Index: branches/RC/core/units/categories/categories_tag_processor.php =================================================================== diff -u -N -r11610 -r11648 --- branches/RC/core/units/categories/categories_tag_processor.php (.../categories_tag_processor.php) (revision 11610) +++ branches/RC/core/units/categories/categories_tag_processor.php (.../categories_tag_processor.php) (revision 11648) @@ -1198,6 +1198,11 @@ $templates = $this->Conn->GetCol($sql, 'CategoryId'); foreach ($page_ids as $page_id) { + if (!array_key_exists($page_id, $templates)) { + // internal page was deleted, but link to it was found in given content block data + continue; + } + $text = preg_replace('/@@' . $page_id . '@@/', $this->Application->HREF($templates[$page_id], '', Array ('pass' => 'm')), $text); } Index: branches/RC/core/admin_templates/js/forms.js =================================================================== diff -u -N -r11546 -r11648 --- branches/RC/core/admin_templates/js/forms.js (.../forms.js) (revision 11546) +++ branches/RC/core/admin_templates/js/forms.js (.../forms.js) (revision 11648) @@ -58,12 +58,13 @@ Form.Resize(); } -function InitEditors() -{ +function InitEditors() { var iframes = document.getElementsByTagName('IFRAME'); + for (var i=0; i -   +   @@ -86,7 +86,7 @@ - +   Index: branches/RC/core/kernel/processors/main_processor.php =================================================================== diff -u -N -r11525 -r11648 --- branches/RC/core/kernel/processors/main_processor.php (.../main_processor.php) (revision 11525) +++ branches/RC/core/kernel/processors/main_processor.php (.../main_processor.php) (revision 11648) @@ -33,26 +33,31 @@ */ function TemplatesBase($params) { - if ($this->Application->IsAdmin()) { - $module = isset($params['module']) ? $params['module'] : 'core'; + $force_admin = array_key_exists('force_admin', $params) && $params['force_admin']; + $module = array_key_exists('module', $params) ? $params['module'] : 'core'; + + if ($this->Application->IsAdmin() || $force_admin) { if ($module == 'in-portal') { $module = 'kernel'; } - $path = preg_replace('/\/(.*?)\/(.*)/', $module.'/\\2', THEMES_PATH); // remove leading slash + substitute module + + $path = $force_admin ? '/core/admin_templates' : THEMES_PATH; + $path = preg_replace('/\/(.*?)\/(.*)/', $module.'/\\2', $path); // remove leading slash + substitute module } else { $path = mb_substr(THEMES_PATH, 1); - $module = isset($params['module']) ? $params['module'] : 'core'; if (mb_strtolower($module) == 'in-portal') { $module_folder = 'platform'; } else { $module_folder = $this->Application->findModule('Name', $module, 'TemplatePath'); } - $path .= rtrim('/'.trim($module_folder, '/'), '/').'/'; + + $path .= rtrim('/' . trim($module_folder, '/'), '/') . '/'; } - return $this->Application->BaseURL().$path; + + return $this->Application->BaseURL() . $path; } /** 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)