X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=include%2Facl_selectors.php;h=8205854ba6ef2c0a7a4b6ebd062a0f40c1eff5ae;hb=9f2196aa1aa0dc112e3fc238832828d4e22fe137;hp=9ef1977bc5fd68d83f025383f4a52331451e19fe;hpb=d5cc757943fd56cbd4c1f89484dc499747d7e887;p=friendica.git diff --git a/include/acl_selectors.php b/include/acl_selectors.php index 9ef1977bc5..8205854ba6 100644 --- a/include/acl_selectors.php +++ b/include/acl_selectors.php @@ -209,7 +209,7 @@ function contact_select($selname, $selclass, $preselected = false, $size = 4, $p $tabindex = ($tabindex > 0 ? "tabindex=\"$tabindex\"" : ""); - if ($privmail AND $preselected) { + if ($privmail && $preselected) { $sql_extra .= " AND `id` IN (".implode(",", $preselected).")"; $hidepreselected = ' style="display: none;"'; } else { @@ -261,7 +261,7 @@ function contact_select($selname, $selclass, $preselected = false, $size = 4, $p $o .= "\r\n"; - if ($privmail AND $preselected) { + if ($privmail && $preselected) { $o .= implode(", ", $receiverlist); } @@ -388,13 +388,9 @@ function populate_acl($user = null, $show_jotnets = false) { } function construct_acl_data(App $a, $user) { - - $arr = array('user' => $user); - call_hooks('construct_acl_data', $arr); - - if (isset($arr['cancel'])) { - return; - } + // This function is now deactivated. It seems as if the generated data isn't used anywhere. + /// @todo Remove this function and all function calls before releasing Friendica 3.5.3 + return; // Get group and contact information for html ACL selector $acl_data = acl_lookup($a, 'html'); @@ -477,6 +473,7 @@ function acl_lookup(App $a, $out_type = 'json') { $r = q("SELECT COUNT(*) AS c FROM `contact` WHERE `uid` = %d AND NOT `self` AND NOT `blocked` AND NOT `pending` AND NOT `archive` + AND `success_update` >= `failure_update` AND `notify` != '' $sql_extra2" , intval(local_user()) ); @@ -489,6 +486,7 @@ function acl_lookup(App $a, $out_type = 'json') { $r = q("SELECT COUNT(*) AS c 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') $sql_extra2" , intval(local_user()), dbesc(NETWORK_DFRN), @@ -548,13 +546,16 @@ function acl_lookup(App $a, $out_type = 'json') { "forum" => '0' ); } + if ((count($groups) > 0) && ($search == "")) { + $groups[] = array("separator" => true); + } } if ($type == '') { - $r = q("SELECT `id`, `name`, `nick`, `micro`, `network`, `url`, `attag`, `addr`, `forum`, `prv` FROM `contact` + $r = q("SELECT `id`, `name`, `nick`, `micro`, `network`, `url`, `attag`, `addr`, `forum`, `prv`, (`prv` OR `forum`) AS `frm` FROM `contact` WHERE `uid` = %d AND NOT `self` AND NOT `blocked` AND NOT `pending` AND NOT `archive` AND `notify` != '' - AND NOT (`network` IN ('%s', '%s')) + AND `success_update` >= `failure_update` AND NOT (`network` IN ('%s', '%s')) $sql_extra2 ORDER BY `name` ASC ", intval(local_user()), @@ -563,7 +564,7 @@ function acl_lookup(App $a, $out_type = 'json') { } elseif ($type == 'c') { $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 NOT (`network` IN ('%s')) + AND `success_update` >= `failure_update` AND NOT (`network` IN ('%s')) $sql_extra2 ORDER BY `name` ASC ", intval(local_user()), @@ -573,7 +574,7 @@ function acl_lookup(App $a, $out_type = 'json') { 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 `network` IN ('%s','%s','%s') + AND `success_update` >= `failure_update` AND `network` IN ('%s','%s','%s') $sql_extra2 ORDER BY `name` ASC ", intval(local_user()), @@ -583,7 +584,7 @@ function acl_lookup(App $a, $out_type = 'json') { ); } elseif ($type == 'a') { $r = q("SELECT `id`, `name`, `nick`, `micro`, `network`, `url`, `attag`, `addr`, `forum`, `prv` FROM `contact` - WHERE `uid` = %d AND `pending` = 0 + WHERE `uid` = %d AND `pending` = 0 AND `success_update` >= `failure_update` $sql_extra2 ORDER BY `name` ASC ", intval(local_user()) @@ -617,8 +618,9 @@ function acl_lookup(App $a, $out_type = 'json') { if (dbm::is_result($r)) { + $forums = array(); foreach ($r as $g) { - $contacts[] = array( + $entry = array( 'type' => 'c', 'photo' => proxy_url($g['micro'], false, PROXY_SIZE_MICRO), 'name' => htmlentities($g['name']), @@ -629,6 +631,17 @@ function acl_lookup(App $a, $out_type = 'json') { 'addr' => htmlentities(($g['addr']) ? $g['addr'] : $g['url']), 'forum' => ((x($g, 'forum') || x($g, 'prv')) ? 1 : 0), ); + if ($entry['forum']) { + $forums[] = $entry; + } else { + $contacts[] = $entry; + } + } + if (count($forums) > 0) { + if ($search == "") { + $forums[] = array("separator" => true); + } + $contacts = array_merge($forums, $contacts); } }