Changeset View
Changeset View
Standalone View
Standalone View
core/kernel/session/session_storage.php
Show All 31 Lines | |||||
var $Expiration; | var $Expiration; | ||||
var $SessionTimeout = 0; | var $SessionTimeout = 0; | ||||
var $DirectVars = Array (); | var $DirectVars = Array (); | ||||
var $ChangedDirectVars = Array (); | var $ChangedDirectVars = Array (); | ||||
var $PersistentVars = Array (); | var $PersistentVars = Array (); | ||||
/** | |||||
* Default persistent vars | |||||
* | |||||
* @var array | |||||
*/ | |||||
protected $defaultPersistentVars = array(); | |||||
var $OriginalData = Array (); | var $OriginalData = Array (); | ||||
Lint: CodingStandard.Classes.PropertyDeclaration.ScopeMissing: Visibility must be declared on property "$OriginalData" | |||||
PHP keywords must be lowercase; expected "array" but found "Array" Lint: Generic.PHP.LowerCaseKeyword.Found: PHP keywords must be lowercase; expected "array" but found "Array" | |||||
There must be no space between the Array keyword and the opening parenthesis Lint: CodingStandard.Arrays.Array.SpaceAfterKeyword: There must be no space between the Array keyword and the opening parenthesis | |||||
Public member variable "SessionStorage::OriginalData" is not in valid camel caps format Lint: CodingStandard.NamingConventions.ValidVariableName.MemberNotCamelCaps: Public member variable "SessionStorage::OriginalData" is not in valid camel caps format | |||||
The var keyword must not be used to declare a property Lint: CodingStandard.Classes.PropertyDeclaration.VarUsed: The var keyword must not be used to declare a property | |||||
Lint: Squiz.Commenting.VariableComment.Missing: Missing member variable doc comment | |||||
var $TimestampField; | var $TimestampField; | ||||
var $SessionDataTable; | var $SessionDataTable; | ||||
var $DataValueField; | var $DataValueField; | ||||
var $DataVarField; | var $DataVarField; | ||||
public function Init($prefix, $special) | public function Init($prefix, $special) | ||||
{ | { | ||||
▲ Show 20 Lines • Show All 293 Lines • ▼ Show 20 Line(s) | |||||
$sql = 'SELECT VariableValue, VariableName | $sql = 'SELECT VariableValue, VariableName | ||||
FROM '.TABLE_PREFIX.'UserPersistentSessionData | FROM '.TABLE_PREFIX.'UserPersistentSessionData | ||||
WHERE PortalUserId = '.$user_id; | WHERE PortalUserId = '.$user_id; | ||||
$this->PersistentVars = (array)$this->Conn->GetCol($sql, 'VariableName'); | $this->PersistentVars = (array)$this->Conn->GetCol($sql, 'VariableName'); | ||||
} | } | ||||
else { | else { | ||||
$this->PersistentVars = Array (); | $this->PersistentVars = Array (); | ||||
} | } | ||||
$default_user_id = (int)$this->Application->ConfigValue('DefaultSettingsUserId'); | |||||
if ( !$default_user_id ) { | |||||
$default_user_id = USER_ROOT; | |||||
} | |||||
if ( $user_id != $default_user_id ) { | |||||
$this->defaultPersistentVars = $this->PersistentVars; | |||||
alexUnsubmitted Not Done Replyaccording to implementation plan here you should be loading persistent settings of $default_user_id user alex: according to implementation plan here you should be loading persistent settings of… | |||||
} | |||||
} | } | ||||
/** | /** | ||||
* Stores variable to persistent session | * Stores variable to persistent session | ||||
* | * | ||||
* @param string $var_name | * @param string $var_name | ||||
* @param mixed $var_value | * @param mixed $var_value | ||||
* @param bool $optional | * @param bool $optional | ||||
* @return void | * @return void | ||||
* @access public | * @access public | ||||
*/ | */ | ||||
public function StorePersistentVar($var_name, $var_value, $optional = false) | public function StorePersistentVar($var_name, $var_value, $optional = false) | ||||
{ | { | ||||
$user_id = $this->Session->RecallVar('user_id'); | $user_id = $this->Session->RecallVar('user_id'); | ||||
if ( $user_id == USER_GUEST || $user_id === false ) { | if ( $user_id == USER_GUEST || $user_id === false ) { | ||||
// -2 (when not logged in), false (when after u:OnLogout event) | // -2 (when not logged in), false (when after u:OnLogout event) | ||||
Not Done Replyplease remove (array) The kDBConnection::GetCol method only returns array (when no results found the array is empty). alex: please remove `(array)`
---
The `kDBConnection::GetCol` method only returns array (when no… | |||||
$this->Session->StoreVar($var_name, $var_value, $optional); | $this->Session->StoreVar($var_name, $var_value, $optional); | ||||
return; | return; | ||||
} | } | ||||
$this->PersistentVars[$var_name] = $var_value; | $this->PersistentVars[$var_name] = $var_value; | ||||
$key_clause = 'PortalUserId = ' . $user_id . ' AND VariableName = ' . $this->Conn->qstr($var_name); | $key_clause = 'PortalUserId = ' . $user_id . ' AND VariableName = ' . $this->Conn->qstr($var_name); | ||||
Show All 33 Lines | |||||
return $this->Session->RecallVar($var_name, $default); | return $this->Session->RecallVar($var_name, $default); | ||||
} | } | ||||
if ( array_key_exists($var_name, $this->PersistentVars) ) { | if ( array_key_exists($var_name, $this->PersistentVars) ) { | ||||
return $this->PersistentVars[$var_name]; | return $this->PersistentVars[$var_name]; | ||||
} | } | ||||
elseif ( $default == ALLOW_DEFAULT_SETTINGS ) { | elseif ( $default == ALLOW_DEFAULT_SETTINGS ) { | ||||
$default_user_id = $this->Application->ConfigValue('DefaultSettingsUserId'); | if ( isset($this->defaultPersistentVars[$var_name]) ) { | ||||
$value = $this->defaultPersistentVars[$var_name]; | |||||
$this->StorePersistentVar($var_name, $value); | |||||
if ( !$default_user_id ) { | return $value; | ||||
$default_user_id = USER_ROOT; | |||||
} | } | ||||
$sql = 'SELECT VariableValue, VariableName | $this->PersistentVars[$var_name] = false; | ||||
FROM ' . TABLE_PREFIX . 'UserPersistentSessionData | |||||
WHERE VariableName = ' . $this->Conn->qstr($var_name) . ' AND PortalUserId = ' . $default_user_id; | |||||
$value = $this->Conn->GetOne($sql); | |||||
$this->PersistentVars[$var_name] = $value; | |||||
if ( $value !== false ) { | |||||
$this->StorePersistentVar($var_name, $value); //storing it, so next time we don't load default user setting | |||||
} | |||||
return $value; | return false; | ||||
} | } | ||||
return $default; | return $default; | ||||
} | } | ||||
/** | /** | ||||
* Removes variable from persistent session | * Removes variable from persistent session | ||||
* | * | ||||
▲ Show 20 Lines • Show All 80 Lines • ▼ Show 20 Line(s) | |||||
* @access public | * @access public | ||||
* @throws BadMethodCallException Always. | * @throws BadMethodCallException Always. | ||||
*/ | */ | ||||
public function GetCol($field) | public function GetCol($field) | ||||
{ | { | ||||
throw new BadMethodCallException('Unsupported'); | throw new BadMethodCallException('Unsupported'); | ||||
} | } | ||||
} | } | ||||
No newline at end of file |
Visibility must be declared on property "$OriginalData"