SF.net SVN: postfixadmin:[419] trunk
Brought to you by:
christian_boltz,
gingerdog
|
From: <chr...@us...> - 2008-07-27 19:06:50
|
Revision: 419
http://postfixadmin.svn.sourceforge.net/postfixadmin/?rev=419&view=rev
Author: christian_boltz
Date: 2008-07-27 19:06:55 +0000 (Sun, 27 Jul 2008)
Log Message:
-----------
config.inc.php + all files related to alias domains
- added $CONF['alias_domain'] switch to disable alias domains
(includes lots of whitespace changes in list-virtual.php)
functions.php:
- added some comments to boolconf()
Modified Paths:
--------------
trunk/config.inc.php
trunk/create-alias-domain.php
trunk/functions.inc.php
trunk/list-virtual.php
trunk/templates/list-virtual.php
trunk/templates/menu.php
Modified: trunk/config.inc.php
===================================================================
--- trunk/config.inc.php 2008-07-27 18:48:41 UTC (rev 418)
+++ trunk/config.inc.php 2008-07-27 19:06:55 UTC (rev 419)
@@ -195,6 +195,13 @@
// '0' means no limits.
$CONF['alias_goto_limit'] = '0';
+// Alias Domains
+// Alias domains allow to "mirror" aliases and mailboxes to another domain. This makes
+// configuration easier, but also requires postfix to do more database queries.
+// Note: If you update from 2.2.x or earlier, you will have to update your postfix config.
+// Set to 'NO' to disable alias domains.
+$CONF['alias_domain'] = 'YES';
+
// Backup
// If you don't want backup tab set this to 'NO';
$CONF['backup'] = 'YES';
Modified: trunk/create-alias-domain.php
===================================================================
--- trunk/create-alias-domain.php 2008-07-27 18:48:41 UTC (rev 418)
+++ trunk/create-alias-domain.php 2008-07-27 19:06:55 UTC (rev 419)
@@ -32,6 +32,12 @@
require_once('common.php');
authentication_require_role('admin');
+
+if (!boolconf['alias_domain']) {
+ header("Location: " . $CONF['postfix_admin_url'] . "/main.php");
+ exit;
+}
+
$username = authentication_get_username();
$SESSID_USERNAME = $username;
if(authentication_has_role('global-admin')) {
Modified: trunk/functions.inc.php
===================================================================
--- trunk/functions.inc.php 2008-07-27 18:48:41 UTC (rev 418)
+++ trunk/functions.inc.php 2008-07-27 19:06:55 UTC (rev 419)
@@ -2189,6 +2189,7 @@
/*
Convert $CONF['whatever'] to boolean
+ (obviously only useful for settings that can be YES or NO)
Returns: TRUE (on YES/yes) or FALSE (on NO/no/not set/unknown value)
*/
@@ -2196,11 +2197,12 @@
function boolconf($setting) {
global $CONF;
if (!isset($CONF[$setting])) { # not set
+ # TODO: show/log error message on unknown settings?
return false;
} elseif (strtoupper($CONF[$setting]) == 'YES') { # YES
return true;
} else { # NO, unknown value
- # TODO: show error on unknown value?
+ # TODO: show/log error message on unknown value?
return false;
}
}
Modified: trunk/list-virtual.php
===================================================================
--- trunk/list-virtual.php 2008-07-27 18:48:41 UTC (rev 418)
+++ trunk/list-virtual.php 2008-07-27 19:06:55 UTC (rev 419)
@@ -73,50 +73,51 @@
}
-# Alias-Domains
-# first try to get a list of other domains pointing
-# to this currently chosen one (aka. alias domains)
-$query = "SELECT $table_alias_domain.alias_domain,$table_alias_domain.target_domain,$table_alias_domain.modified,$table_alias_domain.active FROM $table_alias_domain WHERE target_domain='$fDomain' ORDER BY $table_alias_domain.alias_domain LIMIT $fDisplay, $page_size";
-if ('pgsql'==$CONF['database_type'])
-{
- $query = "SELECT alias_domain,target_domain,extract(epoch from modified) as modified,active FROM $table_alias_domain WHERE target_domain='$fDomain' ORDER BY alias_domain LIMIT $page_size OFFSET $fDisplay";
-}
-$result = db_query ($query);
-$tAliasDomains = array();
-if ($result['rows'] > 0)
-{
- while ($row = db_array ($result['result']))
+if (boolconf('alias_domain')) {
+ # Alias-Domains
+ # first try to get a list of other domains pointing
+ # to this currently chosen one (aka. alias domains)
+ $query = "SELECT $table_alias_domain.alias_domain,$table_alias_domain.target_domain,$table_alias_domain.modified,$table_alias_domain.active FROM $table_alias_domain WHERE target_domain='$fDomain' ORDER BY $table_alias_domain.alias_domain LIMIT $fDisplay, $page_size";
+ if ('pgsql'==$CONF['database_type'])
{
- if ('pgsql'==$CONF['database_type'])
+ $query = "SELECT alias_domain,target_domain,extract(epoch from modified) as modified,active FROM $table_alias_domain WHERE target_domain='$fDomain' ORDER BY alias_domain LIMIT $page_size OFFSET $fDisplay";
+ }
+ $result = db_query ($query);
+ $tAliasDomains = array();
+ if ($result['rows'] > 0)
+ {
+ while ($row = db_array ($result['result']))
{
- $row['modified']=gmstrftime('%c %Z',$row['modified']);
- $row['active']=('t'==$row['active']) ? 1 : 0;
+ if ('pgsql'==$CONF['database_type'])
+ {
+ $row['modified']=gmstrftime('%c %Z',$row['modified']);
+ $row['active']=('t'==$row['active']) ? 1 : 0;
+ }
+ $tAliasDomains[] = $row;
}
- $tAliasDomains[] = $row;
+ }
+ # now let's see if the current domain itself is an alias for another domain
+ $query = "SELECT $table_alias_domain.alias_domain,$table_alias_domain.target_domain,$table_alias_domain.modified,$table_alias_domain.active FROM $table_alias_domain WHERE alias_domain='$fDomain'";
+ if ('pgsql'==$CONF['database_type'])
+ {
+ $query = "SELECT alias_domain,target_domain,extract(epoch from modified) as modified,active FROM $table_alias_domain WHERE alias_domain='$fDomain'";
}
-}
-# now let's see if the current domain itself is an alias for another domain
-$query = "SELECT $table_alias_domain.alias_domain,$table_alias_domain.target_domain,$table_alias_domain.modified,$table_alias_domain.active FROM $table_alias_domain WHERE alias_domain='$fDomain'";
-if ('pgsql'==$CONF['database_type'])
-{
- $query = "SELECT alias_domain,target_domain,extract(epoch from modified) as modified,active FROM $table_alias_domain WHERE alias_domain='$fDomain'";
-}
-$result = db_query ($query);
-$tTargetDomain = "";
-if ($result['rows'] > 0)
-{
- if($row = db_array ($result['result']))
+ $result = db_query ($query);
+ $tTargetDomain = "";
+ if ($result['rows'] > 0)
{
- if ('pgsql'==$CONF['database_type'])
+ if($row = db_array ($result['result']))
{
- $row['modified']=gmstrftime('%c %Z',$row['modified']);
- $row['active']=('t'==$row['active']) ? 1 : 0;
+ if ('pgsql'==$CONF['database_type'])
+ {
+ $row['modified']=gmstrftime('%c %Z',$row['modified']);
+ $row['active']=('t'==$row['active']) ? 1 : 0;
+ }
+ $tTargetDomain = $row;
}
- $tTargetDomain = $row;
}
}
-
$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'])
{
Modified: trunk/templates/list-virtual.php
===================================================================
--- trunk/templates/list-virtual.php 2008-07-27 18:48:41 UTC (rev 418)
+++ trunk/templates/list-virtual.php 2008-07-27 19:06:55 UTC (rev 419)
@@ -72,7 +72,7 @@
print "</td></tr></table></div>\n";
-if ((sizeof ($tAliasDomains) > 0) || is_array ($tTargetDomain))
+if (boolconf('alias_domain') && ((sizeof ($tAliasDomains) > 0) || is_array ($tTargetDomain)))
{
print "<table id=\"alias_domain_table\">\n";
print " <tr>\n";
Modified: trunk/templates/menu.php
===================================================================
--- trunk/templates/menu.php 2008-07-27 18:48:41 UTC (rev 418)
+++ trunk/templates/menu.php 2008-07-27 19:06:55 UTC (rev 419)
@@ -16,8 +16,10 @@
$url = "create-alias.php"; if (isset ($_GET['domain'])) $url .= "?domain=" . $_GET['domain'];
$submenu_virtual .= _menulink($url, $PALANG['pMenu_create_alias']);
-$url = "create-alias-domain.php"; if (isset ($_GET['domain'])) $url .= "?target_domain=" . $_GET['domain'];
-$submenu_virtual .= _menulink($url, $PALANG['pMenu_create_alias_domain']);
+if (boolconf('alias_domain')) {
+ $url = "create-alias-domain.php"; if (isset ($_GET['domain'])) $url .= "?target_domain=" . $_GET['domain'];
+ $submenu_virtual .= _menulink($url, $PALANG['pMenu_create_alias_domain']);
+}
$submenu_admin = _menulink("create-admin.php", $PALANG['pAdminMenu_create_admin']);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|