Page Properties';
$title = $this->PageInfo(array('type' => 'htmlhead_title'));
- $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 @@