Merge pull request #318 from Churro/froxlorMerge_33ab67a

Feature: vHost templates (version 2)
This commit is contained in:
Michael Kaufmann
2016-02-26 19:16:49 +01:00
22 changed files with 766 additions and 39 deletions

View File

@@ -97,7 +97,7 @@ if ($page == 'domains'
}
$row['ipandport'] = substr($row['ipandport'], 0, -1);
$row['termination_date'] = str_replace("0000-00-00", "", $row['termination_date']);
if($row['termination_date'] != "")
{
$cdate = strtotime($row['termination_date'] . " 23:59:59");
@@ -432,6 +432,8 @@ if ($page == 'domains'
$specialsettings = '';
}
$vhostsettingid = 0;
$vhost_usedefaultlocation = 1;
if ($userinfo['caneditphpsettings'] == '1'
|| $userinfo['change_serversettings'] == '1'
) {
@@ -442,6 +444,8 @@ if ($page == 'domains'
|| (int)Settings::Get('phpfpm.enabled') == 1
) {
$phpsettingid = (int)$_POST['phpsettingid'];
$vhostsettingid = (int)$_POST['vhostsettingid'];
$vhost_usedefaultlocation = isset($_POST['vhost_usedefaultlocation']) ? (int)$_POST['vhost_usedefaultlocation'] : 1;
$phpsettingid_check_stmt = Database::prepare("
SELECT * FROM `" . TABLE_PANEL_PHPCONFIGS . "`
WHERE `id` = :phpsettingid"
@@ -733,6 +737,8 @@ if ($page == 'domains'
'ssl_ipandport' => serialize($ssl_ipandports),
'openbasedir' => $openbasedir,
'phpsettingid' => $phpsettingid,
'vhostsettingid' => $vhostsettingid,
'vhost_usedefaultlocation' => $vhost_usedefaultlocation,
'mod_fcgid_starter' => $mod_fcgid_starter,
'mod_fcgid_maxrequests' => $mod_fcgid_maxrequests,
'specialsettings' => $specialsettings,
@@ -786,6 +792,8 @@ if ($page == 'domains'
'registration_date' => $registration_date,
'termination_date' => $termination_date,
'phpsettingid' => $phpsettingid,
'vhostsettingid' => $vhostsettingid,
'vhost_usedefaultlocation' => $vhost_usedefaultlocation,
'mod_fcgid_starter' => $mod_fcgid_starter,
'mod_fcgid_maxrequests' => $mod_fcgid_maxrequests,
'ismainbutsubto' => $issubof,
@@ -819,6 +827,8 @@ if ($page == 'domains'
`registration_date` = :registration_date,
`termination_date` = :termination_date,
`phpsettingid` = :phpsettingid,
`vhostsettingid` = :vhostsettingid,
`vhost_usedefaultlocation` = :vhost_usedefaultlocation,
`mod_fcgid_starter` = :mod_fcgid_starter,
`mod_fcgid_maxrequests` = :mod_fcgid_maxrequests,
`ismainbutsubto` = :ismainbutsubto,
@@ -1000,6 +1010,15 @@ if ($page == 'domains'
}
}
// vhost configs
$vhostconfigs = '';
$configsvhost = Database::query("SELECT * FROM `" . TABLE_PANEL_VHOSTCONFIGS . "` ORDER BY description ASC");
$vhostconfigs.= makeoption($lng['admin']['vhostsettings']['novhostsettings'], 0);
while ($row = $configsvhost->fetch(PDO::FETCH_ASSOC)) {
$vhostconfigs.= makeoption($row['description'], $row['id'], '', true, true);
}
// create serveralias options
$serveraliasoptions = "";
$serveraliasoptions .= makeoption($lng['domains']['serveraliasoption_wildcard'], '0', '0', true, true);
@@ -1253,6 +1272,8 @@ if ($page == 'domains'
}
$speciallogverified = (isset($_POST['speciallogverified']) ? (int)$_POST['speciallogverified'] : 0);
$vhostsettingid = $result['vhostsettingid'];
$vhost_usedefaultlocation = $result['vhost_usedefaultlocation'];
if ($userinfo['caneditphpsettings'] == '1'
|| $userinfo['change_serversettings'] == '1'
@@ -1264,6 +1285,8 @@ if ($page == 'domains'
|| (int)Settings::Get('phpfpm.enabled') == 1
) {
$phpsettingid = (int)$_POST['phpsettingid'];
$vhostsettingid = (int)$_POST['vhostsettingid'];
$vhost_usedefaultlocation = isset($_POST['vhost_usedefaultlocation']) ? (int)$_POST['vhost_usedefaultlocation'] : $vhost_usedefaultlocation;
$phpsettingid_check_stmt = Database::prepare("
SELECT * FROM `" . TABLE_PANEL_PHPCONFIGS . "` WHERE `id` = :phpid
");
@@ -1494,6 +1517,8 @@ if ($page == 'domains'
'ssl_redirect' => $ssl_redirect,
'openbasedir' => $openbasedir,
'phpsettingid' => $phpsettingid,
'vhost_usedefaultlocation' => $vhost_usedefaultlocation,
'vhostsettingid' => $vhostsettingid,
'mod_fcgid_starter' => $mod_fcgid_starter,
'mod_fcgid_maxrequests' => $mod_fcgid_maxrequests,
'specialsettings' => $specialsettings,
@@ -1531,6 +1556,8 @@ if ($page == 'domains'
|| $iswildcarddomain != $result['iswildcarddomain']
|| $openbasedir != $result['openbasedir']
|| $phpsettingid != $result['phpsettingid']
|| $vhostsettingid != $result['vhostsettingid']
|| $vhost_usedefaultlocation != $result['vhost_usedefaultlocation']
|| $mod_fcgid_starter != $result['mod_fcgid_starter']
|| $mod_fcgid_maxrequests != $result['mod_fcgid_maxrequests']
|| $specialsettings != $result['specialsettings']
@@ -1669,6 +1696,8 @@ if ($page == 'domains'
$update_data['openbasedir'] = $openbasedir;
$update_data['speciallogfile'] = $speciallogfile;
$update_data['phpsettingid'] = $phpsettingid;
$update_data['vhostsettingid'] = $vhostsettingid;
$update_data['vhost_usedefaultlocation'] = $vhost_usedefaultlocation;
$update_data['mod_fcgid_starter'] = $mod_fcgid_starter;
$update_data['mod_fcgid_maxrequests'] = $mod_fcgid_maxrequests;
$update_data['specialsettings'] = $specialsettings;
@@ -1697,6 +1726,8 @@ if ($page == 'domains'
`openbasedir` = :openbasedir,
`speciallogfile` = :speciallogfile,
`phpsettingid` = :phpsettingid,
`vhostsettingid` = :vhostsettingid,
`vhost_usedefaultlocation` = :vhost_usedefaultlocation,
`mod_fcgid_starter` = :mod_fcgid_starter,
`mod_fcgid_maxrequests` = :mod_fcgid_maxrequests,
`specialsettings` = :specialsettings,
@@ -1712,6 +1743,8 @@ if ($page == 'domains'
$_update_data['adminid'] = $adminid;
$_update_data['openbasedir'] = $openbasedir;
$_update_data['phpsettingid'] = $phpsettingid;
$_update_data['vhost_usedefaultlocation'] = $vhost_usedefaultlocation;
$_update_data['vhostsettingid'] = $vhostsettingid;
$_update_data['mod_fcgid_starter'] = $mod_fcgid_starter;
$_update_data['mod_fcgid_maxrequests'] = $mod_fcgid_maxrequests;
$_update_data['parentdomainid'] = $id;
@@ -1729,6 +1762,8 @@ if ($page == 'domains'
`customerid` = :customerid,
`adminid` = :adminid,
`openbasedir` = :openbasedir,
`vhostsettingid` = :vhostsettingid,
`vhost_usedefaultlocation` = :vhost_usedefaultlocation,
`phpsettingid` = :phpsettingid,
`mod_fcgid_starter` = :mod_fcgid_starter,
`mod_fcgid_maxrequests` = :mod_fcgid_maxrequests
@@ -1941,7 +1976,7 @@ if ($page == 'domains'
// Fudge the result for ssl_redirect to hide the Let's Encrypt steps
$result['temporary_ssl_redirect'] = $result['ssl_redirect'];
$result['ssl_redirect'] = ($result['ssl_redirect'] == 0 ? 0 : 1);
$serveraliasoptions .= makeoption($lng['domains']['serveraliasoption_wildcard'], '0', $_value, true, true);
$serveraliasoptions .= makeoption($lng['domains']['serveraliasoption_www'], '1', $_value, true, true);
$serveraliasoptions .= makeoption($lng['domains']['serveraliasoption_none'], '2', $_value, true, true);
@@ -1960,6 +1995,14 @@ if ($page == 'domains'
$phpconfigs.= makeoption($phpconfigs_row['description'], $phpconfigs_row['id'], $result['phpsettingid'], true, true);
}
// vhost configs
$vhostconfigs = '';
$vhostconfigs_result_stmt = Database::query("SELECT * FROM `" . TABLE_PANEL_VHOSTCONFIGS . "` ORDER BY description ASC");
$vhostconfigs .= makeoption($lng['admin']['vhostsettings']['novhostsettings'], 0);
while ($vhostconfig_row = $vhostconfigs_result_stmt->fetch(PDO::FETCH_ASSOC)) {
$vhostconfigs .= makeoption($vhostconfig_row['description'], $vhostconfig_row['id'], $result['vhostsettingid'], true, true);
}
$result = htmlentities_array($result);
$domain_edit_data = include_once dirname(__FILE__).'/lib/formfields/admin/domains/formfield.domains_edit.php';