mirror of
https://github.com/postfixadmin/postfixadmin.git
synced 2024-09-19 19:22:14 +02:00
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() git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@419 a1433add-5e2c-0410-b055-b7f2511e0802
This commit is contained in:
parent
711df82fc8
commit
5fa76d73d9
@ -195,6 +195,13 @@ $CONF['special_alias_control'] = 'NO';
|
||||
// '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';
|
||||
|
@ -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')) {
|
||||
|
@ -2189,6 +2189,7 @@ function create_admin($fUsername, $fPassword, $fPassword2, $fDomains, $no_genera
|
||||
|
||||
/*
|
||||
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 create_admin($fUsername, $fPassword, $fPassword2, $fDomains, $no_genera
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
@ -73,18 +73,19 @@ if (!check_owner(authentication_get_username(), $fDomain)) {
|
||||
}
|
||||
|
||||
|
||||
# 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 (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'])
|
||||
{
|
||||
$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)
|
||||
{
|
||||
}
|
||||
$result = db_query ($query);
|
||||
$tAliasDomains = array();
|
||||
if ($result['rows'] > 0)
|
||||
{
|
||||
while ($row = db_array ($result['result']))
|
||||
{
|
||||
if ('pgsql'==$CONF['database_type'])
|
||||
@ -94,17 +95,17 @@ if ($result['rows'] > 0)
|
||||
}
|
||||
$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'])
|
||||
{
|
||||
}
|
||||
# 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)
|
||||
{
|
||||
}
|
||||
$result = db_query ($query);
|
||||
$tTargetDomain = "";
|
||||
if ($result['rows'] > 0)
|
||||
{
|
||||
if($row = db_array ($result['result']))
|
||||
{
|
||||
if ('pgsql'==$CONF['database_type'])
|
||||
@ -114,9 +115,9 @@ if ($result['rows'] > 0)
|
||||
}
|
||||
$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'])
|
||||
{
|
||||
|
@ -72,7 +72,7 @@ if ($tDisplay_next_show == 1)
|
||||
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";
|
||||
|
@ -16,8 +16,10 @@ $submenu_virtual = _menulink($url, $PALANG['pMenu_create_mailbox']);
|
||||
$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']);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user