SF.net SVN: postfixadmin: [168] trunk
Brought to you by:
christian_boltz,
gingerdog
|
From: <chr...@us...> - 2007-10-31 18:24:36
|
Revision: 168
http://postfixadmin.svn.sourceforge.net/postfixadmin/?rev=168&view=rev
Author: christian_boltz
Date: 2007-10-31 11:24:40 -0700 (Wed, 31 Oct 2007)
Log Message:
-----------
Finally got rid of admin/ :-)
- moved admin-only scripts from admin/ to /
- removed all merged files ("require('../$file')") from admin/
- changed include paths - no more admin/superadmin switching needed
- admin_menu.tpl is also gone
- removed all menu.tpl / admin_menu.tpl switches - no more needed
- admin/index.php still exists and redirects to /
Modified Paths:
--------------
trunk/admin/index.php
trunk/create-alias.php
trunk/create-mailbox.php
trunk/delete.php
trunk/edit-active.php
trunk/edit-alias.php
trunk/edit-mailbox.php
trunk/edit-vacation.php
trunk/login.php
trunk/search.php
trunk/viewlog.php
Added Paths:
-----------
trunk/backup.php
trunk/broadcast-message.php
trunk/create-admin.php
trunk/create-domain.php
trunk/edit-active-admin.php
trunk/edit-active-domain.php
trunk/edit-admin.php
trunk/edit-domain.php
trunk/list-admin.php
trunk/list-domain.php
trunk/list-virtual.php
Removed Paths:
-------------
trunk/admin/backup.php
trunk/admin/broadcast-message.php
trunk/admin/create-admin.php
trunk/admin/create-alias.php
trunk/admin/create-domain.php
trunk/admin/create-mailbox.php
trunk/admin/delete.php
trunk/admin/edit-active-admin.php
trunk/admin/edit-active-domain.php
trunk/admin/edit-active.php
trunk/admin/edit-admin.php
trunk/admin/edit-alias.php
trunk/admin/edit-domain.php
trunk/admin/edit-mailbox.php
trunk/admin/edit-vacation.php
trunk/admin/list-admin.php
trunk/admin/list-domain.php
trunk/admin/list-virtual.php
trunk/admin/main.php
trunk/admin/search.php
trunk/admin/viewlog.php
trunk/templates/admin_menu.tpl
Deleted: trunk/admin/backup.php
===================================================================
--- trunk/admin/backup.php 2007-10-31 01:31:37 UTC (rev 167)
+++ trunk/admin/backup.php 2007-10-31 18:24:40 UTC (rev 168)
@@ -1,118 +0,0 @@
-<?php
-/**
- * Postfix Admin
- *
- * LICENSE
- * This source file is subject to the GPL license that is bundled with
- * this package in the file LICENSE.TXT.
- *
- * Further details on the project are available at :
- * http://www.postfixadmin.com or http://postfixadmin.sf.net
- *
- * @version $Id$
- * @license GNU GPL v2 or later.
- *
- * File: backup.php
- * Used to save all settings - but only works for MySQL databases.
- * Template File: -none-
- *
- * Template Variables: -none-
- *
- * Form POST \ GET Variables: -none-
- */
-
-require_once('../common.php');
-
-authentication_require_role('global-admin');
-
-(($CONF['backup'] == 'NO') ? header("Location: " . $CONF['postfix_admin_url'] . "/main.php") && exit : '1');
-
-// TODO: make backup supported for postgres
-if ('pgsql'==$CONF['database_type'])
-{
- print '<p>Sorry: Backup is currently not supported for your DBMS.</p>';
-}
-/*
- SELECT attnum,attname,typname,atttypmod-4,attnotnull,atthasdef,adsrc
- AS def FROM pg_attribute,pg_class,pg_type,pg_attrdef
- WHERE pg_class.oid=attrelid AND pg_type.oid=atttypid
- AND attnum>0 AND pg_class.oid=adrelid AND adnum=attnum AND atthasdef='t' AND lower(relname)='admin'
- UNION SELECT attnum,attname,typname,atttypmod-4,attnotnull,atthasdef,''
- AS def FROM pg_attribute,pg_class,pg_type
- WHERE pg_class.oid=attrelid
- AND pg_type.oid=atttypid
- AND attnum>0
- AND atthasdef='f'
- AND lower(relname)='admin'
-$db = $_GET['db'];
-$cmd = "pg_dump -c -D -f /tix/miner/miner.sql -F p -N -U postgres $db";
-$res = `$cmd`;
-// Alternate: $res = shell_exec($cmd);
-echo $res;
-*/
-
-if ($_SERVER['REQUEST_METHOD'] == "GET")
-{
- umask (077);
- $path = (ini_get('upload_tmp_dir') != '') ? ini_get('upload_tmp_dir') : '/tmp/';
- $filename = "postfixadmin-" . date ("Ymd") . "-" . getmypid() . ".sql";
- $backup = $path . $filename;
-
- $header = "#\n# Postfix Admin $version\n# Date: " . date ("D M j G:i:s T Y") . "\n#\n";
-
- if (!$fh = fopen ($backup, 'w'))
- {
- $tMessage = "<div class=\"error_msg\">Cannot open file ($backup)</div>";
- include ("../templates/header.tpl");
- include ("../templates/admin_menu.tpl");
- include ("../templates/message.tpl");
- include ("../templates/footer.tpl");
- }
- else
- {
- fwrite ($fh, $header);
-
- $tables = array('admin','alias','domain','domain_admins','log','mailbox','vacation');
-
- for ($i = 0 ; $i < sizeof ($tables) ; ++$i)
- {
- $result = db_query ("SHOW CREATE TABLE ".table_by_pos($i));
- if ($result['rows'] > 0)
- {
- while ($row = db_array ($result['result']))
- {
- fwrite ($fh, "$row[1];\n\n");
- }
- }
- }
-
- for ($i = 0 ; $i < sizeof ($tables) ; ++$i)
- {
- $result = db_query ("SELECT * FROM ".table_by_pos($i));
- if ($result['rows'] > 0)
- {
- while ($row = db_assoc ($result['result']))
- {
- foreach ($row as $key=>$val)
- {
- $fields[] = $key;
- $values[] = $val;
- }
-
- fwrite ($fh, "INSERT INTO ". $tables[$i] . " (". implode (',',$fields) . ") VALUES ('" . implode ('\',\'',$values) . "');\n");
- $fields = "";
- $values = "";
- }
- }
- }
- }
- header ("Content-Type: application/octet-stream");
- header ("Content-Disposition: attachment; filename=\"$filename\"");
- header ("Content-Transfer-Encoding: binary");
- header ("Content-Length: " . filesize("$backup"));
- header ("Content-Description: Postfix Admin");
- $download_backup = fopen ("$backup", "r");
- unlink ("$backup");
- fpassthru ($download_backup);
-}
-?>
Deleted: trunk/admin/broadcast-message.php
===================================================================
--- trunk/admin/broadcast-message.php 2007-10-31 01:31:37 UTC (rev 167)
+++ trunk/admin/broadcast-message.php 2007-10-31 18:24:40 UTC (rev 168)
@@ -1,92 +0,0 @@
-<?php
-/**
- * Postfix Admin
- *
- * LICENSE
- * This source file is subject to the GPL license that is bundled with
- * this package in the file LICENSE.TXT.
- *
- * Further details on the project are available at :
- * http://www.postfixadmin.com or http://postfixadmin.sf.net
- *
- * @version $Id$
- * @license GNU GPL v2 or later.
- *
- * File: broadcast-message.php
- * Used to send a message to _ALL_ users with mailboxes on this server.
- *
- * Template File: broadcast-message.tpl
- *
- * Template Variables: -none-
- *
- * Form POST \ GET Variables:
- *
- * name
- * subject
- * message
- */
-
-require_once('../common.php');
-
-authentication_require_role('global-admin');
-
-$SESSID_USERNAME = authentication_get_username();
-
-if ($_SERVER['REQUEST_METHOD'] == "POST")
-{
- if (empty($_POST['subject']) || empty($_POST['message']) || empty($_POST['name']))
- {
- $error = 1;
- }
- else
- {
- $q = 'select username from mailbox union '.
- 'select goto from alias '.
- 'where goto not in (select username from mailbox)';
-
- $result = db_query ($q);
- if ($result['rows'] > 0)
- {
- $b_name = mb_encode_mimeheader( $_POST['name'], 'UTF-8', 'Q');
- $b_subject = mb_encode_mimeheader( $_POST['subject'], 'UTF-8', 'Q');
- $b_message = encode_base64($_POST['message']);
-
- $i = 0;
- while ($row = db_array ($result['result'])) {
- $fTo = $row[0];
- $fHeaders = 'To: ' . $fTo . "\n";
- $fHeaders .= 'From: ' . $b_name . ' <' . $CONF['admin_email'] . ">\n";
- $fHeaders .= 'Subject: ' . $b_subject . "\n";
- $fHeaders .= 'MIME-Version: 1.0' . "\n";
- $fHeaders .= 'Content-Type: text/plain; charset=UTF-8' . "\n";
- $fHeaders .= 'Content-Transfer-Encoding: base64' . "\n";
-
- $fHeaders .= $b_message;
-
- if (!smtp_mail ($fTo, $CONF['admin_email'], $fHeaders))
- {
- $tMessage .= "<br />" . $PALANG['pSendmail_result_error'] . "<br />";
- }
- else
- {
- $tMessage .= "<br />" . $PALANG['pSendmail_result_success'] . "<br />";
- }
- }
- }
- include ("../templates/header.tpl");
- include ("../templates/admin_menu.tpl");
- echo '<p>'.$PALANG['pBroadcast_success'].'</p>';
- include ("../templates/footer.tpl");
- }
-}
-
-if ($_SERVER['REQUEST_METHOD'] == "GET" || $error == 1)
-{
- include ("../templates/header.tpl");
- include ("../templates/admin_menu.tpl");
- include ("../templates/broadcast-message.tpl");
- include ("../templates/footer.tpl");
-}
-
-/* vim: set expandtab softtabstop=3 tabstop=3 shiftwidth=3: */
-?>
Deleted: trunk/admin/create-admin.php
===================================================================
--- trunk/admin/create-admin.php 2007-10-31 01:31:37 UTC (rev 167)
+++ trunk/admin/create-admin.php 2007-10-31 18:24:40 UTC (rev 168)
@@ -1,73 +0,0 @@
-<?php
-/**
- * Postfix Admin
- *
- * LICENSE
- * This source file is subject to the GPL license that is bundled with
- * this package in the file LICENSE.TXT.
- *
- * Further details on the project are available at :
- * http://www.postfixadmin.com or http://postfixadmin.sf.net
- *
- * @version $Id$
- * @license GNU GPL v2 or later.
- *
- * File: create-admin.php
- * Used to create new administrators.
- * Template File: admin_create-admin.tpl
- *
- *
- * Template Variables:
- *
- * tMessage
- * tUsername
- * tDomains
- *
- * Form POST \ GET Variables:
- *
- * fUsername
- * fPassword
- * fPassword2
- * fDomains
- */
-
-require_once('../common.php');
-
-authentication_require_role('global-admin');
-
-$list_domains = list_domains ();
-$tDomains = array();
-
-if ($_SERVER['REQUEST_METHOD'] == "GET")
-{
- $pAdminCreate_admin_username_text = $PALANG['pAdminCreate_admin_username_text'];
- $tDomains = array ();
-
- include ("../templates/header.tpl");
- include ("../templates/admin_menu.tpl");
- include ("../templates/admin_create-admin.tpl");
- include ("../templates/footer.tpl");
-}
-
-if ($_SERVER['REQUEST_METHOD'] == "POST")
-{
- if (isset ($_POST['fUsername'])) $fUsername = escape_string ($_POST['fUsername']);
- if (isset ($_POST['fPassword'])) $fPassword = escape_string ($_POST['fPassword']);
- if (isset ($_POST['fPassword2'])) $fPassword2 = escape_string ($_POST['fPassword2']);
- $fDomains = array();
- if (!empty ($_POST['fDomains'])) $fDomains = $_POST['fDomains'];
-
- list ($error, $tMessage, $pAdminCreate_admin_username_text, $pAdminCreate_admin_password_text) = create_admin($fUsername, $fPassword, $fPassword2, $fDomains);
-
- if ($error != 0) {
- if (isset ($_POST['fUsername'])) $tUsername = escape_string ($_POST['fUsername']);
- if (isset ($_POST['fDomains'])) $tDomains = $_POST['fDomains'];
- }
-
- include ("../templates/header.tpl");
- include ("../templates/admin_menu.tpl");
- include ("../templates/admin_create-admin.tpl");
- include ("../templates/footer.tpl");
-}
-/* vim: set expandtab softtabstop=3 tabstop=3 shiftwidth=3: */
-?>
Deleted: trunk/admin/create-alias.php
===================================================================
--- trunk/admin/create-alias.php 2007-10-31 01:31:37 UTC (rev 167)
+++ trunk/admin/create-alias.php 2007-10-31 18:24:40 UTC (rev 168)
@@ -1,3 +0,0 @@
-<?php
-require ("../create-alias.php");
-?>
Deleted: trunk/admin/create-domain.php
===================================================================
--- trunk/admin/create-domain.php 2007-10-31 01:31:37 UTC (rev 167)
+++ trunk/admin/create-domain.php 2007-10-31 18:24:40 UTC (rev 168)
@@ -1,129 +0,0 @@
-<?php
-/**
- * Postfix Admin
- *
- * LICENSE
- * This source file is subject to the GPL license that is bundled with
- * this package in the file LICENSE.TXT.
- *
- * Further details on the project are available at :
- * http://www.postfixadmin.com or http://postfixadmin.sf.net
- *
- * @version $Id$
- * @license GNU GPL v2 or later.
- *
- * File: create-domain.php
- * Allows administrators to create new domains.
- * Template File: admin_create-domain.tpl
- *
- * Template Variables:
- *
- * tMessage
- * tDomain
- * tDescription
- * tAliases
- * tMailboxes
- * tMaxquota
- * tDefaultaliases
- *
- * Form POST \ GET Variables:
- *
- * fDomain
- * fDescription
- * fAliases
- * fMailboxes
- * fMaxquota
- * fDefaultaliases
- */
-
-require_once('../common.php');
-
-authentication_require_role('global-admin');
-
-
-if ($_SERVER['REQUEST_METHOD'] == "GET")
-{
- $tAliases = $CONF['aliases'];
- $tMailboxes = $CONF['mailboxes'];
- $tMaxquota = $CONF['maxquota'];
- $tTransport = $CONF['transport_default'];
-
- include ("../templates/header.tpl");
- include ("../templates/admin_menu.tpl");
- include ("../templates/admin_create-domain.tpl");
- include ("../templates/footer.tpl");
-}
-
-if ($_SERVER['REQUEST_METHOD'] == "POST")
-{
- if (isset ($_POST['fDomain'])) $fDomain = escape_string ($_POST['fDomain']);
- foreach(array('fDescription' => '', 'fAliases' => '0', 'fMailboxes' => '0',
- 'fMaxquota' => '0', 'fTransport' => 'virtual',
- 'fDefaultaliases' => '0', 'fBackupmx' => '0') as $key => $default) {
- if(isset($_POST[$key]) && !empty($POST[$key])) {
- $$key = escape_string($_POST[$key]);
- }
- $$key = $default;
- }
-
- if (empty ($fDomain) or domain_exist ($fDomain) or !check_domain ($fDomain))
- {
- $error = 1;
- $tDomain = escape_string ($_POST['fDomain']);
- $tDescription = escape_string ($_POST['fDescription']);
- $tAliases = escape_string ($_POST['fAliases']);
- $tMailboxes = escape_string ($_POST['fMailboxes']);
- if (isset ($_POST['fMaxquota'])) $tMaxquota = escape_string ($_POST['fMaxquota']);
- if (isset ($_POST['fTransport'])) $tTransport = escape_string ($_POST['fTransport']);
- if (isset ($_POST['fDefaultaliases'])) $tDefaultaliases = escape_string ($_POST['fDefaultaliases']);
- if (isset ($_POST['fBackupmx'])) $tBackupmx = escape_string ($_POST['fBackupmx']);
- if (domain_exist ($fDomain)) $pAdminCreate_domain_domain_text = $PALANG['pAdminCreate_domain_domain_text_error'];
- if (empty ($fDomain) or !check_domain ($fDomain)) $pAdminCreate_domain_domain_text = $PALANG['pAdminCreate_domain_domain_text_error2'];
- }
-
- if ($error != 1)
- {
- $tAliases = $CONF['aliases'];
- $tMailboxes = $CONF['mailboxes'];
- $tMaxquota = $CONF['maxquota'];
-
- if ($fBackupmx == "on")
- {
- $fAliases = -1;
- $fMailboxes = -1;
- $fMaxquota = -1;
- $fBackupmx = 1;
- $sqlBackupmx = ('pgsql'==$CONF['database_type']) ? 'true' : 1;
- }
- else
- {
- $fBackupmx = 0;
- $sqlBackupmx = ('pgsql'==$CONF['database_type']) ? 'false' : 0;
- }
- $sql_query = "INSERT INTO $table_domain (domain,description,aliases,mailboxes,maxquota,transport,backupmx,created,modified) VALUES ('$fDomain','$fDescription',$fAliases,$fMailboxes,$fMaxquota,'$fTransport',$sqlBackupmx,NOW(),NOW())";
- $result = db_query($sql_query);
- if ($result['rows'] != 1)
- {
- $tMessage = $PALANG['pAdminCreate_domain_result_error'] . "<br />($fDomain)<br />";
- }
- else
- {
- if ($fDefaultaliases == "on")
- {
- foreach ($CONF['default_aliases'] as $address=>$goto)
- {
- $address = $address . "@" . $fDomain;
- $result = db_query ("INSERT INTO $table_alias (address,goto,domain,created,modified) VALUES ('$address','$goto','$fDomain',NOW(),NOW())");
- }
- }
- $tMessage = $PALANG['pAdminCreate_domain_result_success'] . "<br />($fDomain)</br />";
- }
- }
-
- include ("../templates/header.tpl");
- include ("../templates/admin_menu.tpl");
- include ("../templates/admin_create-domain.tpl");
- include ("../templates/footer.tpl");
-/* vim: set expandtab softtabstop=3 tabstop=3 shiftwidth=3: */
-}
-?>
Deleted: trunk/admin/create-mailbox.php
===================================================================
--- trunk/admin/create-mailbox.php 2007-10-31 01:31:37 UTC (rev 167)
+++ trunk/admin/create-mailbox.php 2007-10-31 18:24:40 UTC (rev 168)
@@ -1,3 +0,0 @@
-<?php
-require ("../create-mailbox.php");
-?>
Deleted: trunk/admin/delete.php
===================================================================
--- trunk/admin/delete.php 2007-10-31 01:31:37 UTC (rev 167)
+++ trunk/admin/delete.php 2007-10-31 18:24:40 UTC (rev 168)
@@ -1,3 +0,0 @@
-<?php
-require('../delete.php');
-?>
Deleted: trunk/admin/edit-active-admin.php
===================================================================
--- trunk/admin/edit-active-admin.php 2007-10-31 01:31:37 UTC (rev 167)
+++ trunk/admin/edit-active-admin.php 2007-10-31 18:24:40 UTC (rev 168)
@@ -1,69 +0,0 @@
-<?php
-/**
- * Postfix Admin
- *
- * LICENSE
- * This source file is subject to the GPL license that is bundled with
- * this package in the file LICENSE.TXT.
- *
- * Further details on the project are available at :
- * http://www.postfixadmin.com or http://postfixadmin.sf.net
- *
- * @version $Id$
- * @license GNU GPL v2 or later.
- *
- * File: edit-active-admin.php
- * Edit an active administrator. This is used as a 'toggle' page from list-admin.
- *
- * Template File: message.tpl
- *
- * Template Variables:
- *
- * tMessage
- *
- * Form POST \ GET Variables:
- *
- * fUsername
- */
-
-require_once('../common.php');
-
-authentication_require_role('global-admin');
-
-if ($_SERVER['REQUEST_METHOD'] == "GET")
-{
- if (isset ($_GET['username'])) $fUsername = escape_string ($_GET['username']);
-
- $sqlSet='active=1-active';
- if ('pgsql'==$CONF['database_type']) $sqlSet='active=NOT active';
-
- $result = db_query ("UPDATE $table_admin SET $sqlSet,modified=NOW() WHERE username='$fUsername'");
- if ($result['rows'] != 1)
- {
- $error = 1;
- $tMessage = $PALANG['pAdminEdit_admin_result_error'];
- }
-
- if ($error != 1)
- {
- header ("Location: list-admin.php");
- exit;
- }
-
- include ("../templates/header.tpl");
- include ("../templates/admin_menu.tpl");
- include ("../templates/message.tpl");
- include ("../templates/footer.tpl");
-}
-
-if ($_SERVER['REQUEST_METHOD'] == "POST")
-{
- include ("../templates/header.tpl");
- include ("../templates/admin_menu.tpl");
- include ("../templates/message.tpl");
- include ("../templates/footer.tpl");
-}
-
-/* vim: set expandtab softtabstop=3 tabstop=3 shiftwidth=3: */
-
-?>
Deleted: trunk/admin/edit-active-domain.php
===================================================================
--- trunk/admin/edit-active-domain.php 2007-10-31 01:31:37 UTC (rev 167)
+++ trunk/admin/edit-active-domain.php 2007-10-31 18:24:40 UTC (rev 168)
@@ -1,67 +0,0 @@
-<?php
-/**
- * Postfix Admin
- *
- * LICENSE
- * This source file is subject to the GPL license that is bundled with
- * this package in the file LICENSE.TXT.
- *
- * Further details on the project are available at :
- * http://www.postfixadmin.com or http://postfixadmin.sf.net
- *
- * @version $Id$
- * @license GNU GPL v2 or later.
- *
- * File: edit-active-domain.php
- * Responsible for toggling the status of a domain
- * Template File: message.tpl
- *
- * Template Variables:
- *
- * tMessage
- *
- * Form POST \ GET Variables:
- *
- * fDomain
- */
-
-require_once('../common.php');
-
-authentication_require_role('global-admin');
-
-if ($_SERVER['REQUEST_METHOD'] == "GET")
-{
- if (isset ($_GET['domain'])) $fDomain = escape_string ($_GET['domain']);
-
- $sqlSet='active=1-active';
- if ('pgsql'==$CONF['database_type']) $sqlSet='active=NOT active';
-
- $result = db_query ("UPDATE $table_domain SET $sqlSet,modified=NOW() WHERE domain='$fDomain'");
- if ($result['rows'] != 1)
- {
- $error = 1;
- $tMessage = $PALANG['pAdminEdit_domain_result_error'];
- }
-
- if ($error != 1)
- {
- header ("Location: list-domain.php");
- exit;
- }
-
- include ("../templates/header.tpl");
- include ("../templates/admin_menu.tpl");
- include ("../templates/message.tpl");
- include ("../templates/footer.tpl");
-}
-
-if ($_SERVER['REQUEST_METHOD'] == "POST")
-{
- include ("../templates/header.tpl");
- include ("../templates/admin_menu.tpl");
- include ("../templates/message.tpl");
- include ("../templates/footer.tpl");
-}
-
-/* vim: set expandtab softtabstop=3 tabstop=3 shiftwidth=3: */
-?>
Deleted: trunk/admin/edit-active.php
===================================================================
--- trunk/admin/edit-active.php 2007-10-31 01:31:37 UTC (rev 167)
+++ trunk/admin/edit-active.php 2007-10-31 18:24:40 UTC (rev 168)
@@ -1,3 +0,0 @@
-<?php
-require("../edit-active.php");
-?>
Deleted: trunk/admin/edit-admin.php
===================================================================
--- trunk/admin/edit-admin.php 2007-10-31 01:31:37 UTC (rev 167)
+++ trunk/admin/edit-admin.php 2007-10-31 18:24:40 UTC (rev 168)
@@ -1,152 +0,0 @@
-<?php
-/**
- * Postfix Admin
- *
- * LICENSE
- * This source file is subject to the GPL license that is bundled with
- * this package in the file LICENSE.TXT.
- *
- * Further details on the project are available at :
- * http://www.postfixadmin.com or http://postfixadmin.sf.net
- *
- * @version $Id$
- * @license GNU GPL v2 or later.
- *
- * File: edit-admin.php
- * Edits a normal administrator's details.
- *
- * Template File: admin_edit-admin.tpl
- *
- * Template Variables:
- *
- * tAllDomains
- * tDomains
- * tActive
- * tSadmin
- *
- * Form POST \ GET Variables:
- *
- * fDescription
- * fAliases
- * fMailboxes
- * fMaxquota
- * fActive
- */
-
-require_once('../common.php');
-
-authentication_require_role('global-admin');
-
-$error = 1;
-if(isset($_GET['username'])) {
- $username = escape_string ($_GET['username']);
- $result = db_query("SELECT * FROM $table_admin WHERE username = '$username'");
- if($result['rows'] == 1) {
- $admin_details = db_array($result['result']);
- $error = 0;
- }
-}
-if($error == 1){
- flash_error($PALANG['pAdminEdit_admin_result_error']);
- header("Location: list-admin.php");
- exit(0);
-}
-
-// we aren't ensuring the password is longer than x characters, should we?
-if ($_SERVER['REQUEST_METHOD'] == "POST")
-{
- $fPassword = '';
- $fPassword2 = '';
- if(isset ($_POST['fPassword'])) $fPassword = escape_string ($_POST['fPassword']);
- if(isset ($_POST['fPassword2'])) $fPassword2 = escape_string ($_POST['fPassword2']);
-
-
- $fActive=(isset($_POST['fActive'])) ? escape_string ($_POST['fActive']) : FALSE;
- $fSadmin=(isset($_POST['fSadmin'])) ? escape_string ($_POST['fSadmin']) : FALSE;
-
- $fDomains = false;
- if (isset ($_POST['fDomains'])) $fDomains = $_POST['fDomains'];
-
- $tAllDomains = list_domains ();
-
- // has the password changed?
- $originalPassword = $admin_details['password'];
- if($fPassword != '') {
- if($fPassword != $originalPassword) {
- // if it has, ensure both fields are the same...
- if ($fPassword == $fPassword2)
- {
- if(strlen($fPassword) >= $CONF['min_password_length']) {
- $fPassword = pacrypt($fPassword);
- }
- else {
- $error = 1;
- flash_error(sprintf($PALANG['pPasswordTooShort'], $CONF['min_password_length']));
- }
- }
- else {
- $error = 1;
- $pAdminEdit_admin_password_text = $PALANG['pAdminEdit_admin_password_text_error'];
- }
- }
- }
- $fDomains = array();
- if (array_key_exists('fDomains', $_POST)) $fDomains = escape_string ($_POST['fDomains']);
- if ($error != 1)
- {
- if ($fActive == "on") {
- $sqlActive = db_get_boolean(True);
- }
- else {
- $sqlActive = db_get_boolean(False);
- }
-
- $result = db_query ("UPDATE $table_admin SET modified=NOW(),active='$sqlActive',password='$fPassword' WHERE username='$username'");
-
- if ($fSadmin == "on") $fSadmin = 'ALL';
-
- // delete everything, and put it back later on..
- db_query("DELETE FROM $table_domain_admins WHERE username = '$username'");
- if($fSadmin == 'ALL') {
- $fDomains = array('ALL');
- }
-
- foreach($fDomains as $domain)
- {
- $result = db_query ("INSERT INTO $table_domain_admins (username,domain,created) VALUES ('$username','$domain',NOW())");
- }
- flash_info($PALANG['pAdminEdit_admin_result_success']);
- header("Location: list-admin.php");
- exit(0);
- }
- else {
- flash_error($PALANG['pAdminEdit_admin_result_error']);
- }
-}
-if (isset($_GET['username'])) $username = escape_string ($_GET['username']);
-
-$tAllDomains = list_domains();
-$tDomains = list_domains_for_admin ($username);
-$tActive = '';
-$tPassword = $admin_details['password'];
-
-if($admin_details['active'] == 't' || $admin_details['active'] == 1) {
- $tActive = $admin_details['active'];
-}
-$tSadmin = '0';
-$result = db_query ("SELECT * FROM $table_domain_admins WHERE username='$username'");
-// could/should be multiple matches to query;
-if ($result['rows'] >= 1) {
- $result = $result['result'];
- while($row = db_array($result)) {
- if ($row['domain'] == 'ALL') {
- $tSadmin = '1';
- $tDomains = array(); /* empty the list, they're an admin */
- }
- }
-}
-
-include ("../templates/header.tpl");
-include ("../templates/admin_menu.tpl");
-include ("../templates/admin_edit-admin.tpl");
-include ("../templates/footer.tpl");
Deleted: trunk/admin/edit-alias.php
===================================================================
--- trunk/admin/edit-alias.php 2007-10-31 01:31:37 UTC (rev 167)
+++ trunk/admin/edit-alias.php 2007-10-31 18:24:40 UTC (rev 168)
@@ -1,3 +0,0 @@
-<?php
-require("../edit-alias.php");
-?>
Deleted: trunk/admin/edit-domain.php
===================================================================
--- trunk/admin/edit-domain.php 2007-10-31 01:31:37 UTC (rev 167)
+++ trunk/admin/edit-domain.php 2007-10-31 18:24:40 UTC (rev 168)
@@ -1,118 +0,0 @@
-<?php
-/**
- * Postfix Admin
- *
- * LICENSE
- * This source file is subject to the GPL license that is bundled with
- * this package in the file LICENSE.TXT.
- *
- * Further details on the project are available at :
- * http://www.postfixadmin.com or http://postfixadmin.sf.net
- *
- * @version $Id$
- * @license GNU GPL v2 or later.
- *
- * File: edit-domain.php
- * Updates the properties of a domain.
- * Template File: admin_edit-domain.tpl
- *
- * Template Variables:
- *
- * tDescription
- * tAliases
- * tMailboxes
- * tMaxquota
- * tActive
- *
- * Form POST \ GET Variables:
- *
- * fDescription
- * fAliases
- * fMailboxes
- * fMaxquota
- * fActive
- */
-
-require_once('../common.php');
-
-authentication_require_role('global-admin');
-
-if ($_SERVER['REQUEST_METHOD'] == "GET")
-{
- if (isset ($_GET['domain']))
- {
- $domain = escape_string ($_GET['domain']);
- $domain_properties = get_domain_properties ($domain);
-
- $tDescription = $domain_properties['description'];
- $tAliases = $domain_properties['aliases'];
- $tMailboxes = $domain_properties['mailboxes'];
- $tMaxquota = $domain_properties['maxquota'];
- $tTransport = $domain_properties['transport'];
- $tBackupmx = $domain_properties['backupmx'];
- $tActive = $domain_properties['active'];
- }
-
- include ("../templates/header.tpl");
- include ("../templates/admin_menu.tpl");
- include ("../templates/admin_edit-domain.tpl");
- include ("../templates/footer.tpl");
-}
-
-if ($_SERVER['REQUEST_METHOD'] == "POST")
-{
- if (isset ($_GET['domain'])) $domain = escape_string ($_GET['domain']);
-
- if (isset ($_POST['fDescription'])) $fDescription = escape_string ($_POST['fDescription']);
- if (isset ($_POST['fAliases'])) $fAliases = intval($_POST['fAliases']);
- if (isset ($_POST['fMailboxes'])) $fMailboxes = intval($_POST['fMailboxes']);
- if (isset ($_POST['fMaxquota'])) {
- $fMaxquota = intval($_POST['fMaxquota']);
- } else {
- $fMaxquota = 0;
- }
- if (isset ($_POST['fTransport'])) $fTransport = escape_string ($_POST['fTransport']);
- if (isset ($_POST['fBackupmx'])) $fBackupmx = escape_string ($_POST['fBackupmx']);
- if (isset ($_POST['fActive'])) $fActive = escape_string ($_POST['fActive']);
-
- if ($fBackupmx == "on")
- {
- $fAliases = -1;
- $fMailboxes = -1;
- $fMaxquota = -1;
- $fBackupmx = 1;
- $sqlBackupmx = db_get_boolean(True);
- }
- else
- {
- $fBackupmx = 0;
- $sqlBackupmx = db_get_boolean(False);
- }
-
- if ($fActive == "on") {
- $sqlActive = db_get_boolean(True);
- }
- else {
- $sqlActive = db_get_boolean(False);
- }
-
-
- $result = db_query ("UPDATE $table_domain SET description='$fDescription',aliases=$fAliases,mailboxes=$fMailboxes,maxquota=$fMaxquota,transport='$fTransport',backupmx='$sqlBackupmx',active='$sqlActive',modified=NOW() WHERE domain='$domain'");
- if ($result['rows'] == 1)
- {
- header ("Location: list-domain.php");
- exit;
- }
- else
- {
- $tMessage = $PALANG['pAdminEdit_domain_result_error'];
- }
-
- include ("../templates/header.tpl");
- include ("../templates/admin_menu.tpl");
- include ("../templates/admin_edit-domain.tpl");
- include ("../templates/footer.tpl");
-}
-
-/* vim: set expandtab softtabstop=3 tabstop=3 shiftwidth=3: */
-?>
Deleted: trunk/admin/edit-mailbox.php
===================================================================
--- trunk/admin/edit-mailbox.php 2007-10-31 01:31:37 UTC (rev 167)
+++ trunk/admin/edit-mailbox.php 2007-10-31 18:24:40 UTC (rev 168)
@@ -1,3 +0,0 @@
-<?php
-require("../edit-mailbox.php");
-?>
Deleted: trunk/admin/edit-vacation.php
===================================================================
--- trunk/admin/edit-vacation.php 2007-10-31 01:31:37 UTC (rev 167)
+++ trunk/admin/edit-vacation.php 2007-10-31 18:24:40 UTC (rev 168)
@@ -1,3 +0,0 @@
-<?php
-require ("../edit-vacation.php");
-?>
Modified: trunk/admin/index.php
===================================================================
--- trunk/admin/index.php 2007-10-31 01:31:37 UTC (rev 167)
+++ trunk/admin/index.php 2007-10-31 18:24:40 UTC (rev 168)
@@ -1,4 +1,4 @@
<?php
-header ("Location: list-admin.php");
+header ("Location: ../login.php");
exit(0);
?>
Deleted: trunk/admin/list-admin.php
===================================================================
--- trunk/admin/list-admin.php 2007-10-31 01:31:37 UTC (rev 167)
+++ trunk/admin/list-admin.php 2007-10-31 18:24:40 UTC (rev 168)
@@ -1,50 +0,0 @@
-<?php
-/**
- * Postfix Admin
- *
- * LICENSE
- * This source file is subject to the GPL license that is bundled with
- * this package in the file LICENSE.TXT.
- *
- * Further details on the project are available at :
- * http://www.postfixadmin.com or http://postfixadmin.sf.net
- *
- * @version $Id$
- * @license GNU GPL v2 or later.
- *
- * File: list-admin.php
- * Lists all administrators
- * Template File: list-admin.tpl
- *
- * Template Variables: -none-
- *
- * Form POST \ GET Variables: -none-
- */
-
-require_once("../common.php");
-
-authentication_require_role('global-admin');
-
-$list_admins = list_admins();
-if ((is_array ($list_admins) and sizeof ($list_admins) > 0)) {
- for ($i = 0; $i < sizeof ($list_admins); $i++) {
- $admin_properties[$i] = get_admin_properties ($list_admins[$i]);
- }
-}
-
-if ($_SERVER['REQUEST_METHOD'] == "GET")
-{
- include ("../templates/header.tpl");
- include ("../templates/admin_menu.tpl");
- include ("../templates/admin_list-admin.tpl");
- include ("../templates/footer.tpl");
-}
-
-if ($_SERVER['REQUEST_METHOD'] == "POST")
-{
- include ("../templates/header.tpl");
- include ("../templates/admin_menu.tpl");
- include ("../templates/admin_list-admin.tpl");
- include ("../templates/footer.tpl");
-}
-?>
Deleted: trunk/admin/list-domain.php
===================================================================
--- trunk/admin/list-domain.php 2007-10-31 01:31:37 UTC (rev 167)
+++ trunk/admin/list-domain.php 2007-10-31 18:24:40 UTC (rev 168)
@@ -1,83 +0,0 @@
-<?php
-/**
- * Postfix Admin
- *
- * LICENSE
- * This source file is subject to the GPL license that is bundled with
- * this package in the file LICENSE.TXT.
- *
- * Further details on the project are available at :
- * http://www.postfixadmin.com or http://postfixadmin.sf.net
- *
- * @version $Id$
- * @license GNU GPL v2 or later.
- *
- * File: list-domain.php
- * List all domains as a quick overview.
- * Template File: admin_list-domain.tpl
- *
- * Template Variables:
- *
- * -none-
- *
- * Form POST \ GET Variables:
- *
- * fUsername
- */
-
-require_once('../common.php');
-
-authentication_require_role('global-admin');
-
-$list_admins = list_admins ();
-
-if ($_SERVER['REQUEST_METHOD'] == "GET") {
- if (isset ($_GET['username'])) {
- $fUsername = escape_string ($_GET['username']);
- $list_domains = list_domains_for_admin ($fUsername);
- if ($list_domains != 0)
- {
- for ($i = 0; $i < sizeof ($list_domains); $i++)
- {
- $domain_properties[$i] = get_domain_properties ($list_domains[$i]);
- }
- }
- }
- else
- {
- $list_domains = list_domains ();
- if ((is_array ($list_domains) and sizeof ($list_domains) > 0))
- for ($i = 0; $i < sizeof ($list_domains); $i++)
- {
- $domain_properties[$i] = get_domain_properties ($list_domains[$i]);
- }
- }
-
- include ("../templates/header.tpl");
- include ("../templates/admin_menu.tpl");
- include ("../templates/admin_list-domain.tpl");
- include ("../templates/footer.tpl");
-}
-
-if ($_SERVER['REQUEST_METHOD'] == "POST")
-{
- if (isset ($_POST['fUsername']))
- {
- $fUsername = escape_string ($_POST['fUsername']);
- $list_domains = list_domains_for_admin ($fUsername);
- }
-
- if (!empty ($list_domains))
- {
- for ($i = 0; $i < sizeof ($list_domains); $i++)
- {
- $domain_properties[$i] = get_domain_properties ($list_domains[$i]);
- }
- }
-
- include ("../templates/header.tpl");
- include ("../templates/admin_menu.tpl");
- include ("../templates/admin_list-domain.tpl");
- include ("../templates/footer.tpl");
-}
-?>
Deleted: trunk/admin/list-virtual.php
===================================================================
--- trunk/admin/list-virtual.php 2007-10-31 01:31:37 UTC (rev 167)
+++ trunk/admin/list-virtual.php 2007-10-31 18:24:40 UTC (rev 168)
@@ -1,164 +0,0 @@
-<?php
-/**
- * Postfix Admin
- *
- * LICENSE
- * This source file is subject to the GPL license that is bundled with
- * this package in the file LICENSE.TXT.
- *
- * Further details on the project are available at :
- * http://www.postfixadmin.com or http://postfixadmin.sf.net
- *
- * @version $Id$
- * @license GNU GPL v2 or later.
- *
- * File: list-virtual.php
- * List virtual users for a domain.
- *
- * Template File: overview.tpl
- *
- * Template Variables:
- *
- * tMessage
- * tAlias
- * tMailbox
- *
- * Form POST \ GET Variables:
- *
- * fDomain
- * fDisplay
- */
-
-require_once('../common.php');
-
-authentication_require_role('global-admin');
-
-$list_domains = list_domains ();
-
-
-$tAlias = array();
-$tMailbox = array();
-$fDisplay = 0;
-$page_size = $CONF['page_size'];
-
-if ($_SERVER['REQUEST_METHOD'] == "GET")
-{
- if (isset ($_GET['domain'])) $fDomain = escape_string ($_GET['domain']);
- if (isset ($_GET['limit'])) $fDisplay = intval ($_GET['limit']);
-}
-else
-{
- if (isset ($_POST['fDomain'])) $fDomain = escape_string ($_POST['fDomain']);
- if (isset ($_POST['limit'])) $fDisplay = intval ($_POST['limit']);
-}
-
-
-if ((is_array ($list_domains) and sizeof ($list_domains) > 0)) if (empty ($fDomain)) $fDomain = $list_domains[0];
-
-
-if ((is_array ($list_domains) and sizeof ($list_domains) > 0)) if (empty ($fDomain)) $fDomain = $list_domains[1];
-
-$query = "SELECT $table_alias.address,$table_alias.goto,$table_alias.modified,$table_alias.active FROM $table_alias LEFT JOIN $table_mailbox ON $table_alias.address=$table_mailbox.username WHERE $table_alias.domain='$fDomain' AND $table_mailbox.maildir IS NULL ORDER BY $table_alias.address LIMIT $fDisplay, $page_size";
-if ('pgsql'==$CONF['database_type'])
-{
- $query = "SELECT address,goto,extract(epoch from modified) as modified,active FROM $table_alias WHERE domain='$fDomain' AND NOT EXISTS(SELECT 1 FROM $table_mailbox WHERE username=$table_alias.address) ORDER BY address LIMIT $page_size OFFSET $fDisplay";
-}
-
-$result = db_query ($query);
-if ($result['rows'] > 0)
-{
- while ($row = db_array ($result['result']))
- {
- if ('pgsql'==$CONF['database_type'])
- {
- $row['modified']=gmstrftime('%c %Z',$row['modified']);
- $row['active']=('t'==$row['active']) ? 1 : 0;
- }
- $tAlias[] = $row;
- }
-}
-
-if ($CONF['vacation_control_admin'] == 'YES')
-{
- $query = ("SELECT $table_mailbox.*, $table_vacation.active AS v_active FROM $table_mailbox LEFT JOIN $table_vacation ON $table_mailbox.username=$table_vacation.email WHERE $table_mailbox.domain='$fDomain' ORDER BY $table_mailbox.username LIMIT $fDisplay, $page_size");
- if ('pgsql'==$CONF['database_type'])
- {
- $query = "SELECT *,extract(epoch from created) as uts_created,extract(epoch from modified) as uts_modified FROM $table_mailbox WHERE domain='$fDomain' ORDER BY username LIMIT $page_size OFFSET $fDisplay";
- }
-}
-else
-{
-
- $query = "SELECT * FROM $table_mailbox WHERE domain='$fDomain' ORDER BY username LIMIT $fDisplay, $page_size";
- if ('pgsql'==$CONF['database_type'])
- {
- $query = "SELECT *,extract(epoch from created) as uts_created,extract(epoch from modified) as uts_modified FROM $table_mailbox WHERE domain='$fDomain' ORDER BY username LIMIT $page_size OFFSET $fDisplay";
- }
-
-}
-$result = db_query ($query);
-if ($result['rows'] > 0)
-{
- while ($row = db_array ($result['result']))
- {
- if ('pgsql'==$CONF['database_type'])
- {
- $row['created']=gmstrftime('%c %Z',$row['uts_created']);
- $row['modified']=gmstrftime('%c %Z',$row['uts_modified']);
- $row['active']=('t'==$row['active']) ? 1 : 0;
- $row['v_active'] = 1; // default to off...
- if(isset($row['v_active'])) { /* key may not be present in results due to query from above */
- $row['v_active']=('t'==$row['v_active']) ? 1 : 0;
- }
- }
- $tMailbox[] = $row;
- }
-}
-
-$tCanAddAlias = false;
-$tCanAddMailbox = false;
-
-$limit = get_domain_properties($fDomain);
-if (isset ($limit)) {
- if ($fDisplay >= $page_size) {
- $tDisplay_back_show = 1;
- $tDisplay_back = $fDisplay - $page_size;
- }
- if (($limit['alias_count'] > $page_size) or ($limit['mailbox_count'] > $page_size)) {
- $tDisplay_up_show = 1;
- }
- if ((($fDisplay + $page_size) < $limit['alias_count']) or
- (($fDisplay + $page_size) < $limit['mailbox_count']))
- {
- $tDisplay_next_show = 1;
- $tDisplay_next = $fDisplay + $page_size;
- }
-
- $active = $limit['active'];
- if($active == 't' || $active == 1) {
- $backup_mx = $limit['backupmx'];
- if($backup_mx == 'f' || $backup_mx == 0) {
- if($limit['aliases'] == 0) {
- $tCanAddAlias = true;
- }
- elseif($limit['alias_count'] < $limit['aliases']) {
- $tCanAddAlias = true;
- }
- if($limit['mailboxes'] == 0) {
- $tCanAddMailbox = true;
- }
- elseif($limit['mailbox_count'] < $limit['mailboxes']) {
- $tCanAddMailbox = true;
- }
- }
- }
-}
-
-
-include ("../templates/header.tpl");
-include ("../templates/admin_menu.tpl");
-include ("../templates/overview.tpl");
-include ("../templates/footer.tpl");
-
-/* vim: set expandtab softtabstop=3 tabstop=3 shiftwidth=3: */
-?>
Deleted: trunk/admin/main.php
===================================================================
--- trunk/admin/main.php 2007-10-31 01:31:37 UTC (rev 167)
+++ trunk/admin/main.php 2007-10-31 18:24:40 UTC (rev 168)
@@ -1,4 +0,0 @@
-<?php
-header ("Location: list-admin.php");
-exit;
-?>
Deleted: trunk/admin/search.php
===================================================================
--- trunk/admin/search.php 2007-10-31 01:31:37 UTC (rev 167)
+++ trunk/admin/search.php 2007-10-31 18:24:40 UTC (rev 168)
@@ -1,180 +0,0 @@
-<?php
-/**
- * Postfix Admin
- *
- * LICENSE
- * This source file is subject to the GPL license that is bundled with
- * this package in the file LICENSE.TXT.
- *
- * Further details on the project are available at :
- * http://www.postfixadmin.com or http://postfixadmin.sf.net
- *
- * @version $Id$
- * @license GNU GPL v2 or later.
- *
- * File: search.php
- * Allows for search by e.g. name, mailbox name etc.
- * Template File: search.tpl
- *
- * Template Variables:
- *
- * tAlias
- * tMailbox
- *
- * Form POST \ GET Variables:
- *
- * search
- * fDomain
- * fGo
- */
-
-require_once('../common.php');
-
-require_once('../search.php');
-
-/*
-authentication_require_role('global-admin');
-
-$tAlias = array();
-$tMailbox = array();
-$list_domains = list_domains ();
-
-
-if ($_SERVER['REQUEST_METHOD'] == "GET")
-{
- if (isset ($_GET['search'])) $fSearch = escape_string ($_GET['search']);
-
- if ($CONF['alias_control'] == "YES")
- {
- $query = "SELECT address,goto,modified,domain,active FROM $table_alias WHERE address LIKE '%$fSearch%' OR goto LIKE '%$fSearch%' ORDER BY address";
- if ('pgsql'==$CONF['database_type'])
- {
- $query = "SELECT address,goto,extract (epoch from modified) as modified,domain,active FROM $table_alias WHERE address LIKE '%$fSearch%' OR goto LIKE '%$fSearch%' ORDER BY address";
- }
- }
- else
- {
- $query = "SELECT $table_alias.address,$table_alias.goto,$table_alias.modified,$table_alias.domain,$table_alias.active FROM $table_alias LEFT JOIN $table_mailbox ON $table_alias.address=$table_mailbox.username WHERE $table_alias.address LIKE '%$fSearch%' AND $table_mailbox.maildir IS NULL ORDER BY $table_alias.address";
- if ('pgsql'==$CONF['database_type'])
- {
- $query = "SELECT address,goto,extract(epoch from modified) as modified,domain,active FROM $table_alias WHERE address LIKE '%$fSearch%' AND NOT EXISTS(SELECT 1 FROM $table_mailbox WHERE username=$table_alias.address) ORDER BY address";
- }
- }
-
- $result = db_query ("$query");
-
- if ($result['rows'] > 0)
- {
- while ($row = db_array ($result['result']))
- {
- if ('pgsql'==$CONF['database_type'])
- {
- $row['modified'] = gmstrftime('%c %Z',$row['modified']);
- $row['active']=('t'==$row['active']) ? 1 : 0;
- }
- $tAlias[] = $row;
- }
- }
-
- $query = "SELECT * FROM $table_mailbox WHERE username LIKE '%$fSearch%' OR name LIKE '%$fSearch%' ORDER BY username";
- if ('pgsql'==$CONF['database_type'])
- {
- $query = "SELECT *,extract(epoch from created) as uts_created,extract(epoch from modified) as uts_modified FROM $table_mailbox WHERE username LIKE '%$fSearch%' OR name LIKE '%$fSearch%' ORDER BY username";
- }
- $result = db_query ($query);
- if ($result['rows'] > 0)
- {
- while ($row = db_array ($result['result']))
- {
- if ('pgsql'==$CONF['database_type'])
- {
- $row['created']=gmstrftime('%c %Z',$row['uts_created']);
- $row['modified']=gmstrftime('%c %Z',$row['uts_modified']);
- $row['active']=('t'==$row['active']) ? 1 : 0;
- unset($row['uts_created']);
- unset($row['uts_modified']);
- }
- $tMailbox[] = $row;
- }
- }
-
- include ("../templates/header.tpl");
- include ("../templates/admin_menu.tpl");
- include ("../templates/search.tpl");
- include ("../templates/footer.tpl");
-}
-
-if ($_SERVER['REQUEST_METHOD'] == "POST")
-{
- if (isset ($_POST['search'])) $fSearch = escape_string ($_POST['search']);
- if (isset ($_POST['fGo'])) $fGo = escape_string ($_POST['fGo']);
- if (isset ($_POST['fDomain'])) $fDomain = escape_string ($_POST['fDomain']);
-
- if (empty ($fSearch) && !empty ($fGo))
- {
- header("Location: list-virtual.php?domain=" . $fDomain ) && exit;
- }
-
-
- if ($CONF['alias_control'] == "YES")
- {
- $query = "SELECT address,goto,modified,domain,active FROM $table_alias WHERE address LIKE '%$fSearch%' OR goto LIKE '%$fSearch%' ORDER BY address";
- if ('pgsql'==$CONF['database_type'])
- {
- $query = "SELECT address,goto,extract (epoch from modified) as modified,domain,active FROM $table_alias WHERE address LIKE '%$fSearch%' OR goto LIKE '%$fSearch%' ORDER BY address";
- }
- }
- else
- {
- $query = "SELECT $table_alias.address,$table_alias.goto,$table_alias.modified,$table_alias.domain,$table_alias.active FROM $table_alias LEFT JOIN $table_mailbox ON $table_alias.address=$table_mailbox.username WHERE $table_alias.address LIKE '%$fSearch%' AND $table_mailbox.maildir IS NULL ORDER BY $table_alias.address";
- if ('pgsql'==$CONF['database_type'])
- {
- $query = "SELECT $table_alias.address,$table_alias.goto,extract(epoch from $table_alias.modified) as $table_modified,$table_alias.domain,$table_alias.active FROM $table_alias LEFT JOIN $table_mailbox ON $table_alias.address=$table_mailbox.username WHERE $table_alias.address LIKE '%$fSearch%' AND $table_mailbox.maildir IS NULL ORDER BY $table_alias.address";
- }
- }
-
- $result = db_query ("$query");
-
- if ($result['rows'] > 0)
- {
- while ($row = db_array ($result['result']))
- {
- if ('pgsql'==$CONF['database_type'])
- {
- $row['modified'] = gmstrftime('%c %Z',$row['modified']);
- $row['active']=('t'==$row['active']) ? 1 : 0;
- }
- $tAlias[] = $row;
- }
- }
-
- $query = "SELECT * FROM $table_mailbox WHERE username LIKE '%$fSearch%' OR name LIKE '%$fSearch%' ORDER BY username";
- if ('pgsql'==$CONF['database_type'])
- {
- $query = "SELECT *,extract(epoch from created) as uts_created,extract(epoch from modified) as uts_modified FROM $table_mailbox WHERE username LIKE '%$fSearch%' OR name LIKE '%$fSearch%' ORDER BY username";
- }
- $result = db_query ("$query");
- if ($result['rows'] > 0)
- {
- while ($row = db_array ($result['result']))
- {
- if ('pgsql'==$CONF['database_type'])
- {
- $row['created']=gmstrftime('%c %Z',$row['uts_created']);
- $row['modified']=gmstrftime('%c %Z',$row['uts_modified']);
- $row['active']=('t'==$row['active']) ? 1 : 0;
- unset($row['uts_created']);
- unset($row['uts_modified']);
- }
- $tMailbox[] = $row;
- }
- }
-
- include ("../templates/header.tpl");
- include ("../templates/admin_menu.tpl");
- include ("../templates/search.tpl");
- include ("../templates/footer.tpl");
-}
-*/
-/* vim: set expandtab softtabstop=3 tabstop=3 shiftwidth=3: */
-?>
Deleted: trunk/admin/viewlog.php
===================================================================
--- trunk/admin/viewlog.php 2007-10-31 01:31:37 UTC (rev 167)
+++ trunk/admin/viewlog.php 2007-10-31 18:24:40 UTC (rev 168)
@@ -1,3 +0,0 @@
-<?php
-require("../viewlog.php");
-?>
Copied: trunk/backup.php (from rev 164, trunk/admin/backup.php)
===================================================================
--- trunk/backup.php (rev 0)
+++ trunk/backup.php 2007-10-31 18:24:40 UTC (rev 168)
@@ -0,0 +1,118 @@
+<?php
+/**
+ * Postfix Admin
+ *
+ * LICENSE
+ * This source file is subject to the GPL license that is bundled with
+ * this package in the file LICENSE.TXT.
+ *
+ * Further details on the project are available at :
+ * http://www.postfixadmin.com or http://postfixadmin.sf.net
+ *
+ * @version $Id$
+ * @license GNU GPL v2 or later.
+ *
+ * File: backup.php
+ * Used to save all settings - but only works for MySQL databases.
+ * Template File: -none-
+ *
+ * Template Variables: -none-
+ *
+ * Form POST \ GET Variables: -none-
+ */
+
+require_once('common.php');
+
+authentication_require_role('global-admin');
+
+(($CONF['backup'] == 'NO') ? header("Location: " . $CONF['postfix_admin_url'] . "/main.php") && exit : '1');
+
+// TODO: make backup supported for postgres
+if ('pgsql'==$CONF['database_type'])
+{
+ print '<p>Sorry: Backup is currently not supported for your DBMS.</p>';
+}
+/*
+ SELECT attnum,attname,typname,atttypmod-4,attnotnull,atthasdef,adsrc
+ AS def FROM pg_attribute,pg_class,pg_type,pg_attrdef
+ WHERE pg_class.oid=attrelid AND pg_type.oid=atttypid
+ AND attnum>0 AND pg_class.oid=adrelid AND adnum=attnum AND atthasdef='t' AND lower(relname)='admin'
+ UNION SELECT attnum,attname,typname,atttypmod-4,attnotnull,atthasdef,''
+ AS def FROM pg_attribute,pg_class,pg_type
+ WHERE pg_class.oid=attrelid
+ AND pg_type.oid=atttypid
+ AND attnum>0
+ AND atthasdef='f'
+ AND lower(relname)='admin'
+$db = $_GET['db'];
+$cmd = "pg_dump -c -D -f /tix/miner/miner.sql -F p -N -U postgres $db";
+$res = `$cmd`;
+// Alternate: $res = shell_exec($cmd);
+echo $res;
+*/
+
+if ($_SERVER['REQUEST_METHOD'] == "GET")
+{
+ umask (077);
+ $path = (ini_get('upload_tmp_dir') != '') ? ini_get('upload_tmp_dir') : '/tmp/';
+ $filename = "postfixadmin-" . date ("Ymd") . "-" . getmypid() . ".sql";
+ $backup = $path . $filename;
+
+ $header = "#\n# Postfix Admin $version\n# Date: " . date ("D M j G:i:s T Y") . "\n#\n";
+
+ if (!$fh = fopen ($backup, 'w'))
+ {
+ $tMessage = "<div class=\"error_msg\">Cannot open file ($backup)</div>";
+ include ("templates/header.tpl");
+ include ("templates/menu.tpl");
+ include ("templates/message.tpl");
+ include ("templates/footer.tpl");
+ }
+ else
+ {
+ fwrite ($fh, $header);
+
+ $tables = array('admin','alias','domain','domain_admins','log','mailbox','vacation');
+
+ for ($i = 0 ; $i < sizeof ($tables) ; ++$i)
+ {
+ $result = db_query ("SHOW CREATE TABLE ".table_by_pos($i));
+ if ($result['rows'] > 0)
+ {
+ while ($row = db_array ($result['result']))
+ {
+ fwrite ($fh, "$row[1];\n\n");
+ }
+ }
+ }
+
+ for ($i = 0 ; $i < sizeof ($tables) ; ++$i)
+ {
+ $result = db_query ("SELECT * FROM ".table_by_pos($i));
+ if ($result['rows'] > 0)
+ {
+ while ($row = db_assoc ($result['result']))
+ {
+ foreach ($row as $key=>$val)
+ {
+ $fields[] = $key;
+ $values[] = $val;
+ }
+
+ fwrite ($fh, "INSERT INTO ". $tables[$i] . " (". implode (',',$fields) . ") VALUES ('" . implode ('\',\'',$values) . "');\n");
+ $fields = "";
+ $values = "";
+ }
+ }
+ }
+ }
+ header ("Content-Type: application/octet-stream");
+ header ("Content-Disposition: attachment; filename=\"$filename\"");
+ header ("Content-Transfer-Encoding: binary");
+ header ("Content-Length: " . filesize("$backup"));
+ header ("Content-Description: Postfix Admin");
+ $download_backup = fopen ("$backup", "r");
+ unlink ("$backup");
+ fpassthru ($download_backup);
+}
+?>
Copied: trunk/broadcast-message.php (from rev 164, trunk/admin/broadcast-message.php)
===================================================================
--- trunk/broadcast-message.php (rev 0)
+++ trunk/broadcast-message.php 2007-10-31 18:24:40 UTC (rev 168)
@@ -0,0 +1,92 @@
+<?php
+/**
+ * Postfix Admin
+ *
+ * LICENSE
+ * This source file is subject to the GPL license that is bundled with
+ * this package in the file LICENSE.TXT.
+ *
+ * Further details on the project are available at :
+ * http://www.postfixadmin.com or http://postfixadmin.sf.net
+ *
+ * @version $Id$
+ * @license GNU GPL v2 or later.
+ *
+ * File: broadcast-message.php
+ * Used to send a message to _ALL_ users with mailboxes on this server.
+ *
+ * Template File: broadcast-message.tpl
+ *
+ * Template Variables: -none-
+ *
+ * Form POST \ GET Variables:
+ *
+ * name
+ * subject
+ * message
+ */
+
+require_once('common.php');
+
+authentication_require_role('global-admin');
+
+$SESSID_USERNAME = authentication_get_username();
+
+if ($_SERVER['REQUEST_METHOD'] == "POST")
+{
+ if (empty($_POST['subject']) || empty($_POST['message']) || empty($_POST['name']))
+ {
+ $error = 1;
+ }
+ else
+ {
+ $q = 'select username from mailbox union '.
+ 'select goto from alias '.
+ 'where goto not in (select username from mailbox)';
+
+ $result = db_query ($q);
+ if ($result['rows'] > 0)
+ {
+ $b_name = mb_encode_mimeheader( $_POST['name'], 'UTF-8', 'Q');
+ $b_subject = mb_encode_mimeheader( $_POST['subject'], 'UTF-8', 'Q');
+ $b_message = encode_base64($_POST['message']);
+
+ $i = 0;
+ while ($row = db_array ($result['result'])) {
+ $fTo = $row[0];
+ $fHeaders = 'To: ' . $fTo . "\n";
+ $fHeaders .= 'From: ' . $b_name . ' <' . $CONF['admin_email'] . ">\n";
+ $fHeaders .= 'Subject: ' . $b_subject . "\n";
+ $fHeaders .= 'MIME-Version: 1.0' . "\n";
+ $fHeaders .= 'Content-Type: text/plain; charset=UTF-8' . "\n";
+ $fHeaders .= 'Content-Transfer-Encoding: base64' . "\n";
+
+ $fHeaders .= $b_message;
+
+ if (!smtp_mail ($fTo, $CONF['admin_email'], $fHeaders))
+ {
+ $tMessage .= "<br />" . $PALANG['pSendmail_result_error'] . "<br />";
+ }
+ else
+ {
+ $tMessage .= "<br />" . $PALANG['pSendmail_result_success'] . "<br />";
+ }
+ }
+ }
+ include ("templates/header.tpl");
+ include ("templates/menu.tpl");
+ echo '<p>'.$PALANG['pBroadcast_success'].'</p>';
+ include ("templates/footer.tpl");
+ }
+}
+
+if ($_SERVER['REQUEST_METHOD'] == "GET" || $error == 1)
+{
+ include ("templates/header.tpl");
+ include ("templates/menu.tpl");
+ include ("templates/broadcast-message.tpl");
+ include ("templates/footer.tpl");
+}
+
+/* vim: set expandtab softtabstop=3 tabstop=3 shiftwidth=3: */
+?>
Copied: trunk/create-admin.php (from rev 164, trunk/admin/create-admin.php)
===================================================================
--- trunk/create-admin.php (rev 0)
+++ trunk/create-admin.php 2007-10-31 18:24:40 UTC (rev 168)
@@ -0,0 +1,69 @@
+<?php
+/**
+ * Postfix Admin
+ *
+ * LICENSE
+ * This source file is subject to the GPL license that is bundled with
+ * this package in the file LICENSE.TXT.
+ *
+ * Further details on the project are available at :
+ * http://www.postfixadmin.com or http://postfixadmin.sf.net
+ *
+ * @version $Id$
+ * @license GNU GPL v2 or later.
+ *
+ * File: create-admin.php
+ * Used to create new administrators.
+ * Template File: admin_create-admin.tpl
+ *
+ *
+ * Template Variables:
+ *
+ * tMessage
+ * tUsername
+ * tDomains
+ *
+ * Form POST \ GET Variables:
+ *
+ * fUsername
+ * fPassword
+ * fPassword2
+ * fDomains
+ */
+
+require_once('common.php');
+
+authentication_require_role('global-admin');
+
+$list_domains = list_domains ();
+$tDomains = array();
+
+if ($_SERVER['REQUEST_METHOD'] == "GET")
+{
+ $pAdminCreate_admin_username_text = $PALANG['pAdminCreate_admin_username_text'];
+ $tDomains = array ();
+}
+
+if ($_SERVER['REQUEST_METHOD'] == "POST")
+{
+ if (isset ($_POST['fUsername'])) $fUsername = escape_string ($_POST['fUsername']);
+ if (isset ($_POST['fPassword'])) $fPassword = escape_string ($_POST['fPassword']);
+ if (isset ($_POST['fPassword2'])) $fPassword2 = escape_string ($_POST['fPassword2']);
+ $fDomains = array();
+ if (!empty ($_POST['fDomains'])) $fDomains = $_POST['fDomains'];
+
+ list ($error, $tMessage, $pAdminCreate_admin_username_text, $pAdminCreate_admin_password_text) = create_admin($fUsername, $fPassword, $fPassword2, $fDomains);
+
+ if ($error != 0) {
+ if (isset ($_POST['fUsername'])) $tUsername = escape_string ($_POST['fUsername']);
+ if (isset ($_POST['fDomains'])) $tDomains = $_POST['fDomains'];
+ }
+}
+
+include ("templates/header.tpl");
+include ("templates/menu.tpl");
+include ("templates/admin_create-admin.tpl");
+include ("templates/footer.tpl");
+
+/* vim: set expandtab softtabstop=3 tabstop=3 shiftwidth=3: */
+?>
Modified: trunk/create-alias.php
===================================================================
--- trunk/create-alias.php 2007-10-31 01:31:37 UTC (rev 167)
+++ trunk/create-alias.php 2007-10-31 18:24:40 UTC (rev 168)
@@ -153,13 +153,7 @@
}
include ("$incpath/templates/header.tpl");
-
-if (authentication_has_role('global-admin')) {
- include ("$incpath/templates/admin_menu.tpl");
-} else {
- include ("$incpath/templates/menu.tpl");
-}
-
+include ("$incpath/templates/menu.tpl");
include ("$incpath/templates/create-alias.tpl");
include ("$incpath/templates/footer.tpl");
?>
Copied: trunk/create-domain.php (from rev 164, trunk/admin/create-domain.php)
===================================================================
--- trunk/create-domain.php (rev 0)
+++ trunk/create-domain.php 2007-10-31 18:24:40 UTC (rev 168)
@@ -0,0 +1,125 @@
+<?php
+/**
+ * Postfix Admin
+ *
+ * LICENSE
+ * This source file is subject to the GPL license that is bundled with
+ * this package in the file LICENSE.TXT.
+ *
+ * Further details on the project are available at :
+ * http://www.postfixadmin.com or http://postfixadmin.sf.net
+ *
+ * @version $Id$
+ * @license GNU GPL v2 or later.
+ *
+ * File: create-domain.php
+ * Allows administrators to create new domains.
+ * Template File: admin_create-domain.tpl
+ *
+ * Template Variables:
+ *
+ * tMessage
+ * tDomain
+ * tDescription
+ * tAliases
+ * tMailboxes
+ * tMaxquota
+ * tDefaultaliases
+ *
+ * Form POST \ GET Variables:
+ *
+ * fDomain
+ * fDescription
+ * fAliases
+ * fMailboxes
+ * fMaxquota
+ * fDefaultaliases
+ */
+
+require_once('common.php');
+
+authentication_require_role('global-admin');
+
+
+if ($_SERVER['REQUEST_METHOD'] == "GET")
+{
+ $tAliases = $CONF['aliases'];
+ $tMailboxes = $CONF['mailboxes'];
+ $tMaxquota = $CONF['maxquota'];
+ $tTransport = $CONF['transport_default'];
+}
+
+if ($_SERVER['REQUEST_METHOD'] == "POST")
+{
+ if (isset ($_POST['fDomain'])) $fDomain = escape_string ($_POST['fDomain']);
+ foreach(array('fDescription' => '', 'fAliases' => '0', 'fMailboxes' => '0',
+ 'fMaxquota' => '0', 'fTransport' => 'virtual',
+ 'fDefaultaliases' => '0', 'fBackupmx' => '0') as $key => $default) {
+ if(isset($_POST[$key]) && !empty($POST[$key])) {
+ $$key = escape_string($_POST[$key]);
+ }
+ $$key = $default;
+ }
+
+ if (empty ($fDomain) or domain_exist ($fDomain) or !check_domain ($fDomain))
+ {
+ $error = 1;
+ $tDomain = escape_string ($_POST['fDomain']);
+ $tDescription = escape_string ($_POST['fDescription']);
+ $tAliases = escape_string ($_POST['fAliases']);
+ $tMailboxes = escape_string ($_POST['fMailboxes']);
+ if (isset ($_POST['fMaxquota'])) $tMaxquota = escape_string ($_POST['fMaxquota']);
+ if (isset ($_POST['fTransport'])) $tTransport = escape_string ($_POST['fTransport']);
+ if (isset ($_POST['fDefaultaliases'])) $tDefaultaliases = escape_string ($_POST['fDefaultaliases']);
+ if (isset ($_POST['fBackupmx'])) $tBackupmx = escape_string ($_POST['fBackupmx']);
+ if (domain_exist ($fDomain)) $pAdminCreate_domain_domain_text = $PALANG['pAdminCreate_domain_domain_text_error'];
+ if (empty ($fDoma...
[truncated message content] |