From: rabuzarus <>
Date: Thu, 25 Jun 2015 16:57:42 +0000 (+0200)
Subject: some more work to get acl data into populate_acl
X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=94b21245bca0d139c6b4e498ed5de8342f55454a;p=friendica.git
some more work to get acl data into populate_acl
---
diff --git a/include/acl_selectors.php b/include/acl_selectors.php
index e0055f1c68..85a9f67592 100644
--- a/include/acl_selectors.php
+++ b/include/acl_selectors.php
@@ -283,12 +283,34 @@ function get_acl_permissions($user = null) {
}
-function populate_acl($user = null,$celeb = false,$show_jotnets = true,$show_mail = false) {
+function populate_acl($user = null,$celeb = false,$show_jotnets = false) {
$perms = get_acl_permissions($user);
$jotnets = '';
if($show_jotnets) {
+ $mail_disabled = ((function_exists('imap_open') && (! get_config('system','imap_disabled'))) ? 0 : 1);
+
+ $mail_enabled = false;
+ $pubmail_enabled = false;
+
+ if(! $mail_disabled) {
+ $r = q("SELECT * FROM `mailacct` WHERE `uid` = %d AND `server` != '' LIMIT 1",
+ intval(local_user())
+ );
+ if(count($r)) {
+ $mail_enabled = true;
+ if(intval($r[0]['pubmail']))
+ $pubmail_enabled = true;
+ }
+ }
+
+ if($mail_enabled) {
+ $selected = (($pubmail_enabled) ? ' checked="checked" ' : '');
+ $jotnets .= '
'
+ . t("Post to Email") . '
';
+ }
+
call_hooks('jot_networks', $jotnets);
}
@@ -342,6 +364,7 @@ function populate_acl($user = null,$celeb = false,$show_jotnets = true,$show_mai
'$allowgid' => json_encode($perms['allow_gid']),
'$denycid' => json_encode($perms['deny_cid']),
'$denygid' => json_encode($perms['deny_gid']),
+ '$networks' => $show_jotnets,
'$emailcc' => t('CC: email addresses'),
'$emtitle' => t('Example: bob@example.com, mary@example.com'),
'$jotnets' => $jotnets,
diff --git a/mod/network.php b/mod/network.php
index 7b3c92e249..c3de76413b 100644
--- a/mod/network.php
+++ b/mod/network.php
@@ -485,7 +485,7 @@ function network_content(&$a, $update = 0) {
((strlen($a->user['allow_cid'])) || (strlen($a->user['allow_gid'])) ||
(strlen($a->user['deny_cid'])) || (strlen($a->user['deny_gid']))))) ? 'lock' : 'unlock'),
'default_perms' => get_acl_permissions($a->user),
- 'acl' => populate_acl((($group || $cid || $nets) ? $def_acl : $a->user), $celeb),
+ 'acl' => populate_acl((($group || $cid || $nets) ? $def_acl : $a->user), $celeb, true),
'bang' => (($group || $cid || $nets) ? '!' : ''),
'visitor' => 'block',
'profile_uid' => local_user(),
diff --git a/mod/photos.php b/mod/photos.php
index 8f11a523bb..02ae0e76d2 100644
--- a/mod/photos.php
+++ b/mod/photos.php
@@ -1139,11 +1139,11 @@ function photos_content(&$a) {
if($a->theme['template_engine'] === 'internal') {
$albumselect_e = template_escape($albumselect);
- $aclselect_e = (($visitor) ? '' : template_escape(populate_acl($a->user, $celeb,false)));
+ $aclselect_e = (($visitor) ? '' : template_escape(populate_acl($a->user, $celeb)));
}
else {
$albumselect_e = $albumselect;
- $aclselect_e = (($visitor) ? '' : populate_acl($a->user, $celeb,false));
+ $aclselect_e = (($visitor) ? '' : populate_acl($a->user, $celeb));
}
$o .= replace_macros($tpl,array(
diff --git a/mod/profile.php b/mod/profile.php
index e81cfd22c9..9eb2d34b6c 100644
--- a/mod/profile.php
+++ b/mod/profile.php
@@ -195,7 +195,7 @@ function profile_content(&$a, $update = 0) {
'default_location' => (($is_owner) ? $a->user['default-location'] : ''),
'nickname' => $a->profile['nickname'],
'lockstate' => (((is_array($a->user) && ((strlen($a->user['allow_cid'])) || (strlen($a->user['allow_gid'])) || (strlen($a->user['deny_cid'])) || (strlen($a->user['deny_gid']))))) ? 'lock' : 'unlock'),
- 'acl' => (($is_owner) ? populate_acl($a->user, $celeb) : ''),
+ 'acl' => (($is_owner) ? populate_acl($a->user, $celeb, true) : ''),
'bang' => '',
'visitor' => (($is_owner || $commvisitor) ? 'block' : 'none'),
'profile_uid' => $a->profile['profile_uid'],
diff --git a/view/templates/acl_selector.tpl b/view/templates/acl_selector.tpl
index 6b6f1be4a9..c1220bc1e3 100644
--- a/view/templates/acl_selector.tpl
+++ b/view/templates/acl_selector.tpl
@@ -15,6 +15,14 @@
{{$hide}}
+{{if $networks}}
+
+{{$emailcc}}
+
+{{if $jotnets}}
+{{$jotnets}}
+{{/if}}{{/if}}
+