00001 <?php
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00070 define( '_VALID_MOS', 1 );
00071
00072 class criticalInfo {
00073 private static $instance = __CLASS__;
00074 public $absolute_path;
00075 public $admin_absolute_path;
00076 public $admin_dir;
00077 public $class_base;
00078 public $isAdmin = true;
00079
00080 private function __construct() {
00081 $this->admin_absolute_path = str_replace('\\', '/', dirname(__FILE__));
00082 define ('_ALIRO_ADMIN_PATH', $this->admin_absolute_path);
00083 define ('_ALIRO_CURRENT_PATH', $this->admin_absolute_path);
00084 $this->absolute_path = dirname($this->admin_absolute_path);
00085 define('_ALIRO_ABSOLUTE_PATH', $this->absolute_path);
00086 $this->admin_dir = substr($this->admin_absolute_path, strlen($this->absolute_path));
00087 define ('_ALIRO_ADMIN_DIR', $this->admin_dir);
00088 if (!defined('_ALIRO_CLASS_BASE')) define ('_ALIRO_CLASS_BASE', $this->absolute_path);
00089 $this->class_base = _ALIRO_CLASS_BASE;
00090 define ('_ALIRO_IS_ADMIN', 1);
00091 }
00092
00093 public static function getInstance () {
00094 return is_object(self::$instance) ? self::$instance : (self::$instance = new self::$instance);
00095 }
00096
00097 }
00098
00099 class aliro {
00100 private static $instance = __CLASS__;
00101 private $timer = null;
00102 public $installed = false;
00103
00104 public static function getInstance () {
00105 if (!is_object(self::$instance)) {
00106 self::$instance = new self::$instance();
00107 $critical = criticalInfo::getInstance();
00108 }
00109 return self::$instance;
00110 }
00111
00112 public function classExists ($classname) {
00113 return smartAdminClassMapper::getInstance()->classExists($classname);
00114 }
00115
00116 public function requireClass ($classname) {
00117 smartAdminClassMapper::getInstance()->requireClass($classname);
00118 }
00119
00120 public function startup () {
00121
00122 $protects = array('_REQUEST', '_GET', '_POST', '_COOKIE', '_FILES', '_SERVER', '_ENV', 'GLOBALS', '_SESSION');
00123
00124 foreach ($protects as $protect) {
00125 if ( in_array($protect , array_keys($_REQUEST)) ||
00126 in_array($protect , array_keys($_GET)) ||
00127 in_array($protect , array_keys($_POST)) ||
00128 in_array($protect , array_keys($_COOKIE)) ||
00129 in_array($protect , array_keys($_FILES))) {
00130 die('Invalid Request.');
00131 }
00132 }
00133 if (false !== strpos($_SERVER['REQUEST_URI'], 'mosConfig_absolute_path')) die ('Invalid Request.');
00134
00135 $abovedir = dirname(dirname(__FILE__));
00136 require_once ($abovedir.'/definitions.php');
00137
00138 $filepath = _ALIRO_CLASS_BASE.'/configs/'.md5(_ALIRO_ABSOLUTE_PATH.'/configuration.php').'.php';
00139 if (file_exists($filepath) AND filesize($filepath) > 10 ) $this->installed = true;
00140
00141 $thisdir = _ALIRO_CLASS_BASE._ALIRO_ADMIN_DIR;
00142 require_once (_ALIRO_CLASS_BASE.'/objectcache.php');
00143 $this->timer = new aliroProfiler();
00144
00145 set_include_path(_ALIRO_CLASS_BASE.'/extclasses/'.PATH_SEPARATOR.get_include_path());
00146 require_once (_ALIRO_CLASS_BASE.'/extclasses/HTMLPurifier/Bootstrap.php');
00147 require_once (_ALIRO_CLASS_BASE.'/classloader.php');
00148 require_once ($thisdir.'/classloader.php');
00149 smartAdminClassMapper::getInstance();
00150 if (!$this->installed) {
00151 $newinstall = new aliroInstall();
00152 $newinstall->install();
00153 exit();
00154 }
00155 $controller = aliroRequest::getInstance();
00156 $errorhandler = aliroErrorRecorder::getInstance();
00157 set_error_handler(array($errorhandler, 'PHPerror'));
00158 new aliroJoomla();
00159 $controller->doControl();
00160 }
00161
00162 public function getElapsed () {
00163 return $this->timer->getElapsed();
00164 }
00165
00166 public function getTimeMessage () {
00167 return sprintf(T_('Time to generate page %s seconds'), $this->getElapsed());
00168 }
00169 }
00170
00171 ob_start();
00172 ob_implicit_flush(false);
00173 aliro::getInstance()->startup();