Show
Ignore:
Timestamp:
11/07/06 07:34:01 (2 years ago)
Author:
mdodoo
Message:

Trunk sync up until [1613]. To tell the truth, I do not like doing these syncs.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • branches/multiuser/api.php

    r1604 r1628  
    4949        blGetItems($cid,$date,$markread); 
    5050        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 
    5265} 
    5366 
     
    193206 
    194207} 
     208 
     209function osSearch($q) { 
     210    rss_require('cls/search.php'); 
     211    $sil = new SearchItemList($q,5); 
     212    $results = array(); 
     213    foreach($sil -> feeds as $feed) { 
     214        foreach($feed -> items as $item) { 
     215            $results[] = $item -> title; 
     216        } 
     217    } 
     218    return array($q,$results); 
     219} 
    195220?>