Index: branches/unlabeled/unlabeled-1.2.2/core/kernel/utility/debugger/debugger_responce.php =================================================================== diff -u -N -r4846 -r5632 --- branches/unlabeled/unlabeled-1.2.2/core/kernel/utility/debugger/debugger_responce.php (.../debugger_responce.php) (revision 4846) +++ branches/unlabeled/unlabeled-1.2.2/core/kernel/utility/debugger/debugger_responce.php (.../debugger_responce.php) (revision 5632) @@ -3,13 +3,52 @@ $sid = $_GET['sid']; if (!preg_match('/^@([\d]+)@$/', $sid)) exit; - + $debug_file = FULL_PATH.'/kernel/cache/debug_'.$sid.'.txt'; if (file_exists($debug_file)) { - echo file_get_contents($debug_file); + $ret = file_get_contents($debug_file); + $ret = str_replace('#DBG_FILESIZE#', formatSize( filesize($debug_file) ), $ret); unlink($debug_file); } else { - echo 'file not found'; + $ret = 'file not found'; } + + + if (function_exists('gzencode') && strstr($_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip')) { + header('Content-Encoding: gzip'); + echo gzencode($ret); + } + else { + echo $ret; + } + + /** + * Formats file/memory size in nice way + * + * @param int $bytes + * @return string + * @access public + */ + function formatSize($bytes) + { + if ($bytes >= 1099511627776) { + $return = round($bytes / 1024 / 1024 / 1024 / 1024, 2); + $suffix = "TB"; + } elseif ($bytes >= 1073741824) { + $return = round($bytes / 1024 / 1024 / 1024, 2); + $suffix = "GB"; + } elseif ($bytes >= 1048576) { + $return = round($bytes / 1024 / 1024, 2); + $suffix = "MB"; + } elseif ($bytes >= 1024) { + $return = round($bytes / 1024, 2); + $suffix = "KB"; + } else { + $return = $bytes; + $suffix = "Byte"; + } + $return .= ' '.$suffix; + return $return; + } ?> \ No newline at end of file