Merge pull request #6638 from Ixiter/develop-markdown-anchors

ACL network - fixed preselected acl items
This commit is contained in:
Hypolite Petovan 2019-02-11 07:23:32 -05:00 committed by GitHub
commit d6a82c6c2d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 10 deletions

View file

@ -525,7 +525,7 @@ function networkThreadedView(App $a, $update, $parent)
} }
} elseif (intval($a->argv[$x])) { } elseif (intval($a->argv[$x])) {
$gid = intval($a->argv[$x]); $gid = intval($a->argv[$x]);
$default_permissions = ['allow_gid' => '<' . $gid . '>']; $default_permissions['allow_gid'] = [$gid];
} }
} }
} }
@ -540,18 +540,18 @@ function networkThreadedView(App $a, $update, $parent)
$nets = defaults($_GET, 'nets' , ''); $nets = defaults($_GET, 'nets' , '');
if ($cid) { if ($cid) {
$default_permissions = ['allow_cid' => '<' . intval($cid) . '>']; $default_permissions['allow_cid'] = [(int) $cid];
} }
if ($nets) { if ($nets) {
$r = DBA::select('contact', ['id'], ['uid' => local_user(), 'network' => $nets], ['self' => false]); $r = DBA::select('contact', ['id'], ['uid' => local_user(), 'network' => $nets], ['self' => false]);
$str = ''; $str = [];
while ($rr = DBA::fetch($r)) { while ($rr = DBA::fetch($r)) {
$str .= '<' . $rr['id'] . '>'; $str[] = (int) $rr['id'];
} }
if (strlen($str)) { if (strlen($str)) {
$default_permissions = ['allow_cid' => $str]; $default_permissions['allow_cid'] = $str;
} }
} }

View file

@ -299,10 +299,10 @@ class ACL extends BaseObject
'$showall' => L10n::t('Visible to everybody'), '$showall' => L10n::t('Visible to everybody'),
'$show' => L10n::t('show'), '$show' => L10n::t('show'),
'$hide' => L10n::t('don\'t show'), '$hide' => L10n::t('don\'t show'),
'$allowcid' => json_encode(defaults($default_permissions, 'allow_cid', '')), '$allowcid' => json_encode(defaults($default_permissions, 'allow_cid', [])), // we need arrays for Javascript since we call .remove() and .push() on this values
'$allowgid' => json_encode(defaults($default_permissions, 'allow_gid', '')), '$allowgid' => json_encode(defaults($default_permissions, 'allow_gid', [])),
'$denycid' => json_encode(defaults($default_permissions, 'deny_cid', '')), '$denycid' => json_encode(defaults($default_permissions, 'deny_cid', [])),
'$denygid' => json_encode(defaults($default_permissions, 'deny_gid', '')), '$denygid' => json_encode(defaults($default_permissions, 'deny_gid', [])),
'$networks' => $show_jotnets, '$networks' => $show_jotnets,
'$emailcc' => L10n::t('CC: email addresses'), '$emailcc' => L10n::t('CC: email addresses'),
'$emtitle' => L10n::t('Example: bob@example.com, mary@example.com'), '$emtitle' => L10n::t('Example: bob@example.com, mary@example.com'),