diff --git a/actions/admin/settings/100.panel.php b/actions/admin/settings/100.panel.php index d5be46cc..faf53644 100644 --- a/actions/admin/settings/100.panel.php +++ b/actions/admin/settings/100.panel.php @@ -31,7 +31,10 @@ return array( 'type' => 'option', 'default' => 'English', 'option_mode' => 'one', - 'option_options_method' => array('\\Froxlor\\User', 'getLanguages'), + 'option_options_method' => array( + '\\Froxlor\\User', + 'getLanguages' + ), 'save_method' => 'storeSettingField' ), 'panel_default_theme' => array( @@ -44,7 +47,10 @@ return array( 'type' => 'option', 'default' => 'Froxlor', 'option_mode' => 'one', - 'option_options_method' => 'getThemes', + 'option_options_method' => array( + '\\Froxlor\\UI\\Template', + 'getThemes' + ), 'save_method' => 'storeSettingDefaultTheme' ), 'panel_allow_theme_change_customer' => array( diff --git a/admin_index.php b/admin_index.php index 6bc7dfb3..9f180887 100644 --- a/admin_index.php +++ b/admin_index.php @@ -300,7 +300,7 @@ if ($page == 'overview') { $default_theme = $userinfo['theme']; } - $themes_avail = getThemes(); + $themes_avail = \Froxlor\UI\Template::getThemes(); foreach ($themes_avail as $t => $d) { $theme_options .= \Froxlor\UI\HTML::makeoption($d, $t, $default_theme, true); } diff --git a/admin_settings.php b/admin_settings.php index 85bcdb73..2822e70c 100644 --- a/admin_settings.php +++ b/admin_settings.php @@ -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']); } - if (processFormEx($settings_data, $_POST, array( + if (\Froxlor\UI\Form::processFormEx($settings_data, $_POST, array( 'filename' => $filename, 'action' => $action, 'page' => $page diff --git a/customer_index.php b/customer_index.php index 25ea15b2..1bdcf416 100644 --- a/customer_index.php +++ b/customer_index.php @@ -271,7 +271,7 @@ if ($page == 'overview') { } $theme_options = ''; - $themes_avail = getThemes(); + $themes_avail = \Froxlor\UI\Template::getThemes(); foreach ($themes_avail as $t => $d) { $theme_options .= \Froxlor\UI\HTML::makeoption($d, $t, $default_theme, true); } diff --git a/install/updates/preconfig/0.9/preconfig_0.9.inc.php b/install/updates/preconfig/0.9/preconfig_0.9.inc.php index b6432c33..706906d4 100644 --- a/install/updates/preconfig/0.9/preconfig_0.9.inc.php +++ b/install/updates/preconfig/0.9/preconfig_0.9.inc.php @@ -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.'; $question = 'Select default panel theme: '; $question .= ''; - $themes = getThemes(); + $themes = \Froxlor\UI\Template::getThemes(); foreach ($themes as $cur_theme) { $question .= makeoption($cur_theme, $cur_theme, 'Froxlor'); } diff --git a/lib/Froxlor/UI/Form.php b/lib/Froxlor/UI/Form.php index e894eb97..c39fc6f7 100644 --- a/lib/Froxlor/UI/Form.php +++ b/lib/Froxlor/UI/Form.php @@ -10,13 +10,13 @@ class Form { $fields = ''; - if (validateFormDefinition($form)) { + if (\Froxlor\Validate\Form::validateFormDefinition($form)) { foreach ($form['groups'] as $groupname => $groupdetails) { if (isset($groupdetails['title']) && $groupdetails['title'] != '') { $fields .= self::getFormGroupOutput($groupname, $groupdetails); } - if (validateFieldDefinition($groupdetails)) { + if (\Froxlor\Validate\Form::validateFieldDefinition($groupdetails)) { // Prefetch form fields foreach ($groupdetails['fields'] as $fieldname => $fielddetails) { $groupdetails['fields'][$fieldname] = self::array_merge_prefix($fielddetails, $fielddetails['type'], prefetchFormFieldData($fieldname, $fielddetails)); @@ -38,7 +38,7 @@ class Form { $fields = ''; - if (validateFormDefinition($form)) { + if (\Froxlor\Validate\Form::validateFormDefinition($form)) { foreach ($form['groups'] as $groupname => $groupdetails) { // show overview if ($part == '') { @@ -73,10 +73,10 @@ class Form $fields .= self::getFormGroupOutput($groupname, $groupdetails); } - if (validateFieldDefinition($groupdetails)) { + if (\Froxlor\Validate\Form::validateFieldDefinition($groupdetails)) { // Prefetch form fields 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]; } @@ -93,7 +93,7 @@ class Form return $fields; } - function processForm(&$form, &$input, $url_params = array()) + public static function processForm(&$form, &$input, $url_params = array()) { if (\Froxlor\Validate\Form::validateFormDefinition($form)) { $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(); $changed_fields = array(); $saved_fields = array(); @@ -201,7 +201,7 @@ class Form // Prefetch form fields foreach ($groupdetails['fields'] as $fieldname => $fielddetails) { 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]; } } @@ -233,7 +233,7 @@ class Form foreach ($form['groups'] as $groupname => $groupdetails) { if (($settings_part && $part == $groupname) || $settings_all || $only_enabledisable) { - if (validateFieldDefinition($groupdetails)) { + if (\Froxlor\Validate\Form::validateFieldDefinition($groupdetails)) { // Check fields for plausibility foreach ($groupdetails['fields'] as $fieldname => $fielddetails) { if (! $only_enabledisable || ($only_enabledisable && isset($fielddetails['overview_option']))) { @@ -276,7 +276,7 @@ class Form foreach ($form['groups'] as $groupname => $groupdetails) { if (($settings_part && $part == $groupname) || $settings_all || $only_enabledisable) { - if (validateFieldDefinition($groupdetails)) { + if (\Froxlor\Validate\Form::validateFieldDefinition($groupdetails)) { // Save fields foreach ($groupdetails['fields'] as $fieldname => $fielddetails) { if (! $only_enabledisable || ($only_enabledisable && isset($fielddetails['overview_option']))) { diff --git a/tests/bootstrap.php b/tests/bootstrap.php index 08b77d0f..6fa022aa 100644 --- a/tests/bootstrap.php +++ b/tests/bootstrap.php @@ -36,7 +36,8 @@ require dirname(__DIR__) . '/vendor/autoload.php'; require dirname(__DIR__) . '/lib/tables.inc.php'; // 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\Settings; diff --git a/tests/linting.php b/tests/linting.php new file mode 100644 index 00000000..ebc9734e --- /dev/null +++ b/tests/linting.php @@ -0,0 +1,29 @@ +