本文整理汇总了PHP中eZSession::start方法的典型用法代码示例。如果您正苦于以下问题:PHP eZSession::start方法的具体用法?PHP eZSession::start怎么用?PHP eZSession::start使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类eZSession
的用法示例。
在下文中一共展示了eZSession::start方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: exitWithInternalError
// load siteaccess
$access = eZSiteAccess::match( $uri,
eZSys::hostname(),
eZSys::serverPort(),
eZSys::indexFile() );
$access = eZSiteAccess::change( $access );
$GLOBALS['eZCurrentAccess'] = $access;
// Check for new extension loaded by siteaccess
eZExtension::activateExtensions( 'access' );
$db = eZDB::instance();
if ( $db->isConnected() )
{
eZSession::start();
}
else
{
exitWithInternalError();
return;
}
$moduleINI = eZINI::instance( 'module.ini' );
$globalModuleRepositories = $moduleINI->variable( 'ModuleSettings', 'ModuleRepositories' );
eZModule::setGlobalPathList( $globalModuleRepositories );
$module = eZModule::exists( 'content' );
if ( !$module )
{
exitWithInternalError();
示例2: 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);
}
示例3: sessionInit
/**
* Initializes the session. If running, through Symfony the session
* parameters from Symfony override the session parameter from eZ Publish.
*/
protected function sessionInit()
{
if (!isset($this->settings['session']) || !$this->settings['session']['configured']) {
// running without Symfony2 or session is not configured
// we keep the historic behaviour
$ini = eZINI::instance();
if ($ini->variable('Session', 'ForceStart') === 'enabled') {
eZSession::start();
} else {
eZSession::lazyStart();
}
} else {
$sfHandler = new ezpSessionHandlerSymfony($this->settings['session']['has_previous'] || $this->settings['session']['started']);
$sfHandler->setStorage($this->settings['session']['storage']);
eZSession::init($this->settings['session']['name'], $this->settings['session']['started'], $this->settings['session']['namespace'], $sfHandler);
}
// let session specify if db is required
$this->siteBasics['db-required'] = eZSession::getHandlerInstance()->dbRequired();
}
示例4:
$userID = 0;
if ( $user instanceof eZUser )
$userID = $user->id();
if ( $userID > 0 )
{
if ( $http->hasPostVariable( 'Cookie' ) )
{
$ini = eZINI::instance();
$rememberMeTimeout = $ini->hasVariable( 'Session', 'RememberMeTimeout' )
? $ini->variable( 'Session', 'RememberMeTimeout' )
: false;
if ( $rememberMeTimeout )
{
eZSession::stop();
eZSession::start( $rememberMeTimeout );
}
}
$http->removeSessionVariable( 'eZUserLoggedInID' );
$http->setSessionVariable( 'eZUserLoggedInID', $userID );
// Remove all temporary drafts
eZContentObject::cleanupAllInternalDrafts( $userID );
return $Module->redirectTo( $redirectionURI );
}
}
else
{
// called from outside of a template (?)
$requestedURI = $GLOBALS['eZRequestedURI'];
示例5: create
/**
* Create a ezsrRatingDataObject by definition data (but do not store it, thats up to you!)
* NOTE: you have to provide the following attributes:
* contentobject_id
* contentobject_attribute_id
* rating (this is only requried if you plan to store the object)
*
* @param array $row
* @return ezsrRatingDataObject
*/
static function create( $row = array() )
{
if ( !isset( $row['session_key'] ) )
{
$http = eZHTTPTool::instance();
if (
eZINI::instance()->variable( 'eZStarRating', 'UseUserSession' ) === 'enabled'
&& !eZSession::hasStarted()
)
{
// Creates a session for anonymous
eZSession::start();
}
$row['session_key'] = $http->sessionID();
}
if ( !isset( $row['user_id'] ) )
{
$row['user_id'] = eZUser::currentUserID();
}
if ( !isset( $row['created_at'] ) )
{
$row['created_at'] = time();
}
if ( !isset( $row['contentobject_id'] ) )
{
eZDebug::writeError( 'Missing \'contentobject_id\' parameter!', __METHOD__ );
}
if ( !isset( $row['contentobject_attribute_id'] ) )
{
eZDebug::writeError( 'Missing \'contentobject_attribute_id\' parameter!', __METHOD__ );
}
$object = new self( $row );
return $object;
}
示例6: flush
static public function flush()
{
if ( self::$_isDirty )
{
eZDebug::writeWarning(print_r( self::sessionArray(), true), "Flushing session - Should not happen");
eZSession::start();
foreach ( self::$_localSession as $k => $v)
eZSession::set($k, $v);
}
}