Index: branches/5.0.x/core/units/helpers/mod_rewrite_helper.php =================================================================== diff -u -r12849 -r12877 --- branches/5.0.x/core/units/helpers/mod_rewrite_helper.php (.../mod_rewrite_helper.php) (revision 12849) +++ branches/5.0.x/core/units/helpers/mod_rewrite_helper.php (.../mod_rewrite_helper.php) (revision 12877) @@ -1,6 +1,6 @@ Application->structureTemplateMapping); + + if ($physical_template !== false) { + // replace menu template name with it's actual template name on disk + list ($template_path) = explode(':', $physical_template, 2); + } + $t_parts['path'] = dirname($template_path) == '.' ? '' : '/' . dirname($template_path); $t_parts['file'] = basename($template_path); @@ -591,7 +598,7 @@ $vars['m_cat_page'] = $rets[2]; } - $sql = 'SELECT CategoryId, IsIndex, NamedParentPath + $sql = 'SELECT CategoryId, SymLinkCategoryId, NamedParentPath FROM ' . TABLE_PREFIX . 'Category WHERE Status IN (1,4) AND (LOWER(NamedParentPath) = ' . $this->Conn->qstr($category_path) . ') AND (ThemeId = ' . $vars['m_theme'] . ' OR ThemeId = 0)'; $category_info = $this->Conn->GetRow($sql); @@ -604,15 +611,17 @@ } 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) { + // this category is symlink to other category, so use it's url instead + // (used in case if url prior to symlink adding was indexed by spider or was bookmarked) + if ($last_category_info['SymLinkCategoryId']) { $sql = 'SELECT CategoryId, NamedParentPath FROM ' . TABLE_PREFIX . 'Category - WHERE (ParentId = ' . $last_category_info['CategoryId'] . ') AND (IsIndex = 1) AND (ThemeId = ' . $vars['m_theme'] . ' OR ThemeId = 0)'; + WHERE (CategoryId = ' . $last_category_info['SymLinkCategoryId'] . ')'; $category_info = $this->Conn->GetRow($sql); if ($category_info) { - // when index sub-page is found use it, otherwise use container page + // web symlinked category was found use it + // TODO: maybe 302 redirect should be made to symlinked category url (all other url parts should stay) $last_category_info = $category_info; } }