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

@@ -33,7 +33,7 @@ return array(
'save_method' => 'storeSettingField', 'save_method' => 'storeSettingField',
), ),
'panel_default_theme' => array( 'panel_default_theme' => array(
'label' => $lng['serversettings']['default_theme'], 'label' => array('title' => $lng['panel']['theme'], 'description' => $lng['serversettings']['default_theme']),
'settinggroup' => 'panel', 'settinggroup' => 'panel',
'varname' => 'default_theme', 'varname' => 'default_theme',
'type' => 'option', 'type' => 'option',
@@ -42,6 +42,22 @@ return array(
'option_options_method' => 'getThemes', 'option_options_method' => 'getThemes',
'save_method' => 'storeSettingField', 'save_method' => 'storeSettingField',
), ),
'panel_allow_theme_change_customer' => array(
'label' => $lng['serversettings']['panel_allow_theme_change_customer'],
'settinggroup' => 'panel',
'varname' => 'allow_theme_change_customer',
'type' => 'bool',
'default' => true,
'save_method' => 'storeSettingField',
),
'panel_allow_theme_change_admin' => array(
'label' => $lng['serversettings']['panel_allow_theme_change_admin'],
'settinggroup' => 'panel',
'varname' => 'allow_theme_change_admin',
'type' => 'bool',
'default' => true,
'save_method' => 'storeSettingField'
),
'panel_natsorting' => array( 'panel_natsorting' => array(
'label' => $lng['serversettings']['natsorting'], 'label' => $lng['serversettings']['natsorting'],
'settinggroup' => 'panel', 'settinggroup' => 'panel',

View File

@@ -536,7 +536,9 @@ INSERT INTO `panel_settings` (`settinggroup`, `varname`, `value`) VALUES
('panel', 'use_webfonts', '0'), ('panel', 'use_webfonts', '0'),
('panel', 'webfont', 'Numans'), ('panel', 'webfont', 'Numans'),
('panel', 'phpconfigs_hidestdsubdomain', '0'), ('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'); 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); showUpdateStep("Updating from 0.9.28.1 to 0.9.29-dev1", true);
lastStepStatus(0); 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';"); $db->query("UPDATE TABLE `panel_settings` SET `value`='".$db->escape($fastcgiparams)."' WHERE `varname`='fastcgiparams';");
} }
updateToVersion('0.9.29-dev1'); 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") . "\";"); 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") . "\";");
}
} }

View File

@@ -37,6 +37,7 @@ return array (
array ( array (
'url' => 'customer_index.php?page=change_theme', 'url' => 'customer_index.php?page=change_theme',
'label' => $lng['menue']['main']['changetheme'], 'label' => $lng['menue']['main']['changetheme'],
'show_element' => (getSetting('panel', 'allow_theme_change_customer') == true)
), ),
array ( array (
'url' => 'customer_index.php?action=logout', 'url' => 'customer_index.php?action=logout',
@@ -166,6 +167,7 @@ return array (
array ( array (
'url' => 'admin_index.php?page=change_theme', 'url' => 'admin_index.php?page=change_theme',
'label' => $lng['menue']['main']['changetheme'], 'label' => $lng['menue']['main']['changetheme'],
'show_element' => (getSetting('panel', 'allow_theme_change_admin') == true)
), ),
array ( array (
'url' => 'admin_index.php?action=logout', 'url' => 'admin_index.php?action=logout',

View File

@@ -73,6 +73,6 @@ define('PACKAGE_ENABLED', 2);
// VERSION INFO // VERSION INFO
$version = '0.9.29-dev1'; $version = '0.9.29-dev2';
$dbversion = '2'; $dbversion = '2';
$branding = ''; $branding = '';

View File

@@ -1938,3 +1938,7 @@ $lng['serversettings']['panel_phpconfigs_hidestdsubdomain']['title'] = 'Hide sta
$lng['serversettings']['panel_phpconfigs_hidestdsubdomain']['description'] = 'If activated the standard-subdomains for customers will not be displayed in the php-configurations overview<br /><br />Note: This is only visible if you have enabled FCGID or PHP-FPM'; $lng['serversettings']['panel_phpconfigs_hidestdsubdomain']['description'] = 'If activated the standard-subdomains for customers will not be displayed in the php-configurations overview<br /><br />Note: This is only visible if you have enabled FCGID or PHP-FPM';
$lng['serversettings']['passwordcryptfunc']['title'] = 'Chose which password-crypt method is to be used'; $lng['serversettings']['passwordcryptfunc']['title'] = 'Chose which password-crypt method is to be used';
$lng['serversettings']['systemdefault'] = 'System default'; $lng['serversettings']['systemdefault'] = 'System default';
// Added in Froxlor 0.9.29-dev2
$lng['serversettings']['panel_allow_theme_change_admin'] = 'Allow admins to change the theme';
$lng['serversettings']['panel_allow_theme_change_customer'] = 'Allow customers to change the theme';

View File

@@ -1659,3 +1659,7 @@ $lng['serversettings']['panel_phpconfigs_hidestdsubdomain']['title'] = 'Versteck
$lng['serversettings']['panel_phpconfigs_hidestdsubdomain']['description'] = 'Wenn aktiviert, werden die Standard-Subdomains der Kunden nicht mehr in der PHP-Konfigurations-Übersicht angezeigt.<br /><br />Hinweis: Nur relevant, wenn FCGID oder PHP-FPM aktiviert ist.'; $lng['serversettings']['panel_phpconfigs_hidestdsubdomain']['description'] = 'Wenn aktiviert, werden die Standard-Subdomains der Kunden nicht mehr in der PHP-Konfigurations-Übersicht angezeigt.<br /><br />Hinweis: Nur relevant, wenn FCGID oder PHP-FPM aktiviert ist.';
$lng['serversettings']['passwordcryptfunc']['title'] = 'Wähle zu verwendende Passwort-Verschlüsselungsmethode'; $lng['serversettings']['passwordcryptfunc']['title'] = 'Wähle zu verwendende Passwort-Verschlüsselungsmethode';
$lng['serversettings']['systemdefault'] = 'Systemstandard'; $lng['serversettings']['systemdefault'] = 'Systemstandard';
// Added in Froxlor 0.9.29-dev2
$lng['serversettings']['panel_allow_theme_change_admin'] = 'Erlaube Admins das Theme zu wechseln';
$lng['serversettings']['panel_allow_theme_change_customer'] = 'Erlaube Kunden das Theme zu wechseln';