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
00065 define( '_VALID_MOS', 1 );
00066
00067 class criticalInfo {
00068 private static $instance = __CLASS__;
00069 public $absolute_path;
00070 public $class_base;
00071 public $isAdmin = false;
00072
00073 private function __construct() {
00074 $this->absolute_path = str_replace('\\', '/', dirname(__FILE__));
00075 define('_ALIRO_ABSOLUTE_PATH', $this->absolute_path);
00076 define('_ALIRO_CURRENT_PATH', $this->absolute_path);
00077 if (!defined('_ALIRO_CLASS_BASE')) define ('_ALIRO_CLASS_BASE', $this->absolute_path);
00078 $this->class_base = _ALIRO_CLASS_BASE;
00079 define ('_ALIRO_IS_ADMIN', 0);
00080 define ('_ALIRO_ADMIN_PATH', '');
00081 define ('_ALIRO_ADMIN_DIR', '');
00082 }
00083
00084 public static function getInstance () {
00085 return is_object(self::$instance) ? self::$instance : (self::$instance = new self::$instance);
00086 }
00087
00088 }
00089
00090 class aliro {
00091 private static $instance = __CLASS__;
00092 private $timer = null;
00093 public $installed = false;
00094
00095 public static function getInstance () {
00096 if (!is_object(self::$instance)) {
00097 self::$instance = new self::$instance();
00098 $critical = criticalInfo::getInstance();
00099 }
00100 return self::$instance;
00101 }
00102
00103 public function classExists ($classname) {
00104 return smartClassMapper::getInstance()->classExists($classname);
00105 }
00106
00107 public function requireClass ($classname) {
00108 smartClassMapper::getInstance()->requireClass($classname);
00109 }
00110
00111 public function startup () {
00112
00113 $protects = array('_REQUEST', '_GET', '_POST', '_COOKIE', '_FILES', '_SERVER', '_ENV', 'GLOBALS', '_SESSION');
00114
00115 foreach ($protects as $protect) {
00116 if ( in_array($protect , array_keys($_REQUEST)) ||
00117 in_array($protect , array_keys($_GET)) ||
00118 in_array($protect , array_keys($_POST)) ||
00119 in_array($protect , array_keys($_COOKIE)) ||
00120 in_array($protect , array_keys($_FILES))) {
00121 die('Invalid Request.');
00122 }
00123 }
00124 if (false !== strpos($_SERVER['REQUEST_URI'], 'mosConfig_absolute_path')) die ('Invalid Request.');
00125
00126 require_once (dirname(__FILE__).'/definitions.php');
00127
00128 $filepath = _ALIRO_CLASS_BASE.'/configs/'.md5(_ALIRO_ABSOLUTE_PATH.'/configuration.php').'.php';
00129 if (file_exists($filepath) AND filesize($filepath) > 10 ) $this->installed = true;
00130
00131 require_once (_ALIRO_CLASS_BASE.'/objectcache.php');
00132 $this->timer = new aliroProfiler();
00133 require_once (_ALIRO_CLASS_BASE.'/classloader.php');
00134 smartClassMapper::getInstance();
00135 $this->classLoader = smartClassMapper::getInstance();
00136
00137 $controller = aliroRequest::getInstance();
00138
00139 $errorhandler = aliroErrorRecorder::getInstance();
00140 set_error_handler(array($errorhandler, 'PHPerror'));
00141 $controller->doControl();
00142 }
00143
00144 public function getElapsed () {
00145 return $this->timer->getElapsed();
00146 }
00147
00148 public function getTimeMessage () {
00149 return sprintf(T_('Time to generate page %s seconds'), $this->getElapsed());
00150 }
00151
00152 }
00153
00154 ob_start();
00155 ob_implicit_flush(0);
00156 aliro::getInstance()->startup();