本文整理汇总了PHP中eZUser::loginUser方法的典型用法代码示例。如果您正苦于以下问题:PHP eZUser::loginUser方法的具体用法?PHP eZUser::loginUser怎么用?PHP eZUser::loginUser使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类eZUser
的用法示例。
在下文中一共展示了eZUser::loginUser方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: templateInit
include_once 'kernel/common/template.php';
include_once 'kernel/classes/datatypes/ezuser/ezuser.php';
include_once "lib/ezutils/classes/ezhttptool.php";
$tpl = templateInit();
$http = eZHTTPTool::instance();
if ($http->hasPostVariable('Username')) {
}
$username = $http->postVariable('Username');
if ($http->hasPostVariable('Password')) {
}
$password = $http->postVariable('Password');
if ($http->hasPostVariable('NodeID')) {
}
$parentNodeID = $http->postVariable('NodeID');
// User authentication
$user = eZUser::loginUser($username, $password);
if ($user == false) {
print 'problem:Authentication failed';
eZExecution::cleanExit();
} else {
// Print the list of ID nodes..
//Structure : name, type, ID
$nodes = eZFunctionHandler::execute('content', 'list', array('parent_node_id' => $parentNodeID));
$array = array();
foreach ($nodes as $node) {
$tpl->setVariable('node', $node);
$nodeID = $node->attribute('node_id');
$name = $node->attribute('name');
$className = $node->attribute('class_name');
$object =& $node->object();
$contentClass = $object->contentClass();
示例2: eZUpdateTextCodecSettings
$soapINI->loadCache();
/*!
Reads settings from i18n.ini and passes them to eZTextCodec.
*/
function eZUpdateTextCodecSettings()
{
$ini = eZINI::instance('i18n.ini');
list($i18nSettings['internal-charset'], $i18nSettings['http-charset'], $i18nSettings['mbstring-extension']) = $ini->variableMulti('CharacterSettings', array('Charset', 'HTTPCharset', 'MBStringExtension'), array(false, false, 'enabled'));
eZTextCodec::updateSettings($i18nSettings);
}
// Initialize text codec settings
eZUpdateTextCodecSettings();
// Initialize module loading
$moduleRepositories = eZModule::activeModuleRepositories();
eZModule::setGlobalPathList($moduleRepositories);
// Load soap extensions
$enableSOAP = $soapINI->variable('GeneralSettings', 'EnableSOAP');
if ($enableSOAP == 'true') {
eZSys::init('soap.php');
// Login if we have username and password.
if (eZHTTPTool::username() and eZHTTPTool::password()) {
eZUser::loginUser(eZHTTPTool::username(), eZHTTPTool::password());
}
$server = new eZSOAPServer();
foreach ($soapINI->variable('ExtensionSettings', 'SOAPExtensions') as $extension) {
include_once eZExtension::baseDirectory() . '/' . $extension . '/soap/initialize.php';
}
$server->processRequest();
}
ob_end_flush();
eZExecution::cleanExit();
示例3: initialize
function initialize()
{
if (ob_get_length() != 0) {
ob_end_clean();
}
$debugINI = eZINI::instance('debug.ini');
eZDebugSetting::setDebugINI($debugINI);
// Initialize text codec settings
$this->updateTextCodecSettings();
// Initialize debug settings
$this->updateDebugSettings($this->UseDebugOutput);
// Set the different permissions/settings.
$ini = eZINI::instance();
$iniFilePermission = $ini->variable('FileSettings', 'StorageFilePermissions');
$iniDirPermission = $ini->variable('FileSettings', 'StorageDirPermissions');
$iniVarDirectory = eZSys::cacheDirectory();
eZCodePage::setPermissionSetting(array('file_permission' => octdec($iniFilePermission), 'dir_permission' => octdec($iniDirPermission), 'var_directory' => $iniVarDirectory));
eZExecution::addCleanupHandler('eZDBCleanup');
eZExecution::addFatalErrorHandler('eZFatalError');
eZDebug::setHandleType(eZDebug::HANDLE_FROM_PHP);
if ($this->UseExtensions) {
// Check for extension
eZExtension::activateExtensions('default');
// Extension check end
} else {
if (!$this->isQuiet()) {
$cli = eZCLI::instance();
$cli->output("Notice: This script uses 'use-extensions' => false, meaning extension settings are not loaded!");
}
}
$siteaccess = $this->SiteAccess;
if ($siteaccess) {
$access = array('name' => $siteaccess, 'type' => eZSiteAccess::TYPE_STATIC);
} else {
$ini = eZINI::instance();
$siteaccess = $ini->variable('SiteSettings', 'DefaultAccess');
$access = array('name' => $siteaccess, 'type' => eZSiteAccess::TYPE_DEFAULT);
}
$access = eZSiteAccess::change($access);
if ($this->UseExtensions) {
// Check for siteaccess extension
eZExtension::activateExtensions('access');
// Extension check end
}
// Now that all extensions are activated and siteaccess has been changed, reset
// all eZINI instances as they may not take into account siteaccess specific settings.
eZINI::resetAllInstances(false);
// Set the global setting which is read by the session lib
$GLOBALS['eZSiteBasics']['session-required'] = $this->UseSession;
if ($this->UseSession) {
$db = eZDB::instance();
if ($db->isConnected()) {
eZSession::start();
} else {
$this->setIsInitialized(false);
$this->InitializationErrorMessage = 'database error: ' . $db->errorMessage();
return;
}
}
if ($this->User) {
$userLogin = $this->User['login'];
$userPassword = $this->User['password'];
if ($userLogin and $userPassword) {
$userID = eZUser::loginUser($userLogin, $userPassword);
if (!$userID) {
$cli = eZCLI::instance();
if ($this->isLoud()) {
$cli->warning('Failed to login with user ' . $userLogin);
}
eZExecution::cleanup();
eZExecution::setCleanExit();
}
}
}
// Initialize module handling
if ($this->UseModules) {
$moduleRepositories = eZModule::activeModuleRepositories($this->UseExtensions);
eZModule::setGlobalPathList($moduleRepositories);
}
$this->setIsInitialized(true);
}
示例4: redirect
$user = ngConnectFunctions::createUser($authResult);
if ($user instanceof eZUser && $user->canLoginToSiteAccess($GLOBALS['eZCurrentAccess'])) {
$user->loginCurrent();
} else {
eZUser::logoutCurrent();
}
redirect($http, $module);
} else {
$validationError = ezpI18n::tr('extension/ngconnect/ngconnect/profile', 'User with an email address supplied by your social network already exists. Try logging in instead.');
}
} else {
if ($http->hasPostVariable('LoginButton') && ($ngConnectINI->variable('ProfileGenerationSettings', 'LoginUser') == 'enabled' || $forcedRedirect)) {
// user is trying to connect to the existing account
$login = trim($http->postVariable('Login'));
$password = trim($http->postVariable('Password'));
$userToLogin = eZUser::loginUser($login, $password);
if ($userToLogin instanceof eZUser) {
if ($userToLogin->canLoginToSiteAccess($GLOBALS['eZCurrentAccess'])) {
if (ngConnect::userHasConnection($userToLogin->ContentObjectID, $authResult['login_method'])) {
eZUser::logoutCurrent();
$validationError = ezpI18n::tr('extension/ngconnect/ngconnect/profile', 'This account already has a connection to selected social network.');
} else {
ngConnectFunctions::connectUser($userToLogin->ContentObjectID, $authResult['login_method'], $authResult['id']);
redirect($http, $module);
}
} else {
eZUser::logoutCurrent();
$validationError = ezpI18n::tr('extension/ngconnect/ngconnect/profile', 'You are not allowed to access the site.');
}
} else {
$validationError = ezpI18n::tr('extension/ngconnect/ngconnect/profile', 'A valid username and password is required to login.');