Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • smradius/smradius
  • centiva-shail/smradius
  • nkukard/smradius
3 results
Show changes
Showing
with 0 additions and 5489 deletions
<?php
# Module: AccessControl
# Copyright (C) 2008, LinuxRulz
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
include_once("includes/header.php");
include_once("includes/footer.php");
include_once("includes/db.php");
$db = connect_db();
printHeader(array(
));
# If we have no action, display list
if (!isset($_POST['frmaction']))
{
?>
<p class="pageheader">Access Control List</p>
<form id="main_form" action="accesscontrol-main.php" method="post">
<div class="textcenter">
Action
<select id="main_form_action" name="frmaction"
onchange="
var myform = document.getElementById('main_form');
var myobj = document.getElementById('main_form_action');
if (myobj.selectedIndex == 2) {
myform.action = 'accesscontrol-add.php';
} else if (myobj.selectedIndex == 4) {
myform.action = 'accesscontrol-change.php';
} else if (myobj.selectedIndex == 5) {
myform.action = 'accesscontrol-delete.php';
}
myform.submit();
">
<option selected="selected">select action</option>
<option disabled="disabled"> - - - - - - - - - - - </option>
<option value="add">Add</option>
<option disabled="disabled"> - - - - - - - - - - - </option>
<option value="change">Change</option>
<option value="delete">Delete</option>
</select>
</div>
<p />
<table class="results" style="width: 75%;">
<tr class="resultstitle">
<td id="noborder"></td>
<td class="textcenter">Policy</td>
<td class="textcenter">Name</td>
<td class="textcenter">Verdict</td>
<td class="textcenter">Data</td>
<td class="textcenter">Disabled</td>
</tr>
<?php
$sql = "
SELECT
${DB_TABLE_PREFIX}access_control.ID, ${DB_TABLE_PREFIX}access_control.Name,
${DB_TABLE_PREFIX}access_control.Verdict, ${DB_TABLE_PREFIX}access_control.Data,
${DB_TABLE_PREFIX}access_control.Disabled,
${DB_TABLE_PREFIX}policies.Name AS PolicyName
FROM
${DB_TABLE_PREFIX}access_control, ${DB_TABLE_PREFIX}policies
WHERE
${DB_TABLE_PREFIX}policies.ID = ${DB_TABLE_PREFIX}access_control.PolicyID
ORDER BY
${DB_TABLE_PREFIX}policies.Name
";
$res = $db->query($sql);
while ($row = $res->fetchObject()) {
?>
<tr class="resultsitem">
<td><input type="radio" name="accesscontrol_id" value="<?php echo $row->id ?>" /></td>
<td><?php echo $row->policyname ?></td>
<td><?php echo $row->name ?></td>
<td><?php echo $row->verdict ?></td>
<td><?php echo $row->data ?></td>
<td class="textcenter"><?php echo $row->disabled ? 'yes' : 'no' ?></td>
</tr>
<?php
}
$res->closeCursor();
?>
</table>
</form>
<?php
}
printFooter();
# vim: ts=4
?>
<?php
# Module: Accounting add
# Copyright (C) 2008, LinuxRulz
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
include_once("includes/header.php");
include_once("includes/footer.php");
include_once("includes/db.php");
include_once("includes/tooltips.php");
$db = connect_db();
printHeader(array(
"Tabs" => array(
"Back to accounting" => "accounting-main.php"
),
));
if ($_POST['frmaction'] == "add") {
?>
<p class="pageheader">Add Accounting</p>
<form method="post" action="accounting-add.php">
<div>
<input type="hidden" name="frmaction" value="add2" />
</div>
<table class="entry">
<tr>
<td class="entrytitle">Name</td>
<td><input type="text" name="accounting_name" /></td>
</tr>
<tr>
<td class="entrytitle">Link to policy</td>
<td>
<select name="accounting_policyid">
<?php
$res = $db->query("SELECT ID, Name FROM ${DB_TABLE_PREFIX}policies ORDER BY Name");
while ($row = $res->fetchObject()) {
?>
<option value="<?php echo $row->id ?>"><?php echo $row->name ?></option>
<?php
}
$res->closeCursor();
?>
</select>
</td>
</tr>
<tr>
<td class="entrytitle">Track</td>
<td>
<select id="accounting_track" name="accounting_track"
onchange="
var myobj = document.getElementById('accounting_track');
var myobj2 = document.getElementById('accounting_trackextra');
if (myobj.selectedIndex == 0) {
myobj2.disabled = false;
myobj2.value = '/32';
} else if (myobj.selectedIndex != 0) {
myobj2.disabled = true;
myobj2.value = 'n/a';
}
">
<option value="SenderIP">Sender IP</option>
<option value="Sender:user@domain" selected="selected">Sender:user@domain</option>
<option value="Sender:@domain">Sender:@domain</option>
<option value="Sender:user@">Sender:user@</option>
<option value="Recipient:user@domain">Recipient:user@domain</option>
<option value="Recipient:@domain">Recipient:@domain</option>
<option value="Recipient:user@">Recipient:user@</option>
<option value="SASLUsername">SASLUsername:username</option>
<option value="Policy">Policy</option>
</select>
<input type="text" id="accounting_trackextra" name="accounting_trackextra" size="18" value="n/a" disabled="disabled" />
</td>
</tr>
<tr>
<td class="entrytitle">Period</td>
<td>
<select name="accounting_period">
<option value="0">Daily</option>
<option value="1">Weekly</option>
<option value="2">Monthly</option>
</select>
</td>
</tr>
<tr>
<td class="entrytitle">Message Count Limit</td>
<td><input type="text" name="accounting_messagecountlimit" /></td>
</tr>
<tr>
<td class="entrytitle">Message Cumulative Size Limit</td>
<td><input type="text" name="accounting_messagecumulativesizelimit" />Kbyte</td>
</tr>
<tr>
<td class="entrytitle">
Verdict
</td>
<td>
<select name="accounting_verdict">
<option value="">None</option>
<option value="HOLD">Hold</option>
<option value="REJECT">Reject</option>
<option value="DISCARD">Discard (drop)</option>
<option value="FILTER">Filter</option>
<option value="REDIRECT">Redirect</option>
</select>
</td>
</tr>
<tr>
<td class="entrytitle">
Data
</td>
<td><input type="text" name="accounting_data" /></td>
</tr>
<tr>
<td class="entrytitle">Stop processing here</td>
<td>
<select name="accounting_lastaccounting">
<option value="0">No</option>
<option value="1">Yes</option>
</select>
</td>
</tr>
<tr>
<td class="entrytitle">Comment</td>
<td><textarea name="accounting_comment" cols="40" rows="5"></textarea></td>
</tr>
<tr>
<td colspan="2">
<input type="submit" />
</td>
</tr>
</table>
</form>
<?php
# Check we have all params
} elseif ($_POST['frmaction'] == "add2") {
?>
<p class="pageheader">Accounting Add Results</p>
<?php
# Check name
if (empty($_POST['accounting_policyid'])) {
?>
<div class="warning">Policy ID cannot be empty</div>
<?php
# Check name
} elseif (empty($_POST['accounting_name'])) {
?>
<div class="warning">Name cannot be empty</div>
<?php
# Check accounting track
} elseif (empty($_POST['accounting_track'])) {
?>
<div class="warning">Track cannot be empty</div>
<?php
# Check last accounting
} elseif (!isset($_POST['accounting_lastaccounting'])) {
?>
<div class="warning">Stop procesing here field cannot be empty</div>
<?php
} else {
$stmt = $db->prepare("
INSERT INTO ${DB_TABLE_PREFIX}accounting
(
PolicyID, Name, Track, AccountingPeriod,
MessageCountLimit, MessageCumulativeSizeLimit,
Verdict, Data,
LastAccounting,
Comment, Disabled
)
VALUES
(?,?,?,?,?,?,?,?,?,?,1)");
$res = $stmt->execute(array(
$_POST['accounting_policyid'],
$_POST['accounting_name'],
$_POST['accounting_track'],
$_POST['accounting_period'],
$_POST['accounting_messagecountlimit'],
$_POST['accounting_messagecumulativesize'],
$_POST['accounting_verdict'],
$_POST['accounting_data'],
$_POST['accounting_lastaccounting'],
$_POST['accounting_comment']
));
if ($res) {
?>
<div class="notice">Accounting created</div>
<?php
} else {
?>
<div class="warning">Failed to create accounting</div>
<div class="warning"><?php print_r($stmt->errorInfo()) ?></div>
<?php
}
}
} else {
?>
<div class="warning">Invalid invocation</div>
<?php
}
printFooter();
# vim: ts=4
?>
<?php
# Module: Accounting change
# Copyright (C) 2008, LinuxRulz
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
include_once("includes/header.php");
include_once("includes/footer.php");
include_once("includes/db.php");
include_once("includes/tooltips.php");
$db = connect_db();
printHeader(array(
"Tabs" => array(
"Back to accounting" => "accounting-main.php"
),
));
# Display change screen
if ($_POST['frmaction'] == "change") {
# Check a accounting was selected
if (isset($_POST['accounting_id'])) {
# Prepare statement
$stmt = $db->prepare("
SELECT
${DB_TABLE_PREFIX}accounting.ID, ${DB_TABLE_PREFIX}accounting.PolicyID, ${DB_TABLE_PREFIX}accounting.Name,
${DB_TABLE_PREFIX}accounting.Track, ${DB_TABLE_PREFIX}accounting.AccountingPeriod,
${DB_TABLE_PREFIX}accounting.MessageCountLimit, ${DB_TABLE_PREFIX}accounting.MessageCumulativeSizeLimit,
${DB_TABLE_PREFIX}accounting.Verdict, ${DB_TABLE_PREFIX}accounting.Data,
${DB_TABLE_PREFIX}accounting.LastAccounting,
${DB_TABLE_PREFIX}accounting.Comment,
${DB_TABLE_PREFIX}accounting.Disabled,
${DB_TABLE_PREFIX}policies.Name AS PolicyName
FROM
${DB_TABLE_PREFIX}accounting, ${DB_TABLE_PREFIX}policies
WHERE
${DB_TABLE_PREFIX}accounting.ID = ?
AND ${DB_TABLE_PREFIX}policies.ID = ${DB_TABLE_PREFIX}accounting.PolicyID
");
?>
<p class="pageheader">Update Accounting</p>
<form action="accounting-change.php" method="post">
<div>
<input type="hidden" name="frmaction" value="change2" />
<input type="hidden" name="accounting_id" value="<?php echo $_POST['accounting_id']; ?>" />
</div>
<?php
$res = $stmt->execute(array($_POST['accounting_id']));
$row = $stmt->fetchObject();
$stmt->closeCursor();
?>
<table class="entry" style="width: 75%;">
<tr>
<td></td>
<td class="entrytitle textcenter">Old Value</td>
<td class="entrytitle textcenter">New Value</td>
</tr>
<tr>
<td class="entrytitle">Name</td>
<td class="oldval"><?php echo $row->name ?></td>
<td><input type="text" name="accounting_name" /></td>
</tr>
<tr>
<td class="entrytitle">Link to policy</td>
<td class="oldval"><?php echo $row->policyname ?></td>
<td>
<select name="accounting_policyid">
<option value="">--</option>
<?php
$res = $db->query("SELECT ID, Name FROM ${DB_TABLE_PREFIX}policies ORDER BY Name");
while ($row2 = $res->fetchObject()) {
?>
<option value="<?php echo $row2->id ?>" ><?php echo $row2->name ?></option>
<?php
}
?>
</select>
</td>
</tr>
<tr>
<td class="entrytitle">Track</td>
<td class="oldval"><?php echo $row->track ?></td>
<td>
<select id="accounting_track" name="accounting_track"
onChange="
var myobj = document.getElementById('accounting_track');
var myobj2 = document.getElementById('accounting_trackextra');
if (myobj.selectedIndex == 1) {
myobj2.disabled = false;
myobj2.value = '0.0.0.0/0';
} else if (myobj.selectedIndex != 1) {
myobj2.disabled = true;
myobj2.value = 'n/a';
}
">
<option value="">--</option>
<option value="SenderIP">Sender IP</option>
<option value="Sender:user@domain">Sender:user@domain</option>
<option value="Sender:@domain">Sender:@domain</option>
<option value="Sender:user@">Sender:user@</option>
<option value="Recipient:user@domain">Recipient:user@domain</option>
<option value="Recipient:@domain">Recipient:@domain</option>
<option value="Recipient:user@">Recipient:user@</option>
<option value="SASLUsername">SASLUsername:username</option>
<option value="Policy">Policy</option>
</select>
<input type="text" id="accounting_trackextra" name="accounting_trackextra" size="18" value="n/a" disabled="disabled" />
</td>
</tr>
<tr>
<?php
# Get human readable accounting period
if ($row->accountingperiod == "0") {
$accountingperiod = "Daily";
} elseif ($row->accountingperiod == "1") {
$accountingperiod = "Weekly";
} elseif ($row->accountingperiod == "2") {
$accountingperiod = "Monthly";
}
?>
<td class="entrytitle">Period</td>
<td class="oldval"><?php echo $accountingperiod ?></td>
<td>
<select id="accounting_period" name="accounting_period">
<option value="">--</option>
<option value="0">Daily</option>
<option value="1">Weekly</option>
<option value="2">Monthly</option>
</select>
</td>
</tr>
<tr>
<td class="entrytitle">Message Count Limit</td>
<td class="oldval"><?php echo $row->messagecountlimit ? $row->messagecountlimit : '-none-' ?></td>
<td><input type="text" name="accounting_messagecountlimit" /></td>
</tr>
<tr>
<td class="entrytitle">Message Cumulative Size Limit</td>
<td class="oldval"><?php echo $row->messagecumulativesizelimit ? $row->messagecumulativesizelimit : '-none-' ?></td>
<td><input type="text" name="accounting_messagecumulativesizelimit" />Kbyte</td>
</tr>
<tr>
<td class="entrytitle">
Verdict
</td>
<td class="oldval"><?php echo $row->verdict ?></td>
<td>
<select name="accounting_verdict">
<option value="">--</option>
<option value="HOLD">Hold</option>
<option value="REJECT">Reject</option>
<option value="DISCARD">Discard (drop)</option>
<option value="FILTER">Filter</option>
<option value="REDIRECT">Redirect</option>
</select>
</td>
</tr>
<tr>
<td class="entrytitle">
Data
</td>
<td class="oldval"><?php echo $row->data ?></td>
<td><input type="text" name="accounting_data" /></td>
</tr>
<tr>
<td class="entrytitle">Stop processing here</td>
<td class="oldval"><?php echo $row->lastaccounting ? 'yes' : 'no' ?></td>
<td>
<select name="accounting_lastaccounting">
<option value="">--</option>
<option value="0">No</option>
<option value="1">Yes</option>
</select>
</td>
</tr>
<tr>
<td class="entrytitle texttop">Comment</td>
<td class="oldval texttop"><?php echo $row->comment ?></td>
<td><textarea name="accounting_comment" cols="40" rows="5"></textarea></td>
</tr>
<tr>
<td class="entrytitle">Disabled</td>
<td class="oldval"><?php echo $row->disabled ? 'yes' : 'no' ?></td>
<td>
<select name="accounting_disabled">
<option value="">--</option>
<option value="0">No</option>
<option value="1">Yes</option>
</select>
</td>
</tr>
</table>
<p />
<div class="textcenter">
<input type="submit" />
</div>
</form>
<?php
} else {
?>
<div class="warning">No accounting selected</div>
<?php
}
# SQL Updates
} elseif ($_POST['frmaction'] == "change2") {
?>
<p class="pageheader">Accounting Update Results</p>
<?
$updates = array();
if (!empty($_POST['accounting_policyid'])) {
array_push($updates,"PolicyID = ".$db->quote($_POST['accounting_policyid']));
}
if (!empty($_POST['accounting_name'])) {
array_push($updates,"Name = ".$db->quote($_POST['accounting_name']));
}
if (!empty($_POST['accounting_track'])) {
array_push($updates,"Track = ".$db->quote($_POST['accounting_track']));
}
if (isset($_POST['accounting_period']) && $_POST['accounting_period'] != "") {
array_push($updates,"AccountingPeriod = ".$db->quote($_POST['accounting_period']));
}
if (!empty($_POST['accounting_messagecountlimit'])) {
array_push($updates,"MessageCountLimit = ".$db->quote($_POST['accounting_messagecountlimit']));
}
if (!empty($_POST['accounting_messagecumulativesizelimit'])) {
array_push($updates,"MessageCumulativeSizeLimit = ".$db->quote($_POST['accounting_messagecumulativesizelimit']));
}
if (!empty($_POST['accounting_verdict'])) {
array_push($updates,"Verdict = ".$db->quote($_POST['accounting_verdict']));
}
if (!empty($_POST['accounting_data'])) {
array_push($updates,"Data = ".$db->quote($_POST['accounting_data']));
}
if (!empty($_POST['accounting_lastaccounting'])) {
array_push($updates,"LastAccounting = ".$db->quote($_POST['accounting_lastaccounting']));
}
if (!empty($_POST['accounting_comment'])) {
array_push($updates,"Comment = ".$db->quote($_POST['accounting_comment']));
}
if (isset($_POST['accounting_disabled']) && $_POST['accounting_disabled'] != "") {
array_push($updates ,"Disabled = ".$db->quote($_POST['accounting_disabled']));
}
# Check if we have updates
if (sizeof($updates) > 0) {
$updateStr = implode(', ',$updates);
$res = $db->exec("UPDATE ${DB_TABLE_PREFIX}accounting SET $updateStr WHERE ID = ".$db->quote($_POST['accounting_id']));
if ($res) {
?>
<div class="notice">Accounting updated</div>
<?php
} else {
?>
<div class="warning">Error updating accounting!</div>
<div class="warning"><?php print_r($db->errorInfo()) ?></div>
<?php
}
} else {
?>
<div class="warning">No changes made to accounting</div>
<?php
}
} else {
?>
<div class="warning">Invalid invocation</div>
<?php
}
printFooter();
# vim: ts=4
?>
<?php
# Module: Accounting delete
# Copyright (C) 2008, LinuxRulz
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
include_once("includes/header.php");
include_once("includes/footer.php");
include_once("includes/db.php");
$db = connect_db();
printHeader(array(
"Tabs" => array(
"Back to accounting" => "accounting-main.php",
),
));
# Display delete confirm screen
if ($_POST['frmaction'] == "delete") {
# Check a accounting was selected
if (isset($_POST['accounting_id'])) {
?>
<p class="pageheader">Delete Accounting</p>
<form action="accounting-delete.php" method="post">
<div>
<input type="hidden" name="frmaction" value="delete2" />
<input type="hidden" name="accounting_id" value="<?php echo $_POST['accounting_id']; ?>" />
</div>
<div class="textcenter">
Are you very sure you want to remove this and its associated records? <br />
<input type="submit" name="confirm" value="yes" />
<input type="submit" name="confirm" value="no" />
</div>
</form>
<?php
} else {
?>
<div class="warning">No accounting selected</div>
<?php
}
# SQL Updates
} elseif ($_POST['frmaction'] == "delete2") {
?>
<p class="pageheader">Accounting Delete Results</p>
<?
if (isset($_POST['accounting_id'])) {
if ($_POST['confirm'] == "yes") {
# Check last query succeeded, if so continue
$db->beginTransaction();
$stmt = $db->prepare("
DELETE FROM
${DB_TABLE_PREFIX}accounting_tracking
WHERE
AccountingID = ?
");
$res = $stmt->execute(array($_POST['accounting_id']));
if ($res !== FALSE) {
?>
<div class="notice">Accounting tracking info deleted</div>
<?php
} else {
?>
<div class="warning">Error deleting accounting tracking info!</div>
<div class="warning"><?php print_r($db->errorInfo()) ?></div>
<?php
$db->rollBack();
}
if ($res !== FALSE) {
$res = $db->exec("DELETE FROM ${DB_TABLE_PREFIX}accounting WHERE ID = ".$db->quote($_POST['accounting_id']));
if ($res) {
?>
<div class="notice">Accounting deleted</div>
<?php
} else {
?>
<div class="warning">Error deleting accounting!</div>
<div class="warning"><?php print_r($db->errorInfo()) ?></div>
<?php
$db->rollBack();
}
}
# Commit if last transaction succeeded
if ($res) {
$db->commit();
}
} else {
?>
<div class="notice">Accounting not deleted, aborted by user</div>
<?php
}
# Warn
} else {
?>
<div class="warning">Invocation error, no accounting ID</div>
<?php
}
} else {
?>
<div class="warning">Invalid invocation</div>
<?php
}
printFooter();
# vim: ts=4
?>
<?php
# Module: Accounting
# Copyright (C) 2008, LinuxRulz
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
include_once("includes/header.php");
include_once("includes/footer.php");
include_once("includes/db.php");
$db = connect_db();
printHeader(array(
));
# If we have no action, display list
if (!isset($_POST['frmaction']))
{
?>
<p class="pageheader">Accounting</p>
<form id="main_form" action="accounting-main.php" method="post">
<div class="textcenter">
Action
<select id="main_form_action" name="frmaction"
onchange="
var myform = document.getElementById('main_form');
var myobj = document.getElementById('main_form_action');
if (myobj.selectedIndex == 2) {
myform.action = 'accounting-add.php';
} else if (myobj.selectedIndex == 4) {
myform.action = 'accounting-change.php';
} else if (myobj.selectedIndex == 5) {
myform.action = 'accounting-delete.php';
}
myform.submit();
">
<option selected="selected">select action</option>
<option disabled="disabled"> - - - - - - - - - - - </option>
<option value="add">Add</option>
<option disabled="disabled"> - - - - - - - - - - - </option>
<option value="change">Change</option>
<option value="delete">Delete</option>
</select>
</div>
<p />
<table class="results" style="width: 75%;">
<tr class="resultstitle">
<td id="noborder"></td>
<td class="textcenter">Policy</td>
<td class="textcenter">Name</td>
<td class="textcenter">Track</td>
<td class="textcenter">Period</td>
<td class="textcenter">Count Limit</td>
<td class="textcenter">Cumulative Size Limit</td>
<td class="textcenter">Verdict</td>
<td class="textcenter">Data</td>
<td class="textcenter">Disabled</td>
</tr>
<?php
$sql = "
SELECT
${DB_TABLE_PREFIX}accounting.ID, ${DB_TABLE_PREFIX}accounting.Name,
${DB_TABLE_PREFIX}accounting.Track, ${DB_TABLE_PREFIX}accounting.AccountingPeriod,
${DB_TABLE_PREFIX}accounting.MessageCountLimit,
${DB_TABLE_PREFIX}accounting.MessageCumulativeSizeLimit,
${DB_TABLE_PREFIX}accounting.Verdict, ${DB_TABLE_PREFIX}accounting.Data, ${DB_TABLE_PREFIX}accounting.Disabled,
${DB_TABLE_PREFIX}policies.Name AS PolicyName
FROM
${DB_TABLE_PREFIX}accounting, ${DB_TABLE_PREFIX}policies
WHERE
${DB_TABLE_PREFIX}policies.ID = ${DB_TABLE_PREFIX}accounting.PolicyID
ORDER BY
${DB_TABLE_PREFIX}policies.Name
";
$res = $db->query($sql);
while ($row = $res->fetchObject()) {
# Get human readable ${DB_TABLE_PREFIX}accounting period
if ($row->accountingperiod == "0") {
$accountingperiod = "Daily";
} elseif ($row->accountingperiod == "1") {
$accountingperiod = "Weekly";
} elseif ($row->accountingperiod == "2") {
$accountingperiod = "Monthly";
}
?>
<tr class="resultsitem">
<td><input type="radio" name="accounting_id" value="<?php echo $row->id ?>" /></td>
<td><?php echo $row->policyname ?></td>
<td><?php echo $row->name ?></td>
<td><?php echo $row->track ?></td>
<td><?php echo $accountingperiod ?></td>
<td><?php echo !empty($row->messagecountlimit) ? $row->messagecountlimit : '-' ?></td>
<td><?php echo !empty($row->messagecumulativesizelimit) ? $row->messagecumulativesizelimit : '-' ?></td>
<td><?php echo $row->verdict ?></td>
<td><?php echo $row->data ?></td>
<td class="textcenter"><?php echo $row->disabled ? 'yes' : 'no' ?></td>
</tr>
<?php
}
$res->closeCursor();
?>
</table>
</form>
<?php
}
printFooter();
# vim: ts=4
?>
<?php
# Module: Amavis add
# Copyright (C) 2008, LinuxRulz
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
include_once("includes/header.php");
include_once("includes/footer.php");
include_once("includes/db.php");
include_once("includes/tooltips.php");
$db = connect_db();
printHeader(array(
"Tabs" => array(
"Back to Amavis" => "amavis-main.php"
),
));
# Process an option
function process_post_option($option) {
$results = array();
# Inherit
if ($option == 0) {
array_push($results,NULL);
array_push($results,0);
# Explicit yes
} elseif ($option == 1) {
array_push($results,1);
array_push($results,2);
# Explicit no
} elseif ($option == 2) {
array_push($results,0);
array_push($results,2);
}
return $results;
};
# Process a value
function process_post_value($option,$value) {
$results = array();
# Inherit
if ($option == 0) {
array_push($results,NULL);
array_push($results,0);
# Override
} elseif ($option == 2) {
array_push($results,$value);
array_push($results,2);
}
return $results;
};
# Process a list of items
function process_post_list($option,$value) {
$results = array();
# Inherit
if ($option == 0) {
array_push($results,NULL);
array_push($results,0);
# Merge
} elseif ($option == 1) {
array_push($results,$value);
array_push($results,1);
# Override
} elseif ($option == 2) {
array_push($results,$value);
array_push($results,2);
}
return $results;
};
if ($_POST['frmaction'] == "add") {
?>
<p class="pageheader">Add Amavis Rule</p>
<form method="post" action="amavis-add.php">
<div>
<input type="hidden" name="frmaction" value="add2" />
</div>
<table class="entry">
<tr>
<td class="entrytitle">Name</td>
<td><input type="text" name="amavis_name" /></td>
</tr>
<tr>
<td class="entrytitle">Link to policy</td>
<td>
<select name="amavis_policyid">
<?php
$res = $db->query("SELECT ID, Name FROM ${DB_TABLE_PREFIX}policies ORDER BY Name");
while ($row = $res->fetchObject()) {
?>
<option value="<?php echo $row->id ?>"><?php echo $row->name ?></option>
<?php
}
$res->closeCursor();
?>
</select>
</td>
</tr>
<tr>
<td colspan="2" class="textcenter" style="border-bottom: 1px dashed black;">Bypass Checks</td>
</tr>
<tr>
<td class="entrytitle">
Virus
<?php tooltip('amavis_bypass_virus_checks'); ?>
</td>
<td>
<select name="amavis_bypass_virus_checks">
<option value="0" selected="selected">Inherit</option>
<option value="1">Yes</option>
<option value="2">No</option>
</select>
</td>
</tr>
<tr>
<td class="entrytitle">
Banned File
<?php tooltip('amavis_bypass_banned_checks'); ?>
</td>
<td>
<select name="amavis_bypass_banned_checks">
<option value="0" selected="selected">Inherit</option>
<option value="1">Yes</option>
<option value="2">No</option>
</select>
</td>
</tr>
<tr>
<td class="entrytitle">
Spam
<?php tooltip('amavis_bypass_spam_checks'); ?>
</td>
<td>
<select name="amavis_bypass_spam_checks">
<option value="0" selected="selected">Inherit</option>
<option value="1">Yes</option>
<option value="2">No</option>
</select>
</td>
</tr>
<tr>
<td class="entrytitle">
Header
<?php tooltip('amavis_bypass_header_checks'); ?>
</td>
<td>
<select name="amavis_bypass_header_checks">
<option value="0" selected="selected">Inherit</option>
<option value="1">Yes</option>
<option value="2">No</option>
</select>
</td>
</tr>
<tr>
<td colspan="2" class="textcenter" style="border-bottom: 1px dashed black;">Anti-spam Settings</td>
</tr>
<tr>
<td class="entrytitle">
Tag Level
<?php tooltip('amavis_spam_tag_level'); ?>
</td>
<td>
<select name="amavis_spam_tag_level_mode" id="amavis_spam_tag_level_mode"
onchange="
var myobjs = document.getElementById('amavis_spam_tag_level_mode');
var myobji = document.getElementById('amavis_spam_tag_level');
if (myobjs.selectedIndex == 0) {
myobji.disabled = true;
myobji.value = 'n/a';
} else if (myobjs.selectedIndex != 0) {
myobji.disabled = false;
myobji.value = '0.0';
}
">
<option value="0" selected="selected">Inherit</option>
<option value="2">Override</option>
</select>
<input type="text" name="amavis_spam_tag_level" size="6" id="amavis_spam_tag_level" disabled="disabled" value="n/a" />
</td>
</tr>
<tr>
<td class="entrytitle">
Tag2 Level
<?php tooltip('amavis_spam_tag2_level'); ?>
</td>
<td>
<select name="amavis_spam_tag2_level_mode" id="amavis_spam_tag2_level_mode"
onchange="
var myobjs = document.getElementById('amavis_spam_tag2_level_mode');
var myobji = document.getElementById('amavis_spam_tag2_level');
if (myobjs.selectedIndex == 0) {
myobji.disabled = true;
myobji.value = 'n/a';
} else if (myobjs.selectedIndex != 0) {
myobji.disabled = false;
myobji.value = '5.0';
}
">
<option value="0" selected="selected">Inherit</option>
<option value="2">Override</option>
</select>
<input type="text" name="amavis_spam_tag2_level" size="6" id="amavis_spam_tag2_level" disabled="disabled" value="n/a" />
</td>
</tr>
<tr>
<td class="entrytitle">
Tag3 Level
<?php tooltip('amavis_spam_tag3_level'); ?>
</td>
<td>
<select name="amavis_spam_tag3_level_mode" id="amavis_spam_tag3_level_mode"
onchange="
var myobjs = document.getElementById('amavis_spam_tag3_level_mode');
var myobji = document.getElementById('amavis_spam_tag3_level');
if (myobjs.selectedIndex == 0) {
myobji.disabled = true;
myobji.value = 'n/a';
} else if (myobjs.selectedIndex != 0) {
myobji.disabled = false;
myobji.value = '7.5';
}
">
<option value="0" selected="selected">Inherit</option>
<option value="2">Override</option>
</select>
<input type="text" name="amavis_spam_tag3_level" size="6" id="amavis_spam_tag3_level" disabled="disabled" value="n/a" />
</td>
</tr>
<tr>
<td class="entrytitle">
Kill Level
<?php tooltip('amavis_spam_kill_level'); ?>
</td>
<td>
<select name="amavis_spam_kill_level_mode" id="amavis_spam_kill_level_mode"
onchange="
var myobjs = document.getElementById('amavis_spam_kill_level_mode');
var myobji = document.getElementById('amavis_spam_kill_level');
if (myobjs.selectedIndex == 0) {
myobji.disabled = true;
myobji.value = 'n/a';
} else if (myobjs.selectedIndex != 0) {
myobji.disabled = false;
myobji.value = '7.5';
}
">
<option value="0" selected="selected">Inherit</option>
<option value="2">Override</option>
</select>
<input type="text" name="amavis_spam_kill_level" size="6" id="amavis_spam_kill_level" disabled="disabled" value="n/a" />
</td>
</tr>
<tr>
<td class="entrytitle">
DSN Cutoff Level
<?php tooltip('amavis_spam_dsn_cutoff_level'); ?>
</td>
<td>
<select name="amavis_spam_dsn_cutoff_level_mode" id="amavis_spam_dsn_cutoff_level_mode"
onchange="
var myobjs = document.getElementById('amavis_spam_dsn_cutoff_level_mode');
var myobji = document.getElementById('amavis_spam_dsn_cutoff_level');
if (myobjs.selectedIndex == 0) {
myobji.disabled = true;
myobji.value = 'n/a';
} else if (myobjs.selectedIndex != 0) {
myobji.disabled = false;
myobji.value = '7.5';
}
">
<option value="0" selected="selected">Inherit</option>
<option value="2">Override</option>
</select>
<input type="text" name="amavis_spam_dsn_cutoff_level" size="6" id="amavis_spam_dsn_cutoff_level" disabled="disabled" value="n/a" />
</td>
</tr>
<tr>
<td class="entrytitle">
Quarantine Cutoff Level
<?php tooltip('amavis_spam_quarantine_cutoff_level'); ?>
</td>
<td>
<select name="amavis_spam_quarantine_cutoff_level_mode" id="amavis_spam_quarantine_cutoff_level_mode"
onchange="
var myobjs = document.getElementById('amavis_spam_quarantine_cutoff_level_mode');
var myobji = document.getElementById('amavis_spam_quarantine_cutoff_level');
if (myobjs.selectedIndex == 0) {
myobji.disabled = true;
myobji.value = 'n/a';
} else if (myobjs.selectedIndex != 0) {
myobji.disabled = false;
myobji.value = '15.0';
}
">
<option value="0" selected="selected">Inherit</option>
<option value="2">Override</option>
</select>
<input type="text" name="amavis_spam_quarantine_cutoff_level" size="6" id="amavis_spam_quarantine_cutoff_level"
disabled="disabled" value="n/a" />
</td>
</tr>
<tr>
<td class="entrytitle">
Modify Subject
<?php tooltip('amavis_spam_modifies_subject'); ?>
</td>
<td>
<select name="amavis_spam_modifies_subject">
<option value="0" selected="selected">Inherit</option>
<option value="1">Yes</option>
<option value="2">No</option>
</select>
</td>
</tr>
<tr>
<td class="entrytitle">
Tag Subject
<?php tooltip('amavis_spam_tag_subject'); ?>
</td>
<td>
<select name="amavis_spam_tag_subject_mode" id="amavis_spam_tag_subject_mode"
onchange="
var myobjs = document.getElementById('amavis_spam_tag_subject_mode');
var myobji = document.getElementById('amavis_spam_tag_subject');
if (myobjs.selectedIndex == 0) {
myobji.disabled = true;
myobji.value = 'n/a';
} else if (myobjs.selectedIndex != 0) {
myobji.disabled = false;
myobji.value = '';
}
">
<option value="0" selected="selected">Inherit</option>
<option value="2">Override</option>
</select>
<input type="text" name="amavis_spam_tag_subject" id="amavis_spam_tag_subject"
disabled="disabled" value="n/a" />
</td>
</tr>
<tr>
<td class="entrytitle">
Tag2 Subject
<?php tooltip('amavis_spam_tag2_subject'); ?>
</td>
<td>
<select name="amavis_spam_tag2_subject_mode" id="amavis_spam_tag2_subject_mode"
onchange="
var myobjs = document.getElementById('amavis_spam_tag2_subject_mode');
var myobji = document.getElementById('amavis_spam_tag2_subject');
if (myobjs.selectedIndex == 0) {
myobji.disabled = true;
myobji.value = 'n/a';
} else if (myobjs.selectedIndex != 0) {
myobji.disabled = false;
myobji.value = '';
}
">
<option value="0" selected="selected">Inherit</option>
<option value="2">Override</option>
</select>
<input type="text" name="amavis_spam_tag2_subject" id="amavis_spam_tag2_subject"
disabled="disabled" value="n/a" />
</td>
</tr>
<tr>
<td class="entrytitle">
Tag3 Subject
<?php tooltip('amavis_spam_tag3_subject'); ?>
</td>
<td>
<select name="amavis_spam_tag3_subject_mode" id="amavis_spam_tag3_subject_mode"
onchange="
var myobjs = document.getElementById('amavis_spam_tag3_subject_mode');
var myobji = document.getElementById('amavis_spam_tag3_subject');
if (myobjs.selectedIndex == 0) {
myobji.disabled = true;
myobji.value = 'n/a';
} else if (myobjs.selectedIndex != 0) {
myobji.disabled = false;
myobji.value = '';
}
">
<option value="0" selected="selected">Inherit</option>
<option value="2">Override</option>
</select>
<input type="text" name="amavis_spam_tag3_subject" id="amavis_spam_tag3_subject"
disabled="disabled" value="n/a" />
</td>
</tr>
<tr>
<td colspan="2" class="textcenter" style="border-bottom: 1px dashed black;">General Checks</td>
</tr>
<tr>
<td class="entrytitle">
Max Message Size (in Kbyte)
<?php tooltip('amavis_max_message_size'); ?>
</td>
<td>
<select name="amavis_max_message_size_mode" id="amavis_max_message_size_mode"
onchange="
var myobjs = document.getElementById('amavis_max_message_size_mode');
var myobji = document.getElementById('amavis_max_message_size');
if (myobjs.selectedIndex == 0) {
myobji.disabled = true;
myobji.value = 'n/a';
} else if (myobjs.selectedIndex != 0) {
myobji.disabled = false;
myobji.value = '';
}
">
<option value="0" selected="selected">Inherit</option>
<option value="2">Override</option>
</select>
<input type="text" name="amavis_max_message_size" id="amavis_max_message_size"
disabled="disabled" value="n/a" />
</td>
</tr>
<tr>
<td class="entrytitle texttop">
Banned Files
<?php tooltip('amavis_banned_files'); ?>
</td>
<td class="texttop">
<select name="amavis_banned_files_mode" id="amavis_banned_files_mode"
onchange="
var myobjs = document.getElementById('amavis_banned_files_mode');
var myobji = document.getElementById('amavis_banned_files');
if (myobjs.selectedIndex == 0) {
myobji.disabled = true;
myobji.value = 'n/a';
} else if (myobjs.selectedIndex != 0) {
myobji.disabled = false;
myobji.value = '';
}
">
<option value="0" selected="selected">Inherit</option>
<option value="1">Merge</option>
<option value="2">Override</option>
</select>
<br />
<textarea name="amavis_banned_files" id="amavis_banned_files" disabled="disabled" cols="40" rows="5">n/a</textarea>
</td>
</tr>
<tr>
<td colspan="2" class="textcenter" style="border-bottom: 1px dashed black;">Whitelist &amp; Blacklist</td>
</tr>
<tr>
<td class="entrytitle texttop">
Sender Whitelist
<?php tooltip('amavis_sender_whitelist'); ?>
</td>
<td class="texttop">
<select name="amavis_sender_whitelist_mode" id="amavis_sender_whitelist_mode"
onchange="
var myobjs = document.getElementById('amavis_sender_whitelist_mode');
var myobji = document.getElementById('amavis_sender_whitelist');
if (myobjs.selectedIndex == 0) {
myobji.disabled = true;
myobji.value = 'n/a';
} else if (myobjs.selectedIndex != 0) {
myobji.disabled = false;
myobji.value = '';
}
">
<option value="0" selected="selected">Inherit</option>
<option value="1">Merge</option>
<option value="2">Override</option>
</select>
<br />
<textarea name="amavis_sender_whitelist" id="amavis_sender_whitelist" disabled="disabled" cols="40" rows="5">n/a</textarea>
</td>
</tr>
<tr>
<td class="entrytitle texttop">
Sender Blacklist
<?php tooltip('amavis_sender_blacklist'); ?>
</td>
<td class="texttop">
<select name="amavis_sender_blacklist_mode" id="amavis_sender_blacklist_mode"
onchange="
var myobjs = document.getElementById('amavis_sender_blacklist_mode');
var myobji = document.getElementById('amavis_sender_blacklist');
if (myobjs.selectedIndex == 0) {
myobji.disabled = true;
myobji.value = 'n/a';
} else if (myobjs.selectedIndex != 0) {
myobji.disabled = false;
myobji.value = '';
}
">
<option value="0" selected="selected">Inherit</option>
<option value="1">Merge</option>
<option value="2">Override</option>
</select>
<br />
<textarea name="amavis_sender_blacklist" id="amavis_sender_blacklist" disabled="disabled" cols="40" rows="5">n/a</textarea>
</td>
</tr>
<tr>
<td colspan="2" class="textcenter" style="border-bottom: 1px dashed black;">Admin Notifications</td>
</tr>
<tr>
<td class="entrytitle">
New Virus
<?php tooltip('amavis_notify_admin_newvirus'); ?>
</td>
<td>
<select name="amavis_notify_admin_newvirus_mode" id="amavis_notify_admin_newvirus_mode"
onchange="
var myobjs = document.getElementById('amavis_notify_admin_newvirus_mode');
var myobji = document.getElementById('amavis_notify_admin_newvirus');
if (myobjs.selectedIndex == 0) {
myobji.disabled = true;
myobji.value = 'n/a';
} else if (myobjs.selectedIndex != 0) {
myobji.disabled = false;
myobji.value = '';
}
">
<option value="0" selected="selected">Inherit</option>
<option value="2">Override</option>
</select>
<input type="text" name="amavis_notify_admin_newvirus" id="amavis_notify_admin_newvirus"
disabled="disabled" value="n/a" />
</td>
</tr>
<tr>
<td class="entrytitle">
Virus
<?php tooltip('amavis_notify_admin_virus'); ?>
</td>
<td>
<select name="amavis_notify_admin_virus_mode" id="amavis_notify_admin_virus_mode"
onchange="
var myobjs = document.getElementById('amavis_notify_admin_virus_mode');
var myobji = document.getElementById('amavis_notify_admin_virus');
if (myobjs.selectedIndex == 0) {
myobji.disabled = true;
myobji.value = 'n/a';
} else if (myobjs.selectedIndex != 0) {
myobji.disabled = false;
myobji.value = '';
}
">
<option value="0" selected="selected">Inherit</option>
<option value="2">Override</option>
</select>
<input type="text" name="amavis_notify_admin_virus" id="amavis_notify_admin_virus"
disabled="disabled" value="n/a" />
</td>
</tr>
<tr>
<td class="entrytitle">
Spam
<?php tooltip('amavis_notify_admin_spam'); ?>
</td>
<td>
<select name="amavis_notify_admin_spam_mode" id="amavis_notify_admin_spam_mode"
onchange="
var myobjs = document.getElementById('amavis_notify_admin_spam_mode');
var myobji = document.getElementById('amavis_notify_admin_spam');
if (myobjs.selectedIndex == 0) {
myobji.disabled = true;
myobji.value = 'n/a';
} else if (myobjs.selectedIndex != 0) {
myobji.disabled = false;
myobji.value = '';
}
">
<option value="0" selected="selected">Inherit</option>
<option value="2">Override</option>
</select>
<input type="text" name="amavis_notify_admin_spam" id="amavis_notify_admin_spam"
disabled="disabled" value="n/a" />
</td>
</tr>
<tr>
<td class="entrytitle">
Banned File
<?php tooltip('amavis_notify_admin_banned_file'); ?>
</td>
<td>
<select name="amavis_notify_admin_banned_file_mode" id="amavis_notify_admin_banned_file_mode"
onchange="
var myobjs = document.getElementById('amavis_notify_admin_banned_file_mode');
var myobji = document.getElementById('amavis_notify_admin_banned_file');
if (myobjs.selectedIndex == 0) {
myobji.disabled = true;
myobji.value = 'n/a';
} else if (myobjs.selectedIndex != 0) {
myobji.disabled = false;
myobji.value = '';
}
">
<option value="0" selected="selected">Inherit</option>
<option value="2">Override</option>
</select>
<input type="text" name="amavis_notify_admin_banned_file" id="amavis_notify_admin_banned_file"
disabled="disabled" value="n/a" />
</td>
</tr>
<tr>
<td class="entrytitle">
Bad Header
<?php tooltip('amavis_notify_admin_bad_header'); ?>
</td>
<td>
<select name="amavis_notify_admin_bad_header_mode" id="amavis_notify_admin_bad_header_mode"
onchange="
var myobjs = document.getElementById('amavis_notify_admin_bad_header_mode');
var myobji = document.getElementById('amavis_notify_admin_bad_header');
if (myobjs.selectedIndex == 0) {
myobji.disabled = true;
myobji.value = 'n/a';
} else if (myobjs.selectedIndex != 0) {
myobji.disabled = false;
myobji.value = '';
}
">
<option value="0" selected="selected">Inherit</option>
<option value="2">Override</option>
</select>
<input type="text" name="amavis_notify_admin_bad_header" id="amavis_notify_admin_bad_header"
disabled="disabled" value="n/a" />
</td>
</tr>
<tr>
<td colspan="2" class="textcenter" style="border-bottom: 1px dashed black;">Quarantine</td>
</tr>
<tr>
<td class="entrytitle">
Virus
<?php tooltip('amavis_quarantine_virus'); ?>
</td>
<td>
<select name="amavis_quarantine_virus_mode" id="amavis_quarantine_virus_mode"
onchange="
var myobjs = document.getElementById('amavis_quarantine_virus_mode');
var myobji = document.getElementById('amavis_quarantine_virus');
if (myobjs.selectedIndex == 0) {
myobji.disabled = true;
myobji.value = 'n/a';
} else if (myobjs.selectedIndex != 0) {
myobji.disabled = false;
myobji.value = '';
}
">
<option value="0" selected="selected">Inherit</option>
<option value="2">Override</option>
</select>
<input type="text" name="amavis_quarantine_virus" id="amavis_quarantine_virus"
disabled="disabled" value="n/a" />
</td>
</tr>
<tr>
<td class="entrytitle">
Spam
<?php tooltip('amavis_quarantine_spam'); ?>
</td>
<td>
<select name="amavis_quarantine_spam_mode" id="amavis_quarantine_spam_mode"
onchange="
var myobjs = document.getElementById('amavis_quarantine_spam_mode');
var myobji = document.getElementById('amavis_quarantine_spam');
if (myobjs.selectedIndex == 0) {
myobji.disabled = true;
myobji.value = 'n/a';
} else if (myobjs.selectedIndex != 0) {
myobji.disabled = false;
myobji.value = '';
}
">
<option value="0" selected="selected">Inherit</option>
<option value="2">Override</option>
</select>
<input type="text" name="amavis_quarantine_spam" id="amavis_quarantine_spam"
disabled="disabled" value="n/a" />
</td>
</tr>
<tr>
<td class="entrytitle">
Banned File
<?php tooltip('amavis_quarantine_banned_file'); ?>
</td>
<td>
<select name="amavis_quarantine_banned_file_mode" id="amavis_quarantine_banned_file_mode"
onchange="
var myobjs = document.getElementById('amavis_quarantine_banned_file_mode');
var myobji = document.getElementById('amavis_quarantine_banned_file');
if (myobjs.selectedIndex == 0) {
myobji.disabled = true;
myobji.value = 'n/a';
} else if (myobjs.selectedIndex != 0) {
myobji.disabled = false;
myobji.value = '';
}
">
<option value="0" selected="selected">Inherit</option>
<option value="2">Override</option>
</select>
<input type="text" name="amavis_quarantine_banned_file" id="amavis_quarantine_banned_file"
disabled="disabled" value="n/a" />
</td>
</tr>
<tr>
<td class="entrytitle">
Bad Header
<?php tooltip('amavis_quarantine_bad_header'); ?>
</td>
<td>
<select name="amavis_quarantine_bad_header_mode" id="amavis_quarantine_bad_header_mode"
onchange="
var myobjs = document.getElementById('amavis_quarantine_bad_header_mode');
var myobji = document.getElementById('amavis_quarantine_bad_header');
if (myobjs.selectedIndex == 0) {
myobji.disabled = true;
myobji.value = 'n/a';
} else if (myobjs.selectedIndex != 0) {
myobji.disabled = false;
myobji.value = '';
}
">
<option value="0" selected="selected">Inherit</option>
<option value="2">Override</option>
</select>
<input type="text" name="amavis_quarantine_bad_header" id="amavis_quarantine_bad_header"
disabled="disabled" value="n/a" />
</td>
</tr>
<tr>
<td colspan="2" class="textcenter" style="border-bottom: 1px dashed black;">Interception</td>
</tr>
<tr>
<td class="entrytitle">
BCC To
<?php tooltip('amavis_bcc_to'); ?>
</td>
<td>
<select name="amavis_bcc_to_mode" id="amavis_bcc_to_mode"
onchange="
var myobjs = document.getElementById('amavis_bcc_to_mode');
var myobji = document.getElementById('amavis_bcc_to');
if (myobjs.selectedIndex == 0) {
myobji.disabled = true;
myobji.value = 'n/a';
} else if (myobjs.selectedIndex != 0) {
myobji.disabled = false;
myobji.value = '';
}
">
<option value="0" selected="selected">Inherit</option>
<option value="2">Override</option>
</select>
<input type="text" name="amavis_bcc_to" id="amavis_bcc_to"
disabled="disabled" value="n/a" />
</td>
</tr>
<tr>
<td colspan="2" class="textcenter" style="border-bottom: 1px dashed black;">&nbsp;</td>
</tr>
<tr>
<td class="entrytitle texttop">Comment</td>
<td><textarea name="amavis_comment" cols="40" rows="5"></textarea></td>
</tr>
<tr>
<td colspan="2">
<input type="submit" />
</td>
</tr>
</table>
</form>
<?php
# Check we have all params
} elseif ($_POST['frmaction'] == "add2") {
?>
<p class="pageheader">Amavis Rule Add Results</p>
<?php
# Check name
if (empty($_POST['amavis_policyid'])) {
?>
<div class="warning">Policy ID cannot be empty</div>
<?php
# Check name
} elseif (empty($_POST['amavis_name'])) {
?>
<div class="warning">Name cannot be empty</div>
<?php
} else {
$dbinfo = array();
# add stuff we need first...
array_push($dbinfo,$_POST['amavis_policyid']);
array_push($dbinfo,$_POST['amavis_name']);
# Bypass options
$res = process_post_option($_POST['amavis_bypass_virus_checks']);
$dbinfo = array_merge($dbinfo,$res);
$res = process_post_option($_POST['amavis_bypass_banned_checks']);
$dbinfo = array_merge($dbinfo,$res);
$res = process_post_option($_POST['amavis_bypass_spam_checks']);
$dbinfo = array_merge($dbinfo,$res);
$res = process_post_option($_POST['amavis_bypass_header_checks']);
$dbinfo = array_merge($dbinfo,$res);
# Anti-spam options
$res = process_post_value($_POST['amavis_spam_tag_level_mode'],isset($_POST['amavis_spam_tag_level']) ? $_POST['amavis_spam_tag_level'] : '');
$dbinfo = array_merge($dbinfo,$res);
$res = process_post_value($_POST['amavis_spam_tag2_level_mode'],isset($_POST['amavis_spam_tag2_level']) ? $_POST['amavis_spam_tag2_level'] : '');
$dbinfo = array_merge($dbinfo,$res);
$res = process_post_value($_POST['amavis_spam_tag3_level_mode'],isset($_POST['amavis_spam_tag3_level']) ? $_POST['amavis_spam_tag3_level'] : '');
$dbinfo = array_merge($dbinfo,$res);
$res = process_post_value($_POST['amavis_spam_kill_level_mode'],isset($_POST['amavis_spam_kill_level']) ? $_POST['amavis_spam_kill_level'] : '');
$dbinfo = array_merge($dbinfo,$res);
$res = process_post_value($_POST['amavis_spam_dsn_cutoff_level_mode'],
isset($_POST['amavis_spam_dsn_cutoff_level']) ? $_POST['amavis_spam_dsn_cutoff_level'] : '');
$dbinfo = array_merge($dbinfo,$res);
$res = process_post_value($_POST['amavis_spam_quarantine_cutoff_level_mode'],
isset($_POST['amavis_spam_quarantine_cutoff_level']) ? $_POST['amavis_spam_quarantine_cutoff_level'] : '');
$dbinfo = array_merge($dbinfo,$res);
$res = process_post_option($_POST['amavis_spam_modifies_subject']);
$dbinfo = array_merge($dbinfo,$res);
$res = process_post_value($_POST['amavis_spam_tag_subject_mode'],isset($_POST['amavis_spam_tag_subject']) ? $_POST['amavis_spam_tag_subject'] : '');
$dbinfo = array_merge($dbinfo,$res);
$res = process_post_value($_POST['amavis_spam_tag2_subject_mode'],isset($_POST['amavis_spam_tag2_subject']) ? $_POST['amavis_spam_tag2_subject'] : '');
$dbinfo = array_merge($dbinfo,$res);
$res = process_post_value($_POST['amavis_spam_tag3_subject_mode'],isset($_POST['amavis_spam_tag3_subject']) ? $_POST['amavis_spam_tag3_subject'] : '');
$dbinfo = array_merge($dbinfo,$res);
# General
$res = process_post_value($_POST['amavis_max_message_size_mode'],isset($_POST['amavis_max_message_size']) ? $_POST['amavis_max_message_size'] : '');
$dbinfo = array_merge($dbinfo,$res);
$res = process_post_list($_POST['amavis_banned_files_mode'],isset($_POST['amavis_banned_files']) ? $_POST['amavis_banned_files'] : '');
$dbinfo = array_merge($dbinfo,$res);
# Whitelist & blacklist
$res = process_post_list($_POST['amavis_sender_whitelist_mode'],isset($_POST['amavis_sender_whitelist']) ? $_POST['amavis_sender_whitelist'] : '');
$dbinfo = array_merge($dbinfo,$res);
$res = process_post_list($_POST['amavis_sender_blacklist_mode'],isset($_POST['amavis_sender_blacklist']) ? $_POST['amavis_sender_blacklist'] : '');
$dbinfo = array_merge($dbinfo,$res);
# Notifications
$res = process_post_value($_POST['amavis_notify_admin_newvirus_mode'],isset($_POST['amavis_notify_admin_newvirus']) ?
$_POST['amavis_notify_admin_newvirus'] : '');
$dbinfo = array_merge($dbinfo,$res);
$res = process_post_value($_POST['amavis_notify_admin_virus_mode'],isset($_POST['amavis_notify_admin_virus']) ?
$_POST['amavis_notify_admin_virus'] : '');
$dbinfo = array_merge($dbinfo,$res);
$res = process_post_value($_POST['amavis_notify_admin_spam_mode'],isset($_POST['amavis_notify_admin_spam']) ?
$_POST['amavis_notify_admin_spam'] : '');
$dbinfo = array_merge($dbinfo,$res);
$res = process_post_value($_POST['amavis_notify_admin_banned_file_mode'],isset($_POST['amavis_notify_admin_banned_file']) ?
$_POST['amavis_notify_admin_banned_file'] : '');
$dbinfo = array_merge($dbinfo,$res);
$res = process_post_value($_POST['amavis_notify_admin_bad_header_mode'],isset($_POST['amavis_notify_admin_bad_header']) ?
$_POST['amavis_notify_admin_bad_header'] : '');
$dbinfo = array_merge($dbinfo,$res);
# Quarantine
$res = process_post_value($_POST['amavis_quarantine_virus_mode'],isset($_POST['amavis_quarantine_virus']) ?
$_POST['amavis_quarantine_virus'] : '');
$dbinfo = array_merge($dbinfo,$res);
$res = process_post_value($_POST['amavis_quarantine_spam_mode'],isset($_POST['amavis_quarantine_spam']) ?
$_POST['amavis_quarantine_spam'] : '');
$dbinfo = array_merge($dbinfo,$res);
$res = process_post_value($_POST['amavis_quarantine_banned_file_mode'],isset($_POST['amavis_quarantine_banned_file']) ?
$_POST['amavis_quarantine_banned_file'] : '');
$dbinfo = array_merge($dbinfo,$res);
$res = process_post_value($_POST['amavis_quarantine_bad_header_mode'],isset($_POST['amavis_quarantine_bad_header']) ?
$_POST['amavis_quarantine_bad_header'] : '');
$dbinfo = array_merge($dbinfo,$res);
# Interception
$res = process_post_value($_POST['amavis_bcc_to_mode'],isset($_POST['amavis_bcc_to']) ?
$_POST['amavis_bcc_to'] : '');
$dbinfo = array_merge($dbinfo,$res);
# And stuff we need at end
array_push($dbinfo,$_POST['amavis_comment']);
$stmt = $db->prepare("
INSERT INTO ${DB_TABLE_PREFIX}amavis_rules
(
PolicyID,Name,
bypass_virus_checks, bypass_virus_checks_m,
bypass_banned_checks, bypass_banned_checks_m,
bypass_spam_checks, bypass_spam_checks_m,
bypass_header_checks, bypass_header_checks_m,
spam_tag_level, spam_tag_level_m,
spam_tag2_level, spam_tag2_level_m,
spam_tag3_level, spam_tag3_level_m,
spam_kill_level, spam_kill_level_m,
spam_dsn_cutoff_level, spam_dsn_cutoff_level_m,
spam_quarantine_cutoff_level, spam_quarantine_cutoff_level_m,
spam_modifies_subject, spam_modifies_subject_m,
spam_tag_subject, spam_tag_subject_m,
spam_tag2_subject, spam_tag2_subject_m,
spam_tag3_subject, spam_tag3_subject_m,
max_message_size, max_message_size_m,
banned_files, banned_files_m,
sender_whitelist, sender_whitelist_m,
sender_blacklist, sender_blacklist_m,
notify_admin_newvirus, notify_admin_newvirus_m,
notify_admin_virus, notify_admin_virus_m,
notify_admin_spam, notify_admin_spam_m,
notify_admin_banned_file, notify_admin_banned_file_m,
notify_admin_bad_header, notify_admin_bad_header_m,
quarantine_virus, quarantine_virus_m,
quarantine_spam, quarantine_spam_m,
quarantine_banned_file, quarantine_banned_file_m,
quarantine_bad_header, quarantine_bad_header_m,
bcc_to, bcc_to_m,
Comment,
Disabled
)
VALUES
(
?,?,
?,?,
?,?,
?,?,
?,?,
?,?,
?,?,
?,?,
?,?,
?,?,
?,?,
?,?,
?,?,
?,?,
?,?,
?,?,
?,?,
?,?,
?,?,
?,?,
?,?,
?,?,
?,?,
?,?,
?,?,
?,?,
?,?,
?,?,
?,?,
?,
1
)"
);
if (!$stmt) {
print_r( $db->errorInfo() );
}
$res = $stmt->execute($dbinfo);
if ($res) {
?>
<div class="notice">Amavis rule created</div>
<?php
} else {
?>
<div class="warning">Failed to create Amavis rule</div>
<div class="warning"><?php print_r($db->errorInfo()) ?></div>
<?php
}
}
} else {
?>
<div class="warning">Invalid invocation</div>
<?php
}
printFooter();
# vim: ts=4
?>
<?php
# Module: Amavis change
# Copyright (C) 2008, LinuxRulz
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
include_once("includes/header.php");
include_once("includes/footer.php");
include_once("includes/db.php");
include_once("includes/tooltips.php");
$db = connect_db();
printHeader(array(
"Tabs" => array(
"Back to Amavis" => "amavis-main.php"
),
));
# Process an option
function process_post_option($name,$option) {
global $db;
$results = array();
# Inherit
if ($option == 0) {
array_push($results,"$name = NULL");
array_push($results,"${name}_m = ".$db->quote(0));
# Explicit yes
} elseif ($option == 1) {
array_push($results,"$name = ".$db->quote(1));
array_push($results,"${name}_m = ".$db->quote(2));
# Explicit no
} elseif ($option == 2) {
array_push($results,"$name = ".$db->quote(0));
array_push($results,"${name}_m = ".$db->quote(2));
}
return $results;
};
# Process a value
function process_post_value($name,$option,$value) {
global $db;
$results = array();
# Inherit
if ($option == 0) {
array_push($results,"$name = NULL");
array_push($results,"${name}_m = ".$db->quote(0));
# Override
} elseif ($option == 2) {
array_push($results,"$name = ".$db->quote($value));
array_push($results,"${name}_m = ".$db->quote(2));
}
return $results;
};
# Process a list of items
function process_post_list($name,$option,$value) {
global $db;
$results = array();
# Inherit
if ($option == 0) {
array_push($results,"$name = NULL");
array_push($results,"${name}_m = ".$db->quote(0));
# Merge
} elseif ($option == 1) {
array_push($results,"$name = ".$db->quote($value));
array_push($results,"${name}_m = ".$db->quote(1));
# Override
} elseif ($option == 2) {
array_push($results,"$name = ".$db->quote($value));
array_push($results,"${name}_m = ".$db->quote(2));
}
return $results;
};
# Make a pretty db option
function decode_db_option($option,$value)
{
$ret = "unknown";
if ($option == "0") {
$ret = "Inherit";
# Overwrite
} elseif ($option == "2") {
# Check value
if ($value == "0") {
$ret = "No";
} elseif ($value == "1") {
$ret = "Yes";
}
}
return $ret;
}
# Make a pretty db value
function decode_db_value($option,$value)
{
$ret = "unknown";
if ($option == "0") {
$ret = "Inherit";
# Merge
} elseif ($option == "1") {
$ret = "Merge: $value";
# Overwrite
} elseif ($option == "2") {
$ret = "Overwrite: $value";
}
return $ret;
}
# Display change screen
if ($_POST['frmaction'] == "change") {
# Check a amavis rule was selected
if (isset($_POST['amavis_id'])) {
# Prepare statement
$stmt = $db->prepare("
SELECT
${DB_TABLE_PREFIX}amavis_rules.ID, ${DB_TABLE_PREFIX}amavis_rules.PolicyID, ${DB_TABLE_PREFIX}amavis_rules.Name,
${DB_TABLE_PREFIX}amavis_rules.bypass_virus_checks, ${DB_TABLE_PREFIX}amavis_rules.bypass_virus_checks_m,
${DB_TABLE_PREFIX}amavis_rules.bypass_banned_checks, ${DB_TABLE_PREFIX}amavis_rules.bypass_banned_checks_m,
${DB_TABLE_PREFIX}amavis_rules.bypass_spam_checks, ${DB_TABLE_PREFIX}amavis_rules.bypass_spam_checks_m,
${DB_TABLE_PREFIX}amavis_rules.bypass_header_checks, ${DB_TABLE_PREFIX}amavis_rules.bypass_header_checks_m,
${DB_TABLE_PREFIX}amavis_rules.spam_tag_level, ${DB_TABLE_PREFIX}amavis_rules.spam_tag_level_m,
${DB_TABLE_PREFIX}amavis_rules.spam_tag2_level, ${DB_TABLE_PREFIX}amavis_rules.spam_tag2_level_m,
${DB_TABLE_PREFIX}amavis_rules.spam_tag3_level, ${DB_TABLE_PREFIX}amavis_rules.spam_tag3_level_m,
${DB_TABLE_PREFIX}amavis_rules.spam_kill_level, ${DB_TABLE_PREFIX}amavis_rules.spam_kill_level_m,
${DB_TABLE_PREFIX}amavis_rules.spam_dsn_cutoff_level, ${DB_TABLE_PREFIX}amavis_rules.spam_dsn_cutoff_level_m,
${DB_TABLE_PREFIX}amavis_rules.spam_quarantine_cutoff_level, ${DB_TABLE_PREFIX}amavis_rules.spam_quarantine_cutoff_level_m,
${DB_TABLE_PREFIX}amavis_rules.spam_modifies_subject, ${DB_TABLE_PREFIX}amavis_rules.spam_modifies_subject_m,
${DB_TABLE_PREFIX}amavis_rules.spam_tag_subject, ${DB_TABLE_PREFIX}amavis_rules.spam_tag_subject_m,
${DB_TABLE_PREFIX}amavis_rules.spam_tag2_subject, ${DB_TABLE_PREFIX}amavis_rules.spam_tag2_subject_m,
${DB_TABLE_PREFIX}amavis_rules.spam_tag3_subject, ${DB_TABLE_PREFIX}amavis_rules.spam_tag3_subject_m,
${DB_TABLE_PREFIX}amavis_rules.max_message_size, ${DB_TABLE_PREFIX}amavis_rules.max_message_size_m,
${DB_TABLE_PREFIX}amavis_rules.banned_files, ${DB_TABLE_PREFIX}amavis_rules.banned_files_m,
${DB_TABLE_PREFIX}amavis_rules.sender_whitelist, ${DB_TABLE_PREFIX}amavis_rules.sender_whitelist_m,
${DB_TABLE_PREFIX}amavis_rules.sender_blacklist, ${DB_TABLE_PREFIX}amavis_rules.sender_blacklist_m,
${DB_TABLE_PREFIX}amavis_rules.notify_admin_newvirus, ${DB_TABLE_PREFIX}amavis_rules.notify_admin_newvirus_m,
${DB_TABLE_PREFIX}amavis_rules.notify_admin_virus, ${DB_TABLE_PREFIX}amavis_rules.notify_admin_virus_m,
${DB_TABLE_PREFIX}amavis_rules.notify_admin_spam, ${DB_TABLE_PREFIX}amavis_rules.notify_admin_spam_m,
${DB_TABLE_PREFIX}amavis_rules.notify_admin_banned_file, ${DB_TABLE_PREFIX}amavis_rules.notify_admin_banned_file_m,
${DB_TABLE_PREFIX}amavis_rules.notify_admin_bad_header, ${DB_TABLE_PREFIX}amavis_rules.notify_admin_bad_header_m,
${DB_TABLE_PREFIX}amavis_rules.quarantine_virus, ${DB_TABLE_PREFIX}amavis_rules.quarantine_virus_m,
${DB_TABLE_PREFIX}amavis_rules.quarantine_spam, ${DB_TABLE_PREFIX}amavis_rules.quarantine_spam_m,
${DB_TABLE_PREFIX}amavis_rules.quarantine_banned_file, ${DB_TABLE_PREFIX}amavis_rules.quarantine_banned_file_m,
${DB_TABLE_PREFIX}amavis_rules.quarantine_bad_header, ${DB_TABLE_PREFIX}amavis_rules.quarantine_bad_header_m,
${DB_TABLE_PREFIX}amavis_rules.bcc_to, ${DB_TABLE_PREFIX}amavis_rules.bcc_to_m,
${DB_TABLE_PREFIX}amavis_rules.Comment,
${DB_TABLE_PREFIX}amavis_rules.Disabled,
${DB_TABLE_PREFIX}policies.Name AS PolicyName
FROM
${DB_TABLE_PREFIX}amavis_rules, ${DB_TABLE_PREFIX}policies
WHERE
${DB_TABLE_PREFIX}amavis_rules.ID = ?
AND ${DB_TABLE_PREFIX}policies.ID = ${DB_TABLE_PREFIX}amavis_rules.PolicyID
");
?>
<p class="pageheader">Update Amavis Rule</p>
<form action="amavis-change.php" method="post">
<div>
<input type="hidden" name="frmaction" value="change2" />
<input type="hidden" name="amavis_id" value="<?php echo $_POST['amavis_id']; ?>" />
</div>
<?php
$res = $stmt->execute(array($_POST['amavis_id']));
$row = $stmt->fetchObject();
?>
<table class="entry" style="width: 75%;">
<tr>
<td></td>
<td class="entrytitle textcenter">Old Value</td>
<td class="entrytitle textcenter">New Value</td>
</tr>
<tr>
<td class="entrytitle">Name</td>
<td class="oldval"><?php echo $row->name ?></td>
<td><input type="text" name="amavis_name" /></td>
</tr>
<tr>
<td class="entrytitle">Link to policy</td>
<td class="oldval"><?php echo $row->policyname ?></td>
<td>
<select name="amavis_policyid">
<option value="">--</option>
<?php
$res = $db->query("SELECT ID, Name FROM ${DB_TABLE_PREFIX}policies ORDER BY Name");
while ($row2 = $res->fetchObject()) {
?>
<option value="<?php echo $row2->id ?>" ><?php echo $row2->name ?></option>
<?php
}
$res->closeCursor();
?>
</select>
</td>
</tr>
<tr>
<td colspan="3" class="textcenter" style="border-bottom: 1px dashed black;">Bypass Checks</td>
</tr>
<tr>
<td class="entrytitle">
Virus Checks
<?php tooltip('amavis_bypass_virus_checks'); ?>
</td>
<td class="oldval"><?php echo decode_db_option($row->bypass_virus_checks_m,$row->bypass_virus_checks) ?></td>
<td>
<select name="amavis_bypass_virus_checks">
<option value="">--</option>
<option value="0">Inherit</option>
<option value="1">Yes</option>
<option value="2">No</option>
</select>
</td>
</tr>
<tr>
<td class="entrytitle">
Banned File Checks
<?php tooltip('amavis_bypass_banned_checks'); ?>
</td>
<td class="oldval"><?php echo decode_db_option($row->bypass_banned_checks_m,$row->bypass_banned_checks) ?></td>
<td>
<select name="amavis_bypass_banned_checks">
<option value="">--</option>
<option value="0">Inherit</option>
<option value="1">Yes</option>
<option value="2">No</option>
</select>
</td>
</tr>
<tr>
<td class="entrytitle">
Spam Checks
<?php tooltip('amavis_bypass_spam_checks'); ?>
</td>
<td class="oldval"><?php echo decode_db_option($row->bypass_spam_checks_m,$row->bypass_spam_checks) ?></td>
<td>
<select name="amavis_bypass_spam_checks">
<option value="">--</option>
<option value="0">Inherit</option>
<option value="1">Yes</option>
<option value="2">No</option>
</select>
</td>
</tr>
<tr>
<td class="entrytitle">
Header Checks
<?php tooltip('amavis_bypass_header_checks'); ?>
</td>
<td class="oldval"><?php echo decode_db_option($row->bypass_header_checks_m,$row->bypass_header_checks) ?></td>
<td>
<select name="amavis_bypass_header_checks">
<option value="">--</option>
<option value="0">Inherit</option>
<option value="1">Yes</option>
<option value="2">No</option>
</select>
</td>
</tr>
<tr>
<td colspan="3" class="textcenter" style="border-bottom: 1px dashed black;">Anti-spam Settings</td>
</tr>
<tr>
<td class="entrytitle">
Tag Level
<?php tooltip('amavis_spam_tag_level'); ?>
</td>
<td class="oldval"><?php echo decode_db_value($row->spam_tag_level_m,$row->spam_tag_level) ?></td>
<td>
<select name="amavis_spam_tag_level_mode" id="amavis_spam_tag_level_mode"
onchange="
var myobjs = document.getElementById('amavis_spam_tag_level_mode');
var myobji = document.getElementById('amavis_spam_tag_level');
if (myobjs.selectedIndex != 2) {
myobji.disabled = true;
myobji.value = 'n/a';
} else if (myobjs.selectedIndex == 2) {
myobji.disabled = false;
myobji.value = '0.0';
}
">
<option value="">--</option>
<option value="0">Inherit</option>
<option value="2">Override</option>
</select>
<input type="text" name="amavis_spam_tag_level" size="6" id="amavis_spam_tag_level" disabled="disabled" value="n/a" />
</td>
</tr>
<tr>
<td class="entrytitle">
Tag2 Level
<?php tooltip('amavis_spam_tag2_level'); ?>
</td>
<td class="oldval"><?php echo decode_db_value($row->spam_tag2_level_m,$row->spam_tag2_level) ?></td>
<td>
<select name="amavis_spam_tag2_level_mode" id="amavis_spam_tag2_level_mode"
onchange="
var myobjs = document.getElementById('amavis_spam_tag2_level_mode');
var myobji = document.getElementById('amavis_spam_tag2_level');
if (myobjs.selectedIndex != 2) {
myobji.disabled = true;
myobji.value = 'n/a';
} else if (myobjs.selectedIndex == 2) {
myobji.disabled = false;
myobji.value = '5.0';
}
">
<option value="">--</option>
<option value="0">Inherit</option>
<option value="2">Override</option>
</select>
<input type="text" name="amavis_spam_tag2_level" size="6" id="amavis_spam_tag2_level" disabled="disabled" value="n/a" />
</td>
</tr>
<tr>
<td class="entrytitle">
Tag3 Level
<?php tooltip('amavis_spam_tag3_level'); ?>
</td>
<td class="oldval"><?php echo decode_db_value($row->spam_tag3_level_m,$row->spam_tag3_level) ?></td>
<td>
<select name="amavis_spam_tag3_level_mode" id="amavis_spam_tag3_level_mode"
onchange="
var myobjs = document.getElementById('amavis_spam_tag3_level_mode');
var myobji = document.getElementById('amavis_spam_tag3_level');
if (myobjs.selectedIndex != 2) {
myobji.disabled = true;
myobji.value = 'n/a';
} else if (myobjs.selectedIndex == 2) {
myobji.disabled = false;
myobji.value = '7.5';
}
">
<option value="">--</option>
<option value="0">Inherit</option>
<option value="2">Override</option>
</select>
<input type="text" name="amavis_spam_tag3_level" size="6" id="amavis_spam_tag3_level" disabled="disabled" value="n/a" />
</td>
</tr>
<tr>
<td class="entrytitle">
Kill Level
<?php tooltip('amavis_spam_kill_level'); ?>
</td>
<td class="oldval"><?php echo decode_db_value($row->spam_kill_level_m,$row->spam_kill_level) ?></td>
<td>
<select name="amavis_spam_kill_level_mode" id="amavis_spam_kill_level_mode"
onchange="
var myobjs = document.getElementById('amavis_spam_kill_level_mode');
var myobji = document.getElementById('amavis_spam_kill_level');
if (myobjs.selectedIndex != 2) {
myobji.disabled = true;
myobji.value = 'n/a';
} else if (myobjs.selectedIndex == 2) {
myobji.disabled = false;
myobji.value = '7.5';
}
">
<option value="">--</option>
<option value="0">Inherit</option>
<option value="2">Override</option>
</select>
<input type="text" name="amavis_spam_kill_level" size="6" id="amavis_spam_kill_level" disabled="disabled" value="n/a" />
</td>
</tr>
<tr>
<td class="entrytitle">
DSN Cutoff Level
<?php tooltip('amavis_spam_dsn_cutoff_level'); ?>
</td>
<td class="oldval"><?php echo decode_db_value($row->spam_dsn_cutoff_level_m,$row->spam_dsn_cutoff_level) ?></td>
<td>
<select name="amavis_spam_dsn_cutoff_level_mode" id="amavis_spam_dsn_cutoff_level_mode"
onchange="
var myobjs = document.getElementById('amavis_spam_dsn_cutoff_level_mode');
var myobji = document.getElementById('amavis_spam_dsn_cutoff_level');
if (myobjs.selectedIndex != 2) {
myobji.disabled = true;
myobji.value = 'n/a';
} else if (myobjs.selectedIndex == 2) {
myobji.disabled = false;
myobji.value = '7.5';
}
">
<option value="">--</option>
<option value="0">Inherit</option>
<option value="2">Override</option>
</select>
<input type="text" name="amavis_spam_dsn_cutoff_level" size="6" id="amavis_spam_dsn_cutoff_level" disabled="disabled" value="n/a" />
</td>
</tr>
<tr>
<td class="entrytitle">
Quarantine Cutoff Level
<?php tooltip('amavis_spam_quarantine_cutoff_level'); ?>
</td>
<td class="oldval"><?php echo decode_db_value($row->spam_quarantine_cutoff_level_m,$row->spam_quarantine_cutoff_level) ?></td>
<td>
<select name="amavis_spam_quarantine_cutoff_level_mode" id="amavis_spam_quarantine_cutoff_level_mode"
onchange="
var myobjs = document.getElementById('amavis_spam_quarantine_cutoff_level_mode');
var myobji = document.getElementById('amavis_spam_quarantine_cutoff_level');
if (myobjs.selectedIndex != 2) {
myobji.disabled = true;
myobji.value = 'n/a';
} else if (myobjs.selectedIndex == 2) {
myobji.disabled = false;
myobji.value = '15.0';
}
">
<option value="">--</option>
<option value="0">Inherit</option>
<option value="2">Override</option>
</select>
<input type="text" name="amavis_spam_quarantine_cutoff_level" size="6" id="amavis_spam_quarantine_cutoff_level"
disabled="disabled" value="n/a" />
</td>
</tr>
<tr>
<td class="entrytitle">
Modify Subject
<?php tooltip('amavis_spam_modifies_subject'); ?>
</td>
<td class="oldval"><?php echo decode_db_option($row->spam_modifies_subject_m,$row->spam_modifies_subject) ?></td>
<td>
<select name="amavis_spam_modifies_subject">
<option value="">--</option>
<option value="0">Inherit</option>
<option value="1">Yes</option>
<option value="2">No</option>
</select>
</td>
</tr>
<tr>
<td class="entrytitle">
Tag Subject
<?php tooltip('amavis_spam_tag_subject'); ?>
</td>
<td class="oldval"><?php echo decode_db_value($row->spam_tag_subject_m,$row->spam_tag_subject) ?></td>
<td>
<select name="amavis_spam_tag_subject_mode" id="amavis_spam_tag_subject_mode"
onchange="
var myobjs = document.getElementById('amavis_spam_tag_subject_mode');
var myobji = document.getElementById('amavis_spam_tag_subject');
if (myobjs.selectedIndex != 2) {
myobji.disabled = true;
myobji.value = 'n/a';
} else if (myobjs.selectedIndex == 2) {
myobji.disabled = false;
myobji.value = '';
}
">
<option value="">--</option>
<option value="0">Inherit</option>
<option value="2">Override</option>
</select>
<input type="text" name="amavis_spam_tag_subject" id="amavis_spam_tag_subject"
disabled="disabled" value="n/a" />
</td>
</tr>
<tr>
<td class="entrytitle">
Tag2 Subject
<?php tooltip('amavis_spam_tag2_subject'); ?>
</td>
<td class="oldval"><?php echo decode_db_value($row->spam_tag2_subject_m,$row->spam_tag2_subject) ?></td>
<td>
<select name="amavis_spam_tag2_subject_mode" id="amavis_spam_tag2_subject_mode"
onchange="
var myobjs = document.getElementById('amavis_spam_tag2_subject_mode');
var myobji = document.getElementById('amavis_spam_tag2_subject');
if (myobjs.selectedIndex != 2) {
myobji.disabled = true;
myobji.value = 'n/a';
} else if (myobjs.selectedIndex == 2) {
myobji.disabled = false;
myobji.value = '';
}
">
<option value="">--</option>
<option value="0">Inherit</option>
<option value="2">Override</option>
</select>
<input type="text" name="amavis_spam_tag2_subject" id="amavis_spam_tag2_subject"
disabled="disabled" value="n/a" />
</td>
</tr>
<tr>
<td class="entrytitle">
Tag3 Subject
<?php tooltip('amavis_spam_tag3_subject'); ?>
</td>
<td class="oldval"><?php echo decode_db_value($row->spam_tag3_subject_m,$row->spam_tag3_subject) ?></td>
<td>
<select name="amavis_spam_tag3_subject_mode" id="amavis_spam_tag3_subject_mode"
onchange="
var myobjs = document.getElementById('amavis_spam_tag3_subject_mode');
var myobji = document.getElementById('amavis_spam_tag3_subject');
if (myobjs.selectedIndex != 2) {
myobji.disabled = true;
myobji.value = 'n/a';
} else if (myobjs.selectedIndex == 2) {
myobji.disabled = false;
myobji.value = '';
}
">
<option value="">--</option>
<option value="0">Inherit</option>
<option value="2">Override</option>
</select>
<input type="text" name="amavis_spam_tag3_subject" id="amavis_spam_tag3_subject"
disabled="disabled" value="n/a" />
</td>
</tr>
<tr>
<td colspan="3" class="textcenter" style="border-bottom: 1px dashed black;">General Checks</td>
</tr>
<tr>
<td class="entrytitle">
Max Message Size (Kbyte)
<?php tooltip('amavis_max_message_size'); ?>
</td>
<td class="oldval"><?php echo decode_db_value($row->max_message_size_m,$row->max_message_size) ?></td>
<td>
<select name="amavis_max_message_size_mode" id="amavis_max_message_size_mode"
onchange="
var myobjs = document.getElementById('amavis_max_message_size_mode');
var myobji = document.getElementById('amavis_max_message_size');
if (myobjs.selectedIndex != 2) {
myobji.disabled = true;
myobji.value = 'n/a';
} else if (myobjs.selectedIndex == 2) {
myobji.disabled = false;
myobji.value = '';
}
">
<option value="">--</option>
<option value="0">Inherit</option>
<option value="2">Override</option>
</select>
<input type="text" name="amavis_max_message_size" id="amavis_max_message_size"
disabled="disabled" value="n/a" />
</td>
</tr>
<tr>
<td class="entrytitle texttop">
Banned Files
<?php tooltip('amavis_banned_files'); ?>
</td>
<td class="oldval"><?php echo decode_db_value($row->banned_files_m,$row->banned_files) ?></td>
<td>
<select name="amavis_banned_files_mode" id="amavis_banned_files_mode"
onchange="
var myobjs = document.getElementById('amavis_banned_files_mode');
var myobji = document.getElementById('amavis_banned_files');
if (myobjs.selectedIndex < 2) {
myobji.disabled = true;
myobji.value = 'n/a';
} else if (myobjs.selectedIndex >= 2) {
myobji.disabled = false;
myobji.value = '';
}
">
<option value="">--</option>
<option value="0">Inherit</option>
<option value="1">Merge</option>
<option value="2">Override</option>
</select>
<br />
<textarea name="amavis_banned_files" id="amavis_banned_files" disabled="disabled" cols="40" rows="5">n/a</textarea>
</td>
</tr>
<tr>
<td colspan="3" class="textcenter" style="border-bottom: 1px dashed black;">Whitelist &amp; Blacklist</td>
</tr>
<tr>
<td class="entrytitle texttop">
Sender Whitelist
<?php tooltip('amavis_sender_whitelist'); ?>
</td>
<td class="oldval"><?php echo decode_db_value($row->sender_whitelist_m,$row->sender_whitelist) ?></td>
<td class="texttop">
<select name="amavis_sender_whitelist_mode" id="amavis_sender_whitelist_mode"
onchange="
var myobjs = document.getElementById('amavis_sender_whitelist_mode');
var myobji = document.getElementById('amavis_sender_whitelist');
if (myobjs.selectedIndex < 2) {
myobji.disabled = true;
myobji.value = 'n/a';
} else if (myobjs.selectedIndex >= 2) {
myobji.disabled = false;
myobji.value = '';
}
">
<option value="">--</option>
<option value="0">Inherit</option>
<option value="1">Merge</option>
<option value="2">Override</option>
</select>
<br />
<textarea name="amavis_sender_whitelist" id="amavis_sender_whitelist" disabled="disabled" cols="40" rows="5">n/a</textarea>
</td>
</tr>
<tr>
<td class="entrytitle texttop">
Sender Blacklist
<?php tooltip('amavis_sender_blacklist'); ?>
</td>
<td class="oldval"><?php echo decode_db_value($row->sender_blacklist_m,$row->sender_blacklist) ?></td>
<td class="texttop">
<select name="amavis_sender_blacklist_mode" id="amavis_sender_blacklist_mode"
onchange="
var myobjs = document.getElementById('amavis_sender_blacklist_mode');
var myobji = document.getElementById('amavis_sender_blacklist');
if (myobjs.selectedIndex < 2) {
myobji.disabled = true;
myobji.value = 'n/a';
} else if (myobjs.selectedIndex >= 2) {
myobji.disabled = false;
myobji.value = '';
}
">
<option value="">--</option>
<option value="0">Inherit</option>
<option value="1">Merge</option>
<option value="2">Override</option>
</select>
<br />
<textarea name="amavis_sender_blacklist" id="amavis_sender_blacklist" disabled="disabled" cols="40" rows="5">n/a</textarea>
</td>
</tr>
<tr>
<td colspan="3" class="textcenter" style="border-bottom: 1px dashed black;">Admin Notifications</td>
</tr>
<tr>
<td class="entrytitle">
New Virus
<?php tooltip('amavis_notify_admin_newvirus'); ?>
</td>
<td class="oldval"><?php echo decode_db_value($row->notify_admin_newvirus_m,$row->notify_admin_newvirus) ?></td>
<td>
<select name="amavis_notify_admin_newvirus_mode" id="amavis_notify_admin_newvirus_mode"
onchange="
var myobjs = document.getElementById('amavis_notify_admin_newvirus_mode');
var myobji = document.getElementById('amavis_notify_admin_newvirus');
if (myobjs.selectedIndex != 2) {
myobji.disabled = true;
myobji.value = 'n/a';
} else if (myobjs.selectedIndex == 2) {
myobji.disabled = false;
myobji.value = '';
}
">
<option value="">--</option>
<option value="0">Inherit</option>
<option value="2">Override</option>
</select>
<input type="text" name="amavis_notify_admin_newvirus" id="amavis_notify_admin_newvirus" disabled="disabled" value="n/a" />
</td>
</tr>
<tr>
<td class="entrytitle">
Virus
<?php tooltip('amavis_notify_admin_virus'); ?>
</td>
<td class="oldval"><?php echo decode_db_value($row->notify_admin_virus_m,$row->notify_admin_virus) ?></td>
<td>
<select name="amavis_notify_admin_virus_mode" id="amavis_notify_admin_virus_mode"
onchange="
var myobjs = document.getElementById('amavis_notify_admin_virus_mode');
var myobji = document.getElementById('amavis_notify_admin_virus');
if (myobjs.selectedIndex != 2) {
myobji.disabled = true;
myobji.value = 'n/a';
} else if (myobjs.selectedIndex == 2) {
myobji.disabled = false;
myobji.value = '';
}
">
<option value="">--</option>
<option value="0">Inherit</option>
<option value="2">Override</option>
</select>
<input type="text" name="amavis_notify_admin_virus" id="amavis_notify_admin_virus" disabled="disabled" value="n/a" />
</td>
</tr>
<tr>
<td class="entrytitle">
Spam
<?php tooltip('amavis_notify_admin_spam'); ?>
</td>
<td class="oldval"><?php echo decode_db_value($row->notify_admin_spam_m,$row->notify_admin_spam) ?></td>
<td>
<select name="amavis_notify_admin_spam_mode" id="amavis_notify_admin_spam_mode"
onchange="
var myobjs = document.getElementById('amavis_notify_admin_spam_mode');
var myobji = document.getElementById('amavis_notify_admin_spam');
if (myobjs.selectedIndex != 2) {
myobji.disabled = true;
myobji.value = 'n/a';
} else if (myobjs.selectedIndex == 2) {
myobji.disabled = false;
myobji.value = '';
}
">
<option value="">--</option>
<option value="0">Inherit</option>
<option value="2">Override</option>
</select>
<input type="text" name="amavis_notify_admin_spam" id="amavis_notify_admin_spam" disabled="disabled" value="n/a" />
</td>
</tr>
<tr>
<td class="entrytitle">
Banned File
<?php tooltip('amavis_notify_admin_banned_file'); ?>
</td>
<td class="oldval"><?php echo decode_db_value($row->notify_admin_banned_file_m,$row->notify_admin_banned_file) ?></td>
<td>
<select name="amavis_notify_admin_banned_file_mode" id="amavis_notify_admin_banned_file_mode"
onchange="
var myobjs = document.getElementById('amavis_notify_admin_banned_file_mode');
var myobji = document.getElementById('amavis_notify_admin_banned_file');
if (myobjs.selectedIndex != 2) {
myobji.disabled = true;
myobji.value = 'n/a';
} else if (myobjs.selectedIndex == 2) {
myobji.disabled = false;
myobji.value = '';
}
">
<option value="">--</option>
<option value="0">Inherit</option>
<option value="2">Override</option>
</select>
<input type="text" name="amavis_notify_admin_banned_file" id="amavis_notify_admin_banned_file" disabled="disabled" value="n/a" />
</td>
</tr>
<tr>
<td class="entrytitle">
Bad Header
<?php tooltip('amavis_notify_admin_bad_header'); ?>
</td>
<td class="oldval"><?php echo decode_db_value($row->notify_admin_bad_header_m,$row->notify_admin_bad_header) ?></td>
<td>
<select name="amavis_notify_admin_bad_header_mode" id="amavis_notify_admin_bad_header_mode"
onchange="
var myobjs = document.getElementById('amavis_notify_admin_bad_header_mode');
var myobji = document.getElementById('amavis_notify_admin_bad_header');
if (myobjs.selectedIndex != 2) {
myobji.disabled = true;
myobji.value = 'n/a';
} else if (myobjs.selectedIndex == 2) {
myobji.disabled = false;
myobji.value = '';
}
">
<option value="">--</option>
<option value="0">Inherit</option>
<option value="2">Override</option>
</select>
<input type="text" name="amavis_notify_admin_bad_header" id="amavis_notify_admin_bad_header" disabled="disabled" value="n/a" />
</td>
</tr>
<tr>
<td colspan="3" class="textcenter" style="border-bottom: 1px dashed black;">Quarantine</td>
</tr>
<tr>
<td class="entrytitle">
Virus
<?php tooltip('amavis_quarantine_virus'); ?>
</td>
<td class="oldval"><?php echo decode_db_value($row->quarantine_virus_m,$row->quarantine_virus) ?></td>
<td>
<select name="amavis_quarantine_virus_mode" id="amavis_quarantine_virus_mode"
onchange="
var myobjs = document.getElementById('amavis_quarantine_virus_mode');
var myobji = document.getElementById('amavis_quarantine_virus');
if (myobjs.selectedIndex != 2) {
myobji.disabled = true;
myobji.value = 'n/a';
} else if (myobjs.selectedIndex == 2) {
myobji.disabled = false;
myobji.value = '';
}
">
<option value="">--</option>
<option value="0">Inherit</option>
<option value="2">Override</option>
</select>
<input type="text" name="amavis_quarantine_virus" id="amavis_quarantine_virus" disabled="disabled" value="n/a" />
</td>
</tr>
<tr>
<td class="entrytitle">
Spam
<?php tooltip('amavis_quarantine_spam'); ?>
</td>
<td class="oldval"><?php echo decode_db_value($row->quarantine_spam_m,$row->quarantine_spam) ?></td>
<td>
<select name="amavis_quarantine_spam_mode" id="amavis_quarantine_spam_mode"
onchange="
var myobjs = document.getElementById('amavis_quarantine_spam_mode');
var myobji = document.getElementById('amavis_quarantine_spam');
if (myobjs.selectedIndex != 2) {
myobji.disabled = true;
myobji.value = 'n/a';
} else if (myobjs.selectedIndex == 2) {
myobji.disabled = false;
myobji.value = '';
}
">
<option value="">--</option>
<option value="0">Inherit</option>
<option value="2">Override</option>
</select>
<input type="text" name="amavis_quarantine_spam" id="amavis_quarantine_spam" disabled="disabled" value="n/a" />
</td>
</tr>
<tr>
<td class="entrytitle">
Banned File
<?php tooltip('amavis_quarantine_banned_file'); ?>
</td>
<td class="oldval"><?php echo decode_db_value($row->quarantine_banned_file_m,$row->quarantine_banned_file) ?></td>
<td>
<select name="amavis_quarantine_banned_file_mode" id="amavis_quarantine_banned_file_mode"
onchange="
var myobjs = document.getElementById('amavis_quarantine_banned_file_mode');
var myobji = document.getElementById('amavis_quarantine_banned_file');
if (myobjs.selectedIndex != 2) {
myobji.disabled = true;
myobji.value = 'n/a';
} else if (myobjs.selectedIndex == 2) {
myobji.disabled = false;
myobji.value = '';
}
">
<option value="">--</option>
<option value="0">Inherit</option>
<option value="2">Override</option>
</select>
<input type="text" name="amavis_quarantine_banned_file" id="amavis_quarantine_banned_file" disabled="disabled" value="n/a" />
</td>
</tr>
<tr>
<td class="entrytitle">
Bad Header
<?php tooltip('amavis_quarantine_bad_header'); ?>
</td>
<td class="oldval"><?php echo decode_db_value($row->quarantine_bad_header_m,$row->quarantine_bad_header) ?></td>
<td>
<select name="amavis_quarantine_bad_header_mode" id="amavis_quarantine_bad_header_mode"
onchange="
var myobjs = document.getElementById('amavis_quarantine_bad_header_mode');
var myobji = document.getElementById('amavis_quarantine_bad_header');
if (myobjs.selectedIndex != 2) {
myobji.disabled = true;
myobji.value = 'n/a';
} else if (myobjs.selectedIndex == 2) {
myobji.disabled = false;
myobji.value = '';
}
">
<option value="">--</option>
<option value="0">Inherit</option>
<option value="2">Override</option>
</select>
<input type="text" name="amavis_quarantine_bad_header" id="amavis_quarantine_bad_header" disabled="disabled" value="n/a" />
</td>
</tr>
<tr>
<td colspan="3" class="textcenter" style="border-bottom: 1px dashed black;">Interception</td>
</tr>
<tr>
<td class="entrytitle">
BCC To
<?php tooltip('amavis_bcc_to'); ?>
</td>
<td class="oldval"><?php echo decode_db_value($row->bcc_to_m,$row->bcc_to) ?></td>
<td>
<select name="amavis_bcc_to_mode" id="amavis_bcc_to_mode"
onchange="
var myobjs = document.getElementById('amavis_bcc_to_mode');
var myobji = document.getElementById('amavis_bcc_to');
if (myobjs.selectedIndex != 2) {
myobji.disabled = true;
myobji.value = 'n/a';
} else if (myobjs.selectedIndex == 2) {
myobji.disabled = false;
myobji.value = '';
}
">
<option value="">--</option>
<option value="0">Inherit</option>
<option value="2">Override</option>
</select>
<input type="text" name="amavis_bcc_to" id="amavis_bcc_to" disabled="disabled" value="n/a" />
</td>
</tr>
<tr>
<td colspan="3" class="textcenter" style="border-bottom: 1px dashed black;">&nbsp;</td>
</tr>
<tr>
<td class="entrytitle texttop">Comment</td>
<td class="oldval texttop"><?php echo $row->comment ?></td>
<td><textarea name="amavis_comment" cols="40" rows="5"></textarea></td>
</tr>
<tr>
<td class="entrytitle">Disabled</td>
<td class="oldval"><?php echo $row->disabled ? 'yes' : 'no' ?></td>
<td>
<select name="amavis_disabled">
<option value="">--</option>
<option value="0">No</option>
<option value="1">Yes</option>
</select>
</td>
</tr>
</table>
<p />
<div class="textcenter">
<input type="submit" />
</div>
</form>
<?php
} else {
?>
<div class="warning">No Amavis rule selected</div>
<?php
}
# SQL Updates
} elseif ($_POST['frmaction'] == "change2") {
?>
<p class="pageheader">Amavis Rule Update Results</p>
<?php
$updates = array();
if (!empty($_POST['amavis_policyid'])) {
array_push($updates,"PolicyID = ".$db->quote($_POST['amavis_policyid']));
}
if (!empty($_POST['amavis_name'])) {
array_push($updates,"Name = ".$db->quote($_POST['amavis_name']));
}
# Bypass options
if (isset($_POST['amavis_bypass_virus_checks']) && $_POST['amavis_bypass_virus_checks'] != "") {
$res = process_post_option('bypass_virus_checks',$_POST['amavis_bypass_virus_checks']);
$updates = array_merge($updates,$res);
}
if (isset($_POST['amavis_bypass_banned_checks']) && $_POST['amavis_bypass_banned_checks'] != "") {
$res = process_post_option('bypass_banned_checks',$_POST['amavis_bypass_banned_checks']);
$updates = array_merge($updates,$res);
}
if (isset($_POST['amavis_bypass_spam_checks']) && $_POST['amavis_bypass_spam_checks'] != "") {
$res = process_post_option('bypass_spam_checks',$_POST['amavis_bypass_spam_checks']);
$updates = array_merge($updates,$res);
}
if (isset($_POST['amavis_bypass_header_checks']) && $_POST['amavis_bypass_header_checks'] != "") {
$res = process_post_option('bypass_header_checks',$_POST['amavis_bypass_header_checks']);
$updates = array_merge($updates,$res);
}
# Antispam level
if (isset($_POST['amavis_spam_tag_level_mode']) && $_POST['amavis_spam_tag_level_mode'] != "") {
$res = process_post_value('spam_tag_level',$_POST['amavis_spam_tag_level_mode'],
isset($_POST['amavis_spam_tag_level']) ? $_POST['amavis_spam_tag_level'] : ''
);
$updates = array_merge($updates,$res);
}
if (isset($_POST['amavis_spam_tag2_level_mode']) && $_POST['amavis_spam_tag2_level_mode'] != "") {
$res = process_post_value('spam_tag2_level',$_POST['amavis_spam_tag2_level_mode'],
isset($_POST['amavis_spam_tag2_level']) ? $_POST['amavis_spam_tag2_level'] : ''
);
$updates = array_merge($updates,$res);
}
if (isset($_POST['amavis_spam_tag3_level_mode']) && $_POST['amavis_spam_tag3_level_mode'] != "") {
$res = process_post_value('spam_tag3_level',$_POST['amavis_spam_tag3_level_mode'],
isset($_POST['amavis_spam_tag3_level']) ? $_POST['amavis_spam_tag3_level'] : ''
);
$updates = array_merge($updates,$res);
}
if (isset($_POST['amavis_spam_kill_level_mode']) && $_POST['amavis_spam_kill_level_mode'] != "") {
$res = process_post_value('spam_kill_level',$_POST['amavis_spam_kill_level_mode'],
isset($_POST['amavis_spam_kill_level']) ? $_POST['amavis_spam_kill_level'] : ''
);
$updates = array_merge($updates,$res);
}
if (isset($_POST['amavis_spam_dsn_cutoff_level_mode']) && $_POST['amavis_spam_dsn_cutoff_level_mode'] != "") {
$res = process_post_value('spam_dsn_cutoff_level',$_POST['amavis_spam_dsn_cutoff_level_mode'],
isset($_POST['amavis_spam_dsn_cutoff_level']) ? $_POST['amavis_spam_dsn_cutoff_level'] : ''
);
$updates = array_merge($updates,$res);
}
if (isset($_POST['amavis_spam_quarantine_cutoff_level_mode']) && $_POST['amavis_spam_quarantine_cutoff_level_mode'] != "") {
$res = process_post_value('spam_quarantine_cutoff_level',$_POST['amavis_spam_quarantine_cutoff_level_mode'],
isset($_POST['amavis_spam_quarantine_cutoff_level']) ? $_POST['amavis_spam_quarantine_cutoff_level'] : ''
);
$updates = array_merge($updates,$res);
}
if (isset($_POST['amavis_spam_modifies_subject']) && $_POST['amavis_spam_modifies_subject'] != "") {
$res = process_post_option('spam_modifies_subject',$_POST['amavis_spam_modifies_subject']);
$updates = array_merge($updates,$res);
}
if (isset($_POST['amavis_spam_tag_subject_mode']) && $_POST['amavis_spam_tag_subject_mode'] != "") {
$res = process_post_value('spam_tag_subject',$_POST['amavis_spam_tag_subject_mode'],
isset($_POST['amavis_spam_tag_subject']) ? $_POST['amavis_spam_tag_subject'] : ''
);
$updates = array_merge($updates,$res);
}
if (isset($_POST['amavis_spam_tag2_subject_mode']) && $_POST['amavis_spam_tag2_subject_mode'] != "") {
$res = process_post_value('spam_tag2_subject',$_POST['amavis_spam_tag2_subject_mode'],
isset($_POST['amavis_spam_tag2_subject']) ? $_POST['amavis_spam_tag2_subject'] : ''
);
$updates = array_merge($updates,$res);
}
if (isset($_POST['amavis_spam_tag3_subject_mode']) && $_POST['amavis_spam_tag3_subject_mode'] != "") {
$res = process_post_value('spam_tag3_subject',$_POST['amavis_spam_tag3_subject_mode'],
isset($_POST['amavis_spam_tag3_subject']) ? $_POST['amavis_spam_tag3_subject'] : ''
);
$updates = array_merge($updates,$res);
}
# General
if (isset($_POST['amavis_max_message_size_mode']) && $_POST['amavis_max_message_size_mode'] != "") {
$res = process_post_value('max_message_size',$_POST['amavis_max_message_size_mode'],
isset($_POST['amavis_max_message_size']) ? $_POST['amavis_max_message_size'] : ''
);
$updates = array_merge($updates,$res);
}
if (isset($_POST['amavis_banned_files_mode']) && $_POST['amavis_banned_files_mode'] != "") {
$res = process_post_list('banned_files',$_POST['amavis_banned_files_mode'],
isset($_POST['amavis_banned_files']) ? $_POST['amavis_banned_files'] : ''
);
$updates = array_merge($updates,$res);
}
# Whitelist & blacklist
if (isset($_POST['amavis_sender_whitelist_mode']) && $_POST['amavis_sender_whitelist_mode'] != "") {
$res = process_post_list('sender_whitelist',$_POST['amavis_sender_whitelist_mode'],
isset($_POST['amavis_sender_whitelist']) ? $_POST['amavis_sender_whitelist'] : ''
);
$updates = array_merge($updates,$res);
}
if (isset($_POST['amavis_sender_blacklist_mode']) && $_POST['amavis_sender_blacklist_mode'] != "") {
$res = process_post_list('sender_blacklist',$_POST['amavis_sender_blacklist_mode'],
isset($_POST['amavis_sender_blacklist']) ? $_POST['amavis_sender_blacklist'] : ''
);
$updates = array_merge($updates,$res);
}
# Notifications
if (isset($_POST['amavis_notify_admin_newvirus_mode']) && $_POST['amavis_notify_admin_newvirus_mode'] != "") {
$res = process_post_value('notify_admin_newvirus',$_POST['amavis_notify_admin_newvirus_mode'],
isset($_POST['amavis_notify_admin_newvirus']) ? $_POST['amavis_notify_admin_newvirus'] : ''
);
$updates = array_merge($updates,$res);
}
if (isset($_POST['amavis_notify_admin_virus_mode']) && $_POST['amavis_notify_admin_virus_mode'] != "") {
$res = process_post_value('notify_admin_virus',$_POST['amavis_notify_admin_virus_mode'],
isset($_POST['amavis_notify_admin_virus']) ? $_POST['amavis_notify_admin_virus'] : ''
);
$updates = array_merge($updates,$res);
}
if (isset($_POST['amavis_notify_admin_spam_mode']) && $_POST['amavis_notify_admin_spam_mode'] != "") {
$res = process_post_value('notify_admin_spam',$_POST['amavis_notify_admin_spam_mode'],
isset($_POST['amavis_notify_admin_spam']) ? $_POST['amavis_notify_admin_spam'] : ''
);
$updates = array_merge($updates,$res);
}
if (isset($_POST['amavis_notify_admin_banned_file_mode']) && $_POST['amavis_notify_admin_banned_file_mode'] != "") {
$res = process_post_value('notify_admin_banned_file',$_POST['amavis_notify_admin_banned_file_mode'],
isset($_POST['amavis_notify_admin_banned_file']) ? $_POST['amavis_notify_admin_banned_file'] : ''
);
$updates = array_merge($updates,$res);
}
if (isset($_POST['amavis_notify_admin_bad_header_mode']) && $_POST['amavis_notify_admin_bad_header_mode'] != "") {
$res = process_post_value('notify_admin_bad_header',$_POST['amavis_notify_admin_bad_header_mode'],
isset($_POST['amavis_notify_admin_bad_header']) ? $_POST['amavis_notify_admin_bad_header'] : ''
);
$updates = array_merge($updates,$res);
}
# Quarantine
if (isset($_POST['amavis_quarantine_virus_mode']) && $_POST['amavis_quarantine_virus_mode'] != "") {
$res = process_post_value('quarantine_virus',$_POST['amavis_quarantine_virus_mode'],
isset($_POST['amavis_quarantine_virus']) ? $_POST['amavis_quarantine_virus'] : ''
);
$updates = array_merge($updates,$res);
}
if (isset($_POST['amavis_quarantine_spam_mode']) && $_POST['amavis_quarantine_spam_mode'] != "") {
$res = process_post_value('quarantine_spam',$_POST['amavis_quarantine_spam_mode'],
isset($_POST['amavis_quarantine_spam']) ? $_POST['amavis_quarantine_spam'] : ''
);
$updates = array_merge($updates,$res);
}
if (isset($_POST['amavis_quarantine_banned_file_mode']) && $_POST['amavis_quarantine_banned_file_mode'] != "") {
$res = process_post_value('quarantine_banned_file',$_POST['amavis_quarantine_banned_file_mode'],
isset($_POST['amavis_quarantine_banned_file']) ? $_POST['amavis_quarantine_banned_file'] : ''
);
$updates = array_merge($updates,$res);
}
if (isset($_POST['amavis_quarantine_bad_header_mode']) && $_POST['amavis_quarantine_bad_header_mode'] != "") {
$res = process_post_value('quarantine_bad_header',$_POST['amavis_quarantine_bad_header_mode'],
isset($_POST['amavis_quarantine_bad_header']) ? $_POST['amavis_quarantine_bad_header'] : ''
);
$updates = array_merge($updates,$res);
}
# Interception
if (isset($_POST['amavis_bcc_to_mode']) && $_POST['amavis_bcc_to_mode'] != "") {
$res = process_post_value('bcc_to',$_POST['amavis_bcc_to_mode'],
isset($_POST['amavis_bcc_to']) ? $_POST['amavis_bcc_to'] : ''
);
$updates = array_merge($updates,$res);
}
# Whatever is left over
if (!empty($_POST['amavis_comment'])) {
array_push($updates,"Comment = ".$db->quote($_POST['amavis_comment']));
}
if (isset($_POST['amavis_disabled']) && $_POST['amavis_disabled'] != "") {
array_push($updates ,"Disabled = ".$db->quote($_POST['amavis_disabled']));
}
# Check if we have updates
if (sizeof($updates) > 0) {
$updateStr = implode(', ',$updates);
$res = $db->exec("UPDATE ${DB_TABLE_PREFIX}amavis_rules SET $updateStr WHERE ID = ".$db->quote($_POST['amavis_id']));
if ($res) {
?>
<div class="notice">Amavis rule updated</div>
<?php
} else {
?>
<div class="warning">Error updating Amavis rule!</div>
<div class="warning"><?php print_r($db->errorInfo()) ?></div>
<?php
}
} else {
?>
<div class="warning">No changes made to Amavis rule</div>
<?php
}
} else {
?>
<div class="warning">Invalid invocation</div>
<?php
}
printFooter();
# vim: ts=4
?>
<?php
# Module: Amavis delete
# Copyright (C) 2008, LinuxRulz
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
include_once("includes/header.php");
include_once("includes/footer.php");
include_once("includes/db.php");
$db = connect_db();
printHeader(array(
"Tabs" => array(
"Back to Amavis" => "amavis-main.php",
),
));
# Display delete confirm screen
if ($_POST['frmaction'] == "delete") {
# Check a amavis rule was selected
if (isset($_POST['amavis_id'])) {
?>
<p class="pageheader">Delete Amavis Rule</p>
<form action="amavis-delete.php" method="post">
<div>
<input type="hidden" name="frmaction" value="delete2" />
<input type="hidden" name="amavis_id" value="<?php echo $_POST['amavis_id']; ?>" />
</div>
<div class="textcenter">
Are you very sure? <br />
<input type="submit" name="confirm" value="yes" />
<input type="submit" name="confirm" value="no" />
</div>
</form>
<?php
} else {
?>
<div class="warning">No Amavis rule selected</div>
<?php
}
# SQL Updates
} elseif ($_POST['frmaction'] == "delete2") {
?>
<p class="pageheader">Amavis Rule Delete Results</p>
<?php
if (isset($_POST['amavis_id'])) {
if ($_POST['confirm'] == "yes") {
$res = $db->exec("DELETE FROM ${DB_TABLE_PREFIX}amavis_rules WHERE ID = ".$db->quote($_POST['amavis_id']));
if ($res) {
?>
<div class="notice">Amavis rule deleted</div>
<?php
} else {
?>
<div class="warning">Error deleting Amavis rule!</div>
<div class="warning"><?php print_r($db->errorInfo()) ?></div>
<?php
}
} else {
?>
<div class="notice">Amavis rule not deleted, aborted by user</div>
<?php
}
# Warn
} else {
?>
<div class="warning">Invocation error, no Amavis rule ID</div>
<?php
}
} else {
?>
<div class="warning">Invalid invocation</div>
<?php
}
printFooter();
# vim: ts=4
?>
<?php
# Main amavisd display
# Copyright (C) 2008, LinuxRulz
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
include_once("includes/header.php");
include_once("includes/footer.php");
include_once("includes/db.php");
$db = connect_db();
printHeader(array(
));
# If we have no action, display list
if (!isset($_POST['frmaction']))
{
?>
<p class="pageheader">Amavis Rule List</p>
<form id="main_form" action="amavis-main.php" method="post">
<div class="textcenter">
Action
<select id="main_form_action" name="frmaction"
onchange="
var myform = document.getElementById('main_form');
var myobj = document.getElementById('main_form_action');
if (myobj.selectedIndex == 2) {
myform.action = 'amavis-add.php';
} else if (myobj.selectedIndex == 4) {
myform.action = 'amavis-change.php';
} else if (myobj.selectedIndex == 5) {
myform.action = 'amavis-delete.php';
}
myform.submit();
">
<option selected="selected">select action</option>
<option disabled="disabled"> - - - - - - - - - - - </option>
<option value="add">Add</option>
<option disabled="disabled"> - - - - - - - - - - - </option>
<option value="change">Change</option>
<option value="delete">Delete</option>
</select>
</div>
<p />
<table class="results" style="width: 75%;">
<tr class="resultstitle">
<td id="noborder"></td>
<td class="textcenter">Policy</td>
<td class="textcenter">Name</td>
<td class="textcenter">Disabled</td>
</tr>
<?php
$sql = "
SELECT
${DB_TABLE_PREFIX}amavis_rules.ID, ${DB_TABLE_PREFIX}amavis_rules.Name, ${DB_TABLE_PREFIX}amavis_rules.Disabled,
${DB_TABLE_PREFIX}policies.Name AS PolicyName
FROM
${DB_TABLE_PREFIX}amavis_rules, ${DB_TABLE_PREFIX}policies
WHERE
${DB_TABLE_PREFIX}policies.ID = ${DB_TABLE_PREFIX}amavis_rules.PolicyID
ORDER BY
${DB_TABLE_PREFIX}policies.Name
";
$res = $db->query($sql);
while ($row = $res->fetchObject()) {
?>
<tr class="resultsitem">
<td><input type="radio" name="amavis_id" value="<?php echo $row->id ?>" /></td>
<td><?php echo $row->policyname ?></td>
<td><?php echo $row->name ?></td>
<td class="textcenter"><?php echo $row->disabled ? 'yes' : 'no' ?></td>
</tr>
<?php
}
$res->closeCursor();
?>
</table>
</form>
<?php
}
printFooter();
# vim: ts=4
?>
<?php
# Policy add
# Copyright (C) 2008, LinuxRulz
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
session_start();
include_once("includes/header.php");
include_once("includes/footer.php");
include_once("includes/db.php");
include_once("includes/tooltips.php");
$db = connect_db();
printHeader(array(
"Tabs" => array(
"Back to user list" => "user-main.php"
),
));
if ($_POST['frmaction'] == "add") {
?>
<p class="pageheader">Add attribute</p>
<form method="post" action="attribute-add.php">
<div>
<input type="hidden" name="frmaction" value="add2" />
</div>
<table class="entry">
<tr>
<td class="entrytitle">Attribute Name</td>
<td><input type="text" name="attr_name" /></td>
</tr>
<tr>
<td class="entrytitle">Operator</td>
<td>
<select name="attr_operator">
<option value="=">=</option>
<option value="==">==</option>
<option value=":=">:=</option>
<option value="+=">+=</option>
<option value="!=">!=</option>
<option value=">">&gt</option>
<option value="<">&lt</option>
<option value=">=">&gt=</option>
<option value="<=">&lt=</option>
<option value="=~">=~</option>
<option value="!~">!~</option>
<option value="=*">=*</option>
<option value="!*">!*</option>
<option value="||=">||=</option>
<option value="||==">||==</option>
</select>
</td>
</tr>
<tr>
<td class="entrytitle">Value</td>
<td><input type="text" name="attr_value" /></td>
</tr>
<tr>
<td colspan="2">
<input type="submit" />
</td>
</tr>
</table>
</form>
<?php
# Check we have all params
} elseif ($_POST['frmaction'] == "add2") {
?>
<p class="pageheader">Attribute Add Results</p>
<?php
# Check for empty values
if (empty($_POST['attr_name']) || empty($_POST['attr_operator']) || empty($_POST['attr_value'])) {
?>
<div class="warning">Submission cannot have empty value</div>
<?php
} else {
$stmt = $db->prepare("INSERT INTO ${DB_TABLE_PREFIX}user_attributes (UserID,Name,Operator,Value) VALUES (?,?,?,?)");
# Which user am I working with?
$attr_user_id = $_SESSION['attr_user_id'];
$res = $stmt->execute(array(
$attr_user_id,
$_POST['attr_name'],
$_POST['attr_operator'],
$_POST['attr_value'],
));
if ($res) {
?>
<div class="notice">Attribute added</div>
<?php
session_destroy();
} else {
?>
<div class="warning">Failed to add attribute</div>
<div class="warning"><?php print_r($stmt->errorInfo()) ?></div>
<?php
}
}
} else {
?>
<div class="warning">Invalid invocation</div>
<?php
}
printFooter();
# vim: ts=4
?>
<?php
# Policy member change
# Copyright (C) 2008, LinuxRulz
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
include_once("includes/header.php");
include_once("includes/footer.php");
include_once("includes/db.php");
include_once("includes/tooltips.php");
$db = connect_db();
printHeader(array(
"Tabs" => array(
"Back to members" => "user-main.php",
),
));
# Display change screen
if ($_POST['frmaction'] == "change") {
# Check an attribute was selected
if (isset($_POST['attr_id'])) {
# Prepare statement
$temp = $_POST['attr_id'];
$sql = "SELECT ID, Name, Operator, Value, Disabled FROM ${DB_TABLE_PREFIX}user_attributes WHERE ID = $temp";
$res = $db->query($sql);
$row = $res->fetchObject();
?>
<p class="pageheader">Update User</p>
<form action="attribute-change.php" method="post">
<div>
<input type="hidden" name="frmaction" value="change2" />
<input type="hidden" name="attr_id" value="<?php echo $_POST['attr_id']; ?>" />
</div>
<table class="entry" style="width: 75%;">
<tr>
<td></td>
<td class="entrytitle textcenter">Old Value</td>
<td class="entrytitle textcenter">New Value</td>
</tr>
<tr>
<td class="entrytitle texttop">
Name
<?php tooltip('user_attributes_name'); ?>
</td>
<td class="oldval texttop"><?php echo $row->name ?></td>
<td><textarea name="user_attributes_name" cols="40" rows="1"></textarea></td>
</tr>
<tr>
<td class="entrytitle texttop">
Operator
<?php tooltip('user_attributes_operator'); ?>
</td>
<td class="oldval texttop"><?php echo $row->operator ?></td>
<td>
<select name="user_attributes_operator">
<option value="=">=</option>
<option value="==">==</option>
<option value=":=">:=</option>
<option value="+=">+=</option>
<option value="!=">!=</option>
<option value=">">&gt</option>
<option value="<">&lt</option>
<option value=">=">&gt=</option>
<option value="<=">&lt=</option>
<option value="=~">=~</option>
<option value="!~">!~</option>
<option value="=*">=*</option>
<option value="!*">!*</option>
<option value="||=">||=</option>
<option value="||==">||==</option>
</select>
</td>
</tr>
<tr>
<td class="entrytitle texttop">Value</td>
<td class="oldval texttop"><?php echo $row->value ?></td>
<td><textarea name="user_attributes_value" cols="40" rows="5"></textarea></td>
</tr>
<tr>
<td class="entrytitle">Disabled</td>
<td class="oldval"><?php echo $row->disabled ? 'yes' : 'no' ?></td>
<td>
<select name="user_attributes_disabled" />
<option value="">--</option>
<option value="0">No</option>
<option value="1">Yes</option>
</select>
</td>
</tr>
</table>
<p />
<div class="textcenter">
<input type="submit" />
</div>
</form>
<?php
$res->closeCursor();
} else {
?>
<div class="warning">No attribute selected</div>
<?php
}
# SQL Updates
} elseif ($_POST['frmaction'] == "change2") {
?>
<p class="pageheader">Attribute Update Results</p>
<?php
# Check an attribute was selected
if (isset($_POST['attr_id'])) {
$updates = array();
if (!empty($_POST['user_attributes_name'])) {
array_push($updates,"Name = ".$db->quote($_POST['user_attributes_name']));
}
if (isset($_POST['user_attributes_operator']) && $_POST['user_attributes_operator'] != "") {
array_push($updates,"Operator = ".$db->quote($_POST['user_attributes_operator']));
}
if (!empty($_POST['user_attributes_value'])) {
array_push($updates,"Value = ".$db->quote($_POST['user_attributes_value']));
}
if (isset($_POST['user_attributes_disabled']) && $_POST['user_attributes_disabled'] != "") {
array_push($updates ,"Disabled = ".$db->quote($_POST['user_attributes_disabled']));
}
# Check if we have updates
if (sizeof($updates) > 0) {
$updateStr = implode(', ',$updates);
$res = $db->exec("UPDATE ${DB_TABLE_PREFIX}user_attributes SET $updateStr WHERE ID = ".$db->quote($_POST['attr_id']));
if ($res) {
?>
<div class="notice">Attribute updated</div>
<?php
} else {
?>
<div class="warning">Error updating attribute</div>
<div class="warning"><?php print_r($db->errorInfo()) ?></div>
<?php
}
# Warn
} else {
?>
<div class="warning">No attribute updates</div>
<?php
}
# Warn
} else {
?>
<div class="error">No attribute data available</div>
<?php
}
} else {
?>
<div class="warning">Invalid invocation</div>
<?php
}
printFooter();
# vim: ts=4
?>
<?php
# Module: Policy delete
# Copyright (C) 2008, LinuxRulz
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
include_once("includes/header.php");
include_once("includes/footer.php");
include_once("includes/db.php");
$db = connect_db();
printHeader(array(
"Tabs" => array(
"Back to user list" => "user-main.php",
),
));
# Display delete confirm screen
if ($_POST['frmaction'] == "delete") {
# Check a user was selected
if (isset($_POST['attr_id'])) {
?>
<p class="pageheader">Delete Attribute</p>
<form action="attribute-delete.php" method="post">
<div>
<input type="hidden" name="frmaction" value="delete2" />
<input type="hidden" name="attr_id" value="<?php echo $_POST['attr_id']; ?>" />
</div>
<div class="textcenter">
Are you very sure? <br />
<input type="submit" name="confirm" value="yes" />
<input type="submit" name="confirm" value="no" />
</div>
</form>
<?php
} else {
?>
<div class="warning">No attribute selected</div>
<?php
}
# SQL Updates
} elseif ($_POST['frmaction'] == "delete2") {
?>
<p class="pageheader">Attribute Delete Results</p>
<?php
if (isset($_POST['attr_id'])) {
if ($_POST['confirm'] == "yes") {
$res = $db->exec("DELETE FROM ${DB_TABLE_PREFIX}user_attributes WHERE ID = ".$_POST['attr_id']);
if ($res !== FALSE) {
?>
<div class="notice">Attribute with ID: <?php print_r($_POST['attr_id']);?> deleted</div>
<?php
} else {
?>
<div class="warning">Error deleting attribute</div>
<div class="warning"><?php print_r($db->errorInfo()) ?></div>
<?php
}
?>
<?php
# Warn
} else {
?>
<div class="warning">Delete attribute aborted</div>
<?php
}
?>
<?php
} else {
?>
<div class="warning">Invocation error, no attribute ID selected</div>
<?php
}
}
printFooter();
# vim: ts=4
?>
<?php
# Module: CheckHelo add
# Copyright (C) 2008, LinuxRulz
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
include_once("includes/header.php");
include_once("includes/footer.php");
include_once("includes/db.php");
include_once("includes/tooltips.php");
$db = connect_db();
printHeader(array(
"Tabs" => array(
"Back to HELO checks" => "checkhelo-main.php"
),
));
if ($_POST['frmaction'] == "add") {
?>
<p class="pageheader">Add HELO/EHLO Check</p>
<form method="post" action="checkhelo-add.php">
<div>
<input type="hidden" name="frmaction" value="add2" />
</div>
<table class="entry">
<tr>
<td class="entrytitle">Name</td>
<td><input type="text" name="checkhelo_name" /></td>
</tr>
<tr>
<td class="entrytitle">Link to policy</td>
<td>
<select name="checkhelo_policyid">
<?php
$res = $db->query("SELECT ID, Name FROM ${DB_TABLE_PREFIX}policies ORDER BY Name");
while ($row = $res->fetchObject()) {
?>
<option value="<?php echo $row->id ?>"><?php echo $row->name ?></option>
<?php
}
$res->closeCursor();
?>
</select>
</td>
</tr>
<tr>
<td colspan="2" class="textcenter" style="border-bottom: 1px dashed black;">Blacklisting</td>
</tr>
<tr>
<td class="entrytitle">Use Blacklist</td>
<td>
<select name="checkhelo_useblacklist">
<option value="0" selected="selected">Inherit</option>
<option value="1">Yes</option>
<option value="2">No</option>
</select>
</td>
</tr>
<tr>
<td class="entrytitle">
Blacklist Period
<?php tooltip('checkhelo_blacklist_period'); ?>
</td>
<td><input type="text" name="checkhelo_blacklistperiod" /></td>
</tr>
<tr>
<td colspan="2" class="textcenter" style="border-bottom: 1px dashed black;">Randomization Prevention</td>
</tr>
<tr>
<td class="entrytitle">
Use HRP
</td>
<td>
<select name="checkhelo_usehrp">
<option value="0" selected="selected">Inherit</option>
<option value="1">Yes</option>
<option value="2">No</option>
</select>
</td>
</tr>
<tr>
<td class="entrytitle">
HRP Period
<?php tooltip('checkhelo_blacklist_hrpperiod'); ?>
</td>
<td><input type="text" name="checkhelo_hrpperiod" /></td>
</tr>
<tr>
<td class="entrytitle">
HRP Limit
<?php tooltip('checkhelo_blacklist_hrplimit'); ?>
</td>
<td><input type="text" name="checkhelo_hrplimit" /></td>
</tr>
<tr>
<td colspan="2" class="textcenter" style="border-bottom: 1px dashed black;">Reject (RFC non-compliance)</td>
</tr>
<tr>
<td class="entrytitle">
Reject Invalid
<?php tooltip('checkhelo_rejectinvalid'); ?>
</td>
<td>
<select name="checkhelo_rejectinvalid">
<option value="0" selected="selected">Inherit</option>
<option value="1">Yes</option>
<option value="2">No</option>
</select>
</td>
</tr>
<tr>
<td class="entrytitle">
Reject non-literal IP
<?php tooltip('checkhelo_rejectip'); ?>
</td>
<td>
<select name="checkhelo_rejectip">
<option value="0" selected="selected">Inherit</option>
<option value="1">Yes</option>
<option value="2">No</option>
</select>
</td>
</tr>
<tr>
<td class="entrytitle">
Reject Unresolvable
<?php tooltip('checkhelo_rejectunresolv'); ?>
</td>
<td>
<select name="checkhelo_rejectunresolvable">
<option value="0" selected="selected">Inherit</option>
<option value="1">Yes</option>
<option value="2">No</option>
</select>
</td>
</tr>
<tr>
<td colspan="2" class="textcenter" style="border-bottom: 1px dashed black;">&nbsp;</td>
</tr>
<tr>
<td class="entrytitle">Comment</td>
<td><textarea name="checkhelo_comment" cols="40" rows="5"></textarea></td>
</tr>
<tr>
<td colspan="2">
<input type="submit" />
</td>
</tr>
</table>
</form>
<?php
# Check we have all params
} elseif ($_POST['frmaction'] == "add2") {
?>
<p class="pageheader">HELO/EHLO Check Add Results</p>
<?php
# Check name
if (empty($_POST['checkhelo_policyid'])) {
?>
<div class="warning">Policy ID cannot be empty</div>
<?php
# Check name
} elseif (empty($_POST['checkhelo_name'])) {
?>
<div class="warning">Name cannot be empty</div>
<?php
} else {
# Sort out using of blacklist
switch ($_POST['checkhelo_useblacklist']) {
case "0":
$useBlacklist = null;
break;
case "1":
$useBlacklist = 1;
break;
case "2":
$useBlacklist = 0;
break;
}
# Check period
if (empty($_POST['checkhelo_blacklistperiod'])) {
$blacklistPeriod = null;
} else {
$blacklistPeriod = $_POST['checkhelo_blacklistperiod'];
}
# Sort out using of HRP
switch ($_POST['checkhelo_usehrp']) {
case "0":
$useHRP = null;
break;
case "1":
$useHRP = 1;
break;
case "2":
$useHRP = 0;
break;
}
# Check period
if (empty($_POST['checkhelo_hrpperiod'])) {
$HRPPeriod = null;
} else {
$HRPPeriod = $_POST['checkhelo_hrpperiod'];
}
# Check limit
if (empty($_POST['checkhelo_hrplimit'])) {
$HRPLimit = null;
} else {
$HRPLimit = $_POST['checkhelo_hrplimit'];
}
# Sort out checking invalid HELO's
switch ($_POST['checkhelo_rejectinvalid']) {
case "0":
$rejectInvalid = null;
break;
case "1":
$rejectInvalid = 1;
break;
case "2":
$rejectInvalid = 0;
break;
}
# Sort out checking HELO's for IP's
switch ($_POST['checkhelo_rejectip']) {
case "0":
$rejectIP = null;
break;
case "1":
$rejectIP = 1;
break;
case "2":
$rejectIP = 0;
break;
}
# Sort out checking HELO's are resolvable
switch ($_POST['checkhelo_rejectunresolvable']) {
case "0":
$rejectUnresolvable = null;
break;
case "1":
$rejectUnresolvable = 1;
break;
case "2":
$rejectUnresolvable = 0;
break;
}
$stmt = $db->prepare("
INSERT INTO ${DB_TABLE_PREFIX}checkhelo
(
PolicyID,Name,
UseBlacklist,BlacklistPeriod,
UseHRP,HRPPeriod,HRPLimit,
RejectInvalid,RejectIP,RejectUnresolvable,
Comment,Disabled
)
VALUES
(
?,?,
?,?,
?,?,?,
?,?,?,
?,1
)
");
$res = $stmt->execute(array(
$_POST['checkhelo_policyid'],
$_POST['checkhelo_name'],
$useBlacklist,$blacklistPeriod,
$useHRP,$HRPPeriod,$HRPLimit,
$rejectInvalid,$rejectIP,$rejectUnresolvable,
$_POST['checkhelo_comment']
));
if ($res) {
?>
<div class="notice">HELO/EHLO check created</div>
<?php
} else {
?>
<div class="warning">Failed to create HELO/EHLO check</div>
<div class="warning"><?php print_r($stmt->errorInfo()) ?></div>
<?php
}
}
} else {
?>
<div class="warning">Invalid invocation</div>
<?php
}
printFooter();
# vim: ts=4
?>
<?php
# Module: CheckHelo (blacklist) add
# Copyright (C) 2008, LinuxRulz
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
include_once("includes/header.php");
include_once("includes/footer.php");
include_once("includes/db.php");
include_once("includes/tooltips.php");
$db = connect_db();
printHeader(array(
"Tabs" => array(
"Back to blacklist" => "checkhelo-blacklist-main.php"
),
));
if ($_POST['frmaction'] == "add") {
?>
<p class="pageheader">Add HELO/EHLO Blacklist</p>
<form method="post" action="checkhelo-blacklist-add.php">
<div>
<input type="hidden" name="frmaction" value="add2" />
</div>
<table class="entry">
<tr>
<td class="entrytitle">
Helo
<?php tooltip('checkhelo_blacklist_helo'); ?>
</td>
<td><input type="text" name="blacklist_helo" /></td>
</tr>
<tr>
<td class="entrytitle">Comment</td>
<td><textarea name="blacklist_comment" cols="40" rows="5"></textarea></td>
</tr>
<tr>
<td colspan="2">
<input type="submit" />
</td>
</tr>
</table>
</form>
<?php
# Check we have all params
} elseif ($_POST['frmaction'] == "add2") {
?>
<p class="pageheader">HELO/EHLO Blacklist Add Results</p>
<?php
# Check name
if (empty($_POST['blacklist_helo'])) {
?>
<div class="warning">Helo cannot be empty</div>
<?php
} else {
$stmt = $db->prepare("INSERT INTO ${DB_TABLE_PREFIX}checkhelo_blacklist (Helo,Comment,Disabled) VALUES (?,?,1)");
$res = $stmt->execute(array(
$_POST['blacklist_helo'],
$_POST['blacklist_comment']
));
if ($res) {
?>
<div class="notice">HELO/EHLO blacklist created</div>
<?php
} else {
?>
<div class="warning">Failed to create HELO/EHLO blacklisting</div>
<div class="warning"><?php print_r($stmt->errorInfo()) ?></div>
<?php
}
}
} else {
?>
<div class="warning">Invalid invocation</div>
<?php
}
printFooter();
# vim: ts=4
?>
<?php
# Module: CheckHelo (blacklist) change
# Copyright (C) 2008, LinuxRulz
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
include_once("includes/header.php");
include_once("includes/footer.php");
include_once("includes/db.php");
include_once("includes/tooltips.php");
$db = connect_db();
printHeader(array(
"Tabs" => array(
"Back to blacklist" => "checkhelo-blacklist-main.php"
),
));
# Display change screen
if ($_POST['frmaction'] == "change") {
# Check a checkhelo blacklist was selected
if (isset($_POST['blacklist_id'])) {
# Prepare statement
$stmt = $db->prepare("
SELECT
ID, Helo, Comment,
Disabled
FROM
${DB_TABLE_PREFIX}checkhelo_blacklist
WHERE
ID = ?
");
?>
<p class="pageheader">Update HELO/EHLO Blacklist</p>
<form action="checkhelo-blacklist-change.php" method="post">
<div>
<input type="hidden" name="frmaction" value="change2" />
<input type="hidden" name="blacklist_id" value="<?php echo $_POST['blacklist_id']; ?>" />
</div>
<?php
$res = $stmt->execute(array($_POST['blacklist_id']));
$row = $stmt->fetchObject();
$stmt->closeCursor();
?>
<table class="entry" style="width: 75%;">
<tr>
<td></td>
<td class="entrytitle textcenter">Old Value</td>
<td class="entrytitle textcenter">New Value</td>
</tr>
<tr>
<td class="entrytitle">
Helo
<?php tooltip('checkhelo_blacklist_helo'); ?>
</td>
<td class="oldval"><?php echo $row->helo ?></td>
<td><input type="text" name="blacklist_helo" /></td>
</tr>
<tr>
<td class="entrytitle texttop">Comment</td>
<td class="oldval texttop"><?php echo $row->comment ?></td>
<td><textarea name="blacklist_comment" cols="40" rows="5"></textarea></td>
</tr>
<tr>
<td class="entrytitle">Disabled</td>
<td class="oldval"><?php echo $row->disabled ? 'yes' : 'no' ?></td>
<td>
<select name="blacklist_disabled">
<option value="">--</option>
<option value="0">No</option>
<option value="1">Yes</option>
</select>
</td>
</tr>
</table>
<p />
<div class="textcenter">
<input type="submit" />
</div>
</form>
<?php
} else {
?>
<div class="warning">No blacklisting selected</div>
<?php
}
# SQL Updates
} elseif ($_POST['frmaction'] == "change2") {
?>
<p class="pageheader">HELO/EHLO Blacklisting Update Results</p>
<?php
$updates = array();
if (!empty($_POST['blacklist_helo'])) {
array_push($updates,"Helo = ".$db->quote($_POST['blacklist_helo']));
}
if (!empty($_POST['blacklist_comment'])) {
array_push($updates,"Comment = ".$db->quote($_POST['blacklist_comment']));
}
if (isset($_POST['blacklist_disabled']) && $_POST['blacklist_disabled'] != "") {
array_push($updates ,"Disabled = ".$db->quote($_POST['blacklist_disabled']));
}
# Check if we have updates
if (sizeof($updates) > 0) {
$updateStr = implode(', ',$updates);
$res = $db->exec("UPDATE ${DB_TABLE_PREFIX}checkhelo_blacklist SET $updateStr WHERE ID = ".$db->quote($_POST['blacklist_id']));
if ($res) {
?>
<div class="notice">HELO/EHLO blacklisting updated</div>
<?php
} else {
?>
<div class="warning">Error updating HELO/EHLO blacklisting!</div>
<div class="warning"><?php print_r($db->errorInfo()) ?></div>
<?php
}
} else {
?>
<div class="warning">No changes made to HELO/EHLO blacklisting</div>
<?php
}
} else {
?>
<div class="warning">Invalid invocation</div>
<?php
}
printFooter();
# vim: ts=4
?>
<?php
# Module: CheckHelo (blacklist) delete
# Copyright (C) 2008, LinuxRulz
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
include_once("includes/header.php");
include_once("includes/footer.php");
include_once("includes/db.php");
$db = connect_db();
printHeader(array(
"Tabs" => array(
"Back to blacklist" => "checkhelo-blacklist-main.php",
),
));
# Display delete confirm screen
if ($_POST['frmaction'] == "delete") {
# Check a blacklisting was selected
if (isset($_POST['blacklist_id'])) {
?>
<p class="pageheader">Delete HELO/EHLO blacklist</p>
<form action="checkhelo-blacklist-delete.php" method="post">
<div>
<input type="hidden" name="frmaction" value="delete2" />
<input type="hidden" name="blacklist_id" value="<?php echo $_POST['blacklist_id']; ?>" />
</div>
<div class="textcenter">
Are you very sure? <br />
<input type="submit" name="confirm" value="yes" />
<input type="submit" name="confirm" value="no" />
</div>
</form>
<?php
} else {
?>
<div class="warning">No HELO/EHLO blacklisting selected</div>
<?php
}
# SQL Updates
} elseif ($_POST['frmaction'] == "delete2") {
?>
<p class="pageheader">HELO/EHLO Blacklist Delete Results</p>
<?php
if (isset($_POST['blacklist_id'])) {
if ($_POST['confirm'] == "yes") {
$res = $db->exec("DELETE FROM ${DB_TABLE_PREFIX}checkhelo_blacklist WHERE ID = ".$db->quote($_POST['blacklist_id']));
if ($res) {
?>
<div class="notice">HELO/EHLO blacklist deleted</div>
<?php
} else {
?>
<div class="warning">Error deleting HELO/EHLO blacklist!</div>
<div class="warning"><?php print_r($db->errorInfo()) ?></div>
<?php
}
} else {
?>
<div class="notice">HELO/EHLO blacklist not deleted, aborted by user</div>
<?php
}
# Warn
} else {
?>
<div class="warning">Invocation error, no whitelist ID</div>
<?php
}
} else {
?>
<div class="warning">Invalid invocation</div>
<?php
}
printFooter();
# vim: ts=4
?>
<?php
# Module: CheckHelo (blacklisting)
# Copyright (C) 2008, LinuxRulz
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
include_once("includes/header.php");
include_once("includes/footer.php");
include_once("includes/db.php");
$db = connect_db();
printHeader(array(
));
# If we have no action, display list
if (!isset($_POST['frmaction']))
{
?>
<p class="pageheader">HELO/EHLO Blacklistings</p>
<form id="main_form" action="checkhelo-main.php" method="post">
<div class="textcenter">
Action
<select id="main_form_action" name="frmaction"
onchange="
var myform = document.getElementById('main_form');
var myobj = document.getElementById('main_form_action');
if (myobj.selectedIndex == 2) {
myform.action = 'checkhelo-blacklist-add.php';
} else if (myobj.selectedIndex == 4) {
myform.action = 'checkhelo-blacklist-change.php';
} else if (myobj.selectedIndex == 5) {
myform.action = 'checkhelo-blacklist-delete.php';
}
myform.submit();
">
<option selected="selected">select action</option>
<option disabled="disabled"> - - - - - - - - - - - </option>
<option value="add">Add</option>
<option disabled="disabled"> - - - - - - - - - - - </option>
<option value="change">Change</option>
<option value="delete">Delete</option>
</select>
</div>
<p />
<table class="results" style="width: 75%;">
<tr class="resultstitle">
<td id="noborder"></td>
<td class="textcenter">HELO/EHLO</td>
<td class="textcenter">Disabled</td>
</tr>
<?php
$sql = "
SELECT
ID, Helo, Disabled
FROM
${DB_TABLE_PREFIX}checkhelo_blacklist
ORDER BY
Helo
";
$res = $db->query($sql);
while ($row = $res->fetchObject()) {
?>
<tr class="resultsitem">
<td><input type="radio" name="blacklist_id" value="<?php echo $row->id ?>" /></td>
<td><?php echo $row->helo ?></td>
<td class="textcenter"><?php echo $row->disabled ? 'yes' : 'no' ?></td>
</tr>
<?php
}
$res->closeCursor();
?>
</table>
</form>
<?php
}
printFooter();
# vim: ts=4
?>
<?php
# Module: CheckHelo change
# Copyright (C) 2008, LinuxRulz
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
include_once("includes/header.php");
include_once("includes/footer.php");
include_once("includes/db.php");
include_once("includes/tooltips.php");
$db = connect_db();
printHeader(array(
"Tabs" => array(
"Back to HELO checks" => "checkhelo-main.php"
),
));
# Display change screen
if ($_POST['frmaction'] == "change") {
# Check a helo check was selected
if (isset($_POST['checkhelo_id'])) {
# Prepare statement
$stmt = $db->prepare("
SELECT
${DB_TABLE_PREFIX}checkhelo.ID, ${DB_TABLE_PREFIX}checkhelo.PolicyID, ${DB_TABLE_PREFIX}checkhelo.Name,
${DB_TABLE_PREFIX}checkhelo.UseBlacklist, ${DB_TABLE_PREFIX}checkhelo.BlacklistPeriod,
${DB_TABLE_PREFIX}checkhelo.UseHRP, ${DB_TABLE_PREFIX}checkhelo.HRPPeriod, ${DB_TABLE_PREFIX}checkhelo.HRPLimit,
${DB_TABLE_PREFIX}checkhelo.RejectInvalid, ${DB_TABLE_PREFIX}checkhelo.RejectIP, ${DB_TABLE_PREFIX}checkhelo.RejectUnresolvable,
${DB_TABLE_PREFIX}checkhelo.Comment,
${DB_TABLE_PREFIX}checkhelo.Disabled,
${DB_TABLE_PREFIX}policies.Name AS PolicyName
FROM
${DB_TABLE_PREFIX}checkhelo, ${DB_TABLE_PREFIX}policies
WHERE
${DB_TABLE_PREFIX}checkhelo.ID = ?
AND ${DB_TABLE_PREFIX}policies.ID = ${DB_TABLE_PREFIX}checkhelo.PolicyID
");
?>
<p class="pageheader">Update HELO/EHLO Check</p>
<form action="checkhelo-change.php" method="post">
<div>
<input type="hidden" name="frmaction" value="change2" />
<input type="hidden" name="checkhelo_id" value="<?php echo $_POST['checkhelo_id']; ?>" />
</div>
<?php
$res = $stmt->execute(array($_POST['checkhelo_id']));
$row = $stmt->fetchObject();
?>
<table class="entry" style="width: 75%;">
<tr>
<td></td>
<td class="entrytitle textcenter">Old Value</td>
<td class="entrytitle textcenter">New Value</td>
</tr>
<tr>
<td class="entrytitle">Name</td>
<td class="oldval"><?php echo $row->name ?></td>
<td><input type="text" name="checkhelo_name" /></td>
</tr>
<tr>
<td class="entrytitle">Link to policy</td>
<td class="oldval"><?php echo $row->policyname ?></td>
<td>
<select name="checkhelo_policyid">
<option value="">--</option>
<?php
$res = $db->query("SELECT ID, Name FROM ${DB_TABLE_PREFIX}policies ORDER BY Name");
while ($row2 = $res->fetchObject()) {
?>
<option value="<?php echo $row2->id ?>" ><?php echo $row2->name ?></option>
<?php
}
$res->closeCursor();
?>
</select>
</td>
</tr>
<tr>
<td colspan="3" class="textcenter" style="border-bottom: 1px dashed black;">Blacklisting</td>
</tr>
<tr>
<td class="entrytitle">Use Blacklist</td>
<td class="oldval"><?php
switch ($row->useblacklist) {
case null:
echo "Inherit";
break;
case 1:
echo "Yes";
break;
case 0:
echo "No";
break;
default:
echo "UNKNOWN";
break;
}
?></td>
<td>
<select name="checkhelo_useblacklist">
<option value="">--</option>
<option value="1">Inherit</option>
<option value="2">Yes</option>
<option value="3">No</option>
</select>
</td>
</tr>
<tr>
<td class="entrytitle">
Blacklist Period
<?php tooltip('checkhelo_blacklist_period'); ?>
</td>
<td class="oldval"><?php echo is_null($row->blacklistperiod) ? '*inherited*' : $row->blacklistperiod ?></td>
<td>
<input type="text" name="checkhelo_blacklistperiod" />
<select name="checkhelo_blacklistperiod_m">
<option value="">--</option>
<option value="1">Inherit</option>
<option value="2">Overwrite</option>
</select>
</td>
</tr>
<tr>
<td colspan="3" class="textcenter" style="border-bottom: 1px dashed black;">Randomization Prevention</td>
</tr>
<tr>
<td class="entrytitle">
Use HRP
</td>
<td class="oldval"><?php
switch ($row->usehrp) {
case null:
echo "Inherit";
break;
case 1:
echo "Yes";
break;
case 0:
echo "No";
break;
default:
echo "UNKNOWN";
break;
}
?></td>
<td>
<select name="checkhelo_usehrp">
<option value="">--</option>
<option value="1">Inherit</option>
<option value="2">Yes</option>
<option value="3">No</option>
</select>
</td>
</tr>
<tr>
<td class="entrytitle">
HRP Period
<?php tooltip('checkhelo_blacklist_hrpperiod'); ?>
</td>
<td class="oldval"><?php echo is_null($row->hrpperiod) ? '*inherited*' : $row->hrpperiod ?></td>
<td>
<input type="text" name="checkhelo_hrpperiod" />
<select name="checkhelo_hrpperiod_m">
<option value="">--</option>
<option value="1">Inherit</option>
<option value="2">Overwrite</option>
</select>
</td>
</tr>
<tr>
<td class="entrytitle">
HRP Limit
<?php tooltip('checkhelo_blacklist_hrplimit'); ?>
</td>
<td class="oldval"><?php echo is_null($row->hrplimit) ? '*inherited*' : $row->hrplimit ?></td>
<td>
<input type="text" name="checkhelo_hrplimit" />
<select name="checkhelo_hrplimit_m">
<option value="">--</option>
<option value="1">Inherit</option>
<option value="2">Overwrite</option>
</select>
</td>
</tr>
<tr>
<td colspan="3" class="textcenter" style="border-bottom: 1px dashed black;">Reject (RFC non-compliance)</td>
</tr>
<tr>
<td class="entrytitle">
Reject Invalid
<?php tooltip('checkhelo_rejectinvalid'); ?>
</td>
<td class="oldval"><?php
switch ($row->rejectinvalid) {
case null:
echo "Inherit";
break;
case 1:
echo "Yes";
break;
case 0:
echo "No";
break;
default:
echo "UNKNOWN";
break;
}
?></td>
<td>
<select name="checkhelo_rejectinvalid">
<option value="">--</option>
<option value="1">Inherit</option>
<option value="2">Yes</option>
<option value="3">No</option>
</select>
</td>
</tr>
<tr>
<td class="entrytitle">
Reject non-literal IP
<?php tooltip('checkhelo_rejectip'); ?>
</td>
<td class="oldval"><?php
switch ($row->rejectip) {
case null:
echo "Inherit";
break;
case 1:
echo "Yes";
break;
case 0:
echo "No";
break;
default:
echo "UNKNOWN";
break;
}
?></td>
<td>
<select name="checkhelo_rejectip">
<option value="">--</option>
<option value="1">Inherit</option>
<option value="2">Yes</option>
<option value="3">No</option>
</select>
</td>
</tr>
<tr>
<td class="entrytitle">
Reject Unresolvable
<?php tooltip('checkhelo_rejectunresolv'); ?>
</td>
<td class="oldval"><?php
switch ($row->rejectunresolvable) {
case null:
echo "Inherit";
break;
case 1:
echo "Yes";
break;
case 0:
echo "No";
break;
default:
echo "UNKNOWN";
break;
}
?></td>
<td>
<select name="checkhelo_rejectunresolvable">
<option value="">--</option>
<option value="1">Inherit</option>
<option value="2">Yes</option>
<option value="3">No</option>
</select>
</td>
</tr>
<tr>
<td colspan="3" class="textcenter" style="border-bottom: 1px dashed black;">&nbsp;</td>
</tr>
<tr>
<td class="entrytitle texttop">Comment</td>
<td class="oldval texttop"><?php echo $row->comment ?></td>
<td><textarea name="checkhelo_comment" cols="40" rows="5"></textarea></td>
</tr>
<tr>
<td class="entrytitle">Disabled</td>
<td class="oldval"><?php echo $row->disabled ? 'yes' : 'no' ?></td>
<td>
<select name="checkhelo_disabled">
<option value="">--</option>
<option value="0">No</option>
<option value="1">Yes</option>
</select>
</td>
</tr>
</table>
<p />
<div class="textcenter">
<input type="submit" />
</div>
</form>
<?php
} else {
?>
<div class="warning">No HELO/EHLO check selected</div>
<?php
}
# SQL Updates
} elseif ($_POST['frmaction'] == "change2") {
?>
<p class="pageheader">HELO/EHLO Update Results</p>
<?php
$updates = array();
# Process all our options below
if (!empty($_POST['checkhelo_policyid'])) {
array_push($updates,"PolicyID = ".$db->quote($_POST['checkhelo_policyid']));
}
if (!empty($_POST['checkhelo_name'])) {
array_push($updates,"Name = ".$db->quote($_POST['checkhelo_name']));
}
if (!empty($_POST['checkhelo_useblacklist'])) {
if ($_POST['checkhelo_useblacklist'] == "1") {
$useblacklist = null;
} elseif ($_POST['checkhelo_useblacklist'] == "2") {
$useblacklist = 1;
} elseif ($_POST['checkhelo_useblacklist'] == "3") {
$useblacklist = 0;
}
array_push($updates,"UseBlacklist = ".$db->quote($useblacklist));
}
if (!empty($_POST['checkhelo_blacklistperiod_m'])) {
if ($_POST['checkhelo_blacklistperiod_m'] == "1") {
$blacklistperiod = null;
} elseif ($_POST['checkhelo_blacklistperiod_m'] == "2") {
$blacklistperiod = $_POST['checkhelo_blacklistperiod'];
}
array_push($updates,"BlacklistPeriod = ".$db->quote($blacklistperiod));
}
if (!empty($_POST['checkhelo_usehrp'])) {
if ($_POST['checkhelo_usehrp'] == "1") {
$usehrp = null;
} elseif ($_POST['checkhelo_usehrp'] == "2") {
$usehrp = 1;
} elseif ($_POST['checkhelo_usehrp'] == "3") {
$usehrp = 0;
}
array_push($updates,"UseHRP = ".$db->quote($usehrp));
}
if (!empty($_POST['checkhelo_hrpperiod_m'])) {
if ($_POST['checkhelo_hrpperiod_m'] == "1") {
$hrpperiod = null;
} elseif ($_POST['checkhelo_hrpperiod_m'] == "2") {
$hrpperiod = $_POST['checkhelo_hrpperiod'];
}
array_push($updates,"HRPPeriod = ".$db->quote($hrpperiod));
}
if (!empty($_POST['checkhelo_hrplimit_m'])) {
if ($_POST['checkhelo_hrplimit_m'] == "1") {
$hrplimit = null;
} elseif ($_POST['checkhelo_hrplimit_m'] == "2") {
$hrplimit = $_POST['checkhelo_hrplimit'];
}
array_push($updates,"HRPLimit = ".$db->quote($hrplimit));
}
if (!empty($_POST['checkhelo_rejectinvalid'])) {
if ($_POST['checkhelo_rejectinvalid'] == "1") {
$rejectinvalid = null;
} elseif ($_POST['checkhelo_rejectinvalid'] == "2") {
$rejectinvalid = 1;
} elseif ($_POST['checkhelo_rejectinvalid'] == "3") {
$rejectinvalid = 0;
}
array_push($updates,"RejectInvalid = ".$db->quote($rejectinvalid));
}
if (!empty($_POST['checkhelo_rejectip'])) {
if ($_POST['checkhelo_rejectip'] == "1") {
$rejectip = null;
} elseif ($_POST['checkhelo_rejectip'] == "2") {
$rejectip = 1;
} elseif ($_POST['checkhelo_rejectip'] == "3") {
$rejectip = 0;
}
array_push($updates,"RejectIP = ".$db->quote($rejectip));
}
if (!empty($_POST['checkhelo_rejectunresolvable'])) {
if ($_POST['checkhelo_rejectunresolvable'] == "1") {
$rejectunresolvable = null;
} elseif ($_POST['checkhelo_rejectunresolvable'] == "2") {
$rejectunresolvable = 1;
} elseif ($_POST['checkhelo_rejectunresolvable'] == "3") {
$rejectunresolvable = 0;
}
array_push($updates,"RejectUnresolvable = ".$db->quote($rejectunresolvable));
}
if (!empty($_POST['checkhelo_comment'])) {
array_push($updates,"Comment = ".$db->quote($_POST['checkhelo_comment']));
}
if (isset($_POST['checkhelo_disabled']) && $_POST['checkhelo_disabled'] != "") {
array_push($updates ,"Disabled = ".$db->quote($_POST['checkhelo_disabled']));
}
# Check if we have updates
if (sizeof($updates) > 0) {
$updateStr = implode(', ',$updates);
$res = $db->exec("UPDATE ${DB_TABLE_PREFIX}checkhelo SET $updateStr WHERE ID = ".$db->quote($_POST['checkhelo_id']));
if ($res) {
?>
<div class="notice">HELO/EHLO check updated</div>
<?php
} else {
?>
<div class="warning">Error updating HELO/EHLO check!</div>
<div class="warning"><?php print_r($db->errorInfo()) ?></div>
<?php
}
} else {
?>
<div class="warning">No changes made to HELO/EHLO check</div>
<?php
}
} else {
?>
<div class="warning">Invalid invocation</div>
<?php
}
printFooter();
# vim: ts=4
?>
<?php
# Module: CheckHelo delete
# Copyright (C) 2008, LinuxRulz
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
include_once("includes/header.php");
include_once("includes/footer.php");
include_once("includes/db.php");
$db = connect_db();
printHeader(array(
"Tabs" => array(
"Back to HELO checks" => "checkhelo-main.php",
),
));
# Display delete confirm screen
if ($_POST['frmaction'] == "delete") {
# Check a helo/helo check was selected
if (isset($_POST['checkhelo_id'])) {
?>
<p class="pageheader">Delete HELO/EHLO Check</p>
<form action="checkhelo-delete.php" method="post">
<div>
<input type="hidden" name="frmaction" value="delete2" />
<input type="hidden" name="checkhelo_id" value="<?php echo $_POST['checkhelo_id']; ?>" />
</div>
<div class="textcenter">
Are you very sure? <br />
<input type="submit" name="confirm" value="yes" />
<input type="submit" name="confirm" value="no" />
</div>
</form>
<?php
} else {
?>
<div class="warning">No HELO/EHLO check selected</div>
<?php
}
# SQL Updates
} elseif ($_POST['frmaction'] == "delete2") {
?>
<p class="pageheader">HELO/EHLO Check Delete Results</p>
<?php
if (isset($_POST['checkhelo_id'])) {
if ($_POST['confirm'] == "yes") {
$res = $db->exec("DELETE FROM ${DB_TABLE_PREFIX}checkhelo WHERE ID = ".$db->quote($_POST['checkhelo_id']));
if ($res) {
?>
<div class="notice">HELO/EHLO check deleted</div>
<?php
} else {
?>
<div class="warning">Error deleting HELO/EHLO check!</div>
<div class="warning"><?php print_r($stmt->errorInfo()) ?></div>
<?php
}
} else {
?>
<div class="notice">HELO/EHLO check not deleted, aborted by user</div>
<?php
}
# Warn
} else {
?>
<div class="warning">Invocation error, no HELO/EHLO ID</div>
<?php
}
} else {
?>
<div class="warning">Invalid invocation</div>
<?php
}
printFooter();
# vim: ts=4
?>
<?php
# Module: CheckHelo
# Copyright (C) 2008, LinuxRulz
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
include_once("includes/header.php");
include_once("includes/footer.php");
include_once("includes/db.php");
$db = connect_db();
printHeader(array(
));
# If we have no action, display list
if (!isset($_POST['frmaction']))
{
?>
<p class="pageheader">HELO/EHLO Checks</p>
<form id="main_form" action="checkhelo-main.php" method="post">
<div class="textcenter">
Action
<select id="main_form_action" name="frmaction"
onchange="
var myform = document.getElementById('main_form');
var myobj = document.getElementById('main_form_action');
if (myobj.selectedIndex == 2) {
myform.action = 'checkhelo-add.php';
} else if (myobj.selectedIndex == 4) {
myform.action = 'checkhelo-change.php';
} else if (myobj.selectedIndex == 5) {
myform.action = 'checkhelo-delete.php';
}
myform.submit();
">
<option selected="selected">select action</option>
<option disabled="disabled"> - - - - - - - - - - - </option>
<option value="add">Add</option>
<option disabled="disabled"> - - - - - - - - - - - </option>
<option value="change">Change</option>
<option value="delete">Delete</option>
</select>
</div>
<p />
<table class="results" style="width: 75%;">
<tr class="resultstitle">
<td id="noborder"></td>
<td class="textcenter">Policy</td>
<td class="textcenter">Name</td>
<td class="textcenter">Disabled</td>
</tr>
<?php
$sql = "
SELECT
${DB_TABLE_PREFIX}checkhelo.ID, ${DB_TABLE_PREFIX}checkhelo.Name, ${DB_TABLE_PREFIX}checkhelo.Disabled,
${DB_TABLE_PREFIX}policies.Name AS PolicyName
FROM
${DB_TABLE_PREFIX}checkhelo, ${DB_TABLE_PREFIX}policies
WHERE
${DB_TABLE_PREFIX}policies.ID = ${DB_TABLE_PREFIX}checkhelo.PolicyID
ORDER BY
${DB_TABLE_PREFIX}policies.Name
";
$res = $db->query($sql);
while ($row = $res->fetchObject()) {
?>
<tr class="resultsitem">
<td><input type="radio" name="checkhelo_id" value="<?php echo $row->id ?>" /></td>
<td><?php echo $row->policyname ?></td>
<td><?php echo $row->name ?></td>
<td class="textcenter"><?php echo $row->disabled ? 'yes' : 'no' ?></td>
</tr>
<?php
}
$res->closeCursor();
?>
</table>
</form>
<?php
}
printFooter();
# vim: ts=4
?>