Beispiel #1
0
 public function run($settings)
 {
     //print_r($settings->query('imports', false));
     \Sylma::getManager(self::AUTOLOAD_MANAGER)->loadNamespaces($settings->query('autoload'));
     $this->setArguments($this->createArgument($settings->query()));
     $this->setSettings($this->getArguments());
     //$this->setArguments($settings);
     $this->setErrorReporting();
     //set_exception_handler("self::sendException");
     $iLifetime = $this->readArgument('session/lifetime');
     ini_set('session.gc_maxlifetime', $iLifetime);
     session_set_cookie_params($iLifetime);
     session_cache_expire($this->readArgument('session/cache'));
     $this->startSession();
     // if (\Sylma::read('db/enable')) $this->loadXDB();
     $this->setStartTime(microtime(true));
     require_once 'storage/fs/Controler.php';
     // load directory without security
     $fs = new fs\Controler(\Sylma::ROOT, false, false, false);
     $fs->loadDirectory();
     \Sylma::setManager('fs', $fs);
     \Sylma::setManager('fs/free', $fs);
     // load user
     $user = \Sylma::getManager('user');
     $user->load();
     if (\Sylma::isAdmin()) {
         require_once 'debug/Functions.php';
     }
     // load directory with security
     $fs = new fs\Controler(\Sylma::ROOT, false, true, true);
     $fs->loadDirectory();
     \Sylma::setManager('fs', $fs);
     $this->setDirectory($fs->getDirectory());
     // Check for maintenance mode
     if ($sMaintenance = $this->loadMaintenance()) {
         return $sMaintenance;
     }
     //$this->getDirectory()->getSettings()->loadDocument();
     $path = $this->loadPath();
     \Sylma::setManager('path', $path);
     // The extension specify the window type
     // Parse of the request_uri, creation of the window - $_GET
     // Reload last alternatives mime-type results - $_SESSION['results']
     //self::loadResults();
     if ($sFile = $path->asFile()) {
         $sResult = $this->createWindowBuilder()->createWindow($sFile, $this->get('images'));
     } else {
         $sResult = $this->runScript($path);
     }
     return $sResult;
 }
Beispiel #2
0
 protected static function loadManager($sName)
 {
     $result = null;
     switch ($sName) {
         case 'autoload':
             self::load('/core/Autoload.php');
             $result = new core\Autoload();
             break;
             /** Parsers **/
         /** Parsers **/
         case 'parser':
             $result = new \sylma\parser\Manager();
             break;
             /** Others **/
         /** Others **/
         case 'fs/editable':
             $result = new storage\fs\Controler(self::ROOT, true, true, true, 'editable');
             $result->loadDirectory();
             break;
         case 'fs/cache':
             $result = new storage\fs\Controler(self::PATH_CACHE, true, true, false, 'cache');
             $result->loadDirectory('');
             break;
         case 'fs/trash':
             $result = new storage\fs\Controler(self::PATH_TRASH, true, true, false, 'trash');
             $result->loadDirectory('');
             break;
         case 'fs/tmp':
             $result = new storage\fs\Controler(self::read('directory/tmp'), true, true, false, 'tmp');
             $result->loadDirectory('');
             break;
         case 'fs/root':
             $result = new storage\fs\Controler('/', true, true, false, '/');
             $result->loadDirectory('');
             break;
         case 'dom':
             $result = new dom\Controler();
             break;
         case 'user':
             $result = new core\user\Manager();
             $result = $result->getUser();
             break;
         case 'formater':
             $result = new modules\formater\Controler();
             break;
         case 'redirect':
             $init = self::getControler('init');
             $result = $init->loadRedirect();
             break;
         case 'mysql':
             $result = new storage\sql\Manager(new core\argument\Readable(self::get('database')->query()));
             break;
     }
     if ($result) {
         self::setManager($sName, $result);
     }
     return $result;
 }