'.$back['file'].':'.$back['line']; } } if ($error) $counter++; if (1000 < $counter) { echo $html; die (T_('Program killed - Probably looping')); } return $html; } /* * This is used to recode all calls to file_put_contents as aliroBase::file_put_contents * The aim is to gather information about what is being written by the syste * for performance tuning or similar purposes. * The file path for the diagnostics requires setting according to local setup. public static function file_put_contents ($filepath, $content, $flags=0) { $fpclog = fopen('/var/www/tmp/fpclog.txt', 'a'); fwrite($fpclog, time().','.$filepath.','.strlen($content)."\n"); fclose($fpclog); return @file_put_contents($filepath, $content, $flags); } */ public function classExists ($classname) { $mappername = _ALIRO_IS_ADMIN ? 'smartAdminClassMapper' : 'smartClassMapper'; $mapper = call_user_func(array($mappername, 'getInstance')); return $mapper->classExists($classname); } protected function commonStartup () { $protects = array('_REQUEST', '_GET', '_POST', '_COOKIE', '_FILES', '_SERVER', '_ENV', 'GLOBALS', '_SESSION'); foreach ($protects as $protect) { if ( in_array($protect , array_keys($_REQUEST)) || in_array($protect , array_keys($_GET)) || in_array($protect , array_keys($_POST)) || in_array($protect , array_keys($_COOKIE)) || in_array($protect , array_keys($_FILES))) { die('Invalid Request.'); } } clearstatcache(); $stat = @stat(__FILE__); if (empty($stat) OR !is_array($stat)) $stat = array(php_uname()); mt_srand(crc32(microtime().implode('|', $stat))); if (false !== strpos(@$_SERVER['REQUEST_URI'], 'mosConfig_absolute_path')) die ('Invalid Request.'); require_once (_ALIRO_CLASS_BASE.'/bootstrap/definitions.php'); if (!empty($_GET['oldpath'])) $this->migrateConfig(); $filepath = _ALIRO_SITE_BASE.'/configs/'.md5(_ALIRO_ABSOLUTE_PATH.'/configuration.php').'.php'; if (file_exists($filepath) AND filesize($filepath) > 10 ) $this->installed = true; require_once (_ALIRO_CLASS_BASE.'/bootstrap/objectcache.php'); $this->timer = new aliroProfiler(); // The include path is needed for HTMLpurifier (will possibly serve for other extensions too): set_include_path(_ALIRO_CLASS_BASE.'/extclasses/'.PATH_SEPARATOR.get_include_path()); require_once (_ALIRO_CLASS_BASE.'/extclasses/HTMLPurifier/Bootstrap.php'); require_once (_ALIRO_CLASS_BASE.'/bootstrap/classloader.php'); } protected function migrateConfig () { $configs = array('/configuration.php', '/corecredentials.php', '/credentials.php'); clearstatcache(); foreach ($configs as $cfile) if (!file_exists(_ALIRO_SITE_BASE.'/configs/'.md5($_GET['oldpath'].$cfile).'.php')) return; foreach ($configs as $cfile) rename (_ALIRO_SITE_BASE.'/configs/'.md5($_GET['oldpath'].$cfile).'.php', _ALIRO_SITE_BASE.'/configs/'.md5(_ALIRO_ABSOLUTE_PATH.$cfile).'.php'); } protected function setAutoload () { spl_autoload_register(array('smartClassMapper', 'autoloadClass')); // Initiate HTML Purifier autoloading if (function_exists('spl_autoload_register') AND function_exists('spl_autoload_unregister')) { // HTML Purifier needs unregister for our pre-registering functionality HTMLPurifier_Bootstrap::registerAutoload(); // Be polite and ensure that userland autoload gets retained if (function_exists('__autoload')) spl_autoload_register('__autoload'); } // End of HTML Purifier related code } public function getElapsed () { return $this->timer->getElapsed(); } public function getTimeMessage () { return sprintf(T_('Time to generate page %s seconds'), $this->getElapsed()); } } class jaliroDebug { public static function trace () { return aliroBase::trace(); } }