]> git.mxchange.org Git - friendica.git/blobdiff - include/acl_selectors.php
menu entry for "Delegations" moved to the settings.
[friendica.git] / include / acl_selectors.php
index 1b9843fd174c916c1cfbbf00c6700f7fc042a2de..ee74ccc16ab440309f1fe9ac8e24ebee026dd023 100644 (file)
@@ -1,6 +1,7 @@
 <?php
 
 require_once("include/contact_selectors.php");
+require_once("include/features.php");
 
 /**
  * 
@@ -239,7 +240,7 @@ function prune_deadguys($arr) {
        if($r) {
                $ret = array();
                foreach($r as $rr) 
-                       $ret[] = $rr['id'];
+                       $ret[] = intval($rr['id']);
                return $ret;
        }
        return array();
@@ -319,7 +320,7 @@ function populate_acl($user = null,$celeb = false) {
        $o .= '</div>';
        $o .= '</div>' . "\r\n";
        $o .= '<div id="acl-wrapper-end"></div>' . "\r\n";*/
-       
+
        $tpl = get_markup_template("acl_selector.tpl");
        $o = replace_macros($tpl, array(
                '$showall'=> t("Visible to everybody"),
@@ -329,9 +330,12 @@ function populate_acl($user = null,$celeb = false) {
                '$allowgid' => json_encode($perms['allow_gid']),
                '$denycid' => json_encode($perms['deny_cid']),
                '$denygid' => json_encode($perms['deny_gid']),
+               '$features' => array(
+                       "aclautomention"=>(feature_enabled($user['uid'],"aclautomention")?"true":"false")
+               ),
        ));
-       
-       
+
+
        return $o;
 
 }
@@ -339,7 +343,7 @@ function populate_acl($user = null,$celeb = false) {
 function construct_acl_data(&$a, $user) {
 
        // Get group and contact information for html ACL selector
-       $acl_data = acl_lookup(&$a, 'html');
+       $acl_data = acl_lookup($a, 'html');
 
        $user_defaults = get_acl_permissions($user);
 
@@ -395,19 +399,19 @@ function acl_lookup(&$a, $out_type = 'json') {
        } else {
                $sql_extra = $sql_extra2 = "";
        }
-       
+
        // count groups and contacts
        if ($type=='' || $type=='g'){
-               $r = q("SELECT COUNT(`id`) AS g FROM `group` WHERE `deleted` = 0 AND `uid` = %d $sql_extra",
+               $r = q("SELECT COUNT(*) AS g FROM `group` WHERE `deleted` = 0 AND `uid` = %d $sql_extra",
                        intval(local_user())
                );
                $group_count = (int)$r[0]['g'];
        } else {
                $group_count = 0;
        }
-       
+
        if ($type=='' || $type=='c'){
-               $r = q("SELECT COUNT(`id`) AS c FROM `contact` 
+               $r = q("SELECT COUNT(*) AS c FROM `contact` 
                                WHERE `uid` = %d AND `self` = 0 
                                AND `blocked` = 0 AND `pending` = 0 AND `archive` = 0
                                AND `notify` != '' $sql_extra2" ,
@@ -419,7 +423,7 @@ function acl_lookup(&$a, $out_type = 'json') {
 
                // autocomplete for Private Messages
 
-               $r = q("SELECT COUNT(`id`) AS c FROM `contact` 
+               $r = q("SELECT COUNT(*) AS c FROM `contact` 
                                WHERE `uid` = %d AND `self` = 0 
                                AND `blocked` = 0 AND `pending` = 0 AND `archive` = 0 
                                AND `network` IN ('%s','%s','%s') $sql_extra2" ,
@@ -435,7 +439,7 @@ function acl_lookup(&$a, $out_type = 'json') {
 
                // autocomplete for Contacts
 
-               $r = q("SELECT COUNT(`id`) AS c FROM `contact` 
+               $r = q("SELECT COUNT(*) AS c FROM `contact` 
                                WHERE `uid` = %d AND `self` = 0 
                                AND `pending` = 0 $sql_extra2" ,
                        intval(local_user())
@@ -474,14 +478,15 @@ function acl_lookup(&$a, $out_type = 'json') {
                                "name"  => $g['name'],
                                "id"    => intval($g['id']),
                                "uids"  => array_map("intval", explode(",",$g['uids'])),
-                               "link"  => ''
+                               "link"  => '',
+                               "forum" => '0'
                        );
                }
        }
        
        if ($type=='' || $type=='c'){
        
-               $r = q("SELECT `id`, `name`, `nick`, `micro`, `network`, `url`, `attag` FROM `contact` 
+               $r = q("SELECT `id`, `name`, `nick`, `micro`, `network`, `url`, `attag`, forum FROM `contact` 
                        WHERE `uid` = %d AND `self` = 0 AND `blocked` = 0 AND `pending` = 0 AND `archive` = 0 AND `notify` != ''
                        $sql_extra2
                        ORDER BY `name` ASC ",
@@ -541,6 +546,7 @@ function acl_lookup(&$a, $out_type = 'json') {
                                "network" => $g['network'],
                                "link" => $g['url'],
                                "nick" => ($g['attag']) ? $g['attag'] : $g['nick'],
+                               "forum" => $g['forum']
                        );
                }                       
        }