Changeset 1613 for trunk/gregarius/api.php
- Timestamp:
- 10/24/06 16:45:25 (4 years ago)
- Files:
-
- 1 modified
-
trunk/gregarius/api.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/gregarius/api.php
r1544 r1613 49 49 blGetItems($cid,$date,$markread); 50 50 break; 51 } 51 case 'search': 52 rss_require('extlib/JSON.php'); 53 $json = new Services_JSON(); 54 $query = sanitize(@$_REQUEST['q'], RSS_SANITIZER_WORDS); 55 if ($query) { 56 $res = osSearch($query); 57 } else { 58 $res = array($query,array()); 59 } 60 header('Content-Type: application/json'); 61 die ($json->encode($res)); 62 break; 63 } 64 52 65 } 53 66 … … 195 208 196 209 } 210 211 function osSearch($q) { 212 rss_require('cls/search.php'); 213 $sil = new SearchItemList($q,5); 214 $results = array(); 215 foreach($sil -> feeds as $feed) { 216 foreach($feed -> items as $item) { 217 $results[] = $item -> title; 218 } 219 } 220 return array($q,$results); 221 } 197 222 ?>
