Index: trunk/core/kernel/session/session.php =================================================================== diff -u -r3567 -r3884 --- trunk/core/kernel/session/session.php (.../session.php) (revision 3567) +++ trunk/core/kernel/session/session.php (.../session.php) (revision 3884) @@ -86,11 +86,15 @@ $this->SessionTimeout = $new_timeout; } - function StoreSession(&$session) + function StoreSession(&$session, $additional_fields = Array()) { - $query = ' INSERT INTO '.$this->TableName.' ('.$this->IDField.', '.$this->TimestampField.')'. - ' VALUES ('.$this->Conn->qstr($session->SID).', '.$session->Expiration.')'; - $this->Conn->Query($query); + $fields_hash = Array( $this->IDField => $session->SID, + $this->TimestampField => $session->Expiration); + if ($additional_fields) { + $fields_hash = array_merge_recursive2($fields_hash, $additional_fields); + } + + $this->Conn->doInsert($fields_hash, $this->TableName); } function DeleteSession(&$session) Index: trunk/core/units/general/inp_ses_storage.php =================================================================== diff -u -r3508 -r3884 --- trunk/core/units/general/inp_ses_storage.php (.../inp_ses_storage.php) (revision 3508) +++ trunk/core/units/general/inp_ses_storage.php (.../inp_ses_storage.php) (revision 3884) @@ -33,6 +33,7 @@ if( !$this->Application->IsAdmin() && $this->GetField('PortalUserId') <= 0 ) { $group_list = $this->Application->ConfigValue('User_GuestGroup').','.$this->Application->ConfigValue('User_LoggedInGroup'); + $this->SetField('GroupId', $this->Application->ConfigValue('User_GuestGroup')); $this->SetField('GroupList', $group_list); } } @@ -69,11 +70,18 @@ } - function StoreSession(&$session) + function StoreSession(&$session, $additional_fields = Array()) { - parent::StoreSession($session); - $this->SetField($session, 'IpAddress', $_SERVER['REMOTE_ADDR']); - $this->SetField($session, 'GroupList', $this->Application->ConfigValue('User_GuestGroup')); + $fields_hash = Array( 'PortalUserId' => -2, // Guest + 'Language' => $this->Application->GetDefaultLanguageId(), + 'Theme' => $this->Application->GetDefaultThemeId(), + 'IpAddress' => $_SERVER['REMOTE_ADDR'], + 'GroupList' => $this->Application->ConfigValue('User_GuestGroup'), + 'CurrentTempKey'=> $session->SID, + + ); + + parent::StoreSession($session, $fields_hash); } function GetExpiredSIDs() Index: trunk/kernel/parser.php =================================================================== diff -u -r3873 -r3884 --- trunk/kernel/parser.php (.../parser.php) (revision 3873) +++ trunk/kernel/parser.php (.../parser.php) (revision 3884) @@ -186,23 +186,23 @@ */ function m_loginbox($attribs = array()) { - global $var_list, $objSession, $objUsers, $objTemplate; + global $var_list, $objSession, $objUsers, $objTemplate; - $userid = $objSession->Get("PortalUserId"); - $groupid = $objSession->Get("GroupId"); - if ($userid == 0) - { - if (strlen($attribs["_logintemplate"])) - $t = $objTemplate->ParseTemplate($attribs["_logintemplate"]); - return $t; - } - else - { - $user =& $objUsers->GetItem($userid); - if (strlen($attribs["_loggedintemplate"])) - $t = $user->ParseTemplate($attribs["_loggedintemplate"]); - return $t; - } + $userid = $objSession->Get('PortalUserId'); + + if ($userid <= 0) { + if ( getArrayValue($attribs, '_logintemplate')) { + $t = $objTemplate->ParseTemplate($attribs['_logintemplate']); + } + return $t; + } + else { + $user =& $objUsers->GetItem($userid); + if (getArrayValue($attribs, '_loggedintemplate')) { + $t = $user->ParseTemplate($attribs['_loggedintemplate']); + } + return $t; + } } /* @description: result of suggest site action Index: trunk/admin/index.php =================================================================== diff -u -r3866 -r3884 --- trunk/admin/index.php (.../index.php) (revision 3866) +++ trunk/admin/index.php (.../index.php) (revision 3884) @@ -15,6 +15,8 @@ // new startup: begin define('REL_PATH', 'admin'); + define('THIS_FILE', 'admin/index'); + $relation_level = count( explode('/', REL_PATH) ); define('FULL_PATH', realpath(dirname(__FILE__) . str_repeat('/..', $relation_level) ) ); require_once FULL_PATH.'/kernel/startup.php'; Index: trunk/kernel/include/modules.php =================================================================== diff -u -r3863 -r3884 --- trunk/kernel/include/modules.php (.../modules.php) (revision 3863) +++ trunk/kernel/include/modules.php (.../modules.php) (revision 3884) @@ -812,11 +812,19 @@ if( !isset($FrontEnd) ) $FrontEnd = false; // if frontend not explicitly defined, than if($FrontEnd != 1) - $SessionQueryString = TRUE; + $SessionQueryString = true; -if(is_array($mod_prefix)) +if (is_array($mod_prefix)) { ParseEnv(); +} + if (defined('THIS_FILE') && (THIS_FILE == 'admin/index') ) { + // this is admin login screen & we don't have sid in url here, + // but session is already created by K4, then gether sid from it + $application =& kApplication::Instance(); + $var_list['sid'] = $application->GetSID(); + } + /* create the session object */ $ip = $_SERVER["REMOTE_ADDR"]; @@ -989,9 +997,9 @@ } } -if (strstr($_SERVER['SCRIPT_NAME'], 'install') && $objSession->Get("PortalUserId") == 0) { +/*if (strstr($_SERVER['SCRIPT_NAME'], 'install') && $objSession->Get("PortalUserId") == -2) { $objSession->Delete(); -} +}*/ if( !isset($SearchPerformed) ) $SearchPerformed = false; if($SearchPerformed == true) $objSearch->BuildIndexes(); Index: trunk/kernel/units/general/inp_ses_storage.php =================================================================== diff -u -r3508 -r3884 --- trunk/kernel/units/general/inp_ses_storage.php (.../inp_ses_storage.php) (revision 3508) +++ trunk/kernel/units/general/inp_ses_storage.php (.../inp_ses_storage.php) (revision 3884) @@ -33,6 +33,7 @@ if( !$this->Application->IsAdmin() && $this->GetField('PortalUserId') <= 0 ) { $group_list = $this->Application->ConfigValue('User_GuestGroup').','.$this->Application->ConfigValue('User_LoggedInGroup'); + $this->SetField('GroupId', $this->Application->ConfigValue('User_GuestGroup')); $this->SetField('GroupList', $group_list); } } @@ -69,11 +70,18 @@ } - function StoreSession(&$session) + function StoreSession(&$session, $additional_fields = Array()) { - parent::StoreSession($session); - $this->SetField($session, 'IpAddress', $_SERVER['REMOTE_ADDR']); - $this->SetField($session, 'GroupList', $this->Application->ConfigValue('User_GuestGroup')); + $fields_hash = Array( 'PortalUserId' => -2, // Guest + 'Language' => $this->Application->GetDefaultLanguageId(), + 'Theme' => $this->Application->GetDefaultThemeId(), + 'IpAddress' => $_SERVER['REMOTE_ADDR'], + 'GroupList' => $this->Application->ConfigValue('User_GuestGroup'), + 'CurrentTempKey'=> $session->SID, + + ); + + parent::StoreSession($session, $fields_hash); } function GetExpiredSIDs()