Index: branches/5.2.x/core/units/helpers/mod_rewrite_helper.php =================================================================== diff -u -r14714 -r14753 --- branches/5.2.x/core/units/helpers/mod_rewrite_helper.php (.../mod_rewrite_helper.php) (revision 14714) +++ branches/5.2.x/core/units/helpers/mod_rewrite_helper.php (.../mod_rewrite_helper.php) (revision 14753) @@ -1,6 +1,6 @@ Application->recallObject('kRewriteUrlProcessor'); /* @var $rewrite_processor kRewriteUrlProcessor */ - if (preg_match('/^bb_([\d]+)/', $item_filename, $regs)) { + if ( preg_match('/^bb_([\d]+)/', $item_filename, $regs) ) { // process topics separately, because they don't use item filenames array_pop($url_parts); $rewrite_processor->partParsed($item_filename, 'rtl'); @@ -207,27 +207,26 @@ WHERE (ci.CategoryId = ' . (int)$vars['m_cat_id'] . ') AND (ci.Filename = ' . $this->Conn->qstr($item_filename) . ')'; $cat_item = $this->Conn->GetRow($sql); - if ($cat_item !== false) { + if ( $cat_item !== false ) { // item found $module_prefix = $cat_item['ItemPrefix']; $item_template = $rewrite_processor->GetItemTemplate($cat_item, $module_prefix); - // converting ResourceId to correpsonding Item id + // converting ResourceId to corresponding Item id $module_config = $this->Application->getUnitOptions($module_prefix); $sql = 'SELECT ' . $module_config['IDField'] . ' FROM ' . $module_config['TableName'] . ' WHERE ResourceId = ' . $cat_item['ItemResourceId']; $item_id = $this->Conn->GetOne($sql); - array_pop($url_parts); + if ( $item_id ) { + array_pop($url_parts); - if ($item_id) { - $rewrite_processor->partParsed($item_filename, 'rtl'); - - if ($item_template) { + if ( $item_template ) { // when template is found in category -> set it $vars['t'] = $item_template; + $rewrite_processor->partParsed($item_filename, 'rtl'); } // we have category item id