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