absolute_path = str_replace('\\', '/', dirname(__FILE__)); define('_ALIRO_ABSOLUTE_PATH', $this->absolute_path); define('_CMSAPI_ABSOLUTE_PATH', $this->absolute_path); define('_CMSAPI_CMS_BASE', 'Aliro'); define('_ALIRO_CURRENT_PATH', $this->absolute_path); if (!defined('_ALIRO_CLASS_BASE')) define ('_ALIRO_CLASS_BASE', $this->absolute_path); $this->class_base = _ALIRO_CLASS_BASE; if (!defined('_ALIRO_SITE_BASE')) { $abovesite = dirname($this->absolute_path); foreach (array('cache','configs','tmp') as $dirname) if (!is_dir($abovesite.$dirname)) { define ('_ALIRO_SITE_BASE', $this->absolute_path); break; } if (!defined('_ALIRO_SITE_BASE')) define ('_ALIRO_SITE_BASE', $abovesite); } define ('_ALIRO_IS_ADMIN', 0); define ('_ALIRO_ADMIN_PATH', ''); // Provided only for compatibility, no actual value supplied $this->admin_dir = ''; define ('_ALIRO_ADMIN_DIR', ''); if (!defined('_ALIRO_ADMIN_CLASS_BASE')) define ('_ALIRO_ADMIN_CLASS_BASE', ''); } public static function getInstance () { return is_object(self::$instance) ? self::$instance : (self::$instance = new self()); } } final class aliro extends aliroBase { private static $instance = null; public static function getInstance () { return is_object(self::$instance) ? self::$instance : (self::$instance = new self()); } public function startup ($runController=false) { $this->commonStartup(); $this->setAutoload(); $this->classLoader = smartClassMapper::getInstance(); $config = aliroCore::getInstance(); try { if ($config->getCfg('offline') AND (!aliroSession::isAdminPresent())) { $offline = new aliroOffline(); $offline->show(); exit; } $max_load = (float) $config->getCfg('max_load'); $load = sys_getloadavg(); if ($max_load AND $load[0] > $max_load) { $retry = 60.0 * (mt_rand(75, 150)/100.0); header ('Retry-After: '.(int)$retry); $protocol = isset($_SERVER['SERVER_PROTOCOL']) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP 1.1'; header($protocol.' 503 Too busy, try again later'); die($protocol.' 503 Server too busy. Please try again later.'); } } catch (Exception $exception) { trigger_error('An uncaught database error has occurred while admin is present'); exit; } //if ($this->installed) $database = aliroDatabase::getInstance(); try { // Force creation of pseudo-Joomla environment $joomla = new aliroJoomla(); $controller = aliroRequest::getInstance(); $errorhandler = aliroErrorRecorder::getInstance(); set_error_handler(array($errorhandler, 'PHPerror')); if ($runController) $controller->doControl(); } catch (Exception $exception) { $config->makeOffline($exception); } } }