Fix warnings about unexpected parameter array values type in ACL::getFullSelectorHTML

- Addresses https://github.com/friendica/friendica/issues/7676#issuecomment-560503744
This commit is contained in:
Hypolite Petovan 2019-12-03 06:59:51 -05:00
parent b152d0557b
commit f989c331a3
3 changed files with 12 additions and 13 deletions

View file

@ -490,10 +490,8 @@ function events_content(App $a)
$fhour = !empty($orig_event) ? DateTimeFormat::convert($fdt, $tz, 'UTC', 'H') : '00'; $fhour = !empty($orig_event) ? DateTimeFormat::convert($fdt, $tz, 'UTC', 'H') : '00';
$fminute = !empty($orig_event) ? DateTimeFormat::convert($fdt, $tz, 'UTC', 'i') : '00'; $fminute = !empty($orig_event) ? DateTimeFormat::convert($fdt, $tz, 'UTC', 'i') : '00';
$perms = ACL::getDefaultUserPermissions($orig_event);
if (!$cid && in_array($mode, ['new', 'copy'])) { 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 { } else {
$acl = ''; $acl = '';
} }

View file

@ -1332,7 +1332,7 @@ function photos_content(App $a)
$album_e = $ph[0]['album']; $album_e = $ph[0]['album'];
$caption_e = $ph[0]['desc']; $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, [ $edit = Renderer::replaceMacros($edit_tpl, [
'$id' => $ph[0]['id'], '$id' => $ph[0]['id'],

View file

@ -333,14 +333,15 @@ class ACL extends BaseObject
// Defaults user permissions // Defaults user permissions
if (empty($default_permissions)) { if (empty($default_permissions)) {
$default_permissions = self::getDefaultUserPermissions($user); $default_permissions = self::getDefaultUserPermissions($user);
} else { }
$default_permissions = [ $default_permissions = [
'allow_cid' => $default_permissions['allow_cid'] ?? [], 'allow_cid' => $default_permissions['allow_cid'] ?? [],
'allow_gid' => $default_permissions['allow_gid'] ?? [], 'allow_gid' => $default_permissions['allow_gid'] ?? [],
'deny_cid' => $default_permissions['deny_cid'] ?? [], 'deny_cid' => $default_permissions['deny_cid'] ?? [],
'deny_gid' => $default_permissions['deny_gid'] ?? [], 'deny_gid' => $default_permissions['deny_gid'] ?? [],
'hidewall' => $default_permissions['hidewall'] ?? false,
]; ];
}
if (count($default_permissions['allow_cid']) if (count($default_permissions['allow_cid'])
+ count($default_permissions['allow_gid']) + count($default_permissions['allow_gid'])
@ -366,7 +367,7 @@ class ACL extends BaseObject
} }
} }
if (empty($default_permissions['hidewall'])) { if ($default_permissions['hidewall']) {
if ($mail_enabled) { if ($mail_enabled) {
$jotnets_fields[] = [ $jotnets_fields[] = [
'type' => 'checkbox', 'type' => 'checkbox',
@ -410,7 +411,7 @@ class ACL extends BaseObject
'$group_deny' => implode(',', $default_permissions['deny_gid']), '$group_deny' => implode(',', $default_permissions['deny_gid']),
'$for_federation' => $for_federation, '$for_federation' => $for_federation,
'$jotnets_fields' => $jotnets_fields, '$jotnets_fields' => $jotnets_fields,
'$user_hidewall' => $default_permissions['hidewall'] ?? false, '$user_hidewall' => $default_permissions['hidewall'],
]); ]);
return $o; return $o;