From 8506d6d27e3b926521007064abcdcc2f69c6aa06 Mon Sep 17 00:00:00 2001 From: Igor Scheller Date: Sat, 21 Jan 2017 23:07:20 +0100 Subject: Refactoring: Config cleanup / moved to class --- includes/pages/user_settings.php | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) (limited to 'includes/pages/user_settings.php') diff --git a/includes/pages/user_settings.php b/includes/pages/user_settings.php index 5d4ba368..a2a486f4 100644 --- a/includes/pages/user_settings.php +++ b/includes/pages/user_settings.php @@ -97,13 +97,12 @@ function user_settings_main($user_source, $enable_tshirt_size, $tshirt_sizes) */ function user_settings_password($user_source) { - global $min_password_length; if ( !isset($_REQUEST['password']) || !verify_password($_REQUEST['password'], $user_source['Passwort'], $user_source['UID']) ) { error(_('-> not OK. Please try again.')); - } elseif (strlen($_REQUEST['new_password']) < $min_password_length) { + } elseif (strlen($_REQUEST['new_password']) < config('min_password_length')) { error(_('Your password is to short (please use at least 6 characters).')); } elseif ($_REQUEST['new_password'] != $_REQUEST['new_password2']) { error(_('Your passwords don\'t match.')); @@ -195,8 +194,11 @@ function user_settings_locale($user_source, $locales) */ function user_settings() { - global $enable_tshirt_size, $tshirt_sizes, $themes, $locales; - global $user; + global $themes, $user; + + $enable_tshirt_size = config('enable_tshirt_size'); + $tshirt_sizes = config('tshirt_sizes'); + $locales = config('locales'); $buildup_start_date = null; $teardown_end_date = null; @@ -210,6 +212,12 @@ function user_settings() } } + foreach ($tshirt_sizes as $key => $size) { + if (empty($size)) { + unset($tshirt_sizes[$key]); + } + } + $user_source = $user; if (isset($_REQUEST['submit'])) { -- cgit v1.2.3-54-g00ecf