Example #1
0
function print_successful_redirect($p_redirect_to)
{
    if (helper_show_queries()) {
        html_meta_redirect($p_redirect_to);
        html_page_top1();
        html_page_top2();
        print '<br /><div class="center">';
        print lang_get('operation_successful') . '<br />';
        print_bracket_link($p_redirect_to, lang_get('proceed'));
        print '</div>';
        html_page_bottom1();
    } else {
        print_header_redirect($p_redirect_to);
    }
}
Example #2
0
function html_footer($p_file)
{
    global $g_timer, $g_queries_array, $g_request_time;
    # If a user is logged in, update their last visit time.
    # We do this at the end of the page so that:
    #  1) we can display the user's last visit time on a page before updating it
    #  2) we don't invalidate the user cache immediately after fetching it
    #  3) don't do this on the password verification or update page, as it causes the
    #    verification comparison to fail
    if (auth_is_user_authenticated() && !(is_page_name('verify.php') || is_page_name('account_update.php'))) {
        $t_user_id = auth_get_current_user_id();
        user_update_last_visit($t_user_id);
    }
    echo "\t", '<br />', "\n";
    echo "\t", '<hr size="1" />', "\n";
    echo '<table border="0" width="100%" cellspacing="0" cellpadding="0"><tr valign="top"><td>';
    if (ON == config_get('show_version')) {
        echo "\t", '<span class="timer"><a href="http://www.mantisbt.org/" title="Free Web Based Bug Tracker">Mantis ', MANTIS_VERSION, '</a>', '[<a href="http://www.mantisbt.org/"  title="Free Web Based Bug Tracker" target="_blank">^</a>]</span>', "\n";
    }
    echo "\t", '<address>Copyright &copy; 2000 - 2008 Mantis Group</address>', "\n";
    # only display webmaster email is current user is not the anonymous user
    if (!is_page_name('login_page.php') && !current_user_is_anonymous()) {
        echo "\t", '<address><a href="mailto:', config_get('webmaster_email'), '">', config_get('webmaster_email'), '</a></address>', "\n";
    }
    # print timings
    if (ON == config_get('show_timer')) {
        $g_timer->print_times();
    }
    # print db queries that were run
    if (helper_show_queries()) {
        $t_count = count($g_queries_array);
        echo "\t", $t_count, ' total queries executed.<br />', "\n";
        $t_unique_queries = 0;
        $t_shown_queries = array();
        for ($i = 0; $i < $t_count; $i++) {
            if (!in_array($g_queries_array[$i][0], $t_shown_queries)) {
                $t_unique_queries++;
                $g_queries_array[$i][3] = false;
                array_push($t_shown_queries, $g_queries_array[$i][0]);
            } else {
                $g_queries_array[$i][3] = true;
            }
        }
        echo "\t", $t_unique_queries . ' unique queries executed.<br />', "\n";
        if (ON == config_get('show_queries_list')) {
            echo "\t", '<table>', "\n";
            $t_total = 0;
            for ($i = 0; $i < $t_count; $i++) {
                $t_time = $g_queries_array[$i][1];
                $t_caller = $g_queries_array[$i][2];
                $t_total += $t_time;
                $t_style_tag = '';
                if (true == $g_queries_array[$i][3]) {
                    $t_style_tag = ' style="color: red;"';
                }
                echo "\t", '<tr valign="top"><td', $t_style_tag, '>', $i + 1, '</td>';
                echo '<td', $t_style_tag, '>', $t_time, '</td>';
                echo '<td', $t_style_tag, '><span style="color: gray;">', $t_caller, '</span><br />', string_html_specialchars($g_queries_array[$i][0]), '</td></tr>', "\n";
            }
            # @@@ Note sure if we should localize them given that they are debug info.  Will add if requested by users.
            echo "\t", '<tr><td></td><td>', $t_total, '</td><td>SQL Queries Total Time</td></tr>', "\n";
            echo "\t", '<tr><td></td><td>', round(microtime_float() - $g_request_time, 4), '</td><td>Page Request Total Time</td></tr>', "\n";
            echo "\t", '</table>', "\n";
        }
    }
    echo '</td><td><div align="right">';
    echo '<a href="http://www.mantisbt.org" title="Free Web Based Bug Tracker"><img src="images/mantis_logo_button.gif" width="88" height="35" alt="Powered by Mantis Bugtracker" border="0" /></a>';
    echo '</div></td></tr></table>';
}
Example #3
0
function graph_bydate($p_metrics, $p_labels, $p_title, $p_graph_width = 300, $p_graph_height = 380)
{
    $t_graph_font = graph_get_font();
    error_check(is_array($p_metrics) ? count($p_metrics) : 0, lang_get('by_date'));
    $graph = new Graph($p_graph_width, $p_graph_height);
    $graph->img->SetMargin(40, 140, 40, 100);
    if (ON == config_get_global('jpgraph_antialias')) {
        $graph->img->SetAntiAliasing();
    }
    $graph->SetScale('linlin');
    $graph->SetMarginColor('white');
    $graph->SetFrame(false);
    $graph->title->Set($p_title . ' ' . lang_get('by_date'));
    $graph->title->SetFont($t_graph_font, FS_BOLD);
    $graph->legend->Pos(0.01, 0.05, 'right', 'top');
    $graph->legend->SetShadow(false);
    $graph->legend->SetFillColor('white');
    $graph->legend->SetLayout(LEGEND_VERT);
    $graph->legend->SetFont($t_graph_font);
    $graph->yaxis->scale->ticks->SetDirection(-1);
    $graph->yaxis->SetFont($t_graph_font);
    $graph->yaxis->scale->SetAutoMin(0);
    if (FF_FONT2 <= $t_graph_font) {
        $graph->xaxis->SetLabelAngle(60);
    } else {
        $graph->xaxis->SetLabelAngle(90);
        # can't rotate non truetype fonts
    }
    $graph->xaxis->SetLabelFormatCallback('graph_date_format');
    $graph->xaxis->SetFont($t_graph_font);
    $t_line_colours = config_get('graph_colors');
    $t_count_colours = count($t_line_colours);
    $t_lines = count($p_metrics) - 1;
    $t_line = array();
    for ($i = 1; $i <= $t_lines; $i++) {
        $t_line[$i] = new LinePlot($p_metrics[$i], $p_metrics[0]);
        $t_line[$i]->SetColor($t_line_colours[$i % $t_count_colours]);
        $t_line[$i]->SetCenter();
        $t_line[$i]->SetLegend(lang_get_defaulted($p_labels[$i]));
        $graph->Add($t_line[$i]);
    }
    if (helper_show_queries()) {
        $graph->subtitle->Set(db_count_queries() . ' queries (' . db_count_unique_queries() . ' unique) (' . db_time_queries() . 'sec)');
        $graph->subtitle->SetFont($t_graph_font, FS_NORMAL, 8);
    }
    $graph->Stroke();
}
Example #4
0
/**
 * (13) Print the page footer information
 * @param string $p_file
 * @return null
 */
function html_footer($p_file = null)
{
    global $g_queries_array, $g_request_time;
    # If a user is logged in, update their last visit time.
    # We do this at the end of the page so that:
    #  1) we can display the user's last visit time on a page before updating it
    #  2) we don't invalidate the user cache immediately after fetching it
    #  3) don't do this on the password verification or update page, as it causes the
    #    verification comparison to fail
    if (auth_is_user_authenticated() && !current_user_is_anonymous() && !(is_page_name('verify.php') || is_page_name('account_update.php'))) {
        $t_user_id = auth_get_current_user_id();
        user_update_last_visit($t_user_id);
    }
    echo "\t", '<br />', "\n";
    echo "\t", '<hr size="1" />', "\n";
    echo '<table border="0" width="100%" cellspacing="0" cellpadding="0"><tr valign="top"><td>';
    if (ON == config_get('show_version')) {
        $t_version_suffix = config_get_global('version_suffix');
        $t_mantis_version = MANTIS_VERSION . ($t_version_suffix ? " {$t_version_suffix}" : '');
        $t_mantis_href = '<a href="http://www.mantisbt.org/" title="Free Web-Based Bug Tracker"';
        echo "\t", '<span class="timer">', "{$t_mantis_href}>MantisBT {$t_mantis_version}</a> ", "[{$t_mantis_href} ", 'target="_blank">^</a>]', "</span>\n";
    }
    echo "\t<address>Copyright &copy; 2000 - ", date('Y'), " MantisBT Team</address>\n";
    # only display webmaster email is current user is not the anonymous user
    if (!is_page_name('login_page.php') && auth_is_user_authenticated() && !current_user_is_anonymous()) {
        echo "\t", '<address><a href="mailto:', config_get('webmaster_email'), '">', config_get('webmaster_email'), '</a></address>', "\n";
    }
    event_signal('EVENT_LAYOUT_PAGE_FOOTER');
    # print timings
    if (ON == config_get('show_timer')) {
        echo '<span class="italic">Time: ' . number_format(microtime(true) - $g_request_time, 4) . ' seconds.</span><br />';
        echo sprintf(lang_get('memory_usage_in_kb'), number_format(memory_get_peak_usage() / 1024)), '<br />';
    }
    # print db queries that were run
    if (helper_show_queries()) {
        $t_count = count($g_queries_array);
        echo "\t";
        echo sprintf(lang_get('total_queries_executed'), $t_count);
        echo "<br />\n";
        if (ON == config_get('show_queries_list')) {
            $t_unique_queries = 0;
            $t_shown_queries = array();
            for ($i = 0; $i < $t_count; $i++) {
                if (!in_array($g_queries_array[$i][0], $t_shown_queries)) {
                    $t_unique_queries++;
                    $g_queries_array[$i][3] = false;
                    array_push($t_shown_queries, $g_queries_array[$i][0]);
                } else {
                    $g_queries_array[$i][3] = true;
                }
            }
            echo "\t";
            echo sprintf(lang_get('unique_queries_executed'), $t_unique_queries);
            echo "\t", '<table>', "\n";
            $t_total = 0;
            for ($i = 0; $i < $t_count; $i++) {
                $t_time = $g_queries_array[$i][1];
                $t_caller = $g_queries_array[$i][2];
                $t_total += $t_time;
                $t_style_tag = '';
                if (true == $g_queries_array[$i][3]) {
                    $t_style_tag = ' style="color: red;"';
                }
                echo "\t", '<tr valign="top"><td', $t_style_tag, '>', $i + 1, '</td>';
                echo '<td', $t_style_tag, '>', $t_time, '</td>';
                echo '<td', $t_style_tag, '><span style="color: gray;">', $t_caller, '</span><br />', string_html_specialchars($g_queries_array[$i][0]), '</td></tr>', "\n";
            }
            # @@@ Note sure if we should localize them given that they are debug info.  Will add if requested by users.
            echo "\t", '<tr><td></td><td>', $t_total, '</td><td>SQL Queries Total Time</td></tr>', "\n";
            echo "\t", '<tr><td></td><td>', round(microtime(true) - $g_request_time, 4), '</td><td>Page Request Total Time</td></tr>', "\n";
            echo "\t", '</table>', "\n";
        }
    }
    echo '</td><td>', "\n\t";
    # We don't have a button anymore, so for now we will only show the resized version of the logo when not on login page.
    if (!is_page_name('login_page')) {
        echo '<div align="right">';
        echo '<a href="http://www.mantisbt.org" title="Free Web Based Bug Tracker"><img src="' . helper_mantis_url('images/mantis_logo.png') . '" width="145" height="50" alt="Powered by Mantis Bugtracker" border="0" /></a>';
        echo '</div>', "\n";
    }
    echo '</td></tr></table>', "\n";
}
Example #5
0
function graph_bydate($p_metrics, $p_labels, $p_title, $p_graph_width = 300, $p_graph_height = 380)
{
    $t_graph_font = graph_get_font();
    error_check(is_array($p_metrics) ? count($p_metrics) : 0, lang_get('by_date'));
    if (plugin_config_get('eczlibrary') == ON) {
        $t_metrics = array();
        $t_dates = array_shift($p_metrics);
        //[0];
        $t_cnt = count($p_metrics);
        foreach ($t_dates as $i => $val) {
            //$t_metrics[$val]
            for ($j = 0; $j < $t_cnt; $j++) {
                $t_metrics[$j][$val] = $p_metrics[$j][$i];
            }
        }
        $graph = new ezcGraphLineChart();
        $graph->background->color = '#FFFFFF';
        $graph->xAxis = new ezcGraphChartElementNumericAxis();
        for ($k = 0; $k < $t_cnt; $k++) {
            $graph->data[$k] = new ezcGraphArrayDataSet($t_metrics[$k]);
            $graph->data[$k]->label = $p_labels[$k + 1];
        }
        $graph->xAxis->labelCallback = 'graph_date_format';
        $graph->xAxis->axisLabelRenderer = new ezcGraphAxisRotatedLabelRenderer();
        $graph->xAxis->axisLabelRenderer->angle = -60;
        $graph->xAxis->axisSpace = 0.15;
        $graph->legend->position = ezcGraph::BOTTOM;
        $graph->legend->background = '#FFFFFF80';
        $graph->driver = new ezcGraphGdDriver();
        //$graph->driver->options->supersampling = 1;
        $graph->driver->options->jpegQuality = 100;
        $graph->driver->options->imageFormat = IMG_JPEG;
        $graph->title = $p_title . ' ' . lang_get('by_date');
        $graph->title->maxHeight = 0.03;
        $graph->options->font = $t_graph_font;
        $graph->renderToOutput($p_graph_width, $p_graph_height);
    } else {
        $graph = new Graph($p_graph_width, $p_graph_height);
        $graph->img->SetMargin(40, 140, 40, 100);
        if (ON == plugin_config_get('jpgraph_antialias')) {
            $graph->img->SetAntiAliasing();
        }
        $graph->SetScale('linlin');
        $graph->SetMarginColor('white');
        $graph->SetFrame(false);
        $graph->title->Set($p_title . ' ' . lang_get('by_date'));
        $graph->title->SetFont($t_graph_font, FS_BOLD);
        $graph->legend->Pos(0.01, 0.05, 'right', 'top');
        $graph->legend->SetShadow(false);
        $graph->legend->SetFillColor('white');
        $graph->legend->SetLayout(LEGEND_VERT);
        $graph->legend->SetFont($t_graph_font);
        $graph->yaxis->scale->ticks->SetDirection(-1);
        $graph->yaxis->SetFont($t_graph_font);
        $graph->yaxis->scale->SetAutoMin(0);
        if (FF_FONT2 <= $t_graph_font) {
            $graph->xaxis->SetLabelAngle(60);
        } else {
            $graph->xaxis->SetLabelAngle(90);
            # can't rotate non truetype fonts
        }
        $graph->xaxis->SetLabelFormatCallback('graph_date_format');
        $graph->xaxis->SetFont($t_graph_font);
        /*		$t_line_colours = plugin_config_get( 'jpgraph_colors' );
        		$t_count_colours = count( $t_line_colours );*/
        $t_lines = count($p_metrics) - 1;
        $t_line = array();
        for ($i = 1; $i <= $t_lines; $i++) {
            $t_line[$i] = new LinePlot($p_metrics[$i], $p_metrics[0]);
            //$t_line[$i]->SetColor( $t_line_colours[$i % $t_count_colours] );
            $t_line[$i]->SetCenter();
            $t_line[$i]->SetLegend($p_labels[$i]);
            $graph->Add($t_line[$i]);
        }
        if (helper_show_queries()) {
            $graph->subtitle->Set(db_count_queries() . ' queries (' . db_time_queries() . 'sec)');
            $graph->subtitle->SetFont($t_graph_font, FS_NORMAL, 8);
        }
        $graph->Stroke();
    }
}