Feature: Vhost templates

Reworked the initial implementation by hpmewes (https://github.com/Froxlor/Froxlor/pull/233) with
- bugfixes all over
- added support for apache and lighttpd also
- added an update sequence (instead of only modifying froxlor.sql)
- added english language variables
- added missing parts in admin_vhostsettings.php
- added parameter replacements as available since PR 244
This commit is contained in:
Johannes Feichtner
2016-02-11 23:21:43 +01:00
parent 0559f3c4d6
commit abe253bc31
21 changed files with 761 additions and 38 deletions

View File

@@ -433,6 +433,8 @@ if ($page == 'domains'
$specialsettings = '';
}
$vhostsettingid = 0;
$vhost_usedefaultlocation = 0;
if ($userinfo['caneditphpsettings'] == '1'
|| $userinfo['change_serversettings'] == '1'
) {
@@ -443,6 +445,8 @@ if ($page == 'domains'
|| (int)Settings::Get('phpfpm.enabled') == 1
) {
$phpsettingid = (int)$_POST['phpsettingid'];
$vhostsettingid = (int)$_POST['vhostsettingid'];
$vhost_usedefaultlocation = (int)$_POST['vhost_usedefaultlocation'];
$phpsettingid_check_stmt = Database::prepare("
SELECT * FROM `" . TABLE_PANEL_PHPCONFIGS . "`
WHERE `id` = :phpsettingid"
@@ -734,6 +738,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,
@@ -788,6 +794,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,
@@ -821,6 +829,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,
@@ -1002,6 +1012,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);
@@ -1255,6 +1274,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'
@@ -1266,6 +1287,8 @@ if ($page == 'domains'
|| (int)Settings::Get('phpfpm.enabled') == 1
) {
$phpsettingid = (int)$_POST['phpsettingid'];
$vhostsettingid = (int)$_POST['vhostsettingid'];
$vhost_usedefaultlocation = (int)$_POST['vhost_usedefaultlocation'];
$phpsettingid_check_stmt = Database::prepare("
SELECT * FROM `" . TABLE_PANEL_PHPCONFIGS . "` WHERE `id` = :phpid
");
@@ -1496,6 +1519,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,
@@ -1534,6 +1559,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']
@@ -1672,6 +1699,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;
@@ -1700,6 +1729,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,
@@ -1715,6 +1746,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;
@@ -1732,6 +1765,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
@@ -1963,6 +1998,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';