From db413eab9d32ef2f157b4739111e7823d9c76f33 Mon Sep 17 00:00:00 2001 From: Robert Anderson <randerson@lbsd.net> Date: Wed, 25 Mar 2009 10:32:38 +0000 Subject: [PATCH] remove old files --- webui/accesscontrol-add.php | 163 --- webui/accesscontrol-change.php | 221 ---- webui/accesscontrol-delete.php | 114 -- webui/accesscontrol-main.php | 125 -- webui/accounting-add.php | 238 ---- webui/accounting-change.php | 311 ----- webui/accounting-delete.php | 148 --- webui/accounting-main.php | 144 --- webui/amavis-add.php | 1059 ----------------- webui/amavis-change.php | 1246 -------------------- webui/amavis-delete.php | 114 -- webui/amavis-main.php | 119 -- webui/checkhelo-add.php | 331 ------ webui/checkhelo-blacklist-add.php | 112 -- webui/checkhelo-blacklist-change.php | 168 --- webui/checkhelo-blacklist-delete.php | 113 -- webui/checkhelo-blacklist-main.php | 112 -- webui/checkhelo-change.php | 481 -------- webui/checkhelo-delete.php | 114 -- webui/checkhelo-main.php | 119 -- webui/checkhelo-whitelist-add.php | 117 -- webui/checkhelo-whitelist-change.php | 173 --- webui/checkhelo-whitelist-delete.php | 114 -- webui/checkhelo-whitelist-main.php | 112 -- webui/checkspf-add.php | 214 ---- webui/checkspf-change.php | 306 ----- webui/checkspf-delete.php | 113 -- webui/checkspf-main.php | 119 -- webui/greylisting-add.php | 387 ------ webui/greylisting-change.php | 632 ---------- webui/greylisting-delete.php | 114 -- webui/greylisting-main.php | 129 -- webui/greylisting-whitelist-add.php | 117 -- webui/greylisting-whitelist-change.php | 174 --- webui/greylisting-whitelist-delete.php | 114 -- webui/greylisting-whitelist-main.php | 110 -- webui/policy-change.php | 166 --- webui/policy-group-change.php | 146 --- webui/policy-group-member-add.php | 110 -- webui/policy-group-member-change.php | 160 --- webui/policy-group-member-delete.php | 115 -- webui/policy-group-member-main.php | 130 -- webui/policy-member-add.php | 118 -- webui/policy-member-delete.php | 116 -- webui/postfix-aliases-add.php | 135 --- webui/postfix-aliases-change.php | 156 --- webui/postfix-aliases-delete.php | 114 -- webui/postfix-aliases-main.php | 100 -- webui/postfix-distgroups-add.php | 131 -- webui/postfix-distgroups-change.php | 151 --- webui/postfix-distgroups-delete.php | 135 --- webui/postfix-distgroups-main.php | 101 -- webui/postfix-distgroups-member-add.php | 102 -- webui/postfix-distgroups-member-change.php | 147 --- webui/postfix-distgroups-member-delete.php | 116 -- webui/postfix-distgroups-member-main.php | 131 -- webui/postfix-mailboxes-add.php | 165 --- webui/postfix-mailboxes-change.php | 216 ---- webui/postfix-mailboxes-delete.php | 159 --- webui/postfix-mailboxes-main.php | 101 -- webui/postfix-transports-add.php | 141 --- webui/postfix-transports-change.php | 186 --- webui/postfix-transports-delete.php | 114 -- webui/postfix-transports-main.php | 100 -- webui/quotas-add.php | 220 ---- webui/quotas-change.php | 279 ----- webui/quotas-delete.php | 206 ---- webui/quotas-limits-add.php | 130 -- webui/quotas-limits-change.php | 180 --- webui/quotas-limits-delete.php | 116 -- webui/quotas-limits-main.php | 125 -- webui/quotas-main.php | 134 --- 72 files changed, 13749 deletions(-) delete mode 100644 webui/accesscontrol-add.php delete mode 100644 webui/accesscontrol-change.php delete mode 100644 webui/accesscontrol-delete.php delete mode 100644 webui/accesscontrol-main.php delete mode 100644 webui/accounting-add.php delete mode 100644 webui/accounting-change.php delete mode 100644 webui/accounting-delete.php delete mode 100644 webui/accounting-main.php delete mode 100644 webui/amavis-add.php delete mode 100644 webui/amavis-change.php delete mode 100644 webui/amavis-delete.php delete mode 100644 webui/amavis-main.php delete mode 100644 webui/checkhelo-add.php delete mode 100644 webui/checkhelo-blacklist-add.php delete mode 100644 webui/checkhelo-blacklist-change.php delete mode 100644 webui/checkhelo-blacklist-delete.php delete mode 100644 webui/checkhelo-blacklist-main.php delete mode 100644 webui/checkhelo-change.php delete mode 100644 webui/checkhelo-delete.php delete mode 100644 webui/checkhelo-main.php delete mode 100644 webui/checkhelo-whitelist-add.php delete mode 100644 webui/checkhelo-whitelist-change.php delete mode 100644 webui/checkhelo-whitelist-delete.php delete mode 100644 webui/checkhelo-whitelist-main.php delete mode 100644 webui/checkspf-add.php delete mode 100644 webui/checkspf-change.php delete mode 100644 webui/checkspf-delete.php delete mode 100644 webui/checkspf-main.php delete mode 100644 webui/greylisting-add.php delete mode 100644 webui/greylisting-change.php delete mode 100644 webui/greylisting-delete.php delete mode 100644 webui/greylisting-main.php delete mode 100644 webui/greylisting-whitelist-add.php delete mode 100644 webui/greylisting-whitelist-change.php delete mode 100644 webui/greylisting-whitelist-delete.php delete mode 100644 webui/greylisting-whitelist-main.php delete mode 100644 webui/policy-change.php delete mode 100644 webui/policy-group-change.php delete mode 100644 webui/policy-group-member-add.php delete mode 100644 webui/policy-group-member-change.php delete mode 100644 webui/policy-group-member-delete.php delete mode 100644 webui/policy-group-member-main.php delete mode 100644 webui/policy-member-add.php delete mode 100644 webui/policy-member-delete.php delete mode 100644 webui/postfix-aliases-add.php delete mode 100644 webui/postfix-aliases-change.php delete mode 100644 webui/postfix-aliases-delete.php delete mode 100644 webui/postfix-aliases-main.php delete mode 100644 webui/postfix-distgroups-add.php delete mode 100644 webui/postfix-distgroups-change.php delete mode 100644 webui/postfix-distgroups-delete.php delete mode 100644 webui/postfix-distgroups-main.php delete mode 100644 webui/postfix-distgroups-member-add.php delete mode 100644 webui/postfix-distgroups-member-change.php delete mode 100644 webui/postfix-distgroups-member-delete.php delete mode 100644 webui/postfix-distgroups-member-main.php delete mode 100644 webui/postfix-mailboxes-add.php delete mode 100644 webui/postfix-mailboxes-change.php delete mode 100644 webui/postfix-mailboxes-delete.php delete mode 100644 webui/postfix-mailboxes-main.php delete mode 100644 webui/postfix-transports-add.php delete mode 100644 webui/postfix-transports-change.php delete mode 100644 webui/postfix-transports-delete.php delete mode 100644 webui/postfix-transports-main.php delete mode 100644 webui/quotas-add.php delete mode 100644 webui/quotas-change.php delete mode 100644 webui/quotas-delete.php delete mode 100644 webui/quotas-limits-add.php delete mode 100644 webui/quotas-limits-change.php delete mode 100644 webui/quotas-limits-delete.php delete mode 100644 webui/quotas-limits-main.php delete mode 100644 webui/quotas-main.php diff --git a/webui/accesscontrol-add.php b/webui/accesscontrol-add.php deleted file mode 100644 index 7a0d91e9..00000000 --- a/webui/accesscontrol-add.php +++ /dev/null @@ -1,163 +0,0 @@ -<?php -# Module: AccessControl 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 access cntrl" => "accesscontrol-main.php" - ), -)); - - - -if ($_POST['frmaction'] == "add") { -?> - <p class="pageheader">Add Access Control</p> - - <form method="post" action="accesscontrol-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="accesscontrol_name" /></td> - </tr> - <tr> - <td class="entrytitle">Link to policy</td> - <td> - <select name="accesscontrol_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"> - Verdict - <?php tooltip('accesscontrol_verdict'); ?> - </td> - <td> - <select name="accesscontrol_verdict"> - <option value="HOLD">Hold</option> - <option value="REJECT" selected="selected">Reject</option> - <option value="DISCARD">Discard (drop)</option> - <option value="FILTER">Filter</option> - <option value="REDIRECT">Redirect</option> - <option value="OK">Ok</option> - </select> - </td> - </tr> - <tr> - <td class="entrytitle"> - Data - <?php tooltip('accesscontrol_data'); ?> - </td> - <td><input type="text" name="accesscontrol_data" /></td> - </tr> - <tr> - <td class="entrytitle">Comment</td> - <td><textarea name="accesscontrol_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">Access Control Add Results</p> - -<?php - # Check name - if (empty($_POST['accesscontrol_policyid'])) { -?> - <div class="warning">Policy ID cannot be empty</div> -<?php - - # Check name - } elseif (empty($_POST['accesscontrol_name'])) { -?> - <div class="warning">Name cannot be empty</div> -<?php - - # Check verdict - } elseif (empty($_POST['accesscontrol_verdict'])) { -?> - <div class="warning">Verdict cannot be empty</div> -<?php - - } else { - $stmt = $db->prepare("INSERT INTO ${DB_TABLE_PREFIX}access_control (PolicyID,Name,Verdict,Data,Comment,Disabled) VALUES (?,?,?,?,?,1)"); - - $res = $stmt->execute(array( - $_POST['accesscontrol_policyid'], - $_POST['accesscontrol_name'], - $_POST['accesscontrol_verdict'], - $_POST['accesscontrol_data'], - $_POST['accesscontrol_comment'] - )); - - if ($res) { -?> - <div class="notice">Access control created</div> -<?php - } else { -?> - <div class="warning">Failed to create access control</div> - <div class="warning"><?php print_r($stmt->errorInfo()) ?></div> -<?php - } - - } - - -} else { -?> - <div class="warning">Invalid invocation</div> -<?php -} - -printFooter(); - - -# vim: ts=4 -?> diff --git a/webui/accesscontrol-change.php b/webui/accesscontrol-change.php deleted file mode 100644 index bba8491b..00000000 --- a/webui/accesscontrol-change.php +++ /dev/null @@ -1,221 +0,0 @@ -<?php -# Module: AccessControl 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 access cntrl" => "accesscontrol-main.php" - ), -)); - - - -# Display change screen -if ($_POST['frmaction'] == "change") { - - # Check a access control was selected - if (isset($_POST['accesscontrol_id'])) { - # Prepare statement - $stmt = $db->prepare(" - SELECT - ${DB_TABLE_PREFIX}access_control.ID, ${DB_TABLE_PREFIX}access_control.PolicyID, ${DB_TABLE_PREFIX}access_control.Name, - ${DB_TABLE_PREFIX}access_control.Verdict, ${DB_TABLE_PREFIX}access_control.Data, - ${DB_TABLE_PREFIX}access_control.Comment, ${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}access_control.ID = ? - AND ${DB_TABLE_PREFIX}policies.ID = ${DB_TABLE_PREFIX}access_control.PolicyID - "); -?> - <p class="pageheader">Update Access Control</p> - - <form action="accesscontrol-change.php" method="post"> - <div> - <input type="hidden" name="frmaction" value="change2" /> - <input type="hidden" name="accesscontrol_id" value="<?php echo $_POST['accesscontrol_id']; ?>" /> - </div> -<?php - - $res = $stmt->execute(array($_POST['accesscontrol_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="accesscontrol_name" /></td> - </tr> - <tr> - <td class="entrytitle">Link to policy</td> - <td class="oldval"><?php echo $row->policyname ?></td> - <td> - <select name="accesscontrol_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"> - Verdict - <?php tooltip('accesscontrol_verdict'); ?> - </td> - <td class="oldval"><?php echo $row->verdict ?></td> - <td> - <select name="accesscontrol_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> - <option value="OK">Ok</option> - </select> - </td> - </tr> - <tr> - <td class="entrytitle"> - Data - <?php tooltip('accesscontrol_data'); ?> - </td> - <td class="oldval"><?php echo $row->data ?></td> - <td><input type="text" name="accesscontrol_data" /></td> - </tr> - <tr> - <td class="entrytitle texttop">Comment</td> - <td class="oldval texttop"><?php echo $row->comment ?></td> - <td><textarea name="accesscontrol_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="accesscontrol_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">Access Control Update Results</p> -<?php - $updates = array(); - - if (!empty($_POST['accesscontrol_policyid'])) { - array_push($updates,"PolicyID = ".$db->quote($_POST['accesscontrol_policyid'])); - } - if (!empty($_POST['accesscontrol_name'])) { - array_push($updates,"Name = ".$db->quote($_POST['accesscontrol_name'])); - } - if (!empty($_POST['accesscontrol_verdict'])) { - array_push($updates,"Verdict = ".$db->quote($_POST['accesscontrol_verdict'])); - } - if (!empty($_POST['accesscontrol_data'])) { - array_push($updates,"Data = ".$db->quote($_POST['accesscontrol_data'])); - } - if (!empty($_POST['accesscontrol_comment'])) { - array_push($updates,"Comment = ".$db->quote($_POST['accesscontrol_comment'])); - } - if (isset($_POST['accesscontrol_disabled']) && $_POST['accesscontrol_disabled'] != "") { - array_push($updates ,"Disabled = ".$db->quote($_POST['accesscontrol_disabled'])); - } - - # Check if we have updates - if (sizeof($updates) > 0) { - $updateStr = implode(', ',$updates); - - $res = $db->exec("UPDATE ${DB_TABLE_PREFIX}access_control SET $updateStr WHERE ID = ".$db->quote($_POST['accesscontrol_id'])); - if ($res) { -?> - <div class="notice">Access control updated</div> -<?php - } else { -?> - <div class="warning">Error updating access control!</div> - <div class="warning"><?php print_r($db->errorInfo()) ?></div> -<?php - } - - } else { -?> - <div class="warning">No changes made to access control</div> -<?php - } - -} else { -?> - <div class="warning">Invalid invocation</div> -<?php -} - - -printFooter(); - - -# vim: ts=4 -?> diff --git a/webui/accesscontrol-delete.php b/webui/accesscontrol-delete.php deleted file mode 100644 index ec7f017c..00000000 --- a/webui/accesscontrol-delete.php +++ /dev/null @@ -1,114 +0,0 @@ -<?php -# Module: AccessControl 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 access cntrl" => "accesscontrol-main.php", - ), -)); - - - -# Display delete confirm screen -if ($_POST['frmaction'] == "delete") { - - # Check a access control was selected - if (isset($_POST['accesscontrol_id'])) { -?> - <p class="pageheader">Delete Access Control</p> - - <form action="accesscontrol-delete.php" method="post"> - <div> - <input type="hidden" name="frmaction" value="delete2" /> - <input type="hidden" name="accesscontrol_id" value="<?php echo $_POST['accesscontrol_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 access control selected</div> -<?php - } - - - -# SQL Updates -} elseif ($_POST['frmaction'] == "delete2") { -?> - <p class="pageheader">Access Control Delete Results</p> -<?php - if (isset($_POST['accesscontrol_id'])) { - - if ($_POST['confirm'] == "yes") { - $res = $db->exec("DELETE FROM ${DB_TABLE_PREFIX}access_control WHERE ID = ".$db->quote($_POST['accesscontrol_id'])); - if ($res) { -?> - <div class="notice">Access control deleted</div> -<?php - } else { -?> - <div class="warning">Error deleting access control!</div> - <div class="warning"><?php print_r($db->errorInfo()) ?></div> -<?php - } - } else { -?> - <div class="notice">Access control not deleted, aborted by user</div> -<?php - } - - # Warn - } else { -?> - <div class="warning">Invocation error, no access control ID</div> -<?php - } - - - -} else { -?> - <div class="warning">Invalid invocation</div> -<?php -} - - -printFooter(); - - -# vim: ts=4 -?> - diff --git a/webui/accesscontrol-main.php b/webui/accesscontrol-main.php deleted file mode 100644 index 5f9b2bcf..00000000 --- a/webui/accesscontrol-main.php +++ /dev/null @@ -1,125 +0,0 @@ -<?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 -?> diff --git a/webui/accounting-add.php b/webui/accounting-add.php deleted file mode 100644 index f03264f0..00000000 --- a/webui/accounting-add.php +++ /dev/null @@ -1,238 +0,0 @@ -<?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 -?> diff --git a/webui/accounting-change.php b/webui/accounting-change.php deleted file mode 100644 index 62fbc21b..00000000 --- a/webui/accounting-change.php +++ /dev/null @@ -1,311 +0,0 @@ -<?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 -?> diff --git a/webui/accounting-delete.php b/webui/accounting-delete.php deleted file mode 100644 index 12fa60ee..00000000 --- a/webui/accounting-delete.php +++ /dev/null @@ -1,148 +0,0 @@ -<?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 -?> - diff --git a/webui/accounting-main.php b/webui/accounting-main.php deleted file mode 100644 index 8d594d85..00000000 --- a/webui/accounting-main.php +++ /dev/null @@ -1,144 +0,0 @@ -<?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 -?> diff --git a/webui/amavis-add.php b/webui/amavis-add.php deleted file mode 100644 index af6d218e..00000000 --- a/webui/amavis-add.php +++ /dev/null @@ -1,1059 +0,0 @@ -<?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 & 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;"> </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 -?> diff --git a/webui/amavis-change.php b/webui/amavis-change.php deleted file mode 100644 index db23369a..00000000 --- a/webui/amavis-change.php +++ /dev/null @@ -1,1246 +0,0 @@ -<?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 & 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;"> </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 -?> diff --git a/webui/amavis-delete.php b/webui/amavis-delete.php deleted file mode 100644 index 3a3ee2dd..00000000 --- a/webui/amavis-delete.php +++ /dev/null @@ -1,114 +0,0 @@ -<?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 -?> - diff --git a/webui/amavis-main.php b/webui/amavis-main.php deleted file mode 100644 index 6f374ea9..00000000 --- a/webui/amavis-main.php +++ /dev/null @@ -1,119 +0,0 @@ -<?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 -?> diff --git a/webui/checkhelo-add.php b/webui/checkhelo-add.php deleted file mode 100644 index 8c9cadfd..00000000 --- a/webui/checkhelo-add.php +++ /dev/null @@ -1,331 +0,0 @@ -<?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;"> </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 -?> diff --git a/webui/checkhelo-blacklist-add.php b/webui/checkhelo-blacklist-add.php deleted file mode 100644 index 9ed60342..00000000 --- a/webui/checkhelo-blacklist-add.php +++ /dev/null @@ -1,112 +0,0 @@ -<?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 -?> diff --git a/webui/checkhelo-blacklist-change.php b/webui/checkhelo-blacklist-change.php deleted file mode 100644 index 94da7ca8..00000000 --- a/webui/checkhelo-blacklist-change.php +++ /dev/null @@ -1,168 +0,0 @@ -<?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 -?> diff --git a/webui/checkhelo-blacklist-delete.php b/webui/checkhelo-blacklist-delete.php deleted file mode 100644 index 4dc56440..00000000 --- a/webui/checkhelo-blacklist-delete.php +++ /dev/null @@ -1,113 +0,0 @@ -<?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 -?> diff --git a/webui/checkhelo-blacklist-main.php b/webui/checkhelo-blacklist-main.php deleted file mode 100644 index 33df11f7..00000000 --- a/webui/checkhelo-blacklist-main.php +++ /dev/null @@ -1,112 +0,0 @@ -<?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 -?> diff --git a/webui/checkhelo-change.php b/webui/checkhelo-change.php deleted file mode 100644 index e99979d7..00000000 --- a/webui/checkhelo-change.php +++ /dev/null @@ -1,481 +0,0 @@ -<?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;"> </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 -?> diff --git a/webui/checkhelo-delete.php b/webui/checkhelo-delete.php deleted file mode 100644 index f607b344..00000000 --- a/webui/checkhelo-delete.php +++ /dev/null @@ -1,114 +0,0 @@ -<?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 -?> - diff --git a/webui/checkhelo-main.php b/webui/checkhelo-main.php deleted file mode 100644 index 8b1c7c61..00000000 --- a/webui/checkhelo-main.php +++ /dev/null @@ -1,119 +0,0 @@ -<?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 -?> diff --git a/webui/checkhelo-whitelist-add.php b/webui/checkhelo-whitelist-add.php deleted file mode 100644 index fdcd3d84..00000000 --- a/webui/checkhelo-whitelist-add.php +++ /dev/null @@ -1,117 +0,0 @@ -<?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 -?> diff --git a/webui/checkhelo-whitelist-change.php b/webui/checkhelo-whitelist-change.php deleted file mode 100644 index b180d14a..00000000 --- a/webui/checkhelo-whitelist-change.php +++ /dev/null @@ -1,173 +0,0 @@ -<?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 -?> diff --git a/webui/checkhelo-whitelist-delete.php b/webui/checkhelo-whitelist-delete.php deleted file mode 100644 index 6f6826f6..00000000 --- a/webui/checkhelo-whitelist-delete.php +++ /dev/null @@ -1,114 +0,0 @@ -<?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 -?> - diff --git a/webui/checkhelo-whitelist-main.php b/webui/checkhelo-whitelist-main.php deleted file mode 100644 index e3d168cc..00000000 --- a/webui/checkhelo-whitelist-main.php +++ /dev/null @@ -1,112 +0,0 @@ -<?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 -?> diff --git a/webui/checkspf-add.php b/webui/checkspf-add.php deleted file mode 100644 index b4a3902e..00000000 --- a/webui/checkspf-add.php +++ /dev/null @@ -1,214 +0,0 @@ -<?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 -?> diff --git a/webui/checkspf-change.php b/webui/checkspf-change.php deleted file mode 100644 index ea94b4d7..00000000 --- a/webui/checkspf-change.php +++ /dev/null @@ -1,306 +0,0 @@ -<?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 -?> diff --git a/webui/checkspf-delete.php b/webui/checkspf-delete.php deleted file mode 100644 index 0a7f2062..00000000 --- a/webui/checkspf-delete.php +++ /dev/null @@ -1,113 +0,0 @@ -<?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 -?> diff --git a/webui/checkspf-main.php b/webui/checkspf-main.php deleted file mode 100644 index 09df2ac7..00000000 --- a/webui/checkspf-main.php +++ /dev/null @@ -1,119 +0,0 @@ -<?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 -?> diff --git a/webui/greylisting-add.php b/webui/greylisting-add.php deleted file mode 100644 index 1b02b617..00000000 --- a/webui/greylisting-add.php +++ /dev/null @@ -1,387 +0,0 @@ -<?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;"> </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 -?> diff --git a/webui/greylisting-change.php b/webui/greylisting-change.php deleted file mode 100644 index 175be215..00000000 --- a/webui/greylisting-change.php +++ /dev/null @@ -1,632 +0,0 @@ -<?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;"> </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 -?> diff --git a/webui/greylisting-delete.php b/webui/greylisting-delete.php deleted file mode 100644 index 220062fd..00000000 --- a/webui/greylisting-delete.php +++ /dev/null @@ -1,114 +0,0 @@ -<?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 -?> - diff --git a/webui/greylisting-main.php b/webui/greylisting-main.php deleted file mode 100644 index 99edd6ce..00000000 --- a/webui/greylisting-main.php +++ /dev/null @@ -1,129 +0,0 @@ -<?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 -?> diff --git a/webui/greylisting-whitelist-add.php b/webui/greylisting-whitelist-add.php deleted file mode 100644 index f4c466b3..00000000 --- a/webui/greylisting-whitelist-add.php +++ /dev/null @@ -1,117 +0,0 @@ -<?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 -?> diff --git a/webui/greylisting-whitelist-change.php b/webui/greylisting-whitelist-change.php deleted file mode 100644 index 05deb7fc..00000000 --- a/webui/greylisting-whitelist-change.php +++ /dev/null @@ -1,174 +0,0 @@ -<?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 -?> diff --git a/webui/greylisting-whitelist-delete.php b/webui/greylisting-whitelist-delete.php deleted file mode 100644 index 2dce765c..00000000 --- a/webui/greylisting-whitelist-delete.php +++ /dev/null @@ -1,114 +0,0 @@ -<?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 -?> - diff --git a/webui/greylisting-whitelist-main.php b/webui/greylisting-whitelist-main.php deleted file mode 100644 index 0a31b531..00000000 --- a/webui/greylisting-whitelist-main.php +++ /dev/null @@ -1,110 +0,0 @@ -<?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 -?> diff --git a/webui/policy-change.php b/webui/policy-change.php deleted file mode 100644 index 8dcb5e67..00000000 --- a/webui/policy-change.php +++ /dev/null @@ -1,166 +0,0 @@ -<?php -# Policy 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 policies" => "policy-main.php" - ), -)); - - - -# Display change screen -if ($_POST['frmaction'] == "change") { - - # Check a policy was selected - if (isset($_POST['policy_id'])) { - # Prepare statement - $stmt = $db->prepare("SELECT ID, Name, Priority, Description, Disabled FROM ${DB_TABLE_PREFIX}policies WHERE ID = ?"); -?> - <p class="pageheader">Update Policies</p> - - <form action="policy-change.php" method="post"> - <div> - <input type="hidden" name="frmaction" value="change2" /> - <input type="hidden" name="policy_id" value="<?php echo $_POST['policy_id']; ?>" /> - </div> -<?php - - $res = $stmt->execute(array($_POST['policy_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="policy_name" /></td> - </tr> - <tr> - <td class="entrytitle">Priority</td> - <td class="oldval"><?php echo $row->priority ?></td> - <td> - <input type="text" name="policy_priority" /> - <?php tooltip('policy_priority'); ?> - </td> - </tr> - <tr> - <td class="entrytitle texttop">Description</td> - <td class="oldval texttop"><?php echo $row->description ?></td> - <td><textarea name="policy_description" 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="policy_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 policy selected</div> -<?php - } - - - -# SQL Updates -} elseif ($_POST['frmaction'] == "change2") { -?> - <p class="pageheader">Policy Update Results</p> -<?php - $updates = array(); - - if (!empty($_POST['policy_name'])) { - array_push($updates,"Name = ".$db->quote($_POST['policy_name'])); - } - if (isset($_POST['policy_priority']) && $_POST['policy_priority'] != "") { - array_push($updates,"Priority = ".$db->quote($_POST['policy_priority'])); - } - if (!empty($_POST['policy_description'])) { - array_push($updates,"Description = ".$db->quote($_POST['policy_description'])); - } - if (isset($_POST['policy_disabled']) && $_POST['policy_disabled'] != "") { - array_push($updates ,"Disabled = ".$db->quote($_POST['policy_disabled'])); - } - - # Check if we have updates - if (sizeof($updates) > 0) { - $updateStr = implode(', ',$updates); - - $res = $db->exec("UPDATE ${DB_TABLE_PREFIX}policies SET $updateStr WHERE ID = ".$db->quote($_POST['policy_id'])); - if ($res) { -?> - <div class="notice">Policy updated</div> -<?php - } else { -?> - <div class="warning">Error updating policy!</div> - <div class="warning"><?php print_r($db->errorInfo()) ?></div> -<?php - } - - } else { -?> - <div class="warning">No changes made to policy</div> -<?php - } - -} else { -?> - <div class="warning">Invalid invocation</div> -<?php -} - - -printFooter(); - - -# vim: ts=4 -?> diff --git a/webui/policy-group-change.php b/webui/policy-group-change.php deleted file mode 100644 index 65afe1ac..00000000 --- a/webui/policy-group-change.php +++ /dev/null @@ -1,146 +0,0 @@ -<?php -# Policy group 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"); - - - -$db = connect_db(); - - - -printHeader(array( - "Tabs" => array( - "Back to groups" => "policy-group-main.php" - ), -)); - - - -# Display change screen -if ($_POST['frmaction'] == "change") { - - # Check a policy was selected - if (isset($_POST['policy_group_id'])) { - # Prepare statement - $stmt = $db->prepare("SELECT ID, Name, Disabled FROM ${DB_TABLE_PREFIX}policy_groups WHERE ID = ?"); -?> - <p class="pageheader">Update Policy Group</p> - - <form action="policy-group-change.php" method="post"> - <div> - <input type="hidden" name="frmaction" value="change2" /> - <input type="hidden" name="policy_group_id" value="<?php echo $_POST['policy_group_id']; ?>" /> - </div> -<?php - - $res = $stmt->execute(array($_POST['policy_group_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="policy_group_name" /></td> - </tr> - <tr> - <td class="entrytitle">Disabled</td> - <td class="oldval"><?php echo $row->disabled ? 'yes' : 'no' ?></td> - <td> - <select name="policy_group_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 policy selected</div> -<?php - } - - - -# SQL Updates -} elseif ($_POST['frmaction'] == "change2") { -?> - <p class="pageheader">Policy Group Update Results</p> -<?php - $updates = array(); - - if (!empty($_POST['policy_group_name'])) { - array_push($updates,"Name = ".$db->quote($_POST['policy_group_name'])); - } - if (isset($_POST['policy_group_disabled']) && $_POST['policy_group_disabled'] != "") { - array_push($updates ,"Disabled = ".$db->quote($_POST['policy_group_disabled'])); - } - - # Check if we have updates - if (sizeof($updates) > 0) { - $updateStr = implode(', ',$updates); - - $res = $db->exec("UPDATE ${DB_TABLE_PREFIX}policy_groups SET $updateStr WHERE ID = ".$db->quote($_POST['policy_group_id'])); - if ($res) { -?> - <div class="notice">Policy group updated</div> -<?php - } else { -?> - <div class="warning">Error updating policy group!</div> - <div class="warning"><?php print_r($db->errorInfo()) ?></div> -<?php - } - - } else { -?> - <div class="warning">No changes made to policy group</div> -<?php - } - -} else { -?> - <div class="warning">Invalid invocation</div> -<?php -} - - -printFooter(); - - -# vim: ts=4 -?> diff --git a/webui/policy-group-member-add.php b/webui/policy-group-member-add.php deleted file mode 100644 index 93bf9229..00000000 --- a/webui/policy-group-member-add.php +++ /dev/null @@ -1,110 +0,0 @@ -<?php -# Policy group member 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 groups" => "policy-group-main.php", - "Back to members" => "policy-group-member-main.php?policy_group_id=".$_POST['policy_group_id'], - ), -)); - - -if ($_POST['frmaction'] == "add") { -?> - <p class="pageheader">Add Policy Group Member</p> -<?php -?> - <form method="post" action="policy-group-member-add.php"> - <div> - <input type="hidden" name="frmaction" value="add2" /> - <input type="hidden" name="policy_group_id" value="<?php echo $_POST['policy_group_id'] ?>" /> - </div> - <table class="entry"> - <tr> - <td class="entrytitle"> - Member - <?php tooltip('policy_group_member'); ?> - </td> - <td><input type="text" name="policy_group_member_member" /></td> - </tr> - <tr> - <td class="entrytitle">Comment</td> - <td><textarea name="policy_group_member_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">Policy Group Member Add Results</p> - -<?php - - $stmt = $db->prepare("INSERT INTO ${DB_TABLE_PREFIX}policy_group_members (PolicyGroupID,Member,Comment,Disabled) VALUES (?,?,?,1)"); - - $res = $stmt->execute(array( - $_POST['policy_group_id'], - $_POST['policy_group_member_member'], - $_POST['policy_group_member_comment'] - )); - if ($res) { -?> - <div class="notice">Policy group member created</div> -<?php - } else { -?> - <div class="warning">Failed to create policy group member</div> - <div class="warning"><?php print_r($stmt->errorInfo()) ?></div> -<?php - } - - - -} else { -?> - <div class="warning">Invalid invocation</div> -<?php -} - - -printFooter(); - - -# vim: ts=4 -?> diff --git a/webui/policy-group-member-change.php b/webui/policy-group-member-change.php deleted file mode 100644 index dad89541..00000000 --- a/webui/policy-group-member-change.php +++ /dev/null @@ -1,160 +0,0 @@ -<?php -# Policy group 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 groups" => "policy-group-main.php", - "Back to members" => "policy-group-member-main.php?policy_group_id=".$_POST['policy_group_id'], - ), -)); - - - -# Display change screen -if ($_POST['frmaction'] == "change") { - - # Check a policy was selected - if (isset($_POST['policy_group_member_id'])) { - # Prepare statement - $stmt = $db->prepare("SELECT ID, Member, Comment, Disabled FROM ${DB_TABLE_PREFIX}policy_group_members WHERE ID = ?"); -?> - <p class="pageheader">Update Policy Group Member</p> - - <form action="policy-group-member-change.php" method="post"> - <div> - <input type="hidden" name="frmaction" value="change2" /> - <input type="hidden" name="policy_group_id" value="<?php echo $_POST['policy_group_id']; ?>" /> - <input type="hidden" name="policy_group_member_id" value="<?php echo $_POST['policy_group_member_id']; ?>" /> - </div> -<?php - - $res = $stmt->execute(array($_POST['policy_group_member_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"> - Member - <?php tooltip('policy_group_member'); ?> - </td> - <td class="oldval"><?php echo $row->member ?></td> - <td><input type="text" name="policy_group_member_member" /></td> - </tr> - <tr> - <td class="entrytitle texttop">Comment</td> - <td class="oldval texttop"><?php echo $row->comment ?></td> - <td><textarea name="policy_group_member_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="policy_group_member_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 policy selected</div> -<?php - } - - - -# SQL Updates -} elseif ($_POST['frmaction'] == "change2") { -?> - <p class="pageheader">Policy Group Member Update Results</p> -<?php - $updates = array(); - - if (!empty($_POST['policy_group_member_member'])) { - array_push($updates,"Member = ".$db->quote($_POST['policy_group_member_member'])); - } - if (!empty($_POST['policy_group_member_comment'])) { - array_push($updates,"Comment = ".$db->quote($_POST['policy_group_member_comment'])); - } - if (isset($_POST['policy_group_member_disabled']) && $_POST['policy_group_member_disabled'] != "") { - array_push($updates ,"Disabled = ".$db->quote($_POST['policy_group_member_disabled'])); - } - - # Check if we have updates - if (sizeof($updates) > 0) { - $updateStr = implode(', ',$updates); - - $res = $db->exec("UPDATE ${DB_TABLE_PREFIX}policy_group_members SET $updateStr WHERE ID = ".$db->quote($_POST['policy_group_member_id'])); - if ($res) { -?> - <div class="notice">Policy group member updated</div> -<?php - } else { -?> - <div class="warning">Error updating policy group member!</div> - <div class="warning"><?php print_r($db->errorInfo()) ?></div> -<?php - } - - } else { -?> - <div class="warning">No changes made to policy group member</div> -<?php - } - -} else { -?> - <div class="warning">Invalid invocation</div> -<?php -} - - -printFooter(); - - -# vim: ts=4 -?> diff --git a/webui/policy-group-member-delete.php b/webui/policy-group-member-delete.php deleted file mode 100644 index 4b98be2e..00000000 --- a/webui/policy-group-member-delete.php +++ /dev/null @@ -1,115 +0,0 @@ -<?php -# Policy group member 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 groups" => "policy-group-main.php", - "Back to members" => "policy-group-member-main.php?policy_group_id=".$_POST['policy_group_id'], - ), -)); - - - -# Display delete confirm screen -if ($_POST['frmaction'] == "delete") { - - # Check a policy group member was selected - if (isset($_POST['policy_group_member_id'])) { -?> - <p class="pageheader">Delete Policy Group Member</p> - - <form action="policy-group-member-delete.php" method="post"> - <div> - <input type="hidden" name="frmaction" value="delete2" /> - <input type="hidden" name="policy_group_id" value="<?php echo $_POST['policy_group_id']; ?>" /> - <input type="hidden" name="policy_group_member_id" value="<?php echo $_POST['policy_group_member_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 policy group member selected</div> -<?php - } - - - -# SQL Updates -} elseif ($_POST['frmaction'] == "delete2") { -?> - <p class="pageheader">Policy Group Member Delete Results</p> -<?php - if (isset($_POST['policy_group_member_id'])) { - - if ($_POST['confirm'] == "yes") { - $res = $db->exec("DELETE FROM ${DB_TABLE_PREFIX}policy_group_members WHERE ID = ".$db->quote($_POST['policy_group_member_id'])); - if ($res) { -?> - <div class="notice">Policy group member deleted</div> -<?php - } else { -?> - <div class="warning">Error deleting policy group member!</div> - <div class="warning"><?php print_r($db->errorInfo()) ?></div> -<?php - } - } else { -?> - <div class="notice">Policy group member not deleted, aborted by user</div> -<?php - } - - # Warn - } else { -?> - <div class="warning">Invocation error, no policy group member ID</div> -<?php - } - - - -} else { -?> - <div class="warning">Invalid invocation</div> -<?php -} - - -printFooter(); - - -# vim: ts=4 -?> - diff --git a/webui/policy-group-member-main.php b/webui/policy-group-member-main.php deleted file mode 100644 index d3aea594..00000000 --- a/webui/policy-group-member-main.php +++ /dev/null @@ -1,130 +0,0 @@ -<?php -# Policy group member 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( - "Tabs" => array( - "Back to groups" => "group-main.php" - ), -)); - - -# Check a policy group was selected -if (isset($_POST['group_id'])) { - -?> - <p class="pageheader">Group Members</p> - -<?php - - $group_stmt = $db->prepare("SELECT Name FROM ${DB_TABLE_PREFIX}groups WHERE ID = ?"); - $group_stmt->execute(array($_POST['group_id'])); - $row = $group_stmt->fetchObject(); - $group_stmt->closeCursor(); -?> - <form id="main_form" action="group-member-main.php" method="post"> - <div> - <input type="hidden" name="group_id" value="<?php echo $_POST['group_id'] ?>" /> - </div> - <div class="textcenter"> - <div class="notice">Group: <?php echo $row->name ?></div> - - 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-member-add.php'; - myform.submit(); - } else if (myobj.selectedIndex == 4) { - myform.action = 'group-member-change.php'; - myform.submit(); - } else if (myobj.selectedIndex == 5) { - myform.action = 'group-member-delete.php'; - myform.submit(); - } -"> - - <option 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">Member</td> - <td class="textcenter">Disabled</td> - </tr> -<?php - - $stmt = $db->prepare("SELECT UserID FROM ${DB_TABLE_PREFIX}users_to_groups WHERE GroupID = ?"); - $res = $stmt->execute(array($_REQUEST['group_id'])); - - # Loop with rows - while ($row = $stmt->fetchObject()) { - - $sql = "SELECT ID, Username, Disabled FROM ${DB_TABLE_PREFIX}users WHERE ID = ".$row->userid; - $res = $db->query($sql); - - # List users - while ($row = $res->fetchObject()) { -?> - <tr class="resultsitem"> - <td><input type="radio" name="user_id" value="<?php echo $row->id ?>"/><?php echo $row->id ?></td> - <td><?php echo $row->username ?></td> - <td class="textcenter"><?php echo $row->disabled ? 'yes' : 'no' ?></td> - </tr> -<?php - } - $res->closeCursor(); - } - $stmt->closeCursor(); -?> - </table> - </form> -<?php -} else { -?> - <div class="warning">Invalid invocation</div> -<?php -} - - -printFooter(); - - -# vim: ts=4 -?> diff --git a/webui/policy-member-add.php b/webui/policy-member-add.php deleted file mode 100644 index 8938543e..00000000 --- a/webui/policy-member-add.php +++ /dev/null @@ -1,118 +0,0 @@ -<?php -# Policy member 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 policies" => "policy-main.php", - "Back to members" => "policy-member-main.php?policy_id=".$_REQUEST['username'], - ), -)); - - -if ($_POST['frmaction'] == "add") { -?> - <p class="pageheader">Add user</p> -<?php - if (!empty($_POST['username'])) { -?> - <form method="post" action="policy-member-add.php"> - <div> - <input type="hidden" name="frmaction" value="add2" /> - <input type="hidden" name="policy_id" value="<?php echo $_POST['username'] ?>" /> - </div> - <table class="entry"> - <tr> - <td class="entrytitle texttop"> - Username - <?php tooltip('Username'); ?> - </td> - <td><textarea name="member_source" cols="40" rows="5"/></textarea></td> - </tr> - <tr> - <td colspan="2"> - <input type="submit" /> - </td> - </tr> - </table> - </form> -<?php - } else { -?> - <div class="warning">Invalid user name</div> -<?php - } - - - -# Check we have all params -} elseif ($_POST['frmaction'] == "add2") { -?> - <p class="pageheader">Policy Member Add Results</p> - -<?php - # Check source and dest are not blank - if (empty($_POST['username'])) { -?> - <div class="warning">A blank member is useless?</div> -<?php - - - } else { - $stmt = $db->prepare("INSERT INTO ${DB_TABLE_PREFIX}users (Username) VALUES (?)"); - - $res = $stmt->execute(array( - $_POST['username'], - )); - if ($res) { -?> - <div class="notice">User added</div> -<?php - } else { -?> - <div class="warning">Failed to add user</div> - <div class="warning"><?php print_r($stmt->errorInfo()) ?></div> -<?php - } - - } - - -} else { -?> - <div class="warning">Invalid invocation</div> -<?php -} - - -printFooter(); - - -# vim: ts=4 -?> diff --git a/webui/policy-member-delete.php b/webui/policy-member-delete.php deleted file mode 100644 index e00239e6..00000000 --- a/webui/policy-member-delete.php +++ /dev/null @@ -1,116 +0,0 @@ -<?php -# Policy member 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 policies" => "policy-main.php", - "Back to members" => "policy-member-main.php?policy_id=".$_REQUEST['policy_id'], - ), -)); - - - -# Display delete confirm screen -if ($_POST['frmaction'] == "delete") { - - # Check a policy was selected - if (isset($_POST['policy_member_id'])) { -?> - <p class="pageheader">Delete Policy Member</p> - - <form action="policy-member-delete.php" method="post"> - <div> - <input type="hidden" name="frmaction" value="delete2" /> - <input type="hidden" name="policy_id" value="<?php echo $_POST['policy_id']; ?>" /> - <input type="hidden" name="policy_member_id" value="<?php echo $_POST['policy_member_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 policy selected</div> -<?php - } - - - -# SQL Updates -} elseif ($_POST['frmaction'] == "delete2") { -?> - <p class="pageheader">Policy Member Delete Results</p> -<?php - if (isset($_POST['policy_member_id'])) { - - if ($_POST['confirm'] == "yes") { - $res = $db->exec("DELETE FROM ${DB_TABLE_PREFIX}policy_members WHERE ID = ".$db->quote($_POST['policy_member_id'])); - if ($res) { -?> - <div class="notice">Policy member deleted</div> -<?php - } else { -?> - <div class="warning">Error deleting policy member!</div> - <div class="warning"><?php print_r($db->errorInfo()) ?></div> -<?php - } - } else { -?> - <div class="notice">Policy member not deleted, aborted by user</div> -<?php - } - - # Warn - } else { -?> - <div class="warning">Invocation error, no policy member ID</div> -<?php - } - - - -} else { -?> - <div class="warning">Invalid invocation</div> -<?php -} - - -printFooter(); - - -# vim: ts=4 -?> - diff --git a/webui/postfix-aliases-add.php b/webui/postfix-aliases-add.php deleted file mode 100644 index 9ccb6fb1..00000000 --- a/webui/postfix-aliases-add.php +++ /dev/null @@ -1,135 +0,0 @@ -<?php -# Postfix aliases 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_postfix_db(); - - - -printHeader(array( - "Tabs" => array( - "Back to Aliases" => "postfix-aliases-main.php", - ), -)); - - -if ($_POST['frmaction'] == "add") { -?> - <p class="pageheader">Add Postfix Alias</p> -<?php -?> - <form method="post" action="postfix-aliases-add.php"> - <div> - <input type="hidden" name="frmaction" value="add2" /> - </div> - <table class="entry"> - <tr> - <td class="entrytitle"> - Alias Address - </td> - <td> - <input type="text" name="postfix_alias_address" /> @ - <select name="postfix_transport_id"> -<?php - $sql = "SELECT ID, DomainName FROM ${DB_TABLE_PREFIX}transports WHERE Disabled = 0 ORDER BY DomainName"; - $res = $db->query($sql); - - while ($row = $res->fetchObject()) { -?> - <option value="<?php echo $row->id ?>"> - <?php echo $row->domainname ?> - </option> -<?php - } - $res->closeCursor(); -?> - </select> - </td> - </tr> - <tr> - <td class="entrytitle"> - Goto - <?php tooltip('postfix_alias_goto'); ?> - </td> - <td><input type="text" name="postfix_alias_goto" /></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">Postfix Alias Add Results</p> - -<?php - # Prepare statement - $stmt = $db->prepare("SELECT ID, DomainName, Type, Transport, Disabled FROM ${DB_TABLE_PREFIX}transports WHERE ID = ?"); - $res = $stmt->execute(array($_POST['postfix_transport_id'])); - $row = $stmt->fetchObject(); - - $mailbox = $_POST['postfix_alias_address'] . '@' . $row->domainname; - - - $stmt = $db->prepare("INSERT INTO ${DB_TABLE_PREFIX}aliases (TransportID,Address,MailAddress,Goto,Disabled) VALUES (?,?,?,?,0)"); - $res = $stmt->execute(array( - $row->id, - $_POST['postfix_alias_address'], - $mailbox, - $_POST['postfix_alias_goto'] - )); - - if ($res) { -?> - <div class="notice">Postfix alias created</div> -<?php - } else { -?> - <div class="warning">Failed to create Postfix alias</div> - <div class="warning"><?php print_r($stmt->errorInfo()) ?></div> -<?php - } - - - -} else { -?> - <div class="warning">Invalid invocation</div> -<?php -} - - -printFooter(); - - -# vim: ts=4 -?> diff --git a/webui/postfix-aliases-change.php b/webui/postfix-aliases-change.php deleted file mode 100644 index 2e35a004..00000000 --- a/webui/postfix-aliases-change.php +++ /dev/null @@ -1,156 +0,0 @@ -<?php -# Postfix alias 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_postfix_db(); - - - -printHeader(array( - "Tabs" => array( - "Back to Aliases" => "postfix-aliases-main.php" - ), -)); - - - -# Display change screen -if ($_POST['frmaction'] == "change") { - - # Check a alias was selected - if (isset($_POST['postfix_alias_id'])) { - # Prepare statement - $stmt = $db->prepare("SELECT ID, MailAddress, Goto, Disabled FROM ${DB_TABLE_PREFIX}aliases WHERE ID = ?"); -?> - <p class="pageheader">Update Postfix Alias</p> - - <form action="postfix-aliases-change.php" method="post"> - <div> - <input type="hidden" name="frmaction" value="change2" /> - <input type="hidden" name="postfix_alias_id" value="<?php echo $_POST['postfix_alias_id']; ?>" /> - </div> -<?php - - $res = $stmt->execute(array($_POST['postfix_alias_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">Alias Address</td> - <td class="oldval"><?php echo $row->mailaddress ?></td> - <td></td> - </tr> - <tr> - <td class="entrytitle"> - Goto - <?php tooltip('postfix_alias_goto'); ?> - </td> - <td class="oldval"><?php echo $row->goto ?></td> - <td><input type="text" name="postfix_alias_goto" /></td> - </tr> - <tr> - <td class="entrytitle">Disabled</td> - <td class="oldval"><?php echo $row->disabled ? 'yes' : 'no' ?></td> - <td> - <select name="postfix_alias_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 alias selected</div> -<?php - } - - - -# SQL Updates -} elseif ($_POST['frmaction'] == "change2") { -?> - <p class="pageheader">Policy Group Update Results</p> -<?php - $updates = array(); - - if (!empty($_POST['postfix_alias_goto'])) { - array_push($updates ,"Goto = ".$db->quote($_POST['postfix_alias_goto'])); - } - if (isset($_POST['postfix_alias_disabled']) && $_POST['postfix_alias_disabled'] != "") { - array_push($updates ,"Disabled = ".$db->quote($_POST['postfix_alias_disabled'])); - } - - # Check if we have updates - if (sizeof($updates) > 0) { - $updateStr = implode(', ',$updates); - - $res = $db->exec("UPDATE ${DB_TABLE_PREFIX}aliases SET $updateStr WHERE ID = ".$db->quote($_POST['postfix_alias_id'])); - if ($res) { -?> - <div class="notice">Postfix alias updated</div> -<?php - } else { -?> - <div class="warning">Error updating Postfix alias!</div> - <div class="warning"><?php print_r($db->errorInfo()) ?></div> -<?php - } - - } else { -?> - <div class="warning">No changes made to Postfix alias</div> -<?php - } - -} else { -?> - <div class="warning">Invalid invocation</div> -<?php -} - - -printFooter(); - - -# vim: ts=4 -?> diff --git a/webui/postfix-aliases-delete.php b/webui/postfix-aliases-delete.php deleted file mode 100644 index 887d10e4..00000000 --- a/webui/postfix-aliases-delete.php +++ /dev/null @@ -1,114 +0,0 @@ -<?php -# Postfix alias 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_postfix_db(); - - - -printHeader(array( - "Tabs" => array( - "Back to Aliases" => "postfix-aliases-main.php", - ), -)); - - - -# Display delete confirm screen -if ($_POST['frmaction'] == "delete") { - - # Check a Postfix alias was selected - if (isset($_POST['postfix_alias_id'])) { -?> - <p class="pageheader">Delete Postfix Alias</p> - - <form action="postfix-aliases-delete.php" method="post"> - <div> - <input type="hidden" name="frmaction" value="delete2" /> - <input type="hidden" name="postfix_alias_id" value="<?php echo $_POST['postfix_alias_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 Postfix alias selected</div> -<?php - } - - - -# SQL Updates -} elseif ($_POST['frmaction'] == "delete2") { -?> - <p class="pageheader">Postfix Alias Delete Results</p> -<?php - if (isset($_POST['postfix_alias_id'])) { - - if ($_POST['confirm'] == "yes") { - $res = $db->exec("DELETE FROM ${DB_TABLE_PREFIX}aliases WHERE ID = ".$db->quote($_POST['postfix_alias_id'])); - if ($res) { -?> - <div class="notice">Postfix alias deleted</div> -<?php - } else { -?> - <div class="warning">Error deleting Postfix alias!</div> - <div class="warning"><?php print_r($db->errorInfo()) ?></div> -<?php - } - } else { -?> - <div class="notice">Postfix alias not deleted, aborted by user</div> -<?php - } - - # Warn - } else { -?> - <div class="warning">Invocation error, no Postfix alias ID</div> -<?php - } - - - -} else { -?> - <div class="warning">Invalid invocation</div> -<?php -} - - -printFooter(); - - -# vim: ts=4 -?> - diff --git a/webui/postfix-aliases-main.php b/webui/postfix-aliases-main.php deleted file mode 100644 index 982986a8..00000000 --- a/webui/postfix-aliases-main.php +++ /dev/null @@ -1,100 +0,0 @@ -<?php -# Postfix aliases -# 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_postfix_db(); - - - -printHeader(array( -)); - -?> - <p class="pageheader">Postfix Aliases</p> - - <form id="main_form" action="postfix-aliases-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 = 'postfix-aliases-add.php'; - } else if (myobj.selectedIndex == 4) { - myform.action = 'postfix-aliases-change.php'; - } else if (myobj.selectedIndex == 5) { - myform.action = 'postfix-aliases-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">Alias</td> - <td class="textcenter">Destination</td> - <td class="textcenter">Disabled</td> - </tr> -<?php - $sql = "SELECT ID, MailAddress, Goto, Disabled FROM ${DB_TABLE_PREFIX}aliases ORDER BY MailAddress"; - $res = $db->query($sql); - - while ($row = $res->fetchObject()) { -?> - <tr class="resultsitem"> - <td><input type="radio" name="postfix_alias_id" value="<?php echo $row->id ?>" /></td> - <td><?php echo $row->mailaddress ?></td> - <td><?php echo $row->goto ?></td> - <td class="textcenter"><?php echo $row->disabled ? 'yes' : 'no' ?></td> - </tr> -<?php - } - $res->closeCursor(); -?> - </table> - </form> -<?php - - - -printFooter(); - -# vim: ts=4 -?> diff --git a/webui/postfix-distgroups-add.php b/webui/postfix-distgroups-add.php deleted file mode 100644 index 2e7f772d..00000000 --- a/webui/postfix-distgroups-add.php +++ /dev/null @@ -1,131 +0,0 @@ -<?php -# Postfix distribution 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_postfix_db(); - - - -printHeader(array( - "Tabs" => array( - "Back to groups" => "postfix-distgroups-main.php", - ), -)); - - -if ($_POST['frmaction'] == "add") { -?> - <p class="pageheader">Add Distribution Group</p> -<?php -?> - <form method="post" action="postfix-distgroups-add.php"> - <div> - <input type="hidden" name="frmaction" value="add2" /> - <input type="hidden" name="postfix_group_id" value="<?php echo $_POST['postfix_group_id'] ?>" /> - </div> - <table class="entry"> - <tr> - <td class="entrytitle">Mail Address</td> - <td> - <input type="text" name="postfix_group_address" /> @ - <select name="postfix_transport_id"> -<?php - $sql = "SELECT ID, DomainName FROM ${DB_TABLE_PREFIX}transports WHERE Disabled = 0 ORDER BY DomainName"; - $res = $db->query($sql); - - while ($row = $res->fetchObject()) { -?> - <option value="<?php echo $row->id ?>"> - <?php echo $row->domainname ?> - </option> -<?php - } - $res->closeCursor(); -?> - </select> - </td> - </tr> - <tr> - <td class="entrytitle">Comment</td> - <td><textarea name="postfix_group_comment"></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">Distribution Group Add Results</p> - -<?php - # Prepare statement - $stmt = $db->prepare("SELECT ID, DomainName, Type, Transport, Disabled FROM ${DB_TABLE_PREFIX}transports WHERE ID = ?"); - $res = $stmt->execute(array($_POST['postfix_transport_id'])); - $row = $stmt->fetchObject(); - - $mailbox = $_POST['postfix_group_address'] . '@' . $row->domainname; - - - $stmt = $db->prepare("INSERT INTO ${DB_TABLE_PREFIX}distribution_groups (TransportID,Address,MailAddress,Comment,Disabled) VALUES (?,?,?,?,0)"); - - $res = $stmt->execute(array( - $row->id, - $_POST['postfix_group_address'], - $mailbox, - $_POST['postfix_group_comment'] - )); - - if ($res) { -?> - <div class="notice">Distribution group created</div> -<?php - } else { -?> - <div class="warning">Failed to create distribution group</div> - <div class="warning"><?php print_r($stmt->errorInfo()) ?></div> -<?php - } - - - -} else { -?> - <div class="warning">Invalid invocation</div> -<?php -} - - -printFooter(); - - -# vim: ts=4 -?> diff --git a/webui/postfix-distgroups-change.php b/webui/postfix-distgroups-change.php deleted file mode 100644 index 5900010d..00000000 --- a/webui/postfix-distgroups-change.php +++ /dev/null @@ -1,151 +0,0 @@ -<?php -# Postfixdistribution group 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"); - - - -$db = connect_postfix_db(); - - - -printHeader(array( - "Tabs" => array( - "Back to groups" => "postfix-distgroups-main.php" - ), -)); - - - -# Display change screen -if ($_POST['frmaction'] == "change") { - - # Check a group was selected - if (isset($_POST['postfix_group_id'])) { - # Prepare statement - $stmt = $db->prepare("SELECT ID, MailAddress, Comment, Disabled FROM ${DB_TABLE_PREFIX}distribution_groups WHERE ID = ?"); -?> - <p class="pageheader">Update Distribution Group</p> - - <form action="postfix-distgroups-change.php" method="post"> - <div> - <input type="hidden" name="frmaction" value="change2" /> - <input type="hidden" name="postfix_group_id" value="<?php echo $_POST['postfix_group_id']; ?>" /> - </div> -<?php - - $res = $stmt->execute(array($_POST['postfix_group_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">Mail Address</td> - <td class="oldval"><?php echo $row->mailaddress ?></td> - <td></td> - </tr> - <tr> - <td class="entrytitle texttop">Comment</td> - <td class="oldval texttop"><?php echo $row->comment ?></td> - <td><textarea name="postfix_group_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="postfix_group_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 distribution group selected</div> -<?php - } - - - -# SQL Updates -} elseif ($_POST['frmaction'] == "change2") { -?> - <p class="pageheader">Distribution Group Update Results</p> -<?php - $updates = array(); - - if (!empty($_POST['postfix_group_comment'])) { - array_push($updates,"Comment = ".$db->quote($_POST['postfix_group_comment'])); - } - if (isset($_POST['postfix_group_disabled']) && $_POST['postfix_group_disabled'] != "") { - array_push($updates ,"Disabled = ".$db->quote($_POST['postfix_group_disabled'])); - } - - # Check if we have updates - if (sizeof($updates) > 0) { - $updateStr = implode(', ',$updates); - - $res = $db->exec("UPDATE ${DB_TABLE_PREFIX}distribution_groups SET $updateStr WHERE ID = ".$db->quote($_POST['postfix_group_id'])); - if ($res) { -?> - <div class="notice">Distribution group updated</div> -<?php - } else { -?> - <div class="warning">Error updating distribution group!</div> - <div class="warning"><?php print_r($db->errorInfo()) ?></div> -<?php - } - - } else { -?> - <div class="warning">No changes made to distribution group</div> -<?php - } - -} else { -?> - <div class="warning">Invalid invocation</div> -<?php -} - - -printFooter(); - - -# vim: ts=4 -?> diff --git a/webui/postfix-distgroups-delete.php b/webui/postfix-distgroups-delete.php deleted file mode 100644 index c34130ac..00000000 --- a/webui/postfix-distgroups-delete.php +++ /dev/null @@ -1,135 +0,0 @@ -<?php -# Distribution 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. - - - -include_once("includes/header.php"); -include_once("includes/footer.php"); -include_once("includes/db.php"); - - - -$db = connect_postfix_db(); - - - -printHeader(array( - "Tabs" => array( - "Back to groups" => "postfix-distgroups-main.php", - ), -)); - - - -# Display delete confirm screen -if ($_POST['frmaction'] == "delete") { - - # Check a postfix group was selected - if (isset($_POST['postfix_group_id'])) { -?> - <p class="pageheader">Delete Distribution Group</p> - - <form action="postfix-distgroups-delete.php" method="post"> - <div> - <input type="hidden" name="frmaction" value="delete2" /> - <input type="hidden" name="postfix_group_id" value="<?php echo $_POST['postfix_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 distribution group selected</div> -<?php - } - - - -# SQL Updates -} elseif ($_POST['frmaction'] == "delete2") { -?> - <p class="pageheader">Distribution Group Delete Results</p> -<?php - if (isset($_POST['postfix_group_id'])) { - - if ($_POST['confirm'] == "yes") { - - $res = $db->exec(" - DELETE FROM - ${DB_TABLE_PREFIX}distribution_group_members - WHERE - DistributionGroupID = ".$db->quote($_POST['postfix_group_id']) - ); - if ($res !== FALSE) { -?> - <div class="notice">Distribution group members deleted</div> -<?php - } else { -?> - <div class="warning">Error deleting distribution group members!</div> - <div class="warning"><?php print_r($db->errorInfo()) ?></div> -<?php - $db->rollback(); - } - - if ($res !== FALSE) { - $res = $db->exec("DELETE FROM ${DB_TABLE_PREFIX}distribution_groups WHERE ID = ".$db->quote($_POST['postfix_group_id'])); - if ($res) { -?> - <div class="notice">Distribution group deleted</div> -<?php - } else { -?> - <div class="warning">Error deleting distribution group!</div> - <div class="warning"><?php print_r($db->errorInfo()) ?></div> -<?php - } - } - } else { -?> - <div class="notice">Distribution group not deleted, aborted by user</div> -<?php - } - - # Warn - } else { -?> - <div class="warning">Invocation error, no distribution group ID</div> -<?php - } - - - -} else { -?> - <div class="warning">Invalid invocation</div> -<?php -} - - -printFooter(); - - -# vim: ts=4 -?> - diff --git a/webui/postfix-distgroups-main.php b/webui/postfix-distgroups-main.php deleted file mode 100644 index b343d458..00000000 --- a/webui/postfix-distgroups-main.php +++ /dev/null @@ -1,101 +0,0 @@ -<?php -# Postfix distribution 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_postfix_db(); - - - -printHeader(array( -)); - -?> - <p class="pageheader">Distribution Groups</p> - - <form id="main_form" action="postfix-distgroups-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 = 'postfix-distgroups-add.php'; - } else if (myobj.selectedIndex == 4) { - myform.action = 'postfix-distgroups-change.php'; - } else if (myobj.selectedIndex == 5) { - myform.action = 'postfix-distgroups-delete.php'; - } else if (myobj.selectedIndex == 6) { - myform.action = 'postfix-distgroups-member-main.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> - <option value="members">Members</option> - </select> - </div> - - <p /> - - <table class="results" style="width: 75%;"> - <tr class="resultstitle"> - <td id="noborder"></td> - <td class="textcenter">Mail Address</td> - <td class="textcenter">Disabled</td> - </tr> -<?php - $sql = "SELECT ID, MailAddress, Disabled FROM ${DB_TABLE_PREFIX}distribution_groups ORDER BY MailAddress"; - $res = $db->query($sql); - - while ($row = $res->fetchObject()) { -?> - <tr class="resultsitem"> - <td><input type="radio" name="postfix_group_id" value="<?php echo $row->id ?>" /></td> - <td><?php echo $row->mailaddress ?></td> - <td class="textcenter"><?php echo $row->disabled ? 'yes' : 'no' ?></td> - </tr> -<?php - } - $res->closeCursor(); -?> - </table> - </form> -<?php - - - -printFooter(); - -# vim: ts=4 -?> diff --git a/webui/postfix-distgroups-member-add.php b/webui/postfix-distgroups-member-add.php deleted file mode 100644 index 1811b98c..00000000 --- a/webui/postfix-distgroups-member-add.php +++ /dev/null @@ -1,102 +0,0 @@ -<?php -# Postfix distribution group member 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_postfix_db(); - - - -printHeader(array( - "Tabs" => array( - "Back to groups" => "postfix-distgroups-main.php", - "Back to members" => "postfix-distgroups-member-main.php?postfix_group_id=".$_POST['postfix_group_id'], - ), -)); - - -if ($_POST['frmaction'] == "add") { -?> - <p class="pageheader">Add Distribution Group Member</p> -<?php -?> - <form method="post" action="postfix-distgroups-member-add.php"> - <div> - <input type="hidden" name="frmaction" value="add2" /> - <input type="hidden" name="postfix_group_id" value="<?php echo $_POST['postfix_group_id'] ?>" /> - </div> - <table class="entry"> - <tr> - <td class="entrytitle">Email Address</td> - <td><input type="text" name="postfix_group_member_goto" /></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">Distribution Group Member Add Results</p> - -<?php - - $stmt = $db->prepare("INSERT INTO ${DB_TABLE_PREFIX}distribution_group_members (DistributionGroupID,Goto,Disabled) VALUES (?,?,0)"); - - $res = $stmt->execute(array( - $_POST['postfix_group_id'], - $_POST['postfix_group_member_goto'] - )); - - - if ($res) { -?> - <div class="notice">Distribution group member created</div> -<?php - } else { -?> - <div class="warning">Failed to create distribution group member</div> -<?php - } - - - -} else { -?> - <div class="warning">Invalid invocation</div> -<?php -} - - -printFooter(); - - -# vim: ts=4 -?> diff --git a/webui/postfix-distgroups-member-change.php b/webui/postfix-distgroups-member-change.php deleted file mode 100644 index a2d8569a..00000000 --- a/webui/postfix-distgroups-member-change.php +++ /dev/null @@ -1,147 +0,0 @@ -<?php -# Postfix distribution group 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"); - - - -$db = connect_postfix_db(); - - - -printHeader(array( - "Tabs" => array( - "Back to groups" => "postfix-distgroups-main.php", - "Back to members" => "postfix-distgroups-member-main.php?postfix_group_id=".$_POST['postfix_group_id'], - ), -)); - - - -# Display change screen -if ($_POST['frmaction'] == "change") { - - # Check a postfix was selected - if (isset($_POST['postfix_group_member_id'])) { - # Prepare statement - $stmt = $db->prepare("SELECT ID, Goto, Disabled FROM ${DB_TABLE_PREFIX}distribution_group_members WHERE ID = ?"); -?> - <p class="pageheader">Update Distribution Group Member</p> - - <form action="postfix-distgroups-member-change.php" method="post"> - <div> - <input type="hidden" name="frmaction" value="change2" /> - <input type="hidden" name="postfix_group_id" value="<?php echo $_POST['postfix_group_id']; ?>" /> - <input type="hidden" name="postfix_group_member_id" value="<?php echo $_POST['postfix_group_member_id']; ?>" /> - </div> -<?php - - $res = $stmt->execute(array($_POST['postfix_group_member_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">Email Address</td> - <td class="oldval"><?php echo $row->goto ?></td> - <td><input type="text" name="postfix_group_member_goto" /></td> - </tr> - <tr> - <td class="entrytitle">Disabled</td> - <td class="oldval"><?php echo $row->disabled ? 'yes' : 'no' ?></td> - <td> - <select name="postfix_group_member_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 distribution group selected</div> -<?php - } - - - -# SQL Updates -} elseif ($_POST['frmaction'] == "change2") { -?> - <p class="pageheader">Distribution Group Member Update Results</p> -<?php - $updates = array(); - - if (!empty($_POST['postfix_group_member_goto'])) { - array_push($updates,"Goto = ".$db->quote($_POST['postfix_group_member_goto'])); - } - if (isset($_POST['postfix_group_member_disabled']) && $_POST['postfix_group_member_disabled'] != "") { - array_push($updates ,"Disabled = ".$db->quote($_POST['postfix_group_member_disabled'])); - } - - # Check if we have updates - if (sizeof($updates) > 0) { - $updateStr = implode(', ',$updates); - - $res = $db->exec("UPDATE ${DB_TABLE_PREFIX}distribution_group_members SET $updateStr WHERE ID = ".$db->quote($_POST['postfix_group_member_id'])); - if ($res) { -?> - <div class="notice">Distribution group member updated</div> -<?php - } else { -?> - <div class="warning">Error updating distribution group member!</div> -<?php - } - - } else { -?> - <div class="warning">No changes made to distribution group member</div> -<?php - } - -} else { -?> - <div class="warning">Invalid invocation</div> -<?php -} - - -printFooter(); - - -# vim: ts=4 -?> diff --git a/webui/postfix-distgroups-member-delete.php b/webui/postfix-distgroups-member-delete.php deleted file mode 100644 index cbb624a0..00000000 --- a/webui/postfix-distgroups-member-delete.php +++ /dev/null @@ -1,116 +0,0 @@ -<?php -# Postfix distribution group member 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_postfix_db(); - - - -printHeader(array( - "Tabs" => array( - "Back to groups" => "postfix-group-main.php", - "Back to members" => "postfix-distgroups-member-main.php?postfix_group_id=".$_POST['postfix_group_id'], - ), -)); - - - -# Display delete confirm screen -if ($_POST['frmaction'] == "delete") { - - # Check a postfix group member was selected - if (isset($_POST['postfix_group_member_id'])) { -?> - <p class="pageheader">Delete Distribution Group Member</p> - - <form action="postfix-distgroups-member-delete.php" method="post"> - <div> - <input type="hidden" name="frmaction" value="delete2" /> - <input type="hidden" name="postfix_group_id" value="<?php echo $_POST['postfix_group_id']; ?>" /> - <input type="hidden" name="postfix_group_member_id" value="<?php echo $_POST['postfix_group_member_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 distribution group member selected</div> -<?php - } - - - -# SQL Updates -} elseif ($_POST['frmaction'] == "delete2") { -?> - <p class="pageheader">Distribution Group Member Delete Results</p> -<?php - if (isset($_POST['postfix_group_member_id'])) { - - if ($_POST['confirm'] == "yes") { - $res = $db->exec("DELETE FROM ${DB_TABLE_PREFIX}distribution_group_members WHERE ID = ".$db->quote($_POST['postfix_group_member_id'])); - - if ($res) { -?> - <div class="notice">Distribution group member deleted</div> -<?php - } else { -?> - <div class="warning">Error deleting distribution group member!</div> - <div class="warning"><?php print_r($db->errorInfo()) ?></div> -<?php - } - } else { -?> - <div class="notice">Distribution group member not deleted, aborted by user</div> -<?php - } - - # Warn - } else { -?> - <div class="warning">Invocation error, no distribution group member ID</div> -<?php - } - - - -} else { -?> - <div class="warning">Invalid invocation</div> -<?php -} - - -printFooter(); - - -# vim: ts=4 -?> - diff --git a/webui/postfix-distgroups-member-main.php b/webui/postfix-distgroups-member-main.php deleted file mode 100644 index e93a50d6..00000000 --- a/webui/postfix-distgroups-member-main.php +++ /dev/null @@ -1,131 +0,0 @@ -<?php -# Distribution group member 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_postfix_db(); - - - -printHeader(array( - "Tabs" => array( - "Back to groups" => "postfix-distgroups-main.php" - ), -)); - - -# Check a postfix group was selected -if (isset($_REQUEST['postfix_group_id'])) { - -?> - <p class="pageheader">Distribution Group Members</p> - -<?php - - $postfix_group_stmt = $db->prepare("SELECT MailAddress FROM ${DB_TABLE_PREFIX}distribution_groups WHERE ID = ?"); - $postfix_group_stmt->execute(array($_REQUEST['postfix_group_id'])); - $row = $postfix_group_stmt->fetchObject(); - $postfix_group_stmt->closeCursor(); -?> - <form id="main_form" action="postfix-distgroups-member-main.php" method="post"> - <div> - <input type="hidden" name="postfix_group_id" value="<?php echo $_REQUEST['postfix_group_id'] ?>" /> - </div> - <div class="textcenter"> - <div class="notice">Distribution Group: <?php echo $row->mailaddress ?></div> - - 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 = 'postfix-distgroups-member-add.php'; - myform.submit(); - } else if (myobj.selectedIndex == 4) { - myform.action = 'postfix-distgroups-member-change.php'; - myform.submit(); - } else if (myobj.selectedIndex == 5) { - myform.action = 'postfix-distgroups-member-delete.php'; - myform.submit(); - } -"> - - <option 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">Goto</td> - <td class="textcenter">Disabled</td> - </tr> -<?php - - $stmt = $db->prepare(" - SELECT - ID, Goto, Disabled - FROM - ${DB_TABLE_PREFIX}distribution_group_members - WHERE - DistributionGroupID = ? ORDER BY Goto - "); - $res = $stmt->execute(array($_REQUEST['postfix_group_id'])); - - $i = 0; - - # Loop with rows - while ($row = $stmt->fetchObject()) { -?> - <tr class="resultsitem"> - <td><input type="radio" name="postfix_group_member_id" value="<?php echo $row->id ?>" /></td> - <td class="textcenter"><?php echo $row->goto ?></td> - <td class="textcenter"><?php echo $row->disabled ? 'yes' : 'no' ?></td> - </tr> -<?php - } - $stmt->closeCursor(); -?> - </table> - </form> -<?php -} else { -?> - <div class="warning">Invalid invocation</div> -<?php -} - - -printFooter(); - - -# vim: ts=4 -?> diff --git a/webui/postfix-mailboxes-add.php b/webui/postfix-mailboxes-add.php deleted file mode 100644 index 48a15fc9..00000000 --- a/webui/postfix-mailboxes-add.php +++ /dev/null @@ -1,165 +0,0 @@ -<?php -# Postfix mailbox 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_postfix_db(); - - - -printHeader(array( - "Tabs" => array( - "Back to Mailboxes" => "postfix-mailboxes-main.php", - ), -)); - - -if ($_POST['frmaction'] == "add") { -?> - <p class="pageheader">Add Mailbox</p> -<?php -?> - <form method="post" action="postfix-mailboxes-add.php"> - <div> - <input type="hidden" name="frmaction" value="add2" /> - </div> - <table class="entry"> - <tr> - <td class="entrytitle">Email Address</td> - <td> - <input type="text" size="8" name="postfix_mailbox_address" /> @ - <select name="postfix_transport_id"> -<?php - $sql = "SELECT ID, DomainName FROM ${DB_TABLE_PREFIX}transports WHERE Disabled = 0 ORDER BY DomainName"; - $res = $db->query($sql); - - while ($row = $res->fetchObject()) { -?> - <option value="<?php echo $row->id ?>"> - <?php echo $row->domainname ?> - </option> -<?php - } - $res->closeCursor(); -?> - </select> - </td> - </tr> - <tr> - <td class="entrytitle">Name</td> - <td><input type="text" name="postfix_mailbox_name" id="postfix_mailbox_name" /></td> - </tr> - <tr> - <td class="entrytitle">Password</td> - <td><input type="text" name="postfix_mailbox_password" id="postfix_mailbox_password" /></td> - </tr> - <tr> - <td class="entrytitle"> - Quota (in Mbyte) - <?php tooltip('postfix_mailbox_quota'); ?> - </td> - <td><input type="text" name="postfix_mailbox_quota" size="5" id="postfix_mailbox_quota" /> (0 = unlimited)</td> - </tr> - <tr> - <td class="entrytitle"> - BCC - <?php tooltip('postfix_mailbox_bcc'); ?> - </td> - <td><input type="text" name="postfix_mailbox_bcc" id="postfix_mailbox_bcc" /></td> - </tr> - <tr> - <td class="entrytitle">Comment</td> - <td><textarea name="postfix_mailbox_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">Mailbox Add Results</p> - -<?php - # Prepare statement - $stmt = $db->prepare("SELECT ID, DomainName, Type, Transport, Disabled FROM ${DB_TABLE_PREFIX}transports WHERE ID = ?"); - $res = $stmt->execute(array($_POST['postfix_transport_id'])); - $row = $stmt->fetchObject(); - - $mailbox = $_POST['postfix_mailbox_address'] . '@' . $row->domainname; - - $stmt = $db->prepare(" - INSERT INTO ${DB_TABLE_PREFIX}mailboxes - (TransportID,Address,Mailbox,Password,Quota,Name,BCC,Comment,Disabled) - VALUES - (?,?,?,?,?,?,?,?,0) - "); - - # Encrypt password - $password = "{MD5}".base64_encode(pack("H*", md5($_POST['postfix_mailbox_password']))); - - $res = $stmt->execute(array( - $_POST['postfix_transport_id'], - $_POST['postfix_mailbox_address'], - $mailbox, - $password, - $_POST['postfix_mailbox_quota'], - $_POST['postfix_mailbox_name'], - $_POST['postfix_mailbox_bcc'], - $_POST['postfix_mailbox_comment'], - )); - - - if ($res) { -?> - <div class="notice">Mailbox created</div> -<?php - } else { -?> - <div class="warning">Failed to create mailbox</div> - <div class="warning"><?php print_r($stmt->errorInfo()) ?></div> -<?php - } - - - -} else { -?> - <div class="warning">Invalid invocation</div> -<?php -} - - -printFooter(); - - -# vim: ts=4 -?> diff --git a/webui/postfix-mailboxes-change.php b/webui/postfix-mailboxes-change.php deleted file mode 100644 index 4773083e..00000000 --- a/webui/postfix-mailboxes-change.php +++ /dev/null @@ -1,216 +0,0 @@ -<?php -# Postfix mailbox 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_postfix_db(); - - - -printHeader(array( - "Tabs" => array( - "Back to Mailboxes" => "postfix-mailboxes-main.php" - ), -)); - - - -# Display change screen -if ($_POST['frmaction'] == "change") { - - # Check a mailbox was selected - if (isset($_POST['postfix_mailbox_id'])) { - # Prepare statement - $stmt = $db->prepare(" - SELECT - ID, - Mailbox, - Quota, - Name, - BCC, - Comment, - Disabled - FROM - ${DB_TABLE_PREFIX}mailboxes - WHERE - ID = ? - "); -?> - <p class="pageheader">Update Mailbox</p> - - <form action="postfix-mailboxes-change.php" method="post"> - <div> - <input type="hidden" name="frmaction" value="change2" /> - <input type="hidden" name="postfix_mailbox_id" value="<?php echo $_POST['postfix_mailbox_id']; ?>" /> - </div> -<?php - - $res = $stmt->execute(array($_POST['postfix_mailbox_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">Mailbox</td> - <td class="oldval"><?php echo $row->mailbox ?></td> - <td></td> - </tr> - <tr> - <td class="entrytitle">Name</td> - <td class="oldval"><?php echo $row->name ?></td> - <td><input type="text" name="postfix_mailbox_name" /></td> - </tr> - <tr> - <td class="entrytitle">Password</td> - <td class="oldval">*encrypted*</td> - <td><input type="text" name="postfix_mailbox_password" /></td> - </tr> - <tr> - <td class="entrytitle"> - Quota (in Mbyte) - <?php tooltip('postfix_mailbox_quota'); ?> - </td> - <td class="oldval"><?php echo $row->quota ?></td> - <td><input type="text" name="postfix_mailbox_quota" /> (0 = unlimited)</td> - </tr> - <tr> - <td class="entrytitle"> - BCC - <?php tooltip('postfix_mailbox_bcc'); ?> - </td> - <td class="oldval"><?php echo $row->bcc ?></td> - <td><input type="text" name="postfix_mailbox_bcc" /></td> - </tr> - <tr> - <td class="entrytitle texttop">Comment</td> - <td class="oldval texttop"><?php echo $row->comment ?></td> - <td><textarea name="postfix_mailbox_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="postfix_mailbox_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 mailbox selected</div> -<?php - } - - - -# SQL Updates -} elseif ($_POST['frmaction'] == "change2") { -?> - <p class="pageheader">Mailbox Update Results</p> -<?php - $updates = array(); - - if (!empty($_POST['postfix_mailbox_name'])) { - array_push($updates,"Name = ".$db->quote($_POST['postfix_mailbox_name'])); - } - - if (!empty($_POST['postfix_mailbox_password'])) { - # Encrypt password - $password = "{MD5}".base64_encode(pack("H*", md5($_POST['postfix_mailbox_password']))); - - array_push($updates,"Password = ".$db->quote($password)); - } - - if (isset($_POST['postfix_mailbox_quota'])) { - if (!empty($_POST['postfix_mailbox_quota'])) { - $quota = $db->quote($_POST['postfix_mailbox_quota']); - array_push($updates,"Quota = ".$quota); - } - } - - if (!empty($_POST['postfix_mailbox_bcc'])) { - array_push($updates,"BCC = ".$db->quote($_POST['postfix_mailbox_bcc'])); - } - - if (!empty($_POST['postfix_mailbox_comment'])) { - array_push($updates,"Comment = ".$db->quote($_POST['postfix_mailbox_comment'])); - } - - if (isset($_POST['postfix_mailbox_disabled']) && $_POST['postfix_mailbox_disabled'] != "") { - array_push($updates,"Disabled = ".$db->quote($_POST['postfix_mailbox_disabled'])); - } - - - # Check if we have updates - if (sizeof($updates) > 0) { - $updateStr = implode(', ',$updates); - - $res = $db->exec("UPDATE ${DB_TABLE_PREFIX}mailboxes SET $updateStr WHERE ID = ".$db->quote($_POST['postfix_mailbox_id'])); - if ($res) { -?> - <div class="notice">Mailbox updated</div> -<?php - } else { -?> - <div class="warning">Error updating mailbox!</div> - <div class="warning"><?php print_r($db->errorInfo()) ?></div> -<?php - } - - } else { -?> - <div class="warning">No changes made to Postfix mailbox</div> -<?php - } - -} else { -?> - <div class="warning">Invalid invocation</div> -<?php -} - - -printFooter(); - - -# vim: ts=4 -?> diff --git a/webui/postfix-mailboxes-delete.php b/webui/postfix-mailboxes-delete.php deleted file mode 100644 index 6e010821..00000000 --- a/webui/postfix-mailboxes-delete.php +++ /dev/null @@ -1,159 +0,0 @@ -<?php -# Postfix mailbox 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_postfix_db(); - - - -printHeader(array( - "Tabs" => array( - "Back to Mailboxes" => "postfix-mailboxes-main.php", - ), -)); - - - -# Display delete confirm screen -if ($_POST['frmaction'] == "delete") { - - # Check a Postfix mailbox was selected - if (isset($_POST['postfix_mailbox_id'])) { -?> - <p class="pageheader">Delete Mailbox</p> - - <form action="postfix-mailboxes-delete.php" method="post"> - <div> - <input type="hidden" name="frmaction" value="delete2" /> - <input type="hidden" name="postfix_mailbox_id" value="<?php echo $_POST['postfix_mailbox_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 mailbox selected</div> -<?php - } - - - -# SQL Updates -} elseif ($_POST['frmaction'] == "delete2") { -?> - <p class="pageheader">Mailbox Delete Results</p> -<?php - if (isset($_POST['postfix_mailbox_id'])) { - - if ($_POST['confirm'] == "yes") { - # Grab tracking limits we must delete for - $res = $db->query(" - SELECT - Mailbox - FROM - ${DB_TABLE_PREFIX}mailboxes - WHERE - ID = ".$db->quote($_POST['postfix_mailbox_id'])." - "); - - if ($res !== FALSE) { - # Pull in limit ID's - $row = $res->fetchObject(); - $res->closeCursor(); - $mailbox = $row->mailbox; - } else { -?> - <div class="warning">Error selecting mailbox!</div> - <div class="warning"><?php print_r($db->errorInfo()) ?></div> -<?php - } - - $db->beginTransaction(); - - $res = $db->exec("DELETE FROM ${DB_TABLE_PREFIX}distribution_group_members WHERE Goto = ".$db->quote($mailbox)); - if ($res !== FALSE) { -?> - <div class="notice">Mailbox removed from distribution groups</div> -<?php - } else { -?> - <div class="warning">Error removing mailbox from distribution groups!</div> - <div class="warning"><?php print_r($db->errorInfo()) ?></div> -<?php - $db->rollBack(); - } - - if ($res !== FALSE) { - $res = $db->exec("DELETE FROM ${DB_TABLE_PREFIX}mailboxes WHERE ID = ".$db->quote($_POST['postfix_mailbox_id'])); - if ($res) { -?> - <div class="notice">Mailbox deleted</div> -<?php - } else { -?> - <div class="warning">Error deleting mailbox!</div> - <div class="warning"><?php print_r($db->errorInfo()) ?></div> -<?php - $db->rollBack(); - } - } - - if ($res) { - $db->commit(); - } - - } else { -?> - <div class="notice">Mailbox not deleted, aborted by user</div> -<?php - } - - # Warn - } else { -?> - <div class="warning">Invocation error, no mailbox ID</div> -<?php - } - - - -} else { -?> - <div class="warning">Invalid invocation</div> -<?php -} - - -printFooter(); - - -# vim: ts=4 -?> - diff --git a/webui/postfix-mailboxes-main.php b/webui/postfix-mailboxes-main.php deleted file mode 100644 index bb67e028..00000000 --- a/webui/postfix-mailboxes-main.php +++ /dev/null @@ -1,101 +0,0 @@ -<?php -# Postfix mailboxes -# 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_postfix_db(); - - - -printHeader(array( -)); - -?> - <p class="pageheader">Mailboxes</p> - - <form id="main_form" action="postfix-mailboxes-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 = 'postfix-mailboxes-add.php'; - } else if (myobj.selectedIndex == 4) { - myform.action = 'postfix-mailboxes-change.php'; - } else if (myobj.selectedIndex == 5) { - myform.action = 'postfix-mailboxes-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">Mailbox</td> - <td class="textcenter">Quota</td> - <td class="textcenter">Name</td> - <td class="textcenter">Disabled</td> - </tr> -<?php - $sql = "SELECT ID, Mailbox, Quota, Name, Disabled FROM ${DB_TABLE_PREFIX}mailboxes ORDER BY Mailbox"; - $res = $db->query($sql); - - while ($row = $res->fetchObject()) { -?> - <tr class="resultsitem"> - <td><input type="radio" name="postfix_mailbox_id" value="<?php echo $row->id ?>" /></td> - <td><?php echo $row->mailbox ?></td> - <td><?php echo $row->quota ?></td> - <td><?php echo $row->name ?></td> - <td class="textcenter"><?php echo $row->disabled ? 'yes' : 'no' ?></td> - </tr> -<?php - } -?> - </table> - </form> -<?php - - - -printFooter(); - -# vim: ts=4 -?> diff --git a/webui/postfix-transports-add.php b/webui/postfix-transports-add.php deleted file mode 100644 index c8c54f62..00000000 --- a/webui/postfix-transports-add.php +++ /dev/null @@ -1,141 +0,0 @@ -<?php -# Postfix transport 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_postfix_db(); - - - -printHeader(array( - "Tabs" => array( - "Back to Transports" => "postfix-transports-main.php", - ), -)); - - -if ($_POST['frmaction'] == "add") { -?> - <p class="pageheader">Add Postfix Transport</p> -<?php -?> - <form method="post" action="postfix-transports-add.php"> - <div> - <input type="hidden" name="frmaction" value="add2" /> - </div> - <table class="entry"> - <tr> - <td class="entrytitle">Domain Name</td> - <td><input type="text" name="postfix_transport_domainname" /></td> - </tr> - <tr> - <td class="entrytitle"> - Type - <?php tooltip('postfix_transport_type'); ?> - </td> - <td> - <select name="postfix_transport_type" id="postfix_transport_type" - onchange=" - var myobjs = document.getElementById('postfix_transport_type'); - var myobji = document.getElementById('postfix_transport_data'); - - if (myobjs.selectedIndex == 0) { - myobji.disabled = true; - myobji.value = 'n/a'; - } else if (myobjs.selectedIndex != 0) { - myobji.disabled = false; - myobji.value = 'server hostname here'; - } - "> - <option value="0">Virtual</option> - <option value="1">SMTP</option> - </select> - </td> - </tr> - <tr> - <td class="entrytitle">Data</td> - <td><input type="text" name="postfix_transport_data" id="postfix_transport_data" disabled="disabled" value="n/a" /></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">Postfix Transport Add Results</p> - -<?php - - $stmt = $db->prepare("INSERT INTO ${DB_TABLE_PREFIX}transports (DomainName,Type,Transport,PTransport,Disabled) VALUES (?,?,?,?,0)"); - - # virtual - if ($_POST['postfix_transport_type'] == "0") { - $transport = $_POST['postfix_transport_domainname']; - $ptransport = "virtual:$transport"; - - # smtp - } elseif ($_POST['postfix_transport_type'] == "1") { - $transport = $_POST['postfix_transport_data']; - $ptransport = "smtp:$transport"; - } - - $res = $stmt->execute(array( - $_POST['postfix_transport_domainname'], - $_POST['postfix_transport_type'], - $transport, - $ptransport - )); - if ($res) { -?> - <div class="notice">Postfix transport created</div> -<?php - } else { -?> - <div class="warning">Failed to create Postfix transport</div> - <div class="warning"><?php print_r($stmt->errorInfo()) ?></div> -<?php - } - - - -} else { -?> - <div class="warning">Invalid invocation</div> -<?php -} - - -printFooter(); - - -# vim: ts=4 -?> diff --git a/webui/postfix-transports-change.php b/webui/postfix-transports-change.php deleted file mode 100644 index 9da3f09d..00000000 --- a/webui/postfix-transports-change.php +++ /dev/null @@ -1,186 +0,0 @@ -<?php -# Postfix transport 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_postfix_db(); - - - -printHeader(array( - "Tabs" => array( - "Back to Transports" => "postfix-transports-main.php" - ), -)); - - - -# Display change screen -if ($_POST['frmaction'] == "change") { - - # Check a transport was selected - if (isset($_POST['postfix_transport_id'])) { - # Prepare statement - $stmt = $db->prepare("SELECT ID, DomainName, Type, Transport, Disabled FROM ${DB_TABLE_PREFIX}transports WHERE ID = ?"); -?> - <p class="pageheader">Update Postfix Transport</p> - - <form action="postfix-transports-change.php" method="post"> - <div> - <input type="hidden" name="frmaction" value="change2" /> - <input type="hidden" name="postfix_transport_id" value="<?php echo $_POST['postfix_transport_id']; ?>" /> - </div> -<?php - - $res = $stmt->execute(array($_POST['postfix_transport_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">Domain Name</td> - <td class="oldval"><?php echo $row->domainname ?></td> - <td></td> - </tr> - <tr> - <td class="entrytitle"> - Type - <?php tooltip('postfix_transport_type'); ?> - </td> - <td class="oldval"><?php - # Translate type - if ($row->type == "0") { - echo "Virtual"; - } elseif ($row->type == "1") { - echo "SMTP"; - } - ?></td> - <td></td> - </tr> - <tr> - <td class="entrytitle">Data</td> - <td class="oldval"><?php echo $row->transport ?></td> -<?php - if ($row->type == "1") { -?> - <td><input type="text" name="postfix_transport_data" /></td> -<?php - } else { -?> - <td></td> -<?php - } -?> - </tr> - <tr> - <td class="entrytitle">Disabled</td> - <td class="oldval"><?php echo $row->disabled ? 'yes' : 'no' ?></td> - <td> - <select name="postfix_transport_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 policy selected</div> -<?php - } - - - -# SQL Updates -} elseif ($_POST['frmaction'] == "change2") { -?> - <p class="pageheader">Policy Group Update Results</p> -<?php - $updates = array(); - - if (!empty($_POST['postfix_transport_type'])) { - array_push($updates,"Type = ".$db->quote($_POST['postfix_transport_type'])); - } - - if (!empty($_POST['postfix_transport_data'])) { - # smtp - $transport = $_POST['postfix_transport_data']; - $ptransport = "smtp:$transport"; - array_push($updates ,"Transport = ".$db->quote($transport)); - array_push($updates ,"PTransport = ".$db->quote($ptransport)); - } - - if (isset($_POST['postfix_transport_disabled']) && $_POST['postfix_transport_disabled'] != "") { - array_push($updates ,"Disabled = ".$db->quote($_POST['postfix_transport_disabled'])); - } - - # Check if we have updates - if (sizeof($updates) > 0) { - $updateStr = implode(', ',$updates); - - $res = $db->exec("UPDATE ${DB_TABLE_PREFIX}transports SET $updateStr WHERE ID = ".$db->quote($_POST['postfix_transport_id'])); - if ($res) { -?> - <div class="notice">Postfix transport updated</div> -<?php - } else { -?> - <div class="warning">Error updating Postfix transport!</div> - <div class="warning"><?php print_r($db->errorInfo()) ?></div> -<?php - } - - } else { -?> - <div class="warning">No changes made to Postfix transport</div> -<?php - } - -} else { -?> - <div class="warning">Invalid invocation</div> -<?php -} - - -printFooter(); - - -# vim: ts=4 -?> diff --git a/webui/postfix-transports-delete.php b/webui/postfix-transports-delete.php deleted file mode 100644 index 09975040..00000000 --- a/webui/postfix-transports-delete.php +++ /dev/null @@ -1,114 +0,0 @@ -<?php -# Postfix transport 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_postfix_db(); - - - -printHeader(array( - "Tabs" => array( - "Back to Transports" => "postfix-transports-main.php", - ), -)); - - - -# Display delete confirm screen -if ($_POST['frmaction'] == "delete") { - - # Check a Postfix transport was selected - if (isset($_POST['postfix_transport_id'])) { -?> - <p class="pageheader">Delete Postfix Transport</p> - - <form action="postfix-transports-delete.php" method="post"> - <div> - <input type="hidden" name="frmaction" value="delete2" /> - <input type="hidden" name="postfix_transport_id" value="<?php echo $_POST['postfix_transport_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 Postfix transport selected</div> -<?php - } - - - -# SQL Updates -} elseif ($_POST['frmaction'] == "delete2") { -?> - <p class="pageheader">Postfix Transport Delete Results</p> -<?php - if (isset($_POST['postfix_transport_id'])) { - - if ($_POST['confirm'] == "yes") { - $res = $db->exec("DELETE FROM ${DB_TABLE_PREFIX}transports WHERE ID = ".$db->quote($_POST['postfix_transport_id'])); - if ($res) { -?> - <div class="notice">Postfix transport deleted</div> -<?php - } else { -?> - <div class="warning">Error deleting Postfix transport!</div> - <div class="warning"><?php print_r($db->errorInfo()) ?></div> -<?php - } - } else { -?> - <div class="notice">Postfix transport not deleted, aborted by user</div> -<?php - } - - # Warn - } else { -?> - <div class="warning">Invocation error, no Postfix transport ID</div> -<?php - } - - - -} else { -?> - <div class="warning">Invalid invocation</div> -<?php -} - - -printFooter(); - - -# vim: ts=4 -?> - diff --git a/webui/postfix-transports-main.php b/webui/postfix-transports-main.php deleted file mode 100644 index c898c3bd..00000000 --- a/webui/postfix-transports-main.php +++ /dev/null @@ -1,100 +0,0 @@ -<?php -# Postfix transports -# 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_postfix_db(); - - - -printHeader(array( -)); - -?> - <p class="pageheader">Postfix Transports</p> - - <form id="main_form" action="postfix-transports-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 = 'postfix-transports-add.php'; - } else if (myobj.selectedIndex == 4) { - myform.action = 'postfix-transports-change.php'; - } else if (myobj.selectedIndex == 5) { - myform.action = 'postfix-transports-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">Domain</td> - <td class="textcenter">Transport</td> - <td class="textcenter">Disabled</td> - </tr> -<?php - $sql = "SELECT ID, DomainName, PTransport, Disabled FROM ${DB_TABLE_PREFIX}transports ORDER BY DomainName"; - $res = $db->query($sql); - - while ($row = $res->fetchObject()) { -?> - <tr class="resultsitem"> - <td><input type="radio" name="postfix_transport_id" value="<?php echo $row->id ?>" /></td> - <td><?php echo $row->domainname ?></td> - <td><?php echo $row->ptransport ?></td> - <td class="textcenter"><?php echo $row->disabled ? 'yes' : 'no' ?></td> - </tr> -<?php - } - $res->closeCursor(); -?> - </table> - </form> -<?php - - - -printFooter(); - -# vim: ts=4 -?> diff --git a/webui/quotas-add.php b/webui/quotas-add.php deleted file mode 100644 index f4d40ff4..00000000 --- a/webui/quotas-add.php +++ /dev/null @@ -1,220 +0,0 @@ -<?php -# Module: Quotas 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 quotas" => "quotas-main.php" - ), -)); - - - -if ($_POST['frmaction'] == "add") { -?> - <p class="pageheader">Add Quota</p> - - <form method="post" action="quotas-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="quota_name" /></td> - </tr> - <tr> - <td class="entrytitle">Track</td> - <td> - <select id="quota_track" name="quota_track" - onchange=" - var myobj = document.getElementById('quota_track'); - var myobj2 = document.getElementById('quota_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="quota_trackextra" name="quota_trackextra" size="18" value="n/a" disabled="disabled" /> - </td> - </tr> - <tr> - <td class="entrytitle">Period</td> - <td><input type="text" name="quota_period" /></td> - </tr> - <tr> - <td class="entrytitle">Link to policy</td> - <td> - <select name="quota_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">Verdict</td> - <td> - <select name="quota_verdict"> - <option value="HOLD">Hold</option> - <option value="REJECT" selected="selected">Reject</option> - <option value="DEFER">Defer (delay)</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="quota_data" /></td> - </tr> - <tr> - <td class="entrytitle">Stop processing here</td> - <td> - <select name="quota_lastquota"> - <option value="0">No</option> - <option value="1">Yes</option> - </select> - </td> - </tr> - <tr> - <td class="entrytitle">Comment</td> - <td><textarea name="quota_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">Quota Add Results</p> - -<?php - # Check policy id - if (empty($_POST['quota_policyid'])) { -?> - <div class="warning">Policy ID cannot be empty</div> -<?php - - # Check name - } elseif (empty($_POST['quota_name'])) { -?> - <div class="warning">Name cannot be empty</div> -<?php - - # Check verdict - } elseif (empty($_POST['quota_verdict'])) { -?> - <div class="warning">Verdict cannot be empty</div> -<?php - - # Check last quota - } elseif (!isset($_POST['quota_lastquota'])) { -?> - <div class="warning">Stop procesing here field cannot be empty</div> -<?php - - } else { - - if ($_POST['quota_track'] == "SenderIP") { - $quotaTrack = sprintf('%s:%s',$_POST['quota_track'],$_POST['quota_trackextra']); - } else { - $quotaTrack = $_POST['quota_track']; - } - - - $stmt = $db->prepare(" - INSERT INTO ${DB_TABLE_PREFIX}quotas - (PolicyID,Name,Track,Period,Verdict,Data,LastQuota,Comment,Disabled) - VALUES - (?,?,?,?,?,?,?,?,1) - "); - - $res = $stmt->execute(array( - $_POST['quota_policyid'], - $_POST['quota_name'], - $quotaTrack, - $_POST['quota_period'], - $_POST['quota_verdict'], - $_POST['quota_lastquota'], - $_POST['quota_data'], - $_POST['quota_comment'] - )); - - if ($res) { -?> - <div class="notice">Quota created</div> -<?php - } else { -?> - <div class="warning">Failed to create quota</div> - <div class="warning"><?php print_r($stmt->errorInfo()) ?></div> -<?php - } - - } - - -} else { -?> - <div class="warning">Invalid invocation</div> -<?php -} - -printFooter(); - - -# vim: ts=4 -?> diff --git a/webui/quotas-change.php b/webui/quotas-change.php deleted file mode 100644 index 7c37ca84..00000000 --- a/webui/quotas-change.php +++ /dev/null @@ -1,279 +0,0 @@ -<?php -# Module: Quotas 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"); - - - -$db = connect_db(); - - - -printHeader(array( - "Tabs" => array( - "Back to quotas" => "quotas-main.php" - ), -)); - - - -# Display change screen -if ($_POST['frmaction'] == "change") { - - # Check a quota was selected - if (isset($_POST['quota_id'])) { - # Prepare statement - $stmt = $db->prepare(" - SELECT - ${DB_TABLE_PREFIX}quotas.ID, ${DB_TABLE_PREFIX}quotas.PolicyID, ${DB_TABLE_PREFIX}quotas.Name, - ${DB_TABLE_PREFIX}quotas.Track, ${DB_TABLE_PREFIX}quotas.Period, - ${DB_TABLE_PREFIX}quotas.Verdict, ${DB_TABLE_PREFIX}quotas.Data, - ${DB_TABLE_PREFIX}quotas.LastQuota, - ${DB_TABLE_PREFIX}quotas.Comment, ${DB_TABLE_PREFIX}quotas.Disabled, - - ${DB_TABLE_PREFIX}policies.Name AS PolicyName - - FROM - ${DB_TABLE_PREFIX}quotas, ${DB_TABLE_PREFIX}policies - - WHERE - ${DB_TABLE_PREFIX}quotas.ID = ? - AND ${DB_TABLE_PREFIX}policies.ID = ${DB_TABLE_PREFIX}quotas.PolicyID - "); -?> - <p class="pageheader">Update Quota</p> - - <form action="quotas-change.php" method="post"> - <div> - <input type="hidden" name="frmaction" value="change2" /> - <input type="hidden" name="quota_id" value="<?php echo $_POST['quota_id']; ?>" /> - </div> -<?php - - $res = $stmt->execute(array($_POST['quota_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="quota_name" /></td> - </tr> - <tr> - <td class="entrytitle">Link to policy</td> - <td class="oldval"><?php echo $row->policyname ?></td> - <td> - <select name="quota_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 class="entrytitle">Track</td> - <td class="oldval"><?php echo $row->track ?></td> - <td> - <select id="quota_track" name="quota_track" - onChange=" - var myobj = document.getElementById('quota_track'); - var myobj2 = document.getElementById('quota_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="quota_trackextra" name="quota_trackextra" size="18" value="n/a" disabled="disabled" /> - </td> - </tr> - <tr> - <td class="entrytitle">Period</td> - <td class="oldval"><?php echo $row->period ?></td> - <td><input type="text" name="quota_period" /></td> - </tr> - <tr> - <td class="entrytitle">Verdict</td> - <td class="oldval"><?php echo $row->verdict ?></td> - <td> - <select name="quota_verdict"> - <option value="">--</option> - <option value="HOLD">Hold</option> - <option value="REJECT">Reject</option> - <option value="DEFER">Defer (delay)</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="quota_data" /></td> - </tr> - <tr> - <td class="entrytitle">Stop processing here</td> - <td class="oldval"><?php echo $row->lastquota ? 'yes' : 'no' ?></td> - <td> - <select name="quota_lastquota"> - <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="quota_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="quota_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 quota selected</div> -<?php - } - - - -# SQL Updates -} elseif ($_POST['frmaction'] == "change2") { -?> - <p class="pageheader">Access Control Update Results</p> -<?php - $updates = array(); - - if (!empty($_POST['quota_policyid'])) { - array_push($updates,"PolicyID = ".$db->quote($_POST['quota_policyid'])); - } - if (!empty($_POST['quota_name'])) { - array_push($updates,"Name = ".$db->quote($_POST['quota_name'])); - } - if (!empty($_POST['quota_track'])) { - if ($_POST['quota_track'] == "SenderIP") { - $quotaTrack = sprintf('%s:%s',$_POST['quota_track'],$_POST['quota_trackextra']); - } else { - $quotaTrack = $_POST['quota_track']; - } - - array_push($updates,"Track = ".$db->quote($quotaTrack)); - } - if (!empty($_POST['quota_period'])) { - array_push($updates,"Period = ".$db->quote($_POST['quota_period'])); - } - if (!empty($_POST['quota_verdict'])) { - array_push($updates,"Verdict = ".$db->quote($_POST['quota_verdict'])); - } - if (!empty($_POST['quota_data'])) { - array_push($updates,"Data = ".$db->quote($_POST['quota_data'])); - } - if (isset($_POST['quota_lastquota']) && $_POST['quota_lastquota'] != "") { - array_push($updates,"LastQuota = ".$db->quote($_POST['quota_lastquota'])); - } - if (!empty($_POST['quota_comment'])) { - array_push($updates,"Comment = ".$db->quote($_POST['quota_comment'])); - } - if (isset($_POST['quota_disabled']) && $_POST['quota_disabled'] != "") { - array_push($updates ,"Disabled = ".$db->quote($_POST['quota_disabled'])); - } - - # Check if we have updates - if (sizeof($updates) > 0) { - $updateStr = implode(', ',$updates); - - $res = $db->exec("UPDATE ${DB_TABLE_PREFIX}quotas SET $updateStr WHERE ID = ".$db->quote($_POST['quota_id'])); - if ($res) { -?> - <div class="notice">Quota updated</div> -<?php - } else { -?> - <div class="warning">Error updating quota!</div> - <div class="warning"><?php print_r($db->errorInfo()) ?></div> -<?php - } - - } else { -?> - <div class="warning">No changes made to quota</div> -<?php - } - -} else { -?> - <div class="warning">Invalid invocation</div> -<?php -} - - -printFooter(); - - -# vim: ts=4 -?> diff --git a/webui/quotas-delete.php b/webui/quotas-delete.php deleted file mode 100644 index bb22c832..00000000 --- a/webui/quotas-delete.php +++ /dev/null @@ -1,206 +0,0 @@ -<?php -# Module: Quotas 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 quotas" => "quotas-main.php", - ), -)); - - - -# Display delete confirm screen -if ($_POST['frmaction'] == "delete") { - - # Check a quota was selected - if (isset($_POST['quota_id'])) { -?> - <p class="pageheader">Delete Quota</p> - - <form action="quotas-delete.php" method="post"> - <div> - <input type="hidden" name="frmaction" value="delete2" /> - <input type="hidden" name="quota_id" value="<?php echo $_POST['quota_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 quota selected</div> -<?php - } - - - -# SQL Updates -} elseif ($_POST['frmaction'] == "delete2") { -?> - <p class="pageheader">Quota Delete Results</p> -<?php - if (isset($_POST['quota_id'])) { - - if ($_POST['confirm'] == "yes") { - - # Grab tracking limits we must delete for - $res = $db->query(" - SELECT - ID - FROM - ${DB_TABLE_PREFIX}quotas_limits - WHERE - QuotasID = ".$db->quote($_POST['quota_id'])." - "); - - $limitIDs = array(); - - if ($res !== FALSE) { - # Pull in limit ID's - while ($row = $res->fetchObject()) { - array_push($limitIDs,$row->id); - } - $res->closeCursor(); - - } else { -?> - <div class="warning">Error selecting quota limit IDs!</div> - <div class="warning"><?php print_r($db->errorInfo()) ?></div> -<?php - } - - - # Check last query succeeded, if so continue - if ($res !== FALSE) { - $db->beginTransaction(); - - $stmt = $db->prepare(" - DELETE FROM - ${DB_TABLE_PREFIX}quotas_tracking - WHERE - QuotasLimitsID = ? - "); - - # Loop with limit ID's, start off true - $res = true; - foreach ($limitIDs as $id) { - $res = $stmt->execute(array($id)); - } - - if ($res !== FALSE) { -?> - <div class="notice">Quota tracking info deleted</div> -<?php - } else { -?> - <div class="warning">Error deleting quota tracking info!</div> - <div class="warning"><?php print_r($db->errorInfo()) ?></div> -<?php - $db->rollBack(); - } - } - - - # Check last query succeeded, if so continue - if ($res !== FALSE) { - $stmt = $db->prepare(" - DELETE FROM - ${DB_TABLE_PREFIX}quotas_limits - WHERE - QuotasID = ?" - ); - $res = $stmt->execute(array($_POST['quota_id'])); - - if ($res !== FALSE) { -?> - <div class="notice">Quota limits deleted</div> -<?php - } else { -?> - <div class="warning">Error deleting quota limits!</div> - <div class="warning"><?php print_r($db->errorInfo()) ?></div> -<?php - $db->rollBack(); - } - } - - # Check last query succeeded, if so continue - if ($res !== FALSE) { - $res = $db->exec("DELETE FROM ${DB_TABLE_PREFIX}quotas WHERE ID = ".$db->quote($_POST['quota_id'])); - if ($res) { -?> - <div class="notice">Quota deleted</div> -<?php - } else { -?> - <div class="warning">Error deleting quota!</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">Quota not deleted, aborted by user</div> -<?php - } - - # Warn - } else { -?> - <div class="warning">Invocation error, no quota ID</div> -<?php - } - - - -} else { -?> - <div class="warning">Invalid invocation</div> -<?php -} - - -printFooter(); - - -# vim: ts=4 -?> - diff --git a/webui/quotas-limits-add.php b/webui/quotas-limits-add.php deleted file mode 100644 index ae93d71d..00000000 --- a/webui/quotas-limits-add.php +++ /dev/null @@ -1,130 +0,0 @@ -<?php -# Module: Quotas limits 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 quotas" => "quotas-main.php", - "Back to quota limits" => "quotas-limits-main.php?quota_id=".$_REQUEST['quota_id'], - ), -)); - - -if ($_POST['frmaction'] == "add") { -?> - <p class="pageheader">Add Quota Limit</p> -<?php - if (!empty($_POST['quota_id'])) { -?> - <form method="post" action="quotas-limits-add.php"> - <div> - <input type="hidden" name="frmaction" value="add2" /> - <input type="hidden" name="quota_id" value="<?php echo $_POST['quota_id'] ?>" /> - </div> - <table class="entry"> - <tr> - <td class="entrytitle">Type</td> - <td> - <select name="limit_type"> - <option value="MessageCount">Message Count</option> - <option value="MessageCumulativeSize">Message Cumulative Size</option> - </select> - </td> - </tr> - <tr> - <td class="entrytitle">Counter Limit</td> - <td><input type="text" name="limit_counterlimit" /></td> - </tr> - <tr> - <td class="entrytitle">Comment</td> - <td><textarea name="limit_comment"></textarea></td> - </tr> - <tr> - <td colspan="2"> - <input type="submit" /> - </td> - </tr> - </table> - </form> -<?php - } else { -?> - <div class="warning">No policy ID, invalid invocation?</div> -<?php - } - - - -# Check we have all params -} elseif ($_POST['frmaction'] == "add2") { -?> - <p class="pageheader">Quota Limit Add Results</p> - -<?php - # Check we have a limit - if (empty($_POST['limit_counterlimit'])) { -?> - <div class="warning">Counter limit is required</div> -<?php - - - } else { - $stmt = $db->prepare("INSERT INTO ${DB_TABLE_PREFIX}quotas_limits (QuotasID,Type,CounterLimit,Comment,Disabled) VALUES (?,?,?,?,1)"); - - $res = $stmt->execute(array( - $_POST['quota_id'], - $_POST['limit_type'], - $_POST['limit_counterlimit'], - $_POST['limit_comment'] - )); - if ($res) { -?> - <div class="notice">Quota limit created</div> -<?php - } else { -?> - <div class="warning">Failed to create quota limit</div> - <div class="warning"><?php print_r($stmt->errorInfo()) ?></div> -<?php - } - - } - - -} else { -?> - <div class="warning">Invalid invocation</div> -<?php -} - - -printFooter(); - - -# vim: ts=4 -?> diff --git a/webui/quotas-limits-change.php b/webui/quotas-limits-change.php deleted file mode 100644 index 631cb115..00000000 --- a/webui/quotas-limits-change.php +++ /dev/null @@ -1,180 +0,0 @@ -<?php -# Module: Quotas limits 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"); - - - -$db = connect_db(); - - - -printHeader(array( - "Tabs" => array( - "Back to quotas" => "quotas-main.php", - "Back to limits" => "quotas-limits-main.php?quota_id=".$_REQUEST['quota_id'], - ), -)); - - - -# Display change screen -if ($_POST['frmaction'] == "change") { - - # Check a limit was selected - if (isset($_POST['quota_limit_id'])) { - # Prepare statement - $stmt = $db->prepare("SELECT ID, Type, CounterLimit, Comment, Disabled FROM ${DB_TABLE_PREFIX}quotas_limits WHERE ID = ?"); - $res = $stmt->execute(array($_POST['quota_limit_id'])); - $row = $stmt->fetchObject(); - $stmt->closeCursor(); -?> - <p class="pageheader">Update Quota Limit</p> - - <form action="quotas-limits-change.php" method="post"> - <div> - <input type="hidden" name="frmaction" value="change2" /> - <input type="hidden" name="quota_id" value="<?php echo $_POST['quota_id']; ?>" /> - <input type="hidden" name="quota_limit_id" value="<?php echo $_POST['quota_limit_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">Type</td> - <td class="oldval texttop"><?php echo $row->type ?></td> - <td> - <select name="limit_type"> - <option value="">--</option> - <option value="MessageCount">Message Count</option> - <option value="MessageCumulativeSize">Message Cumulative Size</option> - </select> - </td> - </tr> - <tr> - <td class="entrytitle texttop">Counter Limit</td> - <td class="oldval texttop"><?php echo $row->counterlimit ?></td> - <td><input type="text" name="limit_counterlimit" /></td> - </tr> - <tr> - <td class="entrytitle texttop">Comment</td> - <td class="oldval texttop"><?php echo $row->comment ?></td> - <td><textarea name="limit_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="limit_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 quota selected</div> -<?php - } - - - -# SQL Updates -} elseif ($_POST['frmaction'] == "change2") { -?> - <p class="pageheader">Policy Update Results</p> -<?php - # Check a quota was selected - if (isset($_POST['quota_limit_id'])) { - - $updates = array(); - - if (!empty($_POST['limit_type'])) { - array_push($updates,"Type = ".$db->quote($_POST['limit_type'])); - } - if (!empty($_POST['limit_counterlimit'])) { - array_push($updates,"CounterLimit = ".$db->quote($_POST['limit_counterlimit'])); - } - if (!empty($_POST['limit_comment'])) { - array_push($updates,"Comment = ".$db->quote($_POST['limit_comment'])); - } - if (isset($_POST['limit_disabled']) && $_POST['limit_disabled'] != "") { - array_push($updates ,"Disabled = ".$db->quote($_POST['limit_disabled'])); - } - - # Check if we have updates - if (sizeof($updates) > 0) { - $updateStr = implode(', ',$updates); - - $res = $db->exec("UPDATE ${DB_TABLE_PREFIX}quotas_limits SET $updateStr WHERE ID = ".$db->quote($_POST['quota_limit_id'])); - if ($res) { -?> - <div class="notice">Quota limit updated</div> -<?php - } else { -?> - <div class="warning">Error updating quota limit!</div> - <div class="warning"><?php print_r($db->errorInfo()) ?></div> -<?php - } - - # Warn - } else { -?> - <div class="warning">No quota limit updates</div> -<?php - } - - # Warn - } else { -?> - <div class="error">No quota limit data available</div> -<?php - } - - -} else { -?> - <div class="warning">Invalid invocation</div> -<?php -} - - -printFooter(); - - -# vim: ts=4 -?> - diff --git a/webui/quotas-limits-delete.php b/webui/quotas-limits-delete.php deleted file mode 100644 index 36513dff..00000000 --- a/webui/quotas-limits-delete.php +++ /dev/null @@ -1,116 +0,0 @@ -<?php -# Module: Quotas limits 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 quotas" => "quotas-main.php", - "Back to limits" => "quotas-limits-main.php?quota_id=".$_REQUEST['quota_id'], - ), -)); - - - -# Display delete confirm screen -if ($_POST['frmaction'] == "delete") { - - # Check a quota limit was selected - if (isset($_POST['quota_limit_id'])) { -?> - <p class="pageheader">Delete Quota Limit</p> - - <form action="quotas-limits-delete.php" method="post"> - <div> - <input type="hidden" name="frmaction" value="delete2" /> - <input type="hidden" name="quota_id" value="<?php echo $_POST['quota_id']; ?>" /> - <input type="hidden" name="quota_limit_id" value="<?php echo $_POST['quota_limit_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 quota limit selected</div> -<?php - } - - - -# SQL Updates -} elseif ($_POST['frmaction'] == "delete2") { -?> - <p class="pageheader">Quota Limit Delete Results</p> -<?php - if (isset($_POST['quota_limit_id'])) { - - if ($_POST['confirm'] == "yes") { - $res = $db->exec("DELETE FROM ${DB_TABLE_PREFIX}quotas_limits WHERE ID = ".$db->quote($_POST['quota_limit_id'])); - if ($res) { -?> - <div class="notice">Quota limit deleted</div> -<?php - } else { -?> - <div class="warning">Error deleting quota limit!</div> - <div class="warning"><?php print_r($db->errorInfo()) ?></div> -<?php - } - } else { -?> - <div class="notice">Quota limit not deleted, aborted by user</div> -<?php - } - - # Warn - } else { -?> - <div class="warning">Invocation error, no quota limit ID</div> -<?php - } - - - -} else { -?> - <div class="warning">Invalid invocation</div> -<?php -} - - -printFooter(); - - -# vim: ts=4 -?> - diff --git a/webui/quotas-limits-main.php b/webui/quotas-limits-main.php deleted file mode 100644 index 9690bef9..00000000 --- a/webui/quotas-limits-main.php +++ /dev/null @@ -1,125 +0,0 @@ -<?php -# Module: Quotas limits -# 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 quotas" => "quotas-main.php" - ), -)); - - -# Check a policy was selected -if (isset($_REQUEST['quota_id'])) { - - $stmt = $db->prepare("SELECT Type, CounterLimit, Disabled FROM ${DB_TABLE_PREFIX}quota_limits WHERE QuotaID = ?"); - $quota_stmt = $db->prepare("SELECT Name FROM ${DB_TABLE_PREFIX}quotas WHERE ID = ?"); - $quota_stmt->execute(array($_REQUEST['quota_id'])); - $row = $quota_stmt->fetchObject(); - $quota_stmt->closeCursor(); -?> - <p class="pageheader">Quota Limits</p> - - <form id="main_form" action="quotas-limits-main.php" method="post"> - <div> - <input type="hidden" name="quota_id" value="<?php echo $_REQUEST['quota_id'] ?>" /> - </div> - <div class="textcenter"> - - <div class="notice">Quota: <?php echo $row->name ?></div> - - 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 = 'quotas-limits-add.php'; - myform.submit(); - } else if (myobj.selectedIndex == 4) { - myform.action = 'quotas-limits-change.php'; - myform.submit(); - } else if (myobj.selectedIndex == 5) { - myform.action = 'quotas-limits-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">Type</td> - <td class="textcenter">Counter Limit</td> - <td class="textcenter">Disabled</td> - </tr> -<?php - - $stmt = $db->prepare("SELECT ID, Type, CounterLimit, Disabled FROM ${DB_TABLE_PREFIX}quotas_limits WHERE QuotasID = ?"); - $res = $stmt->execute(array($_REQUEST['quota_id'])); - - $i = 0; - - # Loop with rows - while ($row = $stmt->fetchObject()) { -?> - <tr class="resultsitem"> - <td><input type="radio" name="quota_limit_id" value="<?php echo $row->id ?>" /></td> - <td class="textcenter"><?php echo $row->type ?></td> - <td class="textcenter"><?php echo $row->counterlimit ?></td> - <td class="textcenter"><?php echo $row->disabled ? 'yes' : 'no' ?></td> - </tr> -<?php - } - $stmt->closeCursor(); -?> - </table> - </form> -<?php -} else { -?> - <div class="warning">Invalid invocation</div> -<?php -} - - -printFooter(); - - -# vim: ts=4 -?> diff --git a/webui/quotas-main.php b/webui/quotas-main.php deleted file mode 100644 index 9e372ded..00000000 --- a/webui/quotas-main.php +++ /dev/null @@ -1,134 +0,0 @@ -<?php -# Module: Quotas -# 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">Quota List</p> - - <form id="main_form" action="quotas-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 = 'quotas-add.php'; - } else if (myobj.selectedIndex == 4) { - myform.action = 'quotas-change.php'; - } else if (myobj.selectedIndex == 5) { - myform.action = 'quotas-delete.php'; - } else if (myobj.selectedIndex == 7) { - myform.action = 'quotas-limits-main.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> - <option disabled="disabled"> - - - - - - - - - - - </option> - <option value="limits">Limits</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">Verdict</td> - <td class="textcenter">Data</td> - <td class="textcenter">Disabled</td> - </tr> -<?php - $sql = " - SELECT - ${DB_TABLE_PREFIX}quotas.ID, ${DB_TABLE_PREFIX}quotas.Name, ${DB_TABLE_PREFIX}quotas.Track, - ${DB_TABLE_PREFIX}quotas.Period, - ${DB_TABLE_PREFIX}quotas.Verdict, ${DB_TABLE_PREFIX}quotas.Data, - ${DB_TABLE_PREFIX}quotas.Disabled, ${DB_TABLE_PREFIX}quotas.Comment, - ${DB_TABLE_PREFIX}policies.Name AS PolicyName - - FROM - ${DB_TABLE_PREFIX}quotas, ${DB_TABLE_PREFIX}policies - - WHERE - ${DB_TABLE_PREFIX}policies.ID = ${DB_TABLE_PREFIX}quotas.PolicyID - - ORDER BY - ${DB_TABLE_PREFIX}policies.Name - "; - $res = $db->query($sql); - - while ($row = $res->fetchObject()) { -?> - <tr class="resultsitem"> - <td><input type="radio" name="quota_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 $row->period ?></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 -?> -- GitLab