root/alternc-procmail/branches/v0/procmail_opt.php

Revision 1262, 3.6 kB (checked in by anonymous, 4 years ago)

Initial revision

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
Line 
1 <?php
2    /*
3     *  AlternC Procmail managment
4     *
5     */
6 if ($accook==1 && $addnew) {
7     include_once("procmail_add.php");
8     exit();
9 }
10
11 if (!$already) {
12    chdir ("..");
13    session_start();
14
15    include_once ("procmail_builder/config.php");
16    include_once ("../config/config.php");
17    include_once ("../functions/strings.php");
18    include_once ("../functions/page_header.php");
19    include_once ("../functions/imap.php");
20
21    include_once ("../src/load_prefs.php");
22    displayPageHeader($color, "None");
23 }
24
25   textdomain("procmail_builder");
26
27 // submit :) let's DO something
28 if ($accook==1) {
29     $error="";
30     if ($disable) {
31         if ($pr->disable())
32             $error=_("Your mail filters has been disabled");
33         else
34             $error=$er->errstr();
35     }
36     if ($enable) {
37         if ($pr->enable())
38             $error=_("Your mail filters has been enabled");
39         else
40             $error=$er->errstr();
41     }
42     if ($delete && is_array($del)) {
43     $rules=$pr->readrules();
44     $r=array();
45     for($i=0;$i<count($rules);$i++) {
46         if (!in_array($i+1,$del)) {
47             $r[]=$rules[$i];
48         }
49     }
50     $pr->writerules($r);
51     }
52 }
53
54 ?>
55
56 <br>
57 <form method=post action="procmail_opt.php">
58 <input type="hidden" name="accook" value="1">
59 <table width=95% align=center cellpadding=2 cellspacing=2 border=0>
60 <tr><td bgcolor="<?php echo $color[0] ?>">
61    <center><b><?php __("Filter Messages"); ?></b></center>
62 </td>
63 </tr>
64 <?php
65
66 if ($error) echo "<tr><td><b>$error</b></td></tr>";
67
68 $s=$pr->get_status();
69 $rules=$pr->readrules();
70
71 if ($act=="up") {
72     $t=$pr->uprule($rules,$rid);
73     if ($t!==false) {
74         $pr->writerules($t);
75         $rules=$t;
76     } else {
77         $error=$er->errstr();
78     }
79 }
80 if ($act=="down") {
81         $t=$pr->downrule($rules,$rid);
82         if ($t!==false) {
83                 $pr->writerules($t);
84                 $rules=$t;
85         } else {
86                 $error=$er->errstr();
87         }
88 }
89 ?>
90 <tr><td>
91     <table cellpadding="6"><tr><td>
92     <?php if ($s) {
93         __("Your mailbox filter is enabled"); ?></td><td>
94         <input type="submit" name="disable" value="<?php __("Click here to disable the filters"); ?>">
95     <?php } else {
96         __("Your mailbox filter is disabled"); ?></td><td>
97         <input type="submit" name="enable" value="<?php __("Click here to enable the filters"); ?>">
98     <?php } ?>
99     </td></tr>
100     </table>
101 </td></tr>
102 <tr><td>
103 <?php if (count($rules)) { ?>
104     <input type="submit" name="delete" value="<?php __("Delete checked rules"); ?>">&nbsp;&nbsp;
105 <?php } ?>
106     <input type="submit" name="addnew" value="<?php __("Create a new rule"); ?>">&nbsp;&nbsp;
107 </td></tr>
108 <tr><td bgcolor="<?php echo $color[0] ?>">
109     <center><b><?php __("Current filter rules on your mailbox"); ?></b></center>
110 </td></tr>
111 <tr><td>
112 <?php
113
114 if ($rules===false) {
115     echo $er->errstr();
116 } else {
117     echo "<table cellpadding=\"2\" cellspacing=\"0\" border=\"1\">\n";
118     for($i=0;$i<count($rules);$i++) {
119         echo "<tr>";
120         echo "<td valign=\"top\"><input type=\"checkbox\" id=\"c".($i+1)."\" name=\"del[]\" value=\"".($i+1)."\"></td>";
121         echo "<td valign=\"top\">".ife($i,"<a href=\"procmail_opt.php?rid=$i&act=up\">"._("Up")."</a>","&nbsp;")."</td>";
122         echo "<td valign=\"top\">".ife($i+1<count($rules),"<a href=\"procmail_opt.php?rid=$i&act=down\">"._("Down")."</a>","&nbsp;")."</td>";
123         echo "<td valign=\"top\"><label for=\"c".($i+1)."\">".stripslashes($pr->describe($rules[$i]))."</label></td>";
124         echo "<td valign=\"top\">".$rules[$i]["name"]."</td>";
125         echo "</tr>";
126     }
127     echo "<tr><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>--&gt; "._("Message sent to INBOX folder")."</td><td>&nbsp;</td></tr>";
128     echo "</table>";
129 }
130 ?>
131 </td></tr>
132
133
134 <tr><td><p>&nbsp;</p></td></tr>
135 <tr><td>
136 <small><?php __("help_procmail_1"); ?></small>
137 </td></tr>
138 </table>
139 </form>
140
141 </body></html>
142 <?php
143
144 textdomain("squirrelmail");
145
146 ?>
147
Note: See TracBrowser for help on using the browser.