added new indicator whether services/system has been configured (on new installations); show alternative configuration possibility via config-services.php script
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
This commit is contained in:
@@ -20,6 +20,14 @@ require './lib/init.php';
|
||||
|
||||
if ($userinfo['change_serversettings'] == '1') {
|
||||
|
||||
if ($action == 'setconfigured')
|
||||
{
|
||||
Settings::Set('panel.is_configured', '1', true);
|
||||
redirectTo('admin_configfiles.php', array(
|
||||
's' => $s
|
||||
));
|
||||
}
|
||||
|
||||
$customer_tmpdir = '/tmp/';
|
||||
if (Settings::Get('system.mod_fcgid') == '1' && Settings::Get('system.mod_fcgid_tmpdir') != '')
|
||||
{
|
||||
@@ -164,38 +172,38 @@ if ($userinfo['change_serversettings'] == '1') {
|
||||
|
||||
$lasttype = '';
|
||||
$commands = '';
|
||||
foreach ($confarr as $idx => $action) {
|
||||
if ($lasttype != '' && $lasttype != $action['type']) {
|
||||
foreach ($confarr as $_action) {
|
||||
if ($lasttype != '' && $lasttype != $_action['type']) {
|
||||
$commands = trim($commands);
|
||||
$numbrows = count(explode("\n", $commands));
|
||||
eval("\$configpage.=\"" . getTemplate("configfiles/configfiles_commands") . "\";");
|
||||
$lasttype = '';
|
||||
$commands = '';
|
||||
}
|
||||
switch ($action['type']) {
|
||||
switch ($_action['type']) {
|
||||
case "install":
|
||||
$commands .= strtr($action['content'], $replace_arr) . "\n";
|
||||
$commands .= strtr($_action['content'], $replace_arr) . "\n";
|
||||
$lasttype = "install";
|
||||
break;
|
||||
case "command":
|
||||
$commands .= strtr($action['content'], $replace_arr) . "\n";
|
||||
$commands .= strtr($_action['content'], $replace_arr) . "\n";
|
||||
$lasttype = "command";
|
||||
break;
|
||||
case "file":
|
||||
if (array_key_exists('content', $action)) {
|
||||
$commands_file = getFileContentContainer($action['content'], $replace_arr, $action['name'], $distro_editor);
|
||||
} elseif (array_key_exists('subcommands', $action)) {
|
||||
foreach ($action['subcommands'] as $fileaction) {
|
||||
if (array_key_exists('content', $_action)) {
|
||||
$commands_file = getFileContentContainer($_action['content'], $replace_arr, $_action['name'], $distro_editor);
|
||||
} elseif (array_key_exists('subcommands', $_action)) {
|
||||
foreach ($_action['subcommands'] as $fileaction) {
|
||||
if (array_key_exists('execute', $fileaction) && $fileaction['execute'] == "pre") {
|
||||
$commands_pre .= $fileaction['content'] . "\n";
|
||||
} elseif (array_key_exists('execute', $fileaction) && $fileaction['execute'] == "post") {
|
||||
$commands_post .= $fileaction['content'] . "\n";
|
||||
} elseif ($fileaction['type'] == 'file') {
|
||||
$commands_file = getFileContentContainer($fileaction['content'], $replace_arr, $action['name'], $distro_editor);
|
||||
$commands_file = getFileContentContainer($fileaction['content'], $replace_arr, $_action['name'], $distro_editor);
|
||||
}
|
||||
}
|
||||
}
|
||||
$realname = $action['name'];
|
||||
$realname = $_action['name'];
|
||||
$commands = trim($commands_pre);
|
||||
if ($commands != "") {
|
||||
$numbrows = count(explode("\n", $commands));
|
||||
@@ -220,11 +228,13 @@ if ($userinfo['change_serversettings'] == '1') {
|
||||
}
|
||||
eval("echo \"" . getTemplate("configfiles/configfiles") . "\";");
|
||||
} else {
|
||||
$basedir = FROXLOR_INSTALL_DIR;
|
||||
eval("echo \"" . getTemplate("configfiles/wizard") . "\";");
|
||||
}
|
||||
} else {
|
||||
die('not allowed to see this page');
|
||||
// redirect or similar here
|
||||
redirectTo('admin_index.php', array(
|
||||
's' => $s
|
||||
));
|
||||
}
|
||||
|
||||
// helper functions
|
||||
|
||||
@@ -693,8 +693,9 @@ opcache.interned_strings_buffer'),
|
||||
('panel', 'password_special_char_required', '0'),
|
||||
('panel', 'password_special_char', '!?<>§$%+#=@'),
|
||||
('panel', 'customer_hide_options', ''),
|
||||
('panel', 'is_configured', '0'),
|
||||
('panel', 'version', '0.10.0'),
|
||||
('panel', 'db_version', '201812010');
|
||||
('panel', 'db_version', '201812100');
|
||||
|
||||
|
||||
DROP TABLE IF EXISTS `panel_tasks`;
|
||||
|
||||
@@ -236,6 +236,10 @@ class Action
|
||||
$_daemons_config[$si][] = $sysservice;
|
||||
}
|
||||
} while (! empty($sysservice));
|
||||
// add 'cron' as fixed part (doesn't hurt if it exists)
|
||||
if (!in_array('cron', $_daemons_config[$si])) {
|
||||
$_daemons_config[$si][] = 'cron';
|
||||
}
|
||||
} else {
|
||||
// for all others -> only one value
|
||||
while (! array_key_exists($_daemons_config[$si], $daemons)) {
|
||||
@@ -249,6 +253,9 @@ class Action
|
||||
$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 . "'");
|
||||
echo PHP_EOL;
|
||||
CmdLineHandler::printsucc("You can now apply this config running:" . PHP_EOL . "php " . __FILE__ . " --froxlor-dir=" . dirname(dirname(__DIR__)) . " --apply=" . $output);
|
||||
echo PHP_EOL;
|
||||
}
|
||||
|
||||
private function getCompleteDistroName($cparser)
|
||||
@@ -342,10 +349,11 @@ class Action
|
||||
}
|
||||
// run all cmds
|
||||
$confarr = $dd->getConfig();
|
||||
foreach ($confarr as $idx => $action) {
|
||||
foreach ($confarr as $action) {
|
||||
switch ($action['type']) {
|
||||
case "install":
|
||||
CmdLineHandler::println("Installing required packages");
|
||||
$result = null;
|
||||
passthru(strtr($action['content'], $replace_arr), $result);
|
||||
if (strlen($result) > 1) {
|
||||
echo $result;
|
||||
@@ -375,6 +383,8 @@ class Action
|
||||
}
|
||||
}
|
||||
}
|
||||
// set is_configured flag
|
||||
Settings::Set('panel.is_configured', '1', true);
|
||||
// run cronjob at the end to ensure configs are all up to date
|
||||
exec('php ' . FROXLOR_INSTALL_DIR . '/scripts/froxlor_master_cronjob.php --force');
|
||||
// and done
|
||||
|
||||
@@ -105,3 +105,14 @@ if (isDatabaseVersion('201811300')) {
|
||||
|
||||
updateToDbVersion('201812010');
|
||||
}
|
||||
|
||||
if (isDatabaseVersion('201812010')) {
|
||||
|
||||
showUpdateStep("Adding new is_configured-flag");
|
||||
// updated systems are already configured (most likely :P)
|
||||
Settings::AddNew('panel.is_configured', '1', true);
|
||||
lastStepStatus(0);
|
||||
|
||||
updateToDbVersion('201812100');
|
||||
}
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
$version = '0.10.0';
|
||||
|
||||
// Database version (YYYYMMDDC where C is a daily counter)
|
||||
$dbversion = '201812010';
|
||||
$dbversion = '201812100';
|
||||
|
||||
// Distribution branding-tag (used for Debian etc.)
|
||||
$branding = '';
|
||||
|
||||
@@ -2167,3 +2167,9 @@ $lng['2fa']['2fa_email_desc'] = 'Your account is set up to use one-time password
|
||||
$lng['2fa']['2fa_ga_desc'] = 'Your account is set up to use time-based one-time passwords via authenticator-app. Please scan the QR code below with your desired authenticator app to generate the codes. To deactivate, click on "'.$lng['2fa']['2fa_delete'].'"';
|
||||
$lng['admin']['logviewenabled'] = 'Enable access to access/error-logs';
|
||||
$lng['panel']['viewlogs'] = 'View logfiles';
|
||||
$lng['panel']['not_configured'] = 'System not configured yet. Click here to go to configurations.';
|
||||
$lng['panel']['done_configuring'] = 'When you are done configuring all required / desired services,<br>click the link below';
|
||||
$lng['panel']['ihave_configured'] = 'I have configured the services';
|
||||
$lng['panel']['system_is_configured'] = 'System is already set as configured';
|
||||
$lng['panel']['settings_before_configuration'] = 'Please be sure you adjusted the settings prior to configuring the services here';
|
||||
$lng['panel']['alternative_cmdline_config'] = 'Alternatively, just run the following command as root-user in you shell to configure the services automatically';
|
||||
|
||||
@@ -1815,3 +1815,9 @@ $lng['2fa']['2fa_email_desc'] = 'Das Konto ist eingerichtet, um Einmalpasswörte
|
||||
$lng['2fa']['2fa_ga_desc'] = 'Das Konto ist eingerichtet, um zeitbasierte Einmalpasswörter via Authenticator-App zu erhalten. Um die gewünschte Authenticator-App einzurichten, scanne bitte den untenstehenden QR-Code. Zum Deaktivieren, klicke auf "'.$lng['2fa']['2fa_delete'].'"';
|
||||
$lng['admin']['logviewenabled'] = 'Zugriff auf access/error-Logdateien';
|
||||
$lng['panel']['viewlogs'] = 'Logdateien einsehen';
|
||||
$lng['panel']['not_configured'] = 'Das System wurde noch nicht konfiguriert. Hier klicken für Konfiguration.';
|
||||
$lng['panel']['done_configuring'] = 'Nach Abschluss der Konfiguration der Dienste,<br>untenstehenden Link klicken';
|
||||
$lng['panel']['ihave_configured'] = 'Ich habe die Dienste konfiguriert';
|
||||
$lng['panel']['system_is_configured'] = 'Das System ist bereits konfiguriert';
|
||||
$lng['panel']['settings_before_configuration'] = 'Stelle sicher, dass die Einstellungen angepasst wurden bevor die Dienste konfiguriert werden.';
|
||||
$lng['panel']['alternative_cmdline_config'] = 'Alternativ, führe den folgenden Befehl als root-Benutzer auf der Shell aus, um die Dienste automatisch zu konfigurieren.';
|
||||
|
||||
22
templates/Sparkle/admin/configfiles/wizard.tpl
vendored
22
templates/Sparkle/admin/configfiles/wizard.tpl
vendored
@@ -8,6 +8,13 @@ $header
|
||||
</h2>
|
||||
</header>
|
||||
|
||||
<div class="messagewrapperfull">
|
||||
<div class="warningcontainer bradius">
|
||||
<div class="warningtitle">{$lng['admin']['warning']}</div>
|
||||
<div class="warning">{$lng['panel']['settings_before_configuration']}</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<section>
|
||||
<form action="$filename" method="get" enctype="application/x-www-form-urlencoded">
|
||||
<fieldset>
|
||||
@@ -51,10 +58,25 @@ $header
|
||||
<tr>
|
||||
<td colspan="2" align="center"><input class="bottom" type="submit" value="{$lng['panel']['next']}" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<if Settings::Get('panel.is_configured') == '0'>
|
||||
<td colspan="2" align="center">{$lng['panel']['done_configuring']}:<br><br><a href="{$linker->getLink(array('section' => 'configfiles', 'page' => 'overview', 'action' => 'setconfigured'))}" class="btnlink">{$lng['panel']['ihave_configured']}</a><br><br></td>
|
||||
<else>
|
||||
<td colspan="2" align="center">{$lng['panel']['system_is_configured']}</td>
|
||||
</if>
|
||||
</tr>
|
||||
</tfoot>
|
||||
</table>
|
||||
</fieldset>
|
||||
</form>
|
||||
</section>
|
||||
|
||||
<br><br><br>
|
||||
<section>
|
||||
<p><strong>{$lng['panel']['alternative_cmdline_config']}:</strong></p>
|
||||
<div class="pushbot">
|
||||
<textarea class="shell" rows="2" readonly>php {$basedir}/install/scripts/config-services.php --froxlor-dir={$basedir} --create</textarea>
|
||||
</div>
|
||||
</section>
|
||||
</article>
|
||||
$footer
|
||||
|
||||
21
templates/Sparkle/assets/css/main.css
vendored
21
templates/Sparkle/assets/css/main.css
vendored
@@ -662,13 +662,13 @@ input[type="button"], input[type="submit"], input[type="reset"], input[type="fil
|
||||
margin: 0 1px;
|
||||
}
|
||||
|
||||
input[type="button"]:hover, input[type="submit"]:hover, input[type="reset"]:hover
|
||||
input[type="button"]:hover, input[type="submit"]:hover, input[type="reset"]:hover, .btnlink:hover
|
||||
{
|
||||
color: #333;
|
||||
background-color: #dcdcdc;
|
||||
}
|
||||
|
||||
input[type="button"]:active, input[type="submit"]:active, input[type="reset"]:active
|
||||
input[type="button"]:active, input[type="submit"]:active, input[type="reset"]:active, .btnlink:active
|
||||
{
|
||||
-webkit-box-shadow: inset 0 1px 8px rgba(0, 0, 0, 0.25);
|
||||
-moz-box-shadow: inset 0 1px 8px rgba(0, 0, 0, 0.25);
|
||||
@@ -676,17 +676,17 @@ input[type="button"]:active, input[type="submit"]:active, input[type="reset"]:ac
|
||||
color: #fff !important;
|
||||
}
|
||||
|
||||
input[type="submit"], input[class="yesbutton"] {
|
||||
input[type="submit"], input[class="yesbutton"], .btnlink {
|
||||
color: #fff;
|
||||
background-color: #35aa47;
|
||||
}
|
||||
|
||||
input[type="submit"]:hover, input[class="yesbutton"]:hover {
|
||||
input[type="submit"]:hover, input[class="yesbutton"]:hover, .btnlink:hover {
|
||||
color: #fff;
|
||||
background-color: #1d943b;
|
||||
}
|
||||
|
||||
input[class="submit"]:active, input[class="yesbutton"]:active {
|
||||
input[class="submit"]:active, input[class="yesbutton"]:active, .btnlink:active {
|
||||
background-color: #35aa47;
|
||||
}
|
||||
|
||||
@@ -1725,3 +1725,14 @@ td.size-50 {
|
||||
.label[class*="span"][class*="arrow"] {
|
||||
min-height: 0
|
||||
}
|
||||
|
||||
.liwarn {
|
||||
background-color: #ff3333;
|
||||
margin-top: -6px;
|
||||
}
|
||||
|
||||
.liwarn a {
|
||||
font-weight: 700;
|
||||
padding: 5px 10px;
|
||||
color: #ffe !important;
|
||||
}
|
||||
|
||||
5
templates/Sparkle/header.tpl
vendored
5
templates/Sparkle/header.tpl
vendored
@@ -43,6 +43,11 @@
|
||||
</a>
|
||||
<div class="topheader_navigation">
|
||||
<ul class="topheadernav">
|
||||
<if Settings::Get('panel.is_configured') == 0 && $userinfo['adminsession'] == 1 && $userinfo['change_serversettings'] == 1>
|
||||
<li class="liwarn">
|
||||
<a href="{$linker->getLink(array('section' => 'configfiles', 'page' => 'configfiles'))}">{$lng['panel']['not_configured']}</a>
|
||||
</li>
|
||||
</if>
|
||||
<if Settings::Get('ticket.enabled') == 1>
|
||||
<li>
|
||||
<a href="{$linker->getLink(array('section' => 'tickets', 'page' => 'tickets'))}">
|
||||
|
||||
Reference in New Issue
Block a user