Code

Heimdal stuff not needed. It's too insecure to read m-keys by php.
[gosa.git] / include / sieve / class_sieveElement_Comment.inc
index 51c1d8f37b5f8f01db3b202f20b9adc2796f733e..deaa4f3120ba68ca16e18555117fdbb33c32b929 100644 (file)
@@ -9,7 +9,7 @@ class sieve_comment
 
   function get_sieve_script_part()
   {
-    $str = "/*".$this->data."*/\n";
+    $str = "\n/*".$this->data."*/";
     return($str);
   } 
     
@@ -17,7 +17,7 @@ class sieve_comment
   {
     $this->object_id = $object_id;
 
-    if($data == NULL){
+    if($data === NULL){
       $data = array('ELEMENTS' => array(array('class' => "quoted-string" ,"text" => "/*"._("Your comment here")."*/")));
     }
 
@@ -39,6 +39,7 @@ class sieve_comment
 
       $this->data .= $text."\n";
     }
+    $this->data = rtrim($this->data)."\n";
   }
 
   function check()
@@ -50,6 +51,7 @@ class sieve_comment
   {
     if(isset($_POST['comment_'.$this->object_id])){
       $cm = stripslashes( $_POST['comment_'.$this->object_id]);
+      $cm = preg_replace("/\*\//","* /",$cm);
       $this->data = $cm;
     }
   
@@ -71,11 +73,10 @@ class sieve_comment
     }
  
     /* Create html object */ 
-    $smarty = get_smarty();
     $smarty->assign("Comment",$Comment);
     $smarty->assign("ID",$this->object_id);
     $object = $smarty->fetch(get_template_path("templates/element_comment.tpl",TRUE,dirname(__FILE__)));    
-    $str = preg_replace("/%%OBJECT_CONTENT%%/",$object,$object_container);
+    $str = preg_replace("/%%OBJECT_CONTENT%%/",addcslashes($object,"\\"),$object_container);
     return($str);
   }
 }