From 2fc8842b0f834bcc86eece396ba3850674dd72c2 Mon Sep 17 00:00:00 2001 From: "Paul S. Owen" Date: Fri, 9 May 2003 14:11:55 +0000 Subject: [PATCH] Had to make a start on the UCP proper ... note that things may and in places are quite broken git-svn-id: file:///svn/phpbb/trunk@3996 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/includes/functions.php | 14 +- phpBB/includes/functions_user.php | 179 ++++------ phpBB/language/en/lang_main.php | 107 +++--- phpBB/templates/subSilver/ucp_agreement.html | 33 ++ phpBB/templates/subSilver/ucp_footer.html | 10 + phpBB/templates/subSilver/ucp_header.html | 25 ++ phpBB/templates/subSilver/ucp_main.html | 75 ++++ phpBB/templates/subSilver/ucp_prefs.html | 137 ++++++++ phpBB/templates/subSilver/ucp_profile.html | 156 +++++++++ phpBB/templates/subSilver/ucp_register.html | 87 +++++ phpBB/ucp.php | 117 ++++++- phpBB/ucp/ucp_prefs.php | 70 ++++ phpBB/ucp/ucp_profile.php | 86 +++++ phpBB/ucp/ucp_register.php | 344 ++++++++----------- phpBB/ucp/ucp_zebra.php | 33 ++ 15 files changed, 1096 insertions(+), 377 deletions(-) create mode 100644 phpBB/templates/subSilver/ucp_agreement.html create mode 100644 phpBB/templates/subSilver/ucp_footer.html create mode 100644 phpBB/templates/subSilver/ucp_header.html create mode 100644 phpBB/templates/subSilver/ucp_main.html create mode 100644 phpBB/templates/subSilver/ucp_prefs.html create mode 100644 phpBB/templates/subSilver/ucp_profile.html create mode 100644 phpBB/templates/subSilver/ucp_register.html create mode 100644 phpBB/ucp/ucp_prefs.php create mode 100644 phpBB/ucp/ucp_profile.php create mode 100644 phpBB/ucp/ucp_zebra.php diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index 2418d18abf..74654dd197 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -336,11 +336,11 @@ function make_jumpbox($action, $forum_id = false, $select_all = false) // Pick a language, any language ... function language_select($default = '') { - global $db, $phpbb_root_path, $phpEx; + global $db; - $sql = "SELECT lang_iso, lang_local_name - FROM " . LANG_TABLE . " - ORDER BY lang_english_name"; + $sql = 'SELECT lang_iso, lang_local_name + FROM ' . LANG_TABLE . ' + ORDER BY lang_english_name'; $result = $db->sql_query($sql); $lang_options = ''; @@ -359,9 +359,9 @@ function style_select($default = '') { global $db; - $sql = "SELECT style_id, style_name - FROM " . STYLES_TABLE . " - ORDER BY style_name, style_id"; + $sql = 'SELECT style_id, style_name + FROM ' . STYLES_TABLE . ' + ORDER BY style_name'; $result = $db->sql_query($sql); $style_options = ''; diff --git a/phpBB/includes/functions_user.php b/phpBB/includes/functions_user.php index ec72d2c940..681289c0b7 100644 --- a/phpBB/includes/functions_user.php +++ b/phpBB/includes/functions_user.php @@ -63,20 +63,20 @@ function validate_optional_fields(&$icq, &$aim, &$msnm, &$yim, &$website, &$loca // and user profile manipulation class userdata extends user { - var $error = false; - var $error_msg; + var $error = array(); - function add_new_user($userdata, $coppa) + function add_user($coppa) { global $config, $db, $user; - $userdata = $this->prepare_data($userdata, TRUE); + $userdata = $this->prepare_data(true); - if (!$this->error) + if (!sizeof($this->error)) { - if (($coppa) && ($config['require_activation'] == USER_ACTIVATION_SELF || $config['require_activation'] == USER_ACTIVATION_ADMIN)) + if ($coppa && ($config['require_activation'] == USER_ACTIVATION_SELF || + $config['require_activation'] == USER_ACTIVATION_ADMIN)) { - $user_actkey = $this->gen_png_string(10); + $user_actkey = ucp::gen_rand_string(10); $key_len = 54 - (strlen($server_url)); $key_len = ($key_len > 6) ? $key_len : 6; @@ -103,26 +103,12 @@ class userdata extends user 'username' => $userdata['username'], 'user_password' => $userdata['password'], 'user_email' => $userdata['email'], - 'user_viewemail' => $userdata['viewemail'], - 'user_attachsig' => $userdata['attachsig'], - 'user_allowsmile' => $userdata['allowsmilies'], - 'user_allowhtml' => $userdata['allowhtml'], - 'user_allowbbcode' => $userdata['allowbbcode'], - 'user_allow_viewonline' => $userdata['allowviewonline'], - 'user_allow_pm' => 1, - 'user_notify' => $userdata['notifyreply'], - 'user_allow_viewonline' => $userdata['hideonline'], - 'user_notify_pm'=> $userdata['notifypm'], - 'user_popup_pm' => $userdata['popup_pm'], + 'user_allow_pm' => 1, 'user_timezone' => (float) $userdata['timezone'], - 'user_dateformat' => $userdata['dateformat'], - 'user_lang' => $userdata['language'], - 'user_style' => $userdata['style'], - 'user_active' => $user_active, - 'user_actkey' => $user_actkey + 'user_lang' => $userdata['language'], + 'user_active' => $user_active, + 'user_actkey' => $user_actkey ); - // 'user_avatar' => $avatar_sql['data'], - // 'user_avatar_type' => $avatar_sql['type'], $sql = 'INSERT INTO ' . USERS_TABLE . ' ' . $db->sql_build_array('INSERT', $sql_ary); $db->sql_query($sql); @@ -143,22 +129,22 @@ class userdata extends user if ($coppa) { - $message = $user->lang['COPPA']; + $message = $user->lang['ACCOUNT_COPPA']; $email_template = 'coppa_welcome_inactive'; } else if ($config['require_activation'] == USER_ACTIVATION_SELF) { - $message = $user->lang['Account_inactive']; + $message = $user->lang['ACCOUNT_INACTIVE']; $email_template = 'user_welcome_inactive'; } else if ($config['require_activation'] == USER_ACTIVATION_ADMIN) { - $message = $user->lang['Account_inactive_admin']; + $message = $user->lang['ACCOUNT_INACTIVE_ADMIN']; $email_template = 'admin_welcome_inactive'; } else { - $message = $user->lang['Account_added']; + $message = $user->lang['ACCOUNT_ADDED']; $email_template = 'user_welcome'; } @@ -221,29 +207,27 @@ class userdata extends user $emailer->reset(); } */ - $message = $message . '

' . sprintf($user->lang['RETURN_INDEX'], '', ''); - $return = array('user_id' => $user_id, - 'username' => $userdata['username'], - 'message' => $message); + if ($config['require_activation'] == USER_ACTIVATION_NONE) + { + set_config('newest_user_id', $userdata['user_id']); + set_config('newest_username', $userdata['username']); + set_config('num_users', $config['num_users'] + 1, TRUE); + } + unset($userdata); - return($return); - - - } - else - { - return(array('user_id' => 0, - 'username' => NULL, - 'message' => $this->error_msg)); + return $message; } + return false; } - function prepare_data($userdata, $registration = FALSE) + function prepare_data($registration = FALSE) { global $db, $user, $config; + $userdata = &$_POST; + $strip_var_list = array('username' => 'username', 'email' => 'email'); foreach ($strip_var_list as $var => $param) @@ -287,14 +271,13 @@ class userdata extends user if (!empty($userdata['language'])) { - if (preg_match('/^[a-z_]+$/i', $userdata['language'])) + if (preg_match('#^[a-z_]+$#i', $userdata['language'])) { $userdata['language'] = $userdata['language']; } else { - $this->error = true; - $this->error_msg = $user->lang['Fields_empty']; + $this->error[] = $user->lang['Fields_empty']; } } else @@ -307,25 +290,22 @@ class userdata extends user if (empty($userdata['username']) || empty($userdata['password']) || empty($userdata['password_confirm']) || empty($userdata['email'])) { - $this->error = TRUE; - $this->error_msg .= ((isset($this->error_msg)) ? '
' : '') . $user->lang['Fields_empty']; + $this->error[] = $user->lang['Fields_empty']; } if (!empty($userdata['password']) && !empty($userdata['password_confirm'])) { if ($userdata['password'] != $userdata['password_confirm']) { - $this->error = TRUE; - $this->error_msg .= ((isset($this->error_msg)) ? '
' : '') . $user->lang['Password_mismatch']; + $this->error[] = $user->lang['Password_mismatch']; } else if (strlen($userdata['password']) > 32) { - $this->error = TRUE; - $this->error_msg .= ((isset($this->error_msg)) ? '
' : '') . $user->lang['Password_long']; + $this->error[] = $user->lang['Password_long']; } else { - if (!$this->error) + if (!sizeof($this->error)) { $userdata['password'] = md5($userdata['password']); $passwd_sql = "user_password = '$password', "; @@ -334,8 +314,7 @@ class userdata extends user } else if ((empty($userdata['password']) && !empty($userdata['password_confirm'])) || (!empty($userdata['password']) && empty($userdata['password_confirm']))) { - $this->error = TRUE; - $this->error_msg .= ((isset($this->error_msg)) ? '
' : '') . $user->lang['Password_mismatch']; + $this->error[] = $user->lang['Password_mismatch']; } else { @@ -349,22 +328,19 @@ class userdata extends user { $userdata['email'] = $user->data['user_email']; - $this->error = TRUE; - $this->error_msg .= ((isset($this->error_msg)) ? '
' : '') . $result; + $this->error[] = $result; } } if (empty($userdata['username'])) { - $this->error = TRUE; - $this->error_msg .= ((isset($this->error_msg)) ? '
' : '') . $user->lang['Username_disallowed']; + $this->error[] = $user->lang['Username_disallowed']; } else { if (($result = $this->validate_username($userdata['username'])) != false) { - $this->error = TRUE; - $this->error_msg .= ((isset($this->error_msg)) ? '
' : '') . $result; + $this->error[] = $result; } } @@ -373,8 +349,7 @@ class userdata extends user { if (empty($userdata['confirm_id'])) { - $this->error = TRUE; - $this->error_msg .= ((isset($this->error_msg)) ? '
' : '') . $user->lang['Confirm_code_wrong']; + $this->error[] = $user->lang['CONFIRM_CODE_WRONG']; } else { @@ -382,22 +357,20 @@ class userdata extends user FROM " . CONFIRM_TABLE . " WHERE confirm_id = '" . $userdata['confirm_id'] . "' AND session_id = '" . $user->data['session_id'] . "'"; - $result = $db->sql_query($sql); if ($row = $db->sql_fetchrow($result)) { if ($row['code'] != $userdata['confirm_code']) { - $this->error = TRUE; - $this->error_msg .= ((isset($this->error_msg)) ? '
' : '') . $user->lang['Confirm_code_wrong']; + $this->error[] = $user->lang['CONFIRM_CODE_WRONG']; } } else { - $this->error = TRUE; - $this->error_msg .= ((isset($this->error_msg)) ? '
' : '') . $user->lang['Confirm_code_wrong']; + $this->error[] = $user->lang['CONFIRM_CODE_WRONG']; } + $db->sql_freeresult($result); $sql = "DELETE FROM " . CONFIRM_TABLE . " WHERE confirm_id = '" . $userdata['confirm_id'] . "' @@ -405,7 +378,8 @@ class userdata extends user $db->sql_query($sql); } } - return($userdata); + + return $userdata; } function modify_userdata($userdata) @@ -414,23 +388,6 @@ class userdata extends user } - function gen_png_string($num_chars) - { - $chars = array('A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', '1', '2', '3', '4', '5', '6', '7', '8', '9'); - - list($usec, $sec) = explode(' ', microtime()); - mt_srand($sec * $usec); - - $max_chars = count($chars) - 1; - $rand_str = ''; - for ($i = 0; $i < $num_chars; $i++) - { - $rand_str .= $chars[mt_rand(0, $max_chars)]; - } - - return $rand_str; - } - // Check to see if the username has been taken, or if it is disallowed. // Also checks if it includes the " character, which we don't allow in usernames. // Used for registering, changing names, and posting anonymously with a username @@ -441,7 +398,19 @@ class userdata extends user // Clean up username ... convert any entities into normal // text, remove excess spaces, then escape it $username = strtr(trim($username), array_flip(get_html_translation_table(HTML_ENTITIES))); - $username = preg_replace('#[\s]{2,}#', '', $username); + $username = preg_replace('#\s{2,}#', '', $username); + + if (strlen(htmlspecialchars($username)) > 60) + { + return 'USERNAME_LONG'; + } + + // Don't allow " in username. + if (strstr($username, '"')) + { + return 'USERNAME_INVALID'; + } + $username = $db->sql_escape($username); $sql = "SELECT username @@ -451,8 +420,9 @@ class userdata extends user if (($row = $db->sql_fetchrow($result)) && $row['username'] != $user->data['username']) { - return $user->lang['Username_taken']; + return 'USERNAME_TAKEN'; } + $db->sql_freeresult($result); $sql = "SELECT group_name FROM " . GROUPS_TABLE . " @@ -461,39 +431,36 @@ class userdata extends user if ($row = $db->sql_fetchrow($result)) { - return $user->lang['Username_taken']; + return 'USERNAME_TAKEN'; } - + $db->sql_freeresult($result); + $sql = "SELECT disallow_username FROM " . DISALLOW_TABLE; $result = $db->sql_query($sql); while ($row = $db->sql_fetchrow($result)) { - if (preg_match('#\b(' . str_replace('\*', '.*?', preg_quote($row['disallow_username'], '#')) . ')\b#i', $username)) + if (preg_match('#(' . str_replace('\*', '.*?', preg_quote($row['disallow_username'], '#')) . ')#i', $username)) { - return $user->lang['Username_disallowed']; + return 'USERNAME_DISALLOWED'; } } - + $db->sql_freeresult($result); + $sql = "SELECT word FROM " . WORDS_TABLE; $result = $db->sql_query($sql); while ($row = $db->sql_fetchrow($result)) { - if (preg_match('#\b(' . str_replace('\*', '.*?', preg_quote($row['word'], '#')) . ')\b#i', $username)) + if (preg_match('#(' . str_replace('\*', '.*?', preg_quote($row['word'], '#')) . ')#i', $username)) { - return $user->lang['Username_disallowed']; + return 'USERNAME_DISALLOWED'; } } - - // Don't allow " in username. - if (strstr($username, '"')) - { - return $user->lang['Username_invalid']; - } - + $db->sql_freeresult($result); + return false; } @@ -514,9 +481,10 @@ class userdata extends user { if (preg_match('#^' . str_replace('*', '.*?', $row['ban_email']) . '$#is', $email)) { - return $user->lang['Email_banned']; + return 'EMAIL_BANNED'; } } + $db->sql_freeresult($result); $sql = "SELECT user_email FROM " . USERS_TABLE . " @@ -525,14 +493,15 @@ class userdata extends user if ($row = $db->sql_fetchrow($result)) { - return $user->lang['Email_taken']; + return 'EMAIL_TAKEN'; } + $db->sql_freeresult($result); return false; } } - return $user->lang['Email_invalid']; + return 'EMAIL_INVALID'; } } diff --git a/phpBB/language/en/lang_main.php b/phpBB/language/en/lang_main.php index 0a5fa36205..c1691cf4de 100644 --- a/phpBB/language/en/lang_main.php +++ b/phpBB/language/en/lang_main.php @@ -696,11 +696,15 @@ $lang = array( 'Savebox_size' => 'Your Savebox is %d%% full', 'Click_view_privmsg' => 'Click %sHere%s to visit your Inbox', - 'Preferences' => 'Preferences', - 'Items_required' => 'Items marked with a * are required unless stated otherwise', - 'Registration_info' => 'Registration Information', - 'Profile_info' => 'Profile Information', - 'Profile_info_warn' => 'This information will be publicly viewable', + + 'UCP_PREFERENCES' => 'Preferences', + 'UCP_PROFILE' => 'Profile', + 'UCP_LISTS' => 'Buddy/Ignore Lists', + + + 'ITEMS_REQUIRED' => 'Items marked with a * are required unless stated otherwise', + 'PROFILE_INFO_WARN' => 'This information will be publicly viewable', + 'Avatar_panel' => 'Avatar control panel', 'Avatar_gallery' => 'Avatar gallery', 'WEBSITE' => 'Website', @@ -728,19 +732,14 @@ $lang = array( 'Board_style' => 'Board Style', 'DEFAULT_STYLE' => 'Default style', 'No_themes' => 'No Themes In database', - 'Board_lang' => 'Board Language', - 'Timezone' => 'Timezone', + 'Date_format' => 'Date format', 'Date_format_explain' => 'The syntax used is identical to the PHP date() function', - 'SIGNATURE' => 'Signature', - 'Signature_explain' => 'This is a block of text that can be added to posts you make. There is a %d character limit', + 'SIGNATURE' => 'Signature', + 'SIGNATURE_EXPLAIN' => 'This is a block of text that can be added to posts you make. There is a %d character limit', + 'Public_view_email' => 'Always show my Email Address', - 'Current_password' => 'Current password', - 'New_password' => 'New password', - 'Confirm_password' => 'Confirm password', - 'Confirm_password_explain' => 'You must confirm your current password if you wish to change it or alter your email address', - 'password_if_changed' => 'You only need to supply a password if you want to change it', - 'password_confirm_if_changed' => 'You only need to confirm your password if you changed it above', + 'Avatar' => 'Avatar', 'Avatar_explain' => 'Displays a small graphic image below your details in posts. Only one image can be displayed at a time, its width can be no greater than %d pixels, a height no greater than %d pixels and a file size no more than %dkB.', 'Upload_Avatar_file' => 'Upload Avatar from your machine', @@ -757,12 +756,56 @@ $lang = array( 'Select_category' => 'Select category', 'Delete_Image' => 'Delete Image', 'Current_Image' => 'Current Image', + 'Notify_on_privmsg' => 'Notify on new Private Message', 'Popup_on_privmsg' => 'Pop up window on new Private Message', 'Popup_on_privmsg_explain' => 'Some templates may open a new window to inform you when new private messages arrive', 'Hide_user' => 'Hide your online status', + 'Profile_updated' => 'Your profile has been updated', 'Profile_updated_inactive' => 'Your profile has been updated, however you have changed vital details thus your account is now inactive. Check your email to find out how to reactivate your account, or if admin activation is require wait for the administrator to reactivate your account', + + 'Signature_too_long' => 'Your signature is too long', + 'Fields_empty' => 'You must fill in the required fields', + 'Avatar_filetype' => 'The avatar filetype must be .jpg, .gif or .png', + 'Avatar_filesize' => 'The avatar image file size must be less than %d kB', + 'Avatar_imagesize' => 'The avatar must be less than %d pixels wide and %d pixels high', + 'Welcome_subject' => 'Welcome to %s Forums', + 'New_account_subject' => 'New user account', + 'Account_activated_subject' => 'Account Activated', + + 'Account_active' => 'Your account has now been activated. Thank you for registering', + 'Account_active_admin' => 'The account has now been activated', + 'Reactivate' => 'Reactivate your account!', + 'Already_activated' => 'You have already activated your account', + + 'REGISTRATION' => 'Registration', + 'COPPA_BIRTHDAY' => 'To continue with the registration procedure please tell us when you were born.', + 'UCP_COPPA_BEFORE' => 'Before %s', + 'UCP_COPPA_ON_AFTER'=> 'On or After %s', + + 'UCP_AGREEMENT' => 'While the administrators and moderators of this forum will attempt to remove or edit any generally objectionable material as quickly as possible, it is impossible to review every message. Therefore you acknowledge that all posts made to these forums express the views and opinions of the author and not the administrators, moderators or webmaster (except for posts by these people) and hence will not be held liable.

You agree not to post any abusive, obscene, vulgar, slanderous, hateful, threatening, sexually-orientated or any other material that may violate any applicable laws. Doing so may lead to you being immediately and permanently banned (and your service provider being informed). The IP address of all posts is recorded to aid in enforcing these conditions. You agree that the webmaster, administrator and moderators of this forum have the right to remove, edit, move or close any topic at any time should they see fit. As a user you agree to any information you have entered above being stored in a database. While this information will not be disclosed to any third party without your consent the webmaster, administrator and moderators cannot be held responsible for any hacking attempt that may lead to the data being compromised.

This forum system uses cookies to store information on your local computer. These cookies do not contain any of the information you have entered above, they serve only to improve your viewing pleasure. The email address is used only for confirming your registration details and password (and for sending new passwords should you forget your current one).

By clicking Register below you agree to be bound by these conditions.', + 'UCP_EMAIL_ACTIVATE'=> 'Please note that you will need to enter a valid email address before your account is actived. You will recieve an email at the address you provide that contains an account activation link.', + 'UCP_ADMIN_ACTIVATE'=> 'Please note that the administrator of this forum will have to approve your account before it is activated. You will recieve and email once your account has been activated.', + 'NOT_AGREE' => 'I do not agree to these terms', + 'AGREE' => 'I agree to these terms', + + 'CONFIRM_EMAIL' => 'Confirm email address', + 'NEW_PASSWORD' => 'New password', + 'NEW_PASSWORD_EXPLAIN' => 'You only need to supply a password if you want to change it', + 'CURRENT_PASSWORD' => 'Current password', + 'CURRENT_PASSWORD_EXPLAIN' => 'You must confirm your current password if you wish to change it or alter your email address', + 'CONFIRM_PASSWORD' => 'Confirm password', + 'CONFIRM_PASSWORD_EXPLAIN' => 'You only need to confirm your password if you changed it above', + 'LANGUAGE' => 'Language', + 'TIMEZONE' => 'Timezone', + 'CONFIRMATION' => 'Confirmation of registration', + 'CONFIRM_EXPLAIN' => 'To prevent automated registrations the board administrator requires you to enter a confirmation code. The code is displayed in the image you should see below. If you are visually impaired or cannot otherwise read this code please contact the %sBoard Administrator%s.', + 'CONFIRM_CODE' => 'Confirmation code', + 'CONFIRM_CODE_EXPLAIN' => 'Enter the code exactly as you see it in the image', + 'COPPA_COMPLIANCE' => 'COPPA Compliance', + 'COPPA_EXPLAIN' => 'Please note that clicking submit will create your account. However it cannot be activated until a parent or guardian approves your registration. You will be emailed a copy of the necessary form with details of where to send it.', + 'PASSWORD_MISMATCH' => 'The passwords you entered did not match', 'Current_password_mismatch' => 'The current password you supplied does not match that stored in the database', 'Password_long' => 'Your password must be no more than 32 characters', @@ -772,35 +815,13 @@ $lang = array( 'Email_taken' => 'Sorry but that email address is already registered to a user', 'Email_banned' => 'Sorry but this email address has been banned', 'Email_invalid' => 'Sorry but this email address is invalid', - 'Signature_too_long' => 'Your signature is too long', - 'Fields_empty' => 'You must fill in the required fields', - 'Avatar_filetype' => 'The avatar filetype must be .jpg, .gif or .png', - 'Avatar_filesize' => 'The avatar image file size must be less than %d kB', - 'Avatar_imagesize' => 'The avatar must be less than %d pixels wide and %d pixels high', - 'Welcome_subject' => 'Welcome to %s Forums', - 'New_account_subject' => 'New user account', - 'Account_activated_subject' => 'Account Activated', - 'Account_added' => 'Thank you for registering, your account has been created. You may now login with your username and password', - 'Account_inactive' => 'Your account has been created. However, this forum requires account activation, an activation key has been sent to the email address you provided. Please check your email for further information', - 'Account_inactive_admin' => 'Your account has been created. However, this forum requires account activation by the administrator. An email has been sent to them and you will be informed when your account has been activated', - 'Account_active' => 'Your account has now been activated. Thank you for registering', - 'Account_active_admin' => 'The account has now been activated', - 'Reactivate' => 'Reactivate your account!', - 'Already_activated' => 'You have already activated your account', + 'CONFIRM_CODE_WRONG' => 'The confirmation code you entered was incorrect.', - 'COPPA' => 'Your account has been created but has to be approved, please check your email for details.', - 'REGISTRATION' => 'Registration Agreement Terms', - 'REG_AGREEMENT' => 'While the administrators and moderators of this forum will attempt to remove or edit any generally objectionable material as quickly as possible, it is impossible to review every message. Therefore you acknowledge that all posts made to these forums express the views and opinions of the author and not the administrators, moderators or webmaster (except for posts by these people) and hence will not be held liable.

You agree not to post any abusive, obscene, vulgar, slanderous, hateful, threatening, sexually-orientated or any other material that may violate any applicable laws. Doing so may lead to you being immediately and permanently banned (and your service provider being informed). The IP address of all posts is recorded to aid in enforcing these conditions. You agree that the webmaster, administrator and moderators of this forum have the right to remove, edit, move or close any topic at any time should they see fit. As a user you agree to any information you have entered above being stored in a database. While this information will not be disclosed to any third party without your consent the webmaster, administrator and moderators cannot be held responsible for any hacking attempt that may lead to the data being compromised.

This forum system uses cookies to store information on your local computer. These cookies do not contain any of the information you have entered above, they serve only to improve your viewing pleasure. The email address is used only for confirming your registration details and password (and for sending new passwords should you forget your current one).

By clicking Register below you agree to be bound by these conditions.', - 'REG_EMAIL_ACTIVATION' => 'Please note that you will need to enter a valid email address before your account is actived. You will recieve an email at the address you provide that contains an account activation link.', - 'REG_ADMIN_ACTIVATION' => 'Please note that the administrator of this forum will have to approve your account before it is activated. You will recieve and email once your account has been activated.', - 'AGREE_UNDER_13' => 'I Agree to these terms and am under 13 years of age', - 'AGREE_OVER_13' => 'I Agree to these terms and am over 13 years of age', - 'AGREE_NOT' => 'I do not agree to these terms', - 'AGREE' => 'I agree to these terms', - 'CONFIRM_CODE' => 'Confirmation code', - 'CONFIRM_CODE_EXPLAIN' => 'Enter the code exactly as you see it in the image', + 'ACCOUNT_ADDED' => 'Thank you for registering, your account has been created. You may now login with your username and password', + 'ACCOUNT_INACTIVE' => 'Your account has been created. However, this forum requires account activation, an activation key has been sent to the email address you provided. Please check your email for further information', + 'ACCOUNT_INACTIVE_ADMIN'=> 'Your account has been created. However, this forum requires account activation by the administrator. An email has been sent to them and you will be informed when your account has been activated', + 'ACCOUNT_COPPA' => 'Your account has been created but has to be approved, please check your email for details.', - 'Wrong_activation' => 'The activation key you supplied does not match any in the database', 'Send_password' => 'Send me a new password', 'Password_updated' => 'A new password has been created, please check your email for details on how to activate it', @@ -808,6 +829,8 @@ $lang = array( 'New_password_activation' => 'New password activation', 'Password_activated' => 'Your account has been re-activated. To logon please use the password supplied in the email you received', + 'COPPA' => 'Your account has been created but has to be approved, please check your email for details.', + 'FIND_USERNAME' => 'Find a member', 'FIND_USERNAME_EXPLAIN' => 'Use this form to search for specific members. You do not need to fill out all fields. To match partial data use * as a wildcard. When entering dates use the format yyyy-mm-dd, e.g. 2002-01-01. Use the mark checkboxes to select one or more usernames (several usernames may be accepted depending on the form itself). Alternatively you can mark the users required and click the Insert Marked button.', diff --git a/phpBB/templates/subSilver/ucp_agreement.html b/phpBB/templates/subSilver/ucp_agreement.html new file mode 100644 index 0000000000..e5d15257cc --- /dev/null +++ b/phpBB/templates/subSilver/ucp_agreement.html @@ -0,0 +1,33 @@ + + + + +
+ + + +
+ + + + + + + + +
{SITENAME} - {REGISTRATION}
+ + + + + + + +

{L_COPPA_BIRTHDAY}

{L_COPPA_NO} :: {L_COPPA_YES}


{L_AGREEMENT}

+
+

+ +
+
+ + \ No newline at end of file diff --git a/phpBB/templates/subSilver/ucp_footer.html b/phpBB/templates/subSilver/ucp_footer.html new file mode 100644 index 0000000000..9edca2974e --- /dev/null +++ b/phpBB/templates/subSilver/ucp_footer.html @@ -0,0 +1,10 @@ + + + + + + +
{S_TIMEZONE}

+ + + \ No newline at end of file diff --git a/phpBB/templates/subSilver/ucp_header.html b/phpBB/templates/subSilver/ucp_header.html new file mode 100644 index 0000000000..9cfcb4705e --- /dev/null +++ b/phpBB/templates/subSilver/ucp_header.html @@ -0,0 +1,25 @@ + + + +
+ + + +
+ + + + + + + + +
{ucp_sections.SECTION} + + {ucp_sections.SECTION} + +
+ +
+ + \ No newline at end of file diff --git a/phpBB/templates/subSilver/ucp_main.html b/phpBB/templates/subSilver/ucp_main.html new file mode 100644 index 0000000000..2c06042922 --- /dev/null +++ b/phpBB/templates/subSilver/ucp_main.html @@ -0,0 +1,75 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/phpBB/templates/subSilver/ucp_prefs.html b/phpBB/templates/subSilver/ucp_prefs.html new file mode 100644 index 0000000000..71344e320d --- /dev/null +++ b/phpBB/templates/subSilver/ucp_prefs.html @@ -0,0 +1,137 @@ + + + + + + + + + + \ No newline at end of file diff --git a/phpBB/templates/subSilver/ucp_profile.html b/phpBB/templates/subSilver/ucp_profile.html new file mode 100644 index 0000000000..031a615c96 --- /dev/null +++ b/phpBB/templates/subSilver/ucp_profile.html @@ -0,0 +1,156 @@ + + + + + + + + + + \ No newline at end of file diff --git a/phpBB/templates/subSilver/ucp_register.html b/phpBB/templates/subSilver/ucp_register.html new file mode 100644 index 0000000000..569b9b43ff --- /dev/null +++ b/phpBB/templates/subSilver/ucp_register.html @@ -0,0 +1,87 @@ + + + + +
{L_UCP}
+ + + + + + + + + + + +
{L_SUBSCRIBED_TOPICS}
{subscribed_topics.TOPIC_FOLDER_IMG}{subscribed_topics.NEWEST_POST_IMG}{subscribed_topics.TOPIC_TITLE}{subscribed_topics.UNSUBSCRIBE_IMG}
+
+ + + + + + + + + + + +
{L_SUBSCRIBED_FORUMS}
{subscribed_forums.FORUM_FOLDER_IMG}{subscribed_forums.NEWEST_FORUM_POST_IMG}{subscribed_forums.FORUM_NAME}{subscribed_forums.UNSUBSCRIBE_IMG}
+
+ + + + + + + +
{L_WELCOME_USERCP}
{UCP_WELCOME_MSG}
+
+ + + + + + + + + + + + +
{L_BUDDY_LIST}
{buddy_list.ONLINE_IMG}{buddy_list.BUDDY}{L_PM}{buddy_list.REMOVE_BUDDY}
+
+ + + + + + + + + + + +
{L_UNREAD_PM} +
{pm.NEW_PM_IMG}{pm.PM_TITLE}{pm.PM_SENDER}{pm.DELETE_PM_IMG}
+
+ + + + + + + + + +
Options
{ucp_subsection.L_TITLE} + + {ucp_subsection.L_TITLE} + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
{L_TITLE}
{ERROR}
{L_PUBLIC_VIEW_EMAIL}: + + {L_YES}   + + {L_NO}
{L_HIDE_USER}: + + {L_YES}   + + {L_NO}
{L_NOTIFY_ON_REPLY}:
+ {L_NOTIFY_ON_REPLY_EXPLAIN}
+ + {L_YES}   + + {L_NO}
{L_NOTIFY_ON_PRIVMSG}: + + {L_YES}   + + {L_NO}
{L_POPUP_ON_PRIVMSG}:
{L_POPUP_ON_PRIVMSG_EXPLAIN}
+ + {L_YES}   + + {L_NO}
{L_BOARD_LANGUAGE}:
{L_BOARD_STYLE}:
{L_TIMEZONE}:
{L_DATE_FORMAT}:
+ {L_DATE_FORMAT_EXPLAIN}
+ +
{L_ALWAYS_ADD_SIGNATURE}: + + {L_YES}   + + {L_NO}
{L_ALWAYS_ALLOW_BBCODE}: + + {L_YES}   + + {L_NO}
{L_ALWAYS_ALLOW_HTML}: + + {L_YES}   + + {L_NO}
{L_ALWAYS_ALLOW_SMILIES}: + + {L_YES}   + + {L_NO}
{S_HIDDEN_FIELDS}  
+ + + + + + + + + +
Options
{ucp_subsection.L_TITLE} + + {ucp_subsection.L_TITLE} + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
{L_TITLE}
{ERROR}
{L_USERNAME}: {USERNAME}
{L_EMAIL_ADDRESS}:
{L_CURRENT_PASSWORD}:
+ {L_CURRENT_PASSWORD_EXPLAIN}
+ +
{L_NEW_PASSWORD}:
+ {L_NEW_PASSWORD_EXPLAIN}
+ +
{L_CONFIRM_PASSWORD}:
+ {L_CONFIRM_PASSWORD_EXPLAIN}
+ +
{L_PROFILE_INFO_NOTICE}
{L_ICQ}:
{L_AIM}:
{L_MSNM}:
{L_YIM}:
{L_WEBSITE}:
{L_LOCATION}:
{L_OCCUPATION}:
{L_INTERESTS}:
{L_SIGNATURE}:
{L_SIGNATURE_EXPLAIN}

{HTML_STATUS}
{BBCODE_STATUS}
{SMILIES_STATUS}
 
{L_AVATAR_PANEL}
+ + + + +
{L_AVATAR_EXPLAIN}{L_CURRENT_IMAGE}
{AVATAR}
 {L_DELETE_AVATAR}
{L_UPLOAD_AVATAR_FILE}:
{L_UPLOAD_AVATAR_URL}:
{L_UPLOAD_AVATAR_URL_EXPLAIN}
{L_LINK_REMOTE_AVATAR}:
{L_LINK_REMOTE_AVATAR_EXPLAIN}
{L_AVATAR_GALLERY}:
{S_HIDDEN_FIELDS}  
+ + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
{L_REGISTRATION}
{ERROR}
{L_ITEMS_REQUIRED}
{L_USERNAME}:
{L_EMAIL_ADDRESS}:
{L_CONFIRM_EMAIL}:
{L_PASSWORD}:
{L_CONFIRM_PASSWORD}:
{L_LANGUAGE}:
{L_TIMEZONE}:
{L_CONFIRMATION}
{L_CONFIRM_EXPLAIN}
{CONFIRM_IMG}
{L_CONFIRM_CODE}:
{L_CONFIRM_CODE_EXPLAIN}
{L_COPPA_COMPLIANCE}
{L_COPPA_EXPLAIN}
{S_HIDDEN_FIELDS}  
+ + \ No newline at end of file diff --git a/phpBB/ucp.php b/phpBB/ucp.php index 476fd8f55b..ecaead201c 100755 --- a/phpBB/ucp.php +++ b/phpBB/ucp.php @@ -23,7 +23,6 @@ // TODO for 2.2: // // * Registration -// * Admin defineable use of COPPA // * Link to (additional?) registration conditions // * Form based click through rather than links // * Inform user of registration method i.e. if a valid email is required @@ -89,7 +88,9 @@ if (!empty($_REQUEST['mode'])) { redirect("index.$phpEx$SID"); } - include($phpbb_root_path . 'ucp/usercp_register.'.$phpEx); + + include($phpbb_root_path . 'ucp/ucp_register.'.$phpEx); + ucp_register::main(); break; case 'login': @@ -127,34 +128,49 @@ $censors = array(); obtain_word_list($censors); +$selected_module = (!empty($_REQUEST['module_id'])) ? $_REQUEST['module_id'] : ''; + // "Home" module $template->assign_block_vars('ucp_sections', array( 'U_SECTION' => "ucp.$phpEx$SID", - 'SECTION' => $user->lang['UCP_Main']) + 'SECTION' => $user->lang['UCP_Main'], + 'S_IS_TAB' => (!$selected_module) ? true : false) ); + + // Grab the other enabled UCP modules -$selected_module = (!empty($_REQUEST['module_id'])) ? $_REQUEST['module_id'] : ''; $sql = "SELECT module_id, module_name, module_filename FROM " . UCP_MODULES_TABLE . " - ORDER BY module_order"; + ORDER BY module_order ASC"; $result = $db->sql_query($sql); +$selected_module_name = ''; while ($row = $db->sql_fetchrow($result)) { $template->assign_block_vars('ucp_sections', array( + 'SECTION' => $user->lang['UCP_' . $row['module_name']], + 'U_SECTION' => "ucp.$phpEx$SID&module_id=" . $row['module_id'], - 'SECTION' => $row['module_name']) + + 'S_IS_TAB' => ($row['module_id'] == $selected_module) ? true : false) ); if ($row['module_id'] == $selected_module) { - $module_to_include = $row['module_filename'] . '.' . $phpEx; - include($phpbb_root_path . $module_to_include); + $selected_module_name = $row['module_filename']; + $selected_module_id = $row['module_id']; } } $db->sql_freeresult($result); +if ($selected_module_name) +{ + include($phpbb_root_path . 'ucp/' . $selected_module_name . '.' . $phpEx); + eval($selected_module_name . '::main(' . $selected_module_id . ');'); +} + + // Subscribed Topics $sql = "SELECT tw.topic_id, t.topic_title, t.topic_last_post_time, t.poll_start, t.topic_replies, t.topic_type, t.forum_id @@ -210,19 +226,21 @@ while ($row = $db->sql_fetchrow($result)) $unread_topic = true; } + + + + + + $newest_post_img = ($unread_topic) ? '' . $user->img('goto_post_newest', 'View_newest_post') . ' ' : ''; $folder_img = ($unread_topic) ? $folder_new : $folder; $folder_alt = ($unread_topic) ? 'New_posts' : (($row['topic_status'] == ITEM_LOCKED) ? 'Topic_locked' : 'No_new_posts'); $view_topic_url = 'viewtopic.' . $phpEx . $SID . '&f=' . $forum_id . '&t=' . $topic_id; - // Needs to be handled within this code rather than going out of UCP - $unsubscribe_img = '' . $user->img('icon_delete', 'Stop_watching_topic', FALSE) . ''; - $template->assign_block_vars('subscribed_topics', array( 'TOPIC_FOLDER_IMG' => $user->img($folder_img, $folder_alt), 'NEWEST_POST_IMG' => $newest_post_img, - 'UNSUBSCRIBE_IMG' => $unsubscribe_img, 'TOPIC_TITLE' => (!empty($censors)) ? preg_replace($censors['match'], $censors['replace'], $row['topic_title']) : $row['topic_title'], @@ -268,13 +286,10 @@ while ($row = $db->sql_fetchrow($result)) $last_post = '' . $user->img('goto_post_latest', 'View_latest_post') . ''; - // Needs to be handled within this code rather than going out of UCP - $unsubscribe_img = '' . $user->img('icon_delete', 'Stop_watching_forum', FALSE) . ''; $template->assign_block_vars('subscribed_forums', array( 'FORUM_FOLDER_IMG' => $user->img($folder_image, $folder_alt), 'NEWEST_FORUM_POST_IMG' => $last_post, - 'UNSUBSCRIBE_IMG' => $unsubscribe_img, 'FORUM_NAME' => $row['forum_name'], @@ -299,9 +314,79 @@ $db->sql_freeresult($result); page_header($user->lang['UCP'] . ' - ' . $this_section); $template->set_filenames(array( - 'body' => 'usercp_main.html') + 'body' => 'ucp_main.html') ); +make_jumpbox('viewforum.'.$phpEx); page_footer(); + +// A wrapper class for ucp modules? +class ucp +{ + function main($module_id) + { + return false; + } + + function extra_fields($page) + { + return false; + } + + function gen_rand_string($num_chars) + { + $chars = array('A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', '1', '2', '3', '4', '5', '6', '7', '8', '9'); + + list($usec, $sec) = explode(' ', microtime()); + mt_srand($sec * $usec); + + $max_chars = count($chars) - 1; + $rand_str = ''; + for ($i = 0; $i < $num_chars; $i++) + { + $rand_str .= $chars[mt_rand(0, $max_chars)]; + } + + return $rand_str; + } + + function load($filename) + { + global $phpbb_root_path, $phpEx; + + require($phpbb_root_path . $filename . '.' . $phpEx); + } + + function subsection(&$module_ary, &$selected_module) + { + global $template, $user, $phpEx, $SID; + + foreach($module_ary as $section_title => $module_link) + { + $template->assign_block_vars('ucp_subsection', array( + 'L_TITLE' => $user->lang['UCP_' . $section_title], + + 'S_SELECTED'=> ($section_title == strtoupper($selected_module)) ? true : false, + + 'U_TITLE' => "ucp.$phpEx$SID&$module_link") + ); + } + } + + function output(&$page_title, $tpl_name) + { + global $config, $db, $template, $phpEx; + + page_header($page_title); + + $template->set_filenames(array( + 'body' => $tpl_name) + ); + make_jumpbox('viewforum.'.$phpEx); + + page_footer(); + } +} + ?> \ No newline at end of file diff --git a/phpBB/ucp/ucp_prefs.php b/phpBB/ucp/ucp_prefs.php new file mode 100644 index 0000000000..97d38dede8 --- /dev/null +++ b/phpBB/ucp/ucp_prefs.php @@ -0,0 +1,70 @@ +lang = array_merge($user->lang, array( + 'UCP_PERSONAL' => 'Personal Settings', + 'UCP_VIEW' => 'Viewing Posts', + 'UCP_POST' => 'Posting Messages') + ); + + ucp::subsection($submodules, $submode); + unset($submodules); + + switch($submode) + { + case 'view': + break; + + case 'post': + break; + + default: + break; + } + + $template->assign_vars(array( + 'L_TITLE' => $user->lang['UCP_' . strtoupper($submode)], + + 'S_DISPLAY_' . strtoupper($submode) => true, + 'S_HIDDEN_FIELDS' => $s_hidden_fields, + 'S_UCP_ACTION' => "ucp.$phpEx$SID&module_id=$module_id&mode=$submode") + ); + + ucp::output($user->lang['UCP_PROFILE'], 'ucp_prefs.html'); + } +} + +?> \ No newline at end of file diff --git a/phpBB/ucp/ucp_profile.php b/phpBB/ucp/ucp_profile.php new file mode 100644 index 0000000000..600ea6727e --- /dev/null +++ b/phpBB/ucp/ucp_profile.php @@ -0,0 +1,86 @@ +lang = array_merge($user->lang, array( + 'UCP_REG_DETAILS' => 'Registration details', + 'UCP_PROFILE' => 'Your Profile', + 'UCP_SIGNATURE' => 'Your signature', + 'UCP_AVATAR' => 'Your avatar') + ); + + ucp::subsection($submodules, $submode); + unset($submodules); + + switch ($submode) + { + case 'reg_details': + $template->assign_vars(array( + 'USERNAME' => $user->data['username'], + + 'S_CHANGE_USERNAME' => $auth->acl_get('u_chgname'), ) + ); + break; + + case 'profile': + break; + + case 'signature': + $template->assign_vars(array( + 'SIGNATURE' => $user->data['signature']) + ); + break; + + case 'avatar': + break; + + default: + break; + } + + $template->assign_vars(array( + 'L_TITLE' => $user->lang['UCP_' . strtoupper($submode)], + + 'S_DISPLAY_' . strtoupper($submode) => true, + 'S_HIDDEN_FIELDS' => $s_hidden_fields, + 'S_UCP_ACTION' => "ucp.$phpEx$SID&module_id=$module_id&mode=$submode") + ); + + ucp::output($user->lang['UCP_PROFILE'], 'ucp_profile.html'); + } +} + +?> \ No newline at end of file diff --git a/phpBB/ucp/ucp_register.php b/phpBB/ucp/ucp_register.php index 5d523c9561..ad7295492a 100644 --- a/phpBB/ucp/ucp_register.php +++ b/phpBB/ucp/ucp_register.php @@ -19,59 +19,129 @@ * ***************************************************************************/ -if (!defined('IN_PHPBB')) +class ucp_register extends ucp { - die('Hacking attempt'); - exit; -} - - - - - -// -if ($mode == 'register' && $config['require_activation'] == USER_ACTIVATION_DISABLE) -{ - trigger_error($user->lang['UCP_REGISTER_DISABLE']); -} - - - - - - - -$coppa = (isset($_REQUEST['coppa'])) ? ((!empty($_REQUEST['coppa'])) ? 1 : 0) : false; -$agreed = (!empty($_POST['agreed'])) ? 1 : 0; -$lang = (isset($_POST['lang'])) ? htmlspecialchars($_POST['lang']) : ''; -$tz = (isset($_POST['tz'])) ? intval($_POST['tz']) : $config['board_timezone']; - -$error = array(); - - - - -if (!$agreed) -{ - if ($coppa === false && $config['coppa_enable']) + function main() { - $now = getdate(); - $coppa_birthday = $user->format_date(mktime($now['hours'] + $user->data['user_dst'], $now['minutes'], $now['seconds'], $now['mon'], $now['mday'] - 1, $now['year'] - 13), $user->lang['DATE_FORMAT']); - unset($now); + global $config, $db, $user, $SID, $template, $phpEx; - $template->assign_vars(array( - 'L_COPPA_NO' => sprintf($user->lang['UCP_COPPA_BEFORE'], $coppa_birthday), - 'L_COPPA_YES' => sprintf($user->lang['UCP_COPPA_ON_AFTER'], $coppa_birthday), + // + if ($config['require_activation'] == USER_ACTIVATION_DISABLE) + { + trigger_error($user->lang['UCP_REGISTER_DISABLE']); + } - 'U_COPPA_NO' => "ucp.$phpEx$SID&mode=register&coppa=0", - 'U_COPPA_YES' => "ucp.$phpEx$SID&mode=register&coppa=1", + $coppa = (isset($_REQUEST['coppa'])) ? ((!empty($_REQUEST['coppa'])) ? 1 : 0) : false; + $agreed = (!empty($_POST['agreed'])) ? 1 : 0; - 'S_SHOW_COPPA' => true, - 'S_REGISTER_ACTION' => "ucp.$phpEx$SID&mode=register") - ); - } - else - { + // + if (!$agreed) + { + if ($coppa === false && $config['coppa_enable']) + { + $now = getdate(); + $coppa_birthday = $user->format_date(mktime($now['hours'] + $user->data['user_dst'], $now['minutes'], $now['seconds'], $now['mon'], $now['mday'] - 1, $now['year'] - 13), $user->lang['DATE_FORMAT']); + unset($now); + + $template->assign_vars(array( + 'L_COPPA_NO' => sprintf($user->lang['UCP_COPPA_BEFORE'], $coppa_birthday), + 'L_COPPA_YES' => sprintf($user->lang['UCP_COPPA_ON_AFTER'], $coppa_birthday), + + 'U_COPPA_NO' => "ucp.$phpEx$SID&mode=register&coppa=0", + 'U_COPPA_YES' => "ucp.$phpEx$SID&mode=register&coppa=1", + + 'S_SHOW_COPPA' => true, + 'S_REGISTER_ACTION' => "ucp.$phpEx$SID&mode=register") + ); + } + else + { + $template->assign_vars(array( + 'L_AGREEMENT' => $user->lang['UCP_AGREEMENT'], + + 'S_SHOW_COPPA' => false, + 'S_REGISTER_ACTION' => "ucp.$phpEx$SID&mode=register") + ); + } + + ucp::output($user->lang['REGISTER'], 'ucp_agreement.html'); + } + + // Check and initialize some variables if needed + $error = array(); + if (isset($_POST['submit'])) + { + // Load the userdata manipulation methods + ucp::load('includes/functions_user'); + $userdata = new userdata(); + + if ($message = $userdata->add_user($coppa)) + { + $message = $message . '

' . sprintf($user->lang['RETURN_INDEX'], "", ''); + trigger_error($message); + } + } + + // If an error occured we need to stripslashes on returned data + $username = (isset($_POST['username'])) ? stripslashes(htmlspecialchars($_POST['username'])) : ''; + $password = (isset($_POST['new_password'])) ? stripslashes(htmlspecialchars($_POST['new_password'])) : ''; + $password_confirm = (isset($_POST['password_confirm'])) ? stripslashes(htmlspecialchars($_POST['password_confirm'])) : ''; + $email = (isset($_POST['email'])) ? stripslashes(htmlspecialchars($_POST['email'])) : ''; + $email_confirm = (isset($_POST['email_confirm'])) ? stripslashes(htmlspecialchars($_POST['email_confirm'])) : ''; + $lang = (isset($_POST['lang'])) ? htmlspecialchars($_POST['lang']) : ''; + $tz = (isset($_POST['tz'])) ? intval($_POST['tz']) : $config['board_timezone']; + + $s_hidden_fields = ''; + + // Visual Confirmation - Show images + $confirm_image = ''; + if (!empty($config['enable_confirm'])) + { + $sql = "SELECT session_id + FROM " . SESSIONS_TABLE; + $result = $db->sql_query($sql); + + if ($row = $db->sql_fetchrow($result)) + { + $confirm_sql = ''; + do + { + $confirm_sql .= (($confirm_sql != '') ? ', ' : '') . "'" . $row['session_id'] . "'"; + } + while ($row = $db->sql_fetchrow($result)); + + $sql = "DELETE FROM " . CONFIRM_TABLE . " + WHERE session_id NOT IN ($confirm_sql)"; + $db->sql_query($sql); + } + $db->sql_freeresult($result); + + $sql = "SELECT COUNT(session_id) AS attempts + FROM " . CONFIRM_TABLE . " + WHERE session_id = '" . $userdata['session_id'] . "'"; + $result = $db->sql_query($sql); + + if ($row = $db->sql_fetchrow($result)) + { + if ($row['attempts'] > 5) + { + trigger_error($user->lang['Too_many_registers']); + } + } + $db->sql_freeresult($result); + + $code = ucp::gen_rand_string(6); + $confirm_id = md5(uniqid($user_ip)); + + $sql = "INSERT INTO " . CONFIRM_TABLE . " (confirm_id, session_id, code) + VALUES ('$confirm_id', '" . $user->data['session_id'] . "', '$code')"; + $db->sql_query($sql); + + $confirm_image = (@extension_loaded('zlib')) ? "\"\"" : ''; + $s_hidden_fields .= ''; + } + + // $l_reg_cond = ''; switch ($config['require_activation']) { @@ -84,170 +154,30 @@ if (!$agreed) break; } + // $template->assign_vars(array( - 'L_AGREEMENT' => $user->lang['UCP_AGREEMENT'], - 'L_REG_CONDITIONS' => $l_reg_cond, + 'USERNAME' => $username, + 'PASSWORD' => $password, + 'PASSWORD_CONFIRM' => $password_confirm, + 'EMAIL' => $email, + 'EMAIL_CONFIRM' => $email, + 'CONFIRM_IMG' => $confirm_image, + 'ERROR' => (sizeof($userdata->error)) ? implode('
', $userdata->error) : '', - 'S_SHOW_COPPA' => false, - 'S_REGISTER_ACTION' => "ucp.$phpEx$SID&mode=register") + 'L_CONFIRM_EXPLAIN' => sprintf($user->lang['CONFIRM_EXPLAIN'], '', ''), + 'L_ITEMS_REQUIRED' => $l_reg_cond, + + 'S_LANG_OPTIONS' => language_select($lang), + 'S_TZ_OPTIONS' => tz_select($tz), + 'S_CONFIRM_CODE' => ($config['enable_confirm']) ? true : false, + 'S_COPPA' => $coppa, + 'S_HIDDEN_FIELDS' => $s_hidden_fields, + 'S_UCP_ACTION' => "ucp.$phpEx$SID&mode=register") ); - } - page_header($user->lang['REGISTER']); - - $template->set_filenames(array( - 'body' => 'ucp_agreement.html') - ); - make_jumpbox('viewforum.'.$phpEx); - - page_footer(); - -} -else -{ - $agreed = TRUE; -} - - - - - - -// Check and initialize some variables if needed -if (isset($_POST['submit'])) -{ - // Load the userdata manipulation methods - require($phpbb_root_path . 'includes/functions_user.'.$phpEx); - $userdata = new userdata(); - - if($message = $userdata->add_new_user($coppa)) - { - $message = $message . '

' . sprintf($user->lang['RETURN_INDEX'], "", ''); - trigger_error($message); + // + ucp::output($user->lang['REGISTER'], 'ucp_register.html'); } } -// End of submit - - - - - - -if (sizeof($userdata->error)) -{ - // If an error occured we need to stripslashes on returned data - $username = stripslashes($username); - $password = stripslashes($password); - $password_confirm = stripslashes($password_confirm); - $email = stripslashes($email); - $email_confirm = stripslashes($email_confirm); -} - - - - - - // Visual Confirmation - Show images - $confirm_image = ''; - if (!empty($config['enable_confirm'])) - { - $sql = "SELECT session_id - FROM " . SESSIONS_TABLE; - $result = $db->sql_query($sql); - - if ($row = $db->sql_fetchrow($result)) - { - $confirm_sql = ''; - do - { - $confirm_sql .= (($confirm_sql != '') ? ', ' : '') . "'" . $row['session_id'] . "'"; - } - while ($row = $db->sql_fetchrow($result)); - - $sql = "DELETE FROM " . CONFIRM_TABLE . " - WHERE session_id NOT IN ($confirm_sql)"; - $db->sql_query($sql); - } - $db->sql_freeresult($result); - - $sql = "SELECT COUNT(session_id) AS attempts - FROM " . CONFIRM_TABLE . " - WHERE session_id = '" . $userdata['session_id'] . "'"; - $result = $db->sql_query($sql); - - if ($row = $db->sql_fetchrow($result)) - { - if ($row['attempts'] > 5) - { - trigger_error($user->lang['Too_many_registers']); - } - } - $db->sql_freeresult($result); - - $code = gen_png_string(6); - $confirm_id = md5(uniqid($user_ip)); - - $sql = "INSERT INTO " . CONFIRM_TABLE . " (confirm_id, session_id, code) - VALUES ('$confirm_id', '" . $user->data['session_id'] . "', '$code')"; - $db->sql_query($sql); - - $confirm_image = (@extension_loaded('zlib')) ? '' : ''; - $s_hidden_fields .= ''; - } - // End visual confirmation - - - $template->assign_vars(array( - 'USERNAME' => $username, - 'PASSWORD' => $password, - 'PASSWORD_CONFIRM' => $password_confirm, - 'EMAIL' => $email, - 'EMAIL_CONFIRM' => $email, - 'CONFIRM_IMG' => $confirm_image, - 'ERROR' => (sizeof($userdata->error)) ? implode('
', $userdata->error) : '', - - 'L_CONFIRM_EXPLAIN' => sprintf($user->lang['CONFIRM_EXPLAIN'], '', ''), - - 'S_LANG_OPTIONS' => language_select($lang), - 'S_TZ_OPTIONS' => tz_select($tz), - 'S_CONFIRM_CODE' => ($config['enable_confirm']) ? 1 : 0, - 'S_COPPA' => $coppa, - 'S_HIDDEN_FIELDS' => '', - 'S_FORM_ENCTYPE' => $form_enctype, - 'S_PROFILE_ACTION' => "ucp.$phpEx$SID&mode=register") - ); - - - -// -page_header($user->lang['REGISTER']); - -$template->set_filenames(array( - 'body' => 'ucp_register.html') -); -make_jumpbox('viewforum.'.$phpEx); - -page_footer(); - - - - -function gen_png_string($num_chars) -{ - $chars = array('A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', '1', '2', '3', '4', '5', '6', '7', '8', '9'); - - list($usec, $sec) = explode(' ', microtime()); - mt_srand($sec * $usec); - - $max_chars = count($chars) - 1; - $rand_str = ''; - for ($i = 0; $i < $num_chars; $i++) - { - $rand_str .= $chars[mt_rand(0, $max_chars)]; - } - - return $rand_str; -} - ?> \ No newline at end of file diff --git a/phpBB/ucp/ucp_zebra.php b/phpBB/ucp/ucp_zebra.php new file mode 100644 index 0000000000..b5a4051390 --- /dev/null +++ b/phpBB/ucp/ucp_zebra.php @@ -0,0 +1,33 @@ + \ No newline at end of file