Index: branches/RC/core/kernel/session/session.php =================================================================== diff -u -N -r11428 -r11648 --- branches/RC/core/kernel/session/session.php (.../session.php) (revision 11428) +++ branches/RC/core/kernel/session/session.php (.../session.php) (revision 11648) @@ -895,7 +895,7 @@ { if($this->Application->isDebugMode() && constOn('DBG_SHOW_SESSIONDATA')) { // dump session data - $this->Application->Debugger->appendHTML('SessionStorage ('.$comment.'):'); + $this->Application->Debugger->appendHTML('SessionStorage [' . ($this->RecallVar('admin') == 1 ? 'Admin' : 'Front-End') . '] ('.$comment.'):'); $session_data = $this->Data->GetParams(); ksort($session_data); foreach ($session_data as $session_key => $session_value) { @@ -921,22 +921,28 @@ } } - function SaveData() + function SaveData($params) { if (!$this->SetSession()) { // call it here - it may be not set before, because there was no need; if there is a need, it will be set here return; } + if (!$this->Application->GetVar('skip_last_template') && $this->Application->GetVar('ajax') != 'yes') { - $this->SaveLastTemplate( $this->Application->GetVar('t') ); + $this->SaveLastTemplate( $this->Application->GetVar('t'), $params ); } $this->PrintSession('after save'); $this->Storage->SaveData($this); } - function SaveLastTemplate($t) + /** + * Save last template + * + * @param string $t + * @param Array $params + */ + function SaveLastTemplate($t, $params) { - // save last_template $wid = $this->Application->GetVar('m_wid'); $last_env = $this->getLastTemplateENV($t, Array('m_opener' => 'u')); @@ -969,20 +975,35 @@ $this->StorePersistentVar('last_template_popup', $last_template); } } - elseif ($this->Application->GetVar('admin') == 1) { - $admin_session =& $this->Application->recallObject('Session.admin'); - /* @var $admin_ses Session */ + elseif ($this->Application->GetVar('admin')) { + // admin checking by session data to prevent recursive session save + if (!$this->RecallVar('admin')) { + $admin_session =& $this->Application->recallObject('Session.admin'); + /* @var $admin_session Session */ - $admin_session->StorePersistentVar('last_template_popup', '../'.$last_template); + // save to admin last_template too, because when F5 is pressed in frameset Front-End frame should reload as well + + $admin_session->StoreVar('last_template_popup', '../' . $last_template); + $admin_session->StorePersistentVar('last_template_popup', '../' . $last_template); + $admin_session->SaveData( Array ('save_last_template' => false) ); + } + else { + // don't allow admin=1 & editing_mode=* to get in admin last_template + $last_template = preg_replace('/&(admin|editing_mode)=[\d]/', '', $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', mb_substr($last_env, mb_strlen(ENV_VAR_NAME)+1)); - // save last template here, becase section & module could be added before - $this->StoreVar(rtrim('last_template_popup_'.$wid, '_'), $last_template); + $save_last_template = array_key_exists('save_last_template', $params) ? $params['save_last_template'] : true; + + if ($save_last_template) { + // save last template here, becase section & module could be added before + $this->StoreVar(rtrim('last_template_popup_'.$wid, '_'), $last_template); + } } function getLastTemplateENV($t, $params = null, $encode = true)