]> git.mxchange.org Git - friendica.git/blobdiff - mod/acl.php
give themes more control over events/birthdays and provide them as notifications
[friendica.git] / mod / acl.php
index 402d37376ce07634cf715b0ac5921ff69fbdb825..f3e46efa5610bc952a57aa240b86c384f73dd34d 100644 (file)
@@ -1,5 +1,6 @@
 <?php
 /* ACL selector json backend */
+
 require_once("include/acl_selectors.php");
 
 function acl_init(&$a){
@@ -16,7 +17,8 @@ function acl_init(&$a){
        // For use with jquery.autocomplete for private mail completion
 
        if(x($_REQUEST,'query') && strlen($_REQUEST['query'])) {
-               $type = 'm';
+               if(! $type)
+                       $type = 'm';
                $search = $_REQUEST['query'];
        }
 
@@ -62,6 +64,18 @@ function acl_init(&$a){
                );
                $contact_count = (int)$r[0]['c'];
 
+       }
+       elseif ($type == 'a') {
+
+               // autocomplete for Contacts
+
+               $r = q("SELECT COUNT(`id`) AS c FROM `contact` 
+                               WHERE `uid` = %d AND `self` = 0 
+                               AND `pending` = 0 $sql_extra2" ,
+                       intval(local_user())
+               );
+               $contact_count = (int)$r[0]['c'];
+
        } else {
                $contact_count = 0;
        }
@@ -120,19 +134,30 @@ function acl_init(&$a){
                        dbesc(NETWORK_DIASPORA)
                );
        }
+       elseif($type == 'a') {
+               $r = q("SELECT `id`, `name`, `nick`, `micro`, `network`, `url`, `attag` FROM `contact` 
+                       WHERE `uid` = %d AND `pending` = 0
+                       $sql_extra2
+                       ORDER BY `name` ASC ",
+                       intval(local_user())
+               );
+       }
        else
                $r = array();
 
 
-       if($type == 'm') {
+       if($type == 'm' || $type == 'a') {
                $x = array();
                $x['query'] = $search;
+               $x['photos'] = array();
+               $x['links'] = array();
                $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['photos'][] = $g['micro'];
+                               $x['links'][] = $g['url'];
+                               $x['suggestions'][] = $g['name'];
                                $x['data'][] = intval($g['id']);
                        }
                }