Index: branches/unlabeled/unlabeled-1.57.2/core/kernel/session/session.php =================================================================== diff -u -r8186 -r8232 --- branches/unlabeled/unlabeled-1.57.2/core/kernel/session/session.php (.../session.php) (revision 8186) +++ branches/unlabeled/unlabeled-1.57.2/core/kernel/session/session.php (.../session.php) (revision 8232) @@ -273,13 +273,26 @@ { $this->PersistentVars[$var_name] = $var_value; - $replace_hash = Array ( - 'PortalUserId' => $this->Application->RecallVar('user_id'), - 'VariableName' => $var_name, - 'VariableValue' => $var_value - ); - $this->Conn->doInsert($replace_hash, TABLE_PREFIX.'PersistantSessionData', 'REPLACE'); - + $user_id = $this->Application->RecallVar('user_id'); + $key_clause = 'PortalUserId = '.$user_id.' AND VariableName = '.$this->Conn->qstr($var_name); + + $sql = 'SELECT VariableValue + FROM '.TABLE_PREFIX.'PersistantSessionData + WHERE '.$key_clause; + $record_found = $this->Conn->GetOne($sql); + + $fields_hash = Array ( + 'PortalUserId' => $user_id, + 'VariableName' => $var_name, + 'VariableValue' => $var_value, + ); + + if ($record_found) { + $this->Conn->doUpdate($fields_hash, TABLE_PREFIX.'PersistantSessionData', $key_clause); + } + else { + $this->Conn->doInsert($fields_hash, TABLE_PREFIX.'PersistantSessionData'); + } } function RecallPersistentVar(&$session, $var_name, $default = false) @@ -780,11 +793,16 @@ $last_env = $this->getLastTemplateENV($t, Array('m_opener' => 'u')); $last_template = basename($_SERVER['PHP_SELF']).'|'.substr($last_env, strlen(ENV_VAR_NAME) + 1); $this->StoreVar(rtrim('last_template_'.$wid, '_'), $last_template); - + $last_env = $this->getLastTemplateENV($t, Array()); $last_template = basename($_SERVER['PHP_SELF']).'|'.substr($last_env, strlen(ENV_VAR_NAME) + 1); $this->StoreVar(rtrim('last_template_popup_'.$wid, '_'), $last_template); + if (!$wid && $this->Application->IsAdmin() && $this->Application->LoggedIn() && ($t <> 'login')) { + // only for main window, not popups, not login template (used in adm:MainFrameLink tag) + $this->StorePersistentVar('last_template_popup', $last_template); + } + // save other last... variables for mistical purposes (customizations may be) $this->StoreVar('last_url', $_SERVER['REQUEST_URI']); // needed by ord:StoreContinueShoppingLink $this->StoreVar('last_env', substr($last_env, strlen(ENV_VAR_NAME)+1));