some more work to get acl data into populate_acl
This commit is contained in:
parent
bfebf9636b
commit
94b21245bc
6 changed files with 36 additions and 9 deletions
|
@ -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);
|
$perms = get_acl_permissions($user);
|
||||||
|
|
||||||
$jotnets = '';
|
$jotnets = '';
|
||||||
if($show_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 .= '<div class="profile-jot-net"><input type="checkbox" name="pubmail_enable"' . $selected . ' value="1" /> '
|
||||||
|
. t("Post to Email") . '</div>';
|
||||||
|
}
|
||||||
|
|
||||||
call_hooks('jot_networks', $jotnets);
|
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']),
|
'$allowgid' => json_encode($perms['allow_gid']),
|
||||||
'$denycid' => json_encode($perms['deny_cid']),
|
'$denycid' => json_encode($perms['deny_cid']),
|
||||||
'$denygid' => json_encode($perms['deny_gid']),
|
'$denygid' => json_encode($perms['deny_gid']),
|
||||||
|
'$networks' => $show_jotnets,
|
||||||
'$emailcc' => t('CC: email addresses'),
|
'$emailcc' => t('CC: email addresses'),
|
||||||
'$emtitle' => t('Example: bob@example.com, mary@example.com'),
|
'$emtitle' => t('Example: bob@example.com, mary@example.com'),
|
||||||
'$jotnets' => $jotnets,
|
'$jotnets' => $jotnets,
|
||||||
|
|
|
@ -485,7 +485,7 @@ function network_content(&$a, $update = 0) {
|
||||||
((strlen($a->user['allow_cid'])) || (strlen($a->user['allow_gid'])) ||
|
((strlen($a->user['allow_cid'])) || (strlen($a->user['allow_gid'])) ||
|
||||||
(strlen($a->user['deny_cid'])) || (strlen($a->user['deny_gid']))))) ? 'lock' : 'unlock'),
|
(strlen($a->user['deny_cid'])) || (strlen($a->user['deny_gid']))))) ? 'lock' : 'unlock'),
|
||||||
'default_perms' => get_acl_permissions($a->user),
|
'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) ? '!' : ''),
|
'bang' => (($group || $cid || $nets) ? '!' : ''),
|
||||||
'visitor' => 'block',
|
'visitor' => 'block',
|
||||||
'profile_uid' => local_user(),
|
'profile_uid' => local_user(),
|
||||||
|
|
|
@ -1139,11 +1139,11 @@ function photos_content(&$a) {
|
||||||
|
|
||||||
if($a->theme['template_engine'] === 'internal') {
|
if($a->theme['template_engine'] === 'internal') {
|
||||||
$albumselect_e = template_escape($albumselect);
|
$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 {
|
else {
|
||||||
$albumselect_e = $albumselect;
|
$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(
|
$o .= replace_macros($tpl,array(
|
||||||
|
|
|
@ -195,7 +195,7 @@ function profile_content(&$a, $update = 0) {
|
||||||
'default_location' => (($is_owner) ? $a->user['default-location'] : ''),
|
'default_location' => (($is_owner) ? $a->user['default-location'] : ''),
|
||||||
'nickname' => $a->profile['nickname'],
|
'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'),
|
'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' => '',
|
'bang' => '',
|
||||||
'visitor' => (($is_owner || $commvisitor) ? 'block' : 'none'),
|
'visitor' => (($is_owner || $commvisitor) ? 'block' : 'none'),
|
||||||
'profile_uid' => $a->profile['profile_uid'],
|
'profile_uid' => $a->profile['profile_uid'],
|
||||||
|
|
|
@ -15,6 +15,14 @@
|
||||||
<a href="#" class='acl-button-hide'>{{$hide}}</a>
|
<a href="#" class='acl-button-hide'>{{$hide}}</a>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
{{if $networks}}
|
||||||
|
<hr style="clear:both"/>
|
||||||
|
<div id="profile-jot-email-label">{{$emailcc}}</div><input type="text" name="emailcc" id="profile-jot-email" title="{{$emtitle|escape:'html'}}" />
|
||||||
|
<div id="profile-jot-email-end"></div>
|
||||||
|
{{if $jotnets}}
|
||||||
|
{{$jotnets}}
|
||||||
|
{{/if}}{{/if}}
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
if(typeof acl=="undefined"){
|
if(typeof acl=="undefined"){
|
||||||
|
|
|
@ -74,10 +74,6 @@
|
||||||
<div style="display: none;">
|
<div style="display: none;">
|
||||||
<div id="profile-jot-acl-wrapper" style="width:auto;height:auto;overflow:auto;">
|
<div id="profile-jot-acl-wrapper" style="width:auto;height:auto;overflow:auto;">
|
||||||
{{$acl}}
|
{{$acl}}
|
||||||
<hr style="clear:both"/>
|
|
||||||
<div id="profile-jot-email-label">{{$emailcc}}</div><input type="text" name="emailcc" id="profile-jot-email" title="{{$emtitle|escape:'html'}}" />
|
|
||||||
<div id="profile-jot-email-end"></div>
|
|
||||||
{{$jotnets}}
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue