Index: trunk/kernel/parser.php
===================================================================
diff -u -N -r5218 -r5254
--- trunk/kernel/parser.php (.../parser.php) (revision 5218)
+++ trunk/kernel/parser.php (.../parser.php) (revision 5254)
@@ -1253,28 +1253,31 @@
if(getArrayValue($attribs,'_fullpath') || getArrayValue($attribs,'_currentcategory'))
{
$CurrentCat = $objCatList->CurrentCategoryID();
- if((int)$CurrentCat>0)
- {
- $c = $objCatList->GetCategory($CurrentCat);
- if($attribs["_fullpath"])
- {
- $path = $c->Get("CachedNavbar");
+ if((int)$CurrentCat>0)
+ {
+ $c = $objCatList->GetCategory($CurrentCat);
+ if($attribs["_fullpath"])
+ {
+ $path = $c->Get("CachedNavbar");
- if(strlen($path))
- $ret .= " - ".$path;
- }
- else
- {
- if($attribs["_currentcategory"])
- {
- $f = $attribs["_catfield"];
- if(!strlen($f))
- $f = "Name";
- $ret .= " - ".$c->Get($f);
- }
- }
- }
- }
+ if(strlen($path))
+ $ret .= " - ".$path;
+ }
+ else
+ {
+ if($attribs["_currentcategory"])
+ {
+ $f = $attribs["_catfield"];
+ if (!strlen($f)) {
+ $f = "Name";
+ }
+
+ if ($f == 'Name') $f = $objCatList->TitleField;
+ $ret .= " - ".$c->Get($f);
+ }
+ }
+ }
+ }
$ret = stripslashes($ret);
return $ret;
}
@@ -1705,7 +1708,14 @@
// echo "TEST:
$sql
\n";
$objSearchCats->Query_Item($sql);
$where = "ItemType=1";
-
+
+ $Keywords = GetKeywords($objSession->GetVariable("Search_Keywords"));
+ //echo "SQL Loaded ItemCount (".get_class($this).'): '.$this->NumItems().'
';
+ for($i = 0; $i < $objSearchCats->NumItems(); $i++)
+ {
+ $objSearchCats->Items[$i]->Keywords = $Keywords;
+ }
+
if(is_numeric($CountVal[1]))
{
$objSearchCats->QueryItemCount = $CountVal[1];
@@ -1897,7 +1907,7 @@
if ($keywords) {
foreach ($objSearchCats->Items as $cat) {
- if (strstr(strip_tags(strtolower($cat->Data['Name'])), strtolower($_POST['keywords'])) || strstr(strip_tags(strtolower($cat->Data['Description'])), strtolower($_POST['keywords']))) {
+ if (strstr(strip_tags(strtolower($cat->Data[$cat->TitleField])), strtolower($_POST['keywords'])) || strstr(strip_tags(strtolower($cat->Data[$cat->DescriptionField])), strtolower($_POST['keywords']))) {
$ret++;
}
}
@@ -1969,7 +1979,7 @@
foreach($objSearchCats->Items as $cat)
{
//$cat->Keywords = GetKeywords($objSession->GetVariable("Search_Keywords"));
-/* $keywords_found = strstr( strip_tags(strtolower($cat->Data['Name'])), strtolower($keywords)) || strstr(strip_tags(strtolower($cat->Data['Description'])), strtolower($keywords));
+/* $keywords_found = strstr( strip_tags(strtolower($cat->Data[$objCatList->TitleField])), strtolower($keywords)) || strstr(strip_tags(strtolower($cat->Data[$cat->DescriptionField])), strtolower($keywords));
if(!$keywords) $keywords_found = true;
if ($keywords_found) {*/
if($row==0 && strlen($attribs["_firstitemtemplate"]))
@@ -3408,7 +3418,7 @@
/*if ($keywords) {
foreach ($objSearchCats->Items as $cat) {
- if (strstr(strip_tags(strtolower($cat->Data['Name'])), strtolower($keywords)) || strstr(strip_tags(strtolower($cat->Data['Description'])), strtolower($keywords))) {
+ if (strstr(strip_tags(strtolower($cat->Data[$objCatList->TitleField])), strtolower($keywords)) || strstr(strip_tags(strtolower($cat->Data[$cat->DescriptionField])), strtolower($keywords))) {
$ret++;
}
}
@@ -3537,7 +3547,7 @@
*/
function m_sitemap($attribs = array())
{
- global $objModules, $objConfig;
+ global $objModules, $objConfig, $objCatList;
$html_attribs = ExtraAttributes($attribs);
@@ -3616,7 +3626,7 @@
foreach ($_C_catList as $cat)
{
- $text = $cat->Get("Name");
+ $text = $cat->Get($objCatList->TitleField);
$val = $cat->Get("CategoryId");
$sub_path = $cat->Get("ParentPath");
@@ -3645,7 +3655,7 @@
$ParentPath = empty($_RootCat) ? '|'.$val.'|%' : '|'.$_RootCat.'|'.$val.'|%';
$_Where = GetTablePrefix()."Category.ParentPath LIKE '$ParentPath' AND ".GetTablePrefix()."Category.CategoryId!=$val AND Status=1";
- $_OrderBy = " ORDER BY ".GetTablePrefix()."Category.ParentPath ASC, ".GetTablePrefix()."Category.Name ASC";
+ $_OrderBy = " ORDER BY ".GetTablePrefix()."Category.ParentPath ASC, ".GetTablePrefix()."Category.".$objCatList->TitleField." ASC";
$old_value = $objConfig->Get($_C_objCatSubs->PerPageVar);
$objConfig->Set($_C_objCatSubs->PerPageVar, (int)$MaxCats);
@@ -3657,7 +3667,7 @@
{
foreach ($SubCats as $subcat)
{
- $SubCatName = $subcat->Get("Name");
+ $SubCatName = $subcat->Get($objCatList->TitleField);
$SubCatId = $subcat->Get("CategoryId");
$SubPath = $subcat->Get("ParentPath");
Index: trunk/kernel/frontaction.php
===================================================================
diff -u -N -r4712 -r5254
--- trunk/kernel/frontaction.php (.../frontaction.php) (revision 4712)
+++ trunk/kernel/frontaction.php (.../frontaction.php) (revision 5254)
@@ -749,22 +749,22 @@
if($MissingCount==0)
{
$_POST = inp_striptags($_POST);
- $fields_hash = Array( 'ParentId' => $objCatList->CurrentCategoryID(),
- 'Name' => $_POST['name'],
- 'Description' => $_POST['description'],
- 'CreatedOn' => adodb_date('U'),
- 'EditorsPick' => 0,
- 'Status' => $perm,
- 'HotItem' => 2,
- 'NewItem' => 2,
- 'PopItem' => 2,
- 'Priority' => 0,
- 'MetaKeywords' => $_POST['meta_keywords'],
- 'MetaDescription' => $_POST['meta_description'],
- 'AutomaticFilename' => 1,
- 'Filename' => '',
- 'CategoryTemplate' => '',
- 'ItemTemplate' => '',
+ $fields_hash = Array( 'ParentId' => $objCatList->CurrentCategoryID(),
+ $objCatList->TitleField => $_POST['name'],
+ $objCatList->DescriptionField => $_POST['description'],
+ 'CreatedOn' => adodb_date('U'),
+ 'EditorsPick' => 0,
+ 'Status' => $perm,
+ 'HotItem' => 2,
+ 'NewItem' => 2,
+ 'PopItem' => 2,
+ 'Priority' => 0,
+ 'MetaKeywords' => $_POST['meta_keywords'],
+ 'MetaDescription' => $_POST['meta_description'],
+ 'AutomaticFilename' => 1,
+ 'Filename' => '',
+ 'CategoryTemplate' => '',
+ 'ItemTemplate' => '',
);
$cat =& $objCatList->Add_NEW($fields_hash);
Index: trunk/kernel/include/category.php
===================================================================
diff -u -N -r4446 -r5254
--- trunk/kernel/include/category.php (.../category.php) (revision 4446)
+++ trunk/kernel/include/category.php (.../category.php) (revision 5254)
@@ -9,11 +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";
@@ -93,7 +100,7 @@
}
else
{
- $name = $this->Get('Name');
+ $name = $this->Get($this->TitleField);
}
$name = $this->StripDisallowed($name);
@@ -229,7 +236,10 @@
{
global $m_var_list, $m_var_list_update, $var_list, $var_list_update;
- $sql = "SELECT CategoryId, Name from ".GetTablePrefix()."Category where ParentId=".$this->Get("CategoryId")." AND Status=1 ORDER BY Priority";
+ $sql = " SELECT CategoryId, ".$this->TitleField."
+ FROM ".GetTablePrefix()."Category
+ WHERE ParentId=".$this->Get("CategoryId")." AND Status=1
+ ORDER BY Priority";
if(isset($limit))
{
$rs = $this->adodbConnection->SelectLimit($sql, $limit, 0);
@@ -248,7 +258,7 @@
$var_list_update["t"] = !is_null($target_template)? $target_template : $var_list["t"];
$m_var_list_update["cat"] = $rs->fields["CategoryId"];
$m_var_list_update["p"] = "1";
- $cat_name = $rs->fields['Name'];
+ $cat_name = $rs->fields[$this->TitleField];
if (!is_null($anchor))
$ret .= "$cat_name";
else
@@ -318,9 +328,9 @@
$item_template = '';
do {
- $rs = $this->adodbConnection->Execute('SELECT ParentId, Name, Filename, CachedCategoryTemplate, CachedItemTemplate FROM '.$this->tablename.' WHERE CategoryId = '.$Id2);
+ $rs = $this->adodbConnection->Execute('SELECT ParentId, '.$this->TitleField.', Filename, CachedCategoryTemplate, CachedItemTemplate FROM '.$this->tablename.' WHERE CategoryId = '.$Id2);
$path_parts[] = $Id2;
- $nav_parts[] = $rs->fields['Name'];
+ $nav_parts[] = $rs->fields[$this->TitleField];
$named_parts[] = $rs->fields['Filename'];
if (!$cateogry_template && $rs->fields['CachedCategoryTemplate']) {
@@ -865,14 +875,14 @@
@field:cat.name
@description:Category name
*/
- $ret = $this->HighlightField("Name");
+ $ret = $this->HighlightField($this->TitleField);
break;
case "description":
/*
@field:cat.description
@description:Category Description
*/
- $ret = ($this->Get("Description"));
+ $ret = ($this->Get($this->DescriptionField));
$ret = $this->HighlightText($ret);
break;
case "cachednavbar":
@@ -1353,10 +1363,10 @@
return $this->Get("CachedNavbar");
break;
case "cat_name":
- return $this->Get("Name");
+ return $this->Get($this->TitleField);
break;
case "cat_desc":
- return $this->Get("Description");
+ return $this->Get($this->DescriptionField);
break;
case "cat_priority":
if($this->Get("Priority")!=0)
@@ -1374,7 +1384,7 @@
return $this->Get("Status");
break;
case "cat_Pending":
- return $this->Get("Name");
+ return $this->Get($this->TitleField);
break;
case "cat_pop":
@@ -1481,8 +1491,8 @@
$cat =& $objCatList->GetCategory($catid);
if(is_object($cat))
{
- if(strlen($cat->Get("Name")))
- $names[] = $cat->Get("Name");
+ if(strlen($cat->Get($this->TitleField)))
+ $names[] = $cat->Get($this->TitleField);
}
}
@@ -1534,13 +1544,20 @@
//var $Page; // no need because clsItemList class used instead of clsItemCollection
//var $PerPageVar;
+ 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("Name","Description");
+ $this->AdminSearchFields = array($this->TitleField, $this->DescriptionField);
$this->Page = (int)$m_var_list["p"];
$this->PerPageVar = "Perpage_Category";
$this->SourceTable = GetTablePrefix()."Category";
@@ -1975,7 +1992,7 @@
$r =& $this->GetCategory($root);
$rpath = $r->Get("ParentPath");
$nav_unparsed = substr($nav_unparsed,strlen($rpath),-1);
- $cat_name = $r->Get("Name");
+ $cat_name = $r->Get($this->TitleField);
$m_var_list_update["cat"] = $root;
if($cat == $catid && !$LinkLeaf)
{
@@ -2041,7 +2058,7 @@
$c =& $this->GetCategory($catid);
if(is_object($c))
{
- $cat_name = $c->Get("Name");
+ $cat_name = $c->Get($this->TitleField);
$m_var_list_update["cat"] = $catid;
if($catid==$modcat && strlen($ModTemplate)>0)
@@ -2127,7 +2144,7 @@
if( $d->UsingTempTable() ) $d->Set('CategoryId', -1);
$d->idfield = 'CategoryId';
- $d->Set(Array( 'ParentId', 'Name', 'Description', 'CreatedOn', 'EditorsPick', 'Status', 'HotItem',
+ $d->Set(Array( 'ParentId', $this->TitleField, $this->DescriptionField, 'CreatedOn', 'EditorsPick', 'Status', 'HotItem',
'NewItem','PopItem', 'Priority', 'MetaKeywords', 'MetaDescription', 'CreatedById',
'AutomaticFilename', 'Filename'),
Array( $ParentId, $Name, $Description, $CreatedOn, $EditorsPick, $Status, $Hot, $New,
@@ -2241,7 +2258,7 @@
$dest->Set("ParentId", $ParentTo);
if ($src->get("ParentId") == $ParentTo)
{
- $OldName = $src->Get("Name");
+ $OldName = $src->Get($this->TitleField);
if(substr($OldName,0,5)=="Copy ")
{
$parts = explode(" ",$OldName,4);
@@ -2260,7 +2277,7 @@
else
$Name = $OldName;
//echo "New Name: $Name
";
- $dest->Set("Name", $Name);
+ $dest->Set($this->TitleField, $Name);
$Names = CategoryNameCount($ParentTo,$Name);
//echo "Names Count: ".count($Names)."
";
if(count($Names)>0)
@@ -2294,7 +2311,7 @@
$NewName = "Copy $NameCount of $Name";
}
//echo "New Name: $NewName
";
- $dest->Set("Name",$NewName);
+ $dest->Set($this->TitleField, $NewName);
}
}
@@ -2372,7 +2389,7 @@
$filter = $$cat_filter;
$adodbConnection = &GetADODBConnection();
- $sql = "SELECT COUNT(Name) as children from ".$this->SourceTable." where ParentId=" . $ParentID . $filter;
+ $sql = "SELECT COUNT(*) as children from ".$this->SourceTable." where ParentId=" . $ParentID . $filter;
$result = $adodbConnection->Execute($sql);
return $result->fields["children"];
}
Index: trunk/kernel/action.php
===================================================================
diff -u -N -r4821 -r5254
--- trunk/kernel/action.php (.../action.php) (revision 4821)
+++ trunk/kernel/action.php (.../action.php) (revision 5254)
@@ -537,7 +537,7 @@
{
/* category's paste function populates a sparse array where array[old_id]=new_id */
$PastedCatIds = array();
- $objCatList->PasteFromClipboard($objCatList->CurrentCategoryID(),"Name");
+ $objCatList->PasteFromClipboard($objCatList->CurrentCategoryID(), $objCatList->TitleField);
}
else
{
@@ -701,22 +701,22 @@
$objEditItems = new clsCatList();
$objEditItems->SourceTable = $objSession->GetEditTable("Category");
- $fields_hash = Array( 'ParentId' => GetVar('ParentId'),
- 'Name' => inp_escape(GetVar('cat_name'), (int)GetVar('html_enable')),
- 'Description' => inp_escape(GetVar('cat_desc'), (int)GetVar('html_enable')),
- 'CreatedOn' => $created_on,
- 'EditorsPick' => GetVar('cat_pick'),
- 'Status' => (int)GetVar('status'),
-// 'HotItem' => (int)GetVar('itemhot'),
- 'NewItem' => (int)GetVar('itemnew'),
-// 'PopItem' => (int)GetVar('itempop'),
- 'Priority' => GetVar('Priority'),
- 'MetaKeywords' => GetVar('meta_keywords'),
- 'MetaDescription' => GetVar('meta_desc'),
- 'AutomaticFilename' => GetVar('auto_filename'),
- 'Filename' => GetVar('filename'),
- 'CategoryTemplate' => GetVar('category_template'),
- 'ItemTemplate' => GetVar('item_template'),
+ $fields_hash = Array( 'ParentId' => GetVar('ParentId'),
+ $objCatList->TitleField => inp_escape(GetVar('cat_name'), (int)GetVar('html_enable')),
+ $objCatList->DescriptionField => inp_escape(GetVar('cat_desc'), (int)GetVar('html_enable')),
+ 'CreatedOn' => $created_on,
+ 'EditorsPick' => GetVar('cat_pick'),
+ 'Status' => (int)GetVar('status'),
+// 'HotItem' => (int)GetVar('itemhot'),
+ 'NewItem' => (int)GetVar('itemnew'),
+// 'PopItem' => (int)GetVar('itempop'),
+ 'Priority' => GetVar('Priority'),
+ 'MetaKeywords' => GetVar('meta_keywords'),
+ 'MetaDescription' => GetVar('meta_desc'),
+ 'AutomaticFilename' => GetVar('auto_filename'),
+ 'Filename' => GetVar('filename'),
+ 'CategoryTemplate' => GetVar('category_template'),
+ 'ItemTemplate' => GetVar('item_template'),
);
$objSession->SetVariable('PermCache_UpdateRequired', 1);
@@ -736,10 +736,10 @@
$original_cats = new clsCatList();
$original_cat = $original_cats->GetItemByField('CategoryId', GetVar('CategoryId'));
- $match_fields = Array( 'Name' => 'cat_name',
- 'Filename' => 'filename',
- 'CategoryTemplate' => 'category_template',
- 'ItemTemplate' => 'item_template');
+ $match_fields = Array( $objCatList->TitleField => 'cat_name',
+ 'Filename' => 'filename',
+ 'CategoryTemplate' => 'category_template',
+ 'ItemTemplate' => 'item_template');
foreach ($match_fields as $db_field => $submit_field) {
if ($original_cat->Get($db_field) != stripslashes( GetVar($submit_field) )) {
@@ -754,21 +754,21 @@
}
// check if name of cat isn't changed: end
- $fields_hash = Array( 'Name' => inp_escape(GetVar('cat_name'), (int)GetVar('html_enable')),
- 'Description' => inp_escape(GetVar('cat_desc'), (int)GetVar('html_enable')),
- 'CreatedOn' => DateTimestamp(GetVar('cat_date'), GetDateFormat(0, true)),
- 'EditorsPick' => GetVar('cat_pick'),
- 'Status' => (int)GetVar('status'),
-// 'HotItem' => (int)GetVar('itemhot'),
- 'NewItem' => (int)GetVar('itemnew'),
-// 'PopItem' => (int)GetVar('itempop'),
- 'Priority' => GetVar('Priority'),
- 'MetaKeywords' => GetVar('meta_keywords'),
- 'MetaDescription' => GetVar('meta_desc'),
- 'AutomaticFilename' => GetVar('auto_filename'),
- 'Filename' => GetVar('filename'),
- 'CategoryTemplate' => GetVar('category_template'),
- 'ItemTemplate' => GetVar('item_template'),
+ $fields_hash = Array( $objCatList->TitleField => inp_escape(GetVar('cat_name'), (int)GetVar('html_enable')),
+ $objCatList->DescriptionField => inp_escape(GetVar('cat_desc'), (int)GetVar('html_enable')),
+ 'CreatedOn' => DateTimestamp(GetVar('cat_date'), GetDateFormat(0, true)),
+ 'EditorsPick' => GetVar('cat_pick'),
+ 'Status' => (int)GetVar('status'),
+// 'HotItem' => (int)GetVar('itemhot'),
+ 'NewItem' => (int)GetVar('itemnew'),
+// 'PopItem' => (int)GetVar('itempop'),
+ 'Priority' => GetVar('Priority'),
+ 'MetaKeywords' => GetVar('meta_keywords'),
+ 'MetaDescription' => GetVar('meta_desc'),
+ 'AutomaticFilename' => GetVar('auto_filename'),
+ 'Filename' => GetVar('filename'),
+ 'CategoryTemplate' => GetVar('category_template'),
+ 'ItemTemplate' => GetVar('item_template'),
);
$cat =& $objEditItems->Edit_Category(GetVar('CategoryId'), $fields_hash);