Index: branches/RC/core/units/categories/categories_tag_processor.php =================================================================== diff -u -N -r11504 -r11520 --- branches/RC/core/units/categories/categories_tag_processor.php (.../categories_tag_processor.php) (revision 11504) +++ branches/RC/core/units/categories/categories_tag_processor.php (.../categories_tag_processor.php) (revision 11520) @@ -1069,18 +1069,18 @@ if (EDITING_MODE == EDITING_MODE_CMS) { $bg_color = isset($params['bgcolor']) ? $params['bgcolor'] : '#ffffff'; $url_params = Array ( - 'pass' => 'm,' . $this->Prefix . ',content', - 'm_opener' => 'd', - 'st_id' => $page->GetID(), - 'content_id' => $content->GetID(), - 'front' => 1, - 'admin' => 1, - '__URLENCODE__' => 1, - '__NO_REWRITE__'=> 1, - 'escape' => 1, - 'index_file' => 'index.php', - // 'bgcolor' => $bg_color, - // '__FORCE_SID__' => 1 + 'pass' => 'm,c,content', + 'm_opener' => 'd', + 'c_id' => $page->GetID(), + 'content_id' => $content->GetID(), + 'front' => 1, + 'admin' => 1, + '__URLENCODE__' => 1, + '__NO_REWRITE__'=> 1, + 'escape' => 1, + 'index_file' => 'index.php', +// 'bgcolor' => $bg_color, +// '__FORCE_SID__' => 1 ); if (isset($params['float'])) { @@ -1091,16 +1091,17 @@ } // link from Front-End to admin, don't remove "index.php" - $edit_url = $this->Application->HREF('in-edit/pages/content_edit', ADMIN_DIRECTORY, $url_params, 'index.php'); + $edit_url = $this->Application->HREF('categories/edit_content', ADMIN_DIRECTORY, $url_params, 'index.php'); $button_css = 'font-family: Arial, Verdana; font-size: 9pt; '.$pos_float.' z-index: 99; background-color: #F7C300; color: #CE0031; border: 1px solid #CE0031; padding: 1px 10px 1px 10px; cursor: pointer;'; - $edit_code = '
Edit
'; + $edit_code = '
Edit '.(defined('DEBUG_MODE') && DEBUG_MODE ? "({$num})" : '').'
'; if (isset($params['forms_later']) && $params['forms_later']) { $tmp = $edit_code; $edit_code = ''; } - $edit_code .= '
'; - $edit_code .= ''; + + $edit_code .= ''; + $edit_code .= ''; $edit_code .= ''; $edit_code .= ''; $edit_code .= ''; @@ -1261,34 +1262,59 @@ $page =& $this->_getPage($params); $url_params = Array( - 'pass' => 'm,' . $this->Prefix, - 'm_opener' => 'd', - 'st_id' => $page->GetID(), - 'st_mode' => 't', - // 'st_event' => 'OnEdit', - 'front' => 1, - '__URLENCODE__' => 1, - '__NO_REWRITE__'=> 1, - 'escape' => 1, - 'index_file' => 'index.php', + 'pass' => 'm,c', + 'm_opener' => 'd', + 'c_id' => $page->GetID(), + 'c_mode' => 't', + 'c_event' => 'OnEdit', + 'front' => 1, + '__URLENCODE__' => 1, + '__NO_REWRITE__'=> 1, + 'escape' => 1, + 'index_file' => 'index.php', ); $edit_url = $this->Application->HREF('categories/categories_edit', '/admin', $url_params); $button_css = 'position: absolute; z-index: 1; top: 1; left 1; font-family: Arial, Verdana; font-size: 9px; background-color: #F7C300; color: #CE0031; border: 1px solid #CE0031; width: auto; padding: 2px 10px 2px 10px; cursor: pointer;'; - $edit_code = '
Page Properties'; + $edit_code = '
Page Properties'; $title = $this->PageInfo(array('type' => 'htmlhead_title')); - $edit_code .= ''; - $edit_code .= ''; - $edit_code .= ''; + $edit_code .= ''; +/* $edit_code .= ''; + $edit_code .= ''; + $edit_code .= ''; */ $edit_code .= ''; if (!$this->Application->GetVar('admin_scripts_included')) { $this->Application->SetVar('admin_script_included', 1); - $edit_code .= ''; - $edit_code .= ''; - $edit_code .= ''; - $edit_code .= ''; + + $js_url = $this->Application->BaseURL() . 'core/admin_templates/js'; + + /*$edit_code .= ' + + + ';*/ + +/* $edit_code .= $this->Application->ProcessParsedTag('adm', 'AdminSkin', Array ()) . "\n";*/ + + $edit_code .= '' . "\n"; + $edit_code .= '' . "\n"; + $edit_code .= '' . "\n"; + $edit_code .= '' . "\n"; + $edit_code .= '' . "\n"; + $edit_code .= '' . "\n"; + $edit_code .= '' . "\n"; + $edit_code .= '' . "\n"; } $url_params = Array('m_theme' => '', 'pass' => 'm', 'm_opener' => 'r', 'no_amp' => 1); @@ -1402,12 +1428,12 @@ } if ($page['ItemType'] == 'page') { - $active = $page['ItemPath'] == preg_replace('/^Content\//', '', $this->Application->GetVar('t')); + $active = $page['ItemPath'] == preg_replace('/^Content\//i', '', $this->Application->GetVar('t')); } $block_params = Array ( 'title'=> $title, - 'template'=> preg_replace('/^Content\//', '', $page['ItemPath']), + 'template'=> preg_replace('/^Content\//i', '', $page['ItemPath']), 'active'=>$active, 'category_active' => $category_active, // new 'parent_path'=>$page['ParentPath'], @@ -1622,7 +1648,7 @@ CONCAT(\'c\', c.CategoryId) AS ItemId, c.Priority AS ItemPriority, ' . $lang_part . ' - IF(IsIndex = 2, ( + LOWER( IF(IsIndex = 2, ( SELECT cc.NamedParentPath FROM ' . TABLE_PREFIX . 'Category AS cc WHERE cc.ParentId = c.CategoryId @@ -1631,7 +1657,7 @@ AND cc.IsIndex = 1 ), - c.NamedParentPath) AS ItemPath, + c.NamedParentPath) ) AS ItemPath, 0 AS IsIndex, c.ParentPath AS ParentPath, c.ParentId As ParentId, @@ -1789,7 +1815,7 @@ continue; } $block_params['title'] = $category_data['Name']; - $block_params['template'] = preg_replace('/^Content\//', '', $category_data['NamedParentPath']); + $block_params['template'] = preg_replace('/^Content\//i', '', $category_data['NamedParentPath']); $block_params['is_first'] = $index == 1; // because Content is 1st element $block_params['is_last'] = $index == count($categories_data) - 1; Index: branches/RC/core/units/general/cat_tag_processor.php =================================================================== diff -u -N -r11149 -r11520 --- branches/RC/core/units/general/cat_tag_processor.php (.../cat_tag_processor.php) (revision 11149) +++ branches/RC/core/units/general/cat_tag_processor.php (.../cat_tag_processor.php) (revision 11520) @@ -414,7 +414,9 @@ $rating_helper =& $this->Application->recallObject('RatingHelper'); /* @var $rating_helper RatingHelper */ - return $rating_helper->ratingBar($object, true, '', $params['small_style']); + $small_style = array_key_exists('small_style', $params) ? $params['small_style'] : false; + + return $rating_helper->ratingBar($object, true, '', $small_style); } function RelevanceIndicator($params) Index: branches/RC/core/units/general/helpers/mod_rewrite_helper.php =================================================================== diff -u -N -r11504 -r11520 --- branches/RC/core/units/general/helpers/mod_rewrite_helper.php (.../mod_rewrite_helper.php) (revision 11504) +++ branches/RC/core/units/general/helpers/mod_rewrite_helper.php (.../mod_rewrite_helper.php) (revision 11520) @@ -70,36 +70,66 @@ function ProcessCategory(&$url_parts, &$vars) { - if (!isset($url_parts[0])) return false; + if (!isset($url_parts[0])) { + return false; + } + $res = false; $url_part = array_shift($url_parts); $category_id = 0; - $last_category_id = 0; - $category_path = ''; + $last_category_info = false; + $category_path = $url_part == 'content' ? '' : 'content'; + do { - $category_path = trim($category_path.'/'.$url_part, '/'); + $category_path = trim($category_path . '/' . $url_part, '/'); // bb__ -> forums/bb__2 OR forums/bb_2_6 if( !preg_match('/^bb_([\d]+)*_[\d]+/', $url_part) && preg_match('/(.*)_([\d]+)$/', $category_path, $rets) ) { $category_path = $rets[1]; $vars['m_cat_page'] = $rets[2]; } - $sql = 'SELECT CategoryId - FROM '.TABLE_PREFIX.'Category - WHERE Status = 1 AND NamedParentPath = '.$this->Conn->qstr($category_path); - $category_id = $this->Conn->GetOne($sql); - if ($category_id !== false) { - $last_category_id = $category_id; + $sql = 'SELECT CategoryId, IsIndex, NamedParentPath + FROM ' . TABLE_PREFIX . 'Category + WHERE Status IN (1,4) AND (LOWER(NamedParentPath) = ' . $this->Conn->qstr($category_path) . ')'; + $category_info = $this->Conn->GetRow($sql); + + if ($category_info !== false) { + $last_category_info = $category_info; $url_part = array_shift($url_parts); $res = true; } - } while ($category_id !== false && $url_part); - $vars['m_cat_id'] = $last_category_id; + } while ($category_info !== false && $url_part); + if ($last_category_info) { + // IsIndex = 2 is a Container-only page, meaning it should go to index-page child + if ($last_category_info['IsIndex'] == 2) { + $sql = 'SELECT CategoryId, NamedParentPath + FROM ' . TABLE_PREFIX . 'Category + WHERE ParentId = ' . $last_category_info['CategoryId'] . ' AND IsIndex = 1'; + $category_info = $this->Conn->GetRow($sql); + + if ($category_info) { + // when index sub-page is found use it, otherwise use container page + $last_category_info = $category_info; + } + } + + // 1. Set virtual page as template, this will be replaced to physical template later in kApplication::Run. + // 2. Don't set CachedTemplate field as template here, because we will loose original page associated with it's cms blocks! + $vars['t'] = strtolower( preg_replace('/^Content\//i', '', $last_category_info['NamedParentPath']) ); + + $vars['m_cat_id'] = $last_category_info['CategoryId']; + $vars['is_virtual'] = true; // for template from POST + } + else { + $vars['m_cat_id'] = 0; + } + if ($url_part) { array_unshift($url_parts, $url_part); } + return $res; } @@ -151,31 +181,14 @@ $this->ProcessPage($url_parts, $vars); } - // try to find CMS index page of the category - if ($this->Application->isModuleEnabled('In-CMS')) { - $sql = 'SELECT p.Path, ci.CategoryId FROM '.TABLE_PREFIX.'Pages AS p - LEFT JOIN '.TABLE_PREFIX.'CategoryItems AS ci - ON ci.ItemResourceId = p.ResourceId - WHERE - p.IsIndex = 1 - AND - p.Status = 1 - AND - CategoryId = '.$vars['m_cat_id'].' - AND - ci.PrimaryCat = 1'; - $template_found = $this->Conn->GetRow($sql); - if ($template_found !== false) { - $vars['t'] = $template_found['Path']; - return true; - } - } + /*$sql = 'SELECT CachedTemplate + FROM ' . TABLE_PREFIX . 'Category + WHERE CategoryId = ' . $vars['m_cat_id']; + $vars['t'] = $this->Conn->GetOne($sql);*/ - $sql = 'SELECT CachedTemplate - FROM '.TABLE_PREFIX.'Category - WHERE CategoryId = '.$vars['m_cat_id']; - $vars['t'] = $this->Conn->GetOne($sql); - if (!$vars['t']) $vars['t'] = 'index'; + if (!$vars['t']) { + $vars['t'] = 'index'; + } return true; } @@ -338,7 +351,7 @@ * @param array $url_parts * @return boolean */ - function ProcessVirtualTemplate(&$url_parts, &$vars) + function ProcessFriendlyUrl(&$url_parts, &$vars) { if (!isset($url_parts[0])) return false; @@ -349,38 +362,10 @@ $friendly = $this->Conn->GetRow($sql); if ($friendly) { $vars['m_cat_id'] = $friendly['CategoryId']; - $vars['t'] = preg_replace('/^content\//i', '', $friendly['NamedParentPath']); + $vars['t'] = preg_replace('/^Content\//i', '', $friendly['NamedParentPath']); return true; } - $template_path = 'content/' . implode('/', $url_parts); - - $sql = 'SELECT CategoryId, IsIndex, NamedParentPath FROM '.TABLE_PREFIX.'Category - WHERE - LOWER(NamedParentPath) = '.$this->Conn->qstr($template_path).' - AND - Status IN (1,4) '; - $template_found = $this->Conn->GetRow($sql); - - if ($template_found) { - // IsIndex = 2 is a Container-only page, meaning it should go to index-page child - if ($template_found['IsIndex'] == 2) { - $sql = 'SELECT CategoryId, NamedParentPath - FROM ' . TABLE_PREFIX . 'Category - WHERE ParentId = '.$template_found['CategoryId'].' AND IsIndex = 1'; - $template_found = $this->Conn->GetRow($sql); - $vars['t'] = preg_replace('/^content\//i', '', $template_found['NamedParentPath']); - } - else { - $vars['t'] = implode('/', $url_parts); - } - - $vars['m_cat_id'] = $template_found['CategoryId']; - $vars['is_virtual'] = true; // for template from POST - - return true; - } - return false; } @@ -467,7 +452,7 @@ // bug #1: cancells all other processing in case, when cms page is found // bug #2: doesn't match template partially, e.g. "test/case/other" will not match to page "test/case" with "other" left for future processing - if ( $this->ProcessVirtualTemplate($url_parts, $vars) ) { + if ( $this->ProcessFriendlyUrl($url_parts, $vars) ) { return $vars; } @@ -536,15 +521,15 @@ return $vars; } - if ( $this->Application->isModuleEnabled('In-Edit') && $this->Application->GetVar('admin') == 1) { + /*if ( $this->Application->isModuleEnabled('In-Edit') && $this->Application->GetVar('admin') == 1) { $adm_ses =& $this->Application->recallObject('Session.admin'); $user = $adm_ses->RecallVar('user_id'); $perm_helper =& $this->Application->recallObject('PermissionsHelper'); if ($perm_helper->CheckUserPermission($user, 'PAGE.ADD', 0)) { $vars['t'] = implode('/', $url_parts); return $vars; } - } + }*/ $not_found = $this->Application->ConfigValue('ErrorTemplate'); $vars['t'] = $not_found ? $not_found : 'error_notfound'; Index: branches/RC/core/units/fck/fck_eh.php =================================================================== diff -u -N -r11435 -r11520 --- branches/RC/core/units/fck/fck_eh.php (.../fck_eh.php) (revision 11435) +++ branches/RC/core/units/fck/fck_eh.php (.../fck_eh.php) (revision 11520) @@ -30,10 +30,10 @@ if ($this->Application->LoggedIn() && $this->Application->IsAdmin()) { return true; } - + return parent::CheckPermission($event); } - + function CreateXmlHeader() { ob_end_clean() ; @@ -68,7 +68,7 @@ //$res = ''; foreach ($pages as $id => $title) { - $page_path = preg_replace('/^content\//', '', strtolower($tpls[$id]).'.html'); + $page_path = preg_replace('/^Content\//i', '', strtolower($tpls[$id]).'.html'); $title = $title.' ('.$page_path.')'; $real_url = $this->Application->HREF($tpls[$id], '_FRONT_END_', array('pass'=>'m'), 'index.php'); $res .= ''."\n"; Index: branches/RC/core/units/general/main_event_handler.php =================================================================== diff -u -N -r11501 -r11520 --- branches/RC/core/units/general/main_event_handler.php (.../main_event_handler.php) (revision 11501) +++ branches/RC/core/units/general/main_event_handler.php (.../main_event_handler.php) (revision 11520) @@ -86,14 +86,15 @@ if ($processed_params['m_cat_id'] > 0 && isset($url_params['pass_category']) && $url_params['pass_category']) { $category_filename = $this->Application->getFilename('c', $processed_params['m_cat_id']); $t = isset($url_params['t']) && $url_params['t'] ? $url_params['t'] : false; - // category name doesn't match template name -> Proj-CMS/In-Edit tricks - preg_match('/Content\/(.*)/i', $category_filename, $regs); - if ($regs && ($regs[1] != $t)) { - $ret .= ($t == '__default__' ? $regs[1] : $category_filename) . '/'; + // we could have category path like "Content/" in this case remove template (proj-cms trick) + preg_match('/^Content\/(.*)/i', $category_filename, $regs); + if ($regs && (strtolower($regs[1]) == strtolower($t))) { + $url_params['t'] = ''; } -// $ret .= $this->Application->getFilename('c', $processed_params['m_cat_id']).'/'; + $ret .= $regs[1] . '/'; + $url_params['category_processed'] = true; } else { Index: branches/RC/core/admin_templates/categories/categories_edit.tpl =================================================================== diff -u -N -r11504 -r11520 --- branches/RC/core/admin_templates/categories/categories_edit.tpl (.../categories_edit.tpl) (revision 11504) +++ branches/RC/core/admin_templates/categories/categories_edit.tpl (.../categories_edit.tpl) (revision 11520) @@ -66,6 +66,9 @@
+
+ Status: +
Index: branches/RC/core/admin_templates/incs/close_popup.tpl =================================================================== diff -u -N -r11495 -r11520 --- branches/RC/core/admin_templates/incs/close_popup.tpl (.../close_popup.tpl) (revision 11495) +++ branches/RC/core/admin_templates/incs/close_popup.tpl (.../close_popup.tpl) (revision 11520) @@ -41,17 +41,18 @@ } function onAfterWindowClose($opener) { - + /* var $skip_refresh = true; var $skip_refresh = isset($opener.$skip_refresh) && $opener.$skip_refresh ? true : false; - + */ $opener.focus(); - if (!$skip_refresh) { +// if (!$skip_refresh) { + $opener.location.href = $redirect_url.replace('%5C', '\\'); - } +// } } // copied from "js/script.js" because it's not included here due performance reasons @@ -66,7 +67,7 @@ if ($i == 10) { break; } - + $main_window = $main_window.opener; $i++; } @@ -76,7 +77,7 @@ // alert('getFrame.Error: [' + err.description + ']'); return window; } - + var $frameset = $main_window.parent.frames; for ($i = 0; $i < $frameset.length; $i++) { if ($frameset[$i].name == $name) { Index: branches/RC/core/admin_templates/categories/ci_blocks.tpl =================================================================== diff -u -N -r11482 -r11520 --- branches/RC/core/admin_templates/categories/ci_blocks.tpl (.../ci_blocks.tpl) (revision 11482) +++ branches/RC/core/admin_templates/categories/ci_blocks.tpl (.../ci_blocks.tpl) (revision 11520) @@ -14,17 +14,17 @@ + + <inp2:m_Phrase name='la_alt_Browse' html_escape='1'/> + +
:
- - - <inp2:m_Phrase name='la_alt_Browse' html_escape='1'/> - Index: branches/RC/core/admin_templates/categories/edit_content.tpl =================================================================== diff -u -N -r11501 -r11520 --- branches/RC/core/admin_templates/categories/edit_content.tpl (.../edit_content.tpl) (revision 11501) +++ branches/RC/core/admin_templates/categories/edit_content.tpl (.../edit_content.tpl) (revision 11520) @@ -1,18 +1,17 @@ - - + - + - +
@@ -40,15 +39,34 @@
-
- +
+ + + +
-"/> + + \ No newline at end of file Index: branches/RC/core/admin_templates/categories/categories_tabs.tpl =================================================================== diff -u -N -r11102 -r11520 --- branches/RC/core/admin_templates/categories/categories_tabs.tpl (.../categories_tabs.tpl) (revision 11102) +++ branches/RC/core/admin_templates/categories/categories_tabs.tpl (.../categories_tabs.tpl) (revision 11520) @@ -11,24 +11,18 @@ - - - - -
- - - - - - - - - - - - - - -
-
\ No newline at end of file + + + + + + + + + + + + + + + Index: branches/RC/core/kernel/application.php =================================================================== diff -u -N -r11504 -r11520 --- branches/RC/core/kernel/application.php (.../application.php) (revision 11504) +++ branches/RC/core/kernel/application.php (.../application.php) (revision 11520) @@ -819,7 +819,7 @@ } } - safeDefine('EDITING_MODE', 0); // user can't edit anything + safeDefine('EDITING_MODE', ''); // user can't edit anything if (!$this->RequestProcessed) $this->ProcessRequest(); @@ -1311,10 +1311,9 @@ { if(!$t) $t = $this->GetVar('t'); // moved from kMainTagProcessor->T() - if ($this->isModuleEnabled('Proj-CMS')) { - $t = preg_replace('/^Content\//', '', $t); - } + $t = preg_replace('/^Content\//i', '', $t); + /*if ($this->GetVar('skip_last_template')) { $params['opener'] = 'p'; $this->SetVar('m_opener', 'p');