Index: trunk/kernel/include/parseditem.php
===================================================================
diff -u -N -r1009 -r1019
--- trunk/kernel/include/parseditem.php (.../parseditem.php) (revision 1009)
+++ trunk/kernel/include/parseditem.php (.../parseditem.php) (revision 1019)
@@ -994,7 +994,7 @@
function Query_Item($sql, $offset=-1,$rows=-1)
{
- global $Errors;
+ global $Errors, $objConfig;
//echo "Method QItem [".get_class($this).'], sql: ['.$sql.']
';
$dummy =& $this->GetDummy();
if( !$dummy->TableExists() )
@@ -1003,14 +1003,15 @@
$this->Clear();
return false;
}
-
+ //echo "".get_class($this)."
";
+ //echo "Rows = $rows && Offset = $offset
";
if($rows>-1 && $offset>-1)
{
//print_pre(debug_backtrace());
//echo "Executing SelectLimit $sql Offset: $offset,$rows
\n";
$result = $this->adodbConnection->SelectLimit($sql, $rows,$offset);
}
- else {
+ else {
$result = $this->adodbConnection->Execute($sql);
}
@@ -1544,7 +1545,7 @@
$Start = ($this->Page - 1) * $PerPage;
}
else
- {
+ {
if((int)$this->MaxListCount == 0) $Start = -1;
}
return $Start;
@@ -1555,6 +1556,7 @@
if($this->EnablePaging)
{
if($this->Page < 1) $this->Page = 1;
+ //echo "Got PerPage: ".$this->GetPerPage()."
";
return $this->GetPerPage();
}
else
@@ -1623,11 +1625,14 @@
}
function GetPerPage()
- {
+ {
+ //echo "Getting Per Page ".get_class($this)."
";
// return category perpage
global $objConfig;
$PerPage = $objConfig->Get( $this->PerPageVar );
if( !is_numeric($PerPage) ) $PerPage = $this->DefaultPerPage ? $this->DefaultPerPage : 10;
+ //print_pre(debug_backtrace());
+ //echo "Returning: $PerPage
";
return $PerPage;
}
@@ -1638,14 +1643,14 @@
// or first possible "set_first"
$PerPage = $this->GetPerPage();
$NumPages = ceil( $this->GetNumPages($PerPage) );
-/*
+/*
echo "=====
";
echo "Class ".get_class($this).": Page ".$this->Page." of $NumPages
";
echo "PerPage: $PerPage
";
echo "Items Queries: ".$this->QueryItemCount."
";
echo "=====
";
*/
- if($this->Page > $NumPages)
+ if($this->Page > $NumPages && $PerPage != -1)
{
switch($fix_method)
{
@@ -1917,7 +1922,7 @@
if(count($this->Query_SortField)>0)
{
- for($x=0; $xQuery_SortField); $x++)
+ for($x = 0; $x < count($this->Query_SortField); $x++)
{
$FieldVar = $this->Query_SortField[$x];
$OrderVar = $this->Query_SortOrder[$x];
@@ -1940,7 +1945,7 @@
}
else
$OrderBy="";
-
+ //echo "ORDER BY: $OrderBy
";
return $OrderBy;
}
@@ -2408,7 +2413,12 @@
echo htmlentities($sql,ENT_NOQUOTES)."
\n";
if($attribs["_shortlist"])
{
- $this->PerPageVar = $this->PerPageShortVar;
+ if ($objConfig->Get($this->PerPageShortVar) > 0) {
+ $this->PerPageVar = $this->PerPageShortVar;
+ }
+ else {
+ $this->PerPageVar = $this->PerPageVarLong;
+ }
}
else
$this->PerPageVar = $this->PerPageVarLong;
@@ -2464,15 +2474,20 @@
function LoadPickItems($attribs)
{
- global $objSession, $objCountCache;
+ global $objSession, $objCountCache, $objConfig;
$sql = $this->SqlPickItems($attribs);
if($objSession->HasSystemPermission("DEBUG.LIST"))
echo htmlentities($sql,ENT_NOQUOTES)."
\n";
if($attribs["_shortlist"])
- {
- $this->PerPageVar = $this->PerPageShortVar;
+ {
+ if ($objConfig->Get($this->PerPageShortVar) > 0) {
+ $this->PerPageVar = $this->PerPageShortVar;
+ }
+ else {
+ $this->PerPageVar = $this->PerPageVarLong;
+ }
}
else
$this->PerPageVar = $this->PerPageVarLong;
@@ -2519,7 +2534,12 @@
echo htmlentities($sql,ENT_NOQUOTES)."
\n";
if($attribs["_shortlist"])
{
- $this->PerPageVar = $this->PerPageShortVar;
+ if ($objConfig->Get($this->PerPageShortVar) > 0) {
+ $this->PerPageVar = $this->PerPageShortVar;
+ }
+ else {
+ $this->PerPageVar = $this->PerPageVarLong;
+ }
}
else
$this->PerPageVar = $this->PerPageVarLong;
@@ -2608,7 +2628,12 @@
echo htmlentities($sql,ENT_NOQUOTES)."
\n";
if( getArrayValue($attribs,'_shortlist') )
{
- $this->PerPageVar = $this->PerPageShortVar;
+ if ($objConfig->Get($this->PerPageShortVar) > 0) {
+ $this->PerPageVar = $this->PerPageShortVar;
+ }
+ else {
+ $this->PerPageVar = $this->PerPageVarLong;
+ }
}
else
$this->PerPageVar = $this->PerPageVarLong;
@@ -2675,7 +2700,12 @@
echo htmlentities($sql,ENT_NOQUOTES)."
\n";
if($attribs["_shortlist"])
{
- $this->PerPageVar = $this->PerPageShortVar;
+ if ($objConfig->Get($this->PerPageShortVar) > 0) {
+ $this->PerPageVar = $this->PerPageShortVar;
+ }
+ else {
+ $this->PerPageVar = $this->PerPageVarLong;
+ }
}
else
$this->PerPageVar = $this->PerPageVarLong;
@@ -2745,7 +2775,12 @@
if($attribs["_shortlist"])
{
- $this->PerPageVar = $this->PerPageShortVar;
+ if ($objConfig->Get($this->PerPageShortVar) > 0) {
+ $this->PerPageVar = $this->PerPageShortVar;
+ }
+ else {
+ $this->PerPageVar = $this->PerPageVarLong;
+ }
}
else
$this->PerPageVar = $this->PerPageVarLong;
Index: trunk/kernel/frontaction.php
===================================================================
diff -u -N -r979 -r1019
--- trunk/kernel/frontaction.php (.../frontaction.php) (revision 979)
+++ trunk/kernel/frontaction.php (.../frontaction.php) (revision 1019)
@@ -787,7 +787,7 @@
}
break;
case "m_simple_search":
- $keywords = $_POST["keywords"];
+ $keywords = trim($_POST["keywords"]);
$type = $objItemTypes->GetTypeByName("Category");
$objSearch = new clsSearchResults("Category","clsCategory");
$length = $objConfig->Get('Search_MinKeyword_Length');
@@ -951,7 +951,7 @@
$SearchResultIdList = $objSearch->Result_IdList();
if(count($SearchResultIdList)>0)
{
- $objSearch->PerformSearch(1,$SortOrder,TRUE,$SearchResultIdList);
+ $objSearch->PerformSearch(1,$SortOrder, TRUE,$SearchResultIdList);
//$objSearch->SetRelevence($type->Get("ItemType"), "CategoryId");
}
$SearchPerformed = TRUE;
Index: trunk/kernel/include/searchitems.php
===================================================================
diff -u -N -r964 -r1019
--- trunk/kernel/include/searchitems.php (.../searchitems.php) (revision 964)
+++ trunk/kernel/include/searchitems.php (.../searchitems.php) (revision 1019)
@@ -514,12 +514,12 @@
$SelectSQL .= " AND (ResourceId IN (".implode(",",$idlist)."))";
}
}
- $SelectSQL .= "GROUP BY $idField ";
+ $SelectSQL .= " GROUP BY $idField ";
//echo $SelectSQL."
\n";
- if($InitTable)
- {
+ if($InitTable = TRUE)
+ {
$this->adodbConnection->Execute("DROP TABLE IF EXISTS ".$this->ResultTable);
//$indexSQL = "(INDEX(Relevance), INDEX(ItemId), INDEX(ItemType), INDEX sorting (EdPick,Relevance)) ";
$full_sql = "CREATE TABLE ".$this->ResultTable." ".$indexSQL.$SelectSQL;
@@ -604,6 +604,7 @@
break;
$exact_word=substr($phrase, $i+1, ($exact_match_close-$i)-1);
$exact_word = str_replace("\\", "", $exact_word);
+ $exact_word = trim($exact_word);
$i=$exact_match_close;
if($exact_word)
{