X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FModule%2FPermissionTooltip.php;h=f4fd5665022b2c42579f6fe5b6a5e3a0361caa79;hb=3bca4fe2a64671d09e08346456cdfa6c12f996e9;hp=dbfdd5ef26c63acdf7e9a14eb3721263c3dbce06;hpb=dd8f875d6bd55fc0fa659bd665ce9a5362138980;p=friendica.git
diff --git a/src/Module/PermissionTooltip.php b/src/Module/PermissionTooltip.php
index dbfdd5ef26..f4fd566502 100644
--- a/src/Module/PermissionTooltip.php
+++ b/src/Module/PermissionTooltip.php
@@ -1,6 +1,6 @@
fetchReceiversFromACL($model);
+ }
+
+ $this->httpExit(DI::l10n()->t('Visible to:') . '
' . $receivers);
+ }
+
+ /**
+ * Fetch a list of receivers based on the ACL data
+ *
+ * @param array $model
+ * @return string
+ */
+ private function fetchReceiversFromACL(array $model)
+ {
+ $allowed_users = $model['allow_cid'];
+ $allowed_circles = $model['allow_gid'];
+ $deny_users = $model['deny_cid'];
+ $deny_circles = $model['deny_gid'];
- $o = DI::l10n()->t('Visible to:') . '
';
$l = [];
- if (count($allowed_groups)) {
- $key = array_search(Group::FOLLOWERS, $allowed_groups);
+ if (count($allowed_circles)) {
+ $key = array_search(Circle::FOLLOWERS, $allowed_circles);
if ($key !== false) {
$l[] = '' . DI::l10n()->t('Followers') . '';
- unset($allowed_groups[$key]);
+ unset($allowed_circles[$key]);
}
- $key = array_search(Group::MUTUALS, $allowed_groups);
+ $key = array_search(Circle::MUTUALS, $allowed_circles);
if ($key !== false) {
$l[] = '' . DI::l10n()->t('Mutuals') . '';
- unset($allowed_groups[$key]);
+ unset($allowed_circles[$key]);
}
- foreach (DI::dba()->selectToArray('group', ['name'], ['id' => $allowed_groups]) as $group) {
- $l[] = '' . $group['name'] . '';
+ foreach (DI::dba()->selectToArray('group', ['name'], ['id' => $allowed_circles]) as $circle) {
+ $l[] = '' . $circle['name'] . '';
}
}
@@ -143,21 +157,21 @@ class PermissionTooltip extends \Friendica\BaseModule
$l[] = $contact['name'];
}
- if (count($deny_groups)) {
- $key = array_search(Group::FOLLOWERS, $deny_groups);
+ if (count($deny_circles)) {
+ $key = array_search(Circle::FOLLOWERS, $deny_circles);
if ($key !== false) {
$l[] = '' . DI::l10n()->t('Followers') . '';
- unset($deny_groups[$key]);
+ unset($deny_circles[$key]);
}
- $key = array_search(Group::MUTUALS, $deny_groups);
+ $key = array_search(Circle::MUTUALS, $deny_circles);
if ($key !== false) {
$l[] = '' . DI::l10n()->t('Mutuals') . '';
- unset($deny_groups[$key]);
+ unset($deny_circles[$key]);
}
- foreach (DI::dba()->selectToArray('group', ['name'], ['id' => $allowed_groups]) as $group) {
- $l[] = '' . $group['name'] . '';
+ foreach (DI::dba()->selectToArray('group', ['name'], ['id' => $allowed_circles]) as $circle) {
+ $l[] = '' . $circle['name'] . '';
}
}
@@ -165,11 +179,7 @@ class PermissionTooltip extends \Friendica\BaseModule
$l[] = '' . $contact['name'] . '';
}
- if (!empty($l)) {
- System::httpExit($o . implode(', ', $l));
- } else {
- System::httpExit($o . $receivers);;
- }
+ return implode(', ', $l);
}
/**