summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--it_debug.class15
1 files changed, 6 insertions, 9 deletions
diff --git a/it_debug.class b/it_debug.class
index b7df95b..89258fd 100644
--- a/it_debug.class
+++ b/it_debug.class
@@ -79,11 +79,11 @@ static function srcline($stackoffs = 0)
static function dump($args)
{
if ((preg_match('/csv|txt|gif|jpg/', $_SERVER['PHP_SELF']) || preg_grep('#text/(calendar|css|javascript|json|plain|rfc822|xml)|application/#', headers_list()) || $GLOBALS['debug_edplain']) && !$GLOBALS['debug_edhtml'])
- $plain = 1;
+ ;
else if ($_SERVER['REMOTE_ADDR'])
list($blue, $noblue, $htmlok) = array("<span style='color:#00c'>", "</span>", 1);
else if (posix_isatty(STDOUT))
- list($blue, $noblue, $red, $nored) = getenv('IT_ED_BRIGHT') ? array("\033[34m", "\033[m", "\033[33m", "\033[m") : array("\033[34m", "\033[m", "\033[31m", "\033[m");
+ list($blue, $noblue, $red, $nored, $ansiok) = getenv('IT_ED_BRIGHT') ? array("\033[34m", "\033[m", "\033[33m", "\033[m", 1) : array("\033[34m", "\033[m", "\033[31m", "\033[m", 1);
@fseek(STDOUT, 0, SEEK_END); # Work around PHP bug 49819: posix_isatty seeks to start
$src = it_debug::srcline(1);
@@ -140,11 +140,8 @@ static function dump($args)
#$item = preg_replace('#\s+var \$_(.|\n)*?;\s*\n#', "", $item);
$item = "$red$item$nored";
- if (isset($_SERVER['REMOTE_ADDR']) && !$plain) # html encode content and link any urls
- $item = htmlspecialchars($item, ENT_COMPAT, "ISO-8859-1");
-
if ($htmlok)
- $item = preg_replace("#http://[^ ']*#", "<a href='\$0'>\$0</a>", $item);
+ $item = preg_replace("#http://[^ ']*#", "<a href='\$0'>\$0</a>", htmlspecialchars($item));
if (preg_match('/^[\'"]/', $var))
$r .= "$item ";
@@ -161,10 +158,10 @@ static function dump($args)
# not it_html::Q(); we dont wanna load it_html in ultraclassloader debugging
$title = htmlspecialchars(it_debug::backtrace(array('skiplevels' => 1)), ENT_COMPAT, "ISO-8859-1");
- if (isset($_SERVER['REMOTE_ADDR']) && !$plain)
- return "<pre title='$title' style='color:#c00; text-align:left; background-color:white; margin:0 0 0.4em; padding:0 0 0.4em 0; border-bottom:1px solid #ddd;z-index:10000; position:relative'>$r</pre>\n";
+ if ($htmlok)
+ return "<pre title='$title' style='color:#c00; text-align:left; background:white; margin:0 0 0.8em; border-bottom:1px solid #ddd; z-index:9999; position:relative'>$r</pre>\n";
else
- return "$r\n";
+ return $ansiok ? "$r\n" : "\xe2\x96\x88 " . it::replace("\n" => "\n\xe2\x96\x88 ", "$r") . "\n";
}
/**