writing procmailrc
[old-projects.git] / philter / philter / include / form_emails.inc.php
1 <?php
2 if(count($_POST)) { // a FORM has been submitted
3 if(isset($_POST['global'])) { // FORM global
4 foreach($philter->config['global_plugins'] as $id=>$g_plugin)
5 if(isset($_POST['global'][$id]))
6 $filter->set_global_data($id,$_POST['global'][$id]);
7 $filter->rules[0]->sql_store(get_user_id(),0);
8 $philter->write_procmailrc($filter->to_string(), get_filename());
9 }
10 if(isset($_POST['emails'])) { // FORM emails
11 if(!$mail_pool->handle_form())
12 echo "<p style=\"color:red;\">".$philter->error()."</p>\n";
13 $philter->write_procmailrc($filter->to_string(), get_filename());
14 }
15 }
16 ?>
17 <div class="rubrique"><?php i18n('global_title'); ?></div>
18 <?php
19 i18n('global_help');
20 if(count($philter->config['global_plugins'])) {
21 echo "<form action=\"{$_SERVER['REQUEST_URI']}\" method=\"post\">\n"
22 ."<table width=\"95%\" class=\"bicol\" cellspacing=\"1\" cellpadding=\"1\" align=\"center\">\n";
23
24 $pair = 0;
25 foreach($philter->config['global_plugins'] as $id=>$g_plugin) {
26 echo "<tr><td class='".($pair ? 'pair':'impair')."'>\n";
27 echo $g_plugin->to_form($filter->get_global_data($id));
28 echo "</td></tr>\n";
29 $pair = 1 - $pair;
30 }
31
32 echo "</table><br />\n"
33 ."<center><input type='submit' name='global[submit]' value='"
34 ._i18n('apply_changes')."'/></center\n"
35 ."</form>\n";
36 }
37
38 /********** emails **********/
39 ?>
40 <br />
41 <div class="rubrique"><?php i18n('pool_title'); ?></div>
42 <?php
43 i18n('pool_help');
44 echo $mail_pool->to_form();
45 ?>
46 <div class="rubrique"><?php i18n('filter_adv'); ?></div>
47 <?php i18n('filter_adv_txt'); ?>
48 <form action="<?php echo $_SERVER['REQUEST_URI'] ?>" method="post">
49 <center>
50 <input type="submit" value='<?php i18n('filter_adv') ?>' name='set_adv' />
51 </center>
52 </form>