Fix PHP8 warnings

This commit is contained in:
Aleksander Machniak 2023-08-07 15:00:13 +02:00
parent 99717b0877
commit a1de0c679b
4 changed files with 12 additions and 8 deletions

View file

@ -109,7 +109,7 @@ class kolab_delegation_engine
$folders = $update ? $this->list_folders($uid) : array(); $folders = $update ? $this->list_folders($uid) : array();
foreach ($acl as $folder_name => $rights) { foreach ($acl as $folder_name => $rights) {
$r = $right_types[$rights]; $r = $right_types[$rights] ?? null;
if ($r) { if ($r) {
$storage->set_acl($folder_name, $uid, $r); $storage->set_acl($folder_name, $uid, $r);
} }
@ -123,7 +123,7 @@ class kolab_delegation_engine
} }
foreach ($folders as $folder_name => $folder) { foreach ($folders as $folder_name => $folder) {
if ($folder['rights']) { if (!empty($folder['rights'])) {
$storage->delete_acl($folder_name, $uid); $storage->delete_acl($folder_name, $uid);
} }
} }

View file

@ -234,7 +234,7 @@ class kolab_folders extends rcube_plugin
$subtype = ''; $subtype = '';
if (strlen($mbox)) { if (strlen($mbox)) {
list($ctype, $subtype) = $this->get_folder_type($mbox); list($ctype, $subtype) = $this->get_folder_type($mbox);
if (strlen($args['parent_name']) && $subtype == 'default') { if (isset($args['parent_name']) && strlen($args['parent_name']) && $subtype == 'default') {
$subtype = ''; // there can be only one $subtype = ''; // there can be only one
} }
} }

View file

@ -545,7 +545,7 @@ class kolab_storage
} }
} }
if (!empty($options) && ($options['protected'] || $options['norename'])) { if (!empty($options) && (!empty($options['protected']) || !empty($options['norename']))) {
$folder = $oldfolder; $folder = $oldfolder;
} }
else if (strlen($parent)) { else if (strlen($parent)) {
@ -1101,13 +1101,13 @@ class kolab_storage
if (!empty($parents)) { if (!empty($parents)) {
$parents = array_reverse($parents); $parents = array_reverse($parents);
foreach ($parents as $parent) { foreach ($parents as $parent) {
$parent_node = $refs[$parent->parent] ?: $tree; $parent_node = !empty($refs[$parent->parent]) ? $refs[$parent->parent] : $tree;
$parent_node->children[] = $parent; $parent_node->children[] = $parent;
$_folders[] = $parent; $_folders[] = $parent;
} }
} }
$parent_node = $refs[$folder->parent] ?: $tree; $parent_node = !empty($refs[$folder->parent]) ? $refs[$folder->parent] : $tree;
$parent_node->children[] = $folder; $parent_node->children[] = $folder;
} }

View file

@ -48,7 +48,7 @@ class kolab_utils
// create form output // create form output
foreach ($form as $tab) { foreach ($form as $tab) {
if (is_array($tab['fields']) && empty($tab['content'])) { if (isset($tab['fields']) && is_array($tab['fields']) && empty($tab['content'])) {
$table = new html_table(array('cols' => 2, 'class' => 'propform')); $table = new html_table(array('cols' => 2, 'class' => 'propform'));
foreach ($tab['fields'] as $col => $colprop) { foreach ($tab['fields'] as $col => $colprop) {
$label = !empty($colprop['label']) ? $colprop['label'] : $rcmail->gettext("$domain.$col"); $label = !empty($colprop['label']) ? $colprop['label'] : $rcmail->gettext("$domain.$col");
@ -88,6 +88,10 @@ class kolab_utils
'name' => $folder 'name' => $folder
)); ));
return $acl['form']['sharing']['content'] ?: html::div('hint', $rcmail->gettext('libkolab.aclnorights')); if (!empty($acl['form']['sharing']['content'])) {
return $acl['form']['sharing']['content'];
}
return html::div('hint', $rcmail->gettext('libkolab.aclnorights'));
} }
} }