Exemplo n.º 1
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>';
}
Exemplo n.º 2
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 "<div id=\"footer\">\n";
    echo "\t<hr />\n";
    # 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 "\t<div id=\"powered-by-mantisbt-logo\">\n";
        $t_mantisbt_logo_url = helper_mantis_url('images/mantis_logo.png');
        echo "\t\t<a href=\"http://www.mantisbt.org\" " . "title=\"Mantis Bug Tracker: a free and open source web based bug tracking system.\">" . "<img src=\"{$t_mantisbt_logo_url}\" width=\"102\" height=\"35\" " . "alt=\"Powered by Mantis Bug Tracker: a free and open source web based bug tracking system.\" />" . "</a>\n";
        echo "\t</div>\n";
    }
    # Show optional user-specificed custom copyright statement
    $t_copyright_statement = config_get('copyright_statement');
    if ($t_copyright_statement) {
        echo "\t<address id=\"user-copyright\">{$t_copyright_statement}</address>\n";
    }
    # Show MantisBT version and copyright statement
    $t_version_suffix = '';
    $t_copyright_years = '';
    if (config_get('show_version')) {
        $t_version_suffix = htmlentities(' ' . MANTIS_VERSION . config_get_global('version_suffix'));
        $t_copyright_years = ' 2000 - 2012';
    }
    echo "\t<address id=\"mantisbt-copyright\">Powered by <a href=\"http://www.mantisbt.org\" title=\"Mantis Bug Tracker: a free and open source web based bug tracking system.\">Mantis Bug Tracker</a> (MantisBT){$t_version_suffix}. Copyright &copy;{$t_copyright_years} MantisBT contributors. Licensed under the terms of the <a href=\"http://www.gnu.org/licenses/old-licenses/gpl-2.0.html\" title=\"GNU General Public License (GPL) version 2\">GNU General Public License (GPL) version 2</a> or a later version.</address>\n";
    # Show contact information
    $t_webmaster_contact_information = sprintf(lang_get('webmaster_contact_information'), string_html_specialchars(config_get('webmaster_email')));
    echo "\t<address id=\"webmaster-contact-information\">{$t_webmaster_contact_information}</address>\n";
    event_signal('EVENT_LAYOUT_PAGE_FOOTER');
    # Print horizontal rule if any debugging stats follow
    if (config_get('show_timer') || config_get('show_memory_usage') || config_get('show_queries_count')) {
        echo "\t<hr />\n";
    }
    # Print the page execution time
    if (config_get('show_timer')) {
        $t_page_execution_time = sprintf(lang_get('page_execution_time'), number_format(microtime(true) - $g_request_time, 4));
        echo "\t<p id=\"page-execution-time\">{$t_page_execution_time}</p>\n";
    }
    # Print the page memory usage
    if (config_get('show_memory_usage')) {
        $t_page_memory_usage = sprintf(lang_get('memory_usage_in_kb'), number_format(memory_get_peak_usage() / 1024));
        echo "\t<p id=\"page-memory-usage\">{$t_page_memory_usage}</p>\n";
    }
    # Determine number of unique queries executed
    if (config_get('show_queries_count')) {
        $t_total_queries_count = count($g_queries_array);
        $t_unique_queries_count = 0;
        $t_total_query_execution_time = 0;
        $t_unique_queries = array();
        for ($i = 0; $i < $t_total_queries_count; $i++) {
            if (!in_array($g_queries_array[$i][0], $t_unique_queries)) {
                $t_unique_queries_count++;
                $g_queries_array[$i][3] = false;
                array_push($t_unique_queries, $g_queries_array[$i][0]);
            } else {
                $g_queries_array[$i][3] = true;
            }
            $t_total_query_execution_time += $g_queries_array[$i][1];
        }
        $t_total_queries_executed = sprintf(lang_get('total_queries_executed'), $t_total_queries_count);
        echo "\t<p id=\"total-queries-count\">{$t_total_queries_executed}</p>\n";
        if (config_get_global('db_log_queries')) {
            $t_unique_queries_executed = sprintf(lang_get('unique_queries_executed'), $t_unique_queries_count);
            echo "\t<p id=\"unique-queries-count\">{$t_unique_queries_executed}</p>\n";
        }
        $t_total_query_time = sprintf(lang_get('total_query_execution_time'), $t_total_query_execution_time);
        echo "\t<p id=\"total-query-execution-time\">{$t_total_query_time}</p>\n";
    }
    # Print table of log events
    log_print_to_page();
    echo "</div>\n";
}
Exemplo n.º 3
0
/**
 * (13) Print the page footer information
 * @return void
 */
function html_footer()
{
    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 '<div id="footer">' . "\n";
    echo '<hr />' . "\n";
    # 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 "\t" . '<div id="powered-by-mantisbt-logo">' . "\n";
        $t_mantisbt_logo_url = helper_mantis_url('images/mantis_logo.png');
        echo "\t\t" . '<a href="http://www.mantisbt.org"
			title="Mantis Bug Tracker: a free and open source web based bug tracking system.">
			<img src="' . $t_mantisbt_logo_url . '" width="102" height="35" 
				alt="Powered by Mantis Bug Tracker: a free and open source web based bug tracking system." />
			</a>' . "\n";
        echo "\t" . '</div>' . "\n";
    }
    # Show MantisBT version and copyright statement
    $t_version_suffix = '';
    $t_copyright_years = ' 2000 - ' . date('Y');
    if (config_get('show_version') == ON) {
        $t_version_suffix = ' ' . htmlentities(MANTIS_VERSION . config_get_global('version_suffix'));
    }
    echo '<address id="mantisbt-copyright">' . "\n";
    echo '<address id="version">Powered by <a href="http://www.mantisbt.org" title="bug tracking software">MantisBT ' . $t_version_suffix . "</a></address>\n";
    echo 'Copyright &copy;' . $t_copyright_years . ' MantisBT Team';
    # Show optional user-specified custom copyright statement
    $t_copyright_statement = config_get('copyright_statement');
    if ($t_copyright_statement) {
        echo "\t" . '<address id="user-copyright">' . $t_copyright_statement . '</address>' . "\n";
    }
    echo '</address>' . "\n";
    # Show contact information
    if (!is_page_name('login_page')) {
        $t_webmaster_email = config_get('webmaster_email');
        if (!is_blank($t_webmaster_email)) {
            $t_webmaster_contact_information = sprintf(lang_get('webmaster_contact_information'), string_html_specialchars($t_webmaster_email));
            echo "\t" . '<address id="webmaster-contact-information">' . $t_webmaster_contact_information . '</address>' . "\n";
        }
    }
    event_signal('EVENT_LAYOUT_PAGE_FOOTER');
    # Print horizontal rule if any debugging statistics follow
    if (config_get('show_timer') || config_get('show_memory_usage') || config_get('show_queries_count')) {
        echo "\t" . '<hr />' . "\n";
    }
    # Print the page execution time
    if (config_get('show_timer')) {
        $t_page_execution_time = sprintf(lang_get('page_execution_time'), number_format(microtime(true) - $g_request_time, 4));
        echo "\t" . '<p id="page-execution-time">' . $t_page_execution_time . '</p>' . "\n";
    }
    # Print the page memory usage
    if (config_get('show_memory_usage')) {
        $t_page_memory_usage = sprintf(lang_get('memory_usage_in_kb'), number_format(memory_get_peak_usage() / 1024));
        echo "\t" . '<p id="page-memory-usage">' . $t_page_memory_usage . '</p>' . "\n";
    }
    # Determine number of unique queries executed
    if (config_get('show_queries_count')) {
        $t_total_queries_count = count($g_queries_array);
        $t_unique_queries_count = 0;
        $t_total_query_execution_time = 0;
        $t_unique_queries = array();
        for ($i = 0; $i < $t_total_queries_count; $i++) {
            if (!in_array($g_queries_array[$i][0], $t_unique_queries)) {
                $t_unique_queries_count++;
                $g_queries_array[$i][3] = false;
                array_push($t_unique_queries, $g_queries_array[$i][0]);
            } else {
                $g_queries_array[$i][3] = true;
            }
            $t_total_query_execution_time += $g_queries_array[$i][1];
        }
        $t_total_queries_executed = sprintf(lang_get('total_queries_executed'), $t_total_queries_count);
        echo "\t" . '<p id="total-queries-count">' . $t_total_queries_executed . '</p>' . "\n";
        if (config_get_global('db_log_queries')) {
            $t_unique_queries_executed = sprintf(lang_get('unique_queries_executed'), $t_unique_queries_count);
            echo "\t" . '<p id="unique-queries-count">' . $t_unique_queries_executed . '</p>' . "\n";
        }
        $t_total_query_time = sprintf(lang_get('total_query_execution_time'), $t_total_query_execution_time);
        echo "\t" . '<p id="total-query-execution-time">' . $t_total_query_time . '</p>' . "\n";
    }
    # Print table of log events
    log_print_to_page();
    echo '</div>' . "\n";
}
Exemplo n.º 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";
}
Exemplo n.º 5
0
 private function get_user($p_parsed_from)
 {
     if ($this->_mail_use_reporter) {
         // Always report as mail_reporter
         $t_reporter_id = $this->_mail_reporter_id;
     } else {
         // Try to get the reporting users id
         $t_reporter_id = $this->get_userid_from_email($p_parsed_from['email']);
         if (!$t_reporter_id) {
             if ($this->_mail_auto_signup) {
                 // So, we have to sign up a new user...
                 $t_new_reporter_name = $this->prepare_username($p_parsed_from);
                 if ($t_new_reporter_name !== FALSE && $this->validate_email_address($p_parsed_from['email'])) {
                     if (user_signup($t_new_reporter_name, $p_parsed_from['email'])) {
                         # notify the selected group a new user has signed-up
                         email_notify_new_account($t_new_reporter_name, $p_parsed_from['email']);
                         $t_reporter_id = user_get_id_by_email($p_parsed_from['email']);
                         $t_reporter_name = $t_new_reporter_name;
                         $t_realname = $this->prepare_realname($p_parsed_from, $t_reporter_name);
                         if ($t_realname !== FALSE) {
                             user_set_realname($t_reporter_id, $t_realname);
                         }
                     }
                 }
                 if (!$t_reporter_id) {
                     $this->custom_error('Failed to create user based on: ' . $p_parsed_from['From']);
                 }
             }
         }
         if ((!$t_reporter_id || !user_is_enabled($t_reporter_id)) && $this->_mail_fallback_mail_reporter) {
             // Fall back to the default mail_reporter
             $t_reporter_id = $this->_mail_reporter_id;
         }
     }
     if ($t_reporter_id && user_is_enabled($t_reporter_id)) {
         if (!isset($t_reporter_name)) {
             $t_reporter_name = user_get_field($t_reporter_id, 'username');
         }
         $t_authattemptresult = auth_attempt_script_login($t_reporter_name);
         # last attempt for fallback
         if ($t_authattemptresult === FALSE && $this->_mail_fallback_mail_reporter && $t_reporter_id != $this->_mail_reporter_id && user_is_enabled($this->_mail_reporter_id)) {
             $t_reporter_id = $this->_mail_reporter_id;
             $t_reporter_name = user_get_field($t_reporter_id, 'username');
             $t_authattemptresult = auth_attempt_script_login($t_reporter_name);
         }
         if ($t_authattemptresult === TRUE) {
             user_update_last_visit($t_reporter_id);
             return (int) $t_reporter_id;
         }
     }
     // Normally this function does not get here unless all else failed
     $this->custom_error('Could not get a valid reporter. Email will be ignored');
     return FALSE;
 }