- Added support for headers lists (coma-separated) in rules

release-0.6
alecpl 16 years ago
parent 0b1875c82a
commit 7328469f8f

@ -1,59 +1,65 @@
* version 1.0 [2009-05-21] * version 1.1 [2009-05-27]
----------------------------------------------------------- -----------------------------------------------------------
Rewritten using plugin API - Added new icons
Added hu_HU localization (Tamas Tevesz) - Added support for headers lists (coma-separated) in rules
- Added de_CH localization
* version beta7 (svn-r2300) [2009-03-01] * version 1.0 [2009-05-21]
----------------------------------------------------------- -----------------------------------------------------------
Added SquirrelMail script auto-import (Jonathan Ernst) - Rewritten using plugin API
Added 'vacation' support (Jonathan Ernst & alec) - Added hu_HU localization (Tamas Tevesz)
Added 'stop' support (Jonathan Ernst)
Added option for extensions disabling (Jonathan Ernst & alec) * version beta7 (svn-r2300) [2009-03-01]
Added fi_FI, nl_NL, bg_BG localization -----------------------------------------------------------
Small style fixes - Added SquirrelMail script auto-import (Jonathan Ernst)
- Added 'vacation' support (Jonathan Ernst & alec)
- Added 'stop' support (Jonathan Ernst)
- Added option for extensions disabling (Jonathan Ernst & alec)
- Added fi_FI, nl_NL, bg_BG localization
- Small style fixes
* version 0.2-stable1 (svn-r2205) [2009-01-03] * version 0.2-stable1 (svn-r2205) [2009-01-03]
----------------------------------------------------------- -----------------------------------------------------------
Fix moving down filter row - Fix moving down filter row
Fixes for compressed js files in stable release package - Fixes for compressed js files in stable release package
Created patch for svn version r2205 - Created patch for svn version r2205
* version 0.2-stable [2008-12-31] * version 0.2-stable [2008-12-31]
----------------------------------------------------------- -----------------------------------------------------------
Added ru_RU, fr_FR, zh_CN translation - Added ru_RU, fr_FR, zh_CN translation
Fixes for Roundcube 0.2-stable - Fixes for Roundcube 0.2-stable
* version rc0.2beta [2008-09-21] * version rc0.2beta [2008-09-21]
----------------------------------------------------------- -----------------------------------------------------------
Small css fixes for IE - Small css fixes for IE
Fixes for Roundcube 0.2-beta - Fixes for Roundcube 0.2-beta
* version beta6 [2008-08-08] * version beta6 [2008-08-08]
----------------------------------------------------------- -----------------------------------------------------------
Added de_DE translation - Added de_DE translation
Fix for Roundcube r1634 - Fix for Roundcube r1634
* version beta5 [2008-06-10] * version beta5 [2008-06-10]
----------------------------------------------------------- -----------------------------------------------------------
Fixed 'exists' operators - Fixed 'exists' operators
Fixed 'not*' operators for custom headers - Fixed 'not*' operators for custom headers
Fixed filters deleting - Fixed filters deleting
* version beta4 [2008-06-09] * version beta4 [2008-06-09]
----------------------------------------------------------- -----------------------------------------------------------
Fix for Roundcube r1490 - Fix for Roundcube r1490
* version beta3 [2008-05-22] * version beta3 [2008-05-22]
----------------------------------------------------------- -----------------------------------------------------------
Fixed textarea error class setting - Fixed textarea error class setting
Added pagetitle setting - Added pagetitle setting
Added option 'managesieve_replace_delimiter' - Added option 'managesieve_replace_delimiter'
Fixed errors on IE (still need some css fixes) - Fixed errors on IE (still need some css fixes)
* version beta2 [2008-05-20] * version beta2 [2008-05-20]
----------------------------------------------------------- -----------------------------------------------------------
Use 'if' only for first filter and 'elsif' for the rest - Use 'if' only for first filter and 'elsif' for the rest
* version beta1 [2008-05-15] * version beta1 [2008-05-15]
----------------------------------------------------------- -----------------------------------------------------------
Initial version for Roundcube r1388. - Initial version for Roundcube r1388.

@ -7,7 +7,7 @@
* It's clickable interface which operates on text scripts and communicates * It's clickable interface which operates on text scripts and communicates
* with server using managesieve protocol. Adds Filters tab in Settings. * with server using managesieve protocol. Adds Filters tab in Settings.
* *
* @version 1.0 * @version 1.1
* @author Aleksander 'A.L.E.C' Machniak <alec@alec.pl> * @author Aleksander 'A.L.E.C' Machniak <alec@alec.pl>
* *
* Configuration (main.inc.php): * Configuration (main.inc.php):
@ -308,7 +308,7 @@ class managesieve extends rcube_plugin
$this->errors['tests'][$i]['sizetarget'] = $this->gettext('wrongformat'); $this->errors['tests'][$i]['sizetarget'] = $this->gettext('wrongformat');
break; break;
case '...': case '...':
$cust_header = $this->strip_value($cust_headers[$idx]); $cust_header = $headers = $this->strip_value($cust_headers[$idx]);
if(preg_match('/^not/', $op)) if(preg_match('/^not/', $op))
$this->form['tests'][$i]['not'] = true; $this->form['tests'][$i]['not'] = true;
@ -316,10 +316,22 @@ class managesieve extends rcube_plugin
if ($cust_header == '') if ($cust_header == '')
$this->errors['tests'][$i]['header'] = $this->gettext('cannotbeempty'); $this->errors['tests'][$i]['header'] = $this->gettext('cannotbeempty');
elseif (!preg_match('/^[a-z0-9-]+$/i', $cust_header)) else {
$this->errors['tests'][$i]['header'] = $this->gettext('forbiddenchars'); $headers = preg_split('/[\s,]+/', $cust_header, -1, PREG_SPLIT_NO_EMPTY);
if (!count($headers))
$this->errors['tests'][$i]['header'] = $this->gettext('cannotbeempty');
else {
foreach ($headers as $hr)
if (!preg_match('/^[a-z0-9-]+$/i', $hr))
$this->errors['tests'][$i]['header'] = $this->gettext('forbiddenchars');
}
}
if (empty($this->errors['tests'][$i]['header']))
$cust_header = $headers;
if ($type == 'exists') if ($type == 'exists')
{ {
$this->form['tests'][$i]['test'] = 'exists'; $this->form['tests'][$i]['test'] = 'exists';
$this->form['tests'][$i]['arg'] = $cust_header; $this->form['tests'][$i]['arg'] = $cust_header;
@ -599,9 +611,11 @@ class managesieve extends rcube_plugin
// TODO: list arguments // TODO: list arguments
if ((isset($rule['test']) && $rule['test'] == 'header') && in_array($rule['arg1'], $this->headers)) if ((isset($rule['test']) && $rule['test'] == 'header')
&& !is_array($rule['arg1']) && in_array($rule['arg1'], $this->headers))
$out .= $select_header->show($rule['arg1']); $out .= $select_header->show($rule['arg1']);
elseif ((isset($rule['test']) && $rule['test'] == 'exists') && in_array($rule['arg'], $this->headers)) elseif ((isset($rule['test']) && $rule['test'] == 'exists')
&& !is_array($rule['arg']) && in_array($rule['arg'], $this->headers))
$out .= $select_header->show($rule['arg']); $out .= $select_header->show($rule['arg']);
elseif (isset($rule['test']) && $rule['test'] == 'size') elseif (isset($rule['test']) && $rule['test'] == 'size')
$out .= $select_header->show('size'); $out .= $select_header->show('size');
@ -612,10 +626,12 @@ class managesieve extends rcube_plugin
$out .= '</td><td class="rowtargets">'; $out .= '</td><td class="rowtargets">';
if ((isset($rule['test']) && $rule['test'] == 'header') && !in_array($rule['arg1'], $this->headers)) if ((isset($rule['test']) && $rule['test'] == 'header')
$custom = $rule['arg1']; && (is_array($rule['arg1']) || !in_array($rule['arg1'], $this->headers)))
elseif ((isset($rule['test']) && $rule['test'] == 'exists') && !in_array($rule['arg'], $this->headers)) $custom = is_array($rule['arg1']) ? implode(', ', $rule['arg1']) : $rule['arg1'];
$custom = $rule['arg']; elseif ((isset($rule['test']) && $rule['test'] == 'exists')
&& (is_array($rule['arg']) || !in_array($rule['arg'], $this->headers)))
$custom = is_array($rule['arg']) ? implode(', ', $rule['arg']) : $rule['arg'];
$out .= '<div id="custom_header' .$id. '" style="display:' .(isset($custom) ? 'inline' : 'none'). '"> $out .= '<div id="custom_header' .$id. '" style="display:' .(isset($custom) ? 'inline' : 'none'). '">
<input type="text" name="_custom_header[]" '. $this->error_class($id, 'test', 'header') <input type="text" name="_custom_header[]" '. $this->error_class($id, 'test', 'header')

Loading…
Cancel
Save