writing procmailrc
[old-projects.git] / philter / philter / include / form_emails.inc.php
index 9ffda48..9dd2759 100644 (file)
@@ -1,3 +1,19 @@
+<?php
+if(count($_POST)) {                             // a FORM has been submitted
+    if(isset($_POST['global'])) {               //      FORM global
+        foreach($philter->config['global_plugins'] as $id=>$g_plugin)
+            if(isset($_POST['global'][$id]))
+                $filter->set_global_data($id,$_POST['global'][$id]);
+        $filter->rules[0]->sql_store(get_user_id(),0);
+        $philter->write_procmailrc($filter->to_string(), get_filename());
+    }
+    if(isset($_POST['emails'])) {               //      FORM emails
+        if(!$mail_pool->handle_form())
+            echo "<p style=\"color:red;\">".$philter->error()."</p>\n";
+        $philter->write_procmailrc($filter->to_string(), get_filename());
+    }
+}
+?>
 <div class="rubrique"><?php i18n('global_title'); ?></div>
 <?php
 i18n('global_help');
@@ -29,7 +45,7 @@ echo $mail_pool->to_form();
 ?>
 <div class="rubrique"><?php i18n('filter_adv'); ?></div>
 <?php i18n('filter_adv_txt'); ?>
-<form action="<?php echo $_SERVER['PHP_SELF'] ?>" method="post">
+<form action="<?php echo $_SERVER['REQUEST_URI'] ?>" method="post">
 <center>
     <input type="submit" value='<?php i18n('filter_adv') ?>' name='set_adv' />
 </center>