From: friendica Date: Mon, 7 May 2012 02:53:34 +0000 (-0700) Subject: email recip autocomplete X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=57920849c4138920b5715931a268dd2a55c76003;p=friendica.git email recip autocomplete --- diff --git a/mod/acl.php b/mod/acl.php index 88f150d7a0..402d37376c 100644 --- a/mod/acl.php +++ b/mod/acl.php @@ -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']); + // '' . t('Image/photo') . '' . + $x['data'][] = intval($g['id']); + } + } + echo json_encode($x); + killme(); + } + if(count($r)) { foreach($r as $g){ $contacts[] = array(