Commit | Line | Data |
---|---|---|
dd8de1ec PH |
1 | <?php |
2 | /******************************************************************************** | |
3 | * index.php : index page | |
4 | * --------- | |
5 | * | |
6 | * This file is part of the philter distribution | |
7 | * Copyright: See COPYING files that comes with this distribution | |
8 | ********************************************************************************/ | |
9 | ||
10 | require("include/header.inc.php"); | |
11 | require("include/philter.inc.php"); | |
12 | require("include/config.inc.php"); | |
13 | ||
b19786ca PH |
14 | if(isset($_POST['set_adv'])) |
15 | $philter->set_advanced(); | |
16 | ||
dd8de1ec PH |
17 | $mail_pool = new EmailPool(get_user_id()); |
18 | $filter = new Filter(get_user_id()); | |
19 | ||
20 | if(count($_POST)) { // a FORM has been submitted | |
de47756d PH |
21 | if(isset($_POST['global'])) { // FORM global |
22 | foreach($philter->config['global_plugins'] as $id=>$g_plugin) | |
23 | if(isset($_POST['global'][$id])) | |
24 | $filter->set_global_data($id,$_POST['global'][$id]); | |
25 | $filter->rules[0]->sql_store(get_user_id(),0); | |
26 | } | |
dd8de1ec PH |
27 | if(isset($_POST['emails'])) // FORM emails |
28 | if(!$mail_pool->handle_form()) | |
29 | echo "<p style=\"color:red;\">".$philter->error()."</p>\n"; | |
30 | ||
31 | if(!empty($_POST['order']['action'])) // FORM order | |
32 | if($_POST['order']['action']=='submit') { | |
33 | foreach($filter->rules as $id=>$rule) | |
34 | if(isset($_POST['order'][$id])) | |
35 | $filter->rules[$id]->move_to($_POST['order'][$id], $filter->uid, $id); | |
36 | uasort($filter->rules, 'rule_cmp'); | |
37 | } elseif($_POST['order']['action']=='delete' && !empty($_POST['order']['select'])) { | |
38 | $filter->delete_rule($_POST['order']['select']); | |
39 | $_POST['order']['select'] = min(count($filter->rules),$_POST['order']['select']); | |
40 | } | |
41 | ||
42 | if(!empty($_POST['rule'])) // FORM rule | |
43 | if(!$filter->handle_form()) | |
44 | echo "<p style=\"color:red;\">".$philter->error()."</p>\n"; | |
45 | } | |
46 | ||
47 | require("include/js_factory.inc.php"); | |
48 | ||
b19786ca PH |
49 | if($philter->is_advanced()) |
50 | require("include/form_filter.inc.php"); | |
51 | else | |
52 | require("include/form_emails.inc.php"); | |
dd8de1ec PH |
53 | |
54 | require("include/footer.inc.php"); | |
dd8de1ec PH |
55 | /******************************************************************************** |
56 | * $id: header.inc.php,v 1.2 2003/08/03 16:02:41 madcoder exp $ | |
57 | * vim: set expandtab shiftwidth=4 tabstop=4 softtabstop=4 textwidth=100: | |
58 | ********************************************************************************/ | |
59 | ?> |