]> git.mxchange.org Git - friendica.git/blobdiff - include/acl_selectors.php
Merge pull request #3866 from annando/detailled_notif
[friendica.git] / include / acl_selectors.php
index ca463d9433f5868004ea543ad4d669ca3df5f07c..32348c2330aff6172420b2a20a56288062d42d86 100644 (file)
@@ -478,9 +478,18 @@ function acl_lookup(App $a, $out_type = 'json') {
                        intval(local_user())
                );
                $contact_count = (int)$r[0]['c'];
-       }
-       elseif ($type == 'm') {
-
+       } elseif ($type == 'f') {
+               // autocomplete for editor mentions of forums
+               $r = q("SELECT COUNT(*) AS c FROM `contact`
+                               WHERE `uid` = %d AND NOT `self`
+                               AND NOT `blocked` AND NOT `pending` AND NOT `archive`
+                               AND (`forum` OR `prv`)
+                               AND `success_update` >= `failure_update`
+                               AND `notify` != '' $sql_extra2" ,
+                       intval(local_user())
+               );
+               $contact_count = (int)$r[0]['c'];
+       } elseif ($type == 'm') {
                // autocomplete for Private Messages
 
                $r = q("SELECT COUNT(*) AS c FROM `contact`
@@ -495,8 +504,7 @@ function acl_lookup(App $a, $out_type = 'json') {
                );
                $contact_count = (int)$r[0]['c'];
 
-       }
-       elseif ($type == 'a') {
+       } elseif ($type == 'a') {
 
                // autocomplete for Contacts
 
@@ -546,7 +554,7 @@ function acl_lookup(App $a, $out_type = 'json') {
                                "forum" => '0'
                        );
                }
-               if (count($groups) > 0) {
+               if ((count($groups) > 0) && ($search == "")) {
                        $groups[] = array("separator" => true);
                }
        }
@@ -557,7 +565,7 @@ function acl_lookup(App $a, $out_type = 'json') {
                        WHERE `uid` = %d AND NOT `self` AND NOT `blocked` AND NOT `pending` AND NOT `archive` AND `notify` != ''
                        AND `success_update` >= `failure_update` AND NOT (`network` IN ('%s', '%s'))
                        $sql_extra2
-                       ORDER BY `frm` DESC, `name` ASC ",
+                       ORDER BY `name` ASC ",
                        intval(local_user()),
                        dbesc(NETWORK_OSTATUS), dbesc(NETWORK_STATUSNET)
                );
@@ -570,8 +578,17 @@ function acl_lookup(App $a, $out_type = 'json') {
                        intval(local_user()),
                        dbesc(NETWORK_STATUSNET)
                );
-       }
-       elseif ($type == 'm') {
+       } elseif ($type == 'f') {
+               $r = q("SELECT `id`, `name`, `nick`, `micro`, `network`, `url`, `attag`, `addr`, `forum`, `prv` FROM `contact`
+                       WHERE `uid` = %d AND NOT `self` AND NOT `blocked` AND NOT `pending` AND NOT `archive` AND `notify` != ''
+                       AND `success_update` >= `failure_update` AND NOT (`network` IN ('%s'))
+                       AND (`forum` OR `prv`)
+                       $sql_extra2
+                       ORDER BY `name` ASC ",
+                       intval(local_user()),
+                       dbesc(NETWORK_STATUSNET)
+               );
+       } elseif ($type == 'm') {
                $r = q("SELECT `id`, `name`, `nick`, `micro`, `network`, `url`, `attag`, `addr` FROM `contact`
                        WHERE `uid` = %d AND NOT `self` AND NOT `blocked` AND NOT `pending` AND NOT `archive`
                        AND `success_update` >= `failure_update` AND `network` IN ('%s','%s','%s')
@@ -638,7 +655,9 @@ function acl_lookup(App $a, $out_type = 'json') {
                        }
                }
                if (count($forums) > 0) {
-                       $forums[] = array("separator" => true);
+                       if ($search == "") {
+                               $forums[] = array("separator" => true);
+                       }
                        $contacts = array_merge($forums, $contacts);
                }
        }