Skip to content

Commit

Permalink
Fix warnings about unexpected parameter array values type in ACL::get…
Browse files Browse the repository at this point in the history
…FullSelectorHTML

- Addresses friendica#7676 (comment)
  • Loading branch information
MrPetovan committed Dec 3, 2019
1 parent b152d05 commit f989c33
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 13 deletions.
4 changes: 1 addition & 3 deletions mod/events.php
Expand Up @@ -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 = '';
}
Expand Down
2 changes: 1 addition & 1 deletion mod/photos.php
Expand Up @@ -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'],
Expand Down
19 changes: 10 additions & 9 deletions src/Core/ACL.php
Expand Up @@ -333,15 +333,16 @@ public static function getFullSelectorHTML(Page $page, array $user = null, bool
// 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'])
Expand All @@ -366,7 +367,7 @@ public static function getFullSelectorHTML(Page $page, array $user = null, bool
}
}

if (empty($default_permissions['hidewall'])) {
if ($default_permissions['hidewall']) {
if ($mail_enabled) {
$jotnets_fields[] = [
'type' => 'checkbox',
Expand Down Expand Up @@ -410,7 +411,7 @@ public static function getFullSelectorHTML(Page $page, array $user = null, bool
'$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;
Expand Down

0 comments on commit f989c33

Please sign in to comment.