root/alternc-procmail/tags/nightly_sarge/procmail_opt.php

Revision 1270, 4.1 kB (checked in by benjamin, 4 years ago)

correctifs en tout genre pour que procmail-builder marche sur squirrelmail 1.4 alternc 0.9.3/4 et sarge

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