Exemplo n.º 1
0
 /**
  * Load the storage container
  *
  * @param   array  array containing the configuration.
  * @param string  name of the container that should be used
  * @return bool true on success or false on failure
  *
  * @access public
  */
 function init(&$conf, $containerName)
 {
     parent::init($conf, $containerName);
     if (!is_a($this->dbc, 'pdo') && !is_null($this->dsn)) {
         $login = $password = $extra = null;
         if (!empty($this->options)) {
             if (array_key_exists('username', $this->options)) {
                 $login = $this->options['username'];
             }
             if (array_key_exists('password', $this->options)) {
                 $password = $this->options['password'];
             }
             if (array_key_exists('attr', $this->options)) {
                 $extra = $this->options['attr'];
             }
         }
         try {
             $dbc = new PDO($this->dsn, $login, $password, $extra);
         } catch (PDOException $e) {
             $this->stack->push(LIVEUSER_ERROR_INIT_ERROR, 'error', array('container' => 'could not connect: ' . $e->getMessage(), 'debug' => $e->getTrace()));
             return false;
         }
         $this->dbc = $dbc;
     }
     if (!is_a($this->dbc, 'pdo')) {
         $this->stack->push(LIVEUSER_ERROR_INIT_ERROR, 'error', array('container' => 'storage layer configuration missing'));
         return false;
     }
     return true;
 }
Exemplo n.º 2
0
 /**
  * Load the storage container
  *
  * @param  mixed &$conf   Name of array containing the configuration.
  * @param string $containerName name of the container that should be used
  * @return  boolean true on success or false on failure
  *
  * @access  public
  */
 function init(&$conf, $containerName)
 {
     parent::init($conf, $containerName);
     if (is_array($conf['storage'])) {
         if (!is_file($this->file)) {
             if (!is_file(getenv('DOCUMENT_ROOT') . $this->file)) {
                 $this->_stack->push(LIVEUSER_ERROR_INIT_ERROR, 'error', array('container' => "Auth initialisation failed. Can't find xml file."));
                 return false;
             }
             $this->file = getenv('DOCUMENT_ROOT') . $this->file;
         }
         if ($this->file) {
             if (class_exists('XML_Tree')) {
                 $tree = new XML_Tree($this->file);
                 $err =& $tree->getTreeFromFile();
                 if (PEAR::isError($err)) {
                     $this->_stack->push(LIVEUSER_ERROR_INIT_ERROR, 'error', array('container' => 'could not connect: ' . $err->getMessage()));
                     return false;
                 }
                 $this->tree = $tree;
             } else {
                 $this->_stack->push(LIVEUSER_ERROR_INIT_ERROR, 'error', array('container' => "Auth initialisation failed. Can't find XML_Tree class."));
                 return false;
             }
         } else {
             $this->_stack->push(LIVEUSER_ERROR_INIT_ERROR, 'error', array('container' => "Auth initialisation failed. Can't find xml file."));
             return false;
         }
     }
     return true;
 }
Exemplo n.º 3
0
 /**
  * Load the storage container
  *
  * @param   array  array containing the configuration.
  * @param string  name of the container that should be used
  * @return bool true on success or false on failure
  *
  * @access public
  */
 function init(&$conf, $containerName)
 {
     parent::init($conf, $containerName);
     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;
 }
Exemplo n.º 4
0
 /**
  * Load the storage container
  *
  * @param   array  array containing the configuration.
  * @param string  name of the container that should be used
  * @return bool true on success or false on failure
  *
  * @access public
  */
 function init(&$conf, $containerName)
 {
     parent::init($conf, $containerName);
     return true;
 }
Exemplo n.º 5
0
 /**
  * Load the storage container
  *
  * @param  mixed &$conf   Name of array containing the configuration.
  * @param string $containerName name of the container that should be used
  * @return  boolean true on success or false on failure
  *
  * @access  public
  */
 function init(&$conf, $containerName)
 {
     parent::init($conf, $containerName);
     require_once 'Auth.php';
     if (!is_object($this->pearAuth)) {
         $this->pearAuth = new Auth($conf['pearAuthContainer'], $conf['pearAuthOptions'], '', false);
         if (PEAR::isError($this->pearAuth)) {
             $this->_stack->push(LIVEUSER_ERROR_INIT_ERROR, 'error', array('container' => 'could not connect: ' . $this->pearAuth->getMessage()));
             return false;
         }
     }
     return true;
 }
Exemplo n.º 6
0
 /**
  * Load the storage container
  *
  * @param  mixed &$conf   Name of array containing the configuration.
  * @param string $containerName name of the container that should be used
  * @return  boolean true on success or false on failure
  *
  * @access  public
  */
 function init(&$conf, $containerName)
 {
     parent::init($conf, $containerName);
     if (is_array($conf['storage'])) {
         if (isset($conf['storage']['connection']) && MDB2::isConnection($conf['storage']['connection'])) {
             $this->dbc =& $conf['storage']['connection'];
         } elseif (isset($conf['storage']['dsn'])) {
             $this->dsn = $conf['storage']['dsn'];
             $function = null;
             if (isset($conf['storage']['function'])) {
                 $function = $conf['storage']['function'];
             }
             $options = null;
             if (isset($conf['storage']['options'])) {
                 $options = $conf['storage']['options'];
             }
             $options['portability'] = MDB2_PORTABILITY_ALL;
             if ($function == 'singleton') {
                 $this->dbc =& MDB2::singleton($conf['storage']['dsn'], $options);
             } else {
                 $this->dbc =& MDB2::connect($conf['storage']['dsn'], $options);
             }
             if (PEAR::isError($this->dbc)) {
                 $this->_stack->push(LIVEUSER_ERROR_INIT_ERROR, 'error', array('container' => 'could not connect: ' . $this->dbc->getMessage()));
                 return false;
             }
         }
     }
     return true;
 }
Exemplo n.º 7
0
 /**
  * Load the storage container
  *
  * @param   array  array containing the configuration.
  * @param string  name of the container that should be used
  * @return bool true on success or false on failure
  *
  * @access public
  */
 function init(&$conf, $containerName)
 {
     parent::init($conf, $containerName);
     if (!MDB::isConnection($this->dbc) && !is_null($this->dsn)) {
         $this->options['optimize'] = 'portability';
         if ($function == 'singleton') {
             $dbc =& MDB::singleton($this->dsn, $this->options);
         } else {
             $dbc =& MDB::connect($this->dsn, $this->options);
         }
         if (PEAR::isError($dbc)) {
             $this->stack->push(LIVEUSER_ERROR_INIT_ERROR, 'error', array('container' => 'could not connect: ' . $dbc->getMessage(), 'debug' => $dbc->getUserInfo()));
             return false;
         }
         $this->dbc =& $dbc;
     }
     if (!MDB::isConnection($this->dbc)) {
         $this->stack->push(LIVEUSER_ERROR_INIT_ERROR, 'error', array('container' => 'storage layer configuration missing'));
         return false;
     }
     return true;
 }
Exemplo n.º 8
0
    /**
     * Load the storage container
     *
     * @param   array  array containing the configuration.
     * @param string  name of the container that should be used
     * @return bool true on success or false on failure
     *
     * @access public
     */
    function init(&$conf, $containerName)
    {
        parent::init($conf, $containerName);

        if (!is_a($this->pearAuth, 'auth') && $this->container) {
            $pearAuth = new Auth($this->container, $this->options, '', false);
            if (PEAR::isError($pearAuth)) {
                $this->stack->push(LIVEUSER_ERROR_INIT_ERROR, 'error',
                    array('container' => 'could not connect: '.$pearAuth->getMessage(),
                    'debug' => $pearAuth->getUserInfo()));
                return false;
            }
            $this->pearAuth =& $pearAuth;
        }

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

        return true;
    }
Exemplo n.º 9
0
 /**
  * LiveUser_Auth_Container_PEAR_Auth::freeze()
  *
  * @access public
  */
 function freeze()
 {
     return parent::freeze();
 }
Exemplo n.º 10
0
 /**
  * Load the storage container
  *
  * @param   array  array containing the configuration.
  * @param string  name of the container that should be used
  * @return bool true on success or false on failure
  *
  * @access public
  */
 function init(&$conf, $containerName)
 {
     parent::init($conf, $containerName);
     if (!is_a($this->dbc, 'db_common') && !is_null($this->dsn)) {
         $this->options['portability'] = DB_PORTABILITY_ALL;
         $dbc =& DB::connect($this->dsn, $this->options);
         if (PEAR::isError($dbc)) {
             $this->stack->push(LIVEUSER_ERROR_INIT_ERROR, 'error', array('container' => 'could not connect: ' . $dbc->getMessage(), 'debug' => $dbc->getUserInfo()));
             return false;
         }
         $this->dbc =& $dbc;
     }
     if (!is_a($this->dbc, 'db_common')) {
         $this->stack->push(LIVEUSER_ERROR_INIT_ERROR, 'error', array('container' => 'storage layer configuration missing'));
         return false;
     }
     return true;
 }