diff -r 35ed07abc99e -r 2220bab5c784 plugins/SpecialUserPrefs.php --- a/plugins/SpecialUserPrefs.php Mon Jan 21 11:05:16 2008 -0500 +++ b/plugins/SpecialUserPrefs.php Mon Jan 21 15:38:50 2008 -0500 @@ -67,17 +67,28 @@ { global $userprefs_menu; global $userprefs_menu_links; + global $lang; $html = ''; $quot = '"'; foreach ( $userprefs_menu as $section => $buttons ) { - $html .= ( isset($userprefs_menu_links[$section]) ) ? "{$section}\n " : "{$section}\n "; + $section_name = $section; + if ( preg_match('/^[a-z]+_[a-z_]+$/', $section) ) + { + $section_name = $lang->get($section_name); + } + $html .= ( isset($userprefs_menu_links[$section]) ) ? "{$section_name}\n " : "{$section_name}\n "; $html .= "\n "; } @@ -100,20 +111,22 @@ global $db, $session, $paths, $template, $plugins; // Common objects global $userprefs_menu_links; - userprefs_menu_add('Profile/membership', 'Edit e-mail address and password', makeUrlNS('Special', 'Preferences/EmailPassword') . '" onclick="ajaxLoginNavTo(\'Special\', \'Preferences/EmailPassword\', '.USER_LEVEL_CHPREF.'); return false;'); - userprefs_menu_add('Profile/membership', 'Edit signature', makeUrlNS('Special', 'Preferences/Signature')); - userprefs_menu_add('Profile/membership', 'Edit public profile', makeUrlNS('Special', 'Preferences/Profile')); - userprefs_menu_add('Profile/membership', 'Group memberships', makeUrlNS('Special', 'Usergroups')); + userprefs_menu_add('usercp_sec_profile', 'usercp_sec_profile_emailpassword', makeUrlNS('Special', 'Preferences/EmailPassword') . '" onclick="ajaxLoginNavTo(\'Special\', \'Preferences/EmailPassword\', '.USER_LEVEL_CHPREF.'); return false;'); + userprefs_menu_add('usercp_sec_profile', 'usercp_sec_profile_signature', makeUrlNS('Special', 'Preferences/Signature')); + userprefs_menu_add('usercp_sec_profile', 'usercp_sec_profile_publicinfo', makeUrlNS('Special', 'Preferences/Profile')); + userprefs_menu_add('usercp_sec_profile', 'usercp_sec_profile_usergroups', makeUrlNS('Special', 'Usergroups')); if ( getConfig('avatar_enable') == '1' ) { - userprefs_menu_add('Profile/membership', 'Avatar settings', makeUrlNS('Special', 'Preferences/Avatar')); + userprefs_menu_add('usercp_sec_profile', 'usercp_sec_profile_avatar', makeUrlNS('Special', 'Preferences/Avatar')); } - userprefs_menu_add('Private messages', 'Inbox', makeUrlNS('Special', 'PrivateMessages/Folder/Inbox')); - userprefs_menu_add('Private messages', 'Outbox', makeUrlNS('Special', 'PrivateMessages/Folder/Outbox')); - userprefs_menu_add('Private messages', 'Sent items', makeUrlNS('Special', 'PrivateMessages/Folder/Sent')); - userprefs_menu_add('Private messages', 'Drafts', makeUrlNS('Special', 'PrivateMessages/Folder/Drafts')); - userprefs_menu_add('Private messages', 'Archive', makeUrlNS('Special', 'PrivateMessages/Folder/Archive')); + userprefs_menu_add('usercp_sec_pm', 'usercp_sec_pm_inbox', makeUrlNS('Special', 'PrivateMessages/Folder/Inbox')); + userprefs_menu_add('usercp_sec_pm', 'usercp_sec_pm_outbox', makeUrlNS('Special', 'PrivateMessages/Folder/Outbox')); + userprefs_menu_add('usercp_sec_pm', 'usercp_sec_pm_sent', makeUrlNS('Special', 'PrivateMessages/Folder/Sent')); + userprefs_menu_add('usercp_sec_pm', 'usercp_sec_pm_drafts', makeUrlNS('Special', 'PrivateMessages/Folder/Drafts')); + userprefs_menu_add('usercp_sec_pm', 'usercp_sec_pm_archive', makeUrlNS('Special', 'PrivateMessages/Folder/Archive')); + /* + // Reserved for Enano's Next Big Innovation.(TM) userprefs_menu_add('Private messages', 'Inbox', makeUrlNS('Special', 'Private_Messages#folder:inbox')); userprefs_menu_add('Private messages', 'Starred', makeUrlNS('Special', 'Private_Messages#folder:starred')); userprefs_menu_add('Private messages', 'Sent items', makeUrlNS('Special', 'Private_Messages#folder:sent')); @@ -185,7 +198,7 @@ case 'foo': if ( $_POST['newemail'] != $_POST['newemail_conf'] ) { - $errors .= '
The e-mail addresses you entered did not match.
'; + $errors .= '
' . $lang->get('usercp_emailpassword_err_email_no_match') . '
'; break; } } @@ -201,9 +214,9 @@ $result = $session->update_user($session->user_id, false, $old_pass, false, $new_email); if ( $result != 'success' ) { - $message = '

The following errors were encountered while saving your e-mail address:

'; + $message = '

' . $lang->get('usercp_emailpassword_err_list') . '

'; $message .= ''; - die_friendly('Error updating e-mail address', $message); + die_friendly($lang->get('usercp_emailpassword_err_title'), $message); } $email_changed = true; } @@ -227,16 +240,15 @@ if ( strlen($newpass) > 0 ) { if ( defined('ENANO_DEMO_MODE') ) - $errors .= '
You can\'t change your password in demo mode.
'; + $errors .= '
' . $lang->get('usercp_emailpassword_err_demo') . '
'; // Perform checks if ( strlen($newpass) < 6 ) - $errors .= '
Password must be at least 6 characters. You hacked my script, darn you!
'; + $errors .= '
' . $lang->get('usercp_emailpassword_err_password_too_short') . '
'; if ( getConfig('pw_strength_enable') == '1' ) { $score_inp = password_score($newpass); - $score_min = intval( getConfig('pw_strength_minimum') ); if ( $score_inp < $score_min ) - $errors .= '
Your password did not meet the complexity score requirement for this site. Your password scored '. $score_inp .', while a score of at least '. $score_min .' is needed.
'; + $errors .= '
' . $lang->get('usercp_emailpassword_err_password_too_weak', array('score' => $score_inp)) . '
'; } // Encrypt new password if ( empty($errors) ) @@ -253,15 +265,15 @@ { if ( getConfig('account_activation') == 'user' ) { - redirect(makeUrl(getConfig('main_page')), 'Profile changed', 'Your password and e-mail address have been changed. Since e-mail activation is required on this site, you will need to re-activate your account to continue. An e-mail has been sent to the new e-mail address with an activation link. You must click that link in order to log in again.', 19); + redirect(makeUrl(getConfig('main_page')), $lang->get('usercp_emailpassword_msg_profile_success'), $lang->get('usercp_emailpassword_msg_need_activ_user'), 20); } else if ( getConfig('account_activation') == 'admin' ) { - redirect(makeUrl(getConfig('main_page')), 'Profile changed', 'Your password and e-mail address have been changed. Since administrative activation is requires on this site, a request has been sent to the administrators to activate your account for you. You will not be able to use your account until it is activated by an administrator.', 19); + redirect(makeUrl(getConfig('main_page')), $lang->get('usercp_emailpassword_msg_profile_success'), $lang->get('usercp_emailpassword_msg_need_activ_admin'), 20); } } $session->login_without_crypto($session->username, $newpass); - redirect(makeUrlNS('Special', 'Preferences'), 'Password changed', 'Your password has been changed, and you will now be redirected back to the user control panel.', 4); + redirect(makeUrlNS('Special', 'Preferences'), $lang->get('usercp_emailpassword_msg_pass_success'), $lang->get('usercp_emailpassword_msg_password_changed'), 5); } } } @@ -273,37 +285,39 @@ $pass = $_POST['newpass']; if ( $pass != $_POST['newpass_conf'] ) { - $errors .= '
The passwords you entered did not match
'; + $errors .= '
' . $lang->get('usercp_emailpassword_err_password_no_match') . '
'; break; } + $session->logout(); if ( $email_changed ) { if ( getConfig('account_activation') == 'user' ) { - redirect(makeUrl(getConfig('main_page')), 'Profile changed', 'Your e-mail address has been changed. Since e-mail activation is required on this site, you will need to re-activate your account to continue. An e-mail has been sent to the new e-mail address with an activation link. You must click that link in order to log in again.', 19); + redirect(makeUrl(getConfig('main_page')), $lang->get('usercp_emailpassword_msg_profile_success'), $lang->get('usercp_emailpassword_msg_need_activ_user'), 20); } else if ( getConfig('account_activation') == 'admin' ) { - redirect(makeUrl(getConfig('main_page')), 'Profile changed', 'Your e-mail address has been changed. Since administrative activation is requires on this site, a request has been sent to the administrators to activate your account for you. You will not be able to use your account until it is activated by an administrator.', 19); + redirect(makeUrl(getConfig('main_page')), $lang->get('usercp_emailpassword_msg_profile_success'), $lang->get('usercp_emailpassword_msg_need_activ_admin'), 20); } - else - { - redirect(makeUrlNS('Special', 'Preferences'), 'Password changed', 'Your e-mail address has been changed, and you will now be redirected back to the user control panel.', 4); - } + } + else + { + $session->login_without_crypto($session->username, $newpass); + redirect(makeUrlNS('Special', 'Preferences'), $lang->get('usercp_emailpassword_msg_pass_success'), $lang->get('usercp_emailpassword_msg_password_changed'), 5); } return; } } } - $template->tpl_strings['PAGE_NAME'] = 'Change E-mail Address or Password'; + $template->tpl_strings['PAGE_NAME'] = $lang->get('usercp_emailpassword_title'); break; case 'Signature': - $template->tpl_strings['PAGE_NAME'] = 'Editing signature'; + $template->tpl_strings['PAGE_NAME'] = $lang->get('usercp_signature_title'); break; case 'Profile': - $template->tpl_strings['PAGE_NAME'] = 'Editing public profile'; + $template->tpl_strings['PAGE_NAME'] = $lang->get('usercp_publicinfo_title'); break; } @@ -320,13 +334,14 @@ global $email; $userpage_id = $paths->nslist['User'] . sanitize_page_id($session->username); $userpage_exists = ( isPage($userpage_id) ) ? '' : ' class="wikilink-nonexistent"'; - $user_page = 'user page (comments)'; - $site_admin = $email->encryptEmail(getConfig('contact_email'), '', '', 'administrator'); - $make_one_now = 'make one now'; - echo "

$session->username, welcome to your control panel

"; - echo "

Here you can make changes to your profile, view statistics on yourself on this site, and set your preferences.

-

Your $user_page is your free writing space. You can use it to tell the other members of this site a little bit about yourself. If you haven't already made a user page, why not $make_one_now?

-

Use the menu at the top to navigate around. If you have any questions, you may contact the $site_admin."; + $user_page = makeUrlNS('User', sanitize_page_id($session->username)); + $site_admin = $email->encryptEmail(getConfig('contact_email'), '', '', $lang->get('usercp_intro_para3_admin_link')); + + echo '

' . $lang->get('usercp_intro_heading_main', array('username' => $session->username)) . '

'; + + echo '

' . $lang->get('usercp_intro_para1') . '

+

' . $lang->get('usercp_intro_para2', array('userpage_link' => $user_page)) . '

+

' . $lang->get('usercp_intro_para3', array('admin_contact_link' => $site_admin)) . '

'; break; case 'EmailPassword': @@ -342,30 +357,30 @@ $pubkey = $session->rijndael_genkey(); echo '
- Change password - Type a new password:
+ ' . $lang->get('usercp_emailpassword_grp_chpasswd') . ' + ' . $lang->get('usercp_emailpassword_field_newpass') . '
' . ( getConfig('pw_strength_enable') == '1' ? ' Loading...' : '' ) . '

- Type the password again to confirm:
+ ' . $lang->get('usercp_emailpassword_field_newpass_confirm') . '
' . ( getConfig('pw_strength_enable') == '1' ? '

- Your password needs to score at least '.getConfig('pw_strength_minimum').' in order to be accepted.' : '' ) . ' + ' . $lang->get('usercp_emailpassword_msg_password_min_score') . '' : '' ) . '

- Change e-mail address - New e-mail address:
+ ' . $lang->get('usercp_emailpassword_grp_chemail') . ' + ' . $lang->get('usercp_emailpassword_field_newemail') . '


- Confirm e-mail address:
+ ' . $lang->get('usercp_emailpassword_field_newemail_confirm') . '

-
'; +
'; echo ''; @@ -455,11 +470,11 @@ if ( !$q ) $db->_die(); $session->signature = $sig; - echo '
Your signature has been saved.
'; + echo '
' . $lang->get('usercp_signature_msg_saved') . '
'; } echo '
'; echo $template->tinymce_textarea('new_sig', htmlspecialchars($session->signature)); - echo ''; + echo ''; echo '
'; break; case "Profile":