• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP eZUserSetting类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: createUser

 /**
  * Creates a user with provided auth data
  *
  * @param array $authResult
  *
  * @return bool|eZUser
  */
 public static function createUser($authResult)
 {
     $ngConnectINI = eZINI::instance('ngconnect.ini');
     $siteINI = eZINI::instance('site.ini');
     $defaultUserPlacement = $ngConnectINI->variable('LoginMethod_' . $authResult['login_method'], 'DefaultUserPlacement');
     $placementNode = eZContentObjectTreeNode::fetch($defaultUserPlacement);
     if (!$placementNode instanceof eZContentObjectTreeNode) {
         $defaultUserPlacement = $siteINI->variable('UserSettings', 'DefaultUserPlacement');
         $placementNode = eZContentObjectTreeNode::fetch($defaultUserPlacement);
         if (!$placementNode instanceof eZContentObjectTreeNode) {
             return false;
         }
     }
     $contentClass = eZContentClass::fetch($siteINI->variable('UserSettings', 'UserClassID'));
     $userCreatorID = $siteINI->variable('UserSettings', 'UserCreatorID');
     $defaultSectionID = $siteINI->variable('UserSettings', 'DefaultSectionID');
     $db = eZDB::instance();
     $db->begin();
     $contentObject = $contentClass->instantiate($userCreatorID, $defaultSectionID);
     $contentObject->store();
     $nodeAssignment = eZNodeAssignment::create(array('contentobject_id' => $contentObject->attribute('id'), 'contentobject_version' => 1, 'parent_node' => $placementNode->attribute('node_id'), 'is_main' => 1));
     $nodeAssignment->store();
     $currentTimeStamp = eZDateTime::currentTimeStamp();
     /** @var eZContentObjectVersion $version */
     $version = $contentObject->currentVersion();
     $version->setAttribute('modified', $currentTimeStamp);
     $version->setAttribute('status', eZContentObjectVersion::STATUS_DRAFT);
     $version->store();
     $dataMap = $version->dataMap();
     self::fillUserObject($version->dataMap(), $authResult);
     if (!isset($dataMap['user_account'])) {
         $db->rollback();
         return false;
     }
     $userLogin = 'ngconnect_' . $authResult['login_method'] . '_' . $authResult['id'];
     $userPassword = (string) rand() . 'ngconnect_' . $authResult['login_method'] . '_' . $authResult['id'] . (string) rand();
     $userExists = false;
     if (eZUser::requireUniqueEmail()) {
         $userExists = eZUser::fetchByEmail($authResult['email']) instanceof eZUser;
     }
     if (empty($authResult['email']) || $userExists) {
         $email = md5('ngconnect_' . $authResult['login_method'] . '_' . $authResult['id']) . '@localhost.local';
     } else {
         $email = $authResult['email'];
     }
     $user = new eZUser(array('contentobject_id' => $contentObject->attribute('id'), 'email' => $email, 'login' => $userLogin, 'password_hash' => md5("{$userLogin}\n{$userPassword}"), 'password_hash_type' => 1));
     $user->store();
     $userSetting = new eZUserSetting(array('is_enabled' => true, 'max_login' => 0, 'user_id' => $contentObject->attribute('id')));
     $userSetting->store();
     $dataMap['user_account']->setContent($user);
     $dataMap['user_account']->store();
     $operationResult = eZOperationHandler::execute('content', 'publish', array('object_id' => $contentObject->attribute('id'), 'version' => $version->attribute('version')));
     if (array_key_exists('status', $operationResult) && $operationResult['status'] == eZModuleOperationInfo::STATUS_CONTINUE) {
         $db->commit();
         return $user;
     }
     $db->rollback();
     return false;
 }
开发者ID:netgen,项目名称:ngconnect,代码行数:66,代码来源:ngconnectfunctions.php


示例2: checkObjectAttribute

 /**
  * (called for each obj attribute)
  */
 public function checkObjectAttribute(array $contentObjectAttribute)
 {
     // we adopt the ez api instead of acting on raw data
     $contentObjectAttribute = new eZContentObjectAttribute($contentObjectAttribute);
     // for ezuser datatype, the user is always created even if attribute is set to nullable...
     $warnings = array();
     $userid = $contentObjectAttribute->attribute('contentobject_id');
     $user = $contentObjectAttribute->attribute('content');
     if (!$user) {
         $warnings[] = "No ezuser {$userid} found" . $this->postfixErrorMsg($contentObjectAttribute);
     }
     $settings = eZUserSetting::fetch($userid);
     if (!$settings) {
         $warnings[] = "No settings found for user {$userid}" . $this->postfixErrorMsg($contentObjectAttribute);
     }
     return $warnings;
 }
开发者ID:gggeek,项目名称:ezdbintegrity,代码行数:20,代码来源:ezdbiezuserchecker.php


示例3: removeByUserID

 static function removeByUserID($userID)
 {
     eZPersistentObject::removeObject(eZUserSetting::definition(), array('user_id' => $userID));
 }
开发者ID:CG77,项目名称:ezpublish-legacy,代码行数:4,代码来源:ezusersetting.php


示例4: isEnabled

 function isEnabled($useCache = true)
 {
     if (isset($this->UserCache['info'][$this->ContentObjectID]['is_enabled']) && $useCache) {
         return $this->UserCache['info'][$this->ContentObjectID]['is_enabled'];
     }
     $setting = eZUserSetting::fetch($this->attribute('contentobject_id'));
     if ($setting and !$setting->attribute('is_enabled')) {
         return false;
     }
     return true;
 }
开发者ID:brookinsconsulting,项目名称:ezecosystem,代码行数:11,代码来源:ezuser.php


示例5: isEnabled

 function isEnabled()
 {
     if ($this == eZUser::currentUser()) {
         return true;
     }
     $setting = eZUserSetting::fetch($this->attribute('contentobject_id'));
     if ($setting and !$setting->attribute('is_enabled')) {
         return false;
     }
     return true;
 }
开发者ID:netbliss,项目名称:ezpublish,代码行数:11,代码来源:ezuser.php


示例6: updateUserStatus

    private function updateUserStatus( $enabled = true )
    {
        $userSetting = eZUserSetting::fetch(
            $this->userObject->attribute( 'id' )
        );
        $userSetting->setAttribute( 'is_enabled', (int)$enabled );
        $userSetting->store();

        $eZUser = eZUser::fetch( $this->userObject->attribute( 'id' ) );

        if( $enabled )
            $this->assertTrue( $eZUser->isEnabled() );
        else
            $this->assertFalse( $eZUser->isEnabled() );
    }
开发者ID:nottavi,项目名称:ezpublish,代码行数:15,代码来源:ezusertype_regression.php


示例7: activation

 /**
  * Activate user with user or deactivate and create new eZUserAccountKey with user hash
  * depending on $enableUser being true or not.
  *
  * @param int $userID
  * @param string $userHash
  * @param bool $enableUser
  *
  * @return array An array with operation status, always true if userID is ok
  */
 public static function activation($userID, $userHash, $enableUser = false)
 {
     $user = eZUser::fetch($userID);
     $userSetting = eZUserSetting::fetch($userID);
     if ($user && $userSetting) {
         $userChange = $userSetting->attribute('is_enabled') != $enableUser;
         if ($enableUser) {
             $userSetting->setAttribute('is_enabled', 1);
             $userSetting->store();
             eZUserAccountKey::removeByUserID($userID);
         } else {
             $userSetting->setAttribute('is_enabled', 0);
             $userSetting->store();
             $accountKey = eZUserAccountKey::createNew($userID, $userHash, time());
             $accountKey->store();
         }
         if ($userChange) {
             if (!$enableUser) {
                 eZUser::removeSessionData($userID);
             }
             eZContentCacheManager::clearContentCacheIfNeeded($userID);
         }
         return array('status' => true);
     } else {
         eZDebug::writeError("Failed to activate user {$userID} (could not fetch)", __METHOD__);
         return array('status' => false);
     }
 }
开发者ID:jordanmanning,项目名称:ezpublish,代码行数:38,代码来源:ezuseroperationcollection.php


示例8: array

 * @package kernel
 */
$Module = $Params['Module'];
if (isset($Params["UserID"])) {
    $UserID = $Params["UserID"];
}
$http = eZHTTPTool::instance();
$user = eZUser::fetch($UserID);
if (!$user) {
    return $Module->handleError(eZError::KERNEL_NOT_AVAILABLE, 'kernel');
}
$userObject = $user->attribute('contentobject');
if (!$userObject) {
    return $Module->handleError(eZError::KERNEL_NOT_AVAILABLE, 'kernel');
}
$userSetting = eZUserSetting::fetch($UserID);
if ($http->hasPostVariable("UpdateSettingButton")) {
    $isEnabled = 0;
    if ($http->hasPostVariable('max_login')) {
        $maxLogin = $http->postVariable('max_login');
    } else {
        $maxLogin = $userSetting->attribute('max_login');
    }
    if ($http->hasPostVariable('is_enabled')) {
        $isEnabled = 1;
    }
    if (eZOperationHandler::operationIsAvailable('user_setsettings')) {
        $operationResult = eZOperationHandler::execute('user', 'setsettings', array('user_id' => $UserID, 'is_enabled' => $isEnabled, 'max_login' => $maxLogin));
    } else {
        eZUserOperationCollection::setSettings($UserID, $isEnabled, $maxLogin);
    }
开发者ID:mugoweb,项目名称:ezpublish-legacy,代码行数:31,代码来源:setting.php


示例9: array

    // execute operation to publish the user object
    $publishResult = eZOperationHandler::execute('user', 'register', array('user_id' => $userID));
    if ($publishResult['status'] === eZModuleOperationInfo::STATUS_HALTED) {
        $isPending = true;
    } else {
        // Log in user
        $user = eZUser::fetch($userID);
        if ($user === null) {
            return $Module->handleError(eZError::KERNEL_NOT_FOUND, 'kernel');
        }
        $user->loginCurrent();
    }
} elseif ($mainNodeID) {
    $userContentObject = eZContentObject::fetchByNodeID($mainNodeID);
    if ($userContentObject instanceof eZContentObject) {
        $userSetting = eZUserSetting::fetch($userContentObject->attribute('id'));
        if ($userSetting !== null && $userSetting->attribute('is_enabled')) {
            $alreadyActive = true;
        }
    }
}
// Template handling
$tpl = eZTemplate::factory();
$tpl->setVariable('module', $Module);
$tpl->setVariable('account_activated', $accountActivated);
$tpl->setVariable('already_active', $alreadyActive);
$tpl->setVariable('is_pending', $isPending);
// This line is deprecated, the correct name of the variable should
// be 'account_activated' as shown above.
// However it is kept for backwards compatibility.
$tpl->setVariable('account_avtivated', $accountActivated);
开发者ID:EVE-Corp-Center,项目名称:ECC-Website,代码行数:31,代码来源:activate.php


示例10: set_time_limit

 * File containing a script responsible for disabling user accounts with suspicious user login (containing < and >).
 *
 * @copyright Copyright (C) 1999-2013 eZ Systems AS. All rights reserved.
 * @license http://www.gnu.org/licenses/gpl-2.0.txt GNU General Public License v2
 * @version  2013.11
 * @package update
 */
require 'autoload.php';
set_time_limit(0);
$cli = eZCLI::instance();
$script = eZScript::instance(array('description' => 'Script responsible for disabling user accounts with suspicious user login (containing < and >)', 'use-session' => false, 'use-modules' => false, 'use-extensions' => true));
$options = $script->getOptions('[disable]', '', array('-q' => 'Quiet mode', 'disable' => 'Disabling user accounts with suspicious user login.'));
$cli = eZCLI::instance();
$script->initialize();
$script->startup();
$db = eZDB::instance();
$rows = $db->arrayQuery("SELECT DISTINCT login FROM ezuser, ezuser_setting\n                            WHERE ( ezuser.login LIKE '%<%' OR ezuser.login LIKE '%>%' )\n                                AND ezuser.contentobject_id = ezuser_setting.user_id\n                                    AND ezuser_setting.is_enabled = '1'");
$cli->output('Script found ' . count($rows) . ' user accounts with suspicious login.');
$cli->output('Login list');
foreach ($rows as $index => $row) {
    $user = eZUser::fetchByName($row['login']);
    $userSetting = eZUserSetting::fetch($user->attribute('contentobject_id'));
    $cli->output($index + 1 . '. ' . $row['login']);
    if ($options['disable']) {
        $userSetting->setAttribute('is_enabled', 0);
        $userSetting->store();
        $cli->output('Disabled user account for login "' . $row['login'] . '" with ID "' . $user->attribute('contentobject_id') . "'");
    }
}
$cli->output('Done.');
$script->shutdown();
开发者ID:jordanmanning,项目名称:ezpublish,代码行数:31,代码来源:disablesuspicioususers.php


示例11: fromString

 /**
  * Populates the user_account datatype with the correct values
  * based upon the string passed in $string.
  *
  * The string that must be passed looks like the following :
  * login|email|password_hash|hash_identifier|is_enabled
  *
  * Example:
  * <code>
  * foo|[email protected]|1234|md5_password|0
  * </code>
  *
  * @param object $contentObjectAttribute A contentobject attribute of type user_account.
  * @param string $string The string as described in the example.
  * @return object The newly created eZUser object
  */
 function fromString($contentObjectAttribute, $string)
 {
     if ($string == '') {
         return true;
     }
     $userData = explode('|', $string);
     if (count($userData) < 2) {
         return false;
     }
     $login = $userData[0];
     $email = $userData[1];
     $userByUsername = eZUser::fetchByName($login);
     if ($userByUsername && $userByUsername->attribute('contentobject_id') != $contentObjectAttribute->attribute('contentobject_id')) {
         return false;
     }
     if (eZUser::requireUniqueEmail()) {
         $userByEmail = eZUser::fetchByEmail($email);
         if ($userByEmail && $userByEmail->attribute('contentobject_id') != $contentObjectAttribute->attribute('contentobject_id')) {
             return false;
         }
     }
     $user = eZUser::create($contentObjectAttribute->attribute('contentobject_id'));
     $user->setAttribute('login', $login);
     $user->setAttribute('email', $email);
     if (isset($userData[2])) {
         $user->setAttribute('password_hash', $userData[2]);
     }
     if (isset($userData[3])) {
         $user->setAttribute('password_hash_type', eZUser::passwordHashTypeID($userData[3]));
     }
     if (isset($userData[4])) {
         $userSetting = eZUserSetting::fetch($contentObjectAttribute->attribute('contentobject_id'));
         $userSetting->setAttribute("is_enabled", (int) (bool) $userData[4]);
         $userSetting->store();
     }
     $user->store();
     return $user;
 }
开发者ID:EVE-Corp-Center,项目名称:ECC-Website,代码行数:54,代码来源:ezusertype.php


示例12: loginUser

 static function loginUser($login, $password, $authenticationMatch = false)
 {
     $http = eZHTTPTool::instance();
     $db = eZDB::instance();
     if ($authenticationMatch === false) {
         $authenticationMatch = eZUser::authenticationMatch();
     }
     $loginEscaped = $db->escapeString($login);
     $passwordEscaped = $db->escapeString($password);
     $loginArray = array();
     if ($authenticationMatch & eZUser::AUTHENTICATE_LOGIN) {
         $loginArray[] = "login='{$loginEscaped}'";
     }
     if ($authenticationMatch & eZUser::AUTHENTICATE_EMAIL) {
         $loginArray[] = "email='{$loginEscaped}'";
     }
     if (count($loginArray) == 0) {
         $loginArray[] = "login='{$loginEscaped}'";
     }
     $loginText = implode(' OR ', $loginArray);
     $contentObjectStatus = eZContentObject::STATUS_PUBLISHED;
     $ini = eZINI::instance();
     $textFileIni = eZINI::instance('textfile.ini');
     $databaseName = $db->databaseName();
     // if mysql
     if ($databaseName === 'mysql') {
         $query = "SELECT contentobject_id, password_hash, password_hash_type, email, login\n                      FROM ezuser, ezcontentobject\n                      WHERE ( {$loginText} ) AND\n                        ezcontentobject.status='{$contentObjectStatus}' AND\n                        ( ezcontentobject.id=contentobject_id OR ( password_hash_type=4 AND ( {$loginText} ) AND password_hash=PASSWORD('{$passwordEscaped}') ) )";
     } else {
         $query = "SELECT contentobject_id, password_hash, password_hash_type, email, login\n                      FROM ezuser, ezcontentobject\n                      WHERE ( {$loginText} ) AND\n                            ezcontentobject.status='{$contentObjectStatus}' AND\n                            ezcontentobject.id=contentobject_id";
     }
     $users = $db->arrayQuery($query);
     $exists = false;
     if (count($users) >= 1) {
         foreach ($users as $userRow) {
             $userID = $userRow['contentobject_id'];
             $hashType = $userRow['password_hash_type'];
             $hash = $userRow['password_hash'];
             $exists = eZUser::authenticateHash($userRow['login'], $password, eZUser::site(), $hashType, $hash);
             // If hash type is MySql
             if ($hashType == eZUser::PASSWORD_HASH_MYSQL and $databaseName === 'mysql') {
                 $queryMysqlUser = "SELECT contentobject_id, password_hash, password_hash_type, email, login\n                                       FROM ezuser, ezcontentobject\n                                       WHERE ezcontentobject.status='{$contentObjectStatus}' AND\n                                             password_hash_type=4 AND ( {$loginText} ) AND password_hash=PASSWORD('{$passwordEscaped}') ";
                 $mysqlUsers = $db->arrayQuery($queryMysqlUser);
                 if (count($mysqlUsers) >= 1) {
                     $exists = true;
                 }
             }
             eZDebugSetting::writeDebug('kernel-user', eZUser::createHash($userRow['login'], $password, eZUser::site(), $hashType), "check hash");
             eZDebugSetting::writeDebug('kernel-user', $hash, "stored hash");
             // If current user has been disabled after a few failed login attempts.
             $canLogin = eZUser::isEnabledAfterFailedLogin($userID);
             if ($exists) {
                 // We should store userID for warning message.
                 $GLOBALS['eZFailedLoginAttemptUserID'] = $userID;
                 $userSetting = eZUserSetting::fetch($userID);
                 $isEnabled = $userSetting->attribute("is_enabled");
                 if ($hashType != eZUser::hashType() and strtolower($ini->variable('UserSettings', 'UpdateHash')) == 'true') {
                     $hashType = eZUser::hashType();
                     $hash = eZUser::createHash($login, $password, eZUser::site(), $hashType);
                     $db->query("UPDATE ezuser SET password_hash='{$hash}', password_hash_type='{$hashType}' WHERE contentobject_id='{$userID}'");
                 }
                 break;
             }
         }
     }
     if ($exists and $isEnabled and $canLogin) {
         eZDebugSetting::writeDebug('kernel-user', $userRow, 'user row');
         $user = new eZUser($userRow);
         eZDebugSetting::writeDebug('kernel-user', $user, 'user');
         $userID = $user->attribute('contentobject_id');
         eZUser::updateLastVisit($userID);
         eZUser::setCurrentlyLoggedInUser($user, $userID);
         // Reset number of failed login attempts
         eZUser::setFailedLoginAttempts($userID, 0);
         return $user;
     } else {
         if ($textFileIni->variable('TextFileSettings', 'TextFileEnabled') == "true") {
             $fileName = $textFileIni->variable('TextFileSettings', 'FileName');
             $filePath = $textFileIni->variable('TextFileSettings', 'FilePath');
             $defaultUserPlacement = $ini->variable("UserSettings", "DefaultUserPlacement");
             $separator = $textFileIni->variable("TextFileSettings", "FileFieldSeparator");
             $loginColumnNr = $textFileIni->variable("TextFileSettings", "LoginAttribute");
             $passwordColumnNr = $textFileIni->variable("TextFileSettings", "PasswordAttribute");
             $emailColumnNr = $textFileIni->variable("TextFileSettings", "EmailAttribute");
             $lastNameColumnNr = $textFileIni->variable("TextFileSettings", "LastNameAttribute");
             $firstNameColumnNr = $textFileIni->variable("TextFileSettings", "FirstNameAttribute");
             if ($textFileIni->hasVariable('TextFileSettings', 'DefaultUserGroupType')) {
                 $UserGroupType = $textFileIni->variable('TextFileSettings', 'DefaultUserGroupType');
                 $UserGroup = $textFileIni->variable('TextFileSettings', 'DefaultUserGroup');
             }
             if ($UserGroupType != null) {
                 if ($UserGroupType == "name") {
                     $groupName = $UserGroup;
                     $groupQuery = "SELECT ezcontentobject_tree.node_id\n                                       FROM ezcontentobject, ezcontentobject_tree\n                                       WHERE ezcontentobject.name='{$groupName}'\n                                       AND ezcontentobject.id=ezcontentobject_tree.contentobject_id";
                     $groupObject = $db->arrayQuery($groupQuery);
                     if (count($groupObject) > 0) {
                         $defaultUserPlacement = $groupObject[0]['node_id'];
                     }
                 } else {
                     if ($UserGroupType == "id") {
                         $groupID = $UserGroup;
//.........这里部分代码省略.........
开发者ID:brookinsconsulting,项目名称:ezecosystem,代码行数:101,代码来源:eztextfileuser.php


示例13: loginUser

 static function loginUser($login, $password, $authenticationMatch = false)
 {
     $http = eZHTTPTool::instance();
     $db = eZDB::instance();
     if ($authenticationMatch === false) {
         $authenticationMatch = eZUser::authenticationMatch();
     }
     $loginEscaped = $db->escapeString($login);
     $passwordEscaped = $db->escapeString($password);
     $loginLdapEscaped = self::ldap_escape($login);
     $loginArray = array();
     if ($authenticationMatch & eZUser::AUTHENTICATE_LOGIN) {
         $loginArray[] = "login='{$loginEscaped}'";
     }
     if ($authenticationMatch & eZUser::AUTHENTICATE_EMAIL) {
         $loginArray[] = "email='{$loginEscaped}'";
     }
     if (count($loginArray) == 0) {
         $loginArray[] = "login='{$loginEscaped}'";
     }
     $loginText = implode(' OR ', $loginArray);
     $contentObjectStatus = eZContentObject::STATUS_PUBLISHED;
     $ini = eZINI::instance();
     $LDAPIni = eZINI::instance('ldap.ini');
     $databaseName = $db->databaseName();
     // if mysql
     if ($databaseName === 'mysql') {
         $query = "SELECT contentobject_id, password_hash, password_hash_type, email, login\n                      FROM ezuser, ezcontentobject\n                      WHERE ( {$loginText} ) AND\n                            ezcontentobject.status='{$contentObjectStatus}' AND\n                            ( ezcontentobject.id=contentobject_id OR ( password_hash_type=4 AND ( {$loginText} ) AND password_hash=PASSWORD('{$passwordEscaped}') ) )";
     } else {
         $query = "SELECT contentobject_id, password_hash, password_hash_type, email, login\n                      FROM ezuser, ezcontentobject\n                      WHERE ( {$loginText} ) AND\n                            ezcontentobject.status='{$contentObjectStatus}' AND\n                            ezcontentobject.id=contentobject_id";
     }
     $users = $db->arrayQuery($query);
     $exists = false;
     if (count($users) >= 1) {
         foreach ($users as $userRow) {
             $userID = $userRow['contentobject_id'];
             $hashType = $userRow['password_hash_type'];
             $hash = $userRow['password_hash'];
             $exists = eZUser::authenticateHash($userRow['login'], $password, eZUser::site(), $hashType, $hash);
             // If hash type is MySql
             if ($hashType == eZUser::PASSWORD_HASH_MYSQL and $databaseName === 'mysql') {
                 $queryMysqlUser = "SELECT contentobject_id, password_hash, password_hash_type, email, login\n                                       FROM ezuser, ezcontentobject\n                                       WHERE ezcontentobject.status='{$contentObjectStatus}' AND\n                                             password_hash_type=4 AND ( {$loginText} ) AND password_hash=PASSWORD('{$passwordEscaped}') ";
                 $mysqlUsers = $db->arrayQuery($queryMysqlUser);
                 if (count($mysqlUsers) >= 1) {
                     $exists = true;
                 }
             }
             eZDebugSetting::writeDebug('kernel-user', eZUser::createHash($userRow['login'], $password, eZUser::site(), $hashType), "check hash");
             eZDebugSetting::writeDebug('kernel-user', $hash, "stored hash");
             // If current user has been disabled after a few failed login attempts.
             $canLogin = eZUser::isEnabledAfterFailedLogin($userID);
             if ($exists) {
                 // We should store userID for warning message.
                 $GLOBALS['eZFailedLoginAttemptUserID'] = $userID;
                 $userSetting = eZUserSetting::fetch($userID);
                 $isEnabled = $userSetting->attribute("is_enabled");
                 if ($hashType != eZUser::hashType() and strtolower($ini->variable('UserSettings', 'UpdateHash')) == 'true') {
                     $hashType = eZUser::hashType();
                     $hash = eZUser::createHash($login, $password, eZUser::site(), $hashType);
                     $db->query("UPDATE ezuser SET password_hash='{$hash}', password_hash_type='{$hashType}' WHERE contentobject_id='{$userID}'");
                 }
                 break;
             }
         }
     }
     if ($exists and $isEnabled and $canLogin) {
         eZDebugSetting::writeDebug('kernel-user', $userRow, 'user row');
         $user = new eZUser($userRow);
         eZDebugSetting::writeDebug('kernel-user', $user, 'user');
         $userID = $user->attribute('contentobject_id');
         eZUser::updateLastVisit($userID);
         eZUser::setCurrentlyLoggedInUser($user, $userID);
         // Reset number of failed login attempts
         eZUser::setFailedLoginAttempts($userID, 0);
         return $user;
     } else {
         if ($LDAPIni->variable('LDAPSettings', 'LDAPEnabled') === 'true') {
             // read LDAP ini settings
             // and then try to bind to the ldap server
             $LDAPDebugTrace = $LDAPIni->variable('LDAPSettings', 'LDAPDebugTrace') === 'enabled';
             $LDAPVersion = $LDAPIni->variable('LDAPSettings', 'LDAPVersion');
             $LDAPServer = $LDAPIni->variable('LDAPSettings', 'LDAPServer');
             $LDAPPort = $LDAPIni->variable('LDAPSettings', 'LDAPPort');
             $LDAPFollowReferrals = (int) $LDAPIni->variable('LDAPSettings', 'LDAPFollowReferrals');
             $LDAPBaseDN = $LDAPIni->variable('LDAPSettings', 'LDAPBaseDn');
             $LDAPBindUser = $LDAPIni->variable('LDAPSettings', 'LDAPBindUser');
             $LDAPBindPassword = $LDAPIni->variable('LDAPSettings', 'LDAPBindPassword');
             $LDAPSearchScope = $LDAPIni->variable('LDAPSettings', 'LDAPSearchScope');
             $LDAPLoginAttribute = strtolower($LDAPIni->variable('LDAPSettings', 'LDAPLoginAttribute'));
             $LDAPFirstNameAttribute = strtolower($LDAPIni->variable('LDAPSettings', 'LDAPFirstNameAttribute'));
             $LDAPFirstNameIsCN = $LDAPIni->variable('LDAPSettings', 'LDAPFirstNameIsCommonName') === 'true';
             $LDAPLastNameAttribute = strtolower($LDAPIni->variable('LDAPSettings', 'LDAPLastNameAttribute'));
             $LDAPEmailAttribute = strtolower($LDAPIni->variable('LDAPSettings', 'LDAPEmailAttribute'));
             $defaultUserPlacement = $ini->variable("UserSettings", "DefaultUserPlacement");
             $LDAPUserGroupAttributeType = strtolower($LDAPIni->variable('LDAPSettings', 'LDAPUserGroupAttributeType'));
             $LDAPUserGroupAttribute = strtolower($LDAPIni->variable('LDAPSettings', 'LDAPUserGroupAttribute'));
             if ($LDAPIni->hasVariable('LDAPSettings', 'Utf8Encoding')) {
                 $Utf8Encoding = $LDAPIni->variable('LDAPSettings', 'Utf8Encoding');
                 if ($Utf8Encoding == "true") {
                     $isUtf8Encoding = true;
//.........这里部分代码省略.........
开发者ID:CG77,项目名称:ezpublish-legacy,代码行数:101,代码来源:ezldapuser.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP eZWorkflow类代码示例发布时间:2022-05-23
下一篇:
PHP eZUser类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap