当前位置: 首页>>代码示例>>PHP>>正文


PHP LiveUser类代码示例

本文整理汇总了PHP中LiveUser的典型用法代码示例。如果您正苦于以下问题:PHP LiveUser类的具体用法?PHP LiveUser怎么用?PHP LiveUser使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了LiveUser类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: init

 function init($conf)
 {
     $complex_conf = array('autoInit' => false, 'session' => array('name' => $conf['auth_session_name'], 'varname' => 'ludata'), 'login' => array('method' => 'post', 'username' => 'handle', 'password' => 'passwd', 'force' => false, 'function' => '', 'remember' => 'rememberMe'), 'logout' => array('trigger' => 'logout', 'redirect' => $conf['auth_exit_page'], 'destroy' => true, 'method' => 'get', 'function' => ''), 'authContainers' => array(array('type' => 'DB', 'name' => 'DB_Local', 'loginTimeout' => 0, 'expireTime' => 3600, 'idleTime' => 1800, 'dsn' => $conf['auth_dsn'], 'allowDuplicateHandles' => 0, 'authTable' => 'liveuser_users', 'authTableCols' => array('user_id' => 'auth_user_id', 'handle' => 'handle', 'passwd' => 'passwd', 'lastlogin' => 'lastlogin', 'is_active' => 'is_active'))), 'permContainer' => array('dsn' => $conf['auth_dsn'], 'type' => 'DB_Medium', 'prefix' => 'liveuser_'));
     $this->auth_handler_ = LiveUser::singleton($complex_conf);
     $error = $this->auth_handler_->init();
     return $error;
 }
开发者ID:BackupTheBerlios,项目名称:hem,代码行数:7,代码来源:class.AuthHandler.php

示例2: removeUser

function removeUser($permId)
{
    global $auth, $perm;
    if (is_object($auth) && is_object($perm)) {
        $authData = $perm->getAuthUserId($permId);
        if (LiveUser::isError($authData)) {
            return $authData;
        }
        $result = $auth->removeUser($authData['auth_user_id']);
        if (LiveUser::isError($result)) {
            return $result;
        }
        return $perm->removeUser($permId);
    }
    return FALSE;
}
开发者ID:BackupTheBerlios,项目名称:hem,代码行数:16,代码来源:admin.php

示例3: showLoginForm

                    $tpl->touchBlock('idled');
                    break;
                case LIVEUSER_STATUS_EXPIRED:
                    $tpl->touchBlock('expired');
                    break;
                default:
                    $tpl->touchBlock('failure');
                    break;
            }
        }
    }
    $tpl->show();
    exit;
}
// Create new LiveUser (LiveUser) object.
// We´ll only use the auth container, permissions are not used.
$LU =& LiveUser::factory($LUOptions);
$LU->dispatcher->addObserver('forceLogin', 'forceLogin');
if (!$LU->init()) {
    var_dump($LU->getErrors());
    die;
}
$logout = array_key_exists('logout', $_REQUEST) ? $_REQUEST['logout'] : false;
if ($logout) {
    $LU->logout(true);
    showLoginForm($LU);
}
define('AREA_NEWS', 1);
define('RIGHT_NEWS_NEW', 1);
define('RIGHT_NEWS_CHANGE', 2);
define('RIGHT_NEWS_DELETE', 3);
开发者ID:laiello,项目名称:coopcrucial,代码行数:31,代码来源:conf.php

示例4: readRememberCookie

 /**
  * Handles the retrieval of the login data from the rememberMe cookie.
  *
  * @return bool true on success or false on failure
  *
  * @access public
  */
 function readRememberCookie()
 {
     if (!array_key_exists('cookie', $this->_options) || !array_key_exists($this->_options['cookie']['name'], $_COOKIE)) {
         return false;
     }
     if (strlen($_COOKIE[$this->_options['cookie']['name']]) < 65 || preg_match('/[^a-z0-9]/i', substr($_COOKIE[$this->_options['cookie']['name']], 0, 64))) {
         $this->deleteRememberCookie();
     }
     $cookieData = $_COOKIE[$this->_options['cookie']['name']];
     $store_id = substr($cookieData, 0, 32);
     $passwd_id = substr($cookieData, 32, 32);
     $handle = substr($cookieData, 64);
     $dir = $this->_options['cookie']['savedir'];
     $fh = @fopen($dir . '/' . $store_id . '.lu', 'rb');
     if (!$fh) {
         $this->deleteRememberCookie();
         $this->stack->push(LIVEUSER_ERROR_CONFIG, 'exception', array(), 'Cannot open file for reading');
         return false;
     }
     $fields = fread($fh, 4096);
     fclose($fh);
     if (!$fields) {
         $this->deleteRememberCookie();
         $this->stack->push(LIVEUSER_ERROR_CONFIG, 'exception', array(), 'Cannot read file');
         return false;
     }
     $serverData = @unserialize(LiveUser::cryptRC4($fields, $this->_options['cookie']['secret'], false));
     if (!is_array($serverData) || count($serverData) != 2) {
         $this->deleteRememberCookie();
         $this->stack->push(LIVEUSER_ERROR_COOKIE, 'exception', array(), 'Incorrect array structure');
         return false;
     }
     if ($serverData[0] != $passwd_id) {
         // Delete cookie if it's not valid, keeping it messes up the
         // authentication process
         $this->deleteRememberCookie();
         $this->stack->push(LIVEUSER_ERROR_COOKIE, 'error', array(), 'Passwords hashes do not match in cookie in LiveUser::readRememberMeCookie()');
         return false;
     }
     return array('handle' => $handle, 'passwd' => $serverData[1]);
 }
开发者ID:laiello,项目名称:punchcms,代码行数:48,代码来源:LiveUser.php

示例5: error_reporting

error_reporting(E_ALL);
// right definitions
define('ACCESS', 3);
define('LAUNCH_ATOMIC_BOMB', 4);
define('FLY_ALIEN_SPACE_CRAFT', 5);
// Include configuration.
require_once 'conf.php';
// The error handling stuff is not needed and used only for debugging
// while LiveUser is not yet mature
PEAR::setErrorHandling(PEAR_ERROR_CALLBACK, 'eHandler');
function eHandler($errObj)
{
    echo '<hr /><span style="color: red;">' . $errObj->getMessage() . ':<br />' . $errObj->getUserinfo() . '</span><hr />';
}
// Create new LiveUser object
$LU = LiveUser::factory($liveuserConfig);
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
    <title>Example Area51</title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
    <style type="text/css">
    <!--
    table {
        background-color: #CCCCCC;
        border-color: 1px solid #000;
    }
    body {
        font-family: Verdana, Arial, Helvetica, sans-serif;
        font-size: 12px;
开发者ID:BackupTheBerlios,项目名称:hem,代码行数:31,代码来源:area51.php

示例6: getAuthUserId

 /**
  * Gets the auth ID of a user.
  *
  * @access  public
  * @param   string  Perm user ID.
  * @return  mixed   Permission ID or MDB2 error.
  */
 function getAuthUserId($permId)
 {
     return LiveUser::raiseError(LIVEUSER_NOT_SUPPORTED, null, null, 'Method not supported by this container');
 }
开发者ID:BackupTheBerlios,项目名称:hem,代码行数:11,代码来源:Common.php

示例7: _getUsersByAuth

 /**
  * Finds and gets full userinfo by filtering inside the auth container
  *
  * @param  array auth params (as for getUsers() from the auth container
  * @return array|bool Array with userinfo if found on success or false otherwise
  *
  * @access private
  */
 function _getUsersByAuth($authParams = array())
 {
     if (!is_object($this->auth) || !is_object($this->perm)) {
         $this->stack->push(LIVEUSER_ADMIN_ERROR, 'exception', array('msg' => 'Perm and/or Auth container not set.'));
         return false;
     }
     $first = $authParams['select'] == 'row';
     $authUsers = $this->auth->getUsers($authParams);
     if (!$authUsers) {
         return $authUsers;
     }
     if ($first) {
         $authUsers = array($authUsers);
     }
     $users = array();
     foreach ($authUsers as $authData) {
         $permParams = array('filters' => array('auth_user_id' => $authData['auth_user_id'], 'auth_container_name' => $this->authContainerName), 'select' => 'row');
         $permData = $this->perm->getUsers($permParams);
         if (!$permData) {
             continue;
         }
         if ($first) {
             return LiveUser::arrayMergeClobber($authData, $permData);
         }
         $users[] = LiveUser::arrayMergeClobber($authData, $permData);
     }
     return $users;
 }
开发者ID:ookwudili,项目名称:chisimba,代码行数:36,代码来源:Admin.php

示例8: encryptPW

 /**
  * Encrypts a password for storage in a backend container.
  * Uses the algorithm defined in the passwordEncryptionMode property.
  *
  * @param string  encryption type
  * @return string the encrypted password
  *
  * @access public
  */
 function encryptPW($plainPW)
 {
     return LiveUser::encryptPW($plainPW, $this->passwordEncryptionMode, $this->secret);
 }
开发者ID:laiello,项目名称:coopcrucial,代码行数:13,代码来源:Common.php

示例9: errorMessage

 /**
  * Return a textual error message for a LiveUser error code.
  *
  * @access  public
  * @param   int     error code
  * @return  string  error message
  */
 function errorMessage($value)
 {
     // make the variable static so that it only has to do the defining on the first call
     static $errorMessages;
     // define the varies error messages
     if (!isset($errorMessages)) {
         $errorMessages = array(LIVEUSER_ERROR => 'Unknown error', LIVEUSER_ERROR_NOT_SUPPORTED => 'Feature not supported', LIVEUSER_ERROR_CONFIG => 'Config file error', LIVEUSER_ERROR_MISSING_DEPS => 'Missing package depedencies', LIVEUSER_ERROR_MISSING_LOGINFUNCTION => 'Login function not found', LIVEUSER_ERROR_MISSING_LOGOUTFUNCTION => 'Logout function not found', LIVEUSER_ERROR_COOKIE => 'Remember Me cookie error', LIVEUSER_STATUS_EXPIRED => 'User session has expired', LIVEUSER_STATUS_ISINACTIVE => 'User is set to inactive', LIVEUSER_STATUS_PERMINITERROR => 'Cannot instantiate permission container', LIVEUSER_STATUS_AUTHINITERROR => 'Cannot instantiate authentication configuration', LIVEUSER_STATUS_AUTHNOTFOUND => 'Cannot retrieve Auth object from session', LIVEUSER_STATUS_UNKNOWN => 'Something went wrong in whatever you were trying to do', LIVEUSER_STATUS_LOGGEDOUT => 'User was logged out correctly');
     }
     // If this is an error object, then grab the corresponding error code
     if (LiveUser::isError($value)) {
         $value = $value->getCode();
     }
     // return the textual error message corresponding to the code
     return isset($errorMessages[$value]) ? $errorMessages[$value] : $errorMessages[LIVEUSER_ERROR];
 }
开发者ID:BackupTheBerlios,项目名称:hem,代码行数:22,代码来源:LiveUser.php

示例10: getUsers

 /**
  * Gets all users with handle, passwd, authId,
  * lastlogin, is_active and individual rights.
  *
  * The array will look like this:
  * <code>
  * $userData[0]['auth_user_id']       = 'wujha433gawefawfwfiuj2ou9823r98h';
  *             ['handle']       = 'myLogin';
  *             ['passwd']     = 'd346gs2gwaeiuhaeiuuweijfjuwaefhj';
  *             ['lastlogin']    = 1254801292; (Unix timestamp)
  *             ['is_active']     = 1; (1 = yes, 0 = no)
  * </code>
  *
  * @access  public
  * @param   array  filters to apply to fetched data
  * @param   array  custom fields you wane to be returned
  * @return  mixed  Array with user data or error object.
  */
 function getUsers($filters = array(), $customFields = array())
 {
     return LiveUser::raiseError(LIVEUSER_ERROR_NOT_SUPPORTED, null, null, 'getUsers(): Method not supported by this container');
 }
开发者ID:BackupTheBerlios,项目名称:smart-svn,代码行数:22,代码来源:Common.php

示例11: session_write_close

$as->requireAuth();
$saml_attributes = $as->getAttributes();
session_write_close();
// now - let's continue with the session handling that would normally be done
// by Maharas init.php
// the main thin is that it sets the session cookie name back to what it should be
// session_name(get_config('cookieprefix') . 'mahara');
// and starts the session again
// ***********************************************************************
// copied from original init.php
// ***********************************************************************
// Only do authentication once we know the page theme, so that the login form
// can have the correct theming.
require_once dirname(dirname(dirname(__FILE__))) . '/auth/lib.php';
$SESSION = Session::singleton();
$USER = new LiveUser();
$THEME = new Theme($USER);
// The installer does its own auth_setup checking, because some upgrades may
// break logging in and so need to allow no logins.
if (!defined('INSTALLER')) {
    auth_setup();
}
if (get_config('siteclosed')) {
    if ($USER->admin) {
        if (get_config('disablelogin')) {
            $USER->logout();
        } else {
            if (!defined('INSTALLER')) {
                redirect('/admin/upgrade.php');
            }
        }
开发者ID:richardmansfield,项目名称:richardms-mahara,代码行数:31,代码来源:index.php

示例12:

    }
} else {
    $liveuserConfig['login']['username'] = '';
    $liveuserConfig['login']['password'] = '';
}
/*  Setting $liveuserConfig['login']['username'] and $liveuserConfig['login']['password']
*   to '' causes the login to be ignored by the LiveUser system.
*   In Liveuser.php during the tryLogin function on line 665,  
*   it sees the handle is empty.  It then tries to login based on a cookie,
*   but in line 171 that _options['cookie'] is not set so it goes to line 693
*   sees that _options['login']['username'] and _options['login']['password'] 
*   are empty, tries to run _options['login']['function'] which is also set to ''
*   so it fails out of the if and hits line 715 where it returns false negating the login.
*/
// instantiate a LiveUser object from the config array
$liveuser =& LiveUser::factory($liveuserConfig);
if (isset($_REQUEST['username']) && !isset($_REQUEST['cancel_login'])) {
    if ($totalDelay > EWIKI_LIVEUSER_LOGIN_SHUTDOWN_DELAY) {
        $liveuser->logout();
    } else {
        //Get data as we would for logging
        $loginData = ewiki_liveuser_get_login_data();
        liveuser_loglogin();
        //Tests login, updates $username
        if ($username = $liveuser->getHandle()) {
            //Clear delay flags with matching handle, php session, ssl session, and ip
            // (today only)
            $liveuserDB->query('
                UPDATE `liveweb_login_log` set delay=0 
                WHERE time> DATE_SUB(NOW(), INTERVAL 1 DAY) 
                AND auth_user_handle=? AND php_session_id=?
开发者ID:gpuenteallott,项目名称:rox,代码行数:31,代码来源:auth_liveuser.php

示例13: error_reporting

<?php

$dsn = 'mysql://test:test@localhost/lutest';
error_reporting(E_ALL);
$DOC_ROOT = $_SERVER['DOCUMENT_ROOT'];
$USER_DIR = '/martin';
$PROJECT_NAME = '/hem';
$APP_ROOT = $DOC_ROOT . $USER_DIR . $PROJECT_NAME;
$PEAR_DIR = $APP_ROOT . '/pear';
$APP_FRAMEWORK_DIR = $APP_ROOT . '/framework';
$PATH = $PEAR_DIR . ":" . $APP_FRAMEWORK_DIR;
ini_set('include_path', ':' . $PATH . ':' . ini_get('include_path'));
$conf = array('autoInit' => true, 'session' => array('name' => 'PHPSESSION', 'varname' => 'ludata'), 'login' => array('method' => 'post', 'username' => 'handle', 'password' => 'passwd', 'force' => false, 'function' => '', 'remember' => 'rememberMe'), 'logout' => array('trigger' => 'logout', 'redirect' => 'home.php', 'destroy' => true, 'method' => 'get', 'function' => ''), 'authContainers' => array(array('type' => 'DB', 'name' => 'DB_Local', 'loginTimeout' => 0, 'expireTime' => 3600, 'idleTime' => 1800, 'dsn' => $dsn, 'allowDuplicateHandles' => 0, 'authTable' => 'liveuser_users', 'authTableCols' => array('required' => array('auth_user_id' => array('type' => 'text', 'name' => 'auth_user_id'), 'handle' => array('type' => 'text', 'name' => 'handle'), 'passwd' => array('type' => 'text', 'name' => 'passwd')), 'optional' => array('lastlogin' => array('type' => 'timestamp', 'name' => 'lastlogin'), 'is_active' => array('type' => 'boolean', 'name' => 'is_active'), 'owner_user_id' => array('type' => 'integer', 'name' => 'owner_user_id'), 'owner_group_id' => array('type' => 'integer', 'name' => 'owner_group_id')), 'custom' => array()))), 'permContainer' => array('dsn' => $dsn, 'type' => 'DB_Medium', 'prefix' => 'liveuser_'));
require_once 'LiveUser.php';
$LU =& LiveUser::factory($conf);
开发者ID:BackupTheBerlios,项目名称:hem,代码行数:15,代码来源:config.inc.php

示例14: getUser

 /**
  * Finds and gets userinfo by his userID, customFields can
  *  also be gotten
  *
  * Untested: it most likely doesn't work.
  *
  * @access public
  * @param mixed User ID
  * @param   array  custom fields you want to be returned. If not specified
  *                 the basic set of fields is returned. The keys are the
  *                 names and the values
  * @return mixed Array with userinfo if found else error object
  */
 function getUser($userId, $customFields = array())
 {
     if (is_object($this->auth) && is_object($this->perm)) {
         if (is_array($this->auth->authTableCols['user_id'])) {
             $user_auth_id = $this->auth->authTableCols['user_id']['name'];
             $type = $this->auth->authTableCols['user_id']['type'];
         } else {
             $user_auth_id = $this->auth->authTableCols['user_id'];
             $type = '';
         }
         $filters = array($user_auth_id => array('op' => '=', 'value' => $userId, 'cond' => '', 'type' => $type));
         $search = $this->auth->getUsers($filters, $customFields);
         if (LiveUser::isError($search)) {
             return $search;
         }
         return $search;
     }
     return LiveUser::raiseError(LIVEUSER_ERROR, null, null, 'Perm or Auth container couldn\\t be started.');
 }
开发者ID:BackupTheBerlios,项目名称:hem,代码行数:32,代码来源:Admin.php

示例15: errorMessage

 /**
  * Return a textual error message for a LiveUser error code.
  *
  * @access  public
  * @param   mixed   error code or error object
  * @return  string  error message
  */
 function errorMessage($value)
 {
     // make the variable static so that it only has to do the defining on the first call
     static $errorMessages;
     // define the varies error messages
     if (!isset($errorMessages)) {
         $errorMessages = array(LIVEUSER_ERROR => 'Unknown error', LIVEUSER_ERROR_NOT_SUPPORTED => 'Feature not supported', LIVEUSER_ERROR_CONFIG => 'Config file error', LIVEUSER_ERROR_MISSING_DEPS => 'Missing package depedencies', LIVEUSER_ERROR_MISSING_LOGINFUNCTION => 'Login function not found', LIVEUSER_ERROR_MISSING_LOGOUTFUNCTION => 'Logout function not found', LIVEUSER_ERROR_COOKIE => 'Remember Me cookie error');
     }
     // If this is an error object, then grab the corresponding error code
     if (LiveUser::isError($value)) {
         $value = $value->getCode();
     }
     // return the textual error message corresponding to the code
     return isset($errorMessages[$value]) ? $errorMessages[$value] : $errorMessages[LIVEUSER_ERROR];
 }
开发者ID:BackupTheBerlios,项目名称:hem,代码行数:22,代码来源:LiveUser.php


注:本文中的LiveUser类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。