summaryrefslogtreecommitdiff
path: root/plugins/managesieve/lib/Roundcube/rcube_sieve_vacation.php
diff options
context:
space:
mode:
authorAleksander Machniak <alec@alec.pl>2014-08-29 14:07:06 +0200
committerAleksander Machniak <alec@alec.pl>2014-08-29 14:07:06 +0200
commit5a64153f40ae833f8b57cdd3f40c24ccc0b679d1 (patch)
treedab35fd3e19897b2fc8f4691f74f45db4a0164b9 /plugins/managesieve/lib/Roundcube/rcube_sieve_vacation.php
parent29c24e647cb4c4a0928382a9ab2964980898562b (diff)
Fix vacation times handling
Diffstat (limited to 'plugins/managesieve/lib/Roundcube/rcube_sieve_vacation.php')
-rw-r--r--plugins/managesieve/lib/Roundcube/rcube_sieve_vacation.php42
1 files changed, 22 insertions, 20 deletions
diff --git a/plugins/managesieve/lib/Roundcube/rcube_sieve_vacation.php b/plugins/managesieve/lib/Roundcube/rcube_sieve_vacation.php
index af028e0ae..820265b86 100644
--- a/plugins/managesieve/lib/Roundcube/rcube_sieve_vacation.php
+++ b/plugins/managesieve/lib/Roundcube/rcube_sieve_vacation.php
@@ -156,20 +156,22 @@ class rcube_sieve_vacation extends rcube_sieve_engine
$date = trim($$var . ' ' . $time);
if ($date && ($dt = rcube_utils::anytodatetime($date, $timezone))) {
- $vacation_tests[] = array(
- 'test' => 'currentdate',
- 'part' => 'date',
- 'type' => 'value-' . ($var == 'date_from' ? 'ge' : 'le'),
- 'zone' => $dt->format('O'),
- 'arg' => $dt->format('Y-m-d'),
- );
if ($time) {
$vacation_tests[] = array(
'test' => 'currentdate',
- 'part' => 'time',
+ 'part' => 'iso8601',
'type' => 'value-' . ($var == 'date_from' ? 'ge' : 'le'),
'zone' => $dt->format('O'),
- 'arg' => $dt->format('H:i:s'),
+ 'arg' => str_replace('+00:00', 'Z', strtoupper($dt->format('c'))),
+ );
+ }
+ else {
+ $vacation_tests[] = array(
+ 'test' => 'currentdate',
+ 'part' => 'date',
+ 'type' => 'value-' . ($var == 'date_from' ? 'ge' : 'le'),
+ 'zone' => $dt->format('O'),
+ 'arg' => $dt->format('Y-m-d'),
);
}
}
@@ -333,24 +335,24 @@ class rcube_sieve_vacation extends rcube_sieve_engine
$date_value = array();
foreach ((array) $this->vacation['tests'] as $test) {
- if ($test['test'] == 'currentdate' && ($test['part'] == 'date' || $test['part'] == 'time')) {
+ if ($test['test'] == 'currentdate') {
$idx = $test['type'] == 'value-ge' ? 'from' : 'to';
- $date_value[$idx][$test['part']] = $test['arg'];
- if ($test['zone']) {
- $date_value[$idx]['zone'] = $test['zone'];
+
+ 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) {
- $date = $value['date'] . ' '
- . ($value['time'] ? $value['time'] : ($idx == 'from' ? '00:00:00' : '23:59:59'))
- . ($value['zone'] ? ' ' . $value['zone'] : '');
-
- $date_value[$idx] = $this->rc->format_date($date, $date_format, !empty($value['time']) && !empty($value['zone']));
+ $date = $value['datetime'] ?: $value['date'];
+ $date_value[$idx] = $this->rc->format_date($date, $date_format, false);
- if (!empty($value['time'])) {
- $date_value['time_' . $idx] = $this->rc->format_date($date, $time_format, !empty($value['zone']));
+ if (!empty($value['datetime'])) {
+ $date_value['time_' . $idx] = $this->rc->format_date($date, $time_format, true);
}
}
}