Index: branches/RC/core/units/categories/categories_tag_processor.php =================================================================== diff -u -r9339 -r9375 --- branches/RC/core/units/categories/categories_tag_processor.php (.../categories_tag_processor.php) (revision 9339) +++ branches/RC/core/units/categories/categories_tag_processor.php (.../categories_tag_processor.php) (revision 9375) @@ -175,8 +175,21 @@ WHERE SymLinkCategoryId IS NOT NULL'; $cache = $this->Conn->GetCol($sql, $id_field); } - - return isset($cache[$category_id]) ? $cache[$category_id] : $category_id; + + if (isset($cache[$category_id])) { + + //check if sym. link category is valid + $id_field = $this->Application->getUnitOption($this->Prefix, 'IDField'); + $table_name = $this->Application->getUnitOption($this->Prefix, 'TableName'); + + $sql = 'SELECT '.$id_field.' + FROM '.$table_name.' + WHERE '.$id_field.' = '.$cache[$category_id]; + + $category_id = $this->Conn->GetOne($sql)? $cache[$category_id] : $category_id; + } + + return $category_id; } function CategoryLink($params) @@ -192,11 +205,11 @@ elseif ("$category_id" == 'current') { $category_id = $this->Application->GetVar('m_cat_id'); } - - unset($params['cat_id'], $params['module']); - + $category_id = $this->getCategorySymLink($category_id); + unset($params['cat_id'], $params['module']); + $new_params = Array ('pass' => 'm', 'm_cat_id' => $category_id, 'pass_category' => 1); $params = array_merge_recursive2($params, $new_params); @@ -642,7 +655,34 @@ { return $this->Prefix.'_'.$params['type']; } + + /** + * Checks if current category is valid symbolic link to another category + * + * @param Array $params + * @return string + */ + function IsCategorySymLink($params) + { + $object =& $this->getObject($params); + /* @var $object kDBList */ + + $sym_category_id = $object->GetDBField('SymLinkCategoryId'); + + if (is_null($sym_category_id)) + { + return false; + } + + $id_field = $this->Application->getUnitOption($this->Prefix, 'IDField'); + $table_name = $this->Application->getUnitOption($this->Prefix, 'TableName'); + + $sql = 'SELECT '.$id_field.' + FROM '.$table_name.' + WHERE '.$id_field.' = '.$sym_category_id; + + return $this->Conn->GetOne($sql)? true : false; + } } - ?> \ No newline at end of file