summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: bf62d95)
raw | patch | inline | side by side (parent: bf62d95)
author | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Wed, 21 Mar 2007 06:56:06 +0000 (06:56 +0000) | ||
committer | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Wed, 21 Mar 2007 06:56:06 +0000 (06:56 +0000) |
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@5841 594d385d-05f5-0310-b6e9-bd551577e9d8
include/sieve/class_sieveElement_Comment.inc | patch | blob | history |
diff --git a/include/sieve/class_sieveElement_Comment.inc b/include/sieve/class_sieveElement_Comment.inc
index 197b3211a9f1ea262280551fb4fedba996400736..51c1d8f37b5f8f01db3b202f20b9adc2796f733e 100644 (file)
function get_sieve_script_part()
{
- return($this->data."\n");
+ $str = "/*".$this->data."*/\n";
+ return($str);
}
function sieve_comment($data,$object_id)
}
foreach($data['ELEMENTS'] as $node){
- $this->data .= $node['text'];
+
+ $text = $node['text'];
+
+ /* Convert \t to spaces */
+ $text = preg_replace("#\t#"," ",$text);
+
+ /* Remove comment indicator '#' but keep spaces */
+ $text = preg_replace("/^([ ]*)\#/","\\1",$text);
+
+ /* Remove comment indicator '/ *' */
+ $text = preg_replace("#\/\*#","",$text);
+
+ /* Remove comment indicator '* /' */
+ $text = preg_replace("#\*\/#","",$text);
+
+ $this->data .= $text."\n";
}
}
{
if(isset($_POST['comment_'.$this->object_id])){
$cm = stripslashes( $_POST['comment_'.$this->object_id]);
- $this->data = "/*".$cm."*/";
+ $this->data = $cm;
}
if(isset($_POST['toggle_small_'.$this->object_id])){
$object_container = $smarty->fetch(get_template_path("templates/object_container.tpl",TRUE,dirname(__FILE__)));
$Comment = $this->data;
- /* Remove comment tags */
- if(preg_match("/^#/",$Comment)){
- $Comment = preg_replace("/^#/","",$Comment);
- }elseif(preg_match("#\/\*#",$Comment)){
- $Comment = preg_replace("#^\/\*#","",$Comment);
- $Comment = preg_replace("#\*\/$#","",$Comment);
- }
-
if($this->small){
- $Comment = nl2br($Comment);
+ $Comment = nl2br(preg_replace("/ /"," ",$Comment));
}
/* Create html object */