Пример #1
0
 /**
  * Returns an instance of the login manager class.
  *
  * This array contains private options defined by
  * the following associative keys:
  *
  * <code>
  *
  * array(
  *  'debug' => false/true or an instance of a class that implements the PEAR:Log interface
  *  'session'  => array(
  *      'name'    => 'liveuser session name',
  *      'varname' => 'liveuser session var name'
  *  ),
  * // The session_save_handler options are optional. If they are specified,
  * // session_set_save_handler() will be called with the parameters
  *  'session_save_handler' => array(
  *      'open'    => 'name of the open function/method',
  *      'close'   => 'name of the close function/method',
  *      'read'    => 'name of the read function/method',
  *      'write'   => 'name of the write function/method',
  *      'destroy' => 'name of the destroy function/method',
  *      'gc'      => 'name of the gc function/method',
  *  ),
  * // The session_cookie_params options are optional. If they are specified,
  * // session_set_cookie_params() will be called with the parameters
  *  'session_cookie_params' => array(
  *      'lifetime' => 'Cookie lifetime in days',
  *      'path'     => 'Cookie path',
  *      'domain'   => 'Cookie domain',
  *      'secure'   => 'Cookie send only over secure connections',
  *  ),
  * 'cache_perm' => if the permission data should be cached inside the session
  *  'login' => array(
  *      'force'    => 'Should the user be forced to login'
  *      'regenid'  => 'Should the session be regenerated on login'
  *  ),
  *  'logout' => array(
  *      'destroy'  => 'Whether to destroy the session on logout' false or true
  *  ),
  * // The cookie options are optional. If they are specified, the Remember Me
  * // feature is activated.
  *  'cookie' => array(
  *      'name'     => 'Name of Remember Me cookie',
  *      'lifetime' => 'Cookie lifetime in days',
  *      'path'     => 'Cookie path',
  *      'domain'   => 'Cookie domain',
  *      'secret'   => 'Secret key used for cookie value encryption',
  *      'savedir'  => '/absolute/path/to/writeable/directory' // No / at the end !
  *      'secure'   => 'Cookie send only over secure connections',
  *  ),
  *  'authContainers' => array(
  *      'name' => array(
  *            'type'            => 'DB',
  *            'loginTimeout'    => 0,
  *            'expireTime'      => 3600,
  *            'idleTime'        => 1800,
  *            'allowDuplicateHandles' => false,
  *            'allowEmptyPasswords'   => false,
  *            'storage' => array(
  *                'connection'      => 'db connection object, use this or dsn',
  *                'dsn'             => 'database dsn, use this or connection',
  *           ),
  *           'externalValues' => array(
  *                  'values'      => &$_SERVER,
  *                  'keysToCheck' => array('HTTP_USER_AGENT')
  *           ),
  *      ),
  *  ),
  *  'permContainer' => array(
  *      'type'     => 'Complex',
  *      'storage'  => array(
  *          'MDB2' => array(
  *              'dsn'       => $dsn,
  *              'prefix'    => 'liveuser_'
  *              'tables'    => array(),
  *              'fields'    => array(),
  *              'alias'     => array(),
  *              'force_seq' => true,
  *          ),
  *      ),
  *  ),
  *
  * </code>
  *
  * Other options in the configuration file relative to
  * the Auth and Perm containers depend on what the
  * containers expect. Refer to the Containers documentation.
  * The examples for containers provided are just general
  * do not reflect all the options for all containers.
  *
  * @param  array $conf      Config array to configure.
  * @return LiveUser|false     Returns an object of either LiveUser or false on error
  *                            if so use LiveUser::getErrors() to get the errors
  *
  * @access public
  * @see    LiveUser::getErrors
  */
 function &factory(&$conf)
 {
     $debug = false;
     if (array_key_exists('debug', $conf)) {
         $debug =& $conf['debug'];
     }
     $obj = new LiveUser($debug);
     if (is_array($conf)) {
         $obj->readConfig($conf);
     }
     return $obj;
 }