Index: branches/unlabeled/unlabeled-1.56.2/kernel/include/category.php =================================================================== diff -u -r5656 -r6026 --- branches/unlabeled/unlabeled-1.56.2/kernel/include/category.php (.../category.php) (revision 5656) +++ branches/unlabeled/unlabeled-1.56.2/kernel/include/category.php (.../category.php) (revision 6026) @@ -9,18 +9,18 @@ class clsCategory extends clsItem { var $Permissions; - + var $DescriptionField = ''; - + function clsCategory($CategoryId=NULL) { global $objSession; $this->clsItem(TRUE); - + $ml_formatter =& $this->Application->recallObject('kMultiLanguage'); $this->TitleField = $ml_formatter->LangFieldName('Name'); $this->DescriptionField = $ml_formatter->LangFieldName('Description'); - + $this->tablename = GetTablePrefix()."Category"; $this->type=1; $this->BasePermission ="CATEGORY"; @@ -314,28 +314,28 @@ } return $dataValid; } - + function UpdateCachedPath() { if( $this->UsingTempTable() == true) return ; $Id = $this->Get('CategoryId'); $Id2 = $Id; - + $path_parts = Array(); - $nav_parts = Array(); + $nav_parts = Array(); $named_parts = Array(); $cateogry_template = ''; $item_template = ''; - + $ml_helper =& $this->Application->recallObject('kMultiLanguageHelper'); $language_count = $ml_helper->getLanguageCount(); $primary_lang_id = $this->Application->GetDefaultLanguageId(); - - do { + + do { $rs = $this->adodbConnection->Execute('SELECT * FROM '.$this->tablename.' WHERE CategoryId = '.$Id2); $path_parts[] = $Id2; $named_parts[] = $rs->fields['Filename']; - + $i = 1; while ($i <= $language_count) { $nav_parts[$i][] = $rs->fields['l'.$i.'_Name'] ? $rs->fields['l'.$i.'_Name'] : $rs->fields['l'.$primary_lang_id.'_Name']; @@ -345,30 +345,25 @@ if (!$cateogry_template && $rs->fields['CachedCategoryTemplate']) { $cateogry_template = $rs->fields['CachedCategoryTemplate']; } - - if (!$item_template && $rs->fields['CachedItemTemplate']) { - $item_template = $rs->fields['CachedItemTemplate']; - } - + $Id2 = ($rs && !$rs->EOF) ? $rs->fields['ParentId'] : '0'; - + } while ($Id2 != '0'); - + $parent_path = '|'.implode('|', array_reverse($path_parts) ).'|'; $named_path = implode('/', array_reverse($named_parts) ); - + $i = 1; while ($i <= $language_count) { $this->Set('l'.$i.'_CachedNavbar', implode('&|&', array_reverse($nav_parts[$i]) )); $i++; } - + $this->Set('ParentPath', $parent_path); $this->Set('NamedParentPath', $named_path); $this->Set('CachedCategoryTemplate', $cateogry_template); - $this->Set('CachedItemTemplate', $item_template); $this->Update(); - + } function GetCachedNavBar() @@ -847,7 +842,7 @@ $ml_formatter =& $this->Application->recallObject('kMultiLanguage'); return str_replace('&|&', ' > ', $this->Get($ml_formatter->LangFieldName('CachedNavbar'))); } - + function ParseObject($element) { global $objConfig, $objCatList, $rootURL, $var_list, $var_list_update, $m_var_list_update, $objItemTypes,$objCountCache, $objUsers; @@ -910,9 +905,9 @@ @field:cat.cachednavbar @description: Category cached navbar */ - + $this->Set('CachedNavbar', $this->GetNavbar()); - + $ret = $this->HighlightField("CachedNavbar"); if(!strlen($ret)) { @@ -1385,7 +1380,7 @@ case "cat_fullpath": return $this->GetNavbar(); break; - + case "cat_name": return $this->Get($this->TitleField); break; @@ -1570,15 +1565,15 @@ var $TitleField = ''; var $DescriptionField = ''; - + function clsCatList() { global $m_var_list; $this->clsItemCollection(); $ml_formatter =& $this->Application->recallObject('kMultiLanguage'); $this->TitleField = $ml_formatter->LangFieldName('Name'); $this->DescriptionField = $ml_formatter->LangFieldName('Description'); - + $this->Prefix = 'c'; $this->classname="clsCategory"; $this->AdminSearchFields = array($this->TitleField, $this->DescriptionField); @@ -2121,24 +2116,24 @@ function &Add_NEW($fields_hash, $from_import = false) { global $objSession; - + $fields_hash['CreatedById'] = $objSession->Get('PortalUserId'); - + $d = new clsCategory(NULL); $fields_hash['Filename'] = $d->StripDisallowed($fields_hash['Filename']); $d->tablename = $this->SourceTable; - + if ( $d->UsingTempTable() ) { $d->Set('CategoryId', -1); } $d->idfield = 'CategoryId'; - + foreach ($fields_hash as $field_name => $field_value) { $d->Set($field_name, $field_value); } - + $d->Create(); - + if (!$from_import) { if ($d->Get('Status') == STATUS_ACTIVE) { $d->SendUserEventMail("CATEGORY.ADD", $objSession->Get("PortalUserId")); @@ -2153,7 +2148,7 @@ } return $d; } - + function &Add( $ParentId, $Name, $Description, $CreatedOn, $EditorsPick, $Status, $Hot, $New, $Pop, $Priority, $MetaKeywords,$MetaDesc, $auto_filename = 1, $filename = '') { @@ -2190,16 +2185,16 @@ return $d; } - function &Edit_Category($category_id, $fields_hash) + function &Edit_Category($category_id, $fields_hash) { $d =& $this->GetCategory($category_id); - + $fields_hash['Filename'] = $d->StripDisallowed($fields_hash['Filename']); - + foreach ($fields_hash as $field_name => $field_value) { $d->Set($field_name, $field_value); } - + $d->Update(); $d->UpdateCachedPath(); return $d; @@ -2373,7 +2368,7 @@ } $perm_status = $objSession->HasCatPermission('CATEGORY.DELETE', $check_cat); } - + if (($d->Get("CategoryId") == $Id) && $perm_status) { $d->SendUserEventMail("CATEGORY.DELETE",$objSession->Get("PortalUserId")); $d->SendAdminEventMail("CATEGORY.DELETE");