aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/includes/ucp/ucp_prefs.php
diff options
context:
space:
mode:
authorMeik Sievertsen <acydburn@phpbb.com>2006-11-04 17:19:33 +0000
committerMeik Sievertsen <acydburn@phpbb.com>2006-11-04 17:19:33 +0000
commit63c0c798c83df387bcb71f17c0b98120e89a5467 (patch)
treeb788476b60fd5c7e799590961cfcb5ce5108df74 /phpBB/includes/ucp/ucp_prefs.php
parent8b90d5998b944c055c24fd0d17dba25e2de9860c (diff)
downloadforums-63c0c798c83df387bcb71f17c0b98120e89a5467.tar
forums-63c0c798c83df387bcb71f17c0b98120e89a5467.tar.gz
forums-63c0c798c83df387bcb71f17c0b98120e89a5467.tar.bz2
forums-63c0c798c83df387bcb71f17c0b98120e89a5467.tar.xz
forums-63c0c798c83df387bcb71f17c0b98120e89a5467.zip
- use the $var_ary for settings in a more logical way (hopefully removes the clutter and shows where which variable is set how)
- hopefully utf8 passwords are working too now git-svn-id: file:///svn/phpbb/trunk@6552 89ea8834-ac86-4346-8a33-228a782c2dd0
Diffstat (limited to 'phpBB/includes/ucp/ucp_prefs.php')
-rw-r--r--phpBB/includes/ucp/ucp_prefs.php112
1 files changed, 41 insertions, 71 deletions
diff --git a/phpBB/includes/ucp/ucp_prefs.php b/phpBB/includes/ucp/ucp_prefs.php
index 5dce0b80c2..378562a2dd 100644
--- a/phpBB/includes/ucp/ucp_prefs.php
+++ b/phpBB/includes/ucp/ucp_prefs.php
@@ -30,44 +30,30 @@ class ucp_prefs
case 'personal':
$data = array(
- 'notifymethod' => $user->data['user_notify_type'],
- 'dateformat' => $user->data['user_dateformat'],
- 'lang' => $user->data['user_lang'],
- 'style' => $user->data['user_style'],
- 'tz' => $user->data['user_timezone'],
+ 'notifymethod' => request_var('notifymethod', $user->data['user_notify_type']),
+ 'dateformat' => request_var('dateformat', $user->data['user_dateformat']),
+ 'lang' => request_var('lang', $user->data['user_lang']),
+ 'style' => request_var('style', (int) $user->data['user_style']),
+ 'tz' => request_var('tz', (float) $user->data['user_timezone']),
+
+ 'dst' => request_var('dst', (bool) $user->data['user_dst']),
+ 'viewemail' => request_var('viewemail', (bool) $user->data['user_allow_viewemail']),
+ 'massemail' => request_var('massemail', (bool) $user->data['user_allow_massemail']),
+ 'hideonline' => request_var('hideonline', (bool) !$user->data['user_allow_viewonline']),
+ 'notifypm' => request_var('notifypm', (bool) $user->data['user_notify_pm']),
+ 'popuppm' => request_var('popuppm', (bool) $user->optionget('popuppm')),
+ 'allowpm' => request_var('allowpm', (bool) $user->data['user_allow_pm']),
);
if ($submit)
{
- $var_ary = array(
- 'dateformat' => (string) $config['default_dateformat'],
- 'lang' => (string) $config['default_lang'],
- 'tz' => (float) $config['board_timezone'],
- 'style' => (int) $config['default_style'],
- 'dst' => (bool) $config['board_dst'],
- 'viewemail' => false,
- 'massemail' => true,
- 'hideonline' => false,
- 'notifymethod' => 0,
- 'notifypm' => true,
- 'popuppm' => false,
- 'allowpm' => true,
- );
-
- foreach ($var_ary as $var => $default)
- {
- $data[$var] = request_var($var, $default);
- }
-
$data['style'] = ($config['override_user_style']) ? $config['default_style'] : $data['style'];
- $var_ary = array(
+ $error = validate_data($data, array(
'dateformat' => array('string', false, 3, 30),
'lang' => array('match', false, '#^[a-z0-9_\-]{2,}$#i'),
'tz' => array('num', false, -14, 14),
- );
-
- $error = validate_data($data, $var_ary);
+ ));
if (!sizeof($error))
{
@@ -128,13 +114,13 @@ class ucp_prefs
'S_NOTIFY_EMAIL' => ($data['notifymethod'] == NOTIFY_EMAIL) ? true : false,
'S_NOTIFY_IM' => ($data['notifymethod'] == NOTIFY_IM) ? true : false,
'S_NOTIFY_BOTH' => ($data['notifymethod'] == NOTIFY_BOTH) ? true : false,
- 'S_VIEW_EMAIL' => (isset($data['viewemail'])) ? $data['viewemail'] : $user->data['user_allow_viewemail'],
- 'S_MASS_EMAIL' => (isset($data['massemail'])) ? $data['massemail'] : $user->data['user_allow_massemail'],
- 'S_ALLOW_PM' => (isset($data['allowpm'])) ? $data['allowpm'] : $user->data['user_allow_pm'],
- 'S_HIDE_ONLINE' => (isset($data['hideonline'])) ? $data['hideonline'] : !$user->data['user_allow_viewonline'],
- 'S_NOTIFY_PM' => (isset($data['notifypm'])) ? $data['notifypm'] : $user->data['user_notify_pm'],
- 'S_POPUP_PM' => (isset($data['popuppm'])) ? $data['popuppm'] : $user->optionget('popuppm'),
- 'S_DST' => (isset($data['dst'])) ? $data['dst'] : $user->data['user_dst'],
+ 'S_VIEW_EMAIL' => $data['viewemail'],
+ 'S_MASS_EMAIL' => $data['massemail'],
+ 'S_ALLOW_PM' => $data['allowpm'],
+ 'S_HIDE_ONLINE' => $data['hideonline'],
+ 'S_NOTIFY_PM' => $data['notifypm'],
+ 'S_POPUP_PM' => $data['popuppm'],
+ 'S_DST' => $data['dst'],
'DATE_FORMAT' => $data['dateformat'],
'S_DATEFORMAT_OPTIONS' => $dateformat_options,
@@ -161,32 +147,23 @@ class ucp_prefs
'post_sk' => (!empty($user->data['user_post_sortby_type'])) ? $user->data['user_post_sortby_type'] : 't',
'post_sd' => (!empty($user->data['user_post_sortby_dir'])) ? $user->data['user_post_sortby_dir'] : 'a',
'post_st' => (!empty($user->data['user_post_show_days'])) ? $user->data['user_post_show_days'] : 0,
+
+ 'images' => request_var('images', (bool) $user->optionget('viewimg')),
+ 'flash' => request_var('flash', (bool) $user->optionget('viewflash')),
+ 'smilies' => request_var('smilies', (bool) $user->optionget('viewsmilies')),
+ 'sigs' => request_var('sigs', (bool) $user->optionget('viewsigs')),
+ 'avatars' => request_var('avatars', (bool) $user->optionget('viewavatars')),
+ 'wordcensor' => request_var('wordcensor', (bool) $user->optionget('viewcensors')),
);
if ($submit)
{
- $var_ary = array_merge($data, array(
- 'images' => true,
- 'flash' => false,
- 'smilies' => true,
- 'sigs' => true,
- 'avatars' => true,
- 'wordcensor'=> false,
- ));
-
- foreach ($var_ary as $var => $default)
- {
- $data[$var] = request_var($var, $default);
- }
-
- $var_ary = array(
+ $error = validate_data($data, array(
'topic_sk' => array('string', false, 1, 1),
'topic_sd' => array('string', false, 1, 1),
'post_sk' => array('string', false, 1, 1),
'post_sd' => array('string', false, 1, 1),
- );
-
- $error = validate_data($data, $var_ary);
+ ));
if (!sizeof($error))
{
@@ -271,12 +248,12 @@ class ucp_prefs
$template->assign_vars(array(
'ERROR' => (sizeof($error)) ? implode('<br />', $error) : '',
- 'S_IMAGES' => (isset($data['images'])) ? $data['images'] : $user->optionget('viewimg'),
- 'S_FLASH' => (isset($data['flash'])) ? $data['flash'] : $user->optionget('viewflash'),
- 'S_SMILIES' => (isset($data['smilies'])) ? $data['smilies'] : $user->optionget('viewsmilies'),
- 'S_SIGS' => (isset($data['sigs'])) ? $data['sigs'] : $user->optionget('viewsigs'),
- 'S_AVATARS' => (isset($data['avatars'])) ? $data['avatars'] : $user->optionget('viewavatars'),
- 'S_DISABLE_CENSORS' => (isset($data['wordcensor'])) ? $data['wordcensor'] : $user->optionget('viewcensors'),
+ 'S_IMAGES' => $data['images'],
+ 'S_FLASH' => $data['flash'],
+ 'S_SMILIES' => $data['smilies'],
+ 'S_SIGS' => $data['sigs'],
+ 'S_AVATARS' => $data['avatars'],
+ 'S_DISABLE_CENSORS' => $data['wordcensor'],
'S_CHANGE_CENSORS' => ($auth->acl_get('u_chgcensors')) ? true : false,
@@ -293,21 +270,14 @@ class ucp_prefs
case 'post':
$data = array(
- 'bbcode' => $user->optionget('bbcode'),
- 'smilies' => $user->optionget('smilies'),
- 'sig' => $user->optionget('attachsig'),
- 'notify' => $user->data['user_notify'],
+ 'bbcode' => request_var('bbcode', $user->optionget('bbcode')),
+ 'smilies' => request_var('smilies', $user->optionget('smilies')),
+ 'sig' => request_var('sig', $user->optionget('attachsig')),
+ 'notify' => request_var('notify', $user->data['user_notify']),
);
if ($submit)
{
- $var_ary = $data;
-
- foreach ($var_ary as $var => $default)
- {
- $data[$var] = request_var($var, $default);
- }
-
$user->optionset('bbcode', $data['bbcode']);
$user->optionset('smilies', $data['smilies']);
$user->optionset('attachsig', $data['sig']);