Esempio n. 1
0
function html_login_info()
{
    $t_username = current_user_get_field('username');
    $t_access_level = get_enum_element('access_levels', current_user_get_access_level());
    $t_now = date(config_get('complete_date_format'));
    $t_realname = current_user_get_field('realname');
    print '<table class="hide">';
    print '<tr>';
    print '<td class="login-info-left">';
    if (current_user_is_anonymous()) {
        $t_return_page = $_SERVER['PHP_SELF'];
        if (isset($_SERVER['QUERY_STRING'])) {
            $t_return_page .= '?' . $_SERVER['QUERY_STRING'];
        }
        $t_return_page = string_url($t_return_page);
        print lang_get('anonymous') . ' | <a href="login_page.php?return=' . $t_return_page . '">' . lang_get('login_link') . '</a>';
        if (config_get('allow_signup') == ON) {
            print ' | <a href="signup_page.php">' . lang_get('signup_link') . '</a>';
        }
    } else {
        echo lang_get('logged_in_as'), ": <span class=\"italic\">", string_display($t_username), "</span> <span class=\"small\">";
        echo is_blank($t_realname) ? "({$t_access_level})" : "(" . string_display($t_realname) . " - {$t_access_level})";
        echo "</span>";
    }
    print '</td>';
    print '<td class="login-info-middle">';
    print "<span class=\"italic\">{$t_now}</span>";
    print '</td>';
    print '<td class="login-info-right">';
    print '<form method="post" name="form_set_project" action="set_project.php">';
    echo lang_get('email_project'), ': ';
    if (ON == config_get('show_extended_project_browser')) {
        print_extended_project_browser(helper_get_current_project_trace());
    } else {
        if (ON == config_get('use_javascript')) {
            print '<select name="project_id" class="small" onchange="document.forms.form_set_project.submit();">';
        } else {
            print '<select name="project_id" class="small">';
        }
        print_project_option_list(join(';', helper_get_current_project_trace()), true, null, true);
        print '</select> ';
    }
    print '<input type="submit" class="button-small" value="' . lang_get('switch') . '" />';
    if (OFF != config_get('rss_enabled')) {
        # Link to RSS issues feed for the selected project, including authentication details.
        print '<a href="' . rss_get_issues_feed_url() . '">';
        print '<img src="images/rss.gif" alt="' . lang_get('rss') . '" style="border-style: none; margin: 5px; vertical-align: middle;" />';
        print '</a>';
    }
    print '</form>';
    print '</td>';
    print '</tr>';
    print '</table>';
}
Esempio n. 2
0
/**
 * (11) Print the user's account information
 * Also print the select box where users can switch projects
 * @return null
 */
function html_login_info()
{
    $t_username = current_user_get_field('username');
    $t_access_level = get_enum_element('access_levels', current_user_get_access_level());
    $t_now = date(config_get('complete_date_format'));
    $t_realname = current_user_get_field('realname');
    echo '<div id="login-info">';
    if (current_user_is_anonymous()) {
        $t_return_page = $_SERVER['SCRIPT_NAME'];
        if (isset($_SERVER['QUERY_STRING'])) {
            $t_return_page .= '?' . $_SERVER['QUERY_STRING'];
        }
        $t_return_page = string_url($t_return_page);
        echo '<span id="logged-anon-label">' . lang_get('anonymous') . '</span>';
        echo '<span id="login-link"><a href="' . helper_mantis_url('login_page.php?return=' . $t_return_page) . '">' . lang_get('login_link') . '</a></span>';
        if (config_get_global('allow_signup') == ON) {
            echo '<span id="signup-link"><a href="' . helper_mantis_url('signup_page.php') . '">' . lang_get('signup_link') . '</a></span>';
        }
    } else {
        echo '<span id="logged-in-label">' . lang_get('logged_in_as') . '</span>';
        echo '<span id="logged-in-user">' . string_html_specialchars($t_username) . '</span>';
        echo '<span id="logged-in">';
        echo !is_blank($t_realname) ? '<span id="logged-in-realname">' . string_html_specialchars($t_realname) . '</span>' : '';
        echo '<span id="logged-in-accesslevel" class="' . $t_access_level . '">' . $t_access_level . '</span>';
        echo '</span>';
    }
    echo '</div>';
    $t_show_project_selector = true;
    if (count(current_user_get_accessible_projects()) == 1) {
        // >1
        $t_project_ids = current_user_get_accessible_projects();
        $t_project_id = (int) $t_project_ids[0];
        if (count(current_user_get_accessible_subprojects($t_project_id)) == 0) {
            $t_show_project_selector = false;
        }
    }
    if (OFF != config_get('rss_enabled')) {
        echo '<div id="rss-feed">';
        # Link to RSS issues feed for the selected project, including authentication details.
        echo '<a href="' . htmlspecialchars(rss_get_issues_feed_url()) . '">';
        echo '<img src="' . helper_mantis_url('images/rss.png') . '" alt="' . lang_get('rss') . '" title="' . lang_get('rss') . '" />';
        echo '</a>';
        echo '</div>';
    }
    if ($t_show_project_selector) {
        echo '<form method="post" id="form-set-project" action="' . helper_mantis_url('set_project.php') . '">';
        echo '<fieldset id="project-selector">';
        # CSRF protection not required here - form does not result in modifications
        echo '<label for="form-set-project-id">' . lang_get('email_project') . '</label>';
        echo '<select id="form-set-project-id" name="project_id">';
        print_project_option_list(join(';', helper_get_current_project_trace()), true, null, true);
        echo '</select> ';
        echo '<input type="submit" class="button" value="' . lang_get('switch') . '" />';
        echo '</fieldset>';
        echo '</form>';
        echo '<div id="current-time">' . $t_now . '</div>';
    } else {
        echo '<div id="current-time-centered">' . $t_now . '</div>';
    }
}
Esempio n. 3
0
/**
 * (11) Print the user's account information
 * Also print the select box where users can switch projects
 * @return null
 */
function html_login_info()
{
    $t_username = current_user_get_field('username');
    $t_access_level = get_enum_element('access_levels', current_user_get_access_level());
    $t_now = date(config_get('complete_date_format'));
    $t_realname = current_user_get_field('realname');
    echo '<table class="hide">';
    echo '<tr>';
    echo '<td class="login-info-left">';
    if (current_user_is_anonymous()) {
        $t_return_page = $_SERVER['SCRIPT_NAME'];
        if (isset($_SERVER['QUERY_STRING'])) {
            $t_return_page .= '?' . $_SERVER['QUERY_STRING'];
        }
        $t_return_page = string_url($t_return_page);
        echo lang_get('anonymous') . ' | <a href="' . helper_mantis_url('login_page.php?return=' . $t_return_page) . '">' . lang_get('login_link') . '</a>';
        if (config_get_global('allow_signup') == ON) {
            echo ' | <a href="' . helper_mantis_url('signup_page.php') . '">' . lang_get('signup_link') . '</a>';
        }
    } else {
        echo lang_get('logged_in_as'), ": <span class=\"italic\">", string_html_specialchars($t_username), "</span> <span class=\"small\">";
        echo is_blank($t_realname) ? "({$t_access_level})" : "(" . string_html_specialchars($t_realname) . " - {$t_access_level})";
        echo "</span>";
    }
    echo '</td>';
    echo '<td class="login-info-middle">';
    echo "<span class=\"italic\">{$t_now}</span>";
    echo '</td>';
    echo '<td class="login-info-right">';
    # Project Selector hidden if only one project visisble to user
    $t_show_project_selector = true;
    $t_project_ids = current_user_get_accessible_projects();
    if (count($t_project_ids) == 1) {
        $t_project_id = (int) $t_project_ids[0];
        if (count(current_user_get_accessible_subprojects($t_project_id)) == 0) {
            $t_show_project_selector = false;
        }
    }
    if ($t_show_project_selector) {
        echo '<form method="post" name="form_set_project" action="' . helper_mantis_url('set_project.php') . '">';
        # CSRF protection not required here - form does not result in modifications
        echo lang_get('email_project'), ': ';
        if (ON == config_get('show_extended_project_browser')) {
            print_extended_project_browser(helper_get_current_project_trace());
        } else {
            if (ON == config_get('use_javascript')) {
                echo '<select name="project_id" class="small" onchange="document.forms.form_set_project.submit();">';
            } else {
                echo '<select name="project_id" class="small">';
            }
            print_project_option_list(join(';', helper_get_current_project_trace()), true, null, true);
            echo '</select> ';
        }
        echo '<input type="submit" class="button-small" value="' . lang_get('switch') . '" />';
        echo '</form>';
    } else {
        # User has only one project, set it as both current and default
        if (ALL_PROJECTS == helper_get_current_project()) {
            helper_set_current_project($t_project_id);
            if (!current_user_is_protected()) {
                current_user_set_default_project($t_project_id);
            }
            # Force reload of current page, except if we got here after
            # creating the first project
            $t_redirect_url = str_replace(config_get('short_path'), '', $_SERVER['REQUEST_URI']);
            if ('manage_proj_create.php' != $t_redirect_url) {
                html_meta_redirect($t_redirect_url, 0, false);
            }
        }
    }
    if (OFF != config_get('rss_enabled')) {
        # Link to RSS issues feed for the selected project, including authentication details.
        echo '<a href="' . htmlspecialchars(rss_get_issues_feed_url()) . '">';
        echo '<img src="' . helper_mantis_url('images/rss.png') . '" alt="' . lang_get('rss') . '" style="border-style: none; margin: 5px; vertical-align: middle;" />';
        echo '</a>';
    }
    echo '</td>';
    echo '</tr>';
    echo '</table>';
}
Esempio n. 4
0
$t_rss_enabled = config_get('rss_enabled');
?>
<br />
<div>
<table class="width75" cellspacing="0">
<?php 
$t_column_count = 0;
$t_max_column_count = 2;
foreach ($t_query_arr as $t_id => $t_name) {
    if ($t_column_count == 0) {
        print '<tr>';
    }
    print '<td>';
    if (OFF != $t_rss_enabled) {
        # Use the "new" RSS link style.
        print_rss(rss_get_issues_feed_url(null, null, $t_id), lang_get('rss'));
        echo ' ';
    }
    $t_query_id = (int) $t_id;
    print_link('view_all_set.php?type=3&source_query_id=' . $t_query_id, $t_name);
    if (filter_db_can_delete_filter($t_id)) {
        echo ' ';
        print_button('query_delete_page.php?source_query_id=' . $t_query_id, lang_get('delete_query'));
    }
    print '</td>';
    $t_column_count++;
    if ($t_column_count == $t_max_column_count) {
        print '</tr>';
        $t_column_count = 0;
    }
}
Esempio n. 5
0
/**
 * (10) Print the user's account information
 * Also print the select box where users can switch projects
 * @return void
 */
function html_login_info()
{
    $t_username = current_user_get_field('username');
    $t_access_level = get_enum_element('access_levels', current_user_get_access_level());
    $t_now = date(config_get('complete_date_format'));
    $t_realname = current_user_get_field('realname');
    # Login information
    echo '<div id="login-info">' . "\n";
    if (current_user_is_anonymous()) {
        $t_return_page = $_SERVER['SCRIPT_NAME'];
        if (isset($_SERVER['QUERY_STRING'])) {
            $t_return_page .= '?' . $_SERVER['QUERY_STRING'];
        }
        $t_return_page = string_url($t_return_page);
        echo "\t" . '<span id="logged-anon-label">' . lang_get('anonymous') . '</span>' . "\n";
        echo "\t" . '<span id="login-link"><a href="' . helper_mantis_url('login_page.php?return=' . $t_return_page) . '">' . lang_get('login_link') . '</a></span>' . "\n";
        if (config_get_global('allow_signup') == ON) {
            echo "\t" . '<span id="signup-link"><a href="' . helper_mantis_url('signup_page.php') . '">' . lang_get('signup_link') . '</a></span>' . "\n";
        }
    } else {
        echo "\t" . '<span id="logged-in-label">' . lang_get('logged_in_as') . '</span>' . "\n";
        echo "\t" . '<span id="logged-in-user">' . string_html_specialchars($t_username) . '</span>' . "\n";
        echo "\t" . '<span id="logged-in">';
        echo !is_blank($t_realname) ? "\t" . '<span id="logged-in-realname">' . string_html_specialchars($t_realname) . '</span>' . "\n" : '';
        echo "\t" . '<span id="logged-in-accesslevel" class="' . $t_access_level . '">' . $t_access_level . '</span>' . "\n";
        echo "\t" . '</span>' . "\n";
    }
    echo '</div>' . "\n";
    # RSS feed
    if (OFF != config_get('rss_enabled')) {
        echo '<div id="rss-feed">' . "\n";
        # Link to RSS issues feed for the selected project, including authentication details.
        echo "\t" . '<a href="' . htmlspecialchars(rss_get_issues_feed_url()) . '">' . "\n";
        echo "\t" . '<img src="' . helper_mantis_url('images/rss.png') . '" alt="' . lang_get('rss') . '" title="' . lang_get('rss') . '" />' . "\n";
        echo "\t" . '</a>' . "\n";
        echo '</div>' . "\n";
    }
    # Project Selector (hidden if only one project visisble to user)
    $t_show_project_selector = true;
    $t_project_ids = current_user_get_accessible_projects();
    if (count($t_project_ids) == 1) {
        $t_project_id = (int) $t_project_ids[0];
        if (count(current_user_get_accessible_subprojects($t_project_id)) == 0) {
            $t_show_project_selector = false;
        }
    }
    if ($t_show_project_selector) {
        echo '<div id="project-selector-div">';
        echo '<form method="post" id="form-set-project" action="' . helper_mantis_url('set_project.php') . '">';
        echo '<fieldset id="project-selector">';
        # CSRF protection not required here - form does not result in modifications
        echo '<label for="form-set-project-id">' . lang_get('email_project') . '</label>';
        echo '<select id="form-set-project-id" name="project_id">';
        print_project_option_list(join(';', helper_get_current_project_trace()), true, null, true);
        echo '</select> ';
        echo '<input type="submit" class="button" value="' . lang_get('switch') . '" />';
        echo '</fieldset>';
        echo '</form>';
        echo '</div>';
    } else {
        # User has only one project, set it as both current and default
        if (ALL_PROJECTS == helper_get_current_project()) {
            helper_set_current_project($t_project_id);
            if (!current_user_is_protected()) {
                current_user_set_default_project($t_project_id);
            }
            # Force reload of current page, except if we got here after
            # creating the first project
            $t_redirect_url = str_replace(config_get('short_path'), '', $_SERVER['REQUEST_URI']);
            if ('manage_proj_create.php' != $t_redirect_url) {
                html_meta_redirect($t_redirect_url, 0, false);
            }
        }
    }
    # Current time
    echo '<div id="current-time">' . $t_now . '</div>';
}