]> git.mxchange.org Git - friendica.git/blobdiff - mod/qsearch.php
Fix profile wrong DISTINCT + ORDER BY
[friendica.git] / mod / qsearch.php
index e61915c758f928e50a650ce8ac55ed04cc0e2cab..8512bea51e622aaf52ed1dd4d210b4f3815867dc 100644 (file)
@@ -1,11 +1,12 @@
 <?php
 
-function qsearch_init(&$a) {
+function qsearch_init(App $a) {
 
-       if(! local_user())
+       if (! local_user()) {
                killme();
+       }
 
-       $limit = (get_config('system','lsearch_limit') ? intval(get_config('system','lsearch_limit')) : 100);
+       $limit = (get_config('system','qsearch_limit') ? intval(get_config('system','qsearch_limit')) : 100);
 
        $search = ((x($_GET,'s')) ? notags(trim(urldecode($_GET['s']))) : '');
 
@@ -23,10 +24,10 @@ function qsearch_init(&$a) {
                intval($limit)
        );
 
-       if(count($r)) {
+       if (dbm::is_result($r)) {
 
                foreach($r as $rr)
-                       $results[] = array( t('Group: ') . $rr['name'],'[group]<' . $rr['id'] . '>','');
+                       $results[] = array( 0, (int) $rr['id'], $rr['name'], '', '');
        }
 
        $sql_extra = ((strlen($search)) ? " AND (`name` REGEXP '$search' OR `nick` REGEXP '$search') " : "");
@@ -38,12 +39,13 @@ function qsearch_init(&$a) {
        );
 
 
-       if(count($r)) {
+       if (dbm::is_result($r)) {
 
                foreach($r as $rr)
-                       $results[] = array($rr['name'],$rr['url'],$rr['photo']);
+                       $results[] = array( (int) $rr['id'], 0, $rr['name'],$rr['url'],$rr['photo']);
        }
 
-       echo str_replace('\\/','/',json_encode((object) $results));
+       echo json_encode((object) $results);
        killme();
-}
\ No newline at end of file
+}
+