writing the procmail rcfile
[old-projects.git] / philter / philter / include / philter.inc.php
index 3b89bff..4d3c4f9 100644 (file)
@@ -83,10 +83,16 @@ class Philter {
     }
 
     /** function that writes the procmailrc.
+     * @param   &$procmail  the string containing the procmail filter
+     * @param   $filename   the base filename of the procmailrc filter
      * @return  true if all is ok
      */
-    function write_procmailrc() {
-        // TODO
+    function write_procmailrc(&$procmail, $filename) {
+        $file = $philter->config['path']['spool']."/".$filename;
+        $f = fopen($file.".tmp", "w");
+        fwrite($f, $procmail, strlen($procmail));
+        fclose($f);
+        rename($file.".tmp", $file);
         return true;
     }