Esempio n. 1
0
/**
 * Outputs a page directly to the browser, parsing anything which needs to be parsed.
 *
 * @param string The contents of the page.
 */
function output_page($contents)
{
    global $db, $lang, $theme, $plugins, $mybb;
    global $debug, $templatecache, $templatelist, $maintimer, $globaltime, $parsetime;
    $contents = parse_page($contents);
    $totaltime = $maintimer->stop();
    if ($mybb->usergroup['cancp'] == 1) {
        if ($mybb->settings['extraadmininfo'] != 0) {
            $phptime = $maintimer->format($maintimer->totaltime - $db->query_time);
            $query_time = $maintimer->format($db->query_time);
            if ($maintimer->totaltime > 0) {
                $percentphp = number_format($phptime / $maintimer->totaltime * 100, 2);
                $percentsql = number_format($query_time / $maintimer->totaltime * 100, 2);
            } else {
                // if we've got a super fast script...  all we can do is assume something
                $percentphp = 0;
                $percentsql = 0;
            }
            $phpversion = phpversion();
            $serverload = get_server_load();
            if (my_strpos(getenv("REQUEST_URI"), "?")) {
                $debuglink = htmlspecialchars(getenv("REQUEST_URI")) . "&debug=1";
            } else {
                $debuglink = htmlspecialchars(getenv("REQUEST_URI")) . "?debug=1";
            }
            if ($mybb->settings['gzipoutput'] != 0) {
                $gzipen = "Enabled";
            } else {
                $gzipen = "Disabled";
            }
            if (function_exists("memory_get_usage")) {
                $memory_usage = " / Memory Usage: " . get_friendly_size(memory_get_peak_usage(true));
            }
            $other = "PHP version: {$phpversion} / Server Load: {$serverload} / GZip Compression: {$gzipen}";
            $debugstuff = "Generated in {$totaltime} seconds ({$percentphp}% PHP / {$percentsql}% MySQL)<br />SQL Queries: {$db->query_count} /  Global Parsing Time: {$globaltime}{$memory_usage}<br />{$other}<br />[<a href=\"{$debuglink}\" target=\"_blank\">advanced details</a>]<br />";
            $contents = str_replace("<debugstuff>", $debugstuff, $contents);
        }
        if ($mybb->debug_mode == true) {
            debug_page();
        }
    }
    $contents = str_replace("<debugstuff>", "", $contents);
    $contents = $plugins->run_hooks("pre_output_page", $contents);
    if ($mybb->settings['gzipoutput'] == 1) {
        if (version_compare(PHP_VERSION, '4.2.0', '>=')) {
            $contents = gzip_encode($contents, $mybb->settings['gziplevel']);
        } else {
            $contents = gzip_encode($contents);
        }
    }
    @header("Content-type: text/html; charset={$lang->settings['charset']}");
    echo $contents;
    $plugins->run_hooks("post_output_page");
    // If the use shutdown functionality is turned off, run any shutdown related items now.
    if ($mybb->settings['useshutdownfunc'] == 0 && $mybb->use_shutdown != true) {
        run_shutdown();
    }
}
Esempio n. 2
0
/**
 * Outputs a page directly to the browser, parsing anything which needs to be parsed.
 *
 * @param string The contents of the page.
 */
function output_page($contents)
{
    global $db, $lang, $theme, $plugins, $mybb;
    global $debug, $templatecache, $templatelist, $maintimer, $globaltime, $parsetime;
    $contents = parse_page($contents);
    $totaltime = $maintimer->stop();
    $contents = $plugins->run_hooks("pre_output_page", $contents);
    if ($mybb->usergroup['cancp'] == 1) {
        if ($mybb->settings['extraadmininfo'] != 0) {
            $phptime = $maintimer->format($maintimer->totaltime - $db->query_time);
            $query_time = $maintimer->format($db->query_time);
            if ($maintimer->totaltime > 0) {
                $percentphp = number_format($phptime / $maintimer->totaltime * 100, 2);
                $percentsql = number_format($query_time / $maintimer->totaltime * 100, 2);
            } else {
                // if we've got a super fast script...  all we can do is assume something
                $percentphp = 0;
                $percentsql = 0;
            }
            $phpversion = PHP_VERSION;
            $serverload = get_server_load();
            if (my_strpos(getenv("REQUEST_URI"), "?")) {
                $debuglink = htmlspecialchars_uni(getenv("REQUEST_URI")) . "&amp;debug=1";
            } else {
                $debuglink = htmlspecialchars_uni(getenv("REQUEST_URI")) . "?debug=1";
            }
            if ($mybb->settings['gzipoutput'] != 0) {
                $gzipen = "Enabled";
            } else {
                $gzipen = "Disabled";
            }
            $memory_usage = get_memory_usage();
            if ($memory_usage) {
                $memory_usage = " / Memory Usage: " . get_friendly_size($memory_usage);
            } else {
                $memory_usage = '';
            }
            // MySQLi is still MySQL, so present it that way to the user
            $database_server = $db->short_title;
            if ($database_server == 'MySQLi') {
                $database_server = 'MySQL';
            }
            $other = "PHP version: {$phpversion} / Server Load: {$serverload} / GZip Compression: {$gzipen}";
            $debugstuff = "Generated in {$totaltime} seconds ({$percentphp}% PHP / {$percentsql}% " . $database_server . ")<br />SQL Queries: {$db->query_count} /  Global Parsing Time: {$globaltime}{$memory_usage}<br />{$other}<br />[<a href=\"{$debuglink}\" target=\"_blank\">advanced details</a>]<br />";
            $contents = str_replace("<debugstuff>", $debugstuff, $contents);
        }
        if ($mybb->debug_mode == true) {
            debug_page();
        }
    }
    $contents = str_replace("<debugstuff>", "", $contents);
    if ($mybb->settings['gzipoutput'] == 1) {
        $contents = gzip_encode($contents, $mybb->settings['gziplevel']);
    }
    @header("Content-type: text/html; charset={$lang->settings['charset']}");
    echo $contents;
    $plugins->run_hooks("post_output_page");
}
Esempio n. 3
0
/**
 * Outputs a page directly to the browser, parsing anything which needs to be parsed.
 *
 * @param string $contents The contents of the page.
 */
function output_page($contents)
{
    global $db, $lang, $theme, $templates, $plugins, $mybb;
    global $debug, $templatecache, $templatelist, $maintimer, $globaltime, $parsetime;
    $contents = parse_page($contents);
    $totaltime = format_time_duration($maintimer->stop());
    $contents = $plugins->run_hooks("pre_output_page", $contents);
    if ($mybb->usergroup['cancp'] == 1 || $mybb->dev_mode == 1) {
        if ($mybb->settings['extraadmininfo'] != 0) {
            $phptime = $maintimer->totaltime - $db->query_time;
            $query_time = $db->query_time;
            if ($maintimer->totaltime > 0) {
                $percentphp = number_format($phptime / $maintimer->totaltime * 100, 2);
                $percentsql = number_format($query_time / $maintimer->totaltime * 100, 2);
            } else {
                // if we've got a super fast script...  all we can do is assume something
                $percentphp = 0;
                $percentsql = 0;
            }
            $serverload = get_server_load();
            if (my_strpos(getenv("REQUEST_URI"), "?")) {
                $debuglink = htmlspecialchars_uni(getenv("REQUEST_URI")) . "&amp;debug=1";
            } else {
                $debuglink = htmlspecialchars_uni(getenv("REQUEST_URI")) . "?debug=1";
            }
            $memory_usage = get_memory_usage();
            if ($memory_usage) {
                $memory_usage = $lang->sprintf($lang->debug_memory_usage, get_friendly_size($memory_usage));
            } else {
                $memory_usage = '';
            }
            // MySQLi is still MySQL, so present it that way to the user
            $database_server = $db->short_title;
            if ($database_server == 'MySQLi') {
                $database_server = 'MySQL';
            }
            $generated_in = $lang->sprintf($lang->debug_generated_in, $totaltime);
            $debug_weight = $lang->sprintf($lang->debug_weight, $percentphp, $percentsql, $database_server);
            $sql_queries = $lang->sprintf($lang->debug_sql_queries, $db->query_count);
            $server_load = $lang->sprintf($lang->debug_server_load, $serverload);
            eval("\$debugstuff = \"" . $templates->get("debug_summary") . "\";");
            $contents = str_replace("<debugstuff>", $debugstuff, $contents);
        }
        if ($mybb->debug_mode == true) {
            debug_page();
        }
    }
    $contents = str_replace("<debugstuff>", "", $contents);
    if ($mybb->settings['gzipoutput'] == 1) {
        $contents = gzip_encode($contents, $mybb->settings['gziplevel']);
    }
    @header("Content-type: text/html; charset={$lang->settings['charset']}");
    echo $contents;
    $plugins->run_hooks("post_output_page");
}
if(isset($_GET["rules-destination"])){rules_destination_section();exit;}
if(isset($_GET["rules-destination-table"])){rules_destination();exit;}
if(isset($_GET["rules-destination-search"])){rules_destination_search();exit;}
if(isset($_GET["rules-destination-js"])){rules_destination_js();exit;}
if(isset($_GET["rules-destination-popup"])){rules_destination_popup();exit;}
if(isset($_GET["rules-destination-form2"])){rules_destination_form2();exit;}
if(isset($_POST["rules-destination-add"])){rules_destination_create();exit;}
if(isset($_POST["rules-destination-edit"])){rules_destination_edit();exit;}
if(isset($_POST["rules-destination-move"])){rules_destination_move();exit;}
if(isset($_POST["rules-destination-delete"])){rules_destination_delete();exit;}

if(isset($_POST["new-rule"])){rules_create();exit;}
if(isset($_POST["rules-move"])){rules_move();exit;}
if(isset($_POST["rulename"])){rewrite_rule_settings_save();exit;}
if(isset($_GET["debug"])){debug_page();exit;}
if(isset($_GET["debug-search"])){debug_search();exit;}
if(isset($_GET["enable-disable-debug-js"])){debug_disable_js();exit;}
if(isset($_POST["ProxyPacDynamicDebug"])){ProxyPacDynamicDebug();exit;}
if(isset($_POST["empty-debug"])){debug_empty();exit;}
if(isset($_GET["download-debug"])){debug_download();exit;}

popup();




function tabs(){
	popup();
}
    exit;
}
if (isset($_POST["new-rule"])) {
    rules_create();
    exit;
}
if (isset($_POST["rules-move"])) {
    rules_move();
    exit;
}
if (isset($_POST["rulename"])) {
    rewrite_rule_settings_save();
    exit;
}
if (isset($_GET["debug"])) {
    debug_page();
    exit;
}
if (isset($_GET["debug-search"])) {
    debug_search();
    exit;
}
if (isset($_GET["enable-disable-debug-js"])) {
    debug_disable_js();
    exit;
}
if (isset($_POST["ProxyPacDynamicDebug"])) {
    ProxyPacDynamicDebug();
    exit;
}
if (isset($_POST["empty-debug"])) {