summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: ccedab5)
raw | patch | inline | side by side (parent: ccedab5)
author | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Mon, 19 Mar 2007 10:00:33 +0000 (10:00 +0000) | ||
committer | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Mon, 19 Mar 2007 10:00:33 +0000 (10:00 +0000) |
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@5814 594d385d-05f5-0310-b6e9-bd551577e9d8
index 8792f98f7a855b60f86f76dadf77a43b21b99ea3..a5bf7af3a851823027f7ae4d82ace5abe89b4cac 100644 (file)
}
return($msgs);
}
+
+
+ /* We are forced to add a new require.
+ * This function is called by the
+ * sieveElement_Classes->parent->add_require()
+ */
+ function add_require($str)
+ {
+ $require_id = -1;
+ foreach($this->pap as $key => $obj){
+ if(get_class($obj) == "sieve_require"){
+ $require_id = $key;
+ }
+ }
+
+ /* No require found, add one */
+ if($require_id == -1){
+ $require = new sieve_require(NULL,preg_replace("/[^0-9]/","",microtime()));
+ $require -> Add_Require($str);
+ $new = array();
+ $new[] = $require;
+ foreach($this->pap as $obj){
+ $new[] = $obj;
+ }
+ $this->pap = $new;
+ } else {
+ $this->pap[$require_id]->Add_Require($str);
+ }
+ }
}
diff --git a/include/sieve/class_sieveElement_Fileinto.inc b/include/sieve/class_sieveElement_Fileinto.inc
index 1c1707ef45d4b64bf7f36734bb2e305f00216d15..71024ba0663e0cfa6509dab2cde310a9eea1927a 100644 (file)
{
$this->object_id = $object_id;
$this->parent = $parent;
+ $this->parent->add_require("fileinto");
$mbs = $this->get_mail_boxes();
index edaec6c047291c05f2a6f7e252ac4a128a7b771b..ef726c91a5c381245f21f2b20ea9cae84142e374 100644 (file)
var $comparators = array();
var $match_types = array();
var $operators = array();
-
+ var $parent = NULL;
/* Initialize class
* $elements contains all tokens that belongs to this if/else tag
* $object_id cotains an unique tag id, to be able to create uniqe html post names
*/
- function sieve_if($elements,$object_id)
+ function sieve_if($elements,$object_id,$parent)
{
+ $this->parent = $parent;
+
/* Possible address parts we can select */
$this->address_parts = array(
":all" => _("Complete adress")." ("._("Default").")",
$values["Address_Part"] = ":all";
}
$data[$type]=$values;
+
+ if($type == "envelope"){
+ $this->parent->add_require("envelope");
+ }
+
+
break;
}
case "allof" :
$parsed[$key]['LastError'] = _("Invalid operator given.");
}
$parsed[$key]['Comparator'] = $cp;
+
+ if($cp == "i;ascii-numeric"){
+ $this->parent->add_require("comparator-i;ascii-numeric");
+ }
}
/* In case of :count and :value match types
diff --git a/include/sieve/class_sieveElement_Reject.inc b/include/sieve/class_sieveElement_Reject.inc
index 6c0a6f5b6472e79db98467dc77837dfb36886bb7..8bf9bb61bd4d281ee643e4e59fef546e9e41ff66 100644 (file)
{
var $data = "";
var $object_id = -1;
-
+ var $parent = NULL;
function save_object()
{
return(array());
}
- function sieve_reject($data,$object_id)
+ function sieve_reject($data,$object_id,$parent)
{
$this->object_id = $object_id;
+ $this->parent = $parent;
+ $this->parent->add_require("reject");
/* If the given data is emtpy
* (This is the case when we add new elements in the ui)
diff --git a/include/sieve/class_sieveElement_Require.inc b/include/sieve/class_sieveElement_Require.inc
index 3b91b8205f8d0b065fb55953dd3be32e1f4c85af..c7138deb569e76f8eb22d79fecf2cda365c61d67 100644 (file)
}
}
+ /* Add a new require statement and ensure
+ * that it is not specified twice
+ */
+ function Add_Require($str)
+ {
+ $current = array();
+
+ foreach($this->data as $dat){
+ $current[] = preg_replace("/\"/","",$dat);
+ }
+ if(!in_array($str,$current)){
+ $this->data[] = $str;
+ }
+ $this->data = array_unique($this->data);;
+ }
+
function save_object()
{
/* Get the values should check for, they are seperated by , */
if(empty($val)) continue;
- $tmp[] = "\"".$val."\"";
+ $tmp[] = $val;
}
$this->data = $tmp;
}
{
$Require = "";
foreach($this->data as $key){
- $Require .= $key.", ";
+ $Require .= "\"".$key."\"".", ";
}
$Require = preg_replace("/,$/","",trim($Require));