Fixed focus of AJAX login form fields in IE; removed stale/unused call to $template->makeParserText() in paginate_array(); added hook page_create_request to possibly help control creation of pages of certain namespaces from plugins; fixed critical bug in user CP that prevented plugins from adding custom CP modules
authorDan
Tue, 11 Dec 2007 19:15:26 -0500
changeset 254 f49e3c8b638c
parent 253 6c7060d36a23
child 255 c74736571f43
Fixed focus of AJAX login form fields in IE; removed stale/unused call to $template->makeParserText() in paginate_array(); added hook page_create_request to possibly help control creation of pages of certain namespaces from plugins; fixed critical bug in user CP that prevented plugins from adding custom CP modules
includes/clientside/static/misc.js
includes/functions.php
includes/pageprocess.php
includes/template.php
plugins/SpecialPageFuncs.php
plugins/SpecialUserPrefs.php
themes/oxygen/css/bleu.css
--- a/includes/clientside/static/misc.js	Mon Dec 03 18:45:37 2007 -0500
+++ b/includes/clientside/static/misc.js	Tue Dec 11 19:15:26 2007 -0500
@@ -353,42 +353,75 @@
           form_html += 'Please re-enter your login details, to verify your identity.<br /><br />';
         }
         form_html += ' \
-          <table border="0" align="center"> \
-            <tr> \
-              <td>Username:</td><td><input tabindex="1" id="ajaxlogin_user" type="text"     size="25" /> \
-            </tr> \
-            <tr> \
-              <td>Password:</td><td><input tabindex="2" id="ajaxlogin_pass" type="password" size="25" /> \
-            </tr> \
-            <tr> \
-              <td colspan="2" style="text-align: center;"> \
-                <br /><small>Trouble logging in? Try the <a href="'+makeUrlNS('Special', 'Login/' + title, 'level=' + level)+'">full login form</a>.<br />';
+          <form action="#" onsubmit="ajaxValidateLogin(); return false;" name="ajax_login_form"> \
+            <table border="0" align="center"> \
+              <tr> \
+                <td>Username:</td><td><input name="username" tabindex="1" id="ajaxlogin_user" type="text"     size="25" /> \
+              </tr> \
+              <tr> \
+                <td>Password:</td><td><input name="password" tabindex="2" id="ajaxlogin_pass" type="password" size="25" /> \
+              </tr> \
+              <tr> \
+                <td colspan="2" style="text-align: center;"> \
+                  <br /><small>Trouble logging in? Try the <a href="'+makeUrlNS('Special', 'Login/' + title, 'level=' + level)+'">full login form</a>.<br />';
        if ( level <= USER_LEVEL_MEMBER )
        {
          form_html += ' \
-                Did you <a href="'+makeUrlNS('Special', 'PasswordReset')+'">forget your password</a>?<br /> \
-                Maybe you need to <a href="'+makeUrlNS('Special', 'Register')+'">create an account</a>.</small>';
+                  Did you <a href="'+makeUrlNS('Special', 'PasswordReset')+'">forget your password</a>?<br /> \
+                  Maybe you need to <a href="'+makeUrlNS('Special', 'Register')+'">create an account</a>.</small>';
        }
        form_html += ' \
-              </td> \
-            </tr> \
-          </table> \
-          <input type="hidden" id="ajaxlogin_crypt_key"       value="' + response.key + '" /> \
-          <input type="hidden" id="ajaxlogin_crypt_challenge" value="' + response.challenge + '" /> \
-        </form>';
+                </td> \
+              </tr> \
+            </table> \
+            <input type="hidden" id="ajaxlogin_crypt_key"       value="' + response.key + '" /> \
+            <input type="hidden" id="ajaxlogin_crypt_challenge" value="' + response.challenge + '" /> \
+          </form>';
         ajax_auth_mb_cache.updateContent(form_html);
         $('messageBox').object.nextSibling.firstChild.tabindex = '3';
         if ( typeof(response.username) == 'string' )
         {
           $('ajaxlogin_user').object.value = response.username;
-          $('ajaxlogin_pass').object.focus();
+          if ( IE )
+          {
+            setTimeout("document.forms['ajax_login_form'].password.focus();", 200);
+          }
+          else
+          {
+            $('ajaxlogin_pass').object.focus();
+          }
         }
         else
         {
-          $('ajaxlogin_user').object.focus();
+          if ( IE )
+          {
+            setTimeout("document.forms['ajax_login_form'].username.focus();", 200);
+          }
+          else
+          {
+            $('ajaxlogin_user').object.focus();
+          }
         }
         $('ajaxlogin_pass').object.onblur = function(e) { if ( !shift ) $('messageBox').object.nextSibling.firstChild.focus(); };
-        $('ajaxlogin_pass').object.onkeypress = function(e) { if ( !e && IE ) return true; if ( e.keyCode == 13 ) $('messageBox').object.nextSibling.firstChild.click(); };
+        $('ajaxlogin_pass').object.onkeypress = function(e)
+        {
+          // Trigger a form submit when the password field is focused and the user presses enter
+          
+          // IE doesn't give us an event object when it should - check window.event. If that
+          // still fails, give up.
+          if ( !e )
+          {
+            e = window.event;
+          }
+          if ( !e && IE )
+          {
+            return true;
+          }
+          if ( e.keyCode == 13 )
+          {
+            ajaxValidateLogin();
+          }
+        };
         /*
         ## This causes the background image to disappear under Fx 2
         if ( shown_error )
--- a/includes/functions.php	Mon Dec 03 18:45:37 2007 -0500
+++ b/includes/functions.php	Tue Dec 11 19:15:26 2007 -0500
@@ -2223,7 +2223,6 @@
 function paginate_array($q, $num_results, $result_url, $start = 0, $perpage = 10, $header = '', $footer = '')
 {
   global $db, $session, $paths, $template, $plugins; // Common objects
-  $parser = $template->makeParserText($tpl_text);
   $num_pages = ceil ( $num_results / $perpage );
   $out = '';
   $i = 0;
@@ -2668,7 +2667,8 @@
 function sanitize_tag($tag)
 {
   $tag = strtolower($tag);
-  $tag = preg_replace('/[^\w _@\$%\^&-]+/', '', $tag);
+  $tag = preg_replace('/[^\w @\$%\^&-]+/', '', $tag);
+  $tag = str_replace('_', ' ', $tag);
   $tag = trim($tag);
   return $tag;
 }
--- a/includes/pageprocess.php	Mon Dec 03 18:45:37 2007 -0500
+++ b/includes/pageprocess.php	Tue Dec 11 19:15:26 2007 -0500
@@ -807,7 +807,13 @@
     
     echo '</div>';
     echo '</td></tr>';
-            
+    
+    $code = $plugins->setHook('userpage_sidebar_left');
+    foreach ( $code as $cmd )
+    {
+      eval($cmd);
+    }
+    
     echo '  </table>
           </div>';
     
@@ -923,6 +929,12 @@
       echo '<tr><td class="'.$class.'">' . htmlspecialchars($target_username) . ' hasn\'t posted any real-life contact information.</td></tr>';
     }
     
+    $code = $plugins->setHook('userpage_sidebar_right');
+    foreach ( $code as $cmd )
+    {
+      eval($cmd);
+    }
+    
     echo '  </table>
           </div>';
           
--- a/includes/template.php	Mon Dec 03 18:45:37 2007 -0500
+++ b/includes/template.php	Tue Dec 11 19:15:26 2007 -0500
@@ -749,7 +749,7 @@
       'JS_DYNAMIC_VARS'=>$js_dynamic,
       'UNREAD_PMS'=>$session->unread_pms,
       'URL_ABOUT_ENANO' => makeUrlNS('Special', 'About_Enano', '', true),
-      'REPORT_URI' => makeUrl($paths->page, 'do=sql_report', true)
+      'REPORT_URI' => makeUrl($paths->fullpage, 'do=sql_report', true)
       );
     
     foreach ( $paths->nslist as $ns_id => $ns_prefix )
--- a/plugins/SpecialPageFuncs.php	Mon Dec 03 18:45:37 2007 -0500
+++ b/plugins/SpecialPageFuncs.php	Tue Dec 11 19:15:26 2007 -0500
@@ -109,6 +109,11 @@
       
       exit;
     }
+    $code = $plugins->setHook('page_create_request');
+    foreach ( $code as $cmd )
+    {
+      eval($cmd);
+    }
     if ( substr($urlname, 0, 8) == 'Project:' )
     {
       $template->header();
--- a/plugins/SpecialUserPrefs.php	Mon Dec 03 18:45:37 2007 -0500
+++ b/plugins/SpecialUserPrefs.php	Tue Dec 11 19:15:26 2007 -0500
@@ -599,7 +599,7 @@
       $code = $plugins->setHook('userprefs_body');
       foreach ( $code as $cmd )
       {
-        if ( eval($code) )
+        if ( eval($cmd) )
           $good = true;
       }
       if ( !$good )
--- a/themes/oxygen/css/bleu.css	Mon Dec 03 18:45:37 2007 -0500
+++ b/themes/oxygen/css/bleu.css	Tue Dec 11 19:15:26 2007 -0500
@@ -233,14 +233,14 @@
 td.mdg-menu-btm                   {              height: 12px;     background: url(../images/bleu/border-btm.gif);   }
 
 /* Buttons and textboxes - these settings are used almost everywhere */
-input, textarea, select                   { border: 1px solid #406080; background-color: #F2F2F2; padding: 3px; font-family: arial, helvetica, sans-serif; font-size: 8pt; }
+input, textarea, select, button           { border: 1px solid #406080; background-color: #F2F2F2; padding: 3px; font-family: arial, helvetica, sans-serif; font-size: 8pt; }
 input:hover, textarea:hover, select:hover { border: 1px solid #6080A0; background-color: #F8F8F8; padding: 3px; }
 input:focus, textarea:focus, select:focus { border: 1px solid #90B0D0; background-color: #FFFFFF; padding: 3px; }
 label                                     { padding: 3px; cursor: pointer; font-family: arial, helvetica, sans-serif; font-size: 8pt; }
 label:hover                               { padding: 3px; cursor: pointer; background-color: #F0F0F0; }
 input#pageheading                         { font-size: 14pt; border-bottom: 1px solid #90B0D0; margin-bottom: 0; }
 
-input[type ^="button"], input[type ^="submit"] {
+input[type ^="button"], input[type ^="submit"], button {
   background-image: url(../images/buttonbg.gif);
   background-repeat: repeat-x;
   color: #202020;