Skip to content

Commit

Permalink
Merge pull request #43 from Udera/add_spamdrop-field
Browse files Browse the repository at this point in the history
added fields that are already in the exim-routers to the DB and UI. Thanks @Udera for spotting these inconsistencies and fixing them!
  • Loading branch information
rimas-kudelis committed Jun 24, 2015
2 parents becdfb2 + 18de5da commit 3f46dcd
Show file tree
Hide file tree
Showing 9 changed files with 133 additions and 48 deletions.
2 changes: 2 additions & 0 deletions setup/create_db.pl
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,7 @@ sub create_mysqltables {
on_piped bool NOT NULL default '0',
on_spamassassin bool NOT NULL default '0',
on_vacation bool NOT NULL default '0',
spam_drop bool NOT NULL default '0',
enabled bool NOT NULL default '1',
flags varchar(16) default NULL,
forward varchar(255) default NULL,
Expand Down Expand Up @@ -326,6 +327,7 @@ sub create_postgrestables {
# on_piped smallint NOT NULL default '0',
# on_spamassassin smallint NOT NULL default '0',
# on_vacation smallint NOT NULL default '0',
# spam_drop smallint NOT NULL default '0',
# enabled smallint NOT NULL default '1',
# flags varchar(16) default NULL,
# forward varchar(255) default NULL,
Expand Down
1 change: 1 addition & 0 deletions setup/mysql.sql
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ CREATE TABLE IF NOT EXISTS `vexim`.`users`
on_piped bool NOT NULL default '0',
on_spamassassin bool NOT NULL default '0',
on_vacation bool NOT NULL default '0',
spam_drop bool NOT NULL default '0',
enabled bool NOT NULL default '1',
flags varchar(16) default NULL,
forward varchar(255) default NULL,
Expand Down
1 change: 1 addition & 0 deletions setup/pgsql.sql
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ CREATE TABLE users (user_id SERIAL PRIMARY KEY,
on_piped smallint NOT NULL default '0',
on_spamassassin smallint NOT NULL default '0',
on_vacation smallint NOT NULL default '0',
spam_drop smallint NOT NULL default '0',
enabled smallint NOT NULL default '1',
flags varchar(16) default NULL,
forward varchar(255) default NULL,
Expand Down
12 changes: 10 additions & 2 deletions vexim/adminuseradd.php
Original file line number Diff line number Diff line change
Expand Up @@ -142,9 +142,17 @@ class="textfield">@<?php print $_SESSION['domain']; ?>
<input name="sa_refuse" size="5" type="text" class="textfield"
value="<?php echo $row['sa_refuse']; ?>">
</td>
<td><?php echo _('The score at which to move potential spam mail
to folder or to delete'); ?>
</td>
</tr>
<tr>
<td><?php echo _('How to handle mail above the SA refuse score'); ?>:</td>
<td>
<?php echo _('The score at which to refuse potential spam mail
and not deliver'); ?>
<input type="radio" id="off" name="spam_drop" value="0" checked>
<label for="off"> <?PHP echo _('move to Spam-folder'); ?></label><br>
<input type="radio" id="on" name="spam_drop" value="1">
<label for="on"><?PHP echo _('delete - you cannot restore these mails'); ?></label><br>
</td>
</tr>
<?php } ?>
Expand Down
7 changes: 4 additions & 3 deletions vexim/adminuseraddsubmit.php
Original file line number Diff line number Diff line change
Expand Up @@ -116,16 +116,16 @@
if (validate_password($_POST['clear'], $_POST['vclear'])) {
$query = "INSERT INTO users (localpart, username, domain_id, crypt,
smtp, pop, uid, gid, realname, type, admin, on_avscan, on_piped,
on_spamassassin, sa_tag, sa_refuse, maxmsgsize, enabled, quota)
on_spamassassin, sa_tag, sa_refuse, spam_drop, maxmsgsize, enabled, quota)
VALUES (:localpart, :username, :domain_id, :crypt, :smtp, :pop, :uid, :gid,
:realname, :type, :admin, :on_avscan, :on_piped, :on_spamassassin,
:sa_tag, :sa_refuse, :maxmsgsize, :enabled, :quota)";
:sa_tag, :sa_refuse, :spam_drop, :maxmsgsize, :enabled, :quota)";
$sth = $dbh->prepare($query);
$success = $sth->execute(array(':localpart'=>$_POST['localpart'],
':localpart'=>$_POST['localpart'],
':username'=>$_POST['localpart'].'@'.$_SESSION['domain'],
':domain_id'=>$_SESSION['domain_id'],
':crypt'=>crypt_password($_POST['clear'],$salt),
':crypt'=>crypt_password($_POST['clear']),
':smtp'=>$smtphomepath,
':pop'=>$pophomepath,
':uid'=>$_POST['uid'],
Expand All @@ -138,6 +138,7 @@
':on_spamassassin'=>$_POST['on_spamassassin'],
':sa_tag'=>((isset($_POST['sa_tag'] )) ? $_POST['sa_tag'] : 0),
':sa_refuse'=>((isset($_POST['sa_refuse'] )) ? $_POST['sa_refuse'] : 0),
':spam_drop'=>$_POST['spam_drop'],
':maxmsgsize'=>$_POST['maxmsgsize'],
':enabled'=>$_POST['enabled'],
':quota'=>$_POST['quota'],
Expand Down
11 changes: 11 additions & 0 deletions vexim/adminuserchange.php
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,17 @@
value="<?php echo $row['sa_refuse']; ?>" class="textfield">
</td>
</tr>
<tr>
<td><?php echo _('How to handle mail above the SA refuse score'); ?>:</td>
<td>
<input type="radio" id="off" name="spam_drop" value="0"<?php if ($row['spam_drop'] == "0") {
print " checked"; }?>>
<label for="off"> <?PHP echo _('move to Spam-folder'); ?></label><br>
<input type="radio" id="on" name="spam_drop" value="1"<?php if ($row['spam_drop'] == "1") {
print " checked"; }?>>
<label for="on"><?PHP echo _('delete - you cannot restore these mails'); ?></label><br>
</td>
</tr>
<?php
}
?>
Expand Down
2 changes: 2 additions & 0 deletions vexim/adminuserchangesubmit.php
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,7 @@
quota=:quota,
sa_tag=:sa_tag,
sa_refuse=:sa_refuse,
spam_drop=:spam_drop,
type=:type,
vacation=:vacation,
unseen=:unseen
Expand All @@ -185,6 +186,7 @@
':quota'=>$_POST['quota'],
':sa_tag'=>((isset($_POST['sa_tag'])) ? $_POST['sa_tag'] : 0),
':sa_refuse'=>((isset($_POST['sa_refuse'])) ? $_POST['sa_refuse'] : 0),
':spam_drop'=>$_POST['spam_drop'],
':type'=>$_POST['type'],
':vacation'=>$vacation,
':unseen'=>$_POST['unseen'], ':user_id'=>$_POST['user_id'],
Expand Down
141 changes: 100 additions & 41 deletions vexim/userchange.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,60 +47,119 @@
} else {
print _("Your mailbox quota is currently: Unlimited");
}
?></td></tr><?php
if ($domrow['avscan'] == "1") {
print "<tr><td>" . _("Anti-Virus") . ":</td><td><input name=\"on_avscan\" type=\"checkbox\"";
if ($row['on_avscan'] == "1") {
print " checked ";
}
print "></td></tr>\n";
}
if ($domrow['spamassassin'] == "1") {
print "<tr><td>" . _("Spamassassin") . ":</td><td><input name=\"on_spamassassin\" type=\"checkbox\"";
if ($row['on_spamassassin'] == "1") {
print " checked ";
}
print "></td></tr>\n";
print "<tr><td>" . _("SpamAssassin tag score") . ":</td>";
print "<td><input type=\"text\" size=\"5\" name=\"sa_tag\" value=\"{$row['sa_tag']}\" class=\"textfield\"></td></tr>\n";
print "<tr><td>" . _("SpamAssassin refuse score") . ":</td>";
print "<td><input type=\"text\" size=\"5\" name=\"sa_refuse\" value=\"{$row['sa_refuse']}\" class=\"textfield\"></td></tr>\n";
}
print "<tr><td>" . _("Maximum message size") . ":</td>";
print "<td><input type=\"text\" size=\"5\" name=\"maxmsgsize\" value=\"{$row['maxmsgsize']}\" class=\"textfield\"> " . _("Kb") . "</td></tr>\n";
print "<tr><td>" . _("Vacation enabled") . ":</td><td><input name=\"on_vacation\" type=\"checkbox\"";
if ($row['on_vacation'] == "1") { print " checked "; }
print "></td></tr>\n";
print "<tr><td>" . _("Vacation message") . ":</td>";
print "<td><textarea name=\"vacation\" cols=\"40\" rows=\"5\" class=\"textfield\">".(function_exists('imap_qprint') ? imap_qprint($row['vacation']) : $row['vacation'])."</textarea>";
print "<tr><td>" . _("Forwarding enabled") . ":</td><td><input name=\"on_forward\" type=\"checkbox\"";
if ($row['on_forward'] == "1") { print " checked "; }
print "></td></tr>\n";
print "<tr><td>" . _("Forward mail to") . ":</td>";
print "<td><input type=\"text\" name=\"forward\" value=\"{$row['forward']}\" class=\"textfield\"><br>\n";
print _("Must be a full e-mail address") . "!</td></tr>\n";
print "<tr><td>" . _("Store Forwarded Mail Locally") . ":</td><td><input name=\"unseen\" type=\"checkbox\"";
if ($row['unseen'] == "1") { print " checked "; } print "></td></tr>\n";
?>
<tr><td></td><td class="button"><input name="submit" type="submit" value="<?php echo _("Submit Profile"); ?>"></td></tr>
?>
</td>
</tr>
<?php
if ($domrow['avscan'] == "1") {
?>
<tr>
<td><?php echo _('Anti-Virus'); ?>:</td>
<td><input name="on_avscan" type="checkbox"
<?php if ($row['on_avscan'] == "1") {
print " checked";
} ?>>
</td>
</tr>
<?php
}
if ($domrow['spamassassin'] == "1") {
?>
<tr>
<td><?php echo _('Spamassassin'); ?>:</td>
<td><input name="on_spamassassin" type="checkbox"
<?php if ($row['on_spamassassin'] == "1") {
print " checked";
}?>>
</td>
</tr>
<tr>
<td><?php echo _('Spamassassin tag score'); ?>:</td>
<td>
<input type="text" size="5" name="sa_tag"
value="<?php echo $row['sa_tag']; ?>" class="textfield">
</td>
</tr>
<tr>
<td><?php echo _('Spamassassin refuse score'); ?>:</td>
<td>
<input type="text" size="5" name="sa_refuse"
value="<?php echo $row['sa_refuse']; ?>" class="textfield">
</td>
</tr>
<tr>
<td><?php echo _('How to handle mail above the SA refuse score'); ?>:</td>
<td>
<input type="radio" id="off" name="spam_drop" value="0"<?php if ($row['spam_drop'] == "0") {
print " checked"; }?>>
<label for="off"> <?PHP echo _('move to Spam-folder'); ?></label><br>
<input type="radio" id="on" name="spam_drop" value="1"<?php if ($row['spam_drop'] == "1") {
print " checked"; }?>>
<label for="on"><?PHP echo _('delete - you cannot restore these mails'); ?></label><br>
</td>
</tr>
<?php
}
?>
<tr>
<td><?php echo _('Maximum message size'); ?>:</td>
<td>
<input type="text" size="5" name="maxmsgsize"
value="<?php echo $row['maxmsgsize']; ?>" class="textfield">Kb
</td>
</tr>
<tr>
<td><?php echo _('Vacation on'); ?>:</td>
<td><input name="on_vacation" type="checkbox" <?php
if ($row['on_vacation'] == "1") {
print " checked ";
} ?>>
</td>
</tr>
<tr>
<?php if (function_exists('imap_qprint')) { ?>
<td><?php echo _('Vacation message'); ?>:</td>
<td>
<textarea name="vacation" cols="40" rows="5" class="textfield"><?php print imap_qprint($row['vacation']); ?></textarea>
</td>
<?php } else { ?>
<td><?php echo _('Vacation message (ASCII only!)'); ?>:</td>
<td>
<textarea name="vacation" cols="40" rows="5" class="textfield"><?php print $row['vacation']; ?></textarea>
</td>
<?php } ?>
</tr>
<tr><td><?php echo _("Forwarding enabled"); ?>:</td>
<td><input name="on_forward" type="checkbox"
<?php if($row['on_forward'] == "1") { print " checked "; } ?>>
</td></tr>
<tr><td><?php echo _("Forward mail to");?>:</td>
<td><input type="text" name="forward" value="<?php print $row['forward']; ?>" class="textfield"><br>
<?php echo _("Must be a full e-mail address"); ?>
</td></tr>
<tr><td><?php echo _("Store Forwarded Mail Locally");?>:</td>
<td><input name="unseen" type="checkbox"
<?php if($row['unseen'] == "1") { print " checked "; } ?>
</td></tr>
<tr><td></td><td class="button"><input name="submit" type="submit" value="<?php echo _("Submit Profile"); ?>"></td></tr>
</table>
</form>
<form name="blocklist" method="post" action="userblocksubmit.php">
<table align="center">
<tr><td><?php echo _("Add a new header blocking filter"); ?>:</td></tr>
<tr><td><select name="blockhdr" class="textfield">
<tr><td><?php echo _("Add a new header blocking filter"); ?>:</td></tr>
<tr><td><select name="blockhdr" class="textfield">
<option value="From"><?php echo _("From"); ?>:</option>
<option value="To"><?php echo _("To"); ?>:</option>
<option value="Subject"><?php echo _("Subject"); ?>:</option>
<option value="X-Mailer"><?php echo _("X-Mailer"); ?>:</option>
</select></td>
<td><input name="blockval" type="text" size="25" class="textfield">
<td><input name="blockval" type="text" size="25" class="textfield">
<input name="color" type="hidden" value="black"></td></tr>
<tr><td><input name="submit" type="submit" value="Submit"></td></tr>
<tr><td><input name="submit" type="submit" value="Submit"></td></tr>
</table>
</form>
<table align="center">
<tr><th><?php echo _("Delete"); ?></th><th><?php echo _("Blocked Header"); ?></th><th><?php echo _("Content"); ?></th></tr>
<tr><th><?php echo _("Delete"); ?></th><th><?php echo _("Blocked Header"); ?></th><th><?php echo _("Content"); ?></th></tr>
<?php if ($blocksuccess) {
while ($blockrow = $blocksth->fetch()) {
print "<tr><td><a href=\"userblocksubmit.php?action=delete&block_id={$blockrow['block_id']}\"><img style=\"border:0;width:10px;height:16px\" title=\"Delete\" src=\"images/trashcan.gif\" alt=\"trashcan\"></a></td>";
Expand Down
4 changes: 2 additions & 2 deletions vexim/userchangesubmit.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
sa_refuse=:sa_refuse, on_vacation=:on_vacation,
vacation=:vacation, on_forward=:on_forward,
forward=:forward, maxmsgsize=:maxmsgsize,
unseen=:unseen
unseen=:unseen, spam_drop=:spam_drop
WHERE user_id=:user_id";
$sth = $dbh->prepare($query);
$success = $sth->execute(array(':on_avscan'=>$_POST['on_avscan'],
Expand All @@ -65,7 +65,7 @@
':vacation'=>$vacation,
':on_forward'=>$_POST['on_forward'], ':forward'=>$_POST['forward'],
':maxmsgsize'=>$_POST['maxmsgsize'], ':unseen'=>$_POST['unseen'],
':user_id'=>$_SESSION['user_id']
':spam_drop'=>$_POST['spam_drop'],':user_id'=>$_SESSION['user_id']
));
if ($success) {
if (strlen($_POST['vacation']) > $max_vacation_length)
Expand Down

0 comments on commit 3f46dcd

Please sign in to comment.