Index: trunk/kernel/include/category.php =================================================================== diff -u -N -r3255 -r3268 --- trunk/kernel/include/category.php (.../category.php) (revision 3255) +++ trunk/kernel/include/category.php (.../category.php) (revision 3268) @@ -59,15 +59,17 @@ $db =& GetADODBConnection(); $sql = 'SELECT CategoryId FROM '.$this->tablename.' WHERE (Filename = '.$db->qstr($filename).') AND (ParentId = '.$m_var_list['cat'].')'; - $category_id = $db->GetOne($sql); + $found_category_ids = $db->GetCol($sql); $has_page = preg_match('/(.*)_([\d]+)([a-z]*)$/', $filename, $rets); - if( ($category_id != $this->UniqueId()) || $has_page ) // other category has same filename as ours OR we have filename, that ends with _number + + $duplicates_found = (count($found_category_ids) > 1) || ($found_category_ids && $found_category_ids[0] != $this->UniqueId()); + if ($duplicates_found || $has_page) { - $append = $category_id ? 'a' : ''; + $append = $duplicates_found ? '_a' : ''; if($has_page) { $filename = $rets[1].'_'.$rets[2]; - $append = $rets[3] ? $rets[3] : 'a'; + $append = $rets[3] ? $rets[3] : '_a'; } $sql = 'SELECT CategoryId FROM '.$this->tablename.' WHERE (Filename = %s) AND (CategoryId != '.$this->UniqueId().') AND (ParentId = '.$m_var_list['cat'].')';