]> git.mxchange.org Git - friendica.git/commitdiff
email recip autocomplete
authorfriendica <info@friendica.com>
Mon, 7 May 2012 02:53:34 +0000 (19:53 -0700)
committerfriendica <info@friendica.com>
Mon, 7 May 2012 02:53:34 +0000 (19:53 -0700)
mod/acl.php

index 88f150d7a02e02f8669617d2cbfb34183d0838e2..402d37376ce07634cf715b0ac5921ff69fbdb825 100644 (file)
@@ -13,6 +13,14 @@ function acl_init(&$a){
        $type = (x($_REQUEST,'type')?$_REQUEST['type']:"");
        
 
+       // For use with jquery.autocomplete for private mail completion
+
+       if(x($_REQUEST,'query') && strlen($_REQUEST['query'])) {
+               $type = 'm';
+               $search = $_REQUEST['query'];
+       }
+
+
        if ($search!=""){
                $sql_extra = "AND `name` LIKE '%%".dbesc($search)."%%'";
                $sql_extra2 = "AND (`attag` LIKE '%%".dbesc($search)."%%' OR `name` LIKE '%%".dbesc($search)."%%' OR `nick` LIKE '%%".dbesc($search)."%%')";
@@ -115,6 +123,23 @@ function acl_init(&$a){
        else
                $r = array();
 
+
+       if($type == 'm') {
+               $x = array();
+               $x['query'] = $search;
+               $x['suggestions'] = array();
+               $x['data'] = array();
+               if(count($r)) {
+                       foreach($r as $g) {
+                               $x['suggestions'][] = sprintf( t('%s [%s]'),$g['name'],$g['url']);
+                                       // '<img src="' . $g['micro'] . ' height="16" width="16" alt="' . t('Image/photo') . '" />' . 
+                               $x['data'][] = intval($g['id']);
+                       }
+               }
+               echo json_encode($x);
+               killme();
+       }
+
        if(count($r)) {
                foreach($r as $g){
                        $contacts[] = array(