From 12528f033ad781fd30e82d6e5790c592ccdcadb9 Mon Sep 17 00:00:00 2001 From: rabuzarus <> Date: Thu, 25 Jun 2015 12:33:05 +0200 Subject: [PATCH 1/8] include jotnets in populate_acl --- include/acl_selectors.php | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/include/acl_selectors.php b/include/acl_selectors.php index b2c4b31c8..e0055f1c6 100644 --- a/include/acl_selectors.php +++ b/include/acl_selectors.php @@ -283,10 +283,15 @@ function get_acl_permissions($user = null) { } -function populate_acl($user = null,$celeb = false) { +function populate_acl($user = null,$celeb = false,$show_jotnets = true,$show_mail = false) { $perms = get_acl_permissions($user); + $jotnets = ''; + if($show_jotnets) { + call_hooks('jot_networks', $jotnets); + } + // We shouldn't need to prune deadguys from the block list. Either way they can't get the message. // Also no point enumerating groups and checking them, that will take place on delivery. @@ -337,6 +342,11 @@ 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']), + '$emailcc' => t('CC: email addresses'), + '$emtitle' => t('Example: bob@example.com, mary@example.com'), + '$jotnets' => $jotnets, + '$aclModalTitle' => t('Permissions'), + '$aclModalDismiss' => t('Close'), '$features' => array( "aclautomention"=>(feature_enabled($user['uid'],"aclautomention")?"true":"false") ), From bfebf9636b075ee2b27dab98c39535e7d2298b85 Mon Sep 17 00:00:00 2001 From: rabuzarus <> Date: Thu, 25 Jun 2015 12:38:09 +0200 Subject: [PATCH 2/8] acl for events and photos --- mod/events.php | 2 +- mod/photos.php | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/mod/events.php b/mod/events.php index e9e1af05d..92c128c1d 100644 --- a/mod/events.php +++ b/mod/events.php @@ -507,7 +507,7 @@ function events_content(&$a) { '$sh_text' => t('Share this event'), '$sh_checked' => $sh_checked, '$preview' => t('Preview'), - '$acl' => (($cid) ? '' : populate_acl(((x($orig_event)) ? $orig_event : $a->user),false)), + '$acl' => (($cid) ? '' : populate_acl(((x($orig_event)) ? $orig_event : $a->user),false, false)), '$submit' => t('Submit') )); diff --git a/mod/photos.php b/mod/photos.php index 02ae0e76d..8f11a523b 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))); + $aclselect_e = (($visitor) ? '' : template_escape(populate_acl($a->user, $celeb,false))); } else { $albumselect_e = $albumselect; - $aclselect_e = (($visitor) ? '' : populate_acl($a->user, $celeb)); + $aclselect_e = (($visitor) ? '' : populate_acl($a->user, $celeb,false)); } $o .= replace_macros($tpl,array( From 94b21245bca0d139c6b4e498ed5de8342f55454a Mon Sep 17 00:00:00 2001 From: rabuzarus <> Date: Thu, 25 Jun 2015 18:57:42 +0200 Subject: [PATCH 3/8] some more work to get acl data into populate_acl --- include/acl_selectors.php | 25 ++++++++++++++++++++++++- mod/network.php | 2 +- mod/photos.php | 4 ++-- mod/profile.php | 2 +- view/templates/acl_selector.tpl | 8 ++++++++ view/templates/jot.tpl | 4 ---- 6 files changed, 36 insertions(+), 9 deletions(-) diff --git a/include/acl_selectors.php b/include/acl_selectors.php index e0055f1c6..85a9f6759 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 .= '