323d406a8fe8cc80b0694a6bbe964aa24ec8f130
[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 }
9 if(isset($_POST['emails'])) // FORM emails
10 if(!$mail_pool->handle_form())
11 echo "<p style=\"color:red;\">".$philter->error()."</p>\n";
12
13 if(!empty($_POST['order']['action'])) // FORM order
14 if($_POST['order']['action']=='submit') {
15 foreach($filter->rules as $id=>$rule)
16 if(isset($_POST['order'][$id]))
17 $filter->rules[$id]->move_to($_POST['order'][$id], $filter->uid, $id);
18 uasort($filter->rules, 'rule_cmp');
19 } elseif($_POST['order']['action']=='delete' && !empty($_POST['order']['select'])) {
20 $filter->delete_rule($_POST['order']['select']);
21 $_POST['order']['select'] = min(count($filter->rules),$_POST['order']['select']);
22 }
23 }
24 ?>
25 <div class="rubrique"><?php i18n('global_title'); ?></div>
26 <?php
27 i18n('global_help');
28 if(count($philter->config['global_plugins'])) {
29 echo "<form action=\"{$_SERVER['REQUEST_URI']}\" method=\"post\">\n"
30 ."<table width=\"95%\" class=\"bicol\" cellspacing=\"1\" cellpadding=\"1\" align=\"center\">\n";
31
32 $pair = 0;
33 foreach($philter->config['global_plugins'] as $id=>$g_plugin) {
34 echo "<tr><td class='".($pair ? 'pair':'impair')."'>\n";
35 echo $g_plugin->to_form($filter->get_global_data($id));
36 echo "</td></tr>\n";
37 $pair = 1 - $pair;
38 }
39
40 echo "</table><br />\n"
41 ."<center><input type='submit' name='global[submit]' value='"
42 ._i18n('apply_changes')."'/></center\n"
43 ."</form>\n";
44 }
45
46 /********** emails **********/
47 ?>
48 <br />
49 <div class="rubrique"><?php i18n('pool_title'); ?></div>
50 <?php
51 i18n('pool_help');
52 echo $mail_pool->to_form();
53 ?>
54 <div class="rubrique"><?php i18n('filter_adv'); ?></div>
55 <?php i18n('filter_adv_txt'); ?>
56 <form action="<?php echo $_SERVER['REQUEST_URI'] ?>" method="post">
57 <center>
58 <input type="submit" value='<?php i18n('filter_adv') ?>' name='set_adv' />
59 </center>
60 </form>