]> git.mxchange.org Git - friendica.git/commitdiff
Fix warnings about unexpected parameter array values type in ACL::getFullSelectorHTML
authorHypolite Petovan <hypolite@mrpetovan.com>
Tue, 3 Dec 2019 11:59:51 +0000 (06:59 -0500)
committerHypolite Petovan <hypolite@mrpetovan.com>
Tue, 3 Dec 2019 11:59:51 +0000 (06:59 -0500)
- Addresses https://github.com/friendica/friendica/issues/7676#issuecomment-560503744

mod/events.php
mod/photos.php
src/Core/ACL.php

index a642f166510cff22a2da9ef9c97a6063107e720a..5a5a22d3186bd194a079dc407966a30c7e7ef472 100644 (file)
@@ -490,10 +490,8 @@ function events_content(App $a)
                $fhour   = !empty($orig_event) ? DateTimeFormat::convert($fdt, $tz, 'UTC', 'H') : '00';
                $fminute = !empty($orig_event) ? DateTimeFormat::convert($fdt, $tz, 'UTC', 'i') : '00';
 
-               $perms = ACL::getDefaultUserPermissions($orig_event);
-
                if (!$cid && in_array($mode, ['new', 'copy'])) {
-                       $acl = ACL::getFullSelectorHTML($a->page, $a->user, false, $perms);
+                       $acl = ACL::getFullSelectorHTML($a->page, $a->user, false, ACL::getDefaultUserPermissions($orig_event));
                } else {
                        $acl = '';
                }
index 684e525d4376b3d04521eac10ba32612a3eaa4b2..2f3e7d3117cde88b03989d9ac16dde3411ae5429 100644 (file)
@@ -1332,7 +1332,7 @@ function photos_content(App $a)
 
                        $album_e = $ph[0]['album'];
                        $caption_e = $ph[0]['desc'];
-                       $aclselect_e = ACL::getFullSelectorHTML($a->page, $a->user, false, $ph[0]);
+                       $aclselect_e = ACL::getFullSelectorHTML($a->page, $a->user, false, ACL::getDefaultUserPermissions($ph[0]));
 
                        $edit = Renderer::replaceMacros($edit_tpl, [
                                '$id' => $ph[0]['id'],
index 53e6c19691592243ce381b16766757ebf4273c05..e6dd1a8f32400879a3c03000914334d281c34de5 100644 (file)
@@ -333,15 +333,16 @@ class ACL extends BaseObject
                // Defaults user permissions
                if (empty($default_permissions)) {
                        $default_permissions = self::getDefaultUserPermissions($user);
-               } else {
-                       $default_permissions = [
-                               'allow_cid' => $default_permissions['allow_cid'] ?? [],
-                               'allow_gid' => $default_permissions['allow_gid'] ?? [],
-                               'deny_cid'  => $default_permissions['deny_cid']  ?? [],
-                               'deny_gid'  => $default_permissions['deny_gid']  ?? [],
-                       ];
                }
 
+               $default_permissions = [
+                       'allow_cid' => $default_permissions['allow_cid'] ?? [],
+                       'allow_gid' => $default_permissions['allow_gid'] ?? [],
+                       'deny_cid'  => $default_permissions['deny_cid']  ?? [],
+                       'deny_gid'  => $default_permissions['deny_gid']  ?? [],
+                       'hidewall'  => $default_permissions['hidewall']  ?? false,
+               ];
+
                if (count($default_permissions['allow_cid'])
                        + count($default_permissions['allow_gid'])
                        + count($default_permissions['deny_cid'])
@@ -366,7 +367,7 @@ class ACL extends BaseObject
                                }
                        }
 
-                       if (empty($default_permissions['hidewall'])) {
+                       if ($default_permissions['hidewall']) {
                                if ($mail_enabled) {
                                        $jotnets_fields[] = [
                                                'type' => 'checkbox',
@@ -410,7 +411,7 @@ class ACL extends BaseObject
                        '$group_deny'     => implode(',', $default_permissions['deny_gid']),
                        '$for_federation' => $for_federation,
                        '$jotnets_fields' => $jotnets_fields,
-                       '$user_hidewall'  => $default_permissions['hidewall'] ?? false,
+                       '$user_hidewall'  => $default_permissions['hidewall'],
                ]);
 
                return $o;