Updated changelog and CS fixes after PR merge

pull/204/merge
Aleksander Machniak 11 years ago
parent 9d2550502a
commit 319751fff6

@ -1,9 +1,12 @@
* version 8.0 [2014-07-16]
-----------------------------------------------------------
- Fix bug where non-existing (or unsubscribed) folder wasn't listed in folder selector (#1489956)
- Added optional separate interface for out-of-office management (#1488266)
- Fix disabled "create filter" action
- Fix enotify/notify extension handling
- Improved UI accessibility
- Added option to specify connection socket parameters - managesieve_conn_options
- Support vacation date rules without date extension (#1489978)
* version 7.2 [2014-02-14]
-----------------------------------------------------------

@ -149,6 +149,7 @@ class rcube_sieve_vacation extends rcube_sieve_engine
continue 2;
}
}
$vacation_tests[] = $test;
}
}
@ -158,49 +159,50 @@ class rcube_sieve_vacation extends rcube_sieve_engine
// clear any existing date rules in tests array
foreach ((array) $vacation_tests as $idx => $t) {
if ($t['test'] == 'header' &&
$t['type'] == 'regex' &&
$t['arg1'] == 'received') {
if ($t['test'] == 'header' && $t['type'] == 'regex' && $t['arg1'] == 'received') {
unset($vacation_tests[$idx]);
}
if ($t['test'] == 'true') {
unset($vacation_tests[$idx]);
}
}
$vacation_tests = array();
if ($date_from && $date_to) {
// Add date range rules if range specified
if ($date_from && $date_to) {
$dt_from = rcube_utils::anytodatetime($date_from);
$dt_to = rcube_utils::anytodatetime($date_to);
$interval = $dt_from->diff($dt_to);
if ($interval->invert || $interval->days > 365) {
$error = 'managesieve.invaliddateformat';
}
$dt_i = $dt_from;
$interval = new DateInterval('P1D');
$matchexp = '';
$matchexp = "";
while (!$dt_i->diff($dt_to)->invert) {
$matchexp .= $dt_i->format('d') < 10 ?
"[ 0]".((int)$dt_i->format('d')) :
$dt_i->format('d');
if ($dt_i->format('d') == $dt_i->format('t') ||
$dt_i->diff($dt_to)->days == 0) {
$days = (int) $dt_i->format('d');
$matchexp .= $days < 10 ? "[ 0]$days" : $days;
if ($days == $dt_i->format('t') || $dt_i->diff($dt_to)->days == 0) {
$test = array(
'test' => 'header',
'type' => 'regex',
'arg1' => 'received',
'arg2' => '('.$matchexp.') '.$dt_i->format('M Y')
);
$vacation_tests[] = $test;
$matchexp = "";
$matchexp = '';
}
else {
$matchexp .= '|';
}
$dt_i->add($interval);
}
}
@ -228,7 +230,7 @@ class rcube_sieve_vacation extends rcube_sieve_engine
$rule['name'] = $rule['name'] ?: $this->plugin->gettext('vacation');
$rule['disabled'] = $status == 'off';
$rule['tests'] = $vacation_tests;
$rule['join'] = $date_extension ? count($vacation_tests) > 1 : 0;
$rule['join'] = $date_extension ? count($vacation_tests) > 1 : false;
$rule['actions'] = array($vacation_action);
if ($action && $action != 'keep') {
@ -357,27 +359,23 @@ class rcube_sieve_vacation extends rcube_sieve_engine
}
}
else if ($regex_extension) {
$rx1 = '/^\(([0-9][0-9]).*\)\s([A-Za-z]*)\s([0-9][0-9][0-9][0-9])/';
$rx2 = '/^\(.*([0-9][0-9])\)\s([A-Za-z]*)\s([0-9][0-9][0-9][0-9])/';
// Sieve 'date' extension not available, read start/end from RegEx based rules instead
foreach ((array) $this->vacation['tests'] as $test) {
if ($test['test'] == 'header' &&
$test['type'] == 'regex' &&
$test['arg1'] == 'received') {
if ($test['test'] == 'header' && $test['type'] == 'regex' && $test['arg1'] == 'received') {
$textexp = preg_replace('/\[ ([^\]]*)\]/', '0', $test['arg2']);
if (!$date_value['from']) {
if (preg_match('/^\(([0-9][0-9]).*\)\s([A-Za-z]*)\s([0-9][0-9][0-9][0-9])/',
$textexp, $matches)) {
if (!$date_value['from'] && preg_match($rx1, $textexp, $matches)) {
$date_value['from'] = $matches[1]." ".$matches[2]." ".$matches[3];
}
}
if (preg_match('/^\(.*([0-9][0-9])\)\s([A-Za-z]*)\s([0-9][0-9][0-9][0-9])/',
$textexp, $matches)) {
if (preg_match($rx2, $textexp, $matches)) {
$date_value['to'] = $matches[1]." ".$matches[2]." ".$matches[3];
}
}
}
$date_value['from'] = $this->rc->format_date($date_value['from'], $date_format, false);
$date_value['to'] = $this->rc->format_date($date_value['to'], $date_format, false);
}

Loading…
Cancel
Save