Browse Source

Fix PHP8 warnings

pull/9596/head
Aleksander Machniak 2 years ago
parent
commit
feb75c042b
  1. 34
      plugins/managesieve/lib/Roundcube/rcube_sieve_vacation.php
  2. 19
      program/lib/Roundcube/rcube_ldap.php

34
plugins/managesieve/lib/Roundcube/rcube_sieve_vacation.php

@ -701,21 +701,23 @@ class rcube_sieve_vacation extends rcube_sieve_engine
if ($date_extension) {
$date_value = [];
foreach ((array) $this->vacation['tests'] as $test) {
if ($test['test'] == 'currentdate') {
$idx = $test['type'] == 'value-ge' ? 'start' : 'end';
if (!empty($this->vacation['tests'])) {
foreach ((array) $this->vacation['tests'] as $test) {
if ($test['test'] == 'currentdate') {
$idx = $test['type'] == 'value-ge' ? 'start' : 'end';
if ($test['part'] == 'date') {
$date_value[$idx]['date'] = $test['arg'];
}
else if ($test['part'] == 'iso8601') {
$date_value[$idx]['datetime'] = $test['arg'];
if ($test['part'] == 'date') {
$date_value[$idx]['date'] = $test['arg'];
}
else if ($test['part'] == 'iso8601') {
$date_value[$idx]['datetime'] = $test['arg'];
}
}
}
}
foreach ($date_value as $idx => $value) {
$$idx = new DateTime($value['datetime'] ?: $value['date'], $timezone);
${$idx} = new DateTime(!empty($value['datetime']) ? $value['datetime'] : $value['date'], $timezone);
}
}
else if ($regex_extension) {
@ -738,13 +740,13 @@ class rcube_sieve_vacation extends rcube_sieve_engine
'interval' => $interval,
'start' => $start,
'end' => $end,
'enabled' => $this->vacation['reason'] && empty($this->vacation['disabled']),
'message' => $this->vacation['reason'],
'subject' => $this->vacation['subject'],
'action' => $this->vacation['action'],
'target' => $this->vacation['target'],
'addresses' => $this->vacation['addresses'],
'from' => $this->vacation['from'],
'enabled' => !empty($this->vacation['reason']) && empty($this->vacation['disabled']),
'message' => isset($this->vacation['reason']) ? $this->vacation['reason'] : null,
'subject' => isset($this->vacation['subject']) ? $this->vacation['subject'] : null,
'action' => isset($this->vacation['action']) ? $this->vacation['action'] : null,
'target' => isset($this->vacation['target']) ? $this->vacation['target'] : null,
'addresses' => isset($this->vacation['addresses']) ? $this->vacation['addresses'] : null,
'from' => isset($this->vacation['from']) ? $this->vacation['from'] : null,
];
return $vacation;

19
program/lib/Roundcube/rcube_ldap.php

@ -845,11 +845,13 @@ class rcube_ldap extends rcube_addressbook
foreach ($ldap_data as $entry) {
$rec = $this->_ldap2result($entry);
foreach ($fields as $f) {
foreach ((array)$rec[$f] as $val) {
if ($this->compare_search_value($f, $val, $search, $mode)) {
$this->result->add($rec);
$this->result->count++;
break 2;
if (!empty($rec[$f])) {
foreach ((array)$rec[$f] as $val) {
if ($this->compare_search_value($f, $val, $search, $mode)) {
$this->result->add($rec);
$this->result->count++;
break 2;
}
}
}
}
@ -1770,6 +1772,10 @@ class rcube_ldap extends rcube_addressbook
*/
private function is_group_entry($entry)
{
if (empty($entry['objectclass'])) {
return false;
}
$classes = array_map('strtolower', (array)$entry['objectclass']);
return count(array_intersect(array_keys($this->group_types), $classes)) > 0;
@ -1990,11 +1996,12 @@ class rcube_ldap extends rcube_addressbook
if ($list = $this->ldap->read_entries($dn, '(objectClass=*)', $attrs)) {
$entry = $list[0];
$group_name = is_array($entry[$name_attr]) ? $entry[$name_attr][0] : $entry[$name_attr];
$classes = !empty($entry['objectclass']) ? $entry['objectclass'] : [];
$group_cache[$group_id]['ID'] = $group_id;
$group_cache[$group_id]['dn'] = $dn;
$group_cache[$group_id]['name'] = $group_name;
$group_cache[$group_id]['member_attr'] = $this->get_group_member_attr($entry['objectclass']);
$group_cache[$group_id]['member_attr'] = $this->get_group_member_attr($classes);
}
else {
$group_cache[$group_id] = false;

Loading…
Cancel
Save