]> git.mxchange.org Git - friendica.git/blobdiff - mod/qsearch.php
The first queries are replaced with the new functions. More to come ...
[friendica.git] / mod / qsearch.php
index cffc3e50ba91256f4a854a03d83887b6a1c178c3..ba62fce0d7bddc829c884e117f862ef1bb85dcc1 100644 (file)
@@ -1,10 +1,12 @@
 <?php
 
-if(! function_exists('qsearch_init')) {
-function qsearch_init(&$a) {
+use Friendica\App;
 
-       if(! local_user())
+function qsearch_init(App $a) {
+
+       if (! local_user()) {
                killme();
+       }
 
        $limit = (get_config('system','qsearch_limit') ? intval(get_config('system','qsearch_limit')) : 100);
 
@@ -24,7 +26,7 @@ function qsearch_init(&$a) {
                intval($limit)
        );
 
-       if(count($r)) {
+       if (dbm::is_result($r)) {
 
                foreach($r as $rr)
                        $results[] = array( 0, (int) $rr['id'], $rr['name'], '', '');
@@ -39,7 +41,7 @@ function qsearch_init(&$a) {
        );
 
 
-       if(count($r)) {
+       if (dbm::is_result($r)) {
 
                foreach($r as $rr)
                        $results[] = array( (int) $rr['id'], 0, $rr['name'],$rr['url'],$rr['photo']);
@@ -48,4 +50,3 @@ function qsearch_init(&$a) {
        echo json_encode((object) $results);
        killme();
 }
-}