diff options
author | msquare <msquare@notrademark.de> | 2016-09-29 11:28:42 +0200 |
---|---|---|
committer | msquare <msquare@notrademark.de> | 2016-09-29 11:28:42 +0200 |
commit | 4c288e957ec4340af93f980c65eecea6d3a789f4 (patch) | |
tree | a438607b5a1974e86a7fdd6f5da50db6e5356c1c /includes/sys_menu.php | |
parent | e965f8d04150fbd17ee1b5fcbca5ae85bbe6d6bd (diff) |
prohibit inline control structures on includes and index
Diffstat (limited to 'includes/sys_menu.php')
-rw-r--r-- | includes/sys_menu.php | 69 |
1 files changed, 44 insertions, 25 deletions
diff --git a/includes/sys_menu.php b/includes/sys_menu.php index c6e916b4..6896194a 100644 --- a/includes/sys_menu.php +++ b/includes/sys_menu.php @@ -1,8 +1,9 @@ <?php function page_link_to($page) { - if ($page == "") + if ($page == "") { return '?'; + } return '?p=' . $page; } @@ -18,17 +19,21 @@ function header_toolbar() { $toolbar_items = array(); - if (isset($user)) + if (isset($user)) { $toolbar_items[] = toolbar_item_link(page_link_to('shifts') . '&action=next', 'time', User_shift_state_render($user)); + } - if (! isset($user) && in_array('register', $privileges)) + if (! isset($user) && in_array('register', $privileges)) { $toolbar_items[] = toolbar_item_link(page_link_to('register'), 'plus', register_title(), $p == 'register'); + } - if (in_array('login', $privileges)) + if (in_array('login', $privileges)) { $toolbar_items[] = toolbar_item_link(page_link_to('login'), 'log-in', login_title(), $p == 'login'); + } - if (isset($user) && in_array('user_messages', $privileges)) + if (isset($user) && in_array('user_messages', $privileges)) { $toolbar_items[] = toolbar_item_link(page_link_to('user_messages'), 'envelope', user_unread_messages()); + } $hints = []; if (isset($user)) { @@ -37,20 +42,24 @@ function header_toolbar() { // Erzengel Hinweis für unbeantwortete Fragen if ($p != "admin_questions") { $new_questions = admin_new_questions(); - if ($new_questions != "") + if ($new_questions != "") { $hints[] = $new_questions; + } } $unconfirmed_hint = user_angeltypes_unconfirmed_hint(); - if ($unconfirmed_hint != '') + if ($unconfirmed_hint != '') { $hints[] = $unconfirmed_hint; + } - if (! isset($user['planned_departure_date']) || $user['planned_departure_date'] == null) + if (! isset($user['planned_departure_date']) || $user['planned_departure_date'] == null) { $hints[] = info(_("Please enter your planned date of departure on your settings page to give us a feeling for teardown capacities."), true); + } $driver_license_required = user_driver_license_required_hint(); - if ($driver_license_required != '') + if ($driver_license_required != '') { $hints[] = $driver_license_required; + } if (User_is_freeloader($user)) { $hints[] = error(sprintf(_("You freeloaded at least %s shifts. Shift signup is locked. Please go to heavens desk to be unlocked again."), $max_freeloadable_shifts), true); @@ -77,22 +86,27 @@ function header_toolbar() { $glyphicon = 'warning-sign'; } } - if (count($hints) > 0) + if (count($hints) > 0) { $toolbar_items[] = toolbar_popover($glyphicon . ' text-' . $hint_class, '', $hints, 'bg-' . $hint_class); + } $user_submenu = make_langselect(); $user_submenu[] = toolbar_item_divider(); - if (in_array('user_myshifts', $privileges)) + if (in_array('user_myshifts', $privileges)) { $toolbar_items[] = toolbar_item_link(page_link_to('users') . '&action=view', ' icon-icon_angel', $user['Nick'], $p == 'users'); + } - if (in_array('user_settings', $privileges)) + if (in_array('user_settings', $privileges)) { $user_submenu[] = toolbar_item_link(page_link_to('user_settings'), 'list-alt', settings_title(), $p == 'user_settings'); + } - if (in_array('logout', $privileges)) + if (in_array('logout', $privileges)) { $user_submenu[] = toolbar_item_link(page_link_to('logout'), 'log-out', logout_title(), $p == 'logout'); + } - if (count($user_submenu) > 0) + if (count($user_submenu) > 0) { $toolbar_items[] = toolbar_dropdown('', '', $user_submenu); + } return toolbar($toolbar_items, true); } @@ -100,21 +114,23 @@ function header_toolbar() { function make_navigation() { global $p, $privileges; - $menu = array(); - $pages = array( + $menu = []; + $pages = [ "news" => news_title(), "user_meetings" => meetings_title(), "user_shifts" => shifts_title(), "angeltypes" => angeltypes_title(), "user_questions" => questions_title() - ); + ]; - foreach ($pages as $page => $title) - if (in_array($page, $privileges)) + foreach ($pages as $page => $title) { + if (in_array($page, $privileges)) { $menu[] = toolbar_item_link(page_link_to($page), '', $title, $page == $p); + } + } - $admin_menu = array(); - $admin_pages = array( + $admin_menu = []; + $admin_pages = [ "admin_arrive" => admin_arrive_title(), "admin_active" => admin_active_title(), "admin_user" => admin_user_title(), @@ -127,14 +143,17 @@ function make_navigation() { "admin_import" => admin_import_title(), "admin_log" => admin_log_title(), "admin_event_config" => event_config_title() - ); + ]; - foreach ($admin_pages as $page => $title) - if (in_array($page, $privileges)) + foreach ($admin_pages as $page => $title) { + if (in_array($page, $privileges)) { $admin_menu[] = toolbar_item_link(page_link_to($page), '', $title, $page == $p); + } + } - if (count($admin_menu) > 0) + if (count($admin_menu) > 0) { $menu[] = toolbar_dropdown('', _("Admin"), $admin_menu); + } return toolbar($menu); } |