Index: branches/unlabeled/unlabeled-1.9.2/kernel/units/categories/categories_item.php =================================================================== diff -u -N -r5450 -r5615 --- branches/unlabeled/unlabeled-1.9.2/kernel/units/categories/categories_item.php (.../categories_item.php) (revision 5450) +++ branches/unlabeled/unlabeled-1.9.2/kernel/units/categories/categories_item.php (.../categories_item.php) (revision 5615) @@ -138,6 +138,42 @@ if ( $name != $this->GetDBField('Filename') ) $this->SetDBField('Filename', $name); } + + /** + * Allows to detect if root category being edited + * + * @param Array $params + */ + function IsRoot() + { + $category_id = $this->Application->GetVar($this->getPrefixSpecial().'_id'); + if (is_numeric($category_id) && $category_id == 0) { + $sql = 'SELECT '.$this->IDField.' + FROM '.$this->TableName.' + WHERE '.$this->IDField.' = '.$category_id; + if ($this->Conn->GetOne($sql) === false) { + return true; + } + } + + return false; + } + + /** + * Sets correct name to Home category while editing it + * + * @return bool + */ + function IsNewItem() + { + if ($this->IsRoot()) { + $title_field = $this->Application->getUnitOption($this->Prefix, 'TitleField'); + $category_name = $this->Application->Phrase( $this->Application->ConfigValue('Root_Name') ); + $this->SetDBField($title_field, $category_name); + return false; + } + return parent::IsNewItem(); + } } ?> \ No newline at end of file