/** * Prints the page footer, finishes Gzip encoding and terminates execution */ function print_cp_footer() { global $vbulletin, $level, $vbphrase; echo "\r\n\r\n<!-- START CONTROL PANEL FOOTER -->\r\n"; if ($vbulletin->debug) { if (defined('CVS_REVISION')) { $re = '#^\\$' . 'RCS' . 'file: (.*\\.php),v ' . '\\$ - \\$' . 'Revision: ([0-9\\.]+) \\$$#siU'; $cvsversion = preg_replace($re, '\\1, CVS v\\2', CVS_REVISION); } if ($size = sizeof($GLOBALS['DEVDEBUG'])) { $displayarray = array(); $displayarray[] = "<select id=\"moo\"><option selected=\"selected\">DEBUG MESSAGES ({$size})</option>\n" . construct_select_options($GLOBALS['DEVDEBUG'], -1, 1) . "\t</select>"; if (defined('CVS_REVISION')) { $displayarray[] = "<p style=\"font: bold 11px tahoma;\">{$cvsversion}</p>"; } $displayarray[] = "<p style=\"font: bold 11px tahoma;\">SQL Queries (" . $vbulletin->db->querycount . ")</p>"; $buttons = "<input type=\"button\" class=\"button\" value=\"Explain\" onclick=\"window.location = '" . $vbulletin->scriptpath . iif(strpos($vbulletin->scriptpath, '?') > 0, '&', '?') . 'explain=1' . "';\" />" . "\n" . "<input type=\"button\" class=\"button\" value=\"Reload\" onclick=\"window.location = window.location;\" />"; print_form_header('../docs/phrasedev', 'dofindphrase', 0, 1, 'debug', '90%', '_phrasefind'); $displayarray[] =& $buttons; print_cells_row($displayarray, 0, 'thead'); print_table_footer(); echo '<p align="center" class="smallfont">' . date('r T') . '</p>'; } else { echo "<p align=\"center\" class=\"smallfont\">SQL Queries (" . $vbulletin->db->querycount . ") | " . (!empty($cvsversion) ? "{$cvsversion} | " : '') . "<a href=\"" . $vbulletin->scriptpath . iif(strpos($vbulletin->scriptpath, '?') > 0, '&', '?') . "explain=1\">Explain</a></p>"; if (function_exists('memory_get_usage')) { echo "<p align=\"center\" class=\"smallfont\">Memory Usage: " . vb_number_format(round(memory_get_usage() / 1024, 2)) . " KiB</p>"; } } $_REQUEST['do'] = htmlspecialchars_uni($_REQUEST['do']); echo "<script type=\"text/javascript\">window.status = \"" . construct_phrase($vbphrase['logged_in_user_x_executed_y_queries'], $vbulletin->userinfo['username'], $vbulletin->db->querycount) . " \$_REQUEST[do] = '{$_REQUEST['do']}'\";</script>"; } if (!defined('NO_CP_COPYRIGHT')) { $output_version = defined('ADMIN_VERSION_VBULLETIN') ? ADMIN_VERSION_VBULLETIN : $vbulletin->options['templateversion']; echo '<p align="center"><a href="http://www.vbulletin.com/" target="_blank" class="copyright">' . construct_phrase($vbphrase['vbulletin_copyright_orig'], $output_version, date('Y')) . '</a></p>'; } if (!defined('IS_NAV_PANEL') and !defined('NO_PAGE_TITLE') and VB_AREA != 'Upgrade' and VB_AREA != 'Install') { echo "\n</div>"; } echo "\n</body>\n</html>"; ($hook = vBulletinHook::fetch_hook('admin_complete')) ? eval($hook) : false; if ($vbulletin->options['gzipoutput'] and function_exists("ob_start") and function_exists("crc32") and function_exists("gzcompress") and !$vbulletin->nozip) { $text = ob_get_contents(); while (ob_get_level()) { @ob_end_clean(); } if (!(SAPI_NAME == 'apache2handler' and PHP_VERSION <= '4.3.3') and !headers_sent() and SAPI_NAME != 'apache2filter') { $newtext = fetch_gzipped_text($text, $vbulletin->options['gziplevel']); } else { $newtext = $text; } @header('Content-Length: ' . strlen($newtext)); echo $newtext; } flush(); if (defined('NOSHUTDOWNFUNC')) { exec_shut_down(); } // terminate script execution now - DO NOT REMOVE THIS! exit; }
/** * Finishes off the current page (using templates), prints it out to the browser and halts execution * * @param string The HTML of the page to be printed * @param boolean Send the content length header? */ function print_output($vartext, $sendheader = true) { global $querytime, $vbulletin, $show, $vbphrase; if ($vbulletin->options['addtemplatename']) { if ($doctypepos = @strpos($vartext, vB_Template_Runtime::fetchStyleVar('htmldoctype'))) { $comment = substr($vartext, 0, $doctypepos); $vartext = substr($vartext, $doctypepos + strlen(vB_Template_Runtime::fetchStyleVar('htmldoctype'))); $vartext = vB_Template_Runtime::fetchStyleVar('htmldoctype') . "\n" . $comment . $vartext; } } if (!empty($vbulletin->db->explain) OR $vbulletin->debug) { $totaltime = microtime(true) - TIMESTART; $vartext .= "<!-- Page generated in " . vb_number_format($totaltime, 5) . " seconds with " . $vbulletin->db->querycount . " queries -->"; } // set cookies for displayed notices if ($show['notices'] AND !defined('NOPMPOPUP') AND !empty($vbulletin->np_notices_displayed) AND is_array($vbulletin->np_notices_displayed)) { $np_notices_cookie = $_COOKIE[COOKIE_PREFIX . 'np_notices_displayed']; vbsetcookie('np_notices_displayed', ($np_notices_cookie ? "$np_notices_cookie," : '') . implode(',', $vbulletin->np_notices_displayed), false ); } // debug code global $DEVDEBUG, $vbcollapse; if ($vbulletin->debug) { devdebug('php_sapi_name(): ' . SAPI_NAME); $messages = ''; if (is_array($DEVDEBUG)) { foreach($DEVDEBUG AS $debugmessage) { $messages .= "\t<option>" . htmlspecialchars_uni($debugmessage) . "</option>\n"; } } if (!empty(vB_Template::$template_usage)) { $tempusagecache = vB_Template::$template_usage; $_TEMPLATEQUERIES = vB_Template::$template_queries; unset($tempusagecache['board_inactive_warning'], $_TEMPLATEQUERIES['board_inactive_warning']); ksort($tempusagecache); foreach ($tempusagecache AS $template_name => $times) { $tempusagecache["$template_name"] = "<span class=\"shade\" style=\"float:right\">($times)</span>" . ((isset($_TEMPLATEQUERIES["$template_name"]) AND $_TEMPLATEQUERIES["$template_name"]) ? "<span style=\"color:red; font-weight:bold\">$template_name</span>" : $template_name); } } else { $tempusagecache = array(); } $hook_usage = ''; $hook_total = 0; foreach (vBulletinHook::fetch_hookusage() AS $hook_name => $has_code) { $hook_usage .= '<li class="smallfont' . (!$has_code ? ' shade' : '') . '">' . $hook_name . '</li>'; $hook_total++; } if (!$hook_usage) { $hook_usage = '<li class="smallfont"> </li>'; } $phrase_groups = ''; sort($GLOBALS['phrasegroups']); foreach ($GLOBALS['phrasegroups'] AS $phrase_group) { $phrase_groups .= '<li class="smallfont">' . $phrase_group . '</li>'; } if (!$phrase_groups) { $phrase_groups = '<li class="smallfont"> </li>'; } $vbcollapse['collapseimg_debuginfo'] = (!empty($vbcollapse['collapseimg_debuginfo']) ? $vbcollapse['collapseimg_debuginfo'] : ''); $vbcollapse['collapseobj_debuginfo'] = (!empty($vbcollapse['collapseobj_debuginfo']) ? $vbcollapse['collapseobj_debuginfo'] : ''); $debughtml = " <div class=\"block\" id=\"debuginfo\" style=\"width:800px; margin:4px auto;\"> <h2 class=\"blockhead collapse\"> <a style=\"float:" . vB_Template_Runtime::fetchStyleVar('right') . ";\" href=\"" . htmlspecialchars_uni($vbulletin->input->fetch_relpath()) . "#\" title=\"Close Debug Information\" onclick=\"document.getElementById('debuginfo').parentNode.removeChild(document.getElementById('debuginfo')); return false;\">X</a> vBulletin {$vbulletin->options['templateversion']} Debug Information </h2> <div style=\"border:" . vB_Template_Runtime::fetchStyleVar('blockhead_border') . "; border-top:0;\"> <div class=\"blockbody\"> <div class=\"blockrow\"> <ul style=\"list-style:none; margin:0px; padding:0px\"> <li class=\"smallfont\" style=\"display:inline; margin-right:8px\"><span class=\"shade\">Page Generation</span> " . vb_number_format($totaltime, 5) . " seconds</li> " . (function_exists('memory_get_usage') ? "<li class=\"smallfont\" style=\"display:inline; margin-right:8px\"><span class=\"shade\">Memory Usage</span> " . number_format(memory_get_usage() / 1024) . 'KB</li>' : '') . " <li class=\"smallfont\" style=\"display:inline; margin-right:8px\"><span class=\"shade\">Queries Executed</span> " . (empty($_TEMPLATEQUERIES) ? $vbulletin->db->querycount : "<span title=\"Uncached Templates!\" style=\"color:red; font-weight:bold\">{$vbulletin->db->querycount}</span>") . " <a href=\"" . (htmlspecialchars($vbulletin->scriptpath)) . (strpos($vbulletin->scriptpath, '?') === false ? '?' : '&') . "explain=1\" target=\"_blank\" title=\"Explain Queries\">(?)</a></li> </ul> </div> </div> <div class=\"blocksubhead collapse\"> <a style=\"top:5px;\" class=\"collapse\" id=\"collapse_debuginfo_body\" href=\"#top\"><img src=\"" . vB_Template_Runtime::fetchStyleVar('imgdir_button') . "/collapse_40b.png\" alt=\"\" title=\"Collapse Debug Information\" /></a> More Information </div> <div class=\"blockbody\" id=\"debuginfo_body\"> <div class=\"blockrow\"> <div style=\"width:48%; float:left;\"> <div style=\"margin-bottom:6px; font-weight:bold;\">Template Usage (" . sizeof($tempusagecache) . "):</div> <ul style=\"list-style:none; margin:0px; padding:0px\"><li class=\"smallfont\">" . implode('</li><li class="smallfont">', $tempusagecache) . " </li></ul> <hr style=\"margin:10px 0px 10px 0px\" /> <div style=\"margin-bottom:6px; font-weight:bold;\">Phrase Groups Available (" . sizeof($GLOBALS['phrasegroups']) . "):</div> <ul style=\"list-style:none; margin:0px; padding:0px\">$phrase_groups</ul> </div> <div style=\"width:48%; float:right;\"> <div style=\"margin-bottom:6px; font-weight:bold;\">Included Files (" . sizeof($included_files = get_included_files()) . "):</div> <ul style=\"list-style:none; margin:0px; padding:0px\"><li class=\"smallfont\">" . implode('</li><li class="smallfont">', str_replace(str_replace('\\', '/', DIR) . '/', '', preg_replace('#^(.*/)#si', '<span class="shade">./\1</span>', str_replace('\\', '/', $included_files)))) . " </li></ul> <hr style=\"margin:10px 0px 10px 0px\" /> <div style=\"margin-bottom:6px; font-weight:bold;\">Hooks Called ($hook_total):</div> <ul style=\"list-style:none; margin:0px; padding:0px\">$hook_usage</ul> </div> <br style=\"clear:both;\" /> </div> </div> <div class=\"blockbody\"> <div class=\"blockrow\"> <label>Messages:<select style=\"display:block; width:100%\">$messages</select></label> </div> </div> </div> </div> "; $vartext = str_replace('</body>', "<!--start debug html-->$debughtml<!--end debug html-->\n</body>", $vartext); } // end debug code $output = process_replacement_vars($vartext); if ($vbulletin->debug AND function_exists('memory_get_usage')) { $output = preg_replace('#(<!--querycount-->Executed <b>\d+</b> queries<!--/querycount-->)#siU', 'Memory Usage: <strong>' . number_format((memory_get_usage() / 1024)) . 'KB</strong>, \1', $output); } // parse PHP include ################## ($hook = vBulletinHook::fetch_hook('global_complete')) ? eval($hook) : false; // make sure headers sent returns correctly if (ob_get_level() AND ob_get_length()) { ob_end_flush(); } if (!headers_sent()) { if ($vbulletin->options['gzipoutput']) { $output = fetch_gzipped_text($output, $vbulletin->options['gziplevel']); } if ($sendheader) { @header('Content-Length: ' . strlen($output)); } } // Trigger shutdown event $vbulletin->shutdown->shutdown(); if (defined('NOSHUTDOWNFUNC')) { exec_shut_down(); } // show regular page if (empty($vbulletin->db->explain)) { echo $output; } // show explain else { $querytime = $vbulletin->db->time_total; echo "\n<b>Page generated in $totaltime seconds with " . $vbulletin->db->querycount . " queries,\nspending $querytime doing MySQL queries and " . ($totaltime - $querytime) . " doing PHP things.\n\n<hr />Shutdown Queries:</b>" . (defined('NOSHUTDOWNFUNC') ? " <b>DISABLED</b>" : '') . "<hr />\n\n"; } // broken if zlib.output_compression is on with Apache 2 if (SAPI_NAME != 'apache2handler' AND SAPI_NAME != 'apache2filter') { flush(); } exit; }
$template = $templater->render(true, false, true); if ($count > 0) { $template = preg_replace("#@charset .*#i", "", $template); } $count++; $output .= $template; } $output = vB_String::getCssMinifiedText($output); if ($output == '') { // this can happen if an invalid css template name is passed header('Content-Type: text/css'); echo '/* Unable to find css template */'; exit; } if (!headers_sent() and vB::getDatastore()->getOption('gzipoutput')) { $output = fetch_gzipped_text($output, vB::getDatastore()->getOption('gziplevel')); } header('Content-Type: text/css'); header('Cache-control: max-age=31536000, private'); header('Expires: ' . gmdate("D, d M Y H:i:s", TIMENOW + 31536000) . ' GMT'); header('Pragma:'); header('Last-Modified: ' . gmdate('D, d M Y H:i:s', $style['dateline']) . ' GMT'); header('Content-Length: ' . strlen($output)); echo $output; } /*========================================================================*\ || ###################################################################### || # Downloaded: 15:45, Tue Sep 8th 2015 || # CVS: $RCSfile$ - $Revision: 83435 $ || ###################################################################### \*========================================================================*/
/** * Finishes off the current page (using templates), prints it out to the browser and halts execution * * @param string The HTML of the page to be printed * @param boolean Send the content length header? */ function print_output($vartext, $sendheader = true) { global $querytime, $vbulletin, $show, $vbphrase; if ($vbulletin->options['addtemplatename']) { if ($doctypepos = @strpos($vartext, vB_Template_Runtime::fetchStyleVar('htmldoctype'))) { $comment = substr($vartext, 0, $doctypepos); $vartext = substr($vartext, $doctypepos + strlen(vB_Template_Runtime::fetchStyleVar('htmldoctype'))); $vartext = vB_Template_Runtime::fetchStyleVar('htmldoctype') . "\n" . $comment . $vartext; } } if (!empty($vbulletin->db->explain) or $vbulletin->debug) { $totaltime = microtime(true) - TIMESTART; $vartext .= "<!-- Page generated in " . vb_number_format($totaltime, 5) . " seconds with " . $vbulletin->db->querycount . " queries -->"; } // set cookies for displayed notices if ($show['notices'] and !defined('NOPMPOPUP') and !empty($vbulletin->np_notices_displayed) and is_array($vbulletin->np_notices_displayed)) { $np_notices_cookie = $_COOKIE[COOKIE_PREFIX . 'np_notices_displayed']; vbsetcookie('np_notices_displayed', ($np_notices_cookie ? "{$np_notices_cookie}," : '') . implode(',', $vbulletin->np_notices_displayed), false); } // --- / TODO remove this code for vB4 gold------------------------------ // debug code global $DEVDEBUG, $vbcollapse; if ($vbulletin->debug) { devdebug('php_sapi_name(): ' . SAPI_NAME); $messages = ''; if (is_array($DEVDEBUG)) { foreach ($DEVDEBUG as $debugmessage) { $messages .= "\t<option>" . htmlspecialchars_uni($debugmessage) . "</option>\n"; } } if (!empty(vB_Template::$template_usage)) { $tempusagecache = vB_Template::$template_usage; $_TEMPLATEQUERIES = vB_Template::$template_queries; unset($tempusagecache['board_inactive_warning'], $_TEMPLATEQUERIES['board_inactive_warning']); ksort($tempusagecache); foreach ($tempusagecache as $template_name => $times) { $tempusagecache["{$template_name}"] = "<span class=\"shade\" style=\"float:right\">({$times})</span>" . ((isset($_TEMPLATEQUERIES["{$template_name}"]) and $_TEMPLATEQUERIES["{$template_name}"]) ? "<span style=\"color:red; font-weight:bold\">{$template_name}</span>" : $template_name); } } else { $tempusagecache = array(); } $hook_usage = ''; $hook_total = 0; foreach (vBulletinHook::fetch_hookusage() as $hook_name => $has_code) { $hook_usage .= '<li class="smallfont' . (!$has_code ? ' shade' : '') . '">' . $hook_name . '</li>'; $hook_total++; } if (!$hook_usage) { $hook_usage = '<li class="smallfont"> </li>'; } $phrase_groups = ''; sort($GLOBALS['phrasegroups']); foreach ($GLOBALS['phrasegroups'] as $phrase_group) { $phrase_groups .= '<li class="smallfont">' . $phrase_group . '</li>'; } if (!$phrase_groups) { $phrase_groups = '<li class="smallfont"> </li>'; } $vbcollapse['collapseimg_debuginfo'] = !empty($vbcollapse['collapseimg_debuginfo']) ? $vbcollapse['collapseimg_debuginfo'] : ''; $vbcollapse['collapseobj_debuginfo'] = !empty($vbcollapse['collapseobj_debuginfo']) ? $vbcollapse['collapseobj_debuginfo'] : ''; // TODO: This needs to be converted to vb4 style - $stylevar doesn't exist, use vB_Template_Runtime::fetchStyleVar('textdirection') $debughtml = "\r\n\t\t\t<table class=\"tborder\" cellpadding=\"6\" cellspacing=\"1\" border=\"0\" align=\"center\" style=\"margin-top:20px\" id=\"debuginfo\" dir=\"ltr\">\r\n\t\t\t<thead>\r\n\t\t\t\t<tr>\r\n\t\t\t\t\t<th class=\"tcat\" colspan=\"2\" align=\"left\">\r\n\t\t\t\t\t\t<a style=\"float:right\" href=\"#\" title=\"Close Debug Info\" onclick=\"document.getElementById('debuginfo').parentNode.removeChild(document.getElementById('debuginfo')); return false;\">X</a>\r\n\t\t\t\t\t\tvBulletin {$vbulletin->options['templateversion']} Debug Information\r\n\t\t\t\t\t</th>\r\n\t\t\t\t</tr>\r\n\t\t\t\t<tr>\r\n\t\t\t\t\t<td class=\"alt1 smallfont\" colspan=\"2\">\r\n\t\t\t\t\t\t<ul style=\"list-style:none; margin:0px; padding:0px\">\r\n\t\t\t\t\t\t\t<li class=\"smallfont\" style=\"display:inline; margin-right:8px\"><span class=\"shade\">Page Generation</span> " . vb_number_format($totaltime, 5) . " seconds</li>\r\n\t\t\t\t\t\t\t" . (function_exists('memory_get_usage') ? "<li class=\"smallfont\" style=\"display:inline; margin-right:8px\"><span class=\"shade\">Memory Usage</span> " . number_format(memory_get_usage() / 1024) . 'KB</li>' : '') . "\r\n\t\t\t\t\t\t\t<li class=\"smallfont\" style=\"display:inline; margin-right:8px\"><span class=\"shade\">Queries Executed</span> " . (empty($_TEMPLATEQUERIES) ? $vbulletin->db->querycount : "<span title=\"Uncached Templates!\" style=\"color:red; font-weight:bold\">{$vbulletin->db->querycount}</span>") . " <a href=\"" . htmlspecialchars($vbulletin->scriptpath) . (strpos($vbulletin->scriptpath, '?') === false ? '?' : '&') . "explain=1\" target=\"_blank\" title=\"Explain Queries\">(?)</a></li>\r\n\t\t\t\t\t\t</ul>\r\n\t\t\t\t\t</td>\r\n\t\t\t\t</tr>\r\n\t\t\t\t<tr align=\"left\">\r\n\t\t\t\t\t<th class=\"thead\" colspan=\"2\"><a style=\"float:right\" href=\"#\" onclick=\"return toggle_collapse('debuginfo')\"><img id=\"collapseimg_debuginfo\" src=\"" . vB_Template_Runtime::fetchStyleVar('imgdir_button') . "/collapse_thead{$vbcollapse['collapseimg_debuginfo']}.gif\" alt=\"\" border=\"0\" /></a> More Information</th>\r\n\t\t\t\t</tr>\r\n\t\t\t</thead>\r\n\t\t\t<tbody id=\"collapseobj_debuginfo\" style=\"{$vbcollapse['collapseobj_debuginfo']}\">\r\n\t\t\t\t<tr valign=\"top\">\r\n\t\t\t\t\t<td class=\"alt1 smallfont\">\r\n\t\t\t\t\t\t<div style=\"margin-bottom:6px\"><strong>Template Usage (</strong>" . sizeof($tempusagecache) . "<strong>):</strong></div>\r\n\t\t\t\t\t\t<ul style=\"list-style:none; margin:0px; padding:0px\"><li class=\"smallfont\">" . implode('</li><li class="smallfont">', $tempusagecache) . " </li></ul>\r\n\t\t\t\t\t\t<hr style=\"margin:10px 0px 10px 0px\" />\r\n\t\t\t\t\t\t<div style=\"margin-bottom:6px\"><strong>Phrase Groups Available (</strong>" . sizeof($GLOBALS['phrasegroups']) . "<strong>):</strong></div>\r\n\t\t\t\t\t\t<ul style=\"list-style:none; margin:0px; padding:0px\">{$phrase_groups}</ul>\r\n\t\t\t\t\t</td>\r\n\t\t\t\t\t<td class=\"alt1 smallfont\">\r\n\t\t\t\t\t\t<div style=\"margin-bottom:6px\"><strong>Included Files (</strong>" . sizeof($included_files = get_included_files()) . "<strong>):</strong></div>\r\n\t\t\t\t\t\t<ul style=\"list-style:none; margin:0px; padding:0px\"><li class=\"smallfont\">" . implode('</li><li class="smallfont">', str_replace(str_replace('\\', '/', DIR) . '/', '', preg_replace('#^(.*/)#si', '<span class="shade">./\\1</span>', str_replace('\\', '/', $included_files)))) . " </li></ul>\r\n\t\t\t\t\t\t<hr style=\"margin:10px 0px 10px 0px\" />\r\n\t\t\t\t\t\t<div style=\"margin-bottom:6px\"><strong>Hooks Called (</strong>{$hook_total}<strong>):</strong></div>\r\n\t\t\t\t\t\t<ul style=\"list-style:none; margin:0px; padding:0px\">{$hook_usage}</ul>\r\n\t\t\t\t\t</td>\r\n\t\t\t\t</tr>\r\n\t\t\t\t</tbody>\r\n\t\t\t\t<tbody>\r\n\t\t\t\t<tr>\r\n\t\t\t\t\t<td class=\"alt2 smallfont\" colspan=\"2\"><label>Messages:<select style=\"display:block; width:100%\">{$messages}</select></label></td>\r\n\t\t\t\t</tr>\r\n\t\t\t</tbody>\r\n\t\t\t</table>\r\n\t\t"; $vartext = str_replace('</body>', "<!--start debug html-->{$debughtml}<!--end debug html-->\n</body>", $vartext); } // end debug code // --- / TODO remove this code for vB4 gold------------------------------ $output = process_replacement_vars($vartext); if ($vbulletin->debug and function_exists('memory_get_usage')) { $output = preg_replace('#(<!--querycount-->Executed <b>\\d+</b> queries<!--/querycount-->)#siU', 'Memory Usage: <strong>' . number_format(memory_get_usage() / 1024) . 'KB</strong>, \\1', $output); } // parse PHP include ################## ($hook = vBulletinHook::fetch_hook('global_complete')) ? eval($hook) : false; // make sure headers sent returns correctly if (ob_get_level() and ob_get_length()) { ob_end_flush(); } if ($vbulletin->options['gzipoutput'] and !headers_sent()) { $output = fetch_gzipped_text($output, $vbulletin->options['gziplevel']); if ($sendheader and $vbulletin->donegzip) { @header('Content-Length: ' . strlen($output)); } } // Trigger shutdown event $vbulletin->shutdown->shutdown(); if (defined('NOSHUTDOWNFUNC')) { exec_shut_down(); } // show regular page if (empty($vbulletin->db->explain)) { echo $output; } else { $querytime = $vbulletin->db->time_total; echo "\n<b>Page generated in {$totaltime} seconds with " . $vbulletin->db->querycount . " queries,\nspending {$querytime} doing MySQL queries and " . ($totaltime - $querytime) . " doing PHP things.\n\n<hr />Shutdown Queries:</b>" . (defined('NOSHUTDOWNFUNC') ? " <b>DISABLED</b>" : '') . "<hr />\n\n"; } // broken if zlib.output_compression is on with Apache 2 if (SAPI_NAME != 'apache2handler' and SAPI_NAME != 'apache2filter') { flush(); } exit; }
/** * Prints the page footer, finishes Gzip encoding and terminates execution */ function print_cp_footer() { global $vbulletin, $level, $vbphrase; $vb5_config = vB::getConfig(); echo "\r\n\r\n<!-- START CONTROL PANEL FOOTER -->\r\n"; if ($vb5_config['Misc']['debug']) { echo '<br /><br />'; if (defined('CVS_REVISION')) { $re = '#^\\$' . 'RCS' . 'file: (.*\\.php),v ' . '\\$ - \\$' . 'Revision: ([0-9\\.]+) \\$$#siU'; $cvsversion = preg_replace($re, '\\1, CVS v\\2', CVS_REVISION); } if ($size = sizeof($GLOBALS['DEVDEBUG'])) { $displayarray = array(); $displayarray[] = "<select id=\"moo\"><option selected=\"selected\">DEBUG MESSAGES ({$size})</option>\n" . construct_select_options($GLOBALS['DEVDEBUG'], -1, 1) . "\t</select>"; if (defined('CVS_REVISION')) { $displayarray[] = "<p style=\"font: bold 11px tahoma;\">{$cvsversion}</p>"; } $displayarray[] = "<p style=\"font: bold 11px tahoma;\">SQL Queries (" . $vbulletin->db->querycount . ")</p>"; $buttons = "<input type=\"button\" class=\"button\" value=\"Explain\" onclick=\"window.location = '" . $vbulletin->scriptpath . iif(strpos($vbulletin->scriptpath, '?') > 0, '&', '?') . 'explain=1' . "';\" />" . "\n" . "<input type=\"button\" class=\"button\" value=\"Reload\" onclick=\"window.location = window.location;\" />"; print_form_header('../docs/phrasedev', 'dofindphrase', 0, 1, 'debug', '90%', '_phrasefind'); $displayarray[] =& $buttons; print_cells_row($displayarray, 0, 'thead'); print_table_footer(); echo '<p align="center" class="smallfont">' . date('r T') . '</p>'; } else { echo "<p align=\"center\" class=\"smallfont\">SQL Queries (" . $vbulletin->db->querycount . ") | " . (!empty($cvsversion) ? "{$cvsversion} | " : '') . "<a href=\"" . $vbulletin->scriptpath . iif(strpos($vbulletin->scriptpath, '?') > 0, '&', '?') . "explain=1\">Explain</a></p>"; if (function_exists('memory_get_usage')) { echo "<p align=\"center\" class=\"smallfont\">Memory Usage: " . vb_number_format(round(memory_get_usage() / 1024, 2)) . " KiB</p>"; } } $_REQUEST['do'] = htmlspecialchars_uni($_REQUEST['do']); echo "<script type=\"text/javascript\">window.status = \"" . construct_phrase($vbphrase['logged_in_user_x_executed_y_queries'], $vbulletin->userinfo['username'], $vbulletin->db->querycount) . " \$_REQUEST[do] = '{$_REQUEST['do']}'\";</script>"; } if (!defined('NO_CP_COPYRIGHT')) { $output_version = defined('ADMIN_VERSION_VBULLETIN') ? ADMIN_VERSION_VBULLETIN : $vbulletin->options['templateversion']; echo '<div class="acp-footer"><a href="https://www.vbulletin.com/" target="_blank" class="copyright">' . construct_phrase($vbphrase['vbulletin_copyright_orig'], $output_version, date('Y')) . '</a></div>'; } if (!defined('IS_NAV_PANEL') and !defined('NO_PAGE_TITLE') and VB_AREA != 'Upgrade' and VB_AREA != 'Install') { echo "\n</div>"; } if (vB::getDbAssertor()->getDBConnection()->doExplain) { $data = vB::getDbAssertor()->getDBConnection()->getExplain(); if (!empty($data['describe'])) { echo '<div class="query">'; echo '<h4>Describe Queries: (Included in the full listing of queries below)</h4><ul>'; foreach ($data['describe'] as $describe) { echo '<li>' . htmlspecialchars($describe) . '</li>'; } echo '</ul>'; echo '</div>'; } if (!empty($data['duplicates'])) { echo '<div class="query">'; echo '<h4>Duplicate Queries: (Exact textual duplicates, also included in the full listing of queries below)</h4><ul>'; foreach ($data['duplicates'] as $duplicate) { echo '<li>Times run: ' . $duplicate['count'] . '<pre>' . htmlspecialchars($duplicate['query']) . '</pre></li>'; } echo '</ul>'; echo '</div>'; } foreach ($data['explain'] as $i => $query) { echo ' <div class="query"> <h4>SQL Query #' . ($i + 1) . '</h4> <pre>' . htmlspecialchars($query['query']) . '</pre> ' . $query['explain'] . ' <ul> <li>Time Before: ' . $query['timeStart'] . '</li> <li>Time After: ' . $query['timeStop'] . '</li> <li>Time Taken: ' . $query['timeTaken'] . '</li> <li>Memory Before: ' . $query['memoryStart'] . '</li> <li>Memory After: ' . $query['memoryStop'] . '</li> <li>Memory Used: ' . $query['memoryUsed'] . '</li> </ul> </div> '; } $overall = $data['sqltime'] + $data['phptime']; echo '<h1>' . count($data['explain']) . ' Queries Run : Total SQL time was ' . number_format($data['sqltime'], 6) . ' seconds , Total PHP time was ' . number_format($data['phptime'], 6) . ' seconds , Overall time was ' . number_format($overall, 6) . ' seconds.</h1><br />'; } // Legacy Hook 'admin_complete' Removed // if (vB::getDatastore()->getOption('gzipoutput') and function_exists("ob_start") and function_exists("crc32") and function_exists("gzcompress") and !$vbulletin->nozip) { $text = ob_get_contents(); while (ob_get_level()) { @ob_end_clean(); } if (!headers_sent() and SAPI_NAME != 'apache2filter') { $newtext = fetch_gzipped_text($text, vB::getDatastore()->getOption('gziplevel')); } else { $newtext = $text; } if (!headers_sent()) { @header('Content-Length: ' . strlen($newtext)); } echo $newtext; } flush(); //make sure that shutdown functions get called on exit. $vbulletin->shutdown->shutdown(); if (defined('NOSHUTDOWNFUNC')) { exec_shut_down(); } // terminate script execution now - DO NOT REMOVE THIS! exit; }