コード例 #1
0
ファイル: XML.php プロジェクト: nistormihai/Newscoop
    /**
     * Initialize the storage container
     *
     * @param array Array with the storage configuration
     * @return bool true on success, false on failure.
     *
     * @access public
     */
    function init(&$storageConf)
    {
        parent::init($storageConf);

        if (!is_file($this->file)) {
            if (!is_file(getenv('DOCUMENT_ROOT') . $this->file)) {
                $this->stack->push(LIVEUSER_ERROR_MISSING_DEPS, 'exception', array(),
                    "Perm initialisation failed. Can't find xml file.");
                return false;
            }
            $this->file = getenv('DOCUMENT_ROOT') . $this->file;
        }

        $tree = new XML_Tree($this->file);
        $err =& $tree->getTreeFromFile();
        if (PEAR::isError($err)) {
            $this->stack->push(LIVEUSER_ERROR, 'exception', array(),
                "Perm initialisation failed. Can't get tree from file");
            return false;
        }
        $this->tree =& $tree;

        if (!is_a($this->tree, 'xml_tree')) {
            $this->stack->push(LIVEUSER_ERROR_INIT_ERROR, 'error',
                array('container' => 'storage layer configuration missing'));
            return false;
        }

        return true;
    }
コード例 #2
0
ファイル: XML.php プロジェクト: Zunair/xataface
 /**
  *
  *
  *
  * @param array &$storageConf Array with the storage configuration
  * @return boolean true on success, false on failure.
  *
  * @access public
  */
 function init(&$storageConf)
 {
     if (!parent::init($storageConf)) {
         return false;
     }
     if (!is_file($this->file)) {
         if (!is_file(getenv('DOCUMENT_ROOT') . $this->file)) {
             $this->_stack->push(LIVEUSER_ERROR_MISSING_DEPS, 'exception', array(), "Perm initialisation failed. Can't find xml file.");
             return false;
         }
         $this->file = getenv('DOCUMENT_ROOT') . $this->file;
     }
     if (!class_exists('XML_Tree')) {
         $this->_stack->push(LIVEUSER_ERROR_MISSING_DEPS, 'exception', array(), "Perm initialisation failed. Can't find XML_Tree class");
         return false;
     }
     $tree = new XML_Tree($this->file);
     $err =& $tree->getTreeFromFile();
     if (PEAR::isError($err)) {
         $this->_stack->push(LIVEUSER_ERROR, 'exception', array(), "Perm initialisation failed. Can't get tree from file");
         return false;
     }
     $this->tree = $tree;
     return true;
 }