cant stop migrating to new Settings class, refs #1325
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
This commit is contained in:
@@ -140,7 +140,9 @@ class Settings {
|
||||
}
|
||||
self::$_data[$sstr[0]][$sstr[1]] = $value;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,33 +0,0 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* This file is part of the Froxlor project.
|
||||
* Copyright (c) 2003-2009 the SysCP Team (see authors).
|
||||
* Copyright (c) 2010 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 Florian Lippert <flo@syscp.org> (2003-2009)
|
||||
* @author Froxlor team <team@froxlor.org> (2010-)
|
||||
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt
|
||||
* @package Functions
|
||||
*
|
||||
*/
|
||||
|
||||
function getSetting($settinggroup, $varname)
|
||||
{
|
||||
global $settings, $theme;
|
||||
if(isset($settings[$settinggroup]) && is_array($settings[$settinggroup]) && isset($settings[$settinggroup][$varname]))
|
||||
{
|
||||
return $settings[$settinggroup][$varname];
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -17,6 +17,13 @@
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* @FIXME remove when fully migrated to new Settings class
|
||||
*
|
||||
* @param array $settings_data
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
function loadSettings(&$settings_data) {
|
||||
|
||||
$settings = array();
|
||||
|
||||
@@ -1,28 +0,0 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* This file is part of the Froxlor project.
|
||||
* Copyright (c) 2003-2009 the SysCP Team (see authors).
|
||||
* Copyright (c) 2010 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 Florian Lippert <flo@syscp.org> (2003-2009)
|
||||
* @author Froxlor team <team@froxlor.org> (2010-)
|
||||
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt
|
||||
* @package Functions
|
||||
*
|
||||
*/
|
||||
|
||||
function saveSetting($settinggroup, $varname, $newvalue) {
|
||||
|
||||
$upd_stmt = Database::Prepare("
|
||||
UPDATE `" . TABLE_PANEL_SETTINGS . "` SET `value` = :newvalue
|
||||
WHERE `settinggroup` = :group AND `varname` = :varname
|
||||
");
|
||||
Database::pexecute($upd_stmt, array('newvalue' => $newvalue, 'group' => $settinggroup, 'varname' => $varname));
|
||||
return true;
|
||||
}
|
||||
@@ -46,7 +46,7 @@ function storeSettingDefaultIp($fieldname, $fielddata, $newfieldvalue) {
|
||||
WHERE `id_domain` IN ('" . implode(', ', $ids) . "')
|
||||
AND `id_ipandports` = :defaultip
|
||||
");
|
||||
Database::pexecute($upd_stmt, array('newval' => $newfieldvalue, 'defaultip' => getSetting('system', 'defaultip')));
|
||||
Database::pexecute($upd_stmt, array('newval' => $newfieldvalue, 'defaultip' => Settings::Get('system.defaultip')));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -43,13 +43,13 @@ function storeSettingDefaultTheme($fieldname, $fielddata, $newfieldvalue) {
|
||||
) {
|
||||
// now, if changing themes is disabled we recursivly set
|
||||
// the new theme (customers and admin, depending on settings)
|
||||
if (getSetting('panel', 'allow_theme_change_customer') == '0') {
|
||||
if (Settings::Get('panel.allow_theme_change_customer') == '0') {
|
||||
$upd_stmt = Database::prepare("
|
||||
UPDATE `".TABLE_PANEL_CUSTOMERS."` SET `theme` = :theme
|
||||
");
|
||||
Database::pexecute($upd_stmt, array('theme' => $newfieldvalue));
|
||||
}
|
||||
if (getSetting('panel', 'allow_theme_change_admin') == '0') {
|
||||
if (Settings::Get('panel.allow_theme_change_admin') == '0') {
|
||||
$upd_stmt = Database::prepare("
|
||||
UPDATE `".TABLE_PANEL_ADMINS."` SET `theme` = :theme
|
||||
");
|
||||
|
||||
@@ -25,7 +25,7 @@ function storeSettingField($fieldname, $fielddata, $newfieldvalue) {
|
||||
&& isset($fielddata['varname'])
|
||||
&& $fielddata['varname'] != ''
|
||||
) {
|
||||
if (saveSetting($fielddata['settinggroup'], $fielddata['varname'], $newfieldvalue) != false) {
|
||||
if (Settings::Set($fielddata['settinggroup'].'.'.$fielddata['varname'], $newfieldvalue) !== false) {
|
||||
/*
|
||||
* when fielddata[cronmodule] is set, this means enable/disable a cronjob
|
||||
*/
|
||||
@@ -63,7 +63,7 @@ function storeSettingFieldInsertBindTask($fieldname, $fielddata, $newfieldvalue)
|
||||
&& isset($fielddata['varname'])
|
||||
&& $fielddata['varname'] != ''
|
||||
) {
|
||||
if (saveSetting($fielddata['settinggroup'], $fielddata['varname'], $newfieldvalue) != false) {
|
||||
if (Settings::Set($fielddata['settinggroup'].'.'.$fielddata['varname'], $newfieldvalue) !== false) {
|
||||
return array($fielddata['settinggroup'] . '.' . $fielddata['varname'] => $newfieldvalue);
|
||||
} else {
|
||||
return false;
|
||||
|
||||
@@ -49,7 +49,7 @@ function storeSettingHostname($fieldname, $fielddata, $newfieldvalue) {
|
||||
`domain` = REPLACE(`domain`, :host, :newval)
|
||||
WHERE `id` IN ('" . implode(', ', $ids) . "')
|
||||
");
|
||||
Database::pexecute($upd_stmt, array('host' => getSetting('system', 'hostname'), 'newval' => $newfieldvalue));
|
||||
Database::pexecute($upd_stmt, array('host' => Settings::Get('system.hostname'), 'newval' => $newfieldvalue));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -17,21 +17,24 @@
|
||||
*
|
||||
*/
|
||||
|
||||
function storeSettingIpAddress($fieldname, $fielddata, $newfieldvalue)
|
||||
{
|
||||
function storeSettingIpAddress($fieldname, $fielddata, $newfieldvalue) {
|
||||
|
||||
$returnvalue = storeSettingField($fieldname, $fielddata, $newfieldvalue);
|
||||
|
||||
if($returnvalue !== false && is_array($fielddata) && isset($fielddata['settinggroup']) && $fielddata['settinggroup'] == 'system' && isset($fielddata['varname']) && $fielddata['varname'] == 'ipaddress')
|
||||
{
|
||||
$mysql_access_host_array = array_map('trim', explode(',', getSetting('system', 'mysql_access_host')));
|
||||
if ($returnvalue !== false
|
||||
&& is_array($fielddata)
|
||||
&& isset($fielddata['settinggroup'])
|
||||
&& $fielddata['settinggroup'] == 'system'
|
||||
&& isset($fielddata['varname'])
|
||||
&& $fielddata['varname'] == 'ipaddress'
|
||||
) {
|
||||
$mysql_access_host_array = array_map('trim', explode(',', Settings::Get('system.mysql_access_host')));
|
||||
$mysql_access_host_array[] = $newfieldvalue;
|
||||
$mysql_access_host_array = array_unique(array_trim($mysql_access_host_array));
|
||||
$mysql_access_host = implode(',', $mysql_access_host_array);
|
||||
correctMysqlUsers($mysql_access_host_array);
|
||||
saveSetting('system', 'mysql_access_host', $mysql_access_host);
|
||||
Settings::Set('system.mysql_access_host', $mysql_access_host);
|
||||
}
|
||||
|
||||
return $returnvalue;
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
@@ -37,7 +37,7 @@ return array (
|
||||
array (
|
||||
'url' => 'customer_index.php?page=change_theme',
|
||||
'label' => $lng['menue']['main']['changetheme'],
|
||||
'show_element' => (getSetting('panel', 'allow_theme_change_customer') == true)
|
||||
'show_element' => (Settings::Get('panel.allow_theme_change_customer') == true)
|
||||
),
|
||||
array (
|
||||
'url' => 'customer_index.php?action=logout',
|
||||
@@ -60,11 +60,11 @@ return array (
|
||||
'required_resources' => 'emails'
|
||||
),
|
||||
array (
|
||||
'url' => getSetting('panel', 'webmail_url'),
|
||||
'url' => Setting::Get('panel.webmail_url'),
|
||||
'new_window' => true,
|
||||
'label' => $lng['menue']['email']['webmail'],
|
||||
'required_resources' => 'emails_used',
|
||||
'show_element' => ( getSetting('panel', 'webmail_url') != '' ),
|
||||
'show_element' => ( Settings::Get('panel.webmail_url') != '' ),
|
||||
),
|
||||
),
|
||||
),
|
||||
@@ -78,11 +78,11 @@ return array (
|
||||
'required_resources' => 'mysqls',
|
||||
),
|
||||
array (
|
||||
'url' => getSetting('panel', 'phpmyadmin_url'),
|
||||
'url' => Settings::Get('panel.phpmyadmin_url'),
|
||||
'new_window' => true,
|
||||
'label' => $lng['menue']['mysql']['phpmyadmin'],
|
||||
'required_resources' => 'mysqls_used',
|
||||
'show_element' => ( getSetting('panel', 'phpmyadmin_url') != '' ),
|
||||
'show_element' => ( Settings::Get('panel.phpmyadmin_url') != '' ),
|
||||
),
|
||||
),
|
||||
),
|
||||
@@ -105,10 +105,10 @@ return array (
|
||||
'label' => $lng['menue']['ftp']['accounts'],
|
||||
),
|
||||
array (
|
||||
'url' => getSetting('panel', 'webftp_url'),
|
||||
'url' => Settings::Get('panel.webftp_url'),
|
||||
'new_window' => true,
|
||||
'label' => $lng['menue']['ftp']['webftp'],
|
||||
'show_element' => ( getSetting('panel', 'webftp_url') != '' ),
|
||||
'show_element' => ( Settings::Get('panel.webftp_url') != '' ),
|
||||
),
|
||||
),
|
||||
),
|
||||
@@ -156,7 +156,7 @@ return array (
|
||||
array (
|
||||
'url' => 'admin_index.php?page=change_theme',
|
||||
'label' => $lng['menue']['main']['changetheme'],
|
||||
'show_element' => (getSetting('panel', 'allow_theme_change_admin') == true)
|
||||
'show_element' => (Setting::Get('panel.allow_theme_change_admin') == true)
|
||||
),
|
||||
array (
|
||||
'url' => 'admin_index.php?action=logout',
|
||||
@@ -239,8 +239,8 @@ return array (
|
||||
'url' => 'admin_phpsettings.php?page=overview',
|
||||
'label' => $lng['menue']['phpsettings']['maintitle'],
|
||||
'show_element' => (
|
||||
getSetting('system', 'mod_fcgid') == true ||
|
||||
getSetting('phpfpm', 'enabled') == true
|
||||
Settings::Get('system.mod_fcgid') == true ||
|
||||
Settings::Get('phpfpm.enabled') == true
|
||||
),
|
||||
),
|
||||
),
|
||||
@@ -256,7 +256,7 @@ return array (
|
||||
'url' => 'admin_logger.php?page=log',
|
||||
'label' => $lng['menue']['logger']['logger'],
|
||||
'required_resources' => 'change_serversettings',
|
||||
'show_element' => ( getSetting('logger', 'enabled') == true ),
|
||||
'show_element' => ( Settings::Get('logger.enabled') == true ),
|
||||
),
|
||||
array (
|
||||
'url' => 'admin_message.php?page=message',
|
||||
|
||||
@@ -22,7 +22,7 @@ return array (
|
||||
'tickets' => array (
|
||||
'url' => 'customer_tickets.php',
|
||||
'label' => $lng['menue']['ticket']['ticket'],
|
||||
'show_element' => ( getSetting('ticket', 'enabled') == true ),
|
||||
'show_element' => ( Settings::Get('ticket.enabled') == true ),
|
||||
'elements' => array (
|
||||
array (
|
||||
'url' => 'customer_tickets.php?page=tickets',
|
||||
@@ -34,7 +34,7 @@ return array (
|
||||
'admin' => array (
|
||||
'tickets' => array (
|
||||
'label' => $lng['admin']['ticketsystem'],
|
||||
'show_element' => ( getSetting('ticket', 'enabled') == true ),
|
||||
'show_element' => ( Settings::Get('ticket.enabled') == true ),
|
||||
'elements' => array (
|
||||
array (
|
||||
'url' => 'admin_tickets.php?page=tickets',
|
||||
|
||||
Reference in New Issue
Block a user