function news_ensure_enabled() { if (!news_is_enabled()) { access_denied(); } }
$t_current_user_id = auth_get_current_user_id(); $t_hide_status = config_get('bug_resolved_status_threshold'); echo '<div class="quick-summary-left">'; echo lang_get('open_and_assigned_to_me_label') . lang_get('word_separator'); print_link("view_all_set.php?type=1&handler_id={$t_current_user_id}&hide_status={$t_hide_status}", current_user_get_assigned_open_bug_count(), false, 'subtle'); echo '</div>'; echo '<div class="quick-summary-right">'; echo lang_get('open_and_reported_to_me_label') . lang_get('word_separator'); print_link("view_all_set.php?type=1&reporter_id={$t_current_user_id}&hide_status={$t_hide_status}", current_user_get_reported_open_bug_count(), false, 'subtle'); echo '</div>'; echo '<div class="quick-summary-left">'; echo lang_get('last_visit_label') . lang_get('word_separator'); echo date(config_get('normal_date_format'), current_user_get_field('last_visit')); echo '</div>'; } if (news_is_enabled()) { $t_news_rows = news_get_limited_rows($f_offset, $t_project_id); $t_news_count = count($t_news_rows); if ($t_news_count) { echo '<div id="news-items">'; # Loop through results for ($i = 0; $i < $t_news_count; $i++) { $t_row = $t_news_rows[$i]; # only show VS_PRIVATE posts to configured threshold and above if (VS_PRIVATE == $t_row['view_state'] && !access_has_project_level(config_get('private_news_threshold'))) { continue; } print_news_entry_from_row($t_row); } # end for loop echo '</div>';
/** * Print the main menu * @return null */ function print_menu() { if (auth_is_user_authenticated()) { $t_protected = current_user_get_field('protected'); $t_current_project = helper_get_current_project(); $t_menu_options = array(); # Main Page $t_menu_options[] = '<a href="' . helper_mantis_url('main_page.php') . '">' . lang_get('main_link') . '</a>'; # Plugin / Event added options $t_event_menu_options = event_signal('EVENT_MENU_MAIN_FRONT'); foreach ($t_event_menu_options as $t_plugin => $t_plugin_menu_options) { foreach ($t_plugin_menu_options as $t_callback => $t_callback_menu_options) { if (is_array($t_callback_menu_options)) { $t_menu_options = array_merge($t_menu_options, $t_callback_menu_options); } else { if (!is_null($t_callback_menu_options)) { $t_menu_options[] = $t_callback_menu_options; } } } } # My View $t_menu_options[] = '<a href="' . helper_mantis_url('my_view_page.php">') . lang_get('my_view_link') . '</a>'; # View Bugs $t_menu_options[] = '<a href="' . helper_mantis_url('view_all_bug_page.php">') . lang_get('view_bugs_link') . '</a>'; # Report Bugs if (access_has_project_level(config_get('report_bug_threshold'))) { $t_menu_options[] = string_get_bug_report_link(); } # Changelog Page if (access_has_project_level(config_get('view_changelog_threshold'))) { $t_menu_options[] = '<a href="' . helper_mantis_url('changelog_page.php">') . lang_get('changelog_link') . '</a>'; } # Roadmap Page if (access_has_project_level(config_get('roadmap_view_threshold'))) { $t_menu_options[] = '<a href="' . helper_mantis_url('roadmap_page.php">') . lang_get('roadmap_link') . '</a>'; } # Summary Page if (access_has_project_level(config_get('view_summary_threshold'))) { $t_menu_options[] = '<a href="' . helper_mantis_url('summary_page.php">') . lang_get('summary_link') . '</a>'; } # Project Documentation Page if (ON == config_get('enable_project_documentation')) { $t_menu_options[] = '<a href="' . helper_mantis_url('proj_doc_page.php">') . lang_get('docs_link') . '</a>'; } # Project Wiki if (config_get_global('wiki_enable') == ON) { $t_menu_options[] = '<a href="' . helper_mantis_url('wiki.php?type=project&id=') . $t_current_project . '">' . lang_get('wiki') . '</a>'; } # Plugin / Event added options $t_event_menu_options = event_signal('EVENT_MENU_MAIN'); foreach ($t_event_menu_options as $t_plugin => $t_plugin_menu_options) { foreach ($t_plugin_menu_options as $t_callback => $t_callback_menu_options) { if (is_array($t_callback_menu_options)) { $t_menu_options = array_merge($t_menu_options, $t_callback_menu_options); } else { if (!is_null($t_callback_menu_options)) { $t_menu_options[] = $t_callback_menu_options; } } } } # Manage Users (admins) or Manage Project (managers) or Manage Custom Fields if (access_has_global_level(config_get('manage_site_threshold'))) { $t_link = helper_mantis_url('manage_overview_page.php'); $t_menu_options[] = '<a class="manage-menu-link" href="' . $t_link . '">' . lang_get('manage_link') . '</a>'; } else { $t_show_access = min(config_get('manage_user_threshold'), config_get('manage_project_threshold'), config_get('manage_custom_fields_threshold')); if (access_has_global_level($t_show_access) || access_has_any_project($t_show_access)) { $t_current_project = helper_get_current_project(); if (access_has_global_level(config_get('manage_user_threshold'))) { $t_link = helper_mantis_url('manage_user_page.php'); } else { if (access_has_project_level(config_get('manage_project_threshold'), $t_current_project) && $t_current_project != ALL_PROJECTS) { $t_link = helper_mantis_url('manage_proj_edit_page.php?project_id=') . $t_current_project; } else { $t_link = helper_mantis_url('manage_proj_page.php'); } } $t_menu_options[] = "<a href=\"{$t_link}\">" . lang_get('manage_link') . '</a>'; } } # News Page if (news_is_enabled() && access_has_project_level(config_get('manage_news_threshold'))) { # Admin can edit news for All Projects (site-wide) if (ALL_PROJECTS != helper_get_current_project() || current_user_is_administrator()) { $t_menu_options[] = '<a href="' . helper_mantis_url('news_menu_page.php">') . lang_get('edit_news_link') . '</a>'; } else { $t_menu_options[] = '<a href="' . helper_mantis_url('login_select_proj_page.php">') . lang_get('edit_news_link') . '</a>'; } } # Account Page (only show accounts that are NOT protected) if (OFF == $t_protected) { $t_menu_options[] = '<a class="account-menu-link" href="' . helper_mantis_url('account_page.php">') . lang_get('account_link') . '</a>'; } # Add custom options $t_custom_options = prepare_custom_menu_options('main_menu_custom_options'); $t_menu_options = array_merge($t_menu_options, $t_custom_options); # Time Tracking / Billing if (config_get('time_tracking_enabled') && access_has_global_level(config_get('time_tracking_reporting_threshold'))) { $t_menu_options[] = '<a href="' . helper_mantis_url('billing_page.php">') . lang_get('time_tracking_billing_link') . '</a>'; } # Logout (no if anonymously logged in) if (!current_user_is_anonymous()) { $t_menu_options[] = '<a id="logout-link" href="' . helper_mantis_url('logout_page.php">') . lang_get('logout_link') . '</a>'; } echo '<form method="post" action="' . helper_mantis_url('jump_to_bug.php" class="bug-jump-form">'); echo '<fieldset class="bug-jump">'; # CSRF protection not required here - form does not result in modifications $t_bug_label = lang_get('issue_id'); echo '<input type="hidden" name="bug_label" value="', $t_bug_label, '" />'; echo '<input type="text" name="bug_id" size="10" class="small" /> '; echo '<input type="submit" class="button-small" value="' . lang_get('jump') . '" /> '; echo '</fieldset>'; echo '</form>'; echo '<div class="main-menu">'; echo '<div>'; echo '<ul class="menu">'; echo '<li>'; echo implode($t_menu_options, "</li>\n<li>"); echo '</li>'; echo '</ul>'; echo '</div>'; echo '</div>'; } }
private function get_navbar() { $t_protected = current_user_get_field('protected'); $t_current_project = helper_get_current_project(); $t_menu_options = array(); # Plugin / Event added options $t_event_menu_options = event_signal('EVENT_MENU_MAIN_FRONT'); foreach ($t_event_menu_options as $t_plugin => $t_plugin_menu_options) { foreach ($t_plugin_menu_options as $t_callback => $t_callback_menu_options) { if (is_array($t_callback_menu_options)) { $t_menu_options = array_merge($t_menu_options, $t_callback_menu_options); } else { if (!is_null($t_callback_menu_options)) { $t_menu_options[] = $t_callback_menu_options; } } } } # Home $page = 'main_page.php'; $class = preg_match('/' . str_replace('.php', '', $page) . '/', $_SERVER['REQUEST_URI']) ? 'class="active"' : NULL; $t_menu_options[] = '<li ' . $class . '><a href="' . helper_mantis_url($page) . '">' . lang_get('main_link') . '</a></li>'; # My View $page = 'my_view_page.php'; $class = preg_match('/' . str_replace('.php', '', $page) . '/', $_SERVER['REQUEST_URI']) ? 'class="active"' : NULL; $t_menu_options[] = '<li ' . $class . '><a href="' . helper_mantis_url($page) . '">' . lang_get('my_view_link') . '</a></li>'; # View Bugs $page = 'view_all_bug_page.php'; $class = preg_match('/' . str_replace('.php', '', $page) . '/', $_SERVER['REQUEST_URI']) ? 'class="active"' : NULL; $t_menu_options[] = '<li ' . $class . '><a href="' . helper_mantis_url($page) . '">' . lang_get('view_bugs_link') . '</a></li>'; # Report Bugs if (access_has_project_level(config_get('report_bug_threshold'))) { $page = 'bug_report_page.php'; $class = preg_match('/' . str_replace('.php', '', $page) . '/', $_SERVER['REQUEST_URI']) ? 'class="active"' : NULL; $t_menu_options[] = '<li ' . $class . '><a href="' . helper_mantis_url($page) . '">' . lang_get('report_issue') . '</a></li>'; } # Project Documentation Page if (ON == config_get('enable_project_documentation')) { $page = 'proj_doc_page.php'; $class = preg_match('/' . str_replace('.php', '', $page) . '/', $_SERVER['REQUEST_URI']) ? 'class="active"' : NULL; $t_menu_options[] = '<li ' . $class . '><a href="' . helper_mantis_url($page) . '">' . lang_get('docs_link') . '</a></li>'; } # Project Wiki if (config_get_global('wiki_enable') == ON) { $page = 'wiki.php?type=project&id='; $class = preg_match('/' . str_replace('.php', '', $page) . '/', $_SERVER['REQUEST_URI']) ? 'class="active"' : NULL; $t_menu_options[] = '<li ' . $class . '><a href="' . helper_mantis_url($page) . $t_current_project . '">' . lang_get('wiki') . '</a></li>'; } # Changelog Page if (access_has_project_level(config_get('view_changelog_threshold'))) { $page = 'changelog_page.php'; $class = preg_match('/' . str_replace('.php', '', $page) . '/', $_SERVER['REQUEST_URI']) ? 'class="active"' : NULL; $t_menu_options[] = '<li ' . $class . '><a href="' . helper_mantis_url($page) . '">' . lang_get('changelog_link') . '</a></li>'; } # Roadmap Page if (access_has_project_level(config_get('roadmap_view_threshold'))) { $page = 'roadmap_page.php'; $class = preg_match('/' . str_replace('.php', '', $page) . '/', $_SERVER['REQUEST_URI']) ? 'class="active"' : NULL; $t_menu_options[] = '<li ' . $class . '><a href="' . helper_mantis_url($page) . '">' . lang_get('roadmap_link') . '</a></li>'; } # Summary Page if (access_has_project_level(config_get('view_summary_threshold'))) { $page = 'summary_page.php'; $class = preg_match('/' . str_replace('.php', '', $page) . '/', $_SERVER['REQUEST_URI']) ? 'class="active"' : NULL; $t_menu_options[] = '<li ' . $class . '><a href="' . helper_mantis_url($page) . '">' . lang_get('summary_link') . '</a></li>'; } # News Page if (news_is_enabled() && access_has_project_level(config_get('manage_news_threshold'))) { # Admin can edit news for All Projects (site-wide) if (ALL_PROJECTS != helper_get_current_project() || current_user_is_administrator()) { $page = 'news_menu_page.php'; $class = preg_match('/' . str_replace('.php', '', $page) . '/', $_SERVER['REQUEST_URI']) ? 'class="active"' : NULL; $t_menu_options[] = '<li ' . $class . '><a href="' . helper_mantis_url($page) . '">' . lang_get('edit_news_link') . '</a></li>'; } else { $page = 'login_select_proj_page.php'; $class = preg_match('/' . str_replace('.php', '', $page) . '/', $_SERVER['REQUEST_URI']) ? 'class="active"' : NULL; $t_menu_options[] = '<li ' . $class . '><a href="' . helper_mantis_url($page) . '">' . lang_get('edit_news_link') . '</a></li>'; } } # Add custom options $t_custom_options = prepare_custom_menu_options('main_menu_custom_options'); $t_menu_options = array_merge($t_menu_options, $t_custom_options); # Time Tracking / Billing if (config_get('time_tracking_enabled') && access_has_global_level(config_get('time_tracking_reporting_threshold'))) { $page = 'billing_page.php'; $class = preg_match('/' . str_replace('.php', '', $page) . '/', $_SERVER['REQUEST_URI']) ? 'class="active"' : NULL; $t_menu_options[] = '<li ' . $class . '><a href="' . helper_mantis_url($page) . '">' . lang_get('time_tracking_billing_link') . '</a></li>'; } # echo '<li>'.implode( $t_menu_options, ' </li> <li> ' ). '</li>'; echo implode($t_menu_options, ''); }