Index: branches/RC/core/kernel/session/session.php =================================================================== diff -u -r9286 -r9639 --- branches/RC/core/kernel/session/session.php (.../session.php) (revision 9286) +++ branches/RC/core/kernel/session/session.php (.../session.php) (revision 9639) @@ -41,7 +41,7 @@ Usage: -$session = new Session(smAUTO); //smAUTO is default, you could just leave the brackets empty, or provide another mode +$session =& new Session(smAUTO); //smAUTO is default, you could just leave the brackets empty, or provide another mode $session->SetCookieDomain('my.domain.com'); $session->SetCookiePath('/myscript'); @@ -302,7 +302,23 @@ function RecallPersistentVar(&$session, $var_name, $default = false) { - return isset($this->PersistentVars[$var_name]) ? $this->PersistentVars[$var_name] : $default; + if (isset($this->PersistentVars[$var_name])) { + return $this->PersistentVars[$var_name]; + } + elseif ($default == '_USE_DEFAULT_USER_DATA_') { + $default_user_id = $this->Application->ConfigValue('DefaultSettingsUserId'); + if (!$default_user_id) $default_user_id = -1; + $sql = 'SELECT VariableValue, VariableName + FROM '.TABLE_PREFIX.'PersistantSessionData + WHERE VariableName = '.$this->Conn->qstr($var_name).' AND PortalUserId = '.$default_user_id; + $value = $this->Conn->GetOne($sql); + if ($value !== false) { + $this->PersistentVars[$var_name] = $value; + $this->StorePersistentVar($session, $var_name, $value); //storing it, so next time we don't load default user setting + } + return $value; + } + else return $default; } function RemovePersistentVar(&$session, $var_name) @@ -402,7 +418,7 @@ $this->Checkers = Array(); $this->InitStorage($special); - $this->Data = new Params(); + $this->Data =& new Params(); $tmp_sid = $this->GetPassedSIDValue(); @@ -718,7 +734,7 @@ function Destroy() { $this->Storage->DeleteSession($this); - $this->Data = new Params(); + $this->Data =& new Params(); $this->SID = ''; if ($this->CookiesEnabled) $this->SetSessionCookie(); //will remove the cookie due to value (sid) is empty $this->SetSession(); //will create a new session