Index: branches/RC/core/units/general/helpers/mod_rewrite_helper.php =================================================================== diff -u -r9552 -r10426 --- branches/RC/core/units/general/helpers/mod_rewrite_helper.php (.../mod_rewrite_helper.php) (revision 9552) +++ branches/RC/core/units/general/helpers/mod_rewrite_helper.php (.../mod_rewrite_helper.php) (revision 10426) @@ -77,20 +77,18 @@ $category_id = 0; $last_category_id = 0; $category_path = ''; - do - { + do { $category_path = trim($category_path.'/'.$url_part, '/'); - - if( !preg_match('/^bb_[\d]+/', $url_part) && preg_match('/(.*)_([\d]+)$/', $category_path, $rets) ) - { + // 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]; } - $category_id = $this->Conn->GetOne( - 'SELECT CategoryId + $sql = 'SELECT CategoryId FROM '.TABLE_PREFIX.'Category - WHERE Status = 1 AND NamedParentPath = '.$this->Conn->qstr($category_path)); + 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; $url_part = array_shift($url_parts); @@ -142,6 +140,13 @@ } if( $url_parts ) { // if parts are left, it can only be module page + if (preg_match('/^bb_(.*)/', $url_parts[0], $regs)) { + list ($topic_id, $topic_page) = explode('_', $regs[1], 2); + if (!$topic_id) { + $url_parts[0] = $topic_page; + } + } + if (!is_numeric($url_parts[0])) return false; $this->ProcessPage($url_parts, $vars); } @@ -177,10 +182,10 @@ function ProcessModuleItem(&$url_parts, &$vars, $set_t=true) { if (preg_match('/^bb_.*/', $url_parts[0])) { - $cat_item = $this->Conn->GetRow(' - SELECT c.ParentPath, c.CategoryId FROM '.TABLE_PREFIX.'Category AS c - WHERE - c.CategoryId = '.$vars['m_cat_id']); + $sql = 'SELECT c.ParentPath, c.CategoryId + FROM '.TABLE_PREFIX.'Category AS c + WHERE c.CategoryId = '.$vars['m_cat_id']; + $cat_item = $this->Conn->GetRow($sql); if ($set_t) { $item_template = $this->GetItemTemplate($cat_item, 'bb');