Index: trunk/kernel/parser.php =================================================================== diff -u -r29 -r80 --- trunk/kernel/parser.php (.../parser.php) (revision 29) +++ trunk/kernel/parser.php (.../parser.php) (revision 80) @@ -1762,7 +1762,7 @@ if(!is_object($objSearchCats)) { $objSearchCats = new clsCatList(); - $objSearchCats->SourceTable="ses_".$objSession->GetSessionKey()."_Search"; + $objSearchCats->SourceTable = $objSession->GetSessionTable('Search'); //"ses_".$objSession->GetSessionKey()."_Search" $objSearchCats->Clear(); } $objSearchCats->PerPageVar = "Perpage_Category"; @@ -1772,12 +1772,15 @@ $m_var_list["p"] = 1; $objSearchCats->PerPageVar = "Perpage_Category_Short"; } + + $keywords = $objSession->GetVariable("Search_Keywords"); // for using in all this func branches + if($objSearchCats->NumItems()==0) { LoadCatSearchResults($attribs); //echo "Cat count: ". $objSearchCats->QueryItemCount; $ret = 0; - if ($_POST['keywords']) { + 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']))) { @@ -1850,14 +1853,10 @@ //echo "
"; print_r($objSearchCats->Items); echo "
"; foreach($objSearchCats->Items as $cat) { - $cat->Keywords = GetKeywords($objSession->GetVariable("Search_Keywords")); - $keywords = $objSession->GetVariable("Search_Keywords"); - - //echo "
"; print_r($objSession->GetVariable("Search_Keywords")); echo "
"; - //echo $_POST['keywords']."
"; - //echo $cat->Data['Name']."
"; - - if (strstr(strip_tags(strtolower($cat->Data['Name'])), strtolower($keywords)) || strstr(strip_tags(strtolower($cat->Data['Description'])), strtolower($keywords))) { + //$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)); + if(!$keywords) $keywords_found = true; + if ($keywords_found) { if($row==0 && strlen($attribs["_firstitemtemplate"])) { $o.= $cat->ParseTemplate($attribs["_firstitemtemplate"]); @@ -3253,7 +3252,6 @@ { global $objItemTypes, $objCatList, $objSession, $CountVal, $objSearchCats; - if(!is_object($objSearchCats)) { $objSearchCats = new clsCatList(); @@ -3262,9 +3260,9 @@ } LoadCatSearchResults($attribs); - //echo "
"; print_r($objSearchCats->Items); echo "
"; + //echo "
"; print_r($objSearchCats->Items); echo "
"; $ret = 0; - $keywords = $objSession->GetVariable("Search_Keywords"); + $keywords = $objSession->GetVariable("Search_Keywords"); if ($keywords) { foreach ($objSearchCats->Items as $cat) {