示例#1
0
function print_menu()
{
    if (auth_is_user_authenticated()) {
        $t_protected = current_user_get_field('protected');
        $t_current_project = helper_get_current_project();
        print '<table class="width100" cellspacing="0">';
        print '<tr>';
        print '<td class="menu">';
        $t_menu_options = array();
        # Main Page
        $t_menu_options[] = '<a href="main_page.php">' . lang_get('main_link') . '</a>';
        # My View
        $t_menu_options[] = '<a href="my_view_page.php">' . lang_get('my_view_link') . '</a>';
        # View Bugs
        $t_menu_options[] = '<a href="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="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="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="summary_page.php">' . lang_get('summary_link') . '</a>';
        }
        # Project Documentation Page
        if (ON == config_get('enable_project_documentation')) {
            $t_menu_options[] = '<a href="proj_doc_page.php">' . lang_get('docs_link') . '</a>';
        }
        # Project Wiki
        if (wiki_is_enabled()) {
            $t_menu_options[] = '<a href="wiki.php?type=project&amp;id=' . $t_current_project . '">' . lang_get('wiki') . '</a>';
        }
        # Manage Users (admins) or Manage Project (managers) or Manage Custom Fields
        $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 = '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 = 'manage_proj_edit_page.php?project_id=' . $t_current_project;
                } else {
                    $t_link = 'manage_proj_page.php';
                }
            }
            $t_menu_options[] = "<a href=\"{$t_link}\">" . lang_get('manage_link') . '</a>';
        }
        # News Page
        if (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() || access_has_project_level(ADMINISTRATOR)) {
                $t_menu_options[] = '<a href="news_menu_page.php">' . lang_get('edit_news_link') . '</a>';
            } else {
                $t_menu_options[] = '<a href="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 href="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);
        if (config_get('time_tracking_enabled') && config_get('time_tracking_with_billing')) {
            $t_menu_options[] = '<a href="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 href="logout_page.php">' . lang_get('logout_link') . '</a>';
        }
        print implode($t_menu_options, ' | ');
        print '</td>';
        print '<td class="menu right nowrap">';
        print '<form method="post" action="jump_to_bug.php">';
        if (ON == config_get('use_javascript')) {
            $t_bug_label = lang_get('issue_id');
            print "<input type=\"text\" name=\"bug_id\" size=\"10\" class=\"small\" value=\"{$t_bug_label}\" onfocus=\"if (this.value == '{$t_bug_label}') this.value = ''\" onblur=\"if (this.value == '') this.value = '{$t_bug_label}'\" />&nbsp;";
        } else {
            print "<input type=\"text\" name=\"bug_id\" size=\"10\" class=\"small\" />&nbsp;";
        }
        print '<input type="submit" class="button-small" value="' . lang_get('jump') . '" />&nbsp;';
        print '</form>';
        print '</td>';
        print '</tr>';
        print '</table>';
    }
}
print_bracket_link("#bugnotes", lang_get('jump_to_bugnotes'));
?>
</span>

		<!-- Send Bug Reminder -->
	<?php 
if (!current_user_is_anonymous() && !bug_is_readonly($f_bug_id) && access_has_bug_level(config_get('bug_reminder_threshold'), $f_bug_id)) {
    ?>
		<span class="small">
			<?php 
    print_bracket_link('bug_reminder_page.php?bug_id=' . $f_bug_id, lang_get('bug_reminder'));
    ?>
		</span>
	<?php 
}
if (wiki_is_enabled()) {
    ?>
		<span class="small">
			<?php 
    print_bracket_link('wiki.php?id=' . $f_bug_id, lang_get('wiki'));
    ?>
		</span>
	<?php 
}
?>
	</td>

	<!-- prev/next links -->
	<?php 
if ($t_bugslist) {
    ?>
示例#3
0
function wiki_ensure_enabled()
{
    if (!wiki_is_enabled()) {
        access_denied();
    }
}