debug code, new autoreply try
[old-projects.git] / philter / philter / include / plugin_autoreply.inc.php
index 3cbccc9..3151f34 100644 (file)
@@ -31,15 +31,19 @@ EOF;
     
     function to_string($_data) {
         $uid = get_user_id();
-        $text = explode("\n",$_data[1]);
+
+        $text = addslashes($_data[1]);
+        $text = str_replace('$', '\$', $text);
+        $lines = split("\n", $text);
 
         $res = "    if(! /^X-Philter-Autoreply: $uid$/)\n" # TODO : et ne vient pas da démon
             .  "    {\n"
-            .  "        cc \"| reformail -rt -A'X-Philter-Autoreply: $uid' \\\n"
-            .  "            | ( cat - ; echo '' ; \\\n";
-        foreach($text as $line)
-            $res .= "                echo ".escapeshellarg(chop($line))."; \\\n";
-        $res.= "            ) | $"."SENDMAIL -oi -t\"\n";
+            .  "        cc \"| reformail -rt -A'X-Philter-Autoreply: $uid' -A'X-Precedence: junk' \\\n"
+            .  "            | ( cat - ; echo '';";
+        foreach($lines as $line)
+            $res .= " echo '".chop($line)."';";
+        $res.= " \\\n"
+            .  "            ) | $"."SENDMAIL -oi -t\"\n";
         return $res."    }\n";
     }
 }