summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGunnar Wrobel <wrobel@pardus.de>2010-04-06 17:47:34 (GMT)
committerGunnar Wrobel <wrobel@pardus.de>2010-04-06 17:47:34 (GMT)
commit27499aef5d45f270207b04175bb6ecbfe359fc8c (patch)
tree851037b8f1d3018b50e25184f6070a153a8a1a2e
parent47298ec7c74eb41336256f6e3efd31d856bffd2b (diff)
downloadkolab-webadmin-27499aef5d45f270207b04175bb6ecbfe359fc8c.tar.gz
Fix some minor sieve script issues.
-rw-r--r--lib/KolabAdmin/Sieve/Segment.php8
-rw-r--r--lib/KolabAdmin/Sieve/Segment/Forward.php8
-rw-r--r--lib/KolabAdmin/Sieve/Segment/Vacation.php10
3 files changed, 17 insertions, 9 deletions
diff --git a/lib/KolabAdmin/Sieve/Segment.php b/lib/KolabAdmin/Sieve/Segment.php
index 6c3af6b..ef4d0bb 100644
--- a/lib/KolabAdmin/Sieve/Segment.php
+++ b/lib/KolabAdmin/Sieve/Segment.php
@@ -72,13 +72,15 @@ abstract class KolabAdmin_Sieve_Segment
}
/**
- * Set the segment active.
+ * Set the segment (in)active.
+ *
+ * @param boolean $active Should the segment be active or inactive?
*
* @return NULL
*/
- public function setActive()
+ public function setActive($active = true)
{
- $this->_active = true;
+ $this->_active = $active;
}
/**
diff --git a/lib/KolabAdmin/Sieve/Segment/Forward.php b/lib/KolabAdmin/Sieve/Segment/Forward.php
index 8dcb7f4..eee8fc5 100644
--- a/lib/KolabAdmin/Sieve/Segment/Forward.php
+++ b/lib/KolabAdmin/Sieve/Segment/Forward.php
@@ -57,8 +57,10 @@ extends KolabAdmin_Sieve_Segment
*/
public function __construct($script = '')
{
- $this->template = 'if allof (%s)' . "\r\n" .
- 'redirect "%s";%s' . "\r\n";
+ $this->template = 'if allof (%s' . "\r\n" .
+ ') {' . "\r\n" .
+ 'redirect "%s";%s' . "\r\n" .
+ '}' . "\r\n";
parent::__construct($script);
}
@@ -113,7 +115,7 @@ extends KolabAdmin_Sieve_Segment
throw new Exception('Please enter a valid e-mail address!');
}
return array(
- ($this->isActive()) ? 'true, ## forward enabled' : 'false, ## forward disabled',
+ ($this->isActive()) ? 'true ## forward enabled' : 'false ## forward disabled',
$address,
($this->getKeepOnServer()) ? ' keep;' : ''
);
diff --git a/lib/KolabAdmin/Sieve/Segment/Vacation.php b/lib/KolabAdmin/Sieve/Segment/Vacation.php
index 79dad84..96cf66a 100644
--- a/lib/KolabAdmin/Sieve/Segment/Vacation.php
+++ b/lib/KolabAdmin/Sieve/Segment/Vacation.php
@@ -83,7 +83,7 @@ extends KolabAdmin_Sieve_Segment
$this->_response = '';
$this->template = 'if allof (%s' . "\r\n" .
- '%s' . "\r\n" .
+ '%s,' . "\r\n" .
'%s) {' . "\r\n" .
'vacation :addresses [ %s ] :days %s text:' . "\r\n" .
'%s' . "\r\n" .
@@ -151,6 +151,10 @@ extends KolabAdmin_Sieve_Segment
*/
public function setResendAfter($days)
{
+ //@todo: Should be placed into a validate method.
+ if ($this->_resend_after < 1) {
+ throw new Exception(_('Days must be at least one'));
+ }
$this->_resend_after = $days;
}
@@ -230,12 +234,12 @@ extends KolabAdmin_Sieve_Segment
if (!empty($domain)) {
$domain = 'address :domain :contains "From" "' . $domain . '"';
} else {
- $domain = '';
+ $domain = 'true';
}
if (!$this->getReactToSpam()) {
$react_to_spam = 'not header :contains "X-Spam-Flag" "YES"';
} else {
- $react_to_spam = '';
+ $react_to_spam = 'true';
}
return array(
($this->isActive()) ? 'true, ## vacation enabled' : 'false, ## vacation disabled',