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 3403 deletions
<?php
# Module: CheckHelo (whitelist) 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 whitelist" => "checkhelo-whitelist-main.php"
),
));
if ($_POST['frmaction'] == "add") {
?>
<p class="pageheader">Add HELO/EHLO Whitelist</p>
<form method="post" action="checkhelo-whitelist-add.php">
<div>
<input type="hidden" name="frmaction" value="add2" />
</div>
<table class="entry">
<tr>
<td class="entrytitle">
Source
<?php tooltip('checkhelo_whitelist_source'); ?>
</td>
<td>
<select id="whitelist_type" name="whitelist_type">
<option value="SenderIP">Sender IP</option>
</select>
<input type="text" name="whitelist_source" />
</td>
</tr>
<tr>
<td class="entrytitle">Comment</td>
<td><textarea name="whitelist_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 Whitelist Add Results</p>
<?php
# Check name
if (empty($_POST['whitelist_source'])) {
?>
<div class="warning">Source cannot be empty</div>
<?php
} else {
$stmt = $db->prepare("INSERT INTO ${DB_TABLE_PREFIX}checkhelo_whitelist (Source,Comment,Disabled) VALUES (?,?,1)");
$res = $stmt->execute(array(
$_POST['whitelist_type'] . ":" . $_POST['whitelist_source'],
$_POST['whitelist_comment']
));
if ($res) {
?>
<div class="notice">HELO/EHLO whitelist created</div>
<?php
} else {
?>
<div class="warning">Failed to create HELO/EHLO whitelisting</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 (whitelist) 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 whitelist" => "checkhelo-whitelist-main.php"
),
));
# Display change screen
if ($_POST['frmaction'] == "change") {
# Check a whitelist was selected
if (isset($_POST['whitelist_id'])) {
# Prepare statement
$stmt = $db->prepare("
SELECT
ID, Source, Comment,
Disabled
FROM
${DB_TABLE_PREFIX}checkhelo_whitelist
WHERE
ID = ?
");
?>
<p class="pageheader">Update HELO/EHLO Whitelist</p>
<form action="checkhelo-whitelist-change.php" method="post">
<div>
<input type="hidden" name="frmaction" value="change2" />
<input type="hidden" name="whitelist_id" value="<?php echo $_POST['whitelist_id']; ?>" />
</div>
<?php
$res = $stmt->execute(array($_POST['whitelist_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">
Source
<?php tooltip('checkhelo_whitelist_source'); ?>
</td>
<td class="oldval"><?php echo $row->source ?></td>
<td>
<select id="whitelist_type" name="whitelist_type">
<option value="">--</option>
<option value="SenderIP">Sender IP</option>
</select>
<input type="text" name="whitelist_source" />
</td>
</tr>
<tr>
<td class="entrytitle texttop">Comment</td>
<td class="oldval texttop"><?php echo $row->comment ?></td>
<td><textarea name="whitelist_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="whitelist_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 whitelisting selected</div>
<?php
}
# SQL Updates
} elseif ($_POST['frmaction'] == "change2") {
?>
<p class="pageheader">HELO/EHLO Whitelisting Update Results</p>
<?php
$updates = array();
if (!empty($_POST['whitelist_type'])) {
array_push($updates,"Source = ".$db->quote($_POST['whitelist_type'].":".$_POST['whitelist_source']));
}
if (!empty($_POST['whitelist_comment'])) {
array_push($updates,"Comment = ".$db->quote($_POST['whitelist_comment']));
}
if (isset($_POST['whitelist_disabled']) && $_POST['whitelist_disabled'] != "") {
array_push($updates ,"Disabled = ".$db->quote($_POST['whitelist_disabled']));
}
# Check if we have updates
if (sizeof($updates) > 0) {
$updateStr = implode(', ',$updates);
$res = $db->exec("UPDATE ${DB_TABLE_PREFIX}checkhelo_whitelist SET $updateStr WHERE ID = ".$db->quote($_POST['whitelist_id']));
if ($res) {
?>
<div class="notice">HELO/EHLO whitelisting updated</div>
<?php
} else {
?>
<div class="warning">Error updating HELO/EHLO whitelisting!</div>
<?php
}
} else {
?>
<div class="warning">No changes made to HELO/EHLO whitelisting</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: CheckHelo (whitelist) 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 whitelist" => "checkhelo-whitelist-main.php",
),
));
# Display delete confirm screen
if ($_POST['frmaction'] == "delete") {
# Check a whitelisting was selected
if (isset($_POST['whitelist_id'])) {
?>
<p class="pageheader">Delete HELO/EHLO whitelist</p>
<form action="checkhelo-whitelist-delete.php" method="post">
<div>
<input type="hidden" name="frmaction" value="delete2" />
<input type="hidden" name="whitelist_id" value="<?php echo $_POST['whitelist_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 whitelisting selected</div>
<?php
}
# SQL Updates
} elseif ($_POST['frmaction'] == "delete2") {
?>
<p class="pageheader">HELO/EHLO Whitelist Delete Results</p>
<?php
if (isset($_POST['whitelist_id'])) {
if ($_POST['confirm'] == "yes") {
$res = $db->exec("DELETE FROM ${DB_TABLE_PREFIX}checkhelo_whitelist WHERE ID = ".$db->quote($_POST['whitelist_id']));
if ($res) {
?>
<div class="notice">HELO/EHLO whitelist deleted</div>
<?php
} else {
?>
<div class="warning">Error deleting HELO/EHLO whitelist!</div>
<div class="warning"><?php print_r($db->errorInfo()) ?></div>
<?php
}
} else {
?>
<div class="notice">HELO/EHLO whitelist 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 (whitelisting)
# 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 Whitelistings</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-whitelist-add.php';
} else if (myobj.selectedIndex == 4) {
myform.action = 'checkhelo-whitelist-change.php';
} else if (myobj.selectedIndex == 5) {
myform.action = 'checkhelo-whitelist-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">Source</td>
<td class="textcenter">Disabled</td>
</tr>
<?php
$sql = "
SELECT
ID, Source, Disabled
FROM
${DB_TABLE_PREFIX}checkhelo_whitelist
ORDER BY
Source
";
$res = $db->query($sql);
while ($row = $res->fetchObject()) {
?>
<tr class="resultsitem">
<td><input type="radio" name="whitelist_id" value="<?php echo $row->id ?>" /></td>
<td><?php echo $row->source ?></td>
<td class="textcenter"><?php echo $row->disabled ? 'yes' : 'no' ?></td>
</tr>
<?php
}
$res->closeCursor();
?>
</table>
</form>
<?php
}
printFooter();
# vim: ts=4
?>
<?php
# Module: CheckSPF 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 SPF checks" => "checkspf-main.php"
),
));
if ($_POST['frmaction'] == "add") {
?>
<p class="pageheader">Add SPF Check</p>
<form method="post" action="checkspf-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="checkspf_name" /></td>
</tr>
<tr>
<td class="entrytitle">Link to policy</td>
<td>
<select name="checkspf_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
}
?>
</select>
</td>
</tr>
<tr>
<td class="entrytitle">Use SPF</td>
<td>
<select name="checkspf_usespf">
<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 Failed SPF
<?php tooltip('checkspf_rejectfailed'); ?>
</td>
<td>
<select name="checkspf_rejectfailed">
<option value="0" selected="selected">Inherit</option>
<option value="1">Yes</option>
<option value="2">No</option>
</select>
</td>
</tr>
<tr>
<td class="entrytitle">
Add SPF Header
<?php tooltip('checkspf_addheader'); ?>
</td>
<td>
<select name="checkspf_addheader">
<option value="0" selected="selected">Inherit</option>
<option value="1">Yes</option>
<option value="2">No</option>
</select>
</td>
</tr>
<tr>
<td class="entrytitle">Comment</td>
<td><textarea name="checkspf_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">SPF Check Add Results</p>
<?php
# Check name
if (empty($_POST['checkspf_policyid'])) {
?>
<div class="warning">Policy ID cannot be empty</div>
<?php
# Check name
} elseif (empty($_POST['checkspf_name'])) {
?>
<div class="warning">Name cannot be empty</div>
<?php
} else {
# Sort out if we going to use SPF or not
switch ($_POST['checkspf_usespf']) {
case "0":
$useSPF = null;
break;
case "1":
$useSPF = 1;
break;
case "2":
$useSPF = 2;
break;
}
# And if we reject on failed
switch ($_POST['checkspf_rejectfailed']) {
case "0":
$rejectFailed = null;
break;
case "1":
$rejectFailed = 1;
break;
case "2":
$rejectFailed = 2;
break;
}
# And if we add the spf header
switch ($_POST['checkspf_addheader']) {
case "0":
$addHeader = null;
break;
case "1":
$addHeader = 1;
break;
case "2":
$addHeader = 2;
break;
}
$stmt = $db->prepare("
INSERT INTO ${DB_TABLE_PREFIX}checkspf
(PolicyID,Name,UseSPF,RejectFailedSPF,AddSPFHeader,Comment,Disabled)
VALUES
(?,?,?,?,?,?,1)
");
$res = $stmt->execute(array(
$_POST['checkspf_policyid'],
$_POST['checkspf_name'],
$useSPF,
$rejectFailed,
$addHeader,
$_POST['checkspf_comment']
));
if ($res) {
?>
<div class="notice">SPF check created</div>
<?php
} else {
?>
<div class="warning">Failed to create SPF 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: CheckSPF 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 SPF checks" => "checkspf-main.php"
),
));
# Display change screen
if ($_POST['frmaction'] == "change") {
# Check a SPF check was selected
if (isset($_POST['checkspf_id'])) {
# Prepare statement
$stmt = $db->prepare("
SELECT
${DB_TABLE_PREFIX}checkspf.ID, ${DB_TABLE_PREFIX}checkspf.PolicyID, ${DB_TABLE_PREFIX}checkspf.Name,
${DB_TABLE_PREFIX}checkspf.UseSPF, ${DB_TABLE_PREFIX}checkspf.RejectFailedSPF,
${DB_TABLE_PREFIX}checkspf.AddSPFHeader,
${DB_TABLE_PREFIX}checkspf.Comment, ${DB_TABLE_PREFIX}checkspf.Disabled,
${DB_TABLE_PREFIX}policies.Name AS PolicyName
FROM
${DB_TABLE_PREFIX}checkspf, ${DB_TABLE_PREFIX}policies
WHERE
${DB_TABLE_PREFIX}checkspf.ID = ?
AND ${DB_TABLE_PREFIX}policies.ID = ${DB_TABLE_PREFIX}checkspf.PolicyID
");
?>
<p class="pageheader">Update SPF Check</p>
<form action="checkspf-change.php" method="post">
<div>
<input type="hidden" name="frmaction" value="change2" />
<input type="hidden" name="checkspf_id" value="<?php echo $_POST['checkspf_id']; ?>" />
</div>
<?php
$res = $stmt->execute(array($_POST['checkspf_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="checkspf_name" /></td>
</tr>
<tr>
<td class="entrytitle">Link to policy</td>
<td class="oldval"><?php echo $row->policyname ?></td>
<td>
<select name="checkspf_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">Use SPF</td>
<td class="oldval"><?php
switch ($row->usespf) {
case null:
echo "Inherit";
break;
case 1:
echo "Yes";
break;
case 2:
echo "No";
break;
default:
echo "UNKNOWN";
break;
}
?></td>
<td>
<select name="checkspf_usespf">
<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 Failed SPF
<?php tooltip('checkspf_rejectfailed'); ?>
</td>
<td class="oldval"><?php
switch ($row->rejectfailedspf) {
case null:
echo "Inherit";
break;
case 1:
echo "Yes";
break;
case 2:
echo "No";
break;
default:
echo "UNKNOWN";
break;
}
?></td>
<td>
<select name="checkspf_rejectfailed">
<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">
Add SPF Header
<?php tooltip('checkspf_addheader'); ?>
</td>
<td class="oldval"><?php
switch ($row->addspfheader) {
case null:
echo "Inherit";
break;
case 1:
echo "Yes";
break;
case 2:
echo "No";
break;
default:
echo "UNKNOWN";
break;
}
?></td>
<td>
<select name="checkspf_addheader">
<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 texttop">Comment</td>
<td class="oldval texttop"><?php echo $row->comment ?></td>
<td><textarea name="checkspf_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="checkspf_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 access control selected</div>
<?php
}
# SQL Updates
} elseif ($_POST['frmaction'] == "change2") {
?>
<p class="pageheader">SPF Check Update Results</p>
<?php
$updates = array();
if (!empty($_POST['checkspf_policyid'])) {
array_push($updates,"PolicyID = ".$db->quote($_POST['checkspf_policyid']));
}
if (!empty($_POST['checkspf_name'])) {
array_push($updates,"Name = ".$db->quote($_POST['checkspf_name']));
}
if (!empty($_POST['checkspf_usespf'])) {
if ($_POST['checkspf_usespf'] == "1") {
$usespf = null;
} elseif ($_POST['checkspf_usespf'] == "2") {
$usespf = 1;
} elseif ($_POST['checkspf_usespf'] == "3") {
$usespf = 2;
}
array_push($updates,"UseSPF = ".$db->quote($usespf));
}
if (!empty($_POST['checkspf_rejectfailed'])) {
if ($_POST['checkspf_rejectfailed'] == "1") {
$rejectfailed = null;
} elseif ($_POST['checkspf_rejectfailed'] == "2") {
$rejectfailed = 1;
} elseif ($_POST['checkspf_rejectfailed'] == "3") {
$rejectfailed = 2;
}
array_push($updates,"RejectFailedSPF = ".$db->quote($rejectfailed));
}
if (!empty($_POST['checkspf_addheader'])) {
if ($_POST['checkspf_addheader'] == "1") {
$addheader = null;
} elseif ($_POST['checkspf_addheader'] == "2") {
$addheader = 1;
} elseif ($_POST['checkspf_addheader'] == "3") {
$addheader = 2;
}
array_push($updates,"AddSPFHeader = ".$db->quote($addheader));
}
if (!empty($_POST['checkspf_comment'])) {
array_push($updates,"Comment = ".$db->quote($_POST['checkspf_comment']));
}
if (isset($_POST['checkspf_disabled']) && $_POST['checkspf_disabled'] != "") {
array_push($updates ,"Disabled = ".$db->quote($_POST['checkspf_disabled']));
}
# Check if we have updates
if (sizeof($updates) > 0) {
$updateStr = implode(', ',$updates);
$res = $db->exec("UPDATE ${DB_TABLE_PREFIX}checkspf SET $updateStr WHERE ID = ".$db->quote($_POST['checkspf_id']));
if ($res) {
?>
<div class="notice">SPF check updated</div>
<?php
} else {
?>
<div class="warning">Error updating SPF check!</div>
<div class="warning"><?php print_r($db->errorInfo()) ?></div>
<?php
}
} else {
?>
<div class="warning">No changes made to SPF check</div>
<?php
}
} else {
?>
<div class="warning">Invalid invocation</div>
<?php
}
printFooter();
# vim: ts=4
?>
<?php
# Module: CheckSPF 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 SPF checks" => "checkspf-main.php",
),
));
# Display delete confirm screen
if ($_POST['frmaction'] == "delete") {
# Check a SPF check was selected
if (isset($_POST['checkspf_id'])) {
?>
<p class="pageheader">Delete SPF Check</p>
<form action="checkspf-delete.php" method="post">
<div>
<input type="hidden" name="frmaction" value="delete2" />
<input type="hidden" name="checkspf_id" value="<?php echo $_POST['checkspf_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 SPF check selected</div>
<?php
}
# SQL Updates
} elseif ($_POST['frmaction'] == "delete2") {
?>
<p class="pageheader">SPF Check Delete Results</p>
<?php
if (isset($_POST['checkspf_id'])) {
if ($_POST['confirm'] == "yes") {
$res = $db->exec("DELETE FROM ${DB_TABLE_PREFIX}checkspf WHERE ID = ".$db->quote($_POST['checkspf_id']));
if ($res) {
?>
<div class="notice">SPF check deleted</div>
<?php
} else {
?>
<div class="warning">Error deleting SPF check!</div>
<div class="warning"><?php print_r($db->errorInfo()) ?></div>
<?php
}
} else {
?>
<div class="notice">SPF check not deleted, aborted by user</div>
<?php
}
# Warn
} else {
?>
<div class="warning">Invocation error, no SPF check ID</div>
<?php
}
} else {
?>
<div class="warning">Invalid invocation</div>
<?php
}
printFooter();
# vim: ts=4
?>
<?php
# Module: CheckSPF
# 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">SPF Checks</p>
<form id="main_form" action="checkspf-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 = 'checkspf-add.php';
} else if (myobj.selectedIndex == 4) {
myform.action = 'checkspf-change.php';
} else if (myobj.selectedIndex == 5) {
myform.action = 'checkspf-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}checkspf.ID, ${DB_TABLE_PREFIX}checkspf.Name, ${DB_TABLE_PREFIX}checkspf.Disabled,
${DB_TABLE_PREFIX}policies.Name AS PolicyName
FROM
${DB_TABLE_PREFIX}checkspf, ${DB_TABLE_PREFIX}policies
WHERE
${DB_TABLE_PREFIX}policies.ID = ${DB_TABLE_PREFIX}checkspf.PolicyID
ORDER BY
${DB_TABLE_PREFIX}policies.Name
";
$res = $db->query($sql);
while ($row = $res->fetchObject()) {
?>
<tr class="resultsitem">
<td><input type="radio" name="checkspf_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
# Module: Greylisting 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 greylisting" => "greylisting-main.php"
),
));
if ($_POST['frmaction'] == "add") {
?>
<p class="pageheader">Add Greylisting</p>
<form method="post" action="greylisting-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="greylisting_name" /></td>
</tr>
<tr>
<td class="entrytitle">Link to policy</td>
<td>
<select name="greylisting_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;">Greylisting</td>
</tr>
<tr>
<td class="entrytitle">Use Greylisting</td>
<td>
<select name="greylisting_usegreylisting">
<option value="0" selected="selected">Inherit</option>
<option value="1">Yes</option>
<option value="2">No</option>
</select>
</td>
</tr>
<tr>
<td class="entrytitle">
Greylist Period
<?php tooltip('greylisting_period'); ?>
</td>
<td><input type="text" name="greylisting_period" /></td>
</tr>
<tr>
<td class="entrytitle">
Track
<?php tooltip('greylisting_track'); ?>
</td>
<td>
<select id="greylisting_track" name="greylisting_track"
onchange="
var myobj = document.getElementById('greylisting_track');
var myobj2 = document.getElementById('greylisting_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>
</select>
<input type="text" id="greylisting_trackextra" name="greylisting_trackextra" size="18" value="/32" />
</td>
</tr>
<tr>
<td class="entrytitle">
Greylist Auth Validity
<?php tooltip('greylisting_auth_validity'); ?>
</td>
<td><input type="text" name="greylisting_authvalidity" /></td>
</tr>
<tr>
<td class="entrytitle">
Greylist UnAuth Validity
<?php tooltip('greylisting_unauth_validity'); ?>
</td>
<td><input type="text" name="greylisting_unauthvalidity" /></td>
</tr>
<tr>
<td colspan="2" class="textcenter" style="border-bottom: 1px dashed black;">Auto-Whitelisting</td>
</tr>
<tr>
<td class="entrytitle">Use AWL</td>
<td>
<select name="greylisting_useawl">
<option value="0" selected="selected">Inherit</option>
<option value="1">Yes</option>
<option value="2">No</option>
</select>
</td>
</tr>
<tr>
<td class="entrytitle">
AWL For Period
<?php tooltip('greylisting_awl_period'); ?>
</td>
<td><input type="text" name="greylisting_awlperiod" /></td>
</tr>
<tr>
<td class="entrytitle">
AWL After Count
<?php tooltip('greylisting_awl_count'); ?>
</td>
<td><input type="text" name="greylisting_awlcount" /></td>
</tr>
<tr>
<td class="entrytitle">
AWL After Percentage
<?php tooltip('greylisting_awl_percentage'); ?>
</td>
<td><input type="text" name="greylisting_awlpercentage" /> (blank = inherit, 0 = disable)</td>
</tr>
<tr>
<td colspan="2" class="textcenter" style="border-bottom: 1px dashed black;">Auto-Blacklisting</td>
</tr>
<tr>
<td class="entrytitle">Use ABL</td>
<td>
<select name="greylisting_useabl">
<option value="0" selected="selected">Inherit</option>
<option value="1">Yes</option>
<option value="2">No</option>
</select>
</td>
</tr>
<tr>
<td class="entrytitle">
ABL For Period
<?php tooltip('greylisting_abl_period'); ?>
</td>
<td><input type="text" name="greylisting_ablperiod" /></td>
</tr>
<tr>
<td class="entrytitle">
ABL After Count
<?php tooltip('greylisting_abl_count'); ?>
</td>
<td><input type="text" name="greylisting_ablcount" /></td>
</tr>
<tr>
<td class="entrytitle">
ABL After Percentage
<?php tooltip('greylisting_abl_percentage'); ?>
</td>
<td><input type="text" name="greylisting_ablpercentage" /></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="greylisting_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">Greylisting Add Results</p>
<?php
# Check name
if (empty($_POST['greylisting_policyid'])) {
?>
<div class="warning">Policy ID cannot be empty</div>
<?php
# Check name
} elseif (empty($_POST['greylisting_name'])) {
?>
<div class="warning">Name cannot be empty</div>
<?php
} else {
# Sort out using of blacklist
switch ($_POST['greylisting_usegreylisting']) {
case "0":
$useGreylisting = null;
break;
case "1":
$useGreylisting = 1;
break;
case "2":
$useGreylisting = 0;
break;
}
# Check period
if (empty($_POST['greylisting_period'])) {
$greylistPeriod = null;
} else {
$greylistPeriod = $_POST['greylisting_period'];
}
# Check validity
if (empty($_POST['greylisting_authvalidity'])) {
$greylistAuthValidity = null;
} else {
$greylistAuthValidity = $_POST['greylisting_authvalidity'];
}
if (empty($_POST['greylisting_unauthvalidity'])) {
$greylistUnAuthValidity = null;
} else {
$greylistUnAuthValidity = $_POST['greylisting_unauthvalidity'];
}
# Sort out using of AWL
switch ($_POST['greylisting_useawl']) {
case "0":
$useAWL = null;
break;
case "1":
$useAWL = 1;
break;
case "2":
$useAWL = 0;
break;
}
# AWL period
if (empty($_POST['greylisting_awlperiod'])) {
$AWLPeriod = null;
} else {
$AWLPeriod = $_POST['greylisting_awlperiod'];
}
# AWL count
if (empty($_POST['greylisting_awlcount'])) {
$AWLCount = null;
} else {
$AWLCount = $_POST['greylisting_awlcount'];
}
# AWL percentage
if (!isset($_POST['greylisting_awlpercentage']) || $_POST['greylisting_awlpercentage'] == "") {
$AWLPercentage = null;
} else {
$AWLPercentage = $_POST['greylisting_awlpercentage'];
}
# Sort out using of ABL
switch ($_POST['greylisting_useabl']) {
case "0":
$useABL = null;
break;
case "1":
$useABL = 1;
break;
case "2":
$useABL = 0;
break;
}
# ABL period
if (empty($_POST['greylisting_ablperiod'])) {
$ABLPeriod = null;
} else {
$ABLPeriod = $_POST['greylisting_ablperiod'];
}
# ABL count
if (empty($_POST['greylisting_ablcount'])) {
$ABLCount = null;
} else {
$ABLCount = $_POST['greylisting_ablcount'];
}
# ABL percentage
if (!isset($_POST['greylisting_ablpercentage']) || $_POST['greylisting_ablpercentage'] == "") {
$ABLPercentage = null;
} else {
$ABLPercentage = $_POST['greylisting_ablpercentage'];
}
$stmt = $db->prepare("
INSERT INTO ${DB_TABLE_PREFIX}greylisting
(
PolicyID,Name,
UseGreylisting,GreylistPeriod,
Track,
GreylistAuthValidity, GreylistUnAuthValidity,
UseAutoWhitelist,AutoWhitelistPeriod,AutoWhitelistCount,AutoWhitelistPercentage,
UseAutoBlacklist,AutoBlacklistPeriod,AutoBlacklistCount,AutoBlacklistPercentage,
Comment,Disabled
)
VALUES
(
?,?,
?,?,
?,
?,?,
?,?,?,?,
?,?,?,?,
?,1
)
");
$res = $stmt->execute(array(
$_POST['greylisting_policyid'],
$_POST['greylisting_name'],
$useGreylisting,$greylistPeriod,
$_POST['greylisting_track'] . ":" . $_POST['greylisting_trackextra'],
$greylistAuthValidity,$greylistUnAuthValidity,
$useAWL,$AWLPeriod,$AWLCount,$AWLPercentage,
$useABL,$ABLPeriod,$ABLCount,$ABLPercentage,
$_POST['greylisting_comment']
));
if ($res) {
?>
<div class="notice">Greylisting created</div>
<?php
} else {
?>
<div class="warning">Failed to create Greylisting</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: Greylisting 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 greylisting" => "greylisting-main.php"
),
));
# Display change screen
if ($_POST['frmaction'] == "change") {
# Check a ${DB_TABLE_PREFIX}greylisting was selected
if (isset($_POST['greylisting_id'])) {
# Prepare statement
$stmt = $db->prepare("
SELECT
${DB_TABLE_PREFIX}greylisting.ID, ${DB_TABLE_PREFIX}greylisting.PolicyID, ${DB_TABLE_PREFIX}greylisting.Name,
${DB_TABLE_PREFIX}greylisting.UseGreylisting, ${DB_TABLE_PREFIX}greylisting.GreylistPeriod,
${DB_TABLE_PREFIX}greylisting.Track, ${DB_TABLE_PREFIX}greylisting.GreylistAuthValidity,
${DB_TABLE_PREFIX}greylisting.GreylistUnAuthValidity,
${DB_TABLE_PREFIX}greylisting.useAutoWhitelist, ${DB_TABLE_PREFIX}greylisting.AutoWhitelistPeriod,
${DB_TABLE_PREFIX}greylisting.AutoWhitelistCount, ${DB_TABLE_PREFIX}greylisting.AutoWhitelistPercentage,
${DB_TABLE_PREFIX}greylisting.useAutoBlacklist, ${DB_TABLE_PREFIX}greylisting.AutoBlacklistPeriod,
${DB_TABLE_PREFIX}greylisting.AutoBlacklistCount, ${DB_TABLE_PREFIX}greylisting.AutoBlacklistPercentage,
${DB_TABLE_PREFIX}greylisting.Comment,
${DB_TABLE_PREFIX}greylisting.Disabled,
${DB_TABLE_PREFIX}policies.Name AS PolicyName
FROM
${DB_TABLE_PREFIX}greylisting, ${DB_TABLE_PREFIX}policies
WHERE
${DB_TABLE_PREFIX}greylisting.ID = ?
AND ${DB_TABLE_PREFIX}policies.ID = ${DB_TABLE_PREFIX}greylisting.PolicyID
");
?>
<p class="pageheader">Update Greylisting</p>
<form action="greylisting-change.php" method="post">
<div>
<input type="hidden" name="frmaction" value="change2" />
<input type="hidden" name="greylisting_id" value="<?php echo $_POST['greylisting_id']; ?>" />
</div>
<?php
$res = $stmt->execute(array($_POST['greylisting_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="greylisting_name" /></td>
</tr>
<tr>
<td class="entrytitle">Link to policy</td>
<td class="oldval"><?php echo $row->policyname ?></td>
<td>
<select name="greylisting_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;">Greylisting</td>
</tr>
<tr>
<td class="entrytitle">Use Greylisting</td>
<td class="oldval"><?php
switch ($row->usegreylisting) {
case null:
echo "Inherit";
break;
case 0:
echo "No";
break;
case 1:
echo "Yes";
break;
default:
echo "UNKNOWN";
break;
}
?></td>
<td>
<select name="greylisting_usegreylisting">
<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">
Greylist Period
<?php tooltip('greylisting_period'); ?>
</td>
<td class="oldval"><?php echo is_null($row->greylistperiod) ? '*inherited*' : $row->greylistperiod ?></td>
<td>
<input type="text" name="greylisting_period" />
<select name="greylisting_period_m">
<option value="">--</option>
<option value="1">Inherit</option>
<option value="2">Overwrite</option>
</select>
</td>
</tr>
<tr>
<td class="entrytitle">
Track
<?php tooltip('greylisting_track'); ?>
</td>
<td class="oldval"><?php echo $row->track ?></td>
<td>
<select id="greylisting_track" name="greylisting_track"
onChange="
var myobj = document.getElementById('greylisting_track');
var myobj2 = document.getElementById('greylisting_trackextra');
if (myobj.selectedIndex == 1) {
myobj2.disabled = false;
myobj2.value = '/32';
} else if (myobj.selectedIndex != 1) {
myobj2.disabled = true;
myobj2.value = 'n/a';
}
">
<option value="">--</option>
<option value="SenderIP">Sender IP</option>
</select>
<input type="text" id="greylisting_trackextra" name="greylisting_trackextra" size="18" value="n/a" disabled="disabled" />
</td>
</tr>
<tr>
<td class="entrytitle">
Greylist Auth Validity
<?php tooltip('greylisting_auth_validity'); ?>
</td>
<td class="oldval"><?php echo is_null($row->greylistauthvalidity) ? '*inherited*' : $row->greylistauthvalidity ?></td>
<td>
<input type="text" name="greylisting_authvalidity" />
<select name="greylisting_authvalidity_m">
<option value="">--</option>
<option value="1">Inherit</option>
<option value="2">Overwrite</option>
</select>
</td>
</tr>
<tr>
<td class="entrytitle">
Greylist UnAuth Validity
<?php tooltip('greylisting_unauth_validity'); ?>
</td>
<td class="oldval"><?php echo is_null($row->greylistunauthvalidity) ? '*inherited*' : $row->greylistunauthvalidity ?></td>
<td>
<input type="text" name="greylisting_unauthvalidity" />
<select name="greylisting_unauthvalidity_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;">Auto-Whitelisting</td>
</tr>
<tr>
<td class="entrytitle">Use AWL</td>
<td class="oldval"><?php
switch ($row->useautowhitelist) {
case null:
echo "Inherit";
break;
case 0:
echo "No";
break;
case 1:
echo "Yes";
break;
default:
echo "UNKNOWN";
break;
}
?></td>
<td>
<select name="greylisting_useawl">
<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">
AWL Period
<?php tooltip('greylisting_awl_period'); ?>
</td>
<td class="oldval"><?php echo is_null($row->autowhitelistperiod) ? '*inherited*' : $row->autowhitelistperiod ?></td>
<td>
<input type="text" name="greylisting_awlperiod" />
<select name="greylisting_awlperiod_m">
<option value="">--</option>
<option value="1">Inherit</option>
<option value="2">Overwrite</option>
</select>
</td>
</tr>
<tr>
<td class="entrytitle">
AWL After Count
<?php tooltip('greylisting_awl_count'); ?>
</td>
<td class="oldval">
<?php
if (is_null($row->autowhitelistcount)) {
echo '*inherited*';
} elseif ($row->autowhitelistcount == "0") {
echo '*disabled*';
} else {
echo $row->autowhitelistcount;
}
?>
</td>
<td>
<input type="text" name="greylisting_awlcount" />
<select name="greylisting_awlcount_m">
<option value="">--</option>
<option value="0">Disable</option>
<option value="1">Inherit</option>
<option value="2">Overwrite</option>
</select>
</td>
</tr>
<tr>
<td class="entrytitle">
AWL After Percentage
<?php tooltip('greylisting_awl_percentage'); ?>
</td>
<td class="oldval">
<?php
if (is_null($row->autowhitelistpercentage)) {
echo '*inherited*';
} elseif ($row->autowhitelistpercentage == "0") {
echo '*disabled*';
} else {
echo $row->autowhitelistpercentage;
}
?>
</td>
<td>
<input type="text" name="greylisting_awlpercentage" />
<select name="greylisting_awlpercentage_m">
<option value="">--</option>
<option value="0">Disable</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;">Auto-Blacklisting</td>
</tr>
<tr>
<td class="entrytitle">Use ABL</td>
<td class="oldval"><?php
switch ($row->useautoblacklist) {
case null:
echo "Inherit";
break;
case 0:
echo "No";
break;
case 1:
echo "Yes";
break;
default:
echo "UNKNOWN";
break;
}
?></td>
<td>
<select name="greylisting_useabl">
<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">
ABL Period
<?php tooltip('greylisting_abl_period'); ?>
</td>
<td class="oldval"><?php echo is_null($row->autoblacklistperiod) ? '*inherited*' : $row->autoblacklistperiod ?></td>
<td>
<input type="text" name="greylisting_ablperiod" />
<select name="greylisting_ablperiod_m">
<option value="">--</option>
<option value="1">Inherit</option>
<option value="2">Overwrite</option>
</select>
</td>
</tr>
<tr>
<td class="entrytitle">
ABL After Count
<?php tooltip('greylisting_abl_count'); ?>
</td>
<td class="oldval">
<?php
if (is_null($row->autoblacklistcount)) {
echo '*inherited*';
} elseif ($row->autoblacklistcount == "0") {
echo '*disabled*';
} else {
echo $row->autoblacklistcount;
}
?>
</td>
<td>
<input type="text" name="greylisting_ablcount" />
<select name="greylisting_ablcount_m">
<option value="">--</option>
<option value="0">Disable</option>
<option value="1">Inherit</option>
<option value="2">Overwrite</option>
</select>
</td>
</tr>
<tr>
<td class="entrytitle">
ABL After Percentage
<?php tooltip('greylisting_abl_percentage'); ?>
</td>
<td class="oldval">
<?php
if (is_null($row->autoblacklistpercentage)) {
echo '*inherited*';
} elseif ($row->autoblacklistpercentage == "0") {
echo '*disabled*';
} else {
echo $row->autoblacklistpercentage;
}
?>
</td>
<td>
<input type="text" name="greylisting_ablpercentage" />
<select name="greylisting_ablpercentage_m">
<option value="">--</option>
<option value="0">Disable</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;">&nbsp;</td>
</tr>
<tr>
<td class="entrytitle texttop">Comment</td>
<td class="oldval texttop"><?php echo $row->comment ?></td>
<td><textarea name="greylisting_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="greylisting_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 Greylisting check selected</div>
<?php
}
# SQL Updates
} elseif ($_POST['frmaction'] == "change2") {
?>
<p class="pageheader">Greylisting Update Results</p>
<?php
$updates = array();
# Process all our options below
if (!empty($_POST['greylisting_policyid'])) {
array_push($updates,"PolicyID = ".$db->quote($_POST['greylisting_policyid']));
}
if (!empty($_POST['greylisting_name'])) {
array_push($updates,"Name = ".$db->quote($_POST['greylisting_name']));
}
if (!empty($_POST['greylisting_usegreylisting'])) {
if ($_POST['greylisting_usegreylisting'] == "1") {
$usegreylisting = "NULL";
} elseif ($_POST['greylisting_usegreylisting'] == "2") {
$usegreylisting = $db->quote(1);
} elseif ($_POST['greylisting_usegreylisting'] == "3") {
$usegreylisting = $db->quote(0);
}
array_push($updates,"UseGreylisting = $usegreylisting");
}
if (!empty($_POST['greylisting_period_m'])) {
if ($_POST['greylisting_period_m'] == "1") {
$period = "NULL";
} elseif ($_POST['greylisting_period_m'] == "2") {
$period = $db->quote($_POST['greylisting_period']);
}
array_push($updates,"GreylistPeriod = $period");
}
if (!empty($_POST['greylisting_track'])) {
if ($_POST['greylisting_track'] == "SenderIP") {
$track = sprintf('%s:%s',$_POST['greylisting_track'],$_POST['greylisting_trackextra']);
} else {
$track = $_POST['greylisting_track'];
}
array_push($updates,"Track = ".$db->quote($track));
}
if (!empty($_POST['greylisting_authvalidity_m'])) {
if ($_POST['greylisting_authvalidity_m'] == "1") {
$validity = "NULL";
} elseif ($_POST['greylisting_authvalidity_m'] == "2") {
$validity = $db->quote($_POST['greylisting_authvalidity']);
}
array_push($updates,"GreylistAuthValidity = $validity");
}
if (!empty($_POST['greylisting_noauthvalidity_m'])) {
if ($_POST['greylisting_noauthvalidity_m'] == "1") {
$validity = "NULL";
} elseif ($_POST['greylisting_noauthvalidity_m'] == "2") {
$validity = $db->quote($_POST['greylisting_noauthvalidity']);
}
array_push($updates,"GreylistNoAuthValidity = $validity");
}
# Autowhitelist
if (!empty($_POST['greylisting_useawl'])) {
if ($_POST['greylisting_useawl'] == "1") {
$useawl = "NULL";
} elseif ($_POST['greylisting_useawl'] == "2") {
$useawl = $db->quote(1);
} elseif ($_POST['greylisting_useawl'] == "3") {
$useawl = $db->quote(0);
}
array_push($updates,"UseAutoWhitelist = $useawl");
}
if (!empty($_POST['greylisting_awlperiod_m'])) {
if ($_POST['greylisting_awlperiod_m'] == "1") {
$awlperiod = "NULL";
} elseif ($_POST['greylisting_awlperiod_m'] == "2") {
$awlperiod = $db->quote($_POST['greylisting_awlperiod']);
}
array_push($updates,"AutoWhitelistPeriod = $awlperiod");
}
# AWL Count
if (!empty($_POST['greylisting_awlcount_m'])) {
if ($_POST['greylisting_awlcount_m'] == "1") {
$awlcount = "NULL";
} elseif ($_POST['greylisting_awlcount_m'] == "2") {
$awlcount = $db->quote($_POST['greylisting_awlcount']);
}
array_push($updates,"AutoWhitelistCount = $awlcount");
}
# AWL Percentage
if (isset($_POST['greylisting_awlpercentage_m'])) {
if ($_POST['greylisting_awlpercentage_m'] == "1") {
$awlpercentage = "NULL";
} else {
$awlpercentage = $db->quote($_POST['greylisting_awlpercentage']);
}
array_push($updates,"AutoWhitelistPercentage = $awlpercentage");
}
# Autoblacklist
if (!empty($_POST['greylisting_useabl'])) {
if ($_POST['greylisting_useabl'] == "1") {
$useabl = "NULL";
} elseif ($_POST['greylisting_useabl'] == "2") {
$useabl = $db->quote(1);
} elseif ($_POST['greylisting_useabl'] == "3") {
$useabl = $db->quote(0);
}
array_push($updates,"UseAutoBlacklist = $useabl");
}
if (!empty($_POST['greylisting_ablperiod_m'])) {
if ($_POST['greylisting_ablperiod_m'] == "1") {
$ablperiod = "NULL";
} elseif ($_POST['greylisting_ablperiod_m'] == "2") {
$ablperiod = $db->quote($_POST['greylisting_ablperiod']);
}
array_push($updates,"AutoBlacklistPeriod = $ablperiod");
}
# AWL Count
if (!empty($_POST['greylisting_ablcount_m'])) {
if ($_POST['greylisting_ablcount_m'] == "1") {
$ablcount = "NULL";
} elseif ($_POST['greylisting_ablcount_m'] == "2") {
$ablcount = $db->quote($_POST['greylisting_ablcount']);
}
array_push($updates,"AutoBlacklistCount = $ablcount");
}
# AWL Percentage
if (isset($_POST['greylisting_ablpercentage_m'])) {
if ($_POST['greylisting_ablpercentage_m'] == "1") {
$ablpercentage = "NULL";
} else {
$ablpercentage = $db->quote($_POST['greylisting_ablpercentage']);
}
array_push($updates,"AutoBlacklistPercentage = $ablpercentage");
}
if (!empty($_POST['greylisting_comment'])) {
array_push($updates,"Comment = ".$db->quote($_POST['greylisting_comment']));
}
if (isset($_POST['greylisting_disabled']) && $_POST['greylisting_disabled'] != "") {
array_push($updates ,"Disabled = ".$db->quote($_POST['greylisting_disabled']));
}
# Check if we have updates
if (sizeof($updates) > 0) {
$updateStr = implode(', ',$updates);
$res = $db->exec("UPDATE ${DB_TABLE_PREFIX}greylisting SET $updateStr WHERE ID = ".$db->quote($_POST['greylisting_id']));
if ($res) {
?>
<div class="notice">Greylisting updated</div>
<?php
} else {
?>
<div class="warning">Error updating Greylisting!</div>
<div class="warning"><?php print_r($db->errorInfo()) ?></div>
<?php
}
} else {
?>
<div class="warning">No changes made to Greylisting</div>
<?php
}
} else {
?>
<div class="warning">Invalid invocation</div>
<?php
}
printFooter();
# vim: ts=4
?>
<?php
# Module: Greylisting 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 greylisting" => "greylisting-main.php",
),
));
# Display delete confirm screen
if ($_POST['frmaction'] == "delete") {
# Check a greylisting was selected
if (isset($_POST['greylisting_id'])) {
?>
<p class="pageheader">Delete Greylisting</p>
<form action="greylisting-delete.php" method="post">
<div>
<input type="hidden" name="frmaction" value="delete2" />
<input type="hidden" name="greylisting_id" value="<?php echo $_POST['greylisting_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 Greylisting selected</div>
<?php
}
# SQL Updates
} elseif ($_POST['frmaction'] == "delete2") {
?>
<p class="pageheader">Greylisting Delete Results</p>
<?php
if (isset($_POST['greylisting_id'])) {
if ($_POST['confirm'] == "yes") {
$res = $db->exec("DELETE FROM ${DB_TABLE_PREFIX}greylisting WHERE ID = ".$db->quote($_POST['greylisting_id']));
if ($res) {
?>
<div class="notice">Greylisting deleted</div>
<?php
} else {
?>
<div class="warning">Error deleting Greylisting!</div>
<div class="warning"><?php print_r($stmt->errorInfo()) ?></div>
<?php
}
} else {
?>
<div class="notice">Greylisting not deleted, aborted by user</div>
<?php
}
# Warn
} else {
?>
<div class="warning">Invocation error, no Greylisting ID</div>
<?php
}
} else {
?>
<div class="warning">Invalid invocation</div>
<?php
}
printFooter();
# vim: ts=4
?>
<?php
# Module: Greylisting
# 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">Greylisting Checks</p>
<form id="main_form" action="greylisting-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 = 'greylisting-add.php';
} else if (myobj.selectedIndex == 4) {
myform.action = 'greylisting-change.php';
} else if (myobj.selectedIndex == 5) {
myform.action = 'greylisting-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}greylisting.ID, ${DB_TABLE_PREFIX}greylisting.Name, ${DB_TABLE_PREFIX}greylisting.Disabled,
${DB_TABLE_PREFIX}policies.Name AS PolicyName
FROM
${DB_TABLE_PREFIX}greylisting, ${DB_TABLE_PREFIX}policies
WHERE
${DB_TABLE_PREFIX}policies.ID = ${DB_TABLE_PREFIX}greylisting.PolicyID
ORDER BY
${DB_TABLE_PREFIX}policies.Name
";
$res = $db->query($sql);
# Check if we got a result
if ($res) {
while ($row = $res->fetchObject()) {
?>
<tr class="resultsitem">
<td><input type="radio" name="greylisting_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();
# Or not
} else {
?>
<tr class="resultsitem">
<td class="textcenter warning" colspan="4"><?php print_r($db->errorInfo()) ?></td>
</tr>
<?php
}
?>
</table>
</form>
<?php
}
printFooter();
# vim: ts=4
?>
<?php
# Module: Greylisting (whitelist) 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 whitelist" => "greylisting-whitelist-main.php"
),
));
if ($_POST['frmaction'] == "add") {
?>
<p class="pageheader">Add Greylisting Whitelist</p>
<form method="post" action="greylisting-whitelist-add.php">
<div>
<input type="hidden" name="frmaction" value="add2" />
</div>
<table class="entry">
<tr>
<td class="entrytitle">
Source
<?php tooltip('greylisting_whitelist_source'); ?>
</td>
<td>
<select id="whitelist_type" name="whitelist_type">
<option value="SenderIP">Sender IP</option>
</select>
<input type="text" name="whitelist_source" size="40" />
</td>
</tr>
<tr>
<td class="entrytitle">Comment</td>
<td><textarea name="whitelist_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">Greylisting Whitelist Add Results</p>
<?php
# Check name
if (empty($_POST['whitelist_source'])) {
?>
<div class="warning">Source cannot be empty</div>
<?php
} else {
$stmt = $db->prepare("INSERT INTO ${DB_TABLE_PREFIX}greylisting_whitelist (Source,Comment,Disabled) VALUES (?,?,1)");
$res = $stmt->execute(array(
$_POST['whitelist_type'] . ":" . $_POST['whitelist_source'],
$_POST['whitelist_comment']
));
if ($res) {
?>
<div class="notice">Greylisting whitelist created</div>
<?php
} else {
?>
<div class="warning">Failed to create Greylisting whitelisting</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: Greylisting (whitelist) 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 whitelist" => "greylisting-whitelist-main.php"
),
));
# Display change screen
if ($_POST['frmaction'] == "change") {
# Check a whitelist was selected
if (isset($_POST['whitelist_id'])) {
# Prepare statement
$stmt = $db->prepare("
SELECT
ID, Source, Comment,
Disabled
FROM
${DB_TABLE_PREFIX}greylisting_whitelist
WHERE
ID = ?
");
?>
<p class="pageheader">Update Greylisting Whitelist</p>
<form action="greylisting-whitelist-change.php" method="post">
<div>
<input type="hidden" name="frmaction" value="change2" />
<input type="hidden" name="whitelist_id" value="<?php echo $_POST['whitelist_id']; ?>" />
</div>
<?php
$res = $stmt->execute(array($_POST['whitelist_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">
Source
<?php tooltip('greylisting_whitelist_source'); ?>
</td>
<td class="oldval"><?php echo $row->source ?></td>
<td>
<select id="whitelist_type" name="whitelist_type">
<option value="">--</option>
<option value="SenderIP">Sender IP</option>
</select>
<input type="text" name="whitelist_source" />
</td>
</tr>
<tr>
<td class="entrytitle texttop">Comment</td>
<td class="oldval texttop"><?php echo $row->comment ?></td>
<td><textarea name="whitelist_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="whitelist_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 whitelisting selected</div>
<?php
}
# SQL Updates
} elseif ($_POST['frmaction'] == "change2") {
?>
<p class="pageheader">Greylisting Whitelisting Update Results</p>
<?php
$updates = array();
if (!empty($_POST['whitelist_type'])) {
array_push($updates,"Source = ".$db->quote($_POST['whitelist_type'].":".$_POST['whitelist_source']));
}
if (!empty($_POST['whitelist_comment'])) {
array_push($updates,"Comment = ".$db->quote($_POST['whitelist_comment']));
}
if (isset($_POST['whitelist_disabled']) && $_POST['whitelist_disabled'] != "") {
array_push($updates ,"Disabled = ".$db->quote($_POST['whitelist_disabled']));
}
# Check if we have updates
if (sizeof($updates) > 0) {
$updateStr = implode(', ',$updates);
$res = $db->exec("UPDATE ${DB_TABLE_PREFIX}greylisting_whitelist SET $updateStr WHERE ID = ".$db->quote($_POST['whitelist_id']));
if ($res) {
?>
<div class="notice">Greylisting whitelisting updated</div>
<?php
} else {
?>
<div class="warning">Error updating Greylisting whitelisting!</div>
<?php
}
} else {
?>
<div class="warning">No changes made to Greylisting whitelisting</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: Greylisting (whitelist) 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 whitelist" => "greylisting-whitelist-main.php",
),
));
# Display delete confirm screen
if ($_POST['frmaction'] == "delete") {
# Check a whitelisting was selected
if (isset($_POST['whitelist_id'])) {
?>
<p class="pageheader">Delete Greylisting whitelist</p>
<form action="greylisting-whitelist-delete.php" method="post">
<div>
<input type="hidden" name="frmaction" value="delete2" />
<input type="hidden" name="whitelist_id" value="<?php echo $_POST['whitelist_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 Greylisting whitelisting selected</div>
<?php
}
# SQL Updates
} elseif ($_POST['frmaction'] == "delete2") {
?>
<p class="pageheader">Greylisting Whitelist Delete Results</p>
<?php
if (isset($_POST['whitelist_id'])) {
if ($_POST['confirm'] == "yes") {
$res = $db->exec("DELETE FROM ${DB_TABLE_PREFIX}greylisting_whitelist WHERE ID = ".$db->quote($_POST['whitelist_id']));
if ($res) {
?>
<div class="notice">Greylisting whitelist deleted</div>
<?php
} else {
?>
<div class="warning">Error deleting Greylisting whitelist!</div>
<div class="warning"><?php print_r($db->errorInfo()) ?></div>
<?php
}
} else {
?>
<div class="notice">Greylisting whitelist 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: Greylisting (whitelisting)
# 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">Greylisting Whitelistings</p>
<form id="main_form" action="greylisting-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 = 'greylisting-whitelist-add.php';
} else if (myobj.selectedIndex == 4) {
myform.action = 'greylisting-whitelist-change.php';
} else if (myobj.selectedIndex == 5) {
myform.action = 'greylisting-whitelist-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">Source</td>
<td class="textcenter">Disabled</td>
</tr>
<?php
$sql = "
SELECT
ID, Source, Disabled
FROM
${DB_TABLE_PREFIX}greylisting_whitelist
ORDER BY
Source
";
$res = $db->query($sql);
while ($row = $res->fetchObject()) {
?>
<tr class="resultsitem">
<td><input type="radio" name="whitelist_id" value="<?php echo $row->id ?>" /></td>
<td><?php echo $row->source ?></td>
<td class="textcenter"><?php echo $row->disabled ? 'yes' : 'no' ?></td>
</tr>
<?php
}
$res->closeCursor();
?>
</table>
</form>
<?php
}
printFooter();
# vim: ts=4
?>
<?php
# Policy group 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");
$db = connect_db();
printHeader(array(
"Tabs" => array(
"Back to groups" => "group-main.php",
),
));
if ($_POST['frmaction'] == "add") {
?>
<p class="pageheader">Add Group</p>
<?php
?>
<form method="post" action="group-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="group_name" /></td>
</tr>
<tr>
<td class="entrytitle">Priority</td>
<td><input type="text" name="group_priority" /></td>
</tr>
<tr>
<td class="entrytitle">Disabled</td>
<td>
<select name="group_disabled">
<option value="0">No</option>
<option value="1">Yes</option>
</select>
</td>
</tr>
<tr>
<td class="entrytitle texttop">Comment</td>
<td><textarea name="group_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">Group Add Results</p>
<?php
$stmt = $db->prepare("INSERT INTO ${DB_TABLE_PREFIX}groups (Name,Priority,Disabled,Comment) VALUES (?,?,?,?)");
$res = $stmt->execute(array(
$_POST['group_name'],
$_POST['group_priority'],
$_POST['group_disabled'],
$_POST['group_comment'],
));
if ($res) {
?>
<div class="notice">Group created</div>
<?php
} else {
?>
<div class="warning">Failed to create group</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 group 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.
#FIXME -> delete groups
include_once("includes/header.php");
include_once("includes/footer.php");
include_once("includes/db.php");
$db = connect_db();
printHeader(array(
"Tabs" => array(
"Back to groups" => "group-main.php",
),
));
# Display delete confirm screen
if ($_POST['frmaction'] == "delete") {
# Check a policy group was selected
if (isset($_POST['group_id'])) {
?>
<p class="pageheader">Delete Group</p>
<form action="group-delete.php" method="post">
<div>
<input type="hidden" name="frmaction" value="delete2" />
<input type="hidden" name="group_id" value="<?php echo $_POST['group_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 group selected</div>
<?php
}
# SQL Updates
} elseif ($_POST['frmaction'] == "delete2") {
?>
<p class="pageheader">Group Delete Results</p>
<?php
if (isset($_POST['group_id'])) {
if ($_POST['confirm'] == "yes") {
$db->beginTransaction();
$res = $db->exec("DELETE FROM ${DB_TABLE_PREFIX}users_to_groups WHERE GroupID = ".$db->quote($_POST['group_id']));
if ($res !== FALSE) {
?>
<div class="notice">Users removed</div>
<?php
} else {
?>
<div class="warning">Error removing users</div>
<div class="warning"><?php print_r($db->errorInfo()) ?></div>
<?php
$db->rollback();
}
if ($res !== FALSE) {
$res = $db->exec("DELETE FROM ${DB_TABLE_PREFIX}groups WHERE ID = ".$db->quote($_POST['group_id']));
if ($res) {
?>
<div class="notice">Group deleted</div>
<?php
} else {
?>
<div class="warning">Error deleting group!</div>
<div class="warning"><?php print_r($db->errorInfo()) ?></div>
<?php
$db->rollback();
}
}
if ($res) {
$db->commit();
}
} else {
?>
<div class="notice">Group not deleted, aborted by user</div>
<?php
}
# Warn
} else {
?>
<div class="warning">Invocation error, no group ID</div>
<?php
}
} else {
?>
<div class="warning">Invalid invocation</div>
<?php
}
printFooter();
# vim: ts=4
?>
<?php
# Policy groups main screen
# 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(
));
?>
<p class="pageheader">User Groups</p>
<form id="main_form" action="group-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 = 'group-add.php';
} else if (myobj.selectedIndex == 3) {
myform.action = 'group-delete.php';
} else if (myobj.selectedIndex == 5) {
myform.action = 'group-member-main.php';
} else if (myobj.selectedIndex == 6) {
myform.action = 'group-attributes.php';
}
myform.submit();
">
<option selected="selected">select action</option>
<option disabled="disabled"> - - - - - - - - - - - </option>
<option value="add">Add Group</option>
<option value="delete">Delete Group</option>
<option disabled="disabled"> - - - - - - - - - - - </option>
<option value="members">List Members</option>
<option value="members">List Attributes</option>
</select>
</div>
<p />
<table class="results" style="width: 75%;">
<tr class="resultstitle">
<td class="textcenter">ID</td>
<td class="textcenter">Name</td>
<td class="textcenter">Priority</td>
<td class="textcenter">Disabled</td>
<td class="textcenter">Comment</td>
</tr>
<?php
$sql = "SELECT ID, Name, Priority, Disabled, Comment FROM ${DB_TABLE_PREFIX}groups ORDER BY ID";
$res = $db->query($sql);
while ($row = $res->fetchObject()) {
?>
<tr class="resultsitem">
<td><input type="radio" name="group_id" value="<?php echo $row->id ?>" /></td>
<td><?php echo $row->name ?></td>
<td><?php echo $row->priority ?></td>
<td class="textcenter"><?php echo $row->disabled ? 'yes' : 'no' ?></td>
<td><?php echo $row->comment ?></td>
</tr>
<?php
}
$res->closeCursor();
?>
</table>
</form>
<?php
printFooter();
# vim: ts=4
?>
webui/images/bg.jpg

437 B