From d43770db28cd04b9f3ac2d12283d875782a53713 Mon Sep 17 00:00:00 2001 From: "Paul S. Owen" Date: Mon, 19 May 2003 21:41:55 +0000 Subject: [PATCH] Further updates git-svn-id: file:///svn/phpbb/trunk@4024 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/includes/functions_user.php | 2 +- phpBB/includes/ucp/ucp_prefs.php | 72 ++++++++++++++++++++++++++++-- phpBB/includes/ucp/ucp_profile.php | 12 ++--- phpBB/language/en/lang_main.php | 16 +++++-- 4 files changed, 90 insertions(+), 12 deletions(-) diff --git a/phpBB/includes/functions_user.php b/phpBB/includes/functions_user.php index 6a4bea7b6d..8dc13b1e47 100644 --- a/phpBB/includes/functions_user.php +++ b/phpBB/includes/functions_user.php @@ -133,7 +133,7 @@ class ucp extends user break; case 'bool': - $valid_data[$var_name] = ($data[$var_name] < 0) ? 0 : 1; + $valid_data[$var_name] = ($data[$var_name] <= 0) ? 0 : 1; break; case 'string': diff --git a/phpBB/includes/ucp/ucp_prefs.php b/phpBB/includes/ucp/ucp_prefs.php index 2c963381f1..3027935382 100644 --- a/phpBB/includes/ucp/ucp_prefs.php +++ b/phpBB/includes/ucp/ucp_prefs.php @@ -47,8 +47,9 @@ class ucp_prefs extends ucp 'dateformat'=> '3,15', 'lang' => '2,5', ), - 'int' => array('viewemail', 'hideonline', 'notifypm', 'popuppm', 'dst', 'style'), - 'float' => array('tz') + 'int' => array('dst', 'style'), + 'float' => array('tz'), + 'bool' => array('viewemail', 'hideonline', 'notifypm', 'popuppm') ); $data = $this->normalise_data($_POST, $normalise); @@ -80,7 +81,8 @@ class ucp_prefs extends ucp $db->sql_query($sql); meta_refresh(3, "ucp.$phpEx$SID&i=$id&mode=$submode"); - trigger_error(''); + $message = $user->lang['PREFERENCES_UPDATED'] . '

' . sprintf($user->lang['RETURN_UCP'], "", ''); + trigger_error($message); } // @@ -135,6 +137,70 @@ class ucp_prefs extends ucp break; case 'post': + + if (isset($_POST['submit'])) + { + $data = array(); + $normalise = array( + 'bool' => array('bbcode', 'html', 'smilies', 'sig', 'notify'), + ); + $data = $this->normalise_data($_POST, $normalise); + + if (!sizeof($this->error)) + { + $sql_ary = array( + 'user_allowbbcode' => $data['bbcode'], + 'user_allowhtml' => $data['html'], + 'user_allowsmile' => $data['smilies'], + 'user_attachsig' => $data['sig'], + 'user_notify' => $data['notify'], + ); + + $sql = 'UPDATE ' . USERS_TABLE . ' + SET ' . $db->sql_build_array('UPDATE', $sql_ary) . ' + WHERE user_id = ' . $user->data['user_id']; + $db->sql_query($sql); + + meta_refresh(3, "ucp.$phpEx$SID&i=$id&mode=$submode"); + $message = $user->lang['PREFERENCES_UPDATED'] . '

' . sprintf($user->lang['RETURN_UCP'], "", ''); + trigger_error($message); + } + + // + extract($data); + unset($data); + } + + $bbcode = (isset($bbcode)) ? $bbcode : $user->data['user_allowbbcode']; + $bbcode_yes = ($bbcode) ? ' checked="checked"' : ''; + $bbcode_no = (!$bbcode) ? ' checked="checked"' : ''; + $html = (isset($html)) ? $html : $user->data['user_allowhtml']; + $html_yes = ($html) ? ' checked="checked"' : ''; + $html_no = (!$html) ? ' checked="checked"' : ''; + $smilies = (isset($smilies)) ? $smilies : $user->data['user_allowsmile']; + $smilies_yes = ($smilies) ? ' checked="checked"' : ''; + $smilies_no = (!$smilies) ? ' checked="checked"' : ''; + $sig = (isset($sig)) ? $sig : $user->data['user_attachsig']; + $sig_yes = ($sig) ? ' checked="checked"' : ''; + $sig_no = (!$sig) ? ' checked="checked"' : ''; + $notify = (isset($notify)) ? $notify : $user->data['user_notify']; + $notify_yes = ($notify) ? ' checked="checked"' : ''; + $notify_no = (!$notify) ? ' checked="checked"' : ''; + + $template->assign_vars(array( + 'ERROR' => (sizeof($this->error)) ? implode('
', $this->error) : '', + + 'DEFAULT_BBCODE_YES' => $bbcode_yes, + 'DEFAULT_BBCODE_NO' => $bbcode_no, + 'DEFAULT_HTML_YES' => $html_yes, + 'DEFAULT_HTML_NO' => $html_no, + 'DEFAULT_SMILIES_YES' => $smilies_yes, + 'DEFAULT_SMILIES_NO' => $smilies_no, + 'DEFAULT_SIG_YES' => $sig_yes, + 'DEFAULT_SIG_NO' => $sig_no, + 'DEFAULT_NOTIFY_YES' => $notify_yes, + 'DEFAULT_NOTIFY_NO' => $notify_no,) + ); break; } diff --git a/phpBB/includes/ucp/ucp_profile.php b/phpBB/includes/ucp/ucp_profile.php index 6a846b93e1..bfbcf5d076 100644 --- a/phpBB/includes/ucp/ucp_profile.php +++ b/phpBB/includes/ucp/ucp_profile.php @@ -81,7 +81,8 @@ class ucp_profile extends ucp $db->sql_query($sql); meta_refresh(3, "ucp.$phpEx$SID&i=$id&mode=$submode"); - trigger_error(''); + $message = $user->lang['PROFILE_UPDATED'] . '

' . sprintf($user->lang['RETURN_UCP'], "", ''); + trigger_error($message); } // @@ -129,7 +130,7 @@ class ucp_profile extends ucp $validate = array( 'match' => array( 'icq' => ($data['icq']) ? '#^[0-9]+$#i' : '', - 'website' => ($data['website']) ? '#^http[s]?://(.*?\.)*?([a-z0-9\-]+\.)?[a-z]+#i' : '', + 'website' => ($data['website']) ? '#^http[s]?://(.*?\.)*?[a-z0-9\-]+\.[a-z]+#i' : '', ), ); $this->validate_data($data, $validate); @@ -155,7 +156,8 @@ class ucp_profile extends ucp $db->sql_query($sql); meta_refresh(3, "ucp.$phpEx$SID&i=$id&mode=$submode"); - trigger_error(''); + $message = $user->lang['PROFILE_UPDATED'] . '

' . sprintf($user->lang['RETURN_UCP'], "", ''); + trigger_error($message); } // @@ -256,8 +258,8 @@ class ucp_profile extends ucp WHERE user_id = ' . $user->data['user_id']; $db->sql_query($sql); - meta_refresh(3, "ucp.$phpEx$SID&i=$id&mode=$submode"); - trigger_error(''); + $message = $user->lang['PROFILE_UPDATED'] . '

' . sprintf($user->lang['RETURN_UCP'], "", ''); + trigger_error($message); } } diff --git a/phpBB/language/en/lang_main.php b/phpBB/language/en/lang_main.php index f8acd3669f..7070dfe4b4 100644 --- a/phpBB/language/en/lang_main.php +++ b/phpBB/language/en/lang_main.php @@ -697,6 +697,8 @@ $lang = array( 'AVATAR_GALLERY' => 'Select from gallery', 'SHOW_GALLERY' => 'Show gallery', + 'PROFILE_UPDATED' => 'Your profile has been updated.', + 'UCP_PREFERENCES' => 'Preferences', @@ -713,15 +715,23 @@ $lang = array( 'BOARD_DATE_FORMAT_EXPLAIN' => 'The syntax used is identical to the PHP date() function', 'UCP_VIEW' => 'Viewing Posts', + 'VIEW_IMAGES' => 'Display Images within posts', + 'VIEW_FLASH' => 'Display Flash animations', + 'VIEW_SMILIES' => 'Display Smileys as images', + 'VIEW_SIGS' => 'Display Signatures', + 'VIEW_AVATARS' => 'Display Avatars', + 'DISABLE_CENSORS' => 'Disable Word censoring', 'UCP_POST' => 'Posting Messages', 'DEFAULT_SMILE' => 'Enable smilies by default', 'DEFAULT_HTML' => 'Enable HTML by default', - 'DEFAULT_BBCODE' => 'Enable BBCode by default', + 'DEFAULT_BBCODE' => 'Enable BBCode by default', 'DEFAULT_ADD_SIG' => 'Attach my signature by default', - 'DEFAULT_NOTIFY' => 'Notify me upon replies by default', + 'DEFAULT_NOTIFY' => 'Notify me upon replies by default', + + 'PREFERENCES_UPDATED' => 'Your preferences have been updated.', + - 'UCP_MESSAGING' => 'Private Messaging',