admin_absolute_path = str_replace('\\', '/', dirname(__FILE__));
define ('_ALIRO_ADMIN_PATH', $this->admin_absolute_path);
define ('_ALIRO_CURRENT_PATH', $this->admin_absolute_path);
$this->absolute_path = dirname($this->admin_absolute_path);
define('_ALIRO_ABSOLUTE_PATH', $this->absolute_path);
define('_CMSAPI_ABSOLUTE_PATH', $this->absolute_path);
define('_CMSAPI_CMS_BASE', 'Aliro');
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);
}
$this->admin_dir = substr($this->admin_absolute_path, strlen($this->absolute_path));
define ('_ALIRO_ADMIN_DIR', $this->admin_dir);
if (!defined('_ALIRO_CLASS_BASE')) define ('_ALIRO_CLASS_BASE', $this->absolute_path);
if (!defined('_ALIRO_ADMIN_CLASS_BASE')) define ('_ALIRO_ADMIN_CLASS_BASE', _ALIRO_CLASS_BASE._ALIRO_ADMIN_DIR);
$this->class_base = _ALIRO_CLASS_BASE;
define ('_ALIRO_IS_ADMIN', 1);
}
public static function getInstance () {
return is_object(self::$instance) ? self::$instance : (self::$instance = new self::$instance);
}
}
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();
require_once (_ALIRO_ADMIN_CLASS_BASE.'/bootstrap/classloader.php');
$this->setAutoload();
// smartAdminClassMapper::getInstance();
if (!$this->installed) {
$newinstall = aliroInstallerFactory::getInstaller();
$newinstall->install();
exit();
}
try {
$controller = aliroRequest::getInstance();
$errorhandler = aliroErrorRecorder::getInstance();
set_error_handler(array($errorhandler, 'PHPerror'));
new aliroJoomla();
if ($runController) $controller->doControl();
}
catch (Exception $exception) {
// Most errors should be captured and handled more fully - this is just the fallback
echo $exception->getMessage();
if (isset($exception->trace)) echo '
'.$exception->trace;
if (isset($exception->sql)) echo '
SQL: '.$exception->sql;
if (isset($exception->dbtrace)) echo '
'.$exception->dbtrace;
trigger_error('Uncaught Exception');
}
}
}