Index: trunk/core/kernel/session/session.php =================================================================== diff -u -r6428 -r6685 --- trunk/core/kernel/session/session.php (.../session.php) (revision 6428) +++ trunk/core/kernel/session/session.php (.../session.php) (revision 6685) @@ -91,13 +91,16 @@ function StoreSession(&$session, $additional_fields = Array()) { - $fields_hash = Array( $this->IDField => $session->SID, - $this->TimestampField => $session->Expiration); - if ($additional_fields) { - $fields_hash = array_merge_recursive2($fields_hash, $additional_fields); - } + $fields_hash = Array ( + $this->IDField => $session->SID, + $this->TimestampField => $session->Expiration + ); + + $this->Conn->doInsert($fields_hash, $this->TableName); - $this->Conn->doInsert($fields_hash, $this->TableName); + foreach ($additional_fields as $field_name => $field_value) { + $this->SetField($session, $field_name, $field_value); + } } function DeleteSession(&$session) @@ -159,7 +162,8 @@ function SetField(&$session, $var_name, $value) { - if ($this->DirectVars[$var_name] != $value) { + $value_changed = !isset($this->DirectVars[$var_name]) || ($this->DirectVars[$var_name] != $value); + if ($value_changed) { $this->DirectVars[$var_name] = $value; $this->ChangedDirectVars[] = $var_name; $this->ChangedDirectVars = array_unique($this->ChangedDirectVars); @@ -429,7 +433,8 @@ if (!$cookies_on || $this->IsHTTPSRedirect()) { //If referer is our server, but we don't have our cookies_on, it's definetly off - if ($this->CheckReferer(1) && !$this->Application->GetVar('admin') && !$this->IsHTTPSRedirect()) { + $is_install = defined('IS_INSTALL') && IS_INSTALL; + if (!$is_install && $this->CheckReferer(1) && !$this->Application->GetVar('admin') && !$this->IsHTTPSRedirect()) { $this->CookiesEnabled = false; } else { @@ -500,16 +505,16 @@ switch ($this->Mode) { case smAUTO: //Cookies has the priority - we ignore everything else - $sid=$this->CookiesEnabled ? getArrayValue($http_query->Cookie,$this->CookieName) : $get_sid; + $sid = $this->CookiesEnabled ? $this->GetSessionCookie() : $get_sid; break; case smCOOKIES_ONLY: - $sid = $http_query->Cookie[$this->CookieName]; + $sid = $this->GetSessionCookie(); break; case smGET_ONLY: $sid = $get_sid; break; case smCOOKIES_AND_GET: - $cookie_sid = $http_query->Cookie[$this->CookieName]; + $cookie_sid = $this->GetSessionCookie(); //both sids should match if cookies are enabled if (!$this->CookiesEnabled || ($cookie_sid == $get_sid)) { @@ -594,6 +599,20 @@ $this->Storage->StoreSession($this); } + /** + * Returns SID from cookie + * + * @return int + */ + function GetSessionCookie() + { + return isset($this->Application->HttpQuery->Cookie[$this->CookieName]) ? $this->Application->HttpQuery->Cookie[$this->CookieName] : false; + } + + /** + * Updates SID in cookie with new value + * + */ function SetSessionCookie() { setcookie(