Esempio n. 1
0
 /**
  * Makes sure the $user is set as the currently logged in user by
  * updating the session and setting the necessary global variables.
  *
  * All login handlers should use this function to ensure that the process
  * is executed properly.
  *
  * @access private
  *
  * @param eZUser $user User
  * @param int $userID User ID
  * @param int $flags Optional flag that can be set to:
  *        eZUser::NO_SESSION_REGENERATE to avoid session to be regenerated
  */
 static function setCurrentlyLoggedInUser($user, $userID, $flags = 0)
 {
     $GLOBALS["eZUserGlobalInstance_{$userID}"] = $user;
     // Set/overwrite the global user, this will be accessed from
     // instance() when there is no ID passed to the function.
     $GLOBALS["eZUserGlobalInstance_"] = $user;
     eZSession::setUserID($userID);
     if (!($flags & self::NO_SESSION_REGENERATE)) {
         eZSession::regenerate();
     }
     eZSession::set('eZUserLoggedInID', $userID);
     self::cleanup();
 }
Esempio n. 2
0
 /**
  * Sets the session variable $name to value $value.
  *
  * @param string $name
  * @param mixed $value
  */
 function setSessionVariable($name, $value)
 {
     eZSession::set($name, $value);
 }
Esempio n. 3
0
 /**
  * Gets the user token from session if it exists or create+store
  * it in session.
  *
  * @return string|null
  */
 public static function getToken()
 {
     if (eZSession::issetkey(self::SESSION_KEY)) {
         return eZSession::get(self::SESSION_KEY);
     }
     $token = md5(uniqid(self::SESSION_KEY, true));
     eZSession::set(self::SESSION_KEY, $token);
     return $token;
 }
Esempio n. 4
0
 static function setCurrentlyLoggedInUser( $user, $userID )
 {
     $GLOBALS["eZUserGlobalInstance_$userID"] = $user;
     // Set/overwrite the global user, this will be accessed from
     // instance() when there is no ID passed to the function.
     $GLOBALS["eZUserGlobalInstance_"] = $user;
     eZSession::setUserID( $userID );
     eZSession::set( 'eZUserLoggedInID', $userID );
     self::cleanup();
     eZSession::regenerate();
 }
 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);
     }
 }
Esempio n. 6
0
    $parameters['redirect'] = 'url_alias';
    eZSession::set('bcimagealias_create_parameters', $parameters);
} elseif ($http->hasVariable('NodeID') && $http->variable('NodeID') != '') {
    $parameters['node-id'] = $http->variable('NodeID');
    $parameters['redirect'] = 'url_alias';
    eZSession::set('bcimagealias_create_parameters', $parameters);
}
/**
 * Test for existance of module variable, 'Children'
 */
if (isset($Params['Children']) && $Params['Children'] != '') {
    $parameters['children'] = $Params['Children'] == 'true' ? true : false;
    eZSession::set('bcimagealias_create_parameters', $parameters);
} elseif ($http->hasVariable('Children') && $http->variable('Children') != '') {
    $parameters['children'] = $http->variable('Children') == 'true' ? true : false;
    eZSession::set('bcimagealias_create_parameters', $parameters);
}
/**
 * Test for existance of module variable, 'Regenerate'
 */
if (isset($Params['Regenerate']) && $Params['Regenerate'] != '') {
    $executionOptions['force'] = $Params['Regenerate'] == 'true' ? true : false;
} elseif ($http->hasVariable('Regenerate') && $http->variable('Regenerate') != '') {
    $executionOptions['force'] = $http->variable('Regenerate') == 'true' ? true : false;
}
/**
 * Test for existance of module variable, 'CurrentSiteaccess'
 */
if (isset($Params['CurrentSiteaccess']) && $Params['CurrentSiteaccess'] != '' && $Params['CurrentSiteaccess'] != 'true') {
    $executionOptions['current-siteaccess'] = $Params['CurrentSiteaccess'] == 'true' ? true : false;
} elseif ($http->hasVariable('CurrentSiteaccess') && $http->variable('CurrentSiteaccess') != '' && $http->variable('CurrentSiteaccess') != 'true') {
 public function store()
 {
     eZSession::set(self::SESSION_IDENTIFIER, serialize($this));
 }
Esempio n. 8
0
 /**
  *
  * Handles casese where the token is reset during a request.
  *
  * @param bool $restore
  *
  * @return bool
  *
  */
 public static function handleEZXFormToken($restore = false)
 {
     $activeExtensions = \eZExtension::activeExtensions();
     if (in_array('ezformtoken', $activeExtensions)) {
         if ($restore) {
             if (isset(self::$ezxFormToken) && !empty(self::$ezxFormToken)) {
                 \eZSession::set(\ezxFormToken::SESSION_KEY, self::$ezxFormToken);
             }
         } else {
             self::$ezxFormToken = \eZSession::get(\ezxFormToken::SESSION_KEY);
         }
         return self::$ezxFormToken;
     }
     return false;
 }
 /**
  *
  * @param string $user Usually get from MMUsers::getCurrentUserObject() function
  */
 protected function getSubsForOptin($user) {
     if( $user && SolrSafeOperatorHelper::featureIsActive('newsletterPopin') ) {
         if (SolrSafeOperatorHelper::featureIsActive('UUMP')) {
             // not yet activated for UUMP clusters
             //$instance = new ServiceUserUUMP();
         }
         else {
             $instance = new ServiceUser();
             $userSubs = $instance->subsread();
             $userSubs = $userSubs['Data']['Subs'];
             $toCheck = array();
             $subs = json_decode(CacheFeatureTool::getFeatureLocalizedByCode('newsletterPopin')->parameters, true);
             foreach ( $subs as $key => $value ) {
                 if ( $value ) {
                     $toCheck[] = $key;
                 }
             }
             $filteredSubs = array();
             if(is_array($userSubs)){
                 foreach ( $userSubs as $key => $value ) {
                     $filteredSubs[] = $value['offerId'];
                 }
             }
             $listOfChecks = array();
             if ( !empty($toCheck) ) {
                 foreach ( $toCheck as $value ) {
                     if ( !in_array( $value, $filteredSubs ) && $value != "daysToCheck" ){
                         $listOfChecks[] = $value;
                     }
                 }
             }
             if (!empty($listOfChecks)) {
                 eZSession::set('listOfChecks', $listOfChecks);
             }
         }
     }
 }
Esempio n. 10
0
    $parameters['redirect'] = 'url_alias';
    eZSession::set('bcimagealias_remove_parameters', $parameters);
} elseif ($http->hasVariable('NodeID') && $http->variable('NodeID') != '') {
    $parameters['node-id'] = $http->variable('NodeID');
    $parameters['redirect'] = 'url_alias';
    eZSession::set('bcimagealias_remove_parameters', $parameters);
}
/**
 * Test for existance of module variable, 'Children'
 */
if (isset($Params['Children']) && $Params['Children'] != '') {
    $parameters['children'] = $Params['Children'] == 'true' ? true : false;
    eZSession::set('bcimagealias_remove_parameters', $parameters);
} elseif ($http->hasVariable('Children') && $http->variable('Children') != '') {
    $parameters['children'] = $http->variable('Children') == 'true' ? true : false;
    eZSession::set('bcimagealias_remove_parameters', $parameters);
}
/**
 * Test for existance of module variable, 'CurrentSiteaccess'
 */
if (isset($Params['CurrentSiteaccess']) && $Params['CurrentSiteaccess'] != '' && $Params['CurrentSiteaccess'] != 'true') {
    $executionOptions['current-siteaccess'] = $Params['CurrentSiteaccess'] == 'true' ? true : false;
} elseif ($http->hasVariable('CurrentSiteaccess') && $http->variable('CurrentSiteaccess') != '' && $http->variable('CurrentSiteaccess') != 'true') {
    $executionOptions['current-siteaccess'] = $http->variable('CurrentSiteaccess') == 'true' ? true : false;
}
// Fetch and use parameters from session directly
$parameters = eZSession::get('bcimagealias_remove_parameters', $parameters);
// print_r($parameters); echo "\n\n"; die();
/**
 * Test for non existance of parameter variable, 'node-id' or invalid value and display browse view
 */