]> git.mxchange.org Git - friendica.git/commitdiff
ACL network - fixed preselected acl items
authorPeter Liebetrau <peter.liebetrau@gmail.com>
Mon, 11 Feb 2019 09:00:42 +0000 (10:00 +0100)
committerPeter Liebetrau <peter.liebetrau@gmail.com>
Mon, 11 Feb 2019 09:00:42 +0000 (10:00 +0100)
mod/network.php
src/Core/ACL.php

index f7dbc14ede369e35c4a5d52f7a71a59877402d5d..b5c218de24a0a80b550887d11a5b54610190fcd6 100644 (file)
@@ -525,7 +525,7 @@ function networkThreadedView(App $a, $update, $parent)
                                }
                        } elseif (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' , '');
 
        if ($cid) {
-               $default_permissions = ['allow_cid' => '<' . intval($cid) . '>'];
+               $default_permissions['allow_cid'] = [(int) $cid];
        }
 
        if ($nets) {
                $r = DBA::select('contact', ['id'], ['uid' => local_user(), 'network' => $nets], ['self' => false]);
 
-               $str = '';
+               $str = [];
                while ($rr = DBA::fetch($r)) {
-                       $str .= '<' . $rr['id'] . '>';
+                       $str[] = (int) $rr['id'];
                }
                if (strlen($str)) {
-                       $default_permissions = ['allow_cid' => $str];
+                       $default_permissions['allow_cid'] = $str;
                }
        }
 
index b693a28bf9bd95a89f657c0d5d12056d538c043b..19015714e9c7b48148700c0f414153330aa9cc75 100644 (file)
@@ -293,16 +293,16 @@ class ACL extends BaseObject
                                                L10n::t('Hide your profile details from unknown viewers?'));
                        }
                }
-
+               
                $tpl = Renderer::getMarkupTemplate('acl_selector.tpl');
                $o = Renderer::replaceMacros($tpl, [
                        '$showall' => L10n::t('Visible to everybody'),
                        '$show' => L10n::t('show'),
                        '$hide' => L10n::t('don\'t show'),
-                       '$allowcid' => json_encode(defaults($default_permissions, 'allow_cid', '')),
-                       '$allowgid' => json_encode(defaults($default_permissions, 'allow_gid', '')),
-                       '$denycid' => json_encode(defaults($default_permissions, 'deny_cid', '')),
-                       '$denygid' => json_encode(defaults($default_permissions, 'deny_gid', '')),
+                       '$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', [])),
+                       '$denycid' => json_encode(defaults($default_permissions, 'deny_cid', [])),
+                       '$denygid' => json_encode(defaults($default_permissions, 'deny_gid', [])),
                        '$networks' => $show_jotnets,
                        '$emailcc' => L10n::t('CC: email addresses'),
                        '$emtitle' => L10n::t('Example: bob@example.com, mary@example.com'),