let the admin set the server-alias completely (either wildcard, www. or none), customer option follows, this fixes #1147

Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
This commit is contained in:
Michael Kaufmann (d00p)
2013-10-14 09:50:55 +02:00
parent e1fa5f6f0a
commit 1a99a272b1
5 changed files with 72 additions and 27 deletions

View File

@@ -247,9 +247,9 @@ if($page == 'domains'
if(isset($_POST['email_only'])) if(isset($_POST['email_only']))
$email_only = intval($_POST['email_only']); $email_only = intval($_POST['email_only']);
$wwwserveralias = 0; $serveraliasoption = 0;
if(isset($_POST['wwwserveralias'])) if(isset($_POST['selectserveralias']))
$wwwserveralias = intval($_POST['wwwserveralias']); $serveraliasoption = intval($_POST['selectserveralias']);
$speciallogfile = 0; $speciallogfile = 0;
if(isset($_POST['speciallogfile'])) if(isset($_POST['speciallogfile']))
@@ -547,9 +547,8 @@ if($page == 'domains'
$dkim = '0'; $dkim = '0';
} }
if($wwwserveralias != '1') if ($serveraliasoption != '1' && $serveraliasoption != '2') {
{ $serveraliasoption = '0';
$wwwserveralias = '0';
} }
if($caneditdomain != '1') if($caneditdomain != '1')
@@ -605,7 +604,7 @@ if($page == 'domains'
'zonefile' => $zonefile, 'zonefile' => $zonefile,
'dkim' => $dkim, 'dkim' => $dkim,
'speciallogfile' => $speciallogfile, 'speciallogfile' => $speciallogfile,
'wwwserveralias' => $wwwserveralias, 'selectserveralias' => $serveraliasoption,
'ipandport' => serialize($ipandports), 'ipandport' => serialize($ipandports),
'ssl_redirect' => $ssl_redirect, 'ssl_redirect' => $ssl_redirect,
'ssl_ipandport' => serialize($ssl_ipandports), 'ssl_ipandport' => serialize($ssl_ipandports),
@@ -639,6 +638,9 @@ if($page == 'domains'
$question_nr++; $question_nr++;
} }
$wwwserveralias = ($serveraliasoption == '1') ? '1' : '0';
$iswildcarddomain = ($serveraliasoption == '0') ? '1' : '0';
$db->query("INSERT INTO `" . TABLE_PANEL_DOMAINS . "` SET $db->query("INSERT INTO `" . TABLE_PANEL_DOMAINS . "` SET
`domain` = '" . $db->escape($domain) . "', `domain` = '" . $db->escape($domain) . "',
`customerid` = '" . (int)$customerid . "', `customerid` = '" . (int)$customerid . "',
@@ -648,6 +650,7 @@ if($page == 'domains'
`zonefile` = '" . $db->escape($zonefile) . "', `zonefile` = '" . $db->escape($zonefile) . "',
`dkim` = '" . $db->escape($dkim) . "', `dkim` = '" . $db->escape($dkim) . "',
`wwwserveralias` = '" . $db->escape($wwwserveralias) . "', `wwwserveralias` = '" . $db->escape($wwwserveralias) . "',
`iswildcarddomain` = '" . $db->escape($iswildcarddomain) . "',
`isbinddomain` = '" . $db->escape($isbinddomain) . "', `isbinddomain` = '" . $db->escape($isbinddomain) . "',
`isemaildomain` = '" . $db->escape($isemaildomain) . "', `isemaildomain` = '" . $db->escape($isemaildomain) . "',
`email_only` = '" . $db->escape($email_only) . "', `email_only` = '" . $db->escape($email_only) . "',
@@ -791,6 +794,12 @@ if($page == 'domains'
} }
} }
// create serveralias options
$serveraliasoptions = "";
$serveraliasoptions .= makeoption($lng['domains']['serveraliasoption_wildcard'], '0', '0', true, true);
$serveraliasoptions .= makeoption($lng['domains']['serveraliasoption_www'], '1', '0', true, true);
$serveraliasoptions .= makeoption($lng['domains']['serveraliasoption_none'], '2', '0', true, true);
$subcanemaildomain = makeoption($lng['admin']['subcanemaildomain']['never'], '0', '0', true, true) . makeoption($lng['admin']['subcanemaildomain']['choosableno'], '1', '0', true, true) . makeoption($lng['admin']['subcanemaildomain']['choosableyes'], '2', '0', true, true) . makeoption($lng['admin']['subcanemaildomain']['always'], '3', '0', true, true); $subcanemaildomain = makeoption($lng['admin']['subcanemaildomain']['never'], '0', '0', true, true) . makeoption($lng['admin']['subcanemaildomain']['choosableno'], '1', '0', true, true) . makeoption($lng['admin']['subcanemaildomain']['choosableyes'], '2', '0', true, true) . makeoption($lng['admin']['subcanemaildomain']['always'], '3', '0', true, true);
$add_date = date('Y-m-d'); $add_date = date('Y-m-d');
@@ -909,9 +918,15 @@ if($page == 'domains'
if(isset($_POST['email_only'])) if(isset($_POST['email_only']))
$email_only = intval($_POST['email_only']); $email_only = intval($_POST['email_only']);
$wwwserveralias = 0; $serveraliasoption = '2';
if(isset($_POST['wwwserveralias'])) if ($result['iswildcarddomain'] == '1') {
$wwwserveralias = intval($_POST['wwwserveralias']); $serveraliasoption = '0';
} elseif ($result['wwwserveralias'] == '1') {
$serveraliasoption = '1';
}
if (isset($_POST['selectserveralias'])) {
$serveraliasoption = intval($_POST['selectserveralias']);
}
$speciallogfile = 0; $speciallogfile = 0;
if(isset($_POST['speciallogfile'])) if(isset($_POST['speciallogfile']))
@@ -1154,6 +1169,10 @@ if($page == 'domains'
$issubof = '0'; $issubof = '0';
} }
if ($serveraliasoption != '1' && $serveraliasoption != '2') {
$serveraliasoption = '0';
}
$params = array( $params = array(
'id' => $id, 'id' => $id,
'page' => $page, 'page' => $page,
@@ -1169,7 +1188,7 @@ if($page == 'domains'
'caneditdomain' => $caneditdomain, 'caneditdomain' => $caneditdomain,
'zonefile' => $zonefile, 'zonefile' => $zonefile,
'dkim' => $dkim, 'dkim' => $dkim,
'wwwserveralias' => $wwwserveralias, 'selectserveralias' => $serveraliasoption,
'ssl_redirect' => $ssl_redirect, 'ssl_redirect' => $ssl_redirect,
'openbasedir' => $openbasedir, 'openbasedir' => $openbasedir,
'phpsettingid' => $phpsettingid, 'phpsettingid' => $phpsettingid,
@@ -1203,9 +1222,13 @@ if($page == 'domains'
} }
} }
$wwwserveralias = ($serveraliasoption == '1') ? '1' : '0';
$iswildcarddomain = ($serveraliasoption == '0') ? '1' : '0';
if($documentroot != $result['documentroot'] if($documentroot != $result['documentroot']
|| $ssl_redirect != $result['ssl_redirect'] || $ssl_redirect != $result['ssl_redirect']
|| $wwwserveralias != $result['wwwserveralias'] || $wwwserveralias != $result['wwwserveralias']
|| $iswildcarddomain != $result['iswildcarddomain']
|| $openbasedir != $result['openbasedir'] || $openbasedir != $result['openbasedir']
|| $phpsettingid != $result['phpsettingid'] || $phpsettingid != $result['phpsettingid']
|| $mod_fcgid_starter != $result['mod_fcgid_starter'] || $mod_fcgid_starter != $result['mod_fcgid_starter']
@@ -1279,6 +1302,9 @@ if($page == 'domains'
$log->logAction(ADM_ACTION, LOG_INFO, "removed specialsettings on all subdomains of domain #" . $id); $log->logAction(ADM_ACTION, LOG_INFO, "removed specialsettings on all subdomains of domain #" . $id);
} }
$wwwserveralias = ($serveraliasoption == '1') ? '1' : '0';
$iswildcarddomain = ($serveraliasoption == '0') ? '1' : '0';
$result = $db->query("UPDATE `" . TABLE_PANEL_DOMAINS . "` SET $result = $db->query("UPDATE `" . TABLE_PANEL_DOMAINS . "` SET
`customerid` = '" . (int)$customerid . "', `customerid` = '" . (int)$customerid . "',
`adminid` = '" . (int)$adminid . "', `adminid` = '" . (int)$adminid . "',
@@ -1293,6 +1319,7 @@ if($page == 'domains'
`caneditdomain`='" . $db->escape($caneditdomain) . "', `caneditdomain`='" . $db->escape($caneditdomain) . "',
`zonefile`='" . $db->escape($zonefile) . "', `zonefile`='" . $db->escape($zonefile) . "',
`wwwserveralias`='" . $db->escape($wwwserveralias) . "', `wwwserveralias`='" . $db->escape($wwwserveralias) . "',
`iswildcarddomain`='" . $db->escape($iswildcarddomain) . "',
`openbasedir`='" . $db->escape($openbasedir) . "', `openbasedir`='" . $db->escape($openbasedir) . "',
`speciallogfile`='" . $db->escape($speciallogfile) . "', `speciallogfile`='" . $db->escape($speciallogfile) . "',
`phpsettingid`='" . $db->escape($phpsettingid) . "', `phpsettingid`='" . $db->escape($phpsettingid) . "',
@@ -1453,6 +1480,18 @@ if($page == 'domains'
$result['specialsettings'] = $result['specialsettings']; $result['specialsettings'] = $result['specialsettings'];
// create serveralias options
$serveraliasoptions = "";
$values = array('0' => '0', '1' => '0', '2' => '1');
if ($result['iswildcarddomain'] == '1') {
$values = array('0' => '1', '1' => '0', '2' => '0');
} elseif ($result['wwwserveralias'] == '1') {
$values = array('0' => '0', '1' => '1', '2' => '0');
}
$serveraliasoptions .= makeoption($lng['domains']['serveraliasoption_wildcard'], '0', $values['0'], true, true);
$serveraliasoptions .= makeoption($lng['domains']['serveraliasoption_www'], '1', $values['1'], true, true);
$serveraliasoptions .= makeoption($lng['domains']['serveraliasoption_none'], '2', $values['2'], true, true);
$subcanemaildomain = makeoption($lng['admin']['subcanemaildomain']['never'], '0', $result['subcanemaildomain'], true, true); $subcanemaildomain = makeoption($lng['admin']['subcanemaildomain']['never'], '0', $result['subcanemaildomain'], true, true);
$subcanemaildomain.= makeoption($lng['admin']['subcanemaildomain']['choosableno'], '1', $result['subcanemaildomain'], true, true); $subcanemaildomain.= makeoption($lng['admin']['subcanemaildomain']['choosableno'], '1', $result['subcanemaildomain'], true, true);
$subcanemaildomain.= makeoption($lng['admin']['subcanemaildomain']['choosableyes'], '2', $result['subcanemaildomain'], true, true); $subcanemaildomain.= makeoption($lng['admin']['subcanemaildomain']['choosableyes'], '2', $result['subcanemaildomain'], true, true);

View File

@@ -119,13 +119,11 @@ return array(
'type' => 'label', 'type' => 'label',
'value' => $lng['panel']['nosslipsavailable'] 'value' => $lng['panel']['nosslipsavailable']
), ),
'wwwserveralias' => array( 'selectserveralias' => array(
'label' => $lng['admin']['wwwserveralias'], 'label' => $lng['admin']['selectserveralias'],
'type' => 'checkbox', 'desc' => $lng['admin']['selectserveralias_desc'],
'values' => array( 'type' => 'select',
array ('label' => $lng['panel']['yes'], 'value' => '1') 'select_var' => $serveraliasoptions
),
'value' => array('1')
), ),
'speciallogfile' => array( 'speciallogfile' => array(
'label' => $lng['admin']['speciallogfile']['title'], 'label' => $lng['admin']['speciallogfile']['title'],

View File

@@ -130,13 +130,11 @@ return array(
'type' => 'label', 'type' => 'label',
'value' => $lng['panel']['nosslipsavailable'] 'value' => $lng['panel']['nosslipsavailable']
), ),
'wwwserveralias' => array( 'selectserveralias' => array(
'label' => $lng['admin']['wwwserveralias'], 'label' => $lng['admin']['selectserveralias'],
'type' => 'checkbox', 'desc' => $lng['admin']['selectserveralias_desc'],
'values' => array( 'type' => 'select',
array ('label' => $lng['panel']['yes'], 'value' => '1') 'select_var' => $serveraliasoptions
),
'value' => array($result['wwwserveralias'])
), ),
'speciallogfile' => array( 'speciallogfile' => array(
'label' => $lng['admin']['speciallogfile']['title'], 'label' => $lng['admin']['speciallogfile']['title'],

View File

@@ -1958,7 +1958,7 @@ $lng['serversettings']['customerssl_directory']['description'] = 'Where should c
$lng['admin']['note'] = 'Please note'; $lng['admin']['note'] = 'Please note';
$lng['admin']['phpfpm.ininote'] = 'Not all values you may want to define can be used in the php-fpm pool configuration'; $lng['admin']['phpfpm.ininote'] = 'Not all values you may want to define can be used in the php-fpm pool configuration';
// Added in Froxlor 0.9.29.1-dev // Added in Froxlor 0.9.30
$lng['crondesc']['cron_mailboxsize'] = 'Calculating of mailbox-sizes'; $lng['crondesc']['cron_mailboxsize'] = 'Calculating of mailbox-sizes';
$lng['domains']['ipandport_multi']['title'] = 'IP address(es)'; $lng['domains']['ipandport_multi']['title'] = 'IP address(es)';
$lng['domains']['ipandport_multi']['description'] = 'Specify one or more IP address for the domain.<br /><br /><div style="color:red">NOTE: IP addresses cannot be changed when the domain is configured as <strong>alias-domain</strong> of another domain.</div>'; $lng['domains']['ipandport_multi']['description'] = 'Specify one or more IP address for the domain.<br /><br /><div style="color:red">NOTE: IP addresses cannot be changed when the domain is configured as <strong>alias-domain</strong> of another domain.</div>';
@@ -1966,3 +1966,8 @@ $lng['domains']['ipandport_ssl_multi']['title'] = 'SSL IP address(es)';
$lng['domains']['ssl_redirect']['title'] = 'SSL redirect'; $lng['domains']['ssl_redirect']['title'] = 'SSL redirect';
$lng['domains']['ssl_redirect']['description'] = 'This option creates redirects for non-ssl vhosts so that all requests are redirected to the SSL-vhost.<br /><br />e.g. a request to <strong>http</strong>://domain.tld/ will redirect you to <strong>https</strong>://domain.tld/'; $lng['domains']['ssl_redirect']['description'] = 'This option creates redirects for non-ssl vhosts so that all requests are redirected to the SSL-vhost.<br /><br />e.g. a request to <strong>http</strong>://domain.tld/ will redirect you to <strong>https</strong>://domain.tld/';
$lng['admin']['phpinfo'] = 'PHPinfo()'; $lng['admin']['phpinfo'] = 'PHPinfo()';
$lng['admin']['selectserveralias'] = 'ServerAlias value for the domain';
$lng['admin']['selectserveralias_desc'] = 'Chose whether froxlor should create a wildcard-entry (*.domain.tld), a WWW-alias (www.domain.tld) or no alias at all';
$lng['domains']['serveraliasoption_wildcard'] = 'Wildcard (*.domain.tld)';
$lng['domains']['serveraliasoption_www'] = 'WWW (www.domain.tld)';
$lng['domains']['serveraliasoption_none'] = 'No alias';

View File

@@ -1679,10 +1679,15 @@ $lng['serversettings']['customerssl_directory']['description'] = 'Wo sollen kund
$lng['admin']['note'] = 'Bitte beachten'; $lng['admin']['note'] = 'Bitte beachten';
$lng['admin']['phpfpm.ininote'] = 'Nicht alle gewünschten Werte können in der php-fpm pool Konfiguration verwendet werden'; $lng['admin']['phpfpm.ininote'] = 'Nicht alle gewünschten Werte können in der php-fpm pool Konfiguration verwendet werden';
// Added in Froxlor 0.9.29.1-dev // Added in Froxlor 0.9.30
$lng['crondesc']['cron_mailboxsize'] = 'Berechnung der Mailbox-Größen'; $lng['crondesc']['cron_mailboxsize'] = 'Berechnung der Mailbox-Größen';
$lng['domains']['ipandport_multi']['title'] = 'IP Adresse(n)'; $lng['domains']['ipandport_multi']['title'] = 'IP Adresse(n)';
$lng['domains']['ipandport_multi']['description'] = 'Definiere eine oder mehrere IP Adresse(n) für diese Domain.<br /><br /><div style="color:red">Hinweis: Die IP Adressen können nicht geändert werden, sollte die Domain als <strong>Alias-Domain</strong> für eine andere Domain konfiguriert worden sein.</div>'; $lng['domains']['ipandport_multi']['description'] = 'Definiere eine oder mehrere IP Adresse(n) für diese Domain.<br /><br /><div style="color:red">Hinweis: Die IP Adressen können nicht geändert werden, sollte die Domain als <strong>Alias-Domain</strong> für eine andere Domain konfiguriert worden sein.</div>';
$lng['domains']['ipandport_ssl_multi']['title'] = 'SSL IP Adresse(n)'; $lng['domains']['ipandport_ssl_multi']['title'] = 'SSL IP Adresse(n)';
$lng['domains']['ssl_redirect']['title'] = 'SSL Weiterleitung'; $lng['domains']['ssl_redirect']['title'] = 'SSL Weiterleitung';
$lng['domains']['ssl_redirect']['description'] = 'Diese Option erstellt für alle nicht-ssl vhosts eine Weiterleitung (Redirect), so dass alle Anfragen an den SSL-vhost übermittelt werden.<br /><br />z.B. eine Anfrage an <strong>http</strong>://domain.tld/ würde weiterleiten zu <strong>https</strong>://domain.tld/'; $lng['domains']['ssl_redirect']['description'] = 'Diese Option erstellt für alle nicht-ssl vhosts eine Weiterleitung (Redirect), so dass alle Anfragen an den SSL-vhost übermittelt werden.<br /><br />z.B. eine Anfrage an <strong>http</strong>://domain.tld/ würde weiterleiten zu <strong>https</strong>://domain.tld/';
$lng['admin']['selectserveralias'] = 'ServerAlias Angabe für die Domain';
$lng['admin']['selectserveralias_desc'] = 'Wählen Sie hier, ob für diese Domain ein Wildcard-Eintrag (*.domain.tld), ein WWW-Alias (www.domain.tld) oder gar kein Alias angelegt werden soll.';
$lng['domains']['serveraliasoption_wildcard'] = 'Wildcard (*.domain.tld)';
$lng['domains']['serveraliasoption_www'] = 'WWW (www.domain.tld)';
$lng['domains']['serveraliasoption_none'] = 'Kein alias';