Changeset 1613 for trunk/gregarius/cls
- Timestamp:
- 10/24/06 16:45:25 (2 years ago)
- Files:
-
- 1 modified
-
trunk/gregarius/cls/search.php (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/gregarius/cls/search.php
r1561 r1613 43 43 define ('QUERY_MATCH_EXACT','exact'); 44 44 45 // This is needed for some constants 46 rss_require('cls/wrappers/toolkit.php'); 45 47 46 48 class SearchItemList extends ItemList { … … 51 53 52 54 var $currentPage; 53 var $resultsPerPage ;55 var $resultsPerPage = 0; 54 56 var $startItem; 55 57 var $endItem; … … 58 60 var $logicSep; 59 61 60 function SearchItemList( ) {62 function SearchItemList($query=null,$results=0) { 61 63 parent::ItemList(); 64 if ($query) { 65 $this -> query=$query; 66 } elseif(isset($_REQUEST[QUERY_PRM])) { 67 $this->query = $_REQUEST[QUERY_PRM]; 68 }else{ 69 $this -> query = null; 70 } 71 72 73 // Sanitize the query parameters: 74 // fixme: this probably breaks on queries with weird characters, depending 75 // on the locale. 76 // see: http://php.benscom.com/manual/en/reference.pcre.pattern.syntax.php 77 if ($this -> query) { 78 $this -> query = trim(preg_replace('#[^\w\s\x80-\xff]#','',$this -> query)); 79 } 80 81 $this->resultsPerPage = (int) $results; 82 62 83 $this -> populate(); 63 84 … … 101 122 102 123 function populate() { 103 if (!isset($_REQUEST[QUERY_PRM])) {104 return;105 }106 107 // fixme: this probably breaks on queries with weird characters, depending108 // on the locale.109 // see: http://php.benscom.com/manual/en/reference.pcre.pattern.syntax.php110 $this->query = trim(preg_replace('#[^\w\s\x80-\xff]#','',$_REQUEST[QUERY_PRM]));111 124 112 125 if (!$this->query) { … … 122 135 RSS_SANITIZER_NUMERIC); 123 136 124 $this->resultsPerPage = sanitize( 125 ((array_key_exists(QUERY_RESULTS, $_REQUEST)) ? $_REQUEST[QUERY_RESULTS] : INFINE_RESULTS), 126 RSS_SANITIZER_NUMERIC); 127 137 if (!$this->resultsPerPage) { 138 $this->resultsPerPage = sanitize( 139 ((array_key_exists(QUERY_RESULTS, $_REQUEST)) ? $_REQUEST[QUERY_RESULTS] : INFINE_RESULTS), 140 RSS_SANITIZER_NUMERIC); 141 } 142 128 143 $this->currentPage = sanitize( 129 144 (array_key_exists(QUERY_CURRENT_PAGE, $_REQUEST) ? $_REQUEST[QUERY_CURRENT_PAGE] : 0),
