use correct Settings-class in templates

Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
This commit is contained in:
Michael Kaufmann
2018-12-18 15:53:08 +01:00
parent 6329042d40
commit a25150babf
32 changed files with 74 additions and 261 deletions

View File

@@ -1,81 +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
*
*/
/**
* @FIXME remove when fully migrated to new Settings class
*
* @param array $settings_data
*
* @return array
*/
function loadSettings(&$settings_data) {
$settings = array();
if (is_array($settings_data)
&& isset($settings_data['groups'])
&& is_array($settings_data['groups'])
) {
// prepare for use in for-loop
$row_stmt = Database::prepare("
SELECT `settinggroup`, `varname`, `value`
FROM `" . TABLE_PANEL_SETTINGS . "`
WHERE `settinggroup` = :group AND `varname` = :varname
");
foreach ($settings_data['groups'] as $settings_part => $settings_part_details) {
if (is_array($settings_part_details)
&& isset($settings_part_details['fields'])
&& is_array($settings_part_details['fields'])
) {
foreach ($settings_part_details['fields'] as $field_name => $field_details) {
if (isset($field_details['settinggroup'])
&& isset($field_details['varname'])
&& isset($field_details['default'])
) {
// execute prepared statement
$row = Database::pexecute_first($row_stmt, array(
'group' => $field_details['settinggroup'],
'varname' => $field_details['varname']
));
if (!empty($row)) {
$varvalue = $row['value'];
} else {
$varvalue = $field_details['default'];
}
$settings[$field_details['settinggroup']][$field_details['varname']] = $varvalue;
} else {
$varvalue = false;
}
$settings_data['groups'][$settings_part]['fields'][$field_name]['value'] = $varvalue;
}
}
}
}
return $settings;
}

View File

@@ -23,24 +23,24 @@
*/
function getAvailablePasswordHashes()
{
global $lng;
// get available pwd-hases
$available_pwdhashes = array(
0 => $lng['serversettings']['systemdefault']
);
if (defined('CRYPT_MD5') && CRYPT_MD5 == 1) {
$available_pwdhashes[1] = 'MD5';
}
if (defined('CRYPT_BLOWFISH') && CRYPT_BLOWFISH == 1) {
$available_pwdhashes[2] = 'BLOWFISH';
}
if (defined('CRYPT_SHA256') && CRYPT_SHA256 == 1) {
$available_pwdhashes[3] = 'SHA-256';
}
if (defined('CRYPT_SHA512') && CRYPT_SHA512 == 1) {
$available_pwdhashes[4] = 'SHA-512';
}
return $available_pwdhashes;
global $lng;
// get available pwd-hases
$available_pwdhashes = array(
0 => $lng['serversettings']['systemdefault']
);
if (defined('CRYPT_MD5') && CRYPT_MD5 == 1) {
$available_pwdhashes[1] = 'MD5';
}
if (defined('CRYPT_BLOWFISH') && CRYPT_BLOWFISH == 1) {
$available_pwdhashes[2] = 'BLOWFISH';
}
if (defined('CRYPT_SHA256') && CRYPT_SHA256 == 1) {
$available_pwdhashes[3] = 'SHA-256';
}
if (defined('CRYPT_SHA512') && CRYPT_SHA512 == 1) {
$available_pwdhashes[4] = 'SHA-512';
}
return $available_pwdhashes;
}

View File

@@ -1,33 +0,0 @@
<?php
/**
* This file is part of the Froxlor project.
* Copyright (c) 2014 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> (2014-)
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt
* @package Functions
*
*/
/**
* check if the system is FreeBSD (if exact)
* or BSD-based (NetBSD, OpenBSD, etc. if exact = false [default])
*
* @param boolean $exact whether to check explicitly for FreeBSD or *BSD
*
* @return boolean
*/
function isFreeBSD($exact = false) {
if (($exact && PHP_OS == 'FreeBSD')
|| (!$exact && stristr(PHP_OS, 'BSD'))
) {
return true;
}
return false;
}

View File

@@ -36,7 +36,7 @@ function setCycleOfCronjob($fieldname, $fielddata, $newfieldvalue, $allnewfieldv
break;
}
Database::query("UPDATE `cronjobs_run` SET `interval` = '1 ".$interval."' WHERE `cronfile` = 'cron_used_tickets_reset.php';");
Database::query("UPDATE `cronjobs_run` SET `interval` = '1 ".$interval."' WHERE `cronfile` = 'used_tickets_reset';");
return array(FORMFIELDS_PLAUSIBILITY_CHECK_OK);
}