Index: kernel/application.php =================================================================== --- kernel/application.php (revision 15521) +++ kernel/application.php (working copy) @@ -1351,7 +1351,9 @@ return false; } - return $this->ConfigValue('UseOutputCompression') && function_exists('gzencode') && strstr($_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip'); + $accept_encoding = isset($_SERVER['HTTP_ACCEPT_ENCODING']) ? $_SERVER['HTTP_ACCEPT_ENCODING'] : ''; + + return $this->ConfigValue('UseOutputCompression') && function_exists('gzencode') && strstr($accept_encoding, 'gzip'); } // Facade Index: kernel/utility/debugger/debugger_responce.php =================================================================== --- kernel/utility/debugger/debugger_responce.php (revision 15437) +++ kernel/utility/debugger/debugger_responce.php (working copy) @@ -11,33 +11,37 @@ * or other free or open source software licenses. * See http://www.in-portal.org/license for copyright notices and details. */ + ini_set('memory_limit', -1); set_time_limit(0); - define('FULL_PATH', realpath(dirname(__FILE__).'/../../../..') ); + define('FULL_PATH', realpath(dirname(__FILE__) . '/../../../..')); $sid = $_GET['sid']; $path = isset($_GET['path']) ? $_GET['path'] : '/system/cache'; - if ((strpos($path, '../') !== false) || (trim($path) !== $path)) { + if ( (strpos($path, '../') !== false) || (trim($path) !== $path) ) { // when relative paths or special chars are found template names from url, then it's hacking attempt exit; } - if (!preg_match('/^@([\d]+)@$/', $sid)) exit; + if ( !preg_match('/^@([\d]+)@$/', $sid) ) { + exit; + } - $debug_file = FULL_PATH.$path.'/debug_'.$sid.'.txt'; - if (file_exists($debug_file)) { + $debug_file = FULL_PATH . $path . '/debug_' . $sid . '.txt'; + if ( file_exists($debug_file) ) { $ret = file_get_contents($debug_file); - $ret = str_replace('#DBG_FILESIZE#', formatSize( filesize($debug_file) ), $ret); + $ret = str_replace('#DBG_FILESIZE#', formatSize(filesize($debug_file)), $ret); unlink($debug_file); } else { $ret = 'file not found'; } + $accept_encoding = isset($_SERVER['HTTP_ACCEPT_ENCODING']) ? $_SERVER['HTTP_ACCEPT_ENCODING'] : ''; - if (function_exists('gzencode') && strstr($_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip')) { + if ( function_exists('gzencode') && strstr($accept_encoding, 'gzip') ) { header('Content-Encoding: gzip'); echo gzencode($ret); } @@ -54,22 +58,26 @@ */ function formatSize($bytes) { - if ($bytes >= 1099511627776) { + if ( $bytes >= 1099511627776 ) { $return = round($bytes / 1024 / 1024 / 1024 / 1024, 2); $suffix = "TB"; - } elseif ($bytes >= 1073741824) { + } + elseif ( $bytes >= 1073741824 ) { $return = round($bytes / 1024 / 1024 / 1024, 2); $suffix = "GB"; - } elseif ($bytes >= 1048576) { + } + elseif ( $bytes >= 1048576 ) { $return = round($bytes / 1024 / 1024, 2); $suffix = "MB"; - } elseif ($bytes >= 1024) { + } + elseif ( $bytes >= 1024 ) { $return = round($bytes / 1024, 2); $suffix = "KB"; - } else { + } + else { $return = $bytes; $suffix = "Byte"; } - $return .= ' '.$suffix; + $return .= ' ' . $suffix; return $return; }