Пример #1
0
 public function buildWindow(core\request $path, core\argument $exts, $bUpdate = null, $bRun = true)
 {
     $this->setSettings($exts);
     $sExtension = strtolower($path->getExtension());
     if (!$sExtension) {
         $sExtension = self::EXTENSION_DEFAULT;
     }
     $settings = $this->get($sExtension);
     $sCurrent = (string) $path;
     $path->parse();
     $aPaths = $this->buildWindowStack($settings, $sCurrent);
     $aPaths[] = (string) $path->asFile();
     $bAccess = true;
     foreach ($aPaths as $sFile) {
         $file = $this->getFile($sFile, false);
         if (!$file || !$file->checkRights(\Sylma::MODE_EXECUTE)) {
             $bAccess = false;
             break;
         }
     }
     if (!$bAccess) {
         $this->getInitializer()->send404();
         $aPaths = $this->buildWindowStack($this->createArgument(array($this->get('error'))), '');
         $aPaths[] = $this->read('error/path');
     }
     $aPaths = array_reverse($aPaths);
     $sMain = array_pop($aPaths);
     $window = $this->getFile($sMain);
     $args = $path->getArguments();
     $args->set('sylma-paths', $aPaths);
     $builder = $this->getManager(self::PARSER_MANAGER);
     return $builder->load($window, array('arguments' => $args), $bUpdate, $bRun);
 }
Пример #2
0
 protected function runExecutable(core\request $path)
 {
     $sExtension = $path->getExtension();
     if ($this->getFactory()->findClass($sExtension, '', false)) {
         // with window
         $window = $this->create($sExtension, array($this));
         \Sylma::setManager('window', $window);
         $sResult = $this->createWindowBuilder()->loadObject($path, $window);
     } else {
         // no window
         $this->setHeaderContent($this->getMime($sExtension));
         $path->parse();
         $file = $path->asFile();
         if ($file->getExtension() !== 'vml') {
             $this->send404();
             $file = $this->getFile($this->getErrorPath());
             //$this->launchException('Can execute only view');
         }
         $sResult = (string) $this->prepareScript($file, $path->getArguments());
     }
     return $sResult;
 }