Ejemplo n.º 1
0
 /**
  * Run everything, launch module, etc.
  */
 public function run()
 {
     if (self::$MODULE != null) {
         throw new Orion\Core\Exception('Only one Orion instance is allowed at a time.', E_USER_ERROR, get_class($this));
     }
     Orion\Core\Context::init(self::$BASE);
     $module = Orion\Core\Context::$MODULE_NAME;
     $modulefile = self::$BASE . self::MODULE_PATH . $module . DS . $module . FS . self::$MODE . '.php';
     $moduleclass = self::MODULE_NS . ucfirst($module) . '\\' . ucfirst($module) . ucfirst(self::$MODE);
     if (self::$CONFIG->defined('OPEN_MODULES') && !in_array($module, self::$CONFIG->get('OPEN_MODULES'))) {
         Orion\Core\Context::redirect(404);
     }
     //throw new Orion\Core\Exception('Module ['.$module.'] is not a trusted module (see OPEN_MODULES in configuration).', E_USER_ERROR, get_class($this));
     if (!file_exists($modulefile)) {
         Orion\Core\Context::redirect(404);
     }
     //throw new Orion\Core\Exception( 'Module class file (' . $modulefile . ') does not exist.', E_USER_ERROR, get_class( $this ) );
     require_once $modulefile;
     self::$MODULE = new $moduleclass();
     self::$MODULE->load();
 }