Index: trunk/kernel/include/usersession.php =================================================================== diff -u -N -r7884 -r8029 --- trunk/kernel/include/usersession.php (.../usersession.php) (revision 7884) +++ trunk/kernel/include/usersession.php (.../usersession.php) (revision 8029) @@ -55,7 +55,7 @@ else { $this->Set("PortalUserId", 0); - $this->Set("Language", $objLanguages->GetPrimary()); + $this->Set("Language", (int)$objLanguages->GetPrimary()); $ThemeId = $m_var_list["theme"]; $this->SetThemeName($ThemeId); //$this->Set("Theme", $objConfig->Get("Default_Theme")); @@ -127,7 +127,7 @@ $this->Set("PortalUserId",$this->Get("PortalUserId")); $this->Set("GroupId",$this->Get("GroupId")); $this->Set("GroupList",$this->Get("GroupList")); - $this->Set("Language",$this->Get("Language")); + $this->Set("Language", (int)$this->Get("Language")); $this->Set("tz",$this->Get("tz")); $this->Set("LastAccessed",adodb_date("U")); $this->Update(); @@ -355,7 +355,7 @@ //$this->Set("CurrentTempKey",$this->GetUniqueKey()); $this->UseTempKeys=FALSE; $this->Set("PortalUserId", 0); - $this->Set("Language", $objLanguages->GetPrimary()); + $this->Set("Language", (int)$objLanguages->GetPrimary()); $ThemeId = $m_var_list["theme"]; $this->SetThemeName($ThemeId); //$this->Set("Theme", $objConfig->Get("Default_Theme")); @@ -370,7 +370,7 @@ else { $this->Set("PortalUserId", 0); - $this->Set("Language", $objLanguages->GetPrimary()); + $this->Set("Language", (int)$objLanguages->GetPrimary()); $ThemeId = $m_var_list["theme"]; $this->SetThemeName($ThemeId); //$this->Set("Theme", $objConfig->Get("Default_Theme")); @@ -587,6 +587,11 @@ { global $objConfig, $FrontEnd; + if (!$variableName) { + trigger_error('Attempt to set session variable without name', E_USER_WARNING); + return ; + } + $objConfig->Set($variableName,$variableValue,2); $variableValue = addslashes($variableValue); @@ -695,7 +700,7 @@ } } if((int)$this->GetPersistantVariable("Language")) - $this->Set("Language",$objConfig->Get("Language")); + $this->Set("Language", (int)$objConfig->Get("Language")); $this->DeleteExpiredSessions(); return true; } @@ -1098,8 +1103,8 @@ $item->Set("SessionKey",$result->fields["SessionKey"]); $item->Set("LastAccessed", $result->fields["LastAccessed"]); $item->Set("PortalUserId", $result->fields["PortalUserId"]); - $item->Set("Language", $result->fields["Language"]); - $item->Set("Theme" , $result->fields["Theme"]); + $item->Set("Language", (int)$result->fields["Language"]); + $item->Set("Theme" , (int)$result->fields["Theme"]); array_push($resultSet,$item); $result->MoveNext(); } @@ -1108,24 +1113,8 @@ function GetUniqueKey() { - while(true) - { - /* create the new session key here */ - mt_srand(100000000*(double)microtime()); - $sessionId=strtoupper(sprintf("AD%xFD",mt_rand(100000000,999999999))); //9 digit hex session id - $query = "select SessionKey from ".GetTablePrefix()."UserSession "; - $query .= "where SessionKey='$sessionId' OR CurrentTempKey='$sessionId' OR PrevTempKey='$sessionId'"; - $rs = $this->adodbConnection->Execute($query); - if($rs->EOF) - break; - if($i>100) - { - return ""; - } - $i++; - } - //echo "Getting Unique Key: $sessionId
"; - return $sessionId; + $application =& kApplication::Instance(); + return $application->Session->GenerateSID(); } function GetNewSession() @@ -1142,10 +1131,10 @@ $this->Set("CurrentTempKey",$sessionId); if($m_var_list["lang"]) { - $this->Set("Language",$m_var_list["lang"]); + $this->Set("Language", (int)$m_var_list["lang"]); } else - $this->Set("Language", $objLanguages->GetPrimary()); + $this->Set("Language", (int)$objLanguages->GetPrimary()); $this->SetThemeName(); //$this->Set("Theme", $objConfig->Get("Default_Theme")); $this->UpdateAccessTime(); @@ -1186,7 +1175,7 @@ $Theme = $objThemes->GetItem($id); $name = $Theme->Get("Name"); - $this->Set("Theme",$name); + $this->Set("Theme", (int)$name); //$this->Update(); }