Code

Updated some sieve classes, to handle quotes correctly
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Thu, 29 Mar 2007 08:10:27 +0000 (08:10 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Thu, 29 Mar 2007 08:10:27 +0000 (08:10 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@5918 594d385d-05f5-0310-b6e9-bd551577e9d8

include/sieve/class_sieveElement_Fileinto.inc
include/sieve/class_sieveElement_Redirect.inc
include/sieve/templates/element_fileinto.tpl

index 80b4c3aaca76049d5034fb0184119ffe933148d2..de30a9a1fb99ca7b75abcc61603c9f8a79b85cc3 100644 (file)
@@ -13,8 +13,7 @@ class sieve_fileinto
     $mbs = $this->get_mail_boxes();
     
     if(isset($_POST['fileinto_'.$this->object_id])){
-      $mb = $_POST['fileinto_'.$this->object_id];
-
+      $mb = stripslashes($_POST['fileinto_'.$this->object_id]);
 
       /* Depending on the user mode we only accept 
        *  existing mailboxes 
@@ -74,7 +73,7 @@ class sieve_fileinto
   function execute()
   {
     $smarty = get_smarty();
-    $smarty->assign("Selected",$this->data);
+    $smarty->assign("Selected",htmlentities($this->data));
     $smarty->assign("Boxes", $this->get_mail_boxes());
     $smarty->assign("User_Mode", $this->user_mode);
     $smarty->assign("ID", $this->object_id);
index 67bc934a1c4dacdb559d7ec6a2bebc425d52b719..4f19c67e87c7dbd1473a177e5ed6fe16e704a5df 100644 (file)
@@ -1,7 +1,7 @@
 <?php
 class sieve_redirect 
 {
-  var $data = array();
+  var $data = "";
   var $object_id = -1;
   var $LastError   ="";
   
@@ -10,7 +10,7 @@ class sieve_redirect
     if(isset($_POST['redirect_to_'.$this->object_id])){
       $rt = stripslashes($_POST['redirect_to_'.$this->object_id]);
 
-      $rt = "\"".trim(preg_replace("/\"/","",$rt))."\"";
+      $rt = trim($rt);
       $this->data = $rt;
     }
   }
@@ -20,7 +20,7 @@ class sieve_redirect
   {
     $msgs = array();
     
-    if(!is_email(preg_replace("/\"/","",$this->data))){
+    if(!is_email($this->data)){
       $msgs[] =_("Please specify a valid email address.");
     }
     
@@ -35,9 +35,15 @@ class sieve_redirect
       $data = array('ELEMENTS' => array(array('class' => "quoted-string" ,"text" => _("Put a mail address here"))));
     }
 
-    foreach($data['ELEMENTS'] as $node ){
+    foreach($data['ELEMENTS'] as $key => $node ){
       if(in_array($node['class'],array("quoted-string","text"))){
-        $this->data = $node['text'];
+        $tmp = sieve_get_strings($data['ELEMENTS'],$key);
+        if(count($tmp['STRINGS'])){
+
+          foreach($tmp['STRINGS'] as $str){
+            $this->data.= $str;
+          }
+        }
       }
     }
   }
@@ -51,8 +57,7 @@ class sieve_redirect
  
   function execute()
   {
-    $values = $this->data;
-
+    $values = htmlentities($this->data);
     $smarty = get_smarty();
     $smarty->assign("ID", $this->object_id);
     $smarty->assign("Destinations" , $values);
index 65db0481f89bb4d11bf229ca702ed61d10ff8e40..c6ae998e0ead75a17f1329261679a3f025e4a9a8 100644 (file)
@@ -17,7 +17,7 @@
                <td>
                        {t}Folder{/t}
                        {if $User_Mode}
-                               <input class='sieve_fileinto_input' type='text' value='{$Selected}' name='fileinto_{$ID}'>
+                               <input class='sieve_fileinto_input' type='text' value="{$Selected}" name='fileinto_{$ID}'>
                        {else}
                                <select name='fileinto_{$ID}' class='sieve_fileinto_input'>
                                        {html_options values=$Boxes output=$Boxes selected=$Selected}