minor fixes here and there
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
This commit is contained in:
@@ -31,7 +31,10 @@ return array(
|
|||||||
'type' => 'option',
|
'type' => 'option',
|
||||||
'default' => 'English',
|
'default' => 'English',
|
||||||
'option_mode' => 'one',
|
'option_mode' => 'one',
|
||||||
'option_options_method' => array('\\Froxlor\\User', 'getLanguages'),
|
'option_options_method' => array(
|
||||||
|
'\\Froxlor\\User',
|
||||||
|
'getLanguages'
|
||||||
|
),
|
||||||
'save_method' => 'storeSettingField'
|
'save_method' => 'storeSettingField'
|
||||||
),
|
),
|
||||||
'panel_default_theme' => array(
|
'panel_default_theme' => array(
|
||||||
@@ -44,7 +47,10 @@ return array(
|
|||||||
'type' => 'option',
|
'type' => 'option',
|
||||||
'default' => 'Froxlor',
|
'default' => 'Froxlor',
|
||||||
'option_mode' => 'one',
|
'option_mode' => 'one',
|
||||||
'option_options_method' => 'getThemes',
|
'option_options_method' => array(
|
||||||
|
'\\Froxlor\\UI\\Template',
|
||||||
|
'getThemes'
|
||||||
|
),
|
||||||
'save_method' => 'storeSettingDefaultTheme'
|
'save_method' => 'storeSettingDefaultTheme'
|
||||||
),
|
),
|
||||||
'panel_allow_theme_change_customer' => array(
|
'panel_allow_theme_change_customer' => array(
|
||||||
|
|||||||
@@ -300,7 +300,7 @@ if ($page == 'overview') {
|
|||||||
$default_theme = $userinfo['theme'];
|
$default_theme = $userinfo['theme'];
|
||||||
}
|
}
|
||||||
|
|
||||||
$themes_avail = getThemes();
|
$themes_avail = \Froxlor\UI\Template::getThemes();
|
||||||
foreach ($themes_avail as $t => $d) {
|
foreach ($themes_avail as $t => $d) {
|
||||||
$theme_options .= \Froxlor\UI\HTML::makeoption($d, $t, $default_theme, true);
|
$theme_options .= \Froxlor\UI\HTML::makeoption($d, $t, $default_theme, true);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -59,7 +59,7 @@ if ($page == 'overview' && $userinfo['change_serversettings'] == '1') {
|
|||||||
\Froxlor\UI\Response::standard_error($lng['error']['session_timeout'], $lng['error']['session_timeout_desc']);
|
\Froxlor\UI\Response::standard_error($lng['error']['session_timeout'], $lng['error']['session_timeout_desc']);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (processFormEx($settings_data, $_POST, array(
|
if (\Froxlor\UI\Form::processFormEx($settings_data, $_POST, array(
|
||||||
'filename' => $filename,
|
'filename' => $filename,
|
||||||
'action' => $action,
|
'action' => $action,
|
||||||
'page' => $page
|
'page' => $page
|
||||||
|
|||||||
@@ -271,7 +271,7 @@ if ($page == 'overview') {
|
|||||||
}
|
}
|
||||||
|
|
||||||
$theme_options = '';
|
$theme_options = '';
|
||||||
$themes_avail = getThemes();
|
$themes_avail = \Froxlor\UI\Template::getThemes();
|
||||||
foreach ($themes_avail as $t => $d) {
|
foreach ($themes_avail as $t => $d) {
|
||||||
$theme_options .= \Froxlor\UI\HTML::makeoption($d, $t, $default_theme, true);
|
$theme_options .= \Froxlor\UI\HTML::makeoption($d, $t, $default_theme, true);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -382,7 +382,7 @@ function parseAndOutputPreconfig(&$has_preconfig, &$return, $current_version, $c
|
|||||||
$description = 'As you can (obviously) see, Froxlor now comes with a new theme. You also have the possibility to switch back to "Classic" if you want to.';
|
$description = 'As you can (obviously) see, Froxlor now comes with a new theme. You also have the possibility to switch back to "Classic" if you want to.';
|
||||||
$question = '<strong>Select default panel theme:</strong> ';
|
$question = '<strong>Select default panel theme:</strong> ';
|
||||||
$question .= '<select name="update_default_theme">';
|
$question .= '<select name="update_default_theme">';
|
||||||
$themes = getThemes();
|
$themes = \Froxlor\UI\Template::getThemes();
|
||||||
foreach ($themes as $cur_theme) // $theme is already in use
|
foreach ($themes as $cur_theme) // $theme is already in use
|
||||||
{
|
{
|
||||||
$question .= makeoption($cur_theme, $cur_theme, 'Froxlor');
|
$question .= makeoption($cur_theme, $cur_theme, 'Froxlor');
|
||||||
@@ -401,7 +401,7 @@ function parseAndOutputPreconfig(&$has_preconfig, &$return, $current_version, $c
|
|||||||
|
|
||||||
$question = '<strong>Select your preferred Classic Theme replacement:</strong> ';
|
$question = '<strong>Select your preferred Classic Theme replacement:</strong> ';
|
||||||
$question .= '<select name="classic_theme_replacement">';
|
$question .= '<select name="classic_theme_replacement">';
|
||||||
$themes = getThemes();
|
$themes = \Froxlor\UI\Template::getThemes();
|
||||||
foreach ($themes as $cur_theme) {
|
foreach ($themes as $cur_theme) {
|
||||||
$question .= makeoption($cur_theme, $cur_theme, 'Froxlor');
|
$question .= makeoption($cur_theme, $cur_theme, 'Froxlor');
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,13 +10,13 @@ class Form
|
|||||||
{
|
{
|
||||||
$fields = '';
|
$fields = '';
|
||||||
|
|
||||||
if (validateFormDefinition($form)) {
|
if (\Froxlor\Validate\Form::validateFormDefinition($form)) {
|
||||||
foreach ($form['groups'] as $groupname => $groupdetails) {
|
foreach ($form['groups'] as $groupname => $groupdetails) {
|
||||||
if (isset($groupdetails['title']) && $groupdetails['title'] != '') {
|
if (isset($groupdetails['title']) && $groupdetails['title'] != '') {
|
||||||
$fields .= self::getFormGroupOutput($groupname, $groupdetails);
|
$fields .= self::getFormGroupOutput($groupname, $groupdetails);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (validateFieldDefinition($groupdetails)) {
|
if (\Froxlor\Validate\Form::validateFieldDefinition($groupdetails)) {
|
||||||
// Prefetch form fields
|
// Prefetch form fields
|
||||||
foreach ($groupdetails['fields'] as $fieldname => $fielddetails) {
|
foreach ($groupdetails['fields'] as $fieldname => $fielddetails) {
|
||||||
$groupdetails['fields'][$fieldname] = self::array_merge_prefix($fielddetails, $fielddetails['type'], prefetchFormFieldData($fieldname, $fielddetails));
|
$groupdetails['fields'][$fieldname] = self::array_merge_prefix($fielddetails, $fielddetails['type'], prefetchFormFieldData($fieldname, $fielddetails));
|
||||||
@@ -38,7 +38,7 @@ class Form
|
|||||||
{
|
{
|
||||||
$fields = '';
|
$fields = '';
|
||||||
|
|
||||||
if (validateFormDefinition($form)) {
|
if (\Froxlor\Validate\Form::validateFormDefinition($form)) {
|
||||||
foreach ($form['groups'] as $groupname => $groupdetails) {
|
foreach ($form['groups'] as $groupname => $groupdetails) {
|
||||||
// show overview
|
// show overview
|
||||||
if ($part == '') {
|
if ($part == '') {
|
||||||
@@ -73,10 +73,10 @@ class Form
|
|||||||
$fields .= self::getFormGroupOutput($groupname, $groupdetails);
|
$fields .= self::getFormGroupOutput($groupname, $groupdetails);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (validateFieldDefinition($groupdetails)) {
|
if (\Froxlor\Validate\Form::validateFieldDefinition($groupdetails)) {
|
||||||
// Prefetch form fields
|
// Prefetch form fields
|
||||||
foreach ($groupdetails['fields'] as $fieldname => $fielddetails) {
|
foreach ($groupdetails['fields'] as $fieldname => $fielddetails) {
|
||||||
$groupdetails['fields'][$fieldname] = self::array_merge_prefix($fielddetails, $fielddetails['type'], prefetchFormFieldData($fieldname, $fielddetails));
|
$groupdetails['fields'][$fieldname] = self::array_merge_prefix($fielddetails, $fielddetails['type'], self::prefetchFormFieldData($fieldname, $fielddetails));
|
||||||
$form['groups'][$groupname]['fields'][$fieldname] = $groupdetails['fields'][$fieldname];
|
$form['groups'][$groupname]['fields'][$fieldname] = $groupdetails['fields'][$fieldname];
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -93,7 +93,7 @@ class Form
|
|||||||
return $fields;
|
return $fields;
|
||||||
}
|
}
|
||||||
|
|
||||||
function processForm(&$form, &$input, $url_params = array())
|
public static function processForm(&$form, &$input, $url_params = array())
|
||||||
{
|
{
|
||||||
if (\Froxlor\Validate\Form::validateFormDefinition($form)) {
|
if (\Froxlor\Validate\Form::validateFormDefinition($form)) {
|
||||||
$submitted_fields = array();
|
$submitted_fields = array();
|
||||||
@@ -188,9 +188,9 @@ class Form
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function processFormEx(&$form, &$input, $url_params = array(), $part, $settings_all, $settings_part, $only_enabledisable)
|
public static function processFormEx(&$form, &$input, $url_params = array(), $part, $settings_all, $settings_part, $only_enabledisable)
|
||||||
{
|
{
|
||||||
if (validateFormDefinition($form)) {
|
if (\Froxlor\Validate\Form::validateFormDefinition($form)) {
|
||||||
$submitted_fields = array();
|
$submitted_fields = array();
|
||||||
$changed_fields = array();
|
$changed_fields = array();
|
||||||
$saved_fields = array();
|
$saved_fields = array();
|
||||||
@@ -201,7 +201,7 @@ class Form
|
|||||||
// Prefetch form fields
|
// Prefetch form fields
|
||||||
foreach ($groupdetails['fields'] as $fieldname => $fielddetails) {
|
foreach ($groupdetails['fields'] as $fieldname => $fielddetails) {
|
||||||
if (! $only_enabledisable || ($only_enabledisable && isset($fielddetails['overview_option']))) {
|
if (! $only_enabledisable || ($only_enabledisable && isset($fielddetails['overview_option']))) {
|
||||||
$groupdetails['fields'][$fieldname] = self::array_merge_prefix($fielddetails, $fielddetails['type'], prefetchFormFieldData($fieldname, $fielddetails));
|
$groupdetails['fields'][$fieldname] = self::array_merge_prefix($fielddetails, $fielddetails['type'], self::prefetchFormFieldData($fieldname, $fielddetails));
|
||||||
$form['groups'][$groupname]['fields'][$fieldname] = $groupdetails['fields'][$fieldname];
|
$form['groups'][$groupname]['fields'][$fieldname] = $groupdetails['fields'][$fieldname];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -233,7 +233,7 @@ class Form
|
|||||||
|
|
||||||
foreach ($form['groups'] as $groupname => $groupdetails) {
|
foreach ($form['groups'] as $groupname => $groupdetails) {
|
||||||
if (($settings_part && $part == $groupname) || $settings_all || $only_enabledisable) {
|
if (($settings_part && $part == $groupname) || $settings_all || $only_enabledisable) {
|
||||||
if (validateFieldDefinition($groupdetails)) {
|
if (\Froxlor\Validate\Form::validateFieldDefinition($groupdetails)) {
|
||||||
// Check fields for plausibility
|
// Check fields for plausibility
|
||||||
foreach ($groupdetails['fields'] as $fieldname => $fielddetails) {
|
foreach ($groupdetails['fields'] as $fieldname => $fielddetails) {
|
||||||
if (! $only_enabledisable || ($only_enabledisable && isset($fielddetails['overview_option']))) {
|
if (! $only_enabledisable || ($only_enabledisable && isset($fielddetails['overview_option']))) {
|
||||||
@@ -276,7 +276,7 @@ class Form
|
|||||||
|
|
||||||
foreach ($form['groups'] as $groupname => $groupdetails) {
|
foreach ($form['groups'] as $groupname => $groupdetails) {
|
||||||
if (($settings_part && $part == $groupname) || $settings_all || $only_enabledisable) {
|
if (($settings_part && $part == $groupname) || $settings_all || $only_enabledisable) {
|
||||||
if (validateFieldDefinition($groupdetails)) {
|
if (\Froxlor\Validate\Form::validateFieldDefinition($groupdetails)) {
|
||||||
// Save fields
|
// Save fields
|
||||||
foreach ($groupdetails['fields'] as $fieldname => $fielddetails) {
|
foreach ($groupdetails['fields'] as $fieldname => $fielddetails) {
|
||||||
if (! $only_enabledisable || ($only_enabledisable && isset($fielddetails['overview_option']))) {
|
if (! $only_enabledisable || ($only_enabledisable && isset($fielddetails['overview_option']))) {
|
||||||
|
|||||||
@@ -36,7 +36,8 @@ require dirname(__DIR__) . '/vendor/autoload.php';
|
|||||||
require dirname(__DIR__) . '/lib/tables.inc.php';
|
require dirname(__DIR__) . '/lib/tables.inc.php';
|
||||||
|
|
||||||
// include consts
|
// include consts
|
||||||
require dirname(__DIR__) . '/lib/functions/logger/constant.logger.php';
|
require dirname(__DIR__) . '/lib/functions/constant.formfields.php';
|
||||||
|
require dirname(__DIR__) . '/lib/functions/constant.logger.php';
|
||||||
|
|
||||||
use Froxlor\Database\Database;
|
use Froxlor\Database\Database;
|
||||||
use Froxlor\Settings;
|
use Froxlor\Settings;
|
||||||
|
|||||||
29
tests/linting.php
Normal file
29
tests/linting.php
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
require dirname(__DIR__) . '/vendor/autoload.php';
|
||||||
|
// Includes the Functions
|
||||||
|
require \Froxlor\Froxlor::getInstallDir() . '/lib/functions/constant.formfields.php';
|
||||||
|
require \Froxlor\Froxlor::getInstallDir() . '/lib/functions/constant.logger.php';
|
||||||
|
|
||||||
|
// Includes the MySQL-Tabledefinitions etc.
|
||||||
|
require \Froxlor\Froxlor::getInstallDir() . '/lib/tables.inc.php';
|
||||||
|
|
||||||
|
$functions = get_defined_functions();
|
||||||
|
$calls = array();
|
||||||
|
foreach ($functions['user'] as $func) {
|
||||||
|
|
||||||
|
// grep for function
|
||||||
|
exec('grep -ir "'.$func.'" '.dirname(__DIR__).'/lib/', $output);
|
||||||
|
exec('grep -ir "'.$func.'" '.dirname(__DIR__).'/install/', $output);
|
||||||
|
exec('grep -ir "'.$func.'" '.dirname(__DIR__).'/actions/', $output);
|
||||||
|
exec('grep -ir "'.$func.'" '.dirname(__DIR__).'/*.php', $output);
|
||||||
|
echo "***********************************************".PHP_EOL;
|
||||||
|
echo "******* ". $func." ************************".PHP_EOL;
|
||||||
|
echo "***********************************************".PHP_EOL;
|
||||||
|
foreach ($output as $file) {
|
||||||
|
echo str_replace(dirname(__DIR__), "", $file) . PHP_EOL;
|
||||||
|
}
|
||||||
|
echo PHP_EOL;
|
||||||
|
$output = array();
|
||||||
|
}
|
||||||
|
|
||||||
Reference in New Issue
Block a user