add possibility to allow/disallow changing of themes; fixes #1175

Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
This commit is contained in:
Michael Kaufmann (d00p)
2013-04-15 09:54:35 +02:00
parent 3d246d7926
commit 802d59670c
8 changed files with 56 additions and 5 deletions

View File

@@ -536,7 +536,9 @@ INSERT INTO `panel_settings` (`settinggroup`, `varname`, `value`) VALUES
('panel', 'use_webfonts', '0'),
('panel', 'webfont', 'Numans'),
('panel', 'phpconfigs_hidestdsubdomain', '0'),
('panel', 'version', '0.9.29-dev1');
('panel', 'allow_theme_change_admin', '1'),
('panel', 'allow_theme_change_customer', '1'),
('panel', 'version', '0.9.29-dev2');

View File

@@ -2053,7 +2053,7 @@ if (isFroxlorVersion('0.9.28')) {
updateToVersion('0.9.28.1');
}
if(isFroxlorVersion('0.9.28.1')) {
if (isFroxlorVersion('0.9.28.1')) {
showUpdateStep("Updating from 0.9.28.1 to 0.9.29-dev1", true);
lastStepStatus(0);
@@ -2072,4 +2072,18 @@ if(isFroxlorVersion('0.9.28.1')) {
$db->query("UPDATE TABLE `panel_settings` SET `value`='".$db->escape($fastcgiparams)."' WHERE `varname`='fastcgiparams';");
}
updateToVersion('0.9.29-dev1');
}
}
if (isFroxlorVersion('0.9.29-dev1')) {
showUpdateStep("Updating from 0.9.29-dev1 to 0.9.29-dev2", true);
lastStepStatus(0);
$allow_themechange_c = isset($_POST['allow_themechange_c']) ? (int)$_POST['allow_themechange_c'] : '1';
$allow_themechange_a = isset($_POST['allow_themechange_a']) ? (int)$_POST['allow_themechange_a'] : '1';
showUpdateStep("Inserting new setting to allow/disallow theme changes (default: on)", true);
$db->query("INSERT INTO `panel_settings` (`settinggroup`, `varname`, `value`) VALUES ('panel', 'allow_theme_change_admin', '".$allow_themechange_a."');");
$db->query("INSERT INTO `panel_settings` (`settinggroup`, `varname`, `value`) VALUES ('panel', 'allow_theme_change_customer', '".$allow_themechange_c."');");
lastStepStatus(0);
updateToVersion('0.9.29-dev2');
}

View File

@@ -516,4 +516,13 @@ function parseAndOutputPreconfig(&$has_preconfig, &$return, $current_version)
eval("\$return.=\"" . getTemplate("update/preconfigitem") . "\";");
}
}
if (versionInUpdate($current_version, '0.9.29-dev2')) {
$has_preconfig = true;
$description = 'You can now decide whether admins/customers are able to change the theme<br />';
$question = '<strong>If you want to disallow theme-changing, uncheck the checkboxes below:</strong>&nbsp;';
$question.= "Admins: ". makeyesno('allow_themechange_a', '1', '0', '1');
$question.= "Customers: ".makeyesno('allow_themechange_c', '1', '0', '1');
eval("\$return.=\"" . getTemplate("update/preconfigitem") . "\";");
}
}