Exemplo n.º 1
0
 public function setAppDirectory($directory)
 {
     if (!is_dir($directory) || !Yaf_G::isAbsolutePath($directory)) {
         return false;
     }
     Yaf_G::set('directory', $directory);
     return $this;
 }
Exemplo n.º 2
0
 /**
  * Finds a view script from the available directory.
  *
  * @param string $name The base name of the script.
  * @return void
  */
 protected function _script($name)
 {
     if (preg_match('#\\.\\.[\\\\/]#', $name)) {
         throw new Yaf_Exception('Requested scripts may not include parent ' . 'directory traversal ("../", "..\\" notation)');
     }
     if ($this->_tpl_dir == '') {
         throw new Yaf_Exception_LoadFailed_View('Could not determine the view script path, ' . 'you should call Yaf_View_Simple::setScriptPath to specific it');
     }
     if (Yaf_G::isAbsolutePath($name) && is_readable($name)) {
         return $name;
     } else {
         if (is_readable($this->_tpl_dir . DIRECTORY_SEPARATOR . $name)) {
             return $this->_tpl_dir . DIRECTORY_SEPARATOR . $name;
         }
     }
     throw new Yaf_Exception_LoadFailed_View("Unable to find template " . $this->_tpl_dir . DIRECTORY_SEPARATOR . $name);
 }