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 | ||
772509f3 PH |
14 | function clean_tmp($_uid) { |
15 | mysql_query("DELETE FROM tmp_rules WHERE uid='$_uid'"); | |
16 | mysql_query("DELETE FROM tmp_actions WHERE uid='$_uid'"); | |
17 | mysql_query("DELETE FROM tmp_matches WHERE uid='$_uid'"); | |
18 | } | |
19 | ||
20 | function to_tmp($_uid) { | |
21 | clean_tmp($_uid); | |
22 | mysql_query("INSERT INTO tmp_rules SELECT * FROM rules WHERE uid='$_uid'"); | |
23 | mysql_query("INSERT INTO tmp_actions SELECT * FROM actions WHERE uid='$_uid'"); | |
24 | mysql_query("INSERT INTO tmp_matches SELECT * FROM matches WHERE uid='$_uid'"); | |
25 | } | |
26 | ||
27 | function to_main($_uid) { | |
eb0c0595 PH |
28 | mysql_query("DELETE FROM rules WHERE uid='$_uid'"); |
29 | mysql_query("DELETE FROM actions WHERE uid='$_uid'"); | |
30 | mysql_query("DELETE FROM matches WHERE uid='$_uid'"); | |
772509f3 PH |
31 | mysql_query("INSERT INTO rules SELECT * FROM tmp_rules WHERE uid='$_uid'"); |
32 | mysql_query("INSERT INTO actions SELECT * FROM tmp_actions WHERE uid='$_uid'"); | |
33 | mysql_query("INSERT INTO matches SELECT * FROM tmp_matches WHERE uid='$_uid'"); | |
34 | clean_tmp($_uid); | |
35 | } | |
36 | ||
37 | if(isset($_POST['set_adv']) && !$philter->is_advanced()) { | |
b19786ca | 38 | $philter->set_advanced(); |
772509f3 PH |
39 | to_tmp(get_user_id()); |
40 | } | |
b19786ca | 41 | |
772509f3 PH |
42 | if(isset($_POST['filter_valid']) && $philter->is_advanced()) { |
43 | $philter->del_advanced(); | |
44 | to_main(get_user_id()); | |
5d6c0389 | 45 | $PHILTER_HAS_TO_BE_WRITTEN=true; |
772509f3 | 46 | } |
dd8de1ec | 47 | |
772509f3 PH |
48 | if(isset($_POST['filter_cancel']) && $philter->is_advanced()) { |
49 | $philter->del_advanced(); | |
50 | clean_tmp(get_user_id()); | |
dd8de1ec PH |
51 | } |
52 | ||
772509f3 PH |
53 | $mail_pool = new EmailPool(get_user_id()); |
54 | $filter = new Filter(get_user_id()); | |
dd8de1ec | 55 | |
5d6c0389 PH |
56 | if(isset($PHILTER_HAS_TO_BE_WRITTEN) && $PHILTER_HAS_TO_BE_WRITTEN) { |
57 | unset($PHILTER_HAS_TO_BE_WRITTEN); | |
58 | $philter->write_procmailrc($filter->to_string(), get_filename()); | |
59 | } | |
60 | ||
b19786ca PH |
61 | if($philter->is_advanced()) |
62 | require("include/form_filter.inc.php"); | |
63 | else | |
64 | require("include/form_emails.inc.php"); | |
dd8de1ec PH |
65 | |
66 | require("include/footer.inc.php"); | |
dd8de1ec PH |
67 | /******************************************************************************** |
68 | * $id: header.inc.php,v 1.2 2003/08/03 16:02:41 madcoder exp $ | |
69 | * vim: set expandtab shiftwidth=4 tabstop=4 softtabstop=4 textwidth=100: | |
70 | ********************************************************************************/ | |
71 | ?> |