/** * setConfig * * @param string $config */ public static function setConfig($config) { self::$_config = new Config_Ini($config); Registry::set('top', '<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml" xml:lang="ru"><head><title>%title% - Gmanager 0.8.1 beta</title><meta http-equiv="Content-Type" content="' . self::getContentType() . '; charset=UTF-8" /><link rel="stylesheet" type="text/css" href="public/style.min.css"/><script type="text/javascript" src="public/script.min.js"></script></head><body>'); Registry::set('foot', '<div class="w">Powered by Gemorroj<br/><a href="http://wapinet.ru/gmanager/">wapinet.ru</a></div></body></html>'); Language::setLanguage(self::get('Gmanager', 'language')); define('PCLZIP_TEMPORARY_DIR', self::getTemp() . '/'); define('GMANAGER_REQUEST_TIME', time()); mb_internal_encoding('UTF-8'); setlocale(LC_ALL, self::get('PHP', 'locale')); date_default_timezone_set(self::get('PHP', 'timeZone')); @set_time_limit(self::get('PHP', 'timeLimit')); ini_set('max_execution_time', self::get('PHP', 'timeLimit')); ini_set('memory_limit', self::get('PHP', 'memoryLimit')); ini_set('error_log', Errors::getTraceFile()); ini_set('error_prepend_string', '<div class="red">'); ini_set('error_append_string', '</div><div class="rb"><br/></div>' . Registry::get('foot')); Errors::initHandler(); if (self::get('Auth', 'enable')) { Auth::main(); } Gmanager::getInstance()->init(); }
/** * showEval * * @param string $eval * @return string */ public function showEval($eval = '') { $statEval = $eval . "\n" . 'return array( "ram" => Helper_View::formatSize(memory_get_usage(false) - $gmanagerStatEvalInfo["ram"]), "maxRam" => Helper_View::formatSize(memory_get_peak_usage(false) - $gmanagerStatEvalInfo["maxRam"]), "time" => round(microtime(true) - $gmanagerStatEvalInfo["time"], 4) );'; Errors::initHandlerEval(); $evalFunction = create_function('$gmanagerStatEvalInfo', $statEval); if ($evalFunction !== false) { $info = $evalFunction(array('time' => microtime(true), 'maxRam' => memory_get_peak_usage(false), 'ram' => memory_get_usage(false))); } else { $info = array('time' => '?', 'maxRam' => '?', 'ram' => '?'); } $buf = Errors::getResultHandlerEval(); Errors::initHandler(); return '<div class="input">' . Language::get('result') . '<br/><textarea class="lines" cols="48" rows="' . Helper_View::getRows($buf) . '">' . htmlspecialchars($buf, ENT_NOQUOTES) . '</textarea><br/>' . str_replace('%time%', $info['time'], Language::get('microtime')) . '<br/>' . Language::get('memory_get_usage') . ' ' . $info['ram'] . '<br/>' . Language::get('memory_get_peak_usage') . ' ' . $info['maxRam'] . '<br/></div>'; }