1
0
mirror of https://github.com/dg/dibi.git synced 2025-08-05 21:58:10 +02:00

- updated Nette\Debug

This commit is contained in:
David Grudl
2009-03-08 18:00:36 +00:00
parent 7969289aaa
commit d0097d6c9c

View File

@@ -54,13 +54,13 @@ json_encode($val){if(is_array($val)&&(!$val||array_keys($val)===range(0,count($v
as$k=>$v){$tmp[]=json_encode((string)$k).':'.json_encode($v);}return'{'.implode(',',$tmp).'}';}if(is_string($val)){$val=str_replace(array("\\","\x00"),array("\\\\","\\u0000"),$val);return'"'.addcslashes($val,"\x8\x9\xA\xC\xD/\"").'"';}if(is_int($val)||is_float($val)){return as$k=>$v){$tmp[]=json_encode((string)$k).':'.json_encode($v);}return'{'.implode(',',$tmp).'}';}if(is_string($val)){$val=str_replace(array("\\","\x00"),array("\\\\","\\u0000"),$val);return'"'.addcslashes($val,"\x8\x9\xA\xC\xD/\"").'"';}if(is_int($val)||is_float($val)){return
rtrim(rtrim(number_format($val,5,'.',''),'0'),'.');}if(is_bool($val)){return$val?'true':'false';}return'null';}}if(version_compare(PHP_VERSION,'5.2.2','<')){function rtrim(rtrim(number_format($val,5,'.',''),'0'),'.');}if(is_bool($val)){return$val?'true':'false';}return'null';}}if(version_compare(PHP_VERSION,'5.2.2','<')){function
fixCallback(&$callback){if(is_string($callback)&&strpos($callback,':')){$callback=explode('::',$callback);}if(is_array($callback)&&is_string($callback[0])&&$a=strrpos($callback[0],'\\')){$callback[0]=substr($callback[0],$a+1);}}}else{function fixCallback(&$callback){if(is_string($callback)&&strpos($callback,':')){$callback=explode('::',$callback);}if(is_array($callback)&&is_string($callback[0])&&$a=strrpos($callback[0],'\\')){$callback[0]=substr($callback[0],$a+1);}}}else{function
fixCallback(&$callback){if(is_string($callback)&&$a=strrpos($callback,'\\')){$callback=substr($callback,$a+1);}elseif(is_array($callback)&&is_string($callback[0])&&$a=strrpos($callback[0],'\\')){$callback[0]=substr($callback[0],$a+1);}}}if(version_compare(PHP_VERSION,'5.3.0','<')){function fixCallback(&$callback){if(is_string($callback)&&$a=strrpos($callback,'\\')){$callback=substr($callback,$a+1);}elseif(is_array($callback)&&is_string($callback[0])&&$a=strrpos($callback[0],'\\')){$callback[0]=substr($callback[0],$a+1);}}}function
fixNamespace(&$class){if($a=strrpos($class,'\\')){$class=substr($class,$a+1);}}}else{function fixNamespace(&$class){if($a=strrpos($class,'\\')){$class=substr($class,$a+1);}}final
fixNamespace($foo){}}final
class class
Framework{const Framework{const
NAME='Nette Framework';const
VERSION='0.8';const VERSION='0.8';const
REVISION='180 released on 2008/12/29 13:18:24';final REVISION='223 released on 2009/03/08 06:04:31';final
public public
function function
__construct(){throw __construct(){throw
@@ -83,6 +83,7 @@ static$maxDepth=3;public
static$maxLen=150;public static$maxLen=150;public
static$keysToHide=array('password','passwd','pass','pwd','creditcard','credit card','cc','pin');private static$keysToHide=array('password','passwd','pass','pwd','creditcard','credit card','cc','pin');private
static$enabled=FALSE;private static$enabled=FALSE;private
static$enabledProfiler=FALSE;private
static$firebugDetected;private static$firebugDetected;private
static$ajaxDetected;private static$ajaxDetected;private
static$logFile;private static$logFile;private
@@ -145,18 +146,19 @@ static
function function
processException(Exception$exception,$outputAllowed=FALSE){if(self::$logFile){error_log("PHP Fatal error: Uncaught $exception");$file=@strftime('%d-%b-%Y %H-%M-%S ',Debug::$time).strstr(number_format(Debug::$time,4,'~',''),'~');$file=dirname(self::$logFile)."/exception $file.html";self::$logHandle=@fopen($file,'x');if(self::$logHandle){ob_start(array(__CLASS__,'writeFile'),1);self::paintBlueScreen($exception);ob_end_flush();fclose(self::$logHandle);}if(self::$sendEmails){self::sendEmail((string)$exception);}}elseif(self::$productionMode){}elseif(self::$consoleMode){if($outputAllowed){echo"$exception\n";foreach(self::$colophons processException(Exception$exception,$outputAllowed=FALSE){if(self::$logFile){error_log("PHP Fatal error: Uncaught $exception");$file=@strftime('%d-%b-%Y %H-%M-%S ',Debug::$time).strstr(number_format(Debug::$time,4,'~',''),'~');$file=dirname(self::$logFile)."/exception $file.html";self::$logHandle=@fopen($file,'x');if(self::$logHandle){ob_start(array(__CLASS__,'writeFile'),1);self::paintBlueScreen($exception);ob_end_flush();fclose(self::$logHandle);}if(self::$sendEmails){self::sendEmail((string)$exception);}}elseif(self::$productionMode){}elseif(self::$consoleMode){if($outputAllowed){echo"$exception\n";foreach(self::$colophons
as$callback){foreach((array)call_user_func($callback,'bluescreen')as$line)echo as$callback){foreach((array)call_user_func($callback,'bluescreen')as$line)echo
strip_tags($line)."\n";}}}elseif(self::$firebugDetected&&self::$ajaxDetected&&!headers_sent()){self::fireLog($exception);}elseif($outputAllowed){while(ob_get_level()&&@ob_end_clean());self::paintBlueScreen($exception);}elseif(self::$firebugDetected&&!headers_sent()){self::fireLog($exception);}}public strip_tags($line)."\n";}}}elseif(self::$firebugDetected&&self::$ajaxDetected&&!headers_sent()){self::fireLog($exception);}elseif($outputAllowed){self::paintBlueScreen($exception);}elseif(self::$firebugDetected&&!headers_sent()){self::fireLog($exception);}}public
static static
function function
paintBlueScreen(Exception$exception){$colophons=self::$colophons;if(!function_exists('_netteDebugPrintCode')){function paintBlueScreen(Exception$exception){$internals=array();foreach(array('Object','ObjectMixin')as$class){if(class_exists($class,FALSE)){$rc=new
ReflectionClass($class);$internals[$rc->getFileName()]=TRUE;}}$colophons=self::$colophons;if(!function_exists('_netteDebugPrintCode')){function
_netteDebugPrintCode($file,$line,$count=15){if(function_exists('ini_set')){ini_set('highlight.comment','#999; font-style: italic');ini_set('highlight.default','#000');ini_set('highlight.html','#06b');ini_set('highlight.keyword','#d24; font-weight: bold');ini_set('highlight.string','#080');}$start=max(1,$line-floor($count/2));$source=explode("\n",@highlight_file($file,TRUE));echo$source[0];$source=explode('<br />',$source[1]);array_unshift($source,NULL);$i=$start;while(--$i>=1){if(preg_match('#.*(</?span[^>]*>)#',$source[$i],$m)){if($m[1]!=='</span>')echo$m[1];break;}}$source=array_slice($source,$start,$count,TRUE);end($source);$numWidth=strlen((string)key($source));foreach($source _netteDebugPrintCode($file,$line,$count=15){if(function_exists('ini_set')){ini_set('highlight.comment','#999; font-style: italic');ini_set('highlight.default','#000');ini_set('highlight.html','#06b');ini_set('highlight.keyword','#d24; font-weight: bold');ini_set('highlight.string','#080');}$start=max(1,$line-floor($count/2));$source=explode("\n",@highlight_file($file,TRUE));echo$source[0];$source=explode('<br />',$source[1]);array_unshift($source,NULL);$i=$start;while(--$i>=1){if(preg_match('#.*(</?span[^>]*>)#',$source[$i],$m)){if($m[1]!=='</span>')echo$m[1];break;}}$source=array_slice($source,$start,$count,TRUE);end($source);$numWidth=strlen((string)key($source));foreach($source
as$n=>$s){$s=str_replace(array("\r","\n"),array('',''),$s);if($n===$line){printf("<span class='highlight'>Line %{$numWidth}s: %s\n</span>%s",$n,strip_tags($s),preg_replace('#[^>]*(<[^>]+>)[^<]*#','$1',$s));}else{printf("<span class='line'>Line %{$numWidth}s:</span> %s\n",$n,$s);}}echo'</span></span></code>';}function as$n=>$s){$s=str_replace(array("\r","\n"),array('',''),$s);if($n===$line){printf("<span class='highlight'>Line %{$numWidth}s: %s\n</span>%s",$n,strip_tags($s),preg_replace('#[^>]*(<[^>]+>)[^<]*#','$1',$s));}else{printf("<span class='line'>Line %{$numWidth}s:</span> %s\n",$n,$s);}}echo'</span></span></code>';}function
_netteOpenPanel($name,$collaped){static$id;$id++;?> _netteOpenPanel($name,$collapsed){static$id;$id++;?>
<div class="panel"> <div class="panel">
<h2><a href="#" onclick="return !toggle(this, 'pnl<?php echo$id?>')"><?php echo <h2><a href="#" onclick="return !toggle(this, 'pnl<?php echo$id?>')"><?php echo
htmlSpecialChars($name)?> <span><?php echo$collaped?'&#x25b6;':'&#x25bc;'?></span></a></h2> htmlSpecialChars($name)?> <span><?php echo$collapsed?'&#x25b6;':'&#x25bc;'?></span></a></h2>
<div id="pnl<?php echo$id?>" class="<?php echo$collaped?'collapsed ':''?>inner"> <div id="pnl<?php echo$id?>" class="<?php echo$collapsed?'collapsed ':''?>inner">
<?php <?php
}function }function
_netteClosePanel(){?> _netteClosePanel(){?>
@@ -176,91 +178,108 @@ htmlspecialchars(get_class($exception))?></title>
<style type="text/css"> <style type="text/css">
/* <![CDATA[ */ /* <![CDATA[ */
body { body {
font: 78%/1.5 Verdana, sans-serif;
background: white;
color: #333;
margin: 0 0 2em; margin: 0 0 2em;
padding: 0; padding: 0;
} }
h1 { #netteBluescreen {
font-weight: normal !important; font: 9pt/1.5 Verdana, sans-serif;
font-size: 18pt; background: white;
color: #333;
position: absolute;
left: 0;
top: 0;
width: 100%;
z-index: 23178;
text-align: left;
}
#netteBluescreenIcon {
position: absolute;
right: .5em;
top: .5em;
z-index: 23179;
color: black;
text-decoration: none;
}
#netteBluescreen h1 {
font: 18pt/1.5 Verdana, sans-serif !important;
margin: .6em 0; margin: .6em 0;
} }
h2 { #netteBluescreen h2 {
font-family: sans-serif; font: 14pt/1.5 sans-serif !important;
font-weight: normal;
font-size: 14pt;
color: #888; color: #888;
margin: .6em 0; margin: .6em 0;
} }
a { #netteBluescreen a {
text-decoration: none; text-decoration: none;
color: #4197E3; color: #4197E3;
} }
a span { #netteBluescreen a span {
color: #999; color: #999;
} }
h3 { #netteBluescreen h3 {
font-size: 110%; font: bold 10pt/1.5 Verdana, sans-serif !important;
font-weight: bold;
margin: 1em 0; margin: 1em 0;
padding: 0;
} }
p { margin: .8em 0 } #netteBluescreen p {
margin: .8em 0
pre, code, table {
font-family: Consolas, monospace;
} }
pre, table { #netteBluescreen pre, #netteBluescreen code, #netteBluescreen table {
font: 9pt/1.5 Consolas, monospace !important;
}
#netteBluescreen pre, #netteBluescreen table {
background: #ffffcc; background: #ffffcc;
padding: .4em .7em; padding: .4em .7em;
border: 1px dotted silver; border: 1px dotted silver;
} }
table pre { #netteBluescreen table pre {
padding: 0; padding: 0;
margin: 0; margin: 0;
border: none; border: none;
font-size: 100%;
} }
pre.dump span { #netteBluescreen pre.dump span {
color: #c16549; color: #c16549;
} }
div.panel { #netteBluescreen div.panel {
border-bottom: 1px solid #eee; border-bottom: 1px solid #eee;
padding: 1px 2em; padding: 1px 2em;
} }
div.inner { #netteBluescreen div.inner {
padding: 0.1em 1em 1em; padding: 0.1em 1em 1em;
background: #f5f5f5; background: #f5f5f5;
} }
table { #netteBluescreen table {
border-collapse: collapse; border-collapse: collapse;
width: 100%; width: 100%;
} }
td, th { #netteBluescreen td, #netteBluescreen th {
vertical-align: top; vertical-align: top;
padding: 2px 3px; padding: 2px 3px;
border: 1px solid #eeeebb; border: 1px solid #eeeebb;
} }
ul { #netteBluescreen ul {
font-size: 80%; font: 7pt/1.5 Verdana, sans-serif !important;
padding: 1em 2em 50px;
} }
.highlight, #error { #netteBluescreen .highlight, #netteBluescreenError {
background: red; background: red;
color: white; color: white;
font-weight: bold; font-weight: bold;
@@ -268,7 +287,7 @@ htmlspecialchars(get_class($exception))?></title>
display: block; display: block;
} }
.line { #netteBluescreen .line {
color: #9e9e7e; color: #9e9e7e;
font-weight: normal; font-weight: normal;
font-style: normal; font-style: normal;
@@ -300,200 +319,207 @@ htmlspecialchars(get_class($exception))?></title>
<body> <body>
<div id="error" class="panel"> <div>
<h1><?php echo <a id="netteBluescreenIcon" href="#" onclick="return !toggle(this, 'netteBluescreen')"><span>&#x25bc;</span></a>
htmlspecialchars(get_class($exception)),($exception->getCode()?' #'.$exception->getCode():'')?></h1>
<p><?php echo
htmlspecialchars($exception->getMessage())?></p>
</div> </div>
<div id="netteBluescreen">
<div id="netteBluescreenError" class="panel">
<h1><?php echo
htmlspecialchars(get_class($exception)),($exception->getCode()?' #'.$exception->getCode():'')?></h1>
<p><?php echo
htmlspecialchars($exception->getMessage())?></p>
</div>
<?php $ex=$exception;$level=0;?>
<?php do{?>
<?php if($level++):?> <?php $ex=$exception;$level=0;?>
<?php _netteOpenPanel('Caused by',TRUE)?> <?php do{?>
<div class="panel">
<h1><?php echo <?php if($level++):?>
<?php _netteOpenPanel('Caused by',TRUE)?>
<div class="panel">
<h1><?php echo
htmlspecialchars(get_class($ex)),($ex->getCode()?' #'.$ex->getCode():'')?></h1> htmlspecialchars(get_class($ex)),($ex->getCode()?' #'.$ex->getCode():'')?></h1>
<p><?php echo <p><?php echo
htmlspecialchars($ex->getMessage())?></p> htmlspecialchars($ex->getMessage())?></p>
</div> </div>
<?php endif?> <?php endif?>
<?php if(is_file($ex->getFile())):?> <?php $collapsed=isset($internals[$ex->getFile()]);?>
<?php _netteOpenPanel('Source file',FALSE)?> <?php if(is_file($ex->getFile())):?>
<p><strong>File:</strong> <?php echo <?php _netteOpenPanel('Source file',$collapsed)?>
<p><strong>File:</strong> <?php echo
htmlspecialchars($ex->getFile())?> &nbsp; <strong>Line:</strong> <?php echo$ex->getLine()?></p> htmlspecialchars($ex->getFile())?> &nbsp; <strong>Line:</strong> <?php echo$ex->getLine()?></p>
<pre><?php _netteDebugPrintCode($ex->getFile(),$ex->getLine())?></pre> <pre><?php _netteDebugPrintCode($ex->getFile(),$ex->getLine())?></pre>
<?php _netteClosePanel()?> <?php _netteClosePanel()?>
<?php endif?> <?php endif?>
<?php _netteOpenPanel('Call stack',FALSE)?> <?php _netteOpenPanel('Call stack',FALSE)?>
<ol> <ol>
<?php foreach($ex->getTrace()as$key=>$row):?> <?php foreach($ex->getTrace()as$key=>$row):?>
<li><p> <li><p>
<?php if(isset($row['file'])):?> <?php if(isset($row['file'])):?>
<span title="<?php echo <span title="<?php echo
htmlSpecialChars($row['file'])?>"><?php echo htmlSpecialChars($row['file'])?>"><?php echo
htmlSpecialChars(basename(dirname($row['file']))),'/<b>',htmlSpecialChars(basename($row['file'])),'</b></span> (',$row['line'],')'?> htmlSpecialChars(basename(dirname($row['file']))),'/<b>',htmlSpecialChars(basename($row['file'])),'</b></span> (',$row['line'],')'?>
<?php else:?> <?php else:?>
&lt;PHP inner-code&gt; &lt;PHP inner-code&gt;
<?php endif?> <?php endif?>
<?php if(isset($row['file'])&&is_file($row['file'])):?><a href="#" onclick="return !toggle(this, 'src<?php echo"$level-$key"?>')">source <span>&#x25b6;</span></a> &nbsp; <?php endif?> <?php if(isset($row['file'])&&is_file($row['file'])):?><a href="#" onclick="return !toggle(this, 'src<?php echo"$level-$key"?>')">source <span>&#x25b6;</span></a> &nbsp; <?php endif?>
<?php if(isset($row['class']))echo$row['class'].$row['type']?> <?php if(isset($row['class']))echo$row['class'].$row['type']?>
<?php echo$row['function']?> <?php echo$row['function']?>
(<?php if(!empty($row['args'])):?><a href="#" onclick="return !toggle(this, 'args<?php echo"$level-$key"?>')">arguments <span>&#x25b6;</span></a><?php endif?>) (<?php if(!empty($row['args'])):?><a href="#" onclick="return !toggle(this, 'args<?php echo"$level-$key"?>')">arguments <span>&#x25b6;</span></a><?php endif?>)
</p> </p>
<?php if(!empty($row['args'])):?> <?php if(!empty($row['args'])):?>
<div class="collapsed" id="args<?php echo"$level-$key"?>"> <div class="collapsed" id="args<?php echo"$level-$key"?>">
<table> <table>
<?php <?php
try{$r=isset($row['class'])?new try{$r=isset($row['class'])?new
ReflectionMethod($row['class'],$row['function']):new ReflectionMethod($row['class'],$row['function']):new
ReflectionFunction($row['function']);$params=$r->getParameters();}catch(Exception$e){$params=array();}foreach($row['args']as$k=>$v){echo'<tr><td>',(isset($params[$k])?'$'.$params[$k]->name:"#$k"),'</td><td>';if(isset($params[$k])&&isset($keyFilter[strtolower($params[$k]->name)])){echo'<i>*** hidden ***</i>';}else{echo ReflectionFunction($row['function']);$params=$r->getParameters();}catch(Exception$e){$params=array();}foreach($row['args']as$k=>$v){echo'<tr><td>',(isset($params[$k])?'$'.$params[$k]->name:"#$k"),'</td><td>';if(isset($params[$k])&&isset($keyFilter[strtolower($params[$k]->name)])){echo'<i>*** hidden ***</i>';}else{echo
Debug::dump($v,TRUE);}echo"</td></tr>\n";}?> Debug::dump($v,TRUE);}echo"</td></tr>\n";}?>
</table> </table>
</div> </div>
<?php endif?> <?php endif?>
<?php if(isset($row['file'])&&is_file($row['file'])):?> <?php if(isset($row['file'])&&is_file($row['file'])):?>
<pre class="collapsed" id="src<?php echo"$level-$key"?>"><?php _netteDebugPrintCode($row['file'],$row['line'])?></pre> <pre <?php if(!$collapsed||isset($internals[$row['file']]))echo'class="collapsed"';else$collapsed=FALSE?> id="src<?php echo"$level-$key"?>"><?php _netteDebugPrintCode($row['file'],$row['line'])?></pre>
<?php endif?> <?php endif?>
</li> </li>
<?php endforeach?> <?php endforeach?>
</ol>
<?php _netteClosePanel()?> <?php if(!isset($row)):?>
<li><i>empty</i></li>
<?php endif?>
</ol>
<?php _netteClosePanel()?>
<?php if($ex <?php if($ex
instanceof instanceof
IDebuggable):?> IDebuggable):?>
<?php foreach($ex->getPanels()as$name=>$panel):?> <?php foreach($ex->getPanels()as$name=>$panel):?>
<?php _netteOpenPanel($name,empty($panel['expanded']))?> <?php _netteOpenPanel($name,empty($panel['expanded']))?>
<?php echo$panel['content']?> <?php echo$panel['content']?>
<?php _netteClosePanel()?> <?php _netteClosePanel()?>
<?php endforeach?> <?php endforeach?>
<?php endif?> <?php endif?>
<?php if(isset($ex->context)&&is_array($ex->context)):?> <?php if(isset($ex->context)&&is_array($ex->context)):?>
<?php _netteOpenPanel('Variables',TRUE)?> <?php _netteOpenPanel('Variables',TRUE)?>
<table> <table>
<?php <?php
foreach($ex->context foreach($ex->context
as$k=>$v){echo'<tr><td>$',htmlspecialchars($k),'</td>';echo'<td>',(isset($keyFilter[strtolower($k)])?'<i>*** hidden ***</i>':Debug::dump($v,TRUE)),"</td></tr>\n";}?> as$k=>$v){echo'<tr><td>$',htmlspecialchars($k),'</td>';echo'<td>',(isset($keyFilter[strtolower($k)])?'<i>*** hidden ***</i>':Debug::dump($v,TRUE)),"</td></tr>\n";}?>
</table> </table>
<?php _netteClosePanel()?> <?php _netteClosePanel()?>
<?php endif?> <?php endif?>
<?php }while((method_exists($ex,'getPrevious')&&$ex=$ex->getPrevious())||(isset($ex->previous)&&$ex=$ex->previous));?> <?php }while((method_exists($ex,'getPrevious')&&$ex=$ex->getPrevious())||(isset($ex->previous)&&$ex=$ex->previous));?>
<?php while(--$level)_netteClosePanel()?> <?php while(--$level)_netteClosePanel()?>
<?php _netteOpenPanel('Environment',TRUE)?>
<?php
<?php _netteOpenPanel('Environment',TRUE)?>
<?php
$list=get_defined_constants(TRUE);if(!empty($list['user'])):?> $list=get_defined_constants(TRUE);if(!empty($list['user'])):?>
<h3><a href="#" onclick="return !toggle(this, 'pnl-env-const')">Constants <span>&#x25bc;</span></a></h3> <h3><a href="#" onclick="return !toggle(this, 'pnl-env-const')">Constants <span>&#x25bc;</span></a></h3>
<table id="pnl-env-const"> <table id="pnl-env-const">
<?php <?php
foreach($list['user']as$k=>$v){echo'<tr><td>',htmlspecialchars($k),'</td>';echo'<td>',(isset($keyFilter[strtolower($k)])?'<i>*** hidden ***</i>':Debug::dump($v,TRUE)),"</td></tr>\n";}?> foreach($list['user']as$k=>$v){echo'<tr><td>',htmlspecialchars($k),'</td>';echo'<td>',(isset($keyFilter[strtolower($k)])?'<i>*** hidden ***</i>':Debug::dump($v,TRUE)),"</td></tr>\n";}?>
</table> </table>
<?php endif?> <?php endif?>
<h3><a href="#" onclick="return !toggle(this, 'pnl-env-files')">Included files <span>&#x25b6;</span></a> (<?php echo <h3><a href="#" onclick="return !toggle(this, 'pnl-env-files')">Included files <span>&#x25b6;</span></a> (<?php echo
count(get_included_files())?>)</h3> count(get_included_files())?>)</h3>
<table id="pnl-env-files" class="collapsed"> <table id="pnl-env-files" class="collapsed">
<?php <?php
foreach(get_included_files()as$v){echo'<tr><td>',htmlspecialchars($v),"</td></tr>\n";}?> foreach(get_included_files()as$v){echo'<tr><td>',htmlspecialchars($v),"</td></tr>\n";}?>
</table> </table>
<h3>$_SERVER</h3> <h3>$_SERVER</h3>
<?php if(empty($_SERVER)):?> <?php if(empty($_SERVER)):?>
<p><i>empty</i></p> <p><i>empty</i></p>
<?php else:?> <?php else:?>
<table> <table>
<?php <?php
foreach($_SERVER foreach($_SERVER
as$k=>$v)echo'<tr><td>',htmlspecialchars($k),'</td><td>',Debug::dump($v,TRUE),"</td></tr>\n";?> as$k=>$v)echo'<tr><td>',htmlspecialchars($k),'</td><td>',Debug::dump($v,TRUE),"</td></tr>\n";?>
</table> </table>
<?php endif?> <?php endif?>
<?php _netteClosePanel()?> <?php _netteClosePanel()?>
<?php _netteOpenPanel('HTTP request',TRUE)?>
<?php _netteOpenPanel('HTTP request',TRUE)?> <?php if(function_exists('apache_request_headers')):?>
<?php if(function_exists('apache_request_headers')):?> <h3>Headers</h3>
<h3>Headers</h3> <table>
<table> <?php
<?php
foreach(apache_request_headers()as$k=>$v)echo'<tr><td>',htmlspecialchars($k),'</td><td>',htmlspecialchars($v),"</td></tr>\n";?> foreach(apache_request_headers()as$k=>$v)echo'<tr><td>',htmlspecialchars($k),'</td><td>',htmlspecialchars($v),"</td></tr>\n";?>
</table> </table>
<?php endif?> <?php endif?>
<?php foreach(array('_GET','_POST','_COOKIE')as$name):?> <?php foreach(array('_GET','_POST','_COOKIE')as$name):?>
<h3>$<?php echo$name?></h3> <h3>$<?php echo$name?></h3>
<?php if(empty($GLOBALS[$name])):?> <?php if(empty($GLOBALS[$name])):?>
<p><i>empty</i></p> <p><i>empty</i></p>
<?php else:?> <?php else:?>
<table> <table>
<?php <?php
foreach($GLOBALS[$name]as$k=>$v)echo'<tr><td>',htmlspecialchars($k),'</td><td>',Debug::dump($v,TRUE),"</td></tr>\n";?> foreach($GLOBALS[$name]as$k=>$v)echo'<tr><td>',htmlspecialchars($k),'</td><td>',Debug::dump($v,TRUE),"</td></tr>\n";?>
</table> </table>
<?php endif?> <?php endif?>
<?php endforeach?> <?php endforeach?>
<?php _netteClosePanel()?> <?php _netteClosePanel()?>
<?php _netteOpenPanel('HTTP response',TRUE)?> <?php _netteOpenPanel('HTTP response',TRUE)?>
<h3>Headers</h3> <h3>Headers</h3>
<?php if(headers_list()):?> <?php if(headers_list()):?>
<pre><?php <pre><?php
foreach(headers_list()as$s)echo foreach(headers_list()as$s)echo
htmlspecialchars($s),'<br>';?></pre> htmlspecialchars($s),'<br>';?></pre>
<?php else:?> <?php else:?>
<p><i>no headers</i></p> <p><i>no headers</i></p>
<?php endif?> <?php endif?>
<?php _netteClosePanel()?> <?php _netteClosePanel()?>
<ul> <ul>
<?php foreach($colophons <?php foreach($colophons
as$callback):?> as$callback):?>
<?php foreach((array)call_user_func($callback,'bluescreen')as$line):?><li><?php echo$line,"\n"?></li><?php endforeach?> <?php foreach((array)call_user_func($callback,'bluescreen')as$line):?><li><?php echo$line,"\n"?></li><?php endforeach?>
<?php endforeach?> <?php endforeach?>
</ul> </ul>
</div>
</body> </body>
</html><?php }public </html><?php }public
static static
@@ -508,11 +534,14 @@ defaultMailer($message){$host=isset($_SERVER['HTTP_HOST'])?$_SERVER['HTTP_HOST']
as$key=>$value){$header.="$key: $value\r\n";}$body=str_replace("\r\n","\n",$body);if(PHP_OS!='Linux')$body=str_replace("\n","\r\n",$body);mail($to,$subject,$body,$header);}public as$key=>$value){$header.="$key: $value\r\n";}$body=str_replace("\r\n","\n",$body);if(PHP_OS!='Linux')$body=str_replace("\n","\r\n",$body);mail($to,$subject,$body,$header);}public
static static
function function
enableProfiler(){if(!self::$productionMode){register_shutdown_function(array(__CLASS__,'paintProfiler'));}}public enableProfiler(){self::$enabledProfiler=TRUE;register_shutdown_function(array(__CLASS__,'paintProfiler'));}public
static static
function function
paintProfiler(){$colophons=self::$colophons;if(self::$firebugDetected){self::fireLog('Nette profiler','GROUP_START');foreach(self::$colophons disableProfiler(){self::$enabledProfiler=FALSE;}public
as$callback){foreach((array)call_user_func($callback,'profiler')as$line)self::fireLog(strip_tags($line));}self::fireLog(null,'GROUP_END');}if(!self::$ajaxDetected){?> static
function
paintProfiler(){if(!self::$enabledProfiler||self::$productionMode){return;}self::$enabledProfiler=FALSE;if(self::$firebugDetected){self::fireLog('Nette profiler','GROUP_START');foreach(self::$colophons
as$callback){foreach((array)call_user_func($callback,'profiler')as$line)self::fireLog(strip_tags($line));}self::fireLog(null,'GROUP_END');}if(!self::$ajaxDetected){$colophons=self::$colophons;?>
</pre></xmp> </pre></xmp>
<style type="text/css"> <style type="text/css">
@@ -521,6 +550,7 @@ as$callback){foreach((array)call_user_func($callback,'profiler')as$line)self::fi
position: absolute; position: absolute;
right: 5px; right: 5px;
bottom: 5px; bottom: 5px;
z-index: 23178;
} }
#netteProfiler { #netteProfiler {
@@ -614,8 +644,8 @@ static
function function
fireLog($message,$priority=self::LOG,$label=NULL){if($message fireLog($message,$priority=self::LOG,$label=NULL){if($message
instanceof instanceof
Exception){$priority='TRACE';$message=array('Class'=>get_class($message),'Message'=>$message->getMessage(),'File'=>$message->getFile(),'Line'=>$message->getLine(),'Trace'=>self::replaceObjects($message->getTrace()));}elseif($priority==='GROUP_START'){$label=$message;$message=NULL;}return Exception){$priority='TRACE';$message=array('Class'=>get_class($message),'Message'=>$message->getMessage(),'File'=>$message->getFile(),'Line'=>$message->getLine(),'Trace'=>$message->getTrace());}elseif($priority==='GROUP_START'){$label=$message;$message=NULL;}return
self::fireSend(1,array(array('Type'=>$priority,'Label'=>$label),self::replaceObjects($message)));}private self::fireSend(1,self::replaceObjects(array(array('Type'=>$priority,'Label'=>$label),$message)));}private
static static
function function
fireSend($index,$payload){if(self::$productionMode)return fireSend($index,$payload){if(self::$productionMode)return
@@ -624,5 +654,6 @@ FALSE;header('X-Wf-Protocol-nette: http://meta.wildfirehq.org/Protocol/JsonStrea
TRUE;}static TRUE;}static
private private
function function
replaceObjects($val){if(is_object($val)){return'object '.get_class($val).'';}elseif(is_array($val)){foreach($val replaceObjects($val){if(is_object($val)){return'object '.get_class($val).'';}elseif(is_string($val)){return
iconv('UTF-8','UTF-8//IGNORE',$val);}elseif(is_array($val)){foreach($val
as$k=>$v){unset($val[$k]);$val[$k]=self::replaceObjects($v);}}return$val;}}Debug::init(); as$k=>$v){unset($val[$k]);$val[$k]=self::replaceObjects($v);}}return$val;}}Debug::init();