Started localization on User CP. Localized pagination, password strength, and various other small widgets. Fixed bug in path manager causing return of fullpage from get_page_id_from_url() even when namespace is Special.
authorDan
Mon, 21 Jan 2008 15:37:28 -0500
changeset 362 02d315d1cc58
parent 360 fad9bb5c094b
child 363 2220bab5c784
Started localization on User CP. Localized pagination, password strength, and various other small widgets. Fixed bug in path manager causing return of fullpage from get_page_id_from_url() even when namespace is Special.
includes/clientside/static/pwstrength.js
includes/clientside/static/sliders.js
includes/functions.php
includes/paths.php
language/english/user.json
plugins/SpecialUserPrefs.php
plugins/admin/UserManager.php
--- a/includes/clientside/static/pwstrength.js	Mon Jan 21 10:17:26 2008 -0500
+++ b/includes/clientside/static/pwstrength.js	Mon Jan 21 15:37:28 2008 -0500
@@ -181,9 +181,9 @@
     debug_txt += debug[i] + "\n";
   }
   
-  if ( window.console )
-    window.console.info(debug_txt);
-  else if ( document.getElementById('passdebug') )
+  // For users that really want to know why their password sucks.
+  // Not localized because the feature is really only used for debugging the algorithm.
+  if ( document.getElementById('passdebug') )
     document.getElementById('passdebug').innerHTML = debug_txt;
   
   return score;
@@ -191,36 +191,53 @@
 
 function password_score_draw(score)
 {
+  if ( !$lang )
+  {
+    // $lang isn't initted yet, this happens sometimes on the usercp/emailpassword form.
+    // Try to init it if we have ENANO_LANG_ID and enano_lang; if not, report an error.
+    if ( typeof(enano_lang) == 'object' && typeof(ENANO_LANG_ID) == 'number' )
+    {
+      language_onload();
+    }
+    else
+    {
+      return {
+        color: '#000000',
+        fgcolor: '#666666',
+        str: 'Language init failed',
+      };
+    }
+  }
   // some colors are from the Gmail sign-up form
   if ( score >= 10 )
   {
     var color = '#000000';
     var fgcolor = '#666666';
-    var str = 'Very strong (score: '+score+')';
+    var str = $lang.get('usercp_pwstrength_score_verystrong', { score: score });
   }
   else if ( score > 3 )
   {
     var color = '#008000';
     var fgcolor = '#004000';
-    var str = 'Strong (score: '+score+')';
+    var str = $lang.get('usercp_pwstrength_score_strong', { score: score });
   }
   else if ( score >= 1 )
   {
     var color = '#6699cc';
     var fgcolor = '#4477aa';
-    var str = 'Good (score: '+score+')';
+    var str = $lang.get('usercp_pwstrength_score_good', { score: score });
   }
   else if ( score >= -3 )
   {
     var color = '#f5ac00';
     var fgcolor = '#ffcc33';
-    var str = 'Fair (score: '+score+')';
+    var str = $lang.get('usercp_pwstrength_score_fair', { score: score });
   }
   else
   {
     var color = '#aa0033';
     var fgcolor = '#FF6060';
-    var str = 'Weak (score: '+score+')';
+    var str = $lang.get('usercp_pwstrength_score_weak', { score: score });
   }
   return {
     color: color,
--- a/includes/clientside/static/sliders.js	Mon Jan 21 10:17:26 2008 -0500
+++ b/includes/clientside/static/sliders.js	Mon Jan 21 15:37:28 2008 -0500
@@ -30,6 +30,9 @@
         // use cookies to toggle whether to display it or not
         var id = ( divs[i].parentNode.firstChild.nextSibling ) ? divs[i].parentNode.firstChild.nextSibling.firstChild : divs[i].parentNode.parentNode.firstChild.nextSibling.firstChild;
         
+        if ( !id.nextSibling )
+          return;
+        
         if(id.innerHTML || id.nextSibling.length < 1) id = id.innerHTML;
         else id = id.nextSibling.innerHTML; // Gecko fix
         
--- a/includes/functions.php	Mon Jan 21 10:17:26 2008 -0500
+++ b/includes/functions.php	Mon Jan 21 15:37:28 2008 -0500
@@ -2142,7 +2142,7 @@
       }
     }
     $url = sprintf($result_url, '0');
-    $link = ( 0 == $start ) ? "<b>" . $lang->get('pagination_btn_first') . "</b>" : "<a href=".'"'."$url".'"'." style='text-decoration: none;'>&laquo; " . $lang->get('pagination_btn_first') . "</a>";
+    $link = ( 0 == $start ) ? "<b>" . $lang->get('paginate_btn_first') . "</b>" : "<a href=".'"'."$url".'"'." style='text-decoration: none;'>&laquo; " . $lang->get('paginate_btn_first') . "</a>";
     $blk->assign_vars(array(
       'CLASS'=>$cls,
       'LINK'=>$link
@@ -2184,7 +2184,7 @@
       $offset = strval($total);
       $url = sprintf($result_url, $offset);
       $j = $i + 1;
-      $link = ( $offset == strval($start) ) ? "<b>" . $lang->get('pagination_btn_last') . "</b>" : "<a href=".'"'."$url".'"'." style='text-decoration: none;'>" . $lang->get('pagination_btn_last') . " &raquo;</a>";
+      $link = ( $offset == strval($start) ) ? "<b>" . $lang->get('paginate_btn_last') . "</b>" : "<a href=".'"'."$url".'"'." style='text-decoration: none;'>" . $lang->get('paginate_btn_last') . " &raquo;</a>";
       $blk->assign_vars(array(
         'CLASS'=>$cls,
         'LINK'=>$link
@@ -2255,6 +2255,8 @@
 function paginate_array($q, $num_results, $result_url, $start = 0, $perpage = 10, $header = '', $footer = '')
 {
   global $db, $session, $paths, $template, $plugins; // Common objects
+  global $lang;
+  
   $num_pages = ceil ( $num_results / $perpage );
   $out = '';
   $i = 0;
@@ -2263,13 +2265,14 @@
   // Build paginator
   $begin = '<div class="tblholder" style="display: table; margin: 10px 0 0 auto;">
     <table border="0" cellspacing="1" cellpadding="4">
-      <tr><th>Page:</th>';
+      <tr><th>' . $lang->get('paginate_lbl_page') . '</th>';
   $block = '<td class="row1" style="text-align: center;">{LINK}</td>';
   $end = '</tr></table></div>';
   $blk = $template->makeParserText($block);
   $inner = '';
   $cls = 'row2';
   $total = $num_pages * $perpage - $perpage;
+  /*
   if ( $start > 0 )
   {
     $url = sprintf($result_url, abs($start - $perpage));
@@ -2281,6 +2284,7 @@
       ));
     $inner .= $blk->run();
   }
+  */
   if ( $num_pages < 5 )
   {
     for ( $i = 0; $i < $num_pages; $i++ )
@@ -2322,7 +2326,7 @@
       }
     }
     $url = sprintf($result_url, '0');
-    $link = ( 0 == $start ) ? "<b>" . $lang->get('pagination_btn_first') . "</b>" : "<a href=".'"'."$url".'"'." style='text-decoration: none;'>&laquo; " . $lang->get('pagination_btn_first') . "</a>";
+    $link = ( 0 == $start ) ? "<b>" . $lang->get('paginate_btn_first') . "</b>" : "<a href=".'"'."$url".'"'." style='text-decoration: none;'>&laquo; " . $lang->get('paginate_btn_first') . "</a>";
     $blk->assign_vars(array(
       'CLASS'=>$cls,
       'LINK'=>$link
@@ -2362,7 +2366,7 @@
       $offset = strval($total);
       $url = sprintf($result_url, $offset);
       $j = $i + 1;
-      $link = ( $offset == strval($start) ) ? "<b>" . $lang->get('pagination_btn_last') . "</b>" : "<a href=".'"'."$url".'"'." style='text-decoration: none;'>" . $lang->get('pagination_btn_last') . " &raquo;</a>";
+      $link = ( $offset == strval($start) ) ? "<b>" . $lang->get('paginate_btn_last') . "</b>" : "<a href=".'"'."$url".'"'." style='text-decoration: none;'>" . $lang->get('paginate_btn_last') . " &raquo;</a>";
       $blk->assign_vars(array(
         'CLASS'=>$cls,
         'LINK'=>$link
@@ -2372,6 +2376,7 @@
 
   }
 
+  /*
   if ( $start < $total )
   {
     $link_offset = abs($start + $perpage);
@@ -2384,6 +2389,7 @@
       ));
     $inner .= $blk->run();
   }
+  */
 
   $inner .= '<td class="row2" style="cursor: pointer;" onclick="paginator_goto(this, '.$this_page.', '.$num_pages.', '.$perpage.', unescape(\'' . rawurlencode($result_url) . '\'));">&darr;</td>';
 
--- a/includes/paths.php	Mon Jan 21 10:17:26 2008 -0500
+++ b/includes/paths.php	Mon Jan 21 15:37:28 2008 -0500
@@ -482,6 +482,11 @@
         exit;
       }
       $ret = $_GET['title'];
+      if ( substr($ret, 0, strlen($this->nslist['Special'])) === $this->nslist['Special'] ||
+           substr($ret, 0, strlen($this->nslist['Admin'])) === $this->nslist['Admin'] )
+      {
+        list($ret) = explode('/', $ret);
+      }
     }
     elseif(isset($_SERVER['PATH_INFO']))
     {
--- a/language/english/user.json	Mon Jan 21 10:17:26 2008 -0500
+++ b/language/english/user.json	Mon Jan 21 15:37:28 2008 -0500
@@ -133,6 +133,62 @@
       reg_coppa_link_not13: 'I was born <b>after</b> %yo13_date% and am <b>less than</b> 13 years of age',
     },
     usercp: {
+      // Meta
+      sec_profile: 'Profile/membership',
+      sec_pm: 'Private messages',
+      
+      sec_profile_emailpassword: 'Edit e-mail address and password',
+      sec_profile_signature: 'Edit signature',
+      sec_profile_publicinfo: 'Edit public profile',
+      sec_profile_usergroups: 'Group memberships',
+      sec_profile_avatar: 'Avatar settings',
+      
+      sec_pm_inbox: 'Inbox',
+      sec_pm_outbox: 'Outbox',
+      sec_pm_sent: 'Sent items',
+      sec_pm_drafts: 'Drafts',
+      sec_pm_archive: 'Archive',
+      
+      // CP home
+      intro_heading_main: '%username%, welcome to your control panel',
+      intro_para1: 'Here you can make changes to your profile, view statistics on yourself on this site, and set your preferences.',
+      intro_para2: 'Your <a href="%userpage_link%">user page</a> <sup>(<a href="%userpage_link%#do:comments">comments</a>)</sup> 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 <a href="%userpage_link%#do:edit">make one now</a>?',
+      intro_para3: 'Use the menu at the top to navigate around. If you have any questions, you may contact the %admin_contact_link%.',
+      intro_para3_admin_link: 'administrator',
+      
+      // E-mail / password change form
+      emailpassword_title: 'Change E-mail Address or Password',
+      emailpassword_err_email_no_match: 'The e-mail addresses you entered did not match.',
+      emailpassword_err_list: 'The following errors were encountered while saving your e-mail address:',
+      emailpassword_err_title: 'Error updating e-mail address',
+      emailpassword_err_demo: 'You can\'t change your password in demo mode.',
+      // This is an in-joke.
+      emailpassword_err_password_too_short: 'Password must be at least 6 characters. You hacked my script, darn you!',
+      emailpassword_err_password_too_weak: 'Your password did not meet the complexity score requirement for this site. Your password scored %score%, while a score of at least %config.pw_strength_minimum% is needed.',
+      emailpassword_msg_profile_success: 'Profile changed',
+      emailpassword_msg_pass_success: 'Password changed',
+      emailpassword_msg_need_activ_user: '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.',
+      emailpassword_msg_need_activ_admin: '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.',
+      emailpassword_msg_password_changed: 'Your password has been changed, and you will now be redirected back to the user control panel.',
+      emailpassword_err_password_no_match: 'The passwords you entered did not match',
+      emailpassword_grp_chpasswd: 'Change password',
+      emailpassword_field_newpass: 'Type a new password:',
+      emailpassword_field_newpass_confirm: 'Type the password again to confirm:',
+      emailpassword_msg_password_min_score: 'Your password needs to score at least <b>%config.pw_strength_minimum%</b> in order to be accepted.',
+      // The following is NOT an in-joke. ;-)
+      emailpassword_grp_chemail: 'Change e-mail address',
+      emailpassword_field_newemail: 'New e-mail address:',
+      emailpassword_field_newemail_confirm: 'Confirm e-mail address:',
+      
+      // Signature editor
+      signature_title: 'Editing signature',
+      signature_msg_saved: 'Your signature has been saved.',
+      signature_btn_save: 'Save signature',
+      
+      // Additional profile info
+      publicinfo_title: 'Editing public profile',
+      
+      // Avatar management
       avatar_err_disabled_title: 'Avatar support is disabled.',
       avatar_err_disabled_body: 'The administrator has not enabled avatar support for this site.',
       avatar_table_title: 'Avatar settings',
@@ -158,6 +214,13 @@
       avatar_move_failed: 'Your image was accepted, but there was a problem moving the image file to the correct location.',
       avatar_upload_success: 'Your avatar has been updated.',
       avatar_file_too_large: 'The image you uploaded exceeds the maximum file size allowed for avatars on this site.',
+      
+      // Password strength widget
+      pwstrength_score_verystrong: 'Very strong (score: %score%)',
+      pwstrength_score_strong: 'Strong (score: %score%)',
+      pwstrength_score_good: 'Good (score: %score%)',
+      pwstrength_score_fair: 'Fair (score: %score%)',
+      pwstrength_score_weak: 'Weak (score: %score%)',
     },
     groupcp: {
       status_mod: 'You are a moderator of this group.',
--- a/plugins/SpecialUserPrefs.php	Mon Jan 21 10:17:26 2008 -0500
+++ b/plugins/SpecialUserPrefs.php	Mon Jan 21 15:37:28 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]) ) ? "<a href={$quot}{$userprefs_menu_links[$section]}{$quot}>{$section}</a>\n        " : "<a>{$section}</a>\n        ";
+    $section_name = $section;
+    if ( preg_match('/^[a-z]+_[a-z_]+$/', $section) )
+    {
+      $section_name = $lang->get($section_name);
+    }
+    $html .= ( isset($userprefs_menu_links[$section]) ) ? "<a href={$quot}{$userprefs_menu_links[$section]}{$quot}>{$section_name}</a>\n        " : "<a>{$section_name}</a>\n        ";
     $html .= "<ul>\n          ";
     foreach ( $buttons as $button )
     {
-      $html .= "  <li><a href={$quot}{$button['link']}{$quot}>{$button['text']}</a></li>\n          ";
+      $buttontext = $button['text'];
+      if ( preg_match('/^[a-z]+_[a-z_]+$/', $buttontext) )
+      {
+        $buttontext = $lang->get($buttontext);
+      }
+      $html .= "  <li><a href={$quot}{$button['link']}{$quot}>{$buttontext}</a></li>\n          ";
     }
     $html .= "</ul>\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 .= '<div class="error-box">The e-mail addresses you entered did not match.</div>';
+                $errors .= '<div class="error-box">' . $lang->get('usercp_emailpassword_err_email_no_match') . '</div>';
                 break;
               }
           }
@@ -201,9 +214,9 @@
           $result = $session->update_user($session->user_id, false, $old_pass, false, $new_email);
           if ( $result != 'success' )
           {
-            $message = '<p>The following errors were encountered while saving your e-mail address:</p>';
+            $message = '<p>' . $lang->get('usercp_emailpassword_err_list') . '</p>';
             $message .= '<ul><li>' . implode("</li>\n<li>", $result) . '</li></ul>';
-            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 .= '<div class="error-box" style="margin: 0 0 10px 0;">You can\'t change your password in demo mode.</div>';
+              $errors .= '<div class="error-box" style="margin: 0 0 10px 0;">' . $lang->get('usercp_emailpassword_err_demo') . '</div>';
             // Perform checks
             if ( strlen($newpass) < 6 )
-              $errors .= '<div class="error-box" style="margin: 0 0 10px 0;">Password must be at least 6 characters. You hacked my script, darn you!</div>';
+              $errors .= '<div class="error-box" style="margin: 0 0 10px 0;">' . $lang->get('usercp_emailpassword_err_password_too_short') . '</div>';
             if ( getConfig('pw_strength_enable') == '1' )
             {
               $score_inp = password_score($newpass);
-              $score_min = intval( getConfig('pw_strength_minimum') );
               if ( $score_inp < $score_min )
-                $errors .= '<div class="error-box" style="margin: 0 0 10px 0;">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.</div>';
+                $errors .= '<div class="error-box" style="margin: 0 0 10px 0;">' . $lang->get('usercp_emailpassword_err_password_too_weak', array('score' => $score_inp)) . '</div>';
             }
             // 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 .= '<div class="error-box">The passwords you entered did not match</div>';
+                $errors .= '<div class="error-box">' . $lang->get('usercp_emailpassword_err_password_no_match') . '</div>';
                 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 = '<a href="' . makeUrlNS('User', sanitize_page_id($session->username)) . '"' . $userpage_exists . '>user page</a> <sup>(<a href="' . makeUrlNS('User', str_replace(' ', '_', $session->username)) . '#do:comments">comments</a>)</sup>';
-      $site_admin = $email->encryptEmail(getConfig('contact_email'), '', '', 'administrator');
-      $make_one_now = '<a href="' . makeUrlNS('User', sanitize_page_id($session->username)) . '">make one now</a>';
-      echo "<h3 style='margin-top: 0;'>$session->username, welcome to your control panel</h3>";
-      echo "<p>Here you can make changes to your profile, view statistics on yourself on this site, and set your preferences.</p>
-            <p>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?</p>
-            <p>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 '<h3 style="margin-top: 0;">' . $lang->get('usercp_intro_heading_main', array('username' => $session->username)) . '</h3>';
+      
+      echo '<p>' . $lang->get('usercp_intro_para1') . '</p>
+            <p>' . $lang->get('usercp_intro_para2', array('userpage_link' => $user_page)) . '</p>
+            <p>' . $lang->get('usercp_intro_para3', array('admin_contact_link' => $site_admin)) . '</p>';
       break;
     case 'EmailPassword':
       
@@ -342,30 +357,30 @@
       $pubkey = $session->rijndael_genkey();
       
       echo '<fieldset>
-        <legend>Change password</legend>
-        Type a new password:<br />
+        <legend>' . $lang->get('usercp_emailpassword_grp_chpasswd') . '</legend>
+        ' . $lang->get('usercp_emailpassword_field_newpass') . '<br />
           <input type="password" name="newpass" size="30" tabindex="1" ' . ( getConfig('pw_strength_enable') == '1' ? 'onkeyup="password_score_field(this);" ' : '' ) . '/>' . ( getConfig('pw_strength_enable') == '1' ? '<span class="password-checker" style="font-weight: bold; color: #aaaaaa;"> Loading...</span>' : '' ) . '
         <br />
         <br />
-        Type the password again to confirm:<br />
+        ' . $lang->get('usercp_emailpassword_field_newpass_confirm') . '<br />
         <input type="password" name="newpass_conf" size="30" tabindex="2" />
         ' . ( getConfig('pw_strength_enable') == '1' ? '<br /><br /><div id="pwmeter"></div>
-        <small>Your password needs to score at least <b>'.getConfig('pw_strength_minimum').'</b> in order to be accepted.</small>' : '' ) . '
+        <small>' . $lang->get('usercp_emailpassword_msg_password_min_score') . '</small>' : '' ) . '
       </fieldset><br />
       <fieldset>
-        <legend>Change e-mail address</legend>
-        New e-mail address:<br />
+        <legend>' . $lang->get('usercp_emailpassword_grp_chemail') . '</legend>
+        ' . $lang->get('usercp_emailpassword_field_newemail') . '<br />
           <input type="text" value="' . ( isset($_POST['newemail']) ? htmlspecialchars($_POST['newemail']) : '' ) . '" name="newemail" size="30" tabindex="3" />
         <br />
         <br />
-        Confirm e-mail address:<br />
+        ' . $lang->get('usercp_emailpassword_field_newemail_confirm') . '<br />
           <input type="text" value="' . ( isset($_POST['newemail']) ? htmlspecialchars($_POST['newemail']) : '' ) . '" name="newemail_conf" size="30" tabindex="4" />
       </fieldset>
       <input type="hidden" name="use_crypt" value="no" />
       <input type="hidden" name="crypt_key" value="' . $pubkey . '" />
       <input type="hidden" name="crypt_data" value="" />
       <br />
-      <div style="text-align: right;"><input type="submit" name="submit" value="Save Changes" tabindex="5" /></div>';
+      <div style="text-align: right;"><input type="submit" name="submit" value="' . $lang->get('etc_save_changes') . '" tabindex="5" /></div>';
       
       echo '</form>';
       
@@ -455,11 +470,11 @@
         if ( !$q )
           $db->_die();
         $session->signature = $sig;
-        echo '<div class="info-box" style="margin: 0 0 10px 0;">Your signature has been saved.</div>';
+        echo '<div class="info-box" style="margin: 0 0 10px 0;">' . $lang->get('usercp_signature_msg_saved') . '</div>';
       }
       echo '<form action="'.makeUrl($paths->fullpage).'" method="post">';
       echo $template->tinymce_textarea('new_sig', htmlspecialchars($session->signature));
-      echo '<input type="submit" value="Save signature" />';
+      echo '<input type="submit" value="' . $lang->get('usercp_signature_btn_save') . '" />';
       echo '</form>';
       break;
     case "Profile":
--- a/plugins/admin/UserManager.php	Mon Jan 21 10:17:26 2008 -0500
+++ b/plugins/admin/UserManager.php	Mon Jan 21 15:37:28 2008 -0500
@@ -902,8 +902,7 @@
                         </tr>
                         <tr>
                           <td>{lang:acpum_field_newpassword}</td>
-                          <!-- FIXME: localize password strength widget -->
-                          <td><input type="password" name="new_password" value="" <!-- BEGIN password_meter -->onkeyup="password_score_field(this);" /><span class="password-checker" style="font-weight: bold; color: #AA0000"> Weak (score: -10)</span><!-- BEGINELSE password_meter --> /><!-- END password_meter -->
+                          <td><input type="password" name="new_password" value="" <!-- BEGIN password_meter -->onkeyup="password_score_field(this);" /><span class="password-checker" style="font-weight: bold; color: #A0A0A0"> Waiting for l10n init</span><!-- BEGINELSE password_meter --> /><!-- END password_meter -->
                             <!-- BEGIN password_meter -->
                               <div id="pwmeter" style="margin: 4px 0; height: 8px;"></div>
                             <!-- END password_meter -->
@@ -1141,6 +1140,11 @@
           </div>
         
         </form>
+        
+        <script type="text/javascript">
+        password_score_field(document.forms['useredit_{UUID}'].new_password);
+        </script>
+        
         {AES_JAVASCRIPT}
       <!-- Conclusion of user edit form -->
 EOF;