1
0
mirror of https://github.com/e107inc/e107.git synced 2025-07-31 03:40:37 +02:00

support debug output formatting; support popup debug

This commit is contained in:
mrpete
2007-01-17 13:43:14 +00:00
parent e05d8f0fee
commit d250aad939

View File

@@ -11,9 +11,9 @@
| GNU General Public License (http://gnu.org). | GNU General Public License (http://gnu.org).
| |
| $Source: /cvs_backup/e107_0.8/e107_themes/templates/footer_default.php,v $ | $Source: /cvs_backup/e107_0.8/e107_themes/templates/footer_default.php,v $
| $Revision: 1.5 $ | $Revision: 1.6 $
| $Date: 2006-12-17 11:01:05 $ | $Date: 2007-01-17 13:43:14 $
| $Author: streaky $ | $Author: mrpete $
+----------------------------------------------------------------------------+ +----------------------------------------------------------------------------+
*/ */
if (!defined('e107_INIT')) { exit; } if (!defined('e107_INIT')) { exit; }
@@ -28,7 +28,7 @@ global $eTraffic, $error_handler, $db_time, $sql, $sql2, $mySQLserver, $mySQLuse
// Please DO NOT re-order these items without asking first! You WILL break something ;) // Please DO NOT re-order these items without asking first! You WILL break something ;)
// These letters match the USER footer (that's why there may be B.1,B.2) // These letters match the USER footer (that's why there may be B.1,B.2)
// //
// A Ensure sql and traffic objects exist // A Ensure sql and traffic objects exist
// [Next few ONLY if a regular page; not done for popups] // [Next few ONLY if a regular page; not done for popups]
// B Send the footer templated data // B Send the footer templated data
// C Dump any/all traffic and debug information // C Dump any/all traffic and debug information
@@ -39,7 +39,7 @@ global $eTraffic, $error_handler, $db_time, $sql, $sql2, $mySQLserver, $mySQLuse
// G Browser-Server time sync script (must be the last one generated/sent) // G Browser-Server time sync script (must be the last one generated/sent)
// H Final HTML (/body, /html) // H Final HTML (/body, /html)
// I collect and send buffered page, along with needed headers // I collect and send buffered page, along with needed headers
// //
// //
// A Ensure sql and traffic objects exist // A Ensure sql and traffic objects exist
@@ -60,13 +60,10 @@ unset($fh);
if(varset($e107_popup)!=1){ if(varset($e107_popup)!=1){
// //
// B Send footer template // B Send footer template, stop timing, send simple page stats
// //
parseheader(($ph ? $cust_footer : $FOOTER)); parseheader(($ph ? $cust_footer : $FOOTER));
//
// C Dump all debug and traffic information
//
$eTimingStop = microtime(); $eTimingStop = microtime();
global $eTimingStart; global $eTimingStart;
$rendertime = number_format($eTraffic->TimeDelta( $eTimingStart, $eTimingStop ), 4); $rendertime = number_format($eTraffic->TimeDelta( $eTimingStart, $eTimingStop ), 4);
@@ -79,11 +76,17 @@ if(varset($e107_popup)!=1){
if(isset($pref['displaycacheinfo']) && $pref['displaycacheinfo']){ $rinfo .= $cachestring."."; } if(isset($pref['displaycacheinfo']) && $pref['displaycacheinfo']){ $rinfo .= $cachestring."."; }
echo ($rinfo ? "\n<div style='text-align:center' class='smalltext'>{$rinfo}</div>\n" : ""); echo ($rinfo ? "\n<div style='text-align:center' class='smalltext'>{$rinfo}</div>\n" : "");
} // End of regular-page footer (the above NOT done for popups)
//
// C Dump all debug and traffic information
//
if ((ADMIN || $pref['developer']) && E107_DEBUG_LEVEL) { if ((ADMIN || $pref['developer']) && E107_DEBUG_LEVEL) {
global $db_debug; global $db_debug;
echo "\n<!-- DEBUG -->\n"; echo "\n<!-- DEBUG -->\n<div class='e107_debug dbg_info'>";
$db_debug->Show_All(); $db_debug->Show_All();
echo "</div>\n";
} }
/* /*
@@ -96,7 +99,7 @@ if(varset($e107_popup)!=1){
{ {
$c=1; $c=1;
$mySQLInfo = $sql->mySQLinfo; $mySQLInfo = $sql->mySQLinfo;
echo "<table class='fborder' style='width: 100%;'> echo "<div class='e107_debug qry_notice'><table class='fborder' style='width: 100%;'>
<tr> <tr>
<td class='fcaption' style='width: 5%;'>ID</td><td class='fcaption' style='width: 95%;'>SQL Queries</td>\n</tr>\n"; <td class='fcaption' style='width: 5%;'>ID</td><td class='fcaption' style='width: 95%;'>SQL Queries</td>\n</tr>\n";
foreach ($queryinfo as $infovalue) foreach ($queryinfo as $infovalue)
@@ -104,11 +107,9 @@ if(varset($e107_popup)!=1){
echo "<tr>\n<td class='forumheader3' style='width: 5%;'>{$c}</td><td class='forumheader3' style='width: 95%;'>{$infovalue}</td>\n</tr>\n"; echo "<tr>\n<td class='forumheader3' style='width: 5%;'>{$c}</td><td class='forumheader3' style='width: 95%;'>{$infovalue}</td>\n</tr>\n";
$c++; $c++;
} }
echo "</table>"; echo "</table></div>";
} }
} // End of regular-page footer (the above NOT done for popups)
// //
// D Close DB connection. We're done talking to underlying MySQL // D Close DB connection. We're done talking to underlying MySQL
// //
@@ -129,7 +130,7 @@ if ($pref['developer']) {
global $oblev_at_start,$oblev_before_start; global $oblev_at_start,$oblev_before_start;
if (ob_get_level() != $oblev_at_start) { if (ob_get_level() != $oblev_at_start) {
$oblev = ob_get_level(); $oblev = ob_get_level();
$obdbg = "<div style='text-align:center' class='smalltext'>Software defect detected; ob_*() level {$oblev} at end instead of ($oblev_at_start). POPPING EXTRA BUFFERS!</div>"; $obdbg = "<div class='e107_debug ob_err' style='text-align:center' class='smalltext'>Software defect detected; ob_*() level {$oblev} at end instead of ($oblev_at_start). POPPING EXTRA BUFFERS!</div>";
while (ob_get_level() > $oblev_at_start) { while (ob_get_level() > $oblev_at_start) {
ob_end_flush(); ob_end_flush();
} }
@@ -140,7 +141,7 @@ if ($pref['developer']) {
// Devs can re-enable for testing as needed. // Devs can re-enable for testing as needed.
// //
if (0 && $oblev_before_start != 0) { if (0 && $oblev_before_start != 0) {
$obdbg = "<div style='text-align:center' class='smalltext'>Software warning; ob_*() level {$oblev_before_start} at start; this page not properly integrated into its wrapper.</div>"; $obdbg = "<div class='e107_debug ob_err' style='text-align:center' class='smalltext'>Software warning; ob_*() level {$oblev_before_start} at start; this page not properly integrated into its wrapper.</div>";
echo $obdbg; echo $obdbg;
} }
} }
@@ -148,7 +149,7 @@ if ($pref['developer']) {
if((ADMIN == true || $pref['developer']) && $error_handler->debug == true) { if((ADMIN == true || $pref['developer']) && $error_handler->debug == true) {
echo " echo "
<br /><br /> <br /><br />
<div> <div class='e107_debug php_err'>
<h3>PHP Errors:</h3><br /> <h3>PHP Errors:</h3><br />
".$error_handler->return_errors()." ".$error_handler->return_errors()."
</div> </div>
@@ -210,13 +211,13 @@ header("Cache-Control: must-revalidate");
header("ETag: {$etag}"); header("ETag: {$etag}");
$pref['compression_level'] = 6; $pref['compression_level'] = 6;
if(strstr($_SERVER["HTTP_ACCEPT_ENCODING"], "gzip")) { if(strstr(varset($_SERVER["HTTP_ACCEPT_ENCODING"],""), "gzip")) {
$browser_support = true; $browser_support = true;
} }
if(ini_get("zlib.output_compression") == false && function_exists("gzencode")) { if(ini_get("zlib.output_compression") == false && function_exists("gzencode")) {
$server_support = true; $server_support = true;
} }
if(isset($pref['compress_output']) && $pref['compress_output'] == true && $server_support == true && $browser_support == true) { if(varset($pref['compress_output'],false) && $server_support == true && $browser_support == true) {
$level = intval($pref['compression_level']); $level = intval($pref['compression_level']);
$page = gzencode($page, $level); $page = gzencode($page, $level);
header("Content-Encoding: gzip", true); header("Content-Encoding: gzip", true);