Compare commits
13 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
017396197e | ||
|
|
216f013c96 | ||
|
|
05f1bf0a1f | ||
|
|
295fbae6f5 | ||
|
|
ca4c93ac92 | ||
|
|
13b1503bf2 | ||
|
|
2980397545 | ||
|
|
5612720342 | ||
|
|
4d3fa6eca5 | ||
|
|
05b4c58aa8 | ||
|
|
f290497b64 | ||
|
|
b4dd35eed2 | ||
|
|
ec21e28000 |
@@ -17,7 +17,6 @@
|
|||||||
* @since 0.9.35
|
* @since 0.9.35
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
define('AREA', 'admin');
|
define('AREA', 'admin');
|
||||||
require './lib/init.php';
|
require './lib/init.php';
|
||||||
|
|
||||||
@@ -26,177 +25,188 @@ define('UPDATE_URI', "https://version.froxlor.org/Froxlor/legacy/" . $version);
|
|||||||
define('RELEASE_URI', "https://autoupdate.froxlor.org/froxlor-{version}.zip");
|
define('RELEASE_URI', "https://autoupdate.froxlor.org/froxlor-{version}.zip");
|
||||||
define('CHECKSUM_URI', "https://autoupdate.froxlor.org/froxlor-{version}.zip.sha256");
|
define('CHECKSUM_URI', "https://autoupdate.froxlor.org/froxlor-{version}.zip.sha256");
|
||||||
|
|
||||||
// check for allow_url_fopen
|
|
||||||
if (ini_get('allow_url_fopen') === false) {
|
|
||||||
redirectTo($filename, array('s' => $s, 'page' => 'error', 'errno' => 1));
|
|
||||||
}
|
|
||||||
|
|
||||||
// check for archive-stuff
|
// check for archive-stuff
|
||||||
if (! extension_loaded('zip')) {
|
if (! extension_loaded('zip')) {
|
||||||
redirectTo($filename, array('s' => $s, 'page' => 'error', 'errno' => 2));
|
redirectTo($filename, array(
|
||||||
|
's' => $s,
|
||||||
|
'page' => 'error',
|
||||||
|
'errno' => 2
|
||||||
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
// display initial version check
|
// display initial version check
|
||||||
if ($page == 'overview') {
|
if ($page == 'overview') {
|
||||||
|
|
||||||
// log our actions
|
// log our actions
|
||||||
$log->logAction(ADM_ACTION, LOG_NOTICE, "checking auto-update");
|
$log->logAction(ADM_ACTION, LOG_NOTICE, "checking auto-update");
|
||||||
|
|
||||||
// check for new version
|
// check for new version
|
||||||
$latestversion = @file(UPDATE_URI);
|
$latestversion = HttpClient::urlGet(UPDATE_URI);
|
||||||
|
|
||||||
if (isset($latestversion[0])) {
|
$latestversion = explode('|', $latestversion);
|
||||||
$latestversion = explode('|', $latestversion[0]);
|
|
||||||
|
if (is_array($latestversion) && count($latestversion) >= 1) {
|
||||||
if (is_array($latestversion)
|
$_version = $latestversion[0];
|
||||||
&& count($latestversion) >= 1
|
$_message = isset($latestversion[1]) ? $latestversion[1] : '';
|
||||||
) {
|
$_link = isset($latestversion[2]) ? $latestversion[2] : htmlspecialchars($filename . '?s=' . urlencode($s) . '&page=' . urlencode($page) . '&lookfornewversion=yes');
|
||||||
$_version = $latestversion[0];
|
|
||||||
$_message = isset($latestversion[1]) ? $latestversion[1] : '';
|
// add the branding so debian guys are not gettings confused
|
||||||
$_link = isset($latestversion[2]) ? $latestversion[2] : htmlspecialchars($filename . '?s=' . urlencode($s) . '&page=' . urlencode($page) . '&lookfornewversion=yes');
|
// about their version-number
|
||||||
|
$version_label = $_version . $branding;
|
||||||
// add the branding so debian guys are not gettings confused
|
$version_link = $_link;
|
||||||
// about their version-number
|
$message_addinfo = $_message;
|
||||||
$version_label = $_version.$branding;
|
|
||||||
$version_link = $_link;
|
// not numeric -> error-message
|
||||||
$message_addinfo = $_message;
|
if (! preg_match('/^((\d+\\.)(\d+\\.)(\d+\\.)?(\d+)?(\-(svn|dev|rc)(\d+))?)$/', $_version)) {
|
||||||
|
// check for customized version to not output
|
||||||
// not numeric -> error-message
|
// "There is a newer version of froxlor" besides the error-message
|
||||||
if (!preg_match('/^((\d+\\.)(\d+\\.)(\d+\\.)?(\d+)?(\-(svn|dev|rc)(\d+))?)$/', $_version)) {
|
redirectTo($filename, array(
|
||||||
// check for customized version to not output
|
's' => $s,
|
||||||
// "There is a newer version of froxlor" besides the error-message
|
'page' => 'error',
|
||||||
redirectTo($filename, array('s' => $s, 'page' => 'error', 'errno' => 3));
|
'errno' => 3
|
||||||
} elseif (version_compare2($version, $_version) == -1) {
|
));
|
||||||
// there is a newer version - yay
|
} elseif (version_compare2($version, $_version) == - 1) {
|
||||||
$isnewerversion = 1;
|
// there is a newer version - yay
|
||||||
} else {
|
$isnewerversion = 1;
|
||||||
// nothing new
|
} else {
|
||||||
$isnewerversion = 0;
|
// nothing new
|
||||||
}
|
$isnewerversion = 0;
|
||||||
|
}
|
||||||
// anzeige über version-status mit ggfls. formular
|
|
||||||
// zum update schritt #1 -> download
|
// anzeige über version-status mit ggfls. formular
|
||||||
if ($isnewerversion == 1) {
|
// zum update schritt #1 -> download
|
||||||
$text = 'There is a newer version available. Update to version <b>'.$_version.'</b> now?<br/>(Your current version is: '.$version.')';
|
if ($isnewerversion == 1) {
|
||||||
$hiddenparams = '<input type="hidden" name="newversion" value="'.$_version.'" />';
|
$text = 'There is a newer version available. Update to version <b>' . $_version . '</b> now?<br/>(Your current version is: ' . $version . ')';
|
||||||
$yesfile = $filename.'?s='.$s.'&page=getdownload';
|
$hiddenparams = '<input type="hidden" name="newversion" value="' . $_version . '" />';
|
||||||
eval("echo \"" . getTemplate("misc/question_yesno", true) . "\";");
|
$yesfile = $filename . '?s=' . $s . '&page=getdownload';
|
||||||
exit;
|
eval("echo \"" . getTemplate("misc/question_yesno", true) . "\";");
|
||||||
}
|
exit();
|
||||||
elseif ($isnewerversion == 0) {
|
} elseif ($isnewerversion == 0) {
|
||||||
// all good
|
// all good
|
||||||
standard_success ('noupdatesavail');
|
standard_success('noupdatesavail');
|
||||||
} else {
|
} else {
|
||||||
standard_error ('customized_version');
|
standard_error('customized_version');
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// error (something weird came from version.froxlor.org)
|
}// download the new archive
|
||||||
redirectTo($filename, array('s' => $s, 'page' => 'error', 'errno' => 5));
|
|
||||||
}
|
|
||||||
// download the new archive
|
|
||||||
elseif ($page == 'getdownload') {
|
elseif ($page == 'getdownload') {
|
||||||
|
|
||||||
// retrieve the new version from the form
|
// retrieve the new version from the form
|
||||||
$newversion = isset($_POST['newversion']) ? $_POST['newversion'] : null;
|
$newversion = isset($_POST['newversion']) ? $_POST['newversion'] : null;
|
||||||
|
|
||||||
// valid?
|
// valid?
|
||||||
if ($newversion !== null) {
|
if ($newversion !== null) {
|
||||||
|
|
||||||
// define files to get
|
// define files to get
|
||||||
$toLoad = str_replace('{version}', $newversion, RELEASE_URI);
|
$toLoad = str_replace('{version}', $newversion, RELEASE_URI);
|
||||||
$toCheck = str_replace('{version}', $newversion, CHECKSUM_URI);
|
$toCheck = str_replace('{version}', $newversion, CHECKSUM_URI);
|
||||||
|
|
||||||
// get archive data
|
|
||||||
$newArchive = @file_get_contents($toLoad);
|
|
||||||
|
|
||||||
// check for local destination folder
|
// check for local destination folder
|
||||||
if (!is_dir(FROXLOR_INSTALL_DIR.'/updates/')) {
|
if (! is_dir(FROXLOR_INSTALL_DIR . '/updates/')) {
|
||||||
mkdir(FROXLOR_INSTALL_DIR.'/updates/');
|
mkdir(FROXLOR_INSTALL_DIR . '/updates/');
|
||||||
}
|
}
|
||||||
|
|
||||||
// name archive
|
// name archive
|
||||||
$localArchive = FROXLOR_INSTALL_DIR.'/updates/'.basename($toLoad);
|
$localArchive = FROXLOR_INSTALL_DIR . '/updates/' . basename($toLoad);
|
||||||
|
|
||||||
$log->logAction(ADM_ACTION, LOG_NOTICE, "Downloading ".$toLoad." to ".$localArchive);
|
$log->logAction(ADM_ACTION, LOG_NOTICE, "Downloading " . $toLoad . " to " . $localArchive);
|
||||||
|
|
||||||
// remove old archive
|
// remove old archive
|
||||||
if (file_exists($localArchive)) {
|
if (file_exists($localArchive)) {
|
||||||
@unlink($localArchive);
|
@unlink($localArchive);
|
||||||
}
|
}
|
||||||
|
|
||||||
// store archive
|
// get archive data
|
||||||
$fh = fopen($localArchive, 'w');
|
try {
|
||||||
if (!fwrite($fh, $newArchive)) {
|
HttpClient::fileGet($toLoad, $localArchive);
|
||||||
redirectTo($filename, array('s' => $s, 'page' => 'error', 'errno' => 4));
|
} catch (Exception $e) {
|
||||||
|
redirectTo($filename, array(
|
||||||
|
's' => $s,
|
||||||
|
'page' => 'error',
|
||||||
|
'errno' => 4
|
||||||
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
// close file-handle
|
|
||||||
fclose($fh);
|
|
||||||
|
|
||||||
// validate the integrity of the downloaded file
|
// validate the integrity of the downloaded file
|
||||||
$_shouldsum = @file_get_contents($toCheck);
|
$_shouldsum = HttpClient::urlGet($toCheck);
|
||||||
if (!empty($_shouldsum)) {
|
if (! empty($_shouldsum)) {
|
||||||
$_t = explode(" ", $_shouldsum);
|
$_t = explode(" ", $_shouldsum);
|
||||||
$shouldsum = $_t[0];
|
$shouldsum = $_t[0];
|
||||||
} else {
|
} else {
|
||||||
$shouldsum = null;
|
$shouldsum = null;
|
||||||
}
|
}
|
||||||
$filesum = hash_file('sha256', $localArchive);
|
$filesum = hash_file('sha256', $localArchive);
|
||||||
|
|
||||||
if ($filesum != $shouldsum) {
|
if ($filesum != $shouldsum) {
|
||||||
redirectTo($filename, array('s' => $s, 'page' => 'error', 'errno' => 9));
|
redirectTo($filename, array(
|
||||||
|
's' => $s,
|
||||||
|
'page' => 'error',
|
||||||
|
'errno' => 9
|
||||||
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
// to the next step
|
// to the next step
|
||||||
redirectTo($filename, array('s' => $s, 'page' => 'extract', 'archive' => basename($localArchive)));
|
redirectTo($filename, array(
|
||||||
|
's' => $s,
|
||||||
|
'page' => 'extract',
|
||||||
|
'archive' => basename($localArchive)
|
||||||
|
));
|
||||||
}
|
}
|
||||||
redirectTo($filename, array('s' => $s, 'page' => 'error', 'errno' => 6));
|
redirectTo($filename, array(
|
||||||
}
|
's' => $s,
|
||||||
// extract and install new version
|
'page' => 'error',
|
||||||
|
'errno' => 6
|
||||||
|
));
|
||||||
|
}// extract and install new version
|
||||||
elseif ($page == 'extract') {
|
elseif ($page == 'extract') {
|
||||||
|
|
||||||
$toExtract = isset($_GET['archive']) ? $_GET['archive'] : null;
|
$toExtract = isset($_GET['archive']) ? $_GET['archive'] : null;
|
||||||
$localArchive = FROXLOR_INSTALL_DIR.'/updates/'.$toExtract;
|
$localArchive = FROXLOR_INSTALL_DIR . '/updates/' . $toExtract;
|
||||||
|
|
||||||
if (isset($_POST['send'])
|
if (isset($_POST['send']) && $_POST['send'] == 'send') {
|
||||||
&& $_POST['send'] == 'send'
|
|
||||||
) {
|
|
||||||
// decompress from zip
|
// decompress from zip
|
||||||
$zip = new ZipArchive;
|
$zip = new ZipArchive();
|
||||||
$res = $zip->open($localArchive);
|
$res = $zip->open($localArchive);
|
||||||
if ($res === true) {
|
if ($res === true) {
|
||||||
$log->logAction(ADM_ACTION, LOG_NOTICE, "Extracting ".$localArchive." to ".FROXLOR_INSTALL_DIR);
|
$log->logAction(ADM_ACTION, LOG_NOTICE, "Extracting " . $localArchive . " to " . FROXLOR_INSTALL_DIR);
|
||||||
$zip->extractTo(FROXLOR_INSTALL_DIR);
|
$zip->extractTo(FROXLOR_INSTALL_DIR);
|
||||||
$zip->close();
|
$zip->close();
|
||||||
// success - remove unused archive
|
// success - remove unused archive
|
||||||
@unlink($localArchive);
|
@unlink($localArchive);
|
||||||
} else {
|
} else {
|
||||||
// error
|
// error
|
||||||
redirectTo($filename, array('s' => $s, 'page' => 'error', 'errno' => 8));
|
redirectTo($filename, array(
|
||||||
|
's' => $s,
|
||||||
|
'page' => 'error',
|
||||||
|
'errno' => 8
|
||||||
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
// redirect to update-page?
|
// redirect to update-page?
|
||||||
redirectTo('admin_updates.php', array('s' => $s));
|
redirectTo('admin_updates.php', array(
|
||||||
|
's' => $s
|
||||||
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!file_exists($localArchive)) {
|
if (! file_exists($localArchive)) {
|
||||||
redirectTo($filename, array('s' => $s, 'page' => 'error', 'errno' => 7));
|
redirectTo($filename, array(
|
||||||
|
's' => $s,
|
||||||
|
'page' => 'error',
|
||||||
|
'errno' => 7
|
||||||
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
$text = 'Extract downloaded archive "'.$toExtract.'"?';
|
$text = 'Extract downloaded archive "' . $toExtract . '"?';
|
||||||
$hiddenparams = '';
|
$hiddenparams = '';
|
||||||
$yesfile = $filename.'?s='.$s.'&page=extract&archive='.$toExtract;
|
$yesfile = $filename . '?s=' . $s . '&page=extract&archive=' . $toExtract;
|
||||||
eval("echo \"" . getTemplate("misc/question_yesno", true) . "\";");
|
eval("echo \"" . getTemplate("misc/question_yesno", true) . "\";");
|
||||||
}
|
}
|
||||||
|
|
||||||
// display error
|
// display error
|
||||||
elseif ($page == 'error') {
|
elseif ($page == 'error') {
|
||||||
|
|
||||||
// retrieve error-number via url-parameter
|
// retrieve error-number via url-parameter
|
||||||
$errno = isset($_GET['errno']) ? (int)$_GET['errno'] : 0;
|
$errno = isset($_GET['errno']) ? (int) $_GET['errno'] : 0;
|
||||||
|
|
||||||
// 1 = no allow_url_fopen
|
|
||||||
// 2 = no Zlib
|
// 2 = no Zlib
|
||||||
// 3 = custom version detected
|
// 3 = custom version detected
|
||||||
// 4 = could not store archive to local hdd
|
// 4 = could not store archive to local hdd
|
||||||
@@ -205,5 +215,5 @@ elseif ($page == 'error') {
|
|||||||
// 7 = local archive does not exist
|
// 7 = local archive does not exist
|
||||||
// 8 = could not extract archive
|
// 8 = could not extract archive
|
||||||
// 9 = checksum mismatch
|
// 9 = checksum mismatch
|
||||||
standard_error ('autoupdate_'.$errno);
|
standard_error('autoupdate_' . $errno);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2209,12 +2209,19 @@ if ($page == 'domains' || $page == 'overview') {
|
|||||||
FROM `" . TABLE_PANEL_PHPCONFIGS . "` c
|
FROM `" . TABLE_PANEL_PHPCONFIGS . "` c
|
||||||
LEFT JOIN `" . TABLE_PANEL_FPMDAEMONS . "` fc ON fc.id = c.fpmsettingid
|
LEFT JOIN `" . TABLE_PANEL_FPMDAEMONS . "` fc ON fc.id = c.fpmsettingid
|
||||||
");
|
");
|
||||||
|
$c_allowed_configs = getCustomerDetail($result['customerid'], 'allowed_phpconfigs');
|
||||||
|
if (!empty($c_allowed_configs)) {
|
||||||
|
$c_allowed_configs = json_decode($c_allowed_configs, true);
|
||||||
|
} else {
|
||||||
|
$c_allowed_configs = array();
|
||||||
|
}
|
||||||
|
|
||||||
while ($phpconfigs_row = $phpconfigs_result_stmt->fetch(PDO::FETCH_ASSOC)) {
|
while ($phpconfigs_row = $phpconfigs_result_stmt->fetch(PDO::FETCH_ASSOC)) {
|
||||||
|
$disabled = !empty($c_allowed_configs) && !in_array($phpconfigs_row['id'], $c_allowed_configs);
|
||||||
if ((int) Settings::Get('phpfpm.enabled') == 1) {
|
if ((int) Settings::Get('phpfpm.enabled') == 1) {
|
||||||
$phpconfigs .= makeoption($phpconfigs_row['description'] . " [".$phpconfigs_row['interpreter']."]", $phpconfigs_row['id'], $result['phpsettingid'], true, true);
|
$phpconfigs .= makeoption($phpconfigs_row['description'] . " [".$phpconfigs_row['interpreter']."]", $phpconfigs_row['id'], $result['phpsettingid'], true, true, null, $disabled);
|
||||||
} else {
|
} else {
|
||||||
$phpconfigs .= makeoption($phpconfigs_row['description'], $phpconfigs_row['id'], $result['phpsettingid'], true, true);
|
$phpconfigs .= makeoption($phpconfigs_row['description'], $phpconfigs_row['id'], $result['phpsettingid'], true, true, null, $disabled);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2231,6 +2238,13 @@ if ($page == 'domains' || $page == 'overview') {
|
|||||||
eval("echo \"" . getTemplate("domains/domains_edit") . "\";");
|
eval("echo \"" . getTemplate("domains/domains_edit") . "\";");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} elseif ($action == 'jqGetCustomerPHPConfigs') {
|
||||||
|
|
||||||
|
$customerid = intval($_POST['customerid']);
|
||||||
|
$allowed_phpconfigs = getCustomerDetail($customerid, 'allowed_phpconfigs');
|
||||||
|
echo !empty($allowed_phpconfigs) ? $allowed_phpconfigs : json_encode(array());
|
||||||
|
exit;
|
||||||
|
|
||||||
} elseif ($action == 'import') {
|
} elseif ($action == 'import') {
|
||||||
|
|
||||||
if (isset($_POST['send']) && $_POST['send'] == 'send') {
|
if (isset($_POST['send']) && $_POST['send'] == 'send') {
|
||||||
|
|||||||
@@ -86,41 +86,31 @@ if ($page == 'overview') {
|
|||||||
|| (isset($lookfornewversion) && $lookfornewversion == 'yes')
|
|| (isset($lookfornewversion) && $lookfornewversion == 'yes')
|
||||||
) {
|
) {
|
||||||
$update_check_uri = 'http://version.froxlor.org/Froxlor/legacy/' . $version;
|
$update_check_uri = 'http://version.froxlor.org/Froxlor/legacy/' . $version;
|
||||||
|
$latestversion = HttpClient::urlGet($update_check_uri);
|
||||||
|
$latestversion = explode('|', $latestversion);
|
||||||
|
|
||||||
if (ini_get('allow_url_fopen')) {
|
if (is_array($latestversion)
|
||||||
$latestversion = @file($update_check_uri);
|
&& count($latestversion) >= 1
|
||||||
|
) {
|
||||||
|
$_version = $latestversion[0];
|
||||||
|
$_message = isset($latestversion[1]) ? $latestversion[1] : '';
|
||||||
|
$_link = isset($latestversion[2]) ? $latestversion[2] : htmlspecialchars($filename . '?s=' . urlencode($s) . '&page=' . urlencode($page) . '&lookfornewversion=yes');
|
||||||
|
|
||||||
if (isset($latestversion[0])) {
|
// add the branding so debian guys are not gettings confused
|
||||||
$latestversion = explode('|', $latestversion[0]);
|
// about their version-number
|
||||||
|
$lookfornewversion_lable = $_version.$branding;
|
||||||
|
$lookfornewversion_link = $_link;
|
||||||
|
$lookfornewversion_addinfo = $_message;
|
||||||
|
|
||||||
if (is_array($latestversion)
|
// not numeric -> error-message
|
||||||
&& count($latestversion) >= 1
|
if (!preg_match('/^((\d+\\.)(\d+\\.)(\d+\\.)?(\d+)?(\-(svn|dev|rc)(\d+))?)$/', $_version)) {
|
||||||
) {
|
// check for customized version to not output
|
||||||
$_version = $latestversion[0];
|
// "There is a newer version of froxlor" besides the error-message
|
||||||
$_message = isset($latestversion[1]) ? $latestversion[1] : '';
|
$isnewerversion = 2;
|
||||||
$_link = isset($latestversion[2]) ? $latestversion[2] : htmlspecialchars($filename . '?s=' . urlencode($s) . '&page=' . urlencode($page) . '&lookfornewversion=yes');
|
} elseif (version_compare2($version, $_version) == -1) {
|
||||||
|
$isnewerversion = 1;
|
||||||
// add the branding so debian guys are not gettings confused
|
|
||||||
// about their version-number
|
|
||||||
$lookfornewversion_lable = $_version.$branding;
|
|
||||||
$lookfornewversion_link = $_link;
|
|
||||||
$lookfornewversion_addinfo = $_message;
|
|
||||||
|
|
||||||
// not numeric -> error-message
|
|
||||||
if (!preg_match('/^((\d+\\.)(\d+\\.)(\d+\\.)?(\d+)?(\-(svn|dev|rc)(\d+))?)$/', $_version)) {
|
|
||||||
// check for customized version to not output
|
|
||||||
// "There is a newer version of froxlor" besides the error-message
|
|
||||||
$isnewerversion = 2;
|
|
||||||
} elseif (version_compare2($version, $_version) == -1) {
|
|
||||||
$isnewerversion = 1;
|
|
||||||
} else {
|
|
||||||
$isnewerversion = 0;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
redirectTo($update_check_uri.'/pretty', NULL, false);
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
redirectTo($update_check_uri.'/pretty', NULL, false);
|
$isnewerversion = 0;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
redirectTo($update_check_uri.'/pretty', NULL, false);
|
redirectTo($update_check_uri.'/pretty', NULL, false);
|
||||||
|
|||||||
@@ -349,7 +349,7 @@ if ($page == 'overview') {
|
|||||||
$fpmconfigs = '';
|
$fpmconfigs = '';
|
||||||
$configs = Database::query("SELECT * FROM `" . TABLE_PANEL_FPMDAEMONS . "` ORDER BY `description` ASC");
|
$configs = Database::query("SELECT * FROM `" . TABLE_PANEL_FPMDAEMONS . "` ORDER BY `description` ASC");
|
||||||
while ($row = $configs->fetch(PDO::FETCH_ASSOC)) {
|
while ($row = $configs->fetch(PDO::FETCH_ASSOC)) {
|
||||||
$fpmconfigs .= makeoption($row['description'], $row['id'], $id, true, true);
|
$fpmconfigs .= makeoption($row['description'], $row['id'], $result['fpmsettingid'], true, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
$phpconfig_edit_data = include_once dirname(__FILE__) . '/lib/formfields/admin/phpconfig/formfield.phpconfig_edit.php';
|
$phpconfig_edit_data = include_once dirname(__FILE__) . '/lib/formfields/admin/phpconfig/formfield.phpconfig_edit.php';
|
||||||
@@ -496,7 +496,7 @@ if ($page == 'overview') {
|
|||||||
// set default fpm daemon config for all php-config that use this config that is to be deleted
|
// set default fpm daemon config for all php-config that use this config that is to be deleted
|
||||||
$upd_stmt = Database::prepare("
|
$upd_stmt = Database::prepare("
|
||||||
UPDATE `" . TABLE_PANEL_PHPCONFIGS . "` SET
|
UPDATE `" . TABLE_PANEL_PHPCONFIGS . "` SET
|
||||||
`phpsettingid` = '1' WHERE `phpsettingid` = :id");
|
`fpmsettingid` = '1' WHERE `fpmsettingid` = :id");
|
||||||
Database::pexecute($upd_stmt, array(
|
Database::pexecute($upd_stmt, array(
|
||||||
'id' => $id
|
'id' => $id
|
||||||
));
|
));
|
||||||
|
|||||||
@@ -686,7 +686,7 @@ opcache.interned_strings_buffer'),
|
|||||||
('panel', 'password_special_char_required', '0'),
|
('panel', 'password_special_char_required', '0'),
|
||||||
('panel', 'password_special_char', '!?<>§$%+#=@'),
|
('panel', 'password_special_char', '!?<>§$%+#=@'),
|
||||||
('panel', 'customer_hide_options', ''),
|
('panel', 'customer_hide_options', ''),
|
||||||
('panel', 'version', '0.9.39'),
|
('panel', 'version', '0.9.39.2'),
|
||||||
('panel', 'db_version', '201801260');
|
('panel', 'db_version', '201801260');
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
427
install/scripts/config-services.php
Executable file
427
install/scripts/config-services.php
Executable file
@@ -0,0 +1,427 @@
|
|||||||
|
#!/usr/bin/php
|
||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This file is part of the Froxlor project.
|
||||||
|
* Copyright (c) 2018 the Froxlor Team (see authors).
|
||||||
|
*
|
||||||
|
* For the full copyright and license information, please view the COPYING
|
||||||
|
* file that was distributed with this source code. You can also view the
|
||||||
|
* COPYING file online at http://files.froxlor.org/misc/COPYING.txt
|
||||||
|
*
|
||||||
|
* @copyright (c) the authors
|
||||||
|
* @author Froxlor team <team@froxlor.org> (2018-)
|
||||||
|
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt
|
||||||
|
* @package Cron
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
// Check if we're in the CLI
|
||||||
|
if (@php_sapi_name() !== 'cli') {
|
||||||
|
die('This script will only work in the shell.');
|
||||||
|
}
|
||||||
|
|
||||||
|
require dirname(dirname(__DIR__)) . '/lib/classes/output/class.CmdLineHandler.php';
|
||||||
|
|
||||||
|
class ConfigServicesCmd extends CmdLineHandler
|
||||||
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* list of valid switches
|
||||||
|
*
|
||||||
|
* @var array
|
||||||
|
*/
|
||||||
|
public static $switches = array(
|
||||||
|
'h'
|
||||||
|
);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* list of valid parameters
|
||||||
|
*
|
||||||
|
* @var array
|
||||||
|
*/
|
||||||
|
public static $params = array(
|
||||||
|
'create',
|
||||||
|
'apply',
|
||||||
|
'daemon',
|
||||||
|
'list-daemons',
|
||||||
|
'froxlor-dir',
|
||||||
|
'help'
|
||||||
|
);
|
||||||
|
|
||||||
|
public static $action_class = 'Action';
|
||||||
|
|
||||||
|
public static function printHelp()
|
||||||
|
{
|
||||||
|
self::println("");
|
||||||
|
self::println("Help / command line parameters:");
|
||||||
|
self::println("");
|
||||||
|
// commands
|
||||||
|
self::println("--create\t\tlets you create a services list configuration for the 'apply' command");
|
||||||
|
self::println("");
|
||||||
|
self::println("--apply\t\t\tconfigure your services by given configuration file. To create one run the --create command");
|
||||||
|
self::println("\t\t\tExample: --apply=/path/to/my-config.json");
|
||||||
|
self::println("");
|
||||||
|
self::println("--list-daemons\t\tOutput the services that are going to be configured using a given config file. No services will be configured.");
|
||||||
|
self::println("\t\t\tExample: --apply=/path/to/my-config.json --list-daemons");
|
||||||
|
self::println("");
|
||||||
|
self::println("--daemon\t\tWhen running --apply you can specify a daemon. This will be the only service that gets configured");
|
||||||
|
self::println("\t\t\tExample: --apply=/path/to/my-config.json --daemon=apache24");
|
||||||
|
self::println("");
|
||||||
|
self::println("--froxlor-dir\t\tpath to froxlor installation");
|
||||||
|
self::println("\t\t\tExample: --froxlor-dir=/var/www/froxlor/");
|
||||||
|
self::println("");
|
||||||
|
self::println("--help\t\t\tshow help screen (this)");
|
||||||
|
self::println("");
|
||||||
|
// switches
|
||||||
|
// self::println("-d\t\t\tenable debug output");
|
||||||
|
self::println("-h\t\t\tsame as --help");
|
||||||
|
self::println("");
|
||||||
|
|
||||||
|
die(); // end of execution
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class Action
|
||||||
|
{
|
||||||
|
|
||||||
|
private $_args = null;
|
||||||
|
|
||||||
|
private $_name = null;
|
||||||
|
|
||||||
|
private $_db = null;
|
||||||
|
|
||||||
|
public function __construct($args)
|
||||||
|
{
|
||||||
|
$this->_args = $args;
|
||||||
|
$this->_validate();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getActionName()
|
||||||
|
{
|
||||||
|
return $this->_name;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* validates the parsed command line parameters
|
||||||
|
*
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
|
private function _validate()
|
||||||
|
{
|
||||||
|
$this->_checkConfigParam(true);
|
||||||
|
$this->_parseConfig();
|
||||||
|
|
||||||
|
require FROXLOR_INSTALL_DIR . '/lib/tables.inc.php';
|
||||||
|
require FROXLOR_INSTALL_DIR . '/lib/functions.php';
|
||||||
|
require FROXLOR_INSTALL_DIR . '/lib/classes/settings/class.Settings.php';
|
||||||
|
require FROXLOR_INSTALL_DIR . '/lib/classes/config/class.ConfigParser.php';
|
||||||
|
require FROXLOR_INSTALL_DIR . '/lib/classes/config/class.ConfigService.php';
|
||||||
|
require FROXLOR_INSTALL_DIR . '/lib/classes/config/class.ConfigDaemon.php';
|
||||||
|
|
||||||
|
if (array_key_exists("create", $this->_args)) {
|
||||||
|
$this->_createConfig();
|
||||||
|
} elseif (array_key_exists("apply", $this->_args)) {
|
||||||
|
$this->_applyConfig();
|
||||||
|
} elseif (array_key_exists("list-daemons", $this->_args) || array_key_exists("daemon", $this->_args)) {
|
||||||
|
CmdLineHandler::printwarn("--list-daemons and --daemon only work together with --apply");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private function _createConfig()
|
||||||
|
{
|
||||||
|
$_daemons_config = array(
|
||||||
|
'distro' => ""
|
||||||
|
);
|
||||||
|
|
||||||
|
$config_dir = FROXLOR_INSTALL_DIR . '/lib/configfiles/';
|
||||||
|
// show list of available distro's
|
||||||
|
$distros = glob($config_dir . '*.xml');
|
||||||
|
// tmp array
|
||||||
|
$distributions_select_data = array();
|
||||||
|
// read in all the distros
|
||||||
|
foreach ($distros as $_distribution) {
|
||||||
|
// get configparser object
|
||||||
|
$dist = new ConfigParser($_distribution);
|
||||||
|
// get distro-info
|
||||||
|
$dist_display = $this->getCompleteDistroName($dist);
|
||||||
|
// store in tmp array
|
||||||
|
$distributions_select_data[$dist_display] = str_replace(".xml", "", strtolower(basename($_distribution)));
|
||||||
|
}
|
||||||
|
|
||||||
|
// sort by distribution name
|
||||||
|
ksort($distributions_select_data);
|
||||||
|
|
||||||
|
// list all distributions
|
||||||
|
$mask = "|%-50.50s |%-50.50s |\n";
|
||||||
|
printf($mask, str_repeat("-", 50), str_repeat("-", 50));
|
||||||
|
printf($mask, 'dist', 'name');
|
||||||
|
printf($mask, str_repeat("-", 50), str_repeat("-", 50));
|
||||||
|
foreach ($distributions_select_data as $name => $filename) {
|
||||||
|
printf($mask, $filename, $name);
|
||||||
|
}
|
||||||
|
printf($mask, str_repeat("-", 50), str_repeat("-", 50));
|
||||||
|
echo PHP_EOL;
|
||||||
|
|
||||||
|
while (! in_array($_daemons_config['distro'], $distributions_select_data)) {
|
||||||
|
$_daemons_config['distro'] = CmdLineHandler::getInput("choose distribution", "stretch");
|
||||||
|
}
|
||||||
|
|
||||||
|
// go through all services and let user check whether to include it or not
|
||||||
|
$configfiles = new ConfigParser($config_dir . '/' . $_daemons_config['distro'] . ".xml");
|
||||||
|
$services = $configfiles->getServices();
|
||||||
|
|
||||||
|
foreach ($services as $si => $service) {
|
||||||
|
echo PHP_EOL . "--- " . strtoupper($si) . " ---" . PHP_EOL . PHP_EOL;
|
||||||
|
$_daemons_config[$si] = "";
|
||||||
|
|
||||||
|
$daemons = $service->getDaemons();
|
||||||
|
$mask = "|%-50.50s |%-50.50s |\n";
|
||||||
|
printf($mask, str_repeat("-", 50), str_repeat("-", 50));
|
||||||
|
printf($mask, 'value', 'name');
|
||||||
|
printf($mask, str_repeat("-", 50), str_repeat("-", 50));
|
||||||
|
$default_daemon = "";
|
||||||
|
foreach ($daemons as $di => $dd) {
|
||||||
|
$title = $dd->title;
|
||||||
|
if ($dd->default) {
|
||||||
|
$default_daemon = $di;
|
||||||
|
$title = $title . " (default)";
|
||||||
|
}
|
||||||
|
printf($mask, $di, $title);
|
||||||
|
}
|
||||||
|
printf($mask, "x", "No " . $si);
|
||||||
|
$daemons['x'] = 'x';
|
||||||
|
printf($mask, str_repeat("-", 50), str_repeat("-", 50));
|
||||||
|
echo PHP_EOL;
|
||||||
|
if ($si == 'system') {
|
||||||
|
$_daemons_config[$si] = array();
|
||||||
|
// for the system/other services we need a multiple choice possibility
|
||||||
|
CmdLineHandler::println("Select every service you need. Enter empty value when done");
|
||||||
|
$sysservice = "";
|
||||||
|
do {
|
||||||
|
$sysservice = CmdLineHandler::getInput("choose service");
|
||||||
|
if (! empty($sysservice)) {
|
||||||
|
$_daemons_config[$si][] = $sysservice;
|
||||||
|
}
|
||||||
|
} while (! empty($sysservice));
|
||||||
|
} else {
|
||||||
|
// for all others -> only one value
|
||||||
|
while (! array_key_exists($_daemons_config[$si], $daemons)) {
|
||||||
|
$_daemons_config[$si] = CmdLineHandler::getInput("choose service", $default_daemon);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
echo PHP_EOL . PHP_EOL;
|
||||||
|
$daemons_config = json_encode($_daemons_config);
|
||||||
|
$output = CmdLineHandler::getInput("choose output-filename", "/tmp/froxlor-config-" . date('Ymd') . ".json");
|
||||||
|
file_put_contents($output, $daemons_config);
|
||||||
|
CmdLineHandler::printsucc("Successfully generated service-configfile '" . $output . "'");
|
||||||
|
}
|
||||||
|
|
||||||
|
private function getCompleteDistroName($cparser)
|
||||||
|
{
|
||||||
|
// get distro-info
|
||||||
|
$dist_display = $cparser->distributionName;
|
||||||
|
if ($cparser->distributionCodename != '') {
|
||||||
|
$dist_display .= " " . $cparser->distributionCodename;
|
||||||
|
}
|
||||||
|
if ($cparser->distributionVersion != '') {
|
||||||
|
$dist_display .= " (" . $cparser->distributionVersion . ")";
|
||||||
|
}
|
||||||
|
if ($cparser->deprecated) {
|
||||||
|
$dist_display .= " [deprecated]";
|
||||||
|
}
|
||||||
|
return $dist_display;
|
||||||
|
}
|
||||||
|
|
||||||
|
private function _applyConfig()
|
||||||
|
{
|
||||||
|
if (! is_file($this->_args["apply"])) {
|
||||||
|
throw new Exception("Given config file is not a file");
|
||||||
|
} elseif (! file_exists($this->_args["apply"])) {
|
||||||
|
throw new Exception("Given config file cannot be found ('" . $this->_args["apply"] . "')");
|
||||||
|
} elseif (! is_readable($this->_args["apply"])) {
|
||||||
|
throw new Exception("Given config file cannot be read ('" . $this->_args["apply"] . "')");
|
||||||
|
}
|
||||||
|
|
||||||
|
$config = file_get_contents($this->_args["apply"]);
|
||||||
|
$decoded_config = json_decode($config, true);
|
||||||
|
|
||||||
|
if (array_key_exists("list-daemons", $this->_args)) {
|
||||||
|
$mask = "|%-50.50s |%-50.50s |\n";
|
||||||
|
printf($mask, str_repeat("-", 50), str_repeat("-", 50));
|
||||||
|
printf($mask, 'service', 'daemon');
|
||||||
|
printf($mask, str_repeat("-", 50), str_repeat("-", 50));
|
||||||
|
foreach ($decoded_config as $service => $daemon) {
|
||||||
|
if (is_array($daemon) && count($daemon) > 0) {
|
||||||
|
foreach ($daemon as $sysdaemon) {
|
||||||
|
printf($mask, $service, $sysdaemon);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if ($daemon == 'x') {
|
||||||
|
$daemon = '--- skipped ---';
|
||||||
|
}
|
||||||
|
printf($mask, $service, $daemon);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
printf($mask, str_repeat("-", 50), str_repeat("-", 50));
|
||||||
|
echo PHP_EOL;
|
||||||
|
exit();
|
||||||
|
}
|
||||||
|
|
||||||
|
$only_daemon = null;
|
||||||
|
if (array_key_exists("daemon", $this->_args)) {
|
||||||
|
$only_daemon = $this->_args['daemon'];
|
||||||
|
}
|
||||||
|
|
||||||
|
if (! empty($decoded_config)) {
|
||||||
|
$config_dir = FROXLOR_INSTALL_DIR . '/lib/configfiles/';
|
||||||
|
$configfiles = new ConfigParser($config_dir . '/' . $decoded_config['distro'] . ".xml");
|
||||||
|
$services = $configfiles->getServices();
|
||||||
|
$replace_arr = $this->_getReplacerArray();
|
||||||
|
|
||||||
|
foreach ($services as $si => $service) {
|
||||||
|
echo PHP_EOL . "--- Configuring: " . strtoupper($si) . " ---" . PHP_EOL . PHP_EOL;
|
||||||
|
if (! isset($decoded_config[$si]) || $decoded_config[$si] == 'x') {
|
||||||
|
CmdLineHandler::printwarn("Skipping " . strtoupper($si) . " configuration as desired");
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
$daemons = $service->getDaemons();
|
||||||
|
foreach ($daemons as $di => $dd) {
|
||||||
|
// check for desired service
|
||||||
|
if (($si != 'system' && $decoded_config[$si] != $di) || (is_array($decoded_config[$si]) && ! in_array($di, $decoded_config[$si]))) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
CmdLineHandler::println("Configuring '" . $di . "'");
|
||||||
|
|
||||||
|
if (! empty($only_daemon) && $only_daemon != $di) {
|
||||||
|
CmdLineHandler::printwarn("Skipping " . $di . " configuration as desired");
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
// run all cmds
|
||||||
|
$confarr = $dd->getConfig();
|
||||||
|
foreach ($confarr as $idx => $action) {
|
||||||
|
switch ($action['type']) {
|
||||||
|
case "install":
|
||||||
|
CmdLineHandler::println("Installing required packages");
|
||||||
|
passthru(strtr($action['content'], $replace_arr), $result);
|
||||||
|
if (strlen($result) > 1) {
|
||||||
|
echo $result;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case "command":
|
||||||
|
exec(strtr($action['content'], $replace_arr));
|
||||||
|
break;
|
||||||
|
case "file":
|
||||||
|
if (array_key_exists('content', $action)) {
|
||||||
|
CmdLineHandler::printwarn("Creating file '" . $action['name'] . "'");
|
||||||
|
file_put_contents($action['name'], strtr($action['content'], $replace_arr));
|
||||||
|
} elseif (array_key_exists('subcommands', $action)) {
|
||||||
|
foreach ($action['subcommands'] as $fileaction) {
|
||||||
|
if (array_key_exists('execute', $fileaction) && $fileaction['execute'] == "pre") {
|
||||||
|
exec(strtr($fileaction['content'], $replace_arr));
|
||||||
|
} elseif (array_key_exists('execute', $fileaction) && $fileaction['execute'] == "post") {
|
||||||
|
exec(strtr($fileaction['content'], $replace_arr));
|
||||||
|
} elseif ($fileaction['type'] == 'file') {
|
||||||
|
CmdLineHandler::printwarn("Creating file '" . $fileaction['name'] . "'");
|
||||||
|
file_put_contents($fileaction['name'], strtr($fileaction['content'], $replace_arr));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
CmdLineHandler::printsucc("All services have been configured");
|
||||||
|
} else {
|
||||||
|
CmdLineHandler::printerr("Unable to decode given JSON file");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private function _getReplacerArray()
|
||||||
|
{
|
||||||
|
$customer_tmpdir = '/tmp/';
|
||||||
|
if (Settings::Get('system.mod_fcgid') == '1' && Settings::Get('system.mod_fcgid_tmpdir') != '') {
|
||||||
|
$customer_tmpdir = Settings::Get('system.mod_fcgid_tmpdir');
|
||||||
|
} elseif (Settings::Get('phpfpm.enabled') == '1' && Settings::Get('phpfpm.tmpdir') != '') {
|
||||||
|
$customer_tmpdir = Settings::Get('phpfpm.tmpdir');
|
||||||
|
}
|
||||||
|
|
||||||
|
// try to convert namserver hosts to ip's
|
||||||
|
$ns_ips = "";
|
||||||
|
if (Settings::Get('system.nameservers') != '') {
|
||||||
|
$nameservers = explode(',', Settings::Get('system.nameservers'));
|
||||||
|
foreach ($nameservers as $nameserver) {
|
||||||
|
$nameserver = trim($nameserver);
|
||||||
|
$nameserver_ips = gethostbynamel($nameserver);
|
||||||
|
if (is_array($nameserver_ips) && count($nameserver_ips) > 0) {
|
||||||
|
$ns_ips .= implode(",", $nameserver_ips);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Database::needSqlData();
|
||||||
|
$sql = Database::getSqlData();
|
||||||
|
|
||||||
|
$replace_arr = array(
|
||||||
|
'<SQL_UNPRIVILEGED_USER>' => $sql['user'],
|
||||||
|
'<SQL_UNPRIVILEGED_PASSWORD>' => $sql['passwd'],
|
||||||
|
'<SQL_DB>' => $sql['db'],
|
||||||
|
'<SQL_HOST>' => $sql['host'],
|
||||||
|
'<SQL_SOCKET>' => isset($sql['socket']) ? $sql['socket'] : null,
|
||||||
|
'<SERVERNAME>' => Settings::Get('system.hostname'),
|
||||||
|
'<SERVERIP>' => Settings::Get('system.ipaddress'),
|
||||||
|
'<NAMESERVERS>' => Settings::Get('system.nameservers'),
|
||||||
|
'<NAMESERVERS_IP>' => $ns_ips,
|
||||||
|
'<AXFRSERVERS>' => Settings::Get('system.axfrservers'),
|
||||||
|
'<VIRTUAL_MAILBOX_BASE>' => Settings::Get('system.vmail_homedir'),
|
||||||
|
'<VIRTUAL_UID_MAPS>' => Settings::Get('system.vmail_uid'),
|
||||||
|
'<VIRTUAL_GID_MAPS>' => Settings::Get('system.vmail_gid'),
|
||||||
|
'<SSLPROTOCOLS>' => (Settings::Get('system.use_ssl') == '1') ? 'imaps pop3s' : '',
|
||||||
|
'<CUSTOMER_TMP>' => makeCorrectDir($customer_tmpdir),
|
||||||
|
'<BASE_PATH>' => makeCorrectDir(FROXLOR_INSTALL_DIR),
|
||||||
|
'<BIND_CONFIG_PATH>' => makeCorrectDir(Settings::Get('system.bindconf_directory')),
|
||||||
|
'<WEBSERVER_RELOAD_CMD>' => Settings::Get('system.apachereload_command'),
|
||||||
|
'<CUSTOMER_LOGS>' => makeCorrectDir(Settings::Get('system.logfiles_directory')),
|
||||||
|
'<FPM_IPCDIR>' => makeCorrectDir(Settings::Get('phpfpm.fastcgi_ipcdir')),
|
||||||
|
'<WEBSERVER_GROUP>' => Settings::Get('system.httpgroup')
|
||||||
|
);
|
||||||
|
return $replace_arr;
|
||||||
|
}
|
||||||
|
|
||||||
|
private function _parseConfig()
|
||||||
|
{
|
||||||
|
define('FROXLOR_INSTALL_DIR', $this->_args['froxlor-dir']);
|
||||||
|
if (! file_exists(FROXLOR_INSTALL_DIR . '/lib/classes/database/class.Database.php')) {
|
||||||
|
throw new Exception("Could not find froxlor's Database class. Is froxlor really installed to '" . FROXLOR_INSTALL_DIR . "'?");
|
||||||
|
}
|
||||||
|
if (! file_exists(FROXLOR_INSTALL_DIR . '/lib/userdata.inc.php')) {
|
||||||
|
throw new Exception("Could not find froxlor's userdata.inc.php file. You should use this script only with a fully installed and setup froxlor system.");
|
||||||
|
}
|
||||||
|
require FROXLOR_INSTALL_DIR . '/lib/classes/database/class.Database.php';
|
||||||
|
}
|
||||||
|
|
||||||
|
private function _checkConfigParam($needed = false)
|
||||||
|
{
|
||||||
|
if ($needed) {
|
||||||
|
if (! isset($this->_args["froxlor-dir"])) {
|
||||||
|
throw new Exception("No configuration given (missing --froxlor-dir parameter?)");
|
||||||
|
} elseif (! is_dir($this->_args["froxlor-dir"])) {
|
||||||
|
throw new Exception("Given --froxlor-dir parameter is not a directory");
|
||||||
|
} elseif (! file_exists($this->_args["froxlor-dir"])) {
|
||||||
|
throw new Exception("Given froxlor directory cannot be found ('" . $this->_args["froxlor-dir"] . "')");
|
||||||
|
} elseif (! is_readable($this->_args["froxlor-dir"])) {
|
||||||
|
throw new Exception("Given froxlor direcotry cannot be read ('" . $this->_args["froxlor-dir"] . "')");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// give control to command line handler
|
||||||
|
try {
|
||||||
|
ConfigServicesCmd::processParameters($argc, $argv);
|
||||||
|
} catch (Exception $e) {
|
||||||
|
ConfigServicesCmd::printerr($e->getMessage());
|
||||||
|
}
|
||||||
231
install/scripts/switch-server-ip.php
Normal file → Executable file
231
install/scripts/switch-server-ip.php
Normal file → Executable file
@@ -13,46 +13,33 @@
|
|||||||
* @author Froxlor team <team@froxlor.org> (2016-)
|
* @author Froxlor team <team@froxlor.org> (2016-)
|
||||||
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt
|
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt
|
||||||
* @package Cron
|
* @package Cron
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// Check if we're in the CLI
|
// Check if we're in the CLI
|
||||||
if(@php_sapi_name() !== 'cli') {
|
if (@php_sapi_name() !== 'cli') {
|
||||||
die('This script will only work in the shell.');
|
die('This script will only work in the shell.');
|
||||||
}
|
}
|
||||||
|
|
||||||
// give control to command line handler
|
require dirname(dirname(__DIR__)) . '/lib/classes/output/class.CmdLineHandler.php';
|
||||||
try {
|
|
||||||
CmdLineHandler::processParameters($argc, $argv);
|
|
||||||
} catch (Exception $e) {
|
|
||||||
CmdLineHandler::printerr($e->getMessage());
|
|
||||||
}
|
|
||||||
|
|
||||||
class CmdLineHandler
|
class SwitchServerIp extends CmdLineHandler
|
||||||
{
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* internal variable for passed arguments
|
* list of valid switches
|
||||||
*
|
*
|
||||||
* @var array
|
* @var array
|
||||||
*/
|
*/
|
||||||
private static $args = null;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Action object read from commandline/config
|
|
||||||
*
|
|
||||||
* @var Action
|
|
||||||
*/
|
|
||||||
private $_action = null;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* list of valid parameters/switches
|
|
||||||
*/
|
|
||||||
public static $switches = array(
|
public static $switches = array(
|
||||||
/* 'd', // debug / output information for everything */
|
|
||||||
'h'
|
'h'
|
||||||
);
|
);
|
||||||
// same as --help
|
|
||||||
|
/**
|
||||||
|
* list of valid parameters
|
||||||
|
*
|
||||||
|
* @var array
|
||||||
|
*/
|
||||||
public static $params = array(
|
public static $params = array(
|
||||||
'switch',
|
'switch',
|
||||||
'list',
|
'list',
|
||||||
@@ -60,131 +47,7 @@ class CmdLineHandler
|
|||||||
'help'
|
'help'
|
||||||
);
|
);
|
||||||
|
|
||||||
/**
|
public static $action_class = 'Action';
|
||||||
* Returns a CmdLineHandler object with given
|
|
||||||
* arguments from command line
|
|
||||||
*
|
|
||||||
* @param int $argc
|
|
||||||
* @param array $argv
|
|
||||||
*
|
|
||||||
* @return CmdLineHandler
|
|
||||||
*/
|
|
||||||
public static function processParameters($argc, $argv)
|
|
||||||
{
|
|
||||||
return new CmdLineHandler($argc, $argv);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* returns the Action object generated in
|
|
||||||
* the class constructor
|
|
||||||
*
|
|
||||||
* @return Action
|
|
||||||
*/
|
|
||||||
public function getAction()
|
|
||||||
{
|
|
||||||
return $this->_action;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* class constructor, validates the command line parameters
|
|
||||||
* and sets the Action-object if valid
|
|
||||||
*
|
|
||||||
* @param int $argc
|
|
||||||
* @param string[] $argv
|
|
||||||
*
|
|
||||||
* @return null
|
|
||||||
* @throws Exception
|
|
||||||
*/
|
|
||||||
private function __construct($argc, $argv)
|
|
||||||
{
|
|
||||||
self::$args = $this->_parseArgs($argv);
|
|
||||||
$this->_action = $this->_createAction();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Parses the arguments given via the command line;
|
|
||||||
* three types are supported:
|
|
||||||
* 1.
|
|
||||||
* --parm1 or --parm2=value
|
|
||||||
* 2. -xyz (multiple switches in one) or -a=value
|
|
||||||
* 3. parm1 parm2
|
|
||||||
*
|
|
||||||
* The 1. will be mapped as
|
|
||||||
* ["parm1"] => true, ["parm2"] => "value"
|
|
||||||
* The 2. as
|
|
||||||
* ["x"] => true, ["y"] => true, ["z"] => true, ["a"] => "value"
|
|
||||||
* And the 3. as
|
|
||||||
* [0] => "parm1", [1] => "parm2"
|
|
||||||
*
|
|
||||||
* @param array $argv
|
|
||||||
*
|
|
||||||
* @return array
|
|
||||||
*/
|
|
||||||
private function _parseArgs($argv)
|
|
||||||
{
|
|
||||||
array_shift($argv);
|
|
||||||
$o = array();
|
|
||||||
foreach ($argv as $a) {
|
|
||||||
if (substr($a, 0, 2) == '--') {
|
|
||||||
$eq = strpos($a, '=');
|
|
||||||
if ($eq !== false) {
|
|
||||||
$o[substr($a, 2, $eq - 2)] = substr($a, $eq + 1);
|
|
||||||
} else {
|
|
||||||
$k = substr($a, 2);
|
|
||||||
if (! isset($o[$k])) {
|
|
||||||
$o[$k] = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else
|
|
||||||
if (substr($a, 0, 1) == '-') {
|
|
||||||
if (substr($a, 2, 1) == '=') {
|
|
||||||
$o[substr($a, 1, 1)] = substr($a, 3);
|
|
||||||
} else {
|
|
||||||
foreach (str_split(substr($a, 1)) as $k) {
|
|
||||||
if (! isset($o[$k])) {
|
|
||||||
$o[$k] = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
$o[] = $a;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return $o;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Creates an Action-Object for the Action-Handler
|
|
||||||
*
|
|
||||||
* @return Action
|
|
||||||
* @throws Exception
|
|
||||||
*/
|
|
||||||
private function _createAction()
|
|
||||||
{
|
|
||||||
|
|
||||||
// Test for help-switch
|
|
||||||
if (empty(self::$args) || array_key_exists("help", self::$args) || array_key_exists("h", self::$args)) {
|
|
||||||
self::printHelp();
|
|
||||||
// end of execution
|
|
||||||
}
|
|
||||||
// check if no unknown parameters are present
|
|
||||||
foreach (self::$args as $arg => $value) {
|
|
||||||
|
|
||||||
if (is_numeric($arg)) {
|
|
||||||
throw new Exception("Unknown parameter '" . $value . "' in argument list");
|
|
||||||
} elseif (! in_array($arg, self::$params) && ! in_array($arg, self::$switches)) {
|
|
||||||
throw new Exception("Unknown parameter '" . $arg . "' in argument list");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// set debugger switch
|
|
||||||
if (isset(self::$args["d"]) && self::$args["d"] == true) {
|
|
||||||
// Debugger::getInstance()->setEnabled(true);
|
|
||||||
// Debugger::getInstance()->debug("debug output enabled");
|
|
||||||
}
|
|
||||||
|
|
||||||
return new Action(self::$args);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static function printHelp()
|
public static function printHelp()
|
||||||
{
|
{
|
||||||
@@ -207,34 +70,9 @@ class CmdLineHandler
|
|||||||
// self::println("-d\t\t\tenable debug output");
|
// self::println("-d\t\t\tenable debug output");
|
||||||
self::println("-h\t\t\tsame as --help");
|
self::println("-h\t\t\tsame as --help");
|
||||||
self::println("");
|
self::println("");
|
||||||
|
|
||||||
die(); // end of execution
|
die(); // end of execution
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function println($msg = "")
|
|
||||||
{
|
|
||||||
print $msg . PHP_EOL;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static function _printcolor($msg = "", $color = "0")
|
|
||||||
{
|
|
||||||
print "\033[" . $color . "m" . $msg . "\033[0m" . PHP_EOL;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static function printerr($msg = "")
|
|
||||||
{
|
|
||||||
self::_printcolor($msg, "31");
|
|
||||||
}
|
|
||||||
|
|
||||||
public static function printsucc($msg = "")
|
|
||||||
{
|
|
||||||
self::_printcolor($msg, "32");
|
|
||||||
}
|
|
||||||
|
|
||||||
public static function printwarn($msg = "")
|
|
||||||
{
|
|
||||||
self::_printcolor($msg, "33");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class Action
|
class Action
|
||||||
@@ -268,11 +106,11 @@ class Action
|
|||||||
if (array_key_exists("list", $this->_args) || array_key_exists("switch", $this->_args)) {
|
if (array_key_exists("list", $this->_args) || array_key_exists("switch", $this->_args)) {
|
||||||
$need_config = true;
|
$need_config = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->_checkConfigParam($need_config);
|
$this->_checkConfigParam($need_config);
|
||||||
|
|
||||||
$this->_parseConfig();
|
$this->_parseConfig();
|
||||||
|
|
||||||
if (array_key_exists("list", $this->_args)) {
|
if (array_key_exists("list", $this->_args)) {
|
||||||
$this->_listIPs();
|
$this->_listIPs();
|
||||||
}
|
}
|
||||||
@@ -300,11 +138,11 @@ class Action
|
|||||||
private function _switchIPs()
|
private function _switchIPs()
|
||||||
{
|
{
|
||||||
$ip_list = $this->_args['switch'];
|
$ip_list = $this->_args['switch'];
|
||||||
|
|
||||||
if (empty($ip_list) || is_bool($ip_list)) {
|
if (empty($ip_list) || is_bool($ip_list)) {
|
||||||
throw new Exception("No paramters given for --switch action.");
|
throw new Exception("No paramters given for --switch action.");
|
||||||
}
|
}
|
||||||
|
|
||||||
$ips_to_switch = array();
|
$ips_to_switch = array();
|
||||||
$ip_list = explode(" ", $ip_list);
|
$ip_list = explode(" ", $ip_list);
|
||||||
foreach ($ip_list as $ips_combo) {
|
foreach ($ip_list as $ips_combo) {
|
||||||
@@ -324,22 +162,22 @@ class Action
|
|||||||
}
|
}
|
||||||
$ips_to_switch[] = $ip_pair;
|
$ips_to_switch[] = $ip_pair;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (count($ips_to_switch) > 0) {
|
if (count($ips_to_switch) > 0) {
|
||||||
$upd_stmt = Database::prepare("UPDATE panel_ipsandports SET `ip` = :newip WHERE `ip` = :oldip");
|
$upd_stmt = Database::prepare("UPDATE panel_ipsandports SET `ip` = :newip WHERE `ip` = :oldip");
|
||||||
|
|
||||||
// system.ipaddress
|
// system.ipaddress
|
||||||
$check_sysip_stmt = Database::prepare("SELECT `value` FROM `panel_settings` WHERE `settinggroup` = 'system' and `varname` = 'ipaddress'");
|
$check_sysip_stmt = Database::prepare("SELECT `value` FROM `panel_settings` WHERE `settinggroup` = 'system' and `varname` = 'ipaddress'");
|
||||||
$check_sysip = Database::pexecute_first($check_sysip_stmt);
|
$check_sysip = Database::pexecute_first($check_sysip_stmt);
|
||||||
|
|
||||||
// system.mysql_access_host
|
// system.mysql_access_host
|
||||||
$check_mysqlip_stmt = Database::prepare("SELECT `value` FROM `panel_settings` WHERE `settinggroup` = 'system' and `varname` = 'mysql_access_host'");
|
$check_mysqlip_stmt = Database::prepare("SELECT `value` FROM `panel_settings` WHERE `settinggroup` = 'system' and `varname` = 'mysql_access_host'");
|
||||||
$check_mysqlip = Database::pexecute_first($check_mysqlip_stmt);
|
$check_mysqlip = Database::pexecute_first($check_mysqlip_stmt);
|
||||||
|
|
||||||
// system.axfrservers
|
// system.axfrservers
|
||||||
$check_axfrip_stmt = Database::prepare("SELECT `value` FROM `panel_settings` WHERE `settinggroup` = 'system' and `varname` = 'axfrservers'");
|
$check_axfrip_stmt = Database::prepare("SELECT `value` FROM `panel_settings` WHERE `settinggroup` = 'system' and `varname` = 'axfrservers'");
|
||||||
$check_axfrip = Database::pexecute_first($check_axfrip_stmt);
|
$check_axfrip = Database::pexecute_first($check_axfrip_stmt);
|
||||||
|
|
||||||
foreach ($ips_to_switch as $ip_pair) {
|
foreach ($ips_to_switch as $ip_pair) {
|
||||||
echo "Switching IP \033[1m" . $ip_pair[0] . "\033[0m to IP \033[1m" . $ip_pair[1] . "\033[0m" . PHP_EOL;
|
echo "Switching IP \033[1m" . $ip_pair[0] . "\033[0m to IP \033[1m" . $ip_pair[1] . "\033[0m" . PHP_EOL;
|
||||||
Database::pexecute($upd_stmt, array(
|
Database::pexecute($upd_stmt, array(
|
||||||
@@ -347,11 +185,11 @@ class Action
|
|||||||
'oldip' => $ip_pair[0]
|
'oldip' => $ip_pair[0]
|
||||||
));
|
));
|
||||||
$rows_updated = $upd_stmt->rowCount();
|
$rows_updated = $upd_stmt->rowCount();
|
||||||
|
|
||||||
if ($rows_updated == 0) {
|
if ($rows_updated == 0) {
|
||||||
CmdLineHandler::printwarn("Note: " . $ip_pair[0] . " not updated to " . $ip_pair[1] . " (possibly no entry found in froxlor database. Use --list to see what IP addresses are added in froxlor");
|
CmdLineHandler::printwarn("Note: " . $ip_pair[0] . " not updated to " . $ip_pair[1] . " (possibly no entry found in froxlor database. Use --list to see what IP addresses are added in froxlor");
|
||||||
}
|
}
|
||||||
|
|
||||||
// check whether the system.ipaddress needs updating
|
// check whether the system.ipaddress needs updating
|
||||||
if ($check_sysip['value'] == $ip_pair[0]) {
|
if ($check_sysip['value'] == $ip_pair[0]) {
|
||||||
$upd2_stmt = Database::prepare("UPDATE `panel_settings` SET `value` = :newip WHERE `settinggroup` = 'system' and `varname` = 'ipaddress'");
|
$upd2_stmt = Database::prepare("UPDATE `panel_settings` SET `value` = :newip WHERE `settinggroup` = 'system' and `varname` = 'ipaddress'");
|
||||||
@@ -360,7 +198,7 @@ class Action
|
|||||||
));
|
));
|
||||||
CmdLineHandler::printsucc("Updated system-ipaddress from '" . $ip_pair[0] . "' to '" . $ip_pair[1] . "'");
|
CmdLineHandler::printsucc("Updated system-ipaddress from '" . $ip_pair[0] . "' to '" . $ip_pair[1] . "'");
|
||||||
}
|
}
|
||||||
|
|
||||||
// check whether the system.mysql_access_host needs updating
|
// check whether the system.mysql_access_host needs updating
|
||||||
if (strstr($check_mysqlip['value'], $ip_pair[0]) !== false) {
|
if (strstr($check_mysqlip['value'], $ip_pair[0]) !== false) {
|
||||||
$new_mysqlip = str_replace($ip_pair[0], $ip_pair[1], $check_mysqlip['value']);
|
$new_mysqlip = str_replace($ip_pair[0], $ip_pair[1], $check_mysqlip['value']);
|
||||||
@@ -370,7 +208,7 @@ class Action
|
|||||||
));
|
));
|
||||||
CmdLineHandler::printsucc("Updated mysql_access_host from '" . $check_mysqlip['value'] . "' to '" . $new_mysqlip . "'");
|
CmdLineHandler::printsucc("Updated mysql_access_host from '" . $check_mysqlip['value'] . "' to '" . $new_mysqlip . "'");
|
||||||
}
|
}
|
||||||
|
|
||||||
// check whether the system.axfrservers needs updating
|
// check whether the system.axfrservers needs updating
|
||||||
if (strstr($check_axfrip['value'], $ip_pair[0]) !== false) {
|
if (strstr($check_axfrip['value'], $ip_pair[0]) !== false) {
|
||||||
$new_axfrip = str_replace($ip_pair[0], $ip_pair[1], $check_axfrip['value']);
|
$new_axfrip = str_replace($ip_pair[0], $ip_pair[1], $check_axfrip['value']);
|
||||||
@@ -382,7 +220,7 @@ class Action
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
echo PHP_EOL;
|
echo PHP_EOL;
|
||||||
CmdLineHandler::printwarn("*** ATTENTION *** Remember to replace IP addresses in configuration files if used anywhere.");
|
CmdLineHandler::printwarn("*** ATTENTION *** Remember to replace IP addresses in configuration files if used anywhere.");
|
||||||
CmdLineHandler::printsucc("IP addresses updated");
|
CmdLineHandler::printsucc("IP addresses updated");
|
||||||
@@ -391,10 +229,10 @@ class Action
|
|||||||
private function _parseConfig()
|
private function _parseConfig()
|
||||||
{
|
{
|
||||||
define('FROXLOR_INSTALL_DIR', $this->_args['froxlor-dir']);
|
define('FROXLOR_INSTALL_DIR', $this->_args['froxlor-dir']);
|
||||||
if (!file_exists(FROXLOR_INSTALL_DIR . '/lib/classes/database/class.Database.php')) {
|
if (! file_exists(FROXLOR_INSTALL_DIR . '/lib/classes/database/class.Database.php')) {
|
||||||
throw new Exception("Could not find froxlor's Database class. Is froxlor really installed to '".FROXLOR_INSTALL_DIR."'?");
|
throw new Exception("Could not find froxlor's Database class. Is froxlor really installed to '" . FROXLOR_INSTALL_DIR . "'?");
|
||||||
}
|
}
|
||||||
if (!file_exists(FROXLOR_INSTALL_DIR . '/lib/userdata.inc.php')) {
|
if (! file_exists(FROXLOR_INSTALL_DIR . '/lib/userdata.inc.php')) {
|
||||||
throw new Exception("Could not find froxlor's userdata.inc.php file. You should use this script only with a fully installed and setup froxlor system.");
|
throw new Exception("Could not find froxlor's userdata.inc.php file. You should use this script only with a fully installed and setup froxlor system.");
|
||||||
}
|
}
|
||||||
require FROXLOR_INSTALL_DIR . '/lib/classes/database/class.Database.php';
|
require FROXLOR_INSTALL_DIR . '/lib/classes/database/class.Database.php';
|
||||||
@@ -415,3 +253,10 @@ class Action
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// give control to command line handler
|
||||||
|
try {
|
||||||
|
SwitchServerIp::processParameters($argc, $argv);
|
||||||
|
} catch (Exception $e) {
|
||||||
|
SwitchServerIp::printerr($e->getMessage());
|
||||||
|
}
|
||||||
|
|||||||
@@ -3880,3 +3880,15 @@ if (isFroxlorVersion('0.9.38.8')) {
|
|||||||
showUpdateStep("Updating from 0.9.38.8 to 0.9.39 final", false);
|
showUpdateStep("Updating from 0.9.38.8 to 0.9.39 final", false);
|
||||||
updateToVersion('0.9.39');
|
updateToVersion('0.9.39');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (isFroxlorVersion('0.9.39')) {
|
||||||
|
|
||||||
|
showUpdateStep("Updating from 0.9.39 to 0.9.39.1", false);
|
||||||
|
updateToVersion('0.9.39.1');
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isFroxlorVersion('0.9.39.1')) {
|
||||||
|
|
||||||
|
showUpdateStep("Updating from 0.9.39.1 to 0.9.39.2", false);
|
||||||
|
updateToVersion('0.9.39.2');
|
||||||
|
}
|
||||||
|
|||||||
82
lib/ajax.php
82
lib/ajax.php
@@ -18,7 +18,7 @@
|
|||||||
|
|
||||||
// Load the user settings
|
// Load the user settings
|
||||||
define('FROXLOR_INSTALL_DIR', dirname(dirname(__FILE__)));
|
define('FROXLOR_INSTALL_DIR', dirname(dirname(__FILE__)));
|
||||||
if (!file_exists('./userdata.inc.php')) {
|
if (! file_exists('./userdata.inc.php')) {
|
||||||
die();
|
die();
|
||||||
}
|
}
|
||||||
require './userdata.inc.php';
|
require './userdata.inc.php';
|
||||||
@@ -27,10 +27,11 @@ require './classes/database/class.Database.php';
|
|||||||
require './classes/settings/class.Settings.php';
|
require './classes/settings/class.Settings.php';
|
||||||
require './functions/validate/function.validate_ip.php';
|
require './functions/validate/function.validate_ip.php';
|
||||||
require './functions/validate/function.validateDomain.php';
|
require './functions/validate/function.validateDomain.php';
|
||||||
|
require './classes/cURL/class.HttpClient.php';
|
||||||
|
|
||||||
if(isset($_POST['action'])) {
|
if (isset($_POST['action'])) {
|
||||||
$action = $_POST['action'];
|
$action = $_POST['action'];
|
||||||
} elseif(isset($_GET['action'])) {
|
} elseif (isset($_GET['action'])) {
|
||||||
$action = $_GET['action'];
|
$action = $_GET['action'];
|
||||||
} else {
|
} else {
|
||||||
$action = "";
|
$action = "";
|
||||||
@@ -42,51 +43,31 @@ if ($action == "newsfeed") {
|
|||||||
} else {
|
} else {
|
||||||
$feed = "https://inside.froxlor.org/news/";
|
$feed = "https://inside.froxlor.org/news/";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (function_exists("simplexml_load_file") == false) {
|
if (function_exists("simplexml_load_file") == false) {
|
||||||
die();
|
outputItem("Newsfeed not available due to missing php-simplexml extension", "Please install the php-simplexml extension in order to view our newsfeed.");
|
||||||
|
exit();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (function_exists('curl_version')) {
|
if (function_exists('curl_version')) {
|
||||||
$ch = curl_init();
|
$output = HttpClient::urlGet($feed);
|
||||||
curl_setopt($ch, CURLOPT_URL, $feed);
|
|
||||||
curl_setopt($ch, CURLOPT_USERAGENT, 'Froxlor/'.$version);
|
|
||||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
|
|
||||||
$output = curl_exec($ch);
|
|
||||||
curl_close($ch);
|
|
||||||
$news = simplexml_load_string(trim($output));
|
$news = simplexml_load_string(trim($output));
|
||||||
} else {
|
} else {
|
||||||
if (ini_get('allow_url_fopen')) {
|
outputItem("Newsfeed not available due to missing php-curl extension", "Please install the php-curl extension in order to view our newsfeed.");
|
||||||
ini_set('user_agent', 'Froxlor/'.$version);
|
exit();
|
||||||
$news = simplexml_load_file($feed, null, LIBXML_NOCDATA);
|
|
||||||
} else {
|
|
||||||
$news = false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($news !== false) {
|
if ($news !== false) {
|
||||||
for ($i = 0; $i < 3; $i++) {
|
for ($i = 0; $i < 3; $i ++) {
|
||||||
$item = $news->channel->item[$i];
|
$item = $news->channel->item[$i];
|
||||||
|
|
||||||
$title = (string)$item->title;
|
$title = (string) $item->title;
|
||||||
$link = (string)$item->link;
|
$link = (string) $item->link;
|
||||||
$date = date("Y-m-d G:i", strtotime($item->pubDate));
|
$date = date("Y-m-d G:i", strtotime($item->pubDate));
|
||||||
$content = preg_replace("/[\r\n]+/", " ", strip_tags($item->description));
|
$content = preg_replace("/[\r\n]+/", " ", strip_tags($item->description));
|
||||||
$content = substr($content, 0, 150) . "...";
|
$content = substr($content, 0, 150) . "...";
|
||||||
|
|
||||||
echo "<li class=\"clearfix\">
|
outputItem($title, $content, $link, $date);
|
||||||
<div class=\"newsfeed-body clearfix\">
|
|
||||||
<div class=\"header\">
|
|
||||||
<strong class=\"primary-font\"><a href=\"{$link}\" target=\"_blank\">{$title}</a></strong>
|
|
||||||
<small class=\"pull-right text-muted\">
|
|
||||||
<i class=\"fa fa-clock-o fa-fw\"></i> {$date}
|
|
||||||
</small>
|
|
||||||
</div>
|
|
||||||
<p>
|
|
||||||
{$content}
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
</li>";
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
echo "";
|
echo "";
|
||||||
@@ -94,3 +75,30 @@ if ($action == "newsfeed") {
|
|||||||
} else {
|
} else {
|
||||||
echo "No action set.";
|
echo "No action set.";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function outputItem($title, $content, $link = null, $date = null)
|
||||||
|
{
|
||||||
|
echo "<li class=\"clearfix\">
|
||||||
|
<div class=\"newsfeed-body clearfix\">
|
||||||
|
<div class=\"header\">
|
||||||
|
<strong class=\"primary-font\">";
|
||||||
|
if (! empty($link)) {
|
||||||
|
echo "<a href=\"{$link}\" target=\"_blank\">";
|
||||||
|
}
|
||||||
|
echo $title;
|
||||||
|
if (! empty($link)) {
|
||||||
|
echo "</a>";
|
||||||
|
}
|
||||||
|
echo "</strong>";
|
||||||
|
if (! empty($date)) {
|
||||||
|
echo "<small class=\"pull-right text-muted\">
|
||||||
|
<i class=\"fa fa-clock-o fa-fw\"></i> {$date}
|
||||||
|
</small>";
|
||||||
|
}
|
||||||
|
echo "</div>
|
||||||
|
<p>
|
||||||
|
{$content}
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
</li>";
|
||||||
|
}
|
||||||
|
|||||||
60
lib/classes/cURL/class.HttpClient.php
Normal file
60
lib/classes/cURL/class.HttpClient.php
Normal file
@@ -0,0 +1,60 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
class HttpClient
|
||||||
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Executes simple GET request
|
||||||
|
*
|
||||||
|
* @param string $url
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public static function urlGet($url)
|
||||||
|
{
|
||||||
|
include FROXLOR_INSTALL_DIR . '/lib/version.inc.php';
|
||||||
|
$ch = curl_init();
|
||||||
|
curl_setopt($ch, CURLOPT_URL, $url);
|
||||||
|
curl_setopt($ch, CURLOPT_USERAGENT, 'Froxlor/' . $version);
|
||||||
|
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
|
||||||
|
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
|
||||||
|
$output = curl_exec($ch);
|
||||||
|
if ($output === false) {
|
||||||
|
$e = curl_error($ch);
|
||||||
|
curl_close($ch);
|
||||||
|
throw new \Exception("Curl error: " . $e);
|
||||||
|
}
|
||||||
|
curl_close($ch);
|
||||||
|
return $output;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Downloads and stores a file from an url
|
||||||
|
*
|
||||||
|
* @param string $url
|
||||||
|
* @param string $target
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public static function fileGet($url, $target)
|
||||||
|
{
|
||||||
|
include FROXLOR_INSTALL_DIR . '/lib/version.inc.php';
|
||||||
|
$fh = fopen($target, 'w');
|
||||||
|
$ch = curl_init();
|
||||||
|
curl_setopt($ch, CURLOPT_URL, $url);
|
||||||
|
curl_setopt($ch, CURLOPT_USERAGENT, 'Froxlor/' . $version);
|
||||||
|
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
|
||||||
|
curl_setopt($ch, CURLOPT_TIMEOUT, 50);
|
||||||
|
//give curl the file pointer so that it can write to it
|
||||||
|
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
|
||||||
|
curl_setopt($ch, CURLOPT_FILE, $fh);
|
||||||
|
$output = curl_exec($ch);
|
||||||
|
if ($output === false) {
|
||||||
|
$e = curl_error($ch);
|
||||||
|
curl_close($ch);
|
||||||
|
throw new \Exception("Curl error: " . $e);
|
||||||
|
}
|
||||||
|
curl_close($ch);
|
||||||
|
return $output;
|
||||||
|
}
|
||||||
|
}
|
||||||
196
lib/classes/output/class.CmdLineHandler.php
Normal file
196
lib/classes/output/class.CmdLineHandler.php
Normal file
@@ -0,0 +1,196 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This file is part of the Froxlor project.
|
||||||
|
* Copyright (c) 2018 the Froxlor Team (see authors).
|
||||||
|
*
|
||||||
|
* For the full copyright and license information, please view the COPYING
|
||||||
|
* file that was distributed with this source code. You can also view the
|
||||||
|
* COPYING file online at http://files.froxlor.org/misc/COPYING.txt
|
||||||
|
*
|
||||||
|
* @copyright (c) the authors
|
||||||
|
* @author Froxlor team <team@froxlor.org> (2018-)
|
||||||
|
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt
|
||||||
|
* @package Cron
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
abstract class CmdLineHandler
|
||||||
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* internal variable for passed arguments
|
||||||
|
*
|
||||||
|
* @var array
|
||||||
|
*/
|
||||||
|
private static $args = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Action object read from commandline/config
|
||||||
|
*
|
||||||
|
* @var Action
|
||||||
|
*/
|
||||||
|
private $_action = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns a CmdLineHandler object with given
|
||||||
|
* arguments from command line
|
||||||
|
*
|
||||||
|
* @param int $argc
|
||||||
|
* @param array $argv
|
||||||
|
*
|
||||||
|
* @return CmdLineHandler
|
||||||
|
*/
|
||||||
|
public static function processParameters($argc, $argv)
|
||||||
|
{
|
||||||
|
$me = get_called_class();
|
||||||
|
return new $me($argc, $argv);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* returns the Action object generated in
|
||||||
|
* the class constructor
|
||||||
|
*
|
||||||
|
* @return Action
|
||||||
|
*/
|
||||||
|
public function getAction()
|
||||||
|
{
|
||||||
|
return $this->_action;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* class constructor, validates the command line parameters
|
||||||
|
* and sets the Action-object if valid
|
||||||
|
*
|
||||||
|
* @param int $argc
|
||||||
|
* @param string[] $argv
|
||||||
|
*
|
||||||
|
* @return null
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
|
private function __construct($argc, $argv)
|
||||||
|
{
|
||||||
|
self::$args = $this->_parseArgs($argv);
|
||||||
|
$this->_action = $this->_createAction();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Parses the arguments given via the command line;
|
||||||
|
* three types are supported:
|
||||||
|
* 1.
|
||||||
|
* --parm1 or --parm2=value
|
||||||
|
* 2. -xyz (multiple switches in one) or -a=value
|
||||||
|
* 3. parm1 parm2
|
||||||
|
*
|
||||||
|
* The 1. will be mapped as
|
||||||
|
* ["parm1"] => true, ["parm2"] => "value"
|
||||||
|
* The 2. as
|
||||||
|
* ["x"] => true, ["y"] => true, ["z"] => true, ["a"] => "value"
|
||||||
|
* And the 3. as
|
||||||
|
* [0] => "parm1", [1] => "parm2"
|
||||||
|
*
|
||||||
|
* @param array $argv
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
private function _parseArgs($argv)
|
||||||
|
{
|
||||||
|
array_shift($argv);
|
||||||
|
$o = array();
|
||||||
|
foreach ($argv as $a) {
|
||||||
|
if (substr($a, 0, 2) == '--') {
|
||||||
|
$eq = strpos($a, '=');
|
||||||
|
if ($eq !== false) {
|
||||||
|
$o[substr($a, 2, $eq - 2)] = substr($a, $eq + 1);
|
||||||
|
} else {
|
||||||
|
$k = substr($a, 2);
|
||||||
|
if (! isset($o[$k])) {
|
||||||
|
$o[$k] = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else if (substr($a, 0, 1) == '-') {
|
||||||
|
if (substr($a, 2, 1) == '=') {
|
||||||
|
$o[substr($a, 1, 1)] = substr($a, 3);
|
||||||
|
} else {
|
||||||
|
foreach (str_split(substr($a, 1)) as $k) {
|
||||||
|
if (! isset($o[$k])) {
|
||||||
|
$o[$k] = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$o[] = $a;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $o;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates an Action-Object for the Action-Handler
|
||||||
|
*
|
||||||
|
* @return Action
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
|
private function _createAction()
|
||||||
|
{
|
||||||
|
|
||||||
|
// Test for help-switch
|
||||||
|
if (empty(self::$args) || array_key_exists("help", self::$args) || array_key_exists("h", self::$args)) {
|
||||||
|
static::printHelp();
|
||||||
|
// end of execution
|
||||||
|
}
|
||||||
|
// check if no unknown parameters are present
|
||||||
|
foreach (self::$args as $arg => $value) {
|
||||||
|
|
||||||
|
if (is_numeric($arg)) {
|
||||||
|
throw new Exception("Unknown parameter '" . $value . "' in argument list");
|
||||||
|
} elseif (! in_array($arg, static::$params) && ! in_array($arg, static::$switches)) {
|
||||||
|
throw new Exception("Unknown parameter '" . $arg . "' in argument list");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// set debugger switch
|
||||||
|
if (isset(self::$args["d"]) && self::$args["d"] == true) {
|
||||||
|
// Debugger::getInstance()->setEnabled(true);
|
||||||
|
// Debugger::getInstance()->debug("debug output enabled");
|
||||||
|
}
|
||||||
|
|
||||||
|
return new static::$action_class(self::$args);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function getInput($prompt = "#", $default = "")
|
||||||
|
{
|
||||||
|
if (! empty($default)) {
|
||||||
|
$prompt .= " [" . $default . "]";
|
||||||
|
}
|
||||||
|
$result = readline($prompt . ":");
|
||||||
|
if (empty($result) && ! empty($default)) {
|
||||||
|
$result = $default;
|
||||||
|
}
|
||||||
|
return mb_strtolower($result);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function println($msg = "")
|
||||||
|
{
|
||||||
|
print $msg . PHP_EOL;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static function _printcolor($msg = "", $color = "0")
|
||||||
|
{
|
||||||
|
print "\033[" . $color . "m" . $msg . "\033[0m" . PHP_EOL;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function printerr($msg = "")
|
||||||
|
{
|
||||||
|
self::_printcolor($msg, "31");
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function printsucc($msg = "")
|
||||||
|
{
|
||||||
|
self::_printcolor($msg, "32");
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function printwarn($msg = "")
|
||||||
|
{
|
||||||
|
self::_printcolor($msg, "33");
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -361,7 +361,7 @@ class phpinterface_fpm
|
|||||||
$config = makeCorrectFile($configdir . '/dummy.conf');
|
$config = makeCorrectFile($configdir . '/dummy.conf');
|
||||||
$dummy = "[dummy]
|
$dummy = "[dummy]
|
||||||
user = ".Settings::Get('system.httpuser')."
|
user = ".Settings::Get('system.httpuser')."
|
||||||
listen = /run/" . base64_encode($configdir) . "-fpm.sock
|
listen = /run/" . md5($configdir) . "-fpm.sock
|
||||||
pm = static
|
pm = static
|
||||||
pm.max_children = 1
|
pm.max_children = 1
|
||||||
";
|
";
|
||||||
|
|||||||
@@ -98,14 +98,14 @@ class SImExporter
|
|||||||
// when there were changes in the variable-name or similar
|
// when there were changes in the variable-name or similar
|
||||||
unset($_data['panel.version']);
|
unset($_data['panel.version']);
|
||||||
unset($_data['panel.db_version']);
|
unset($_data['panel.db_version']);
|
||||||
/*
|
|
||||||
// store new data
|
// store new data
|
||||||
foreach ($_data as $index => $value) {
|
foreach ($_data as $index => $value) {
|
||||||
Settings::Set($index, $value);
|
Settings::Set($index, $value);
|
||||||
}
|
}
|
||||||
// save to DB
|
// save to DB
|
||||||
Settings::Flush();
|
Settings::Flush();
|
||||||
*/
|
|
||||||
// all good
|
// all good
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -216,9 +216,8 @@ class lescript
|
|||||||
// simple self check
|
// simple self check
|
||||||
if (Settings::Get('system.disable_le_selfcheck') == '0')
|
if (Settings::Get('system.disable_le_selfcheck') == '0')
|
||||||
{
|
{
|
||||||
$selfcheckContextOptions = array('http' => array('header' => "User-Agent: Froxlor/".$this->version));
|
$selfcheckpayload = HttpClient::urlGet($uri);
|
||||||
$selfcheckContext = stream_context_create($selfcheckContextOptions);
|
if ($payload !== trim($selfcheckpayload)) {
|
||||||
if ($payload !== trim(@file_get_contents($uri, false, $selfcheckContext))) {
|
|
||||||
$errmsg = json_encode(error_get_last());
|
$errmsg = json_encode(error_get_last());
|
||||||
if ($errmsg != "null") {
|
if ($errmsg != "null") {
|
||||||
$errmsg = "; PHP error: " . $errmsg;
|
$errmsg = "; PHP error: " . $errmsg;
|
||||||
|
|||||||
@@ -233,13 +233,8 @@ class lescript_v2
|
|||||||
|
|
||||||
// simple self check
|
// simple self check
|
||||||
if (Settings::Get('system.disable_le_selfcheck') == '0') {
|
if (Settings::Get('system.disable_le_selfcheck') == '0') {
|
||||||
$selfcheckContextOptions = array(
|
$selfcheckpayload = HttpClient::urlGet($uri);
|
||||||
'http' => array(
|
if ($payload !== trim($selfcheckpayload)) {
|
||||||
'header' => "User-Agent: Froxlor/" . $this->version
|
|
||||||
)
|
|
||||||
);
|
|
||||||
$selfcheckContext = stream_context_create($selfcheckContextOptions);
|
|
||||||
if ($payload !== trim(@file_get_contents($uri, false, $selfcheckContext))) {
|
|
||||||
$errmsg = json_encode(error_get_last());
|
$errmsg = json_encode(error_get_last());
|
||||||
if ($errmsg != "null") {
|
if ($errmsg != "null") {
|
||||||
$errmsg = "; PHP error: " . $errmsg;
|
$errmsg = "; PHP error: " . $errmsg;
|
||||||
|
|||||||
@@ -353,7 +353,7 @@ exit "$RETVAL"
|
|||||||
<!--DNS -->
|
<!--DNS -->
|
||||||
<service type="dns" title="{{lng.admin.configfiles.dns}}">
|
<service type="dns" title="{{lng.admin.configfiles.dns}}">
|
||||||
<!--Bind9 -->
|
<!--Bind9 -->
|
||||||
<daemon name="bind" title="Bind9 nameserver">
|
<daemon name="bind" title="Bind9 nameserver" default="true">
|
||||||
<install><![CDATA[emerge net-dns/bind]]></install>
|
<install><![CDATA[emerge net-dns/bind]]></install>
|
||||||
<file name="/etc/bind/default.zone">
|
<file name="/etc/bind/default.zone">
|
||||||
<content><![CDATA[
|
<content><![CDATA[
|
||||||
@@ -3422,10 +3422,17 @@ MAILDIRPATH=.maildir
|
|||||||
<daemon name="proftpd" title="ProFTPd" default="true">
|
<daemon name="proftpd" title="ProFTPd" default="true">
|
||||||
<command><![CDATA[echo "net-ftp/proftpd mysql" >> /etc/portage/package.use]]></command>
|
<command><![CDATA[echo "net-ftp/proftpd mysql" >> /etc/portage/package.use]]></command>
|
||||||
<install><![CDATA[emerge net-ftp/proftpd]]></install>
|
<install><![CDATA[emerge net-ftp/proftpd]]></install>
|
||||||
<commands>
|
<file name="/etc/proftpd/create-cert.sh" chown="root:0" chmod="0700">
|
||||||
<command><![CDATA[[ -f /etc/ssl/certs/proftpd.crt ] || openssl req -new -x509 -newkey rsa:4096 -days 3650 -nodes -out /etc/ssl/certs/proftpd.crt -keyout /etc/ssl/private/proftpd.key -subj "/C=US/ST=Some-State/O=Internet Widgits Pty Ltd/CN=<SERVERNAME>"]]></command>
|
<content><![CDATA[#!/bin/bash
|
||||||
<command><![CDATA[[ -f /etc/ssl/certs/proftpd_ec.crt ] || openssl req -new -x509 -nodes -newkey ec:<(openssl ecparam -name secp521r1) -keyout /etc/ssl/private/proftpd_ec.key -out /etc/ssl/certs/proftpd_ec.crt -days 3650 -subj "/C=US/ST=Some-State/O=Internet Widgits Pty Ltd/CN=<SERVERNAME>"]]></command>
|
[ -f /etc/ssl/certs/proftpd.crt ] || openssl req -new -x509 -newkey rsa:4096 -days 3650 -nodes -out /etc/ssl/certs/proftpd.crt -keyout /etc/ssl/private/proftpd.key -subj "/C=US/ST=Some-State/O=Internet Widgits Pty Ltd/CN=<SERVERNAME>"
|
||||||
<command><![CDATA[chmod 0600 /etc/ssl/private/proftpd.key /etc/ssl/private/proftpd_ec.key]]></command>
|
[ -f /etc/ssl/certs/proftpd_ec.crt ] || openssl req -new -x509 -nodes -newkey ec:<(openssl ecparam -name secp521r1) -keyout /etc/ssl/private/proftpd_ec.key -out /etc/ssl/certs/proftpd_ec.crt -days 3650 -subj "/C=US/ST=Some-State/O=Internet Widgits Pty Ltd/CN=<SERVERNAME>"
|
||||||
|
chmod 0600 /etc/ssl/private/proftpd.key /etc/ssl/private/proftpd_ec.key
|
||||||
|
]]>
|
||||||
|
</content>
|
||||||
|
</file>
|
||||||
|
<commands index="1">
|
||||||
|
<command><![CDATA[/etc/proftpd/create-cert.sh]]></command>
|
||||||
|
<command><![CDATA[rm -f /etc/proftpd/create-cert.sh]]></command>
|
||||||
</commands>
|
</commands>
|
||||||
<file name="/etc/proftpd/proftpd.conf" chown="root:0" chmod="0600"
|
<file name="/etc/proftpd/proftpd.conf" chown="root:0" chmod="0600"
|
||||||
backup="true">
|
backup="true">
|
||||||
|
|||||||
@@ -365,7 +365,7 @@ exit "$RETVAL"
|
|||||||
<!--DNS -->
|
<!--DNS -->
|
||||||
<service type="dns" title="{{lng.admin.configfiles.dns}}">
|
<service type="dns" title="{{lng.admin.configfiles.dns}}">
|
||||||
<!--Bind9 -->
|
<!--Bind9 -->
|
||||||
<daemon name="bind" title="Bind9 nameserver">
|
<daemon name="bind" title="Bind9 nameserver" default="true">
|
||||||
<install><![CDATA[apt-get install bind9]]></install>
|
<install><![CDATA[apt-get install bind9]]></install>
|
||||||
<command><![CDATA[echo "include \"{{settings.system.bindconf_directory}}froxlor_bind.conf\";" >> /etc/bind/named.conf.local]]></command>
|
<command><![CDATA[echo "include \"{{settings.system.bindconf_directory}}froxlor_bind.conf\";" >> /etc/bind/named.conf.local]]></command>
|
||||||
<command><![CDATA[touch {{settings.system.bindconf_directory}}froxlor_bind.conf]]></command>
|
<command><![CDATA[touch {{settings.system.bindconf_directory}}froxlor_bind.conf]]></command>
|
||||||
@@ -3814,10 +3814,17 @@ plugin {
|
|||||||
<!-- Proftpd -->
|
<!-- Proftpd -->
|
||||||
<daemon name="proftpd" title="ProFTPd" default="true">
|
<daemon name="proftpd" title="ProFTPd" default="true">
|
||||||
<install><![CDATA[apt-get install proftpd-basic proftpd-mod-mysql]]></install>
|
<install><![CDATA[apt-get install proftpd-basic proftpd-mod-mysql]]></install>
|
||||||
<commands>
|
<file name="/etc/proftpd/create-cert.sh" chown="root:0" chmod="0700">
|
||||||
<command><![CDATA[[ -f /etc/ssl/certs/proftpd.crt ] || openssl req -new -x509 -newkey rsa:4096 -days 3650 -nodes -out /etc/ssl/certs/proftpd.crt -keyout /etc/ssl/private/proftpd.key -subj "/C=US/ST=Some-State/O=Internet Widgits Pty Ltd/CN=<SERVERNAME>"]]></command>
|
<content><![CDATA[#!/bin/bash
|
||||||
<command><![CDATA[[ -f /etc/ssl/certs/proftpd_ec.crt ] || openssl req -new -x509 -nodes -newkey ec:<(openssl ecparam -name secp521r1) -keyout /etc/ssl/private/proftpd_ec.key -out /etc/ssl/certs/proftpd_ec.crt -days 3650 -subj "/C=US/ST=Some-State/O=Internet Widgits Pty Ltd/CN=<SERVERNAME>"]]></command>
|
[ -f /etc/ssl/certs/proftpd.crt ] || openssl req -new -x509 -newkey rsa:4096 -days 3650 -nodes -out /etc/ssl/certs/proftpd.crt -keyout /etc/ssl/private/proftpd.key -subj "/C=US/ST=Some-State/O=Internet Widgits Pty Ltd/CN=<SERVERNAME>"
|
||||||
<command><![CDATA[chmod 0600 /etc/ssl/private/proftpd.key /etc/ssl/private/proftpd_ec.key]]></command>
|
[ -f /etc/ssl/certs/proftpd_ec.crt ] || openssl req -new -x509 -nodes -newkey ec:<(openssl ecparam -name secp521r1) -keyout /etc/ssl/private/proftpd_ec.key -out /etc/ssl/certs/proftpd_ec.crt -days 3650 -subj "/C=US/ST=Some-State/O=Internet Widgits Pty Ltd/CN=<SERVERNAME>"
|
||||||
|
chmod 0600 /etc/ssl/private/proftpd.key /etc/ssl/private/proftpd_ec.key
|
||||||
|
]]>
|
||||||
|
</content>
|
||||||
|
</file>
|
||||||
|
<commands index="1">
|
||||||
|
<command><![CDATA[/etc/proftpd/create-cert.sh]]></command>
|
||||||
|
<command><![CDATA[rm -f /etc/proftpd/create-cert.sh]]></command>
|
||||||
</commands>
|
</commands>
|
||||||
<file name="/etc/proftpd/proftpd.conf" chown="root:0" chmod="0600"
|
<file name="/etc/proftpd/proftpd.conf" chown="root:0" chmod="0600"
|
||||||
backup="true">
|
backup="true">
|
||||||
@@ -4643,8 +4650,8 @@ aliases: files
|
|||||||
</commands>
|
</commands>
|
||||||
<file name="/etc/nsswitch.conf" backup="true">
|
<file name="/etc/nsswitch.conf" backup="true">
|
||||||
<content><![CDATA[
|
<content><![CDATA[
|
||||||
# Make sure that `passwd`, `group` and `shadow` have mysql in their lines
|
# Make sure that `passwd`, `group` and `shadow` have extrausers in their lines
|
||||||
# You should place mysql at the end, so that it is queried after the other mechanisams
|
# You should place extrausers at the end, so that it is queried after the other mechanisams
|
||||||
#
|
#
|
||||||
passwd: compat extrausers
|
passwd: compat extrausers
|
||||||
group: compat extrausers
|
group: compat extrausers
|
||||||
|
|||||||
@@ -334,7 +334,7 @@ exit "$RETVAL"
|
|||||||
<!--DNS -->
|
<!--DNS -->
|
||||||
<service type="dns" title="{{lng.admin.configfiles.dns}}">
|
<service type="dns" title="{{lng.admin.configfiles.dns}}">
|
||||||
<!--Bind9 -->
|
<!--Bind9 -->
|
||||||
<daemon name="bind" title="Bind9 nameserver">
|
<daemon name="bind" title="Bind9 nameserver" default="true">
|
||||||
<install><![CDATA[apt-get install bind9]]></install>
|
<install><![CDATA[apt-get install bind9]]></install>
|
||||||
<command><![CDATA[echo "include \"{{settings.system.bindconf_directory}}froxlor_bind.conf\";" >> /etc/bind/named.conf]]></command>
|
<command><![CDATA[echo "include \"{{settings.system.bindconf_directory}}froxlor_bind.conf\";" >> /etc/bind/named.conf]]></command>
|
||||||
<command><![CDATA[touch {{settings.system.bindconf_directory}}froxlor_bind.conf]]></command>
|
<command><![CDATA[touch {{settings.system.bindconf_directory}}froxlor_bind.conf]]></command>
|
||||||
@@ -1143,10 +1143,17 @@ MYSQL_AUXOPTIONS_FIELD CONCAT("allowimap=",imap,",allowpop3=",pop3)
|
|||||||
<!-- Proftpd -->
|
<!-- Proftpd -->
|
||||||
<daemon name="proftpd" title="ProFTPd" default="true">
|
<daemon name="proftpd" title="ProFTPd" default="true">
|
||||||
<install><![CDATA[apt-get install proftpd-basic proftpd-mod-mysql]]></install>
|
<install><![CDATA[apt-get install proftpd-basic proftpd-mod-mysql]]></install>
|
||||||
<commands>
|
<file name="/etc/proftpd/create-cert.sh" chown="root:0" chmod="0700">
|
||||||
<command><![CDATA[[ -f /etc/ssl/certs/proftpd.crt ] || openssl req -new -x509 -newkey rsa:4096 -days 3650 -nodes -out /etc/ssl/certs/proftpd.crt -keyout /etc/ssl/private/proftpd.key -subj "/C=US/ST=Some-State/O=Internet Widgits Pty Ltd/CN=<SERVERNAME>"]]></command>
|
<content><![CDATA[#!/bin/bash
|
||||||
<command><![CDATA[[ -f /etc/ssl/certs/proftpd_ec.crt ] || openssl req -new -x509 -nodes -newkey ec:<(openssl ecparam -name secp521r1) -keyout /etc/ssl/private/proftpd_ec.key -out /etc/ssl/certs/proftpd_ec.crt -days 3650 -subj "/C=US/ST=Some-State/O=Internet Widgits Pty Ltd/CN=<SERVERNAME>"]]></command>
|
[ -f /etc/ssl/certs/proftpd.crt ] || openssl req -new -x509 -newkey rsa:4096 -days 3650 -nodes -out /etc/ssl/certs/proftpd.crt -keyout /etc/ssl/private/proftpd.key -subj "/C=US/ST=Some-State/O=Internet Widgits Pty Ltd/CN=<SERVERNAME>"
|
||||||
<command><![CDATA[chmod 0600 /etc/ssl/private/proftpd.key /etc/ssl/private/proftpd_ec.key]]></command>
|
[ -f /etc/ssl/certs/proftpd_ec.crt ] || openssl req -new -x509 -nodes -newkey ec:<(openssl ecparam -name secp521r1) -keyout /etc/ssl/private/proftpd_ec.key -out /etc/ssl/certs/proftpd_ec.crt -days 3650 -subj "/C=US/ST=Some-State/O=Internet Widgits Pty Ltd/CN=<SERVERNAME>"
|
||||||
|
chmod 0600 /etc/ssl/private/proftpd.key /etc/ssl/private/proftpd_ec.key
|
||||||
|
]]>
|
||||||
|
</content>
|
||||||
|
</file>
|
||||||
|
<commands index="1">
|
||||||
|
<command><![CDATA[/etc/proftpd/create-cert.sh]]></command>
|
||||||
|
<command><![CDATA[rm -f /etc/proftpd/create-cert.sh]]></command>
|
||||||
</commands>
|
</commands>
|
||||||
<file name="/etc/proftpd/proftpd.conf" chown="root:0" chmod="0600"
|
<file name="/etc/proftpd/proftpd.conf" chown="root:0" chmod="0600"
|
||||||
backup="true">
|
backup="true">
|
||||||
@@ -1642,8 +1649,8 @@ aliases: files
|
|||||||
</commands>
|
</commands>
|
||||||
<file name="/etc/nsswitch.conf" backup="true">
|
<file name="/etc/nsswitch.conf" backup="true">
|
||||||
<content><![CDATA[
|
<content><![CDATA[
|
||||||
# Make sure that `passwd`, `group` and `shadow` have mysql in their lines
|
# Make sure that `passwd`, `group` and `shadow` have extrausers in their lines
|
||||||
# You should place mysql at the end, so that it is queried after the other mechanisams
|
# You should place extrausers at the end, so that it is queried after the other mechanisams
|
||||||
#
|
#
|
||||||
passwd: compat extrausers
|
passwd: compat extrausers
|
||||||
group: compat extrausers
|
group: compat extrausers
|
||||||
|
|||||||
@@ -354,7 +354,7 @@ exit "$RETVAL"
|
|||||||
<!--DNS -->
|
<!--DNS -->
|
||||||
<service type="dns" title="{{lng.admin.configfiles.dns}}">
|
<service type="dns" title="{{lng.admin.configfiles.dns}}">
|
||||||
<!--Bind9 -->
|
<!--Bind9 -->
|
||||||
<daemon name="bind" title="Bind9 nameserver">
|
<daemon name="bind" title="Bind9 nameserver" default="true">
|
||||||
<install><![CDATA[apt-get install bind9]]></install>
|
<install><![CDATA[apt-get install bind9]]></install>
|
||||||
<command><![CDATA[echo "include \"{{settings.system.bindconf_directory}}froxlor_bind.conf\";" >> /etc/bind/named.conf.local]]></command>
|
<command><![CDATA[echo "include \"{{settings.system.bindconf_directory}}froxlor_bind.conf\";" >> /etc/bind/named.conf.local]]></command>
|
||||||
<command><![CDATA[touch {{settings.system.bindconf_directory}}froxlor_bind.conf]]></command>
|
<command><![CDATA[touch {{settings.system.bindconf_directory}}froxlor_bind.conf]]></command>
|
||||||
@@ -3882,10 +3882,17 @@ plugin {
|
|||||||
<!-- Proftpd -->
|
<!-- Proftpd -->
|
||||||
<daemon name="proftpd" title="ProFTPd" default="true">
|
<daemon name="proftpd" title="ProFTPd" default="true">
|
||||||
<install><![CDATA[apt-get install proftpd-basic proftpd-mod-mysql]]></install>
|
<install><![CDATA[apt-get install proftpd-basic proftpd-mod-mysql]]></install>
|
||||||
<commands>
|
<file name="/etc/proftpd/create-cert.sh" chown="root:0" chmod="0700">
|
||||||
<command><![CDATA[[ -f /etc/ssl/certs/proftpd.crt ] || openssl req -new -x509 -newkey rsa:4096 -days 3650 -nodes -out /etc/ssl/certs/proftpd.crt -keyout /etc/ssl/private/proftpd.key -subj "/C=US/ST=Some-State/O=Internet Widgits Pty Ltd/CN=<SERVERNAME>"]]></command>
|
<content><![CDATA[#!/bin/bash
|
||||||
<command><![CDATA[[ -f /etc/ssl/certs/proftpd_ec.crt ] || openssl req -new -x509 -nodes -newkey ec:<(openssl ecparam -name secp521r1) -keyout /etc/ssl/private/proftpd_ec.key -out /etc/ssl/certs/proftpd_ec.crt -days 3650 -subj "/C=US/ST=Some-State/O=Internet Widgits Pty Ltd/CN=<SERVERNAME>"]]></command>
|
[ -f /etc/ssl/certs/proftpd.crt ] || openssl req -new -x509 -newkey rsa:4096 -days 3650 -nodes -out /etc/ssl/certs/proftpd.crt -keyout /etc/ssl/private/proftpd.key -subj "/C=US/ST=Some-State/O=Internet Widgits Pty Ltd/CN=<SERVERNAME>"
|
||||||
<command><![CDATA[chmod 0600 /etc/ssl/private/proftpd.key /etc/ssl/private/proftpd_ec.key]]></command>
|
[ -f /etc/ssl/certs/proftpd_ec.crt ] || openssl req -new -x509 -nodes -newkey ec:<(openssl ecparam -name secp521r1) -keyout /etc/ssl/private/proftpd_ec.key -out /etc/ssl/certs/proftpd_ec.crt -days 3650 -subj "/C=US/ST=Some-State/O=Internet Widgits Pty Ltd/CN=<SERVERNAME>"
|
||||||
|
chmod 0600 /etc/ssl/private/proftpd.key /etc/ssl/private/proftpd_ec.key
|
||||||
|
]]>
|
||||||
|
</content>
|
||||||
|
</file>
|
||||||
|
<commands index="1">
|
||||||
|
<command><![CDATA[/etc/proftpd/create-cert.sh]]></command>
|
||||||
|
<command><![CDATA[rm -f /etc/proftpd/create-cert.sh]]></command>
|
||||||
</commands>
|
</commands>
|
||||||
<file name="/etc/proftpd/proftpd.conf" chown="root:0" chmod="0600"
|
<file name="/etc/proftpd/proftpd.conf" chown="root:0" chmod="0600"
|
||||||
backup="true">
|
backup="true">
|
||||||
@@ -4543,8 +4550,8 @@ PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
|
|||||||
</commands>
|
</commands>
|
||||||
<file name="/etc/nsswitch.conf" backup="true">
|
<file name="/etc/nsswitch.conf" backup="true">
|
||||||
<content><![CDATA[
|
<content><![CDATA[
|
||||||
# Make sure that `passwd`, `group` and `shadow` have mysql in their lines
|
# Make sure that `passwd`, `group` and `shadow` have extrausers in their lines
|
||||||
# You should place mysql at the end, so that it is queried after the other mechanisams
|
# You should place extrausers at the end, so that it is queried after the other mechanisams
|
||||||
#
|
#
|
||||||
passwd: compat extrausers
|
passwd: compat extrausers
|
||||||
group: compat extrausers
|
group: compat extrausers
|
||||||
|
|||||||
@@ -367,7 +367,7 @@ exit "$RETVAL"
|
|||||||
<!--DNS -->
|
<!--DNS -->
|
||||||
<service type="dns" title="{{lng.admin.configfiles.dns}}">
|
<service type="dns" title="{{lng.admin.configfiles.dns}}">
|
||||||
<!--Bind9 -->
|
<!--Bind9 -->
|
||||||
<daemon name="bind" title="Bind9 nameserver">
|
<daemon name="bind" title="Bind9 nameserver" default="true">
|
||||||
<install><![CDATA[apt-get install bind9]]></install>
|
<install><![CDATA[apt-get install bind9]]></install>
|
||||||
<command><![CDATA[echo "include \"{{settings.system.bindconf_directory}}froxlor_bind.conf\";" >> /etc/bind/named.conf]]></command>
|
<command><![CDATA[echo "include \"{{settings.system.bindconf_directory}}froxlor_bind.conf\";" >> /etc/bind/named.conf]]></command>
|
||||||
<command><![CDATA[touch {{settings.system.bindconf_directory}}froxlor_bind.conf]]></command>
|
<command><![CDATA[touch {{settings.system.bindconf_directory}}froxlor_bind.conf]]></command>
|
||||||
@@ -1152,10 +1152,17 @@ MYSQL_AUXOPTIONS_FIELD CONCAT("allowimap=",imap,",allowpop3=",pop3)
|
|||||||
<!-- Proftpd -->
|
<!-- Proftpd -->
|
||||||
<daemon name="proftpd" title="ProFTPd" default="true">
|
<daemon name="proftpd" title="ProFTPd" default="true">
|
||||||
<install><![CDATA[apt-get install proftpd-basic proftpd-mod-mysql]]></install>
|
<install><![CDATA[apt-get install proftpd-basic proftpd-mod-mysql]]></install>
|
||||||
<commands>
|
<file name="/etc/proftpd/create-cert.sh" chown="root:0" chmod="0700">
|
||||||
<command><![CDATA[[ -f /etc/ssl/certs/proftpd.crt ] || openssl req -new -x509 -newkey rsa:4096 -days 3650 -nodes -out /etc/ssl/certs/proftpd.crt -keyout /etc/ssl/private/proftpd.key -subj "/C=US/ST=Some-State/O=Internet Widgits Pty Ltd/CN=<SERVERNAME>"]]></command>
|
<content><![CDATA[#!/bin/bash
|
||||||
<command><![CDATA[[ -f /etc/ssl/certs/proftpd_ec.crt ] || openssl req -new -x509 -nodes -newkey ec:<(openssl ecparam -name secp521r1) -keyout /etc/ssl/private/proftpd_ec.key -out /etc/ssl/certs/proftpd_ec.crt -days 3650 -subj "/C=US/ST=Some-State/O=Internet Widgits Pty Ltd/CN=<SERVERNAME>"]]></command>
|
[ -f /etc/ssl/certs/proftpd.crt ] || openssl req -new -x509 -newkey rsa:4096 -days 3650 -nodes -out /etc/ssl/certs/proftpd.crt -keyout /etc/ssl/private/proftpd.key -subj "/C=US/ST=Some-State/O=Internet Widgits Pty Ltd/CN=<SERVERNAME>"
|
||||||
<command><![CDATA[chmod 0600 /etc/ssl/private/proftpd.key /etc/ssl/private/proftpd_ec.key]]></command>
|
[ -f /etc/ssl/certs/proftpd_ec.crt ] || openssl req -new -x509 -nodes -newkey ec:<(openssl ecparam -name secp521r1) -keyout /etc/ssl/private/proftpd_ec.key -out /etc/ssl/certs/proftpd_ec.crt -days 3650 -subj "/C=US/ST=Some-State/O=Internet Widgits Pty Ltd/CN=<SERVERNAME>"
|
||||||
|
chmod 0600 /etc/ssl/private/proftpd.key /etc/ssl/private/proftpd_ec.key
|
||||||
|
]]>
|
||||||
|
</content>
|
||||||
|
</file>
|
||||||
|
<commands index="1">
|
||||||
|
<command><![CDATA[/etc/proftpd/create-cert.sh]]></command>
|
||||||
|
<command><![CDATA[rm -f /etc/proftpd/create-cert.sh]]></command>
|
||||||
</commands>
|
</commands>
|
||||||
<file name="/etc/proftpd/proftpd.conf" chown="root:0" chmod="0600"
|
<file name="/etc/proftpd/proftpd.conf" chown="root:0" chmod="0600"
|
||||||
backup="true">
|
backup="true">
|
||||||
@@ -1651,8 +1658,8 @@ aliases: files
|
|||||||
</commands>
|
</commands>
|
||||||
<file name="/etc/nsswitch.conf" backup="true">
|
<file name="/etc/nsswitch.conf" backup="true">
|
||||||
<content><![CDATA[
|
<content><![CDATA[
|
||||||
# Make sure that `passwd`, `group` and `shadow` have mysql in their lines
|
# Make sure that `passwd`, `group` and `shadow` have extrausers in their lines
|
||||||
# You should place mysql at the end, so that it is queried after the other mechanisams
|
# You should place extrausers at the end, so that it is queried after the other mechanisams
|
||||||
#
|
#
|
||||||
passwd: compat extrausers
|
passwd: compat extrausers
|
||||||
group: compat extrausers
|
group: compat extrausers
|
||||||
|
|||||||
@@ -407,7 +407,7 @@ exit "$RETVAL"
|
|||||||
<!--DNS -->
|
<!--DNS -->
|
||||||
<service type="dns" title="{{lng.admin.configfiles.dns}}">
|
<service type="dns" title="{{lng.admin.configfiles.dns}}">
|
||||||
<!--Bind9 -->
|
<!--Bind9 -->
|
||||||
<daemon name="bind" title="Bind9 nameserver">
|
<daemon name="bind" title="Bind9 nameserver" default="true">
|
||||||
<install><![CDATA[apt-get install bind9]]></install>
|
<install><![CDATA[apt-get install bind9]]></install>
|
||||||
<command><![CDATA[echo "include \"{{settings.system.bindconf_directory}}froxlor_bind.conf\";" >> /etc/bind/named.conf.local]]></command>
|
<command><![CDATA[echo "include \"{{settings.system.bindconf_directory}}froxlor_bind.conf\";" >> /etc/bind/named.conf.local]]></command>
|
||||||
<command><![CDATA[touch {{settings.system.bindconf_directory}}froxlor_bind.conf]]></command>
|
<command><![CDATA[touch {{settings.system.bindconf_directory}}froxlor_bind.conf]]></command>
|
||||||
@@ -4716,10 +4716,17 @@ MYSQL_AUXOPTIONS_FIELD CONCAT("allowimap=",imap,",allowpop3=",pop3)
|
|||||||
<!-- Proftpd -->
|
<!-- Proftpd -->
|
||||||
<daemon name="proftpd" title="ProFTPd" default="true">
|
<daemon name="proftpd" title="ProFTPd" default="true">
|
||||||
<install><![CDATA[apt-get install proftpd-basic proftpd-mod-mysql]]></install>
|
<install><![CDATA[apt-get install proftpd-basic proftpd-mod-mysql]]></install>
|
||||||
<commands>
|
<file name="/etc/proftpd/create-cert.sh" chown="root:0" chmod="0700">
|
||||||
<command><![CDATA[[ -f /etc/ssl/certs/proftpd.crt ] || openssl req -new -x509 -newkey rsa:4096 -days 3650 -nodes -out /etc/ssl/certs/proftpd.crt -keyout /etc/ssl/private/proftpd.key -subj "/C=US/ST=Some-State/O=Internet Widgits Pty Ltd/CN=<SERVERNAME>"]]></command>
|
<content><![CDATA[#!/bin/bash
|
||||||
<command><![CDATA[[ -f /etc/ssl/certs/proftpd_ec.crt ] || openssl req -new -x509 -nodes -newkey ec:<(openssl ecparam -name secp521r1) -keyout /etc/ssl/private/proftpd_ec.key -out /etc/ssl/certs/proftpd_ec.crt -days 3650 -subj "/C=US/ST=Some-State/O=Internet Widgits Pty Ltd/CN=<SERVERNAME>"]]></command>
|
[ -f /etc/ssl/certs/proftpd.crt ] || openssl req -new -x509 -newkey rsa:4096 -days 3650 -nodes -out /etc/ssl/certs/proftpd.crt -keyout /etc/ssl/private/proftpd.key -subj "/C=US/ST=Some-State/O=Internet Widgits Pty Ltd/CN=<SERVERNAME>"
|
||||||
<command><![CDATA[chmod 0600 /etc/ssl/private/proftpd.key /etc/ssl/private/proftpd_ec.key]]></command>
|
[ -f /etc/ssl/certs/proftpd_ec.crt ] || openssl req -new -x509 -nodes -newkey ec:<(openssl ecparam -name secp521r1) -keyout /etc/ssl/private/proftpd_ec.key -out /etc/ssl/certs/proftpd_ec.crt -days 3650 -subj "/C=US/ST=Some-State/O=Internet Widgits Pty Ltd/CN=<SERVERNAME>"
|
||||||
|
chmod 0600 /etc/ssl/private/proftpd.key /etc/ssl/private/proftpd_ec.key
|
||||||
|
]]>
|
||||||
|
</content>
|
||||||
|
</file>
|
||||||
|
<commands index="1">
|
||||||
|
<command><![CDATA[/etc/proftpd/create-cert.sh]]></command>
|
||||||
|
<command><![CDATA[rm -f /etc/proftpd/create-cert.sh]]></command>
|
||||||
</commands>
|
</commands>
|
||||||
<file name="/etc/proftpd/proftpd.conf" chown="root:0" chmod="0600"
|
<file name="/etc/proftpd/proftpd.conf" chown="root:0" chmod="0600"
|
||||||
backup="true">
|
backup="true">
|
||||||
@@ -5451,8 +5458,8 @@ aliases: files
|
|||||||
</commands>
|
</commands>
|
||||||
<file name="/etc/nsswitch.conf" backup="true">
|
<file name="/etc/nsswitch.conf" backup="true">
|
||||||
<content><![CDATA[
|
<content><![CDATA[
|
||||||
# Make sure that `passwd`, `group` and `shadow` have mysql in their lines
|
# Make sure that `passwd`, `group` and `shadow` have extrausers in their lines
|
||||||
# You should place mysql at the end, so that it is queried after the other mechanisams
|
# You should place extrausers at the end, so that it is queried after the other mechanisams
|
||||||
#
|
#
|
||||||
passwd: compat extrausers
|
passwd: compat extrausers
|
||||||
group: compat extrausers
|
group: compat extrausers
|
||||||
|
|||||||
@@ -29,7 +29,7 @@
|
|||||||
* @author Florian Lippert <flo@syscp.org>
|
* @author Florian Lippert <flo@syscp.org>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function makeoption($title, $value, $selvalue = NULL, $title_trusted = false, $value_trusted = false, $id = NULL)
|
function makeoption($title, $value, $selvalue = NULL, $title_trusted = false, $value_trusted = false, $id = NULL, $disabled = false)
|
||||||
{
|
{
|
||||||
if($selvalue !== NULL
|
if($selvalue !== NULL
|
||||||
&& ((is_array($selvalue) && in_array($value, $selvalue)) || $value == $selvalue))
|
&& ((is_array($selvalue) && in_array($value, $selvalue)) || $value == $selvalue))
|
||||||
@@ -40,6 +40,10 @@ function makeoption($title, $value, $selvalue = NULL, $title_trusted = false, $v
|
|||||||
{
|
{
|
||||||
$selected = '';
|
$selected = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($disabled) {
|
||||||
|
$selected .= ' disabled="disabled"';
|
||||||
|
}
|
||||||
|
|
||||||
if(!$title_trusted)
|
if(!$title_trusted)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -16,7 +16,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
// Main version variable
|
// Main version variable
|
||||||
$version = '0.9.39';
|
$version = '0.9.39.2';
|
||||||
|
|
||||||
// Database version (YYYYMMDDC where C is a daily counter)
|
// Database version (YYYYMMDDC where C is a daily counter)
|
||||||
$dbversion = '201801260';
|
$dbversion = '201801260';
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ $header
|
|||||||
{$title}
|
{$title}
|
||||||
</h2>
|
</h2>
|
||||||
</header>
|
</header>
|
||||||
|
<script type="text/javascript" src="templates/{$theme}/assets/js/domains.js"></script>
|
||||||
|
|
||||||
<section>
|
<section>
|
||||||
|
|
||||||
|
|||||||
52
templates/Sparkle/assets/js/domains.js
vendored
Normal file
52
templates/Sparkle/assets/js/domains.js
vendored
Normal file
@@ -0,0 +1,52 @@
|
|||||||
|
$(document).ready(function() {
|
||||||
|
|
||||||
|
var getUrlParameter = function getUrlParameter(sParam) {
|
||||||
|
var sPageURL = decodeURIComponent(window.location.search.substring(1)),
|
||||||
|
sURLVariables = sPageURL.split('&'),
|
||||||
|
sParameterName,
|
||||||
|
i;
|
||||||
|
|
||||||
|
for (i = 0; i < sURLVariables.length; i++) {
|
||||||
|
sParameterName = sURLVariables[i].split('=');
|
||||||
|
|
||||||
|
if (sParameterName[0] === sParam) {
|
||||||
|
return sParameterName[1] === undefined ? true : sParameterName[1];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* disable unusable php-configuration by customer settings
|
||||||
|
*/
|
||||||
|
$('#customerid').change(function() {
|
||||||
|
var cid = $(this).val();
|
||||||
|
var sid = getUrlParameter('s');
|
||||||
|
var page = getUrlParameter('page');
|
||||||
|
|
||||||
|
$.ajax({
|
||||||
|
url: "admin_domains.php?s="+sid+"&page="+page+"&action=jqGetCustomerPHPConfigs",
|
||||||
|
type: "POST",
|
||||||
|
data: {
|
||||||
|
customerid: cid
|
||||||
|
},
|
||||||
|
dataType: "json",
|
||||||
|
success: function(json) {
|
||||||
|
if (json.length > 0) {
|
||||||
|
$('#phpsettingid option').each(function() {
|
||||||
|
var pid = $(this).val();
|
||||||
|
$(this).attr("disabled", "disabled");
|
||||||
|
for (i in json) {
|
||||||
|
if (pid == json[i]) {
|
||||||
|
$(this).removeAttr("disabled");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
error: function(a, b) {
|
||||||
|
console.log(a, b);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
});
|
||||||
Reference in New Issue
Block a user