本文整理汇总了PHP中eZUser::isCurrentUserRegistered方法的典型用法代码示例。如果您正苦于以下问题:PHP eZUser::isCurrentUserRegistered方法的具体用法?PHP eZUser::isCurrentUserRegistered怎么用?PHP eZUser::isCurrentUserRegistered使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类eZUser
的用法示例。
在下文中一共展示了eZUser::isCurrentUserRegistered方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setUserHashCookie
/**
* Sets a cookie with the current user hash
*
* @param bool $unsetCookie controls whether to remove the cookie
*/
public static function setUserHashCookie($unsetCookie = false)
{
$wwwDir = eZSys::wwwDir();
// On host based site accesses this can be empty, causing the cookie to be set for the current dir,
// but we want it to be set for the whole eZ publish site
$cookiePath = $wwwDir != '' ? $wwwDir : '/';
if (eZUser::isCurrentUserRegistered()) {
setcookie('vuserhash', self::getUserHash($newSession), 0, $cookiePath);
} elseif ($unsetCookie) {
//removes cookie
setcookie('vuserhash', '0', 1, $cookiePath);
}
}
示例2: enabled
static function enabled()
{
if (isset($GLOBALS['eZHTTPHeaderCustom'])) {
return $GLOBALS['eZHTTPHeaderCustom'];
}
$ini = eZINI::instance();
if (!$ini->hasVariable('HTTPHeaderSettings', 'CustomHeader')) {
$GLOBALS['eZHTTPHeaderCustom'] = false;
} else {
if ($ini->variable('HTTPHeaderSettings', 'CustomHeader') === 'enabled' && $ini->hasVariable('HTTPHeaderSettings', 'OnlyForAnonymous') && $ini->variable('HTTPHeaderSettings', 'OnlyForAnonymous') === 'enabled') {
$GLOBALS['eZHTTPHeaderCustom'] = !eZUser::isCurrentUserRegistered();
} else {
$GLOBALS['eZHTTPHeaderCustom'] = $ini->variable('HTTPHeaderSettings', 'CustomHeader') == 'enabled';
}
}
return $GLOBALS['eZHTTPHeaderCustom'];
}
示例3: array
} else {
if ($http->hasPostVariable("ContentObjectID")) {
$objectID = $http->postVariable("ContentObjectID");
// Check which action to perform
if ($http->hasPostVariable("ActionAddToBasket")) {
$shopModule = eZModule::exists("shop");
$result = $shopModule->run("basket", array());
if (isset($result['content']) && $result['content']) {
return $result;
} else {
$module->setExitStatus($shopModule->exitStatus());
$module->setRedirectURI($shopModule->redirectURI());
}
} else {
if ($http->hasPostVariable("ActionAddToWishList")) {
if (!eZUser::isCurrentUserRegistered()) {
return $module->handleError(eZError::KERNEL_ACCESS_DENIED, 'kernel');
}
$shopModule = eZModule::exists("shop");
$result = $shopModule->run("wishlist", array());
$module->setExitStatus($shopModule->exitStatus());
$module->setRedirectURI($shopModule->redirectURI());
} else {
if ($http->hasPostVariable("ActionPreview")) {
$user = eZUser::currentUser();
$object = eZContentObject::fetch($objectID);
$module->redirectTo($module->functionURI('versionview') . '/' . $objectID . '/' . $object->attribute('current_version') . '/');
return;
} else {
if ($http->hasPostVariable("ActionRemove")) {
$viewMode = $http->postVariable('ViewMode', 'full');
示例4: shouldProtectUser
/**
* Figures out if current user should be protected or not
* based on if (s)he has a session and is logged in.
*
* @return bool
*/
protected static function shouldProtectUser()
{
if (!self::$isEnabled) {
return false;
}
if (!eZSession::hasStarted()) {
return false;
}
if (!eZUser::isCurrentUserRegistered()) {
return false;
}
return true;
}
示例5: verifyAccountInformation
function verifyAccountInformation()
{
return eZUser::isCurrentUserRegistered();
}
示例6: run
/**
* Execution point for controller actions
*/
public function run()
{
if ($this->mobileDeviceDetect->isEnabled()) {
$this->mobileDeviceDetect->process();
if ($this->mobileDeviceDetect->isMobileDevice()) {
$this->mobileDeviceDetect->redirect();
}
}
ob_start();
$this->requestInit();
// send header information
foreach (eZHTTPHeader::headerOverrideArray($this->uri) + array('Expires' => 'Mon, 26 Jul 1997 05:00:00 GMT', 'Last-Modified' => gmdate('D, d M Y H:i:s') . ' GMT', 'Cache-Control' => 'no-cache, must-revalidate', 'Pragma' => 'no-cache', 'X-Powered-By' => eZPublishSDK::EDITION, 'Content-Type' => 'text/html; charset=' . $this->httpCharset, 'Served-by' => isset($_SERVER["SERVER_NAME"]) ? $_SERVER['SERVER_NAME'] : null, 'Content-language' => $this->languageCode) as $key => $value) {
header($key . ': ' . $value);
}
try {
$moduleResult = $this->dispatchLoop();
} catch (Exception $e) {
$this->shutdown();
throw $e;
}
$ini = eZINI::instance();
/**
* Ouput an is_logged_in cookie when users are logged in for use by http cache solutions.
*
* @deprecated As of 4.5, since 4.4 added lazy session support (init on use)
*/
if ($ini->variable("SiteAccessSettings", "CheckValidity") !== 'true') {
$wwwDir = eZSys::wwwDir();
// On host based site accesses this can be empty, causing the cookie to be set for the current dir,
// but we want it to be set for the whole eZ publish site
$cookiePath = $wwwDir != '' ? $wwwDir : '/';
if (eZUser::isCurrentUserRegistered()) {
// Only set the cookie if it doesnt exist. This way we are not constantly sending the set request in the headers.
if (!isset($_COOKIE['is_logged_in']) || $_COOKIE['is_logged_in'] !== 'true') {
setcookie('is_logged_in', 'true', 0, $cookiePath);
}
} else {
if (isset($_COOKIE['is_logged_in'])) {
setcookie('is_logged_in', false, 0, $cookiePath);
}
}
}
if ($this->module->exitStatus() == eZModule::STATUS_REDIRECT) {
$this->shutdown();
return $this->redirect();
}
$uiContextName = $this->module->uiContextName();
// Store the last URI for access history for login redirection
// Only if user has session and only if there was no error or no redirects happen
if (eZSession::hasStarted() && $this->module->exitStatus() == eZModule::STATUS_OK) {
$currentURI = $this->completeRequestedURI;
if (strlen($currentURI) > 0 && $currentURI[0] !== '/') {
$currentURI = '/' . $currentURI;
}
$lastAccessedURI = "";
$lastAccessedViewURI = "";
$http = eZHTTPTool::instance();
// Fetched stored session variables
if ($http->hasSessionVariable("LastAccessesURI")) {
$lastAccessedViewURI = $http->sessionVariable("LastAccessesURI");
}
if ($http->hasSessionVariable("LastAccessedModifyingURI")) {
$lastAccessedURI = $http->sessionVariable("LastAccessedModifyingURI");
}
// Update last accessed view page
if ($currentURI != $lastAccessedViewURI && !in_array($uiContextName, array('edit', 'administration', 'ajax', 'browse', 'authentication'))) {
$http->setSessionVariable("LastAccessesURI", $currentURI);
}
// Update last accessed non-view page
if ($currentURI != $lastAccessedURI && $uiContextName != 'ajax') {
$http->setSessionVariable("LastAccessedModifyingURI", $currentURI);
}
}
eZDebug::addTimingPoint("Module end '" . $this->module->attribute('name') . "'");
if (!is_array($moduleResult)) {
eZDebug::writeError('Module did not return proper result: ' . $this->module->attribute('name'), 'index.php');
$moduleResult = array();
$moduleResult['content'] = false;
}
if (!isset($moduleResult['ui_context'])) {
$moduleResult['ui_context'] = $uiContextName;
}
$moduleResult['ui_component'] = $this->module->uiComponentName();
$moduleResult['is_mobile_device'] = $this->mobileDeviceDetect->isMobileDevice();
$moduleResult['mobile_device_alias'] = $this->mobileDeviceDetect->getUserAgentAlias();
$templateResult = null;
eZDebug::setUseExternalCSS($this->siteBasics['external-css']);
if ($this->siteBasics['show-page-layout']) {
$tpl = eZTemplate::factory();
if ($tpl->hasVariable('node')) {
$tpl->unsetVariable('node');
}
if (!isset($moduleResult['path'])) {
$moduleResult['path'] = false;
}
$moduleResult['uri'] = eZSys::requestURI();
$tpl->setVariable("module_result", $moduleResult);
//.........这里部分代码省略.........
示例7: update
/**
* Do all time based operations on block pool such as rotation, updating
* the queue, overflow as well as executes fetch interfaces.
*
* @static
*/
public static function update( $nodeArray = array() )
{
// log in user as anonymous if another user is logged in
if ( eZUser::isCurrentUserRegistered() )
{
$loggedInUser = eZUser::currentUser();
$anonymousUserId = eZUser::anonymousId();
$anonymousUser = eZUser::fetch( $anonymousUserId );
eZUser::setCurrentlyLoggedInUser( $anonymousUser, $anonymousUserId );
unset( $anonymousUser, $anonymousUserId );
}
include_once( 'kernel/classes/ezcontentcache.php' );
$ini = eZINI::instance( 'block.ini' );
$db = eZDB::instance();
// Remove the blocks and items for the block if marked for removal
$res = $db->arrayQuery( "SELECT id
FROM ezm_block
WHERE is_removed=1" );
foreach ( $res as $row )
{
$blockID = $row['id'];
$db->begin();
$db->query( "DELETE FROM ezm_pool
WHERE block_id='$blockID'" );
$db->query( "DELETE FROM ezm_block
WHERE id='$blockID'" );
$db->commit();
}
if ( !$nodeArray )
{
// Update pool and pages for all nodes
$res = $db->arrayQuery( "SELECT DISTINCT node_id FROM ezm_block" );
foreach ( $res as $row )
{
$nodeArray[] = $row['node_id'];
}
}
foreach ( $nodeArray as $nodeID )
{
// a safety margin
$delay = intval( eZINI::instance( 'ezflow.ini' )->variable( 'SafetyDelay', 'DelayInSeconds' ) );
$time = time() - $delay;
$nodeChanged = false;
$blocks = $db->arrayQuery( "SELECT *
FROM ezm_block
WHERE node_id=$nodeID" );
$blockByID = array();
// Determine the order of updating
$correctOrder = array();
$next = array();
foreach ( $blocks as $block )
{
$next[$block['id']] = trim( $block['overflow_id'] ); // Make sure that block ID does not any have spaces
$blockByID[$block['id']] = $block;
}
$nextIDs = array_keys( $next );
foreach ( $nextIDs as $id )
{
if ( in_array( $id, $correctOrder, true ) )
{
continue;
}
if ( !$next[$id] )
{
$correctOrder[] = $id;
continue;
}
$subCorrectOrder = array( $id );
$currentID = $id;
while ( ( $nextID = $next[$currentID] ) )
{
if ( !in_array( $nextID, $nextIDs, true ) )
{
eZDebug::writeWarning( "Overflow for $currentID is $nextID, but no such block was found for the given node", __METHOD__ );
break;
}
if ( in_array( $nextID, $subCorrectOrder, true ) )
{
eZDebug::writeWarning( "Loop detected, ignoring ($nextID should be after $currentID and vice versa)", __METHOD__ );
break;
//.........这里部分代码省略.........