Mass convert NULL -> null. Left strings and comments alone, obviously.
[lhc/web/wiklou.git] / includes / User.php
index 7998f1b..ffe5433 100644 (file)
@@ -44,7 +44,7 @@ class User {
 
        /**
         * \type{\arrayof{\string}} A list of default user toggles, i.e., boolean user
-         * preferences that are displayed by Special:Preferences as checkboxes.
+        * preferences that are displayed by Special:Preferences as checkboxes.
         * This list can be extended via the UserToggles hook or by
         * $wgContLang::getExtraUserToggles().
         * @showinitializer
@@ -647,6 +647,12 @@ class User {
                                return 'passwordtooshort';
                        } elseif ( $wgContLang->lc( $password ) == $wgContLang->lc( $this->mName ) ) {
                                return 'password-name-match';
+                       } else {
+                               //it seems weird returning true here, but this is because of the
+                               //initialization of $result to false above. If the hook is never run or it
+                               //doesn't modify $result, then we will likely get down into this if with
+                               //a valid password.
+                               return true;
                        }
                } elseif( $result === true ) {
                        return true;
@@ -687,8 +693,9 @@ class User {
         *                - 'creatable'  Valid for batch processes, login and account creation
         */
        static function getCanonicalName( $name, $validate = 'valid' ) {
-               # Maybe force usernames to capital
-               $name = Title::capitalize( $name, NS_USER );
+               # Force usernames to capital
+               global $wgContLang;
+               $name = $wgContLang->ucfirst( $name );
 
                # Reject names containing '#'; these will be cleaned up
                # with title normalisation, but then it's too late to
@@ -2320,7 +2327,7 @@ class User {
                        $dbw = wfGetDB( DB_MASTER );
                        $dbw->update( 'watchlist',
                                        array( /* SET */
-                                               'wl_notificationtimestamp' => NULL
+                                               'wl_notificationtimestamp' => null
                                        ), array( /* WHERE */
                                                'wl_title' => $title->getDBkey(),
                                                'wl_namespace' => $title->getNamespace(),
@@ -2347,7 +2354,7 @@ class User {
                        $dbw = wfGetDB( DB_MASTER );
                        $dbw->update( 'watchlist',
                                array( /* SET */
-                                       'wl_notificationtimestamp' => NULL
+                                       'wl_notificationtimestamp' => null
                                ), array( /* WHERE */
                                        'wl_user' => $currentUser
                                ), __METHOD__
@@ -3569,6 +3576,7 @@ class User {
        }
 
        protected function loadOptions() {
+               global $wgCookiePrefix;
                $this->load();
                if ( $this->mOptionsLoaded || !$this->getId() )
                        return;
@@ -3597,6 +3605,11 @@ class User {
                                $this->mOptionOverrides[$row->up_property] = $row->up_value;
                                $this->mOptions[$row->up_property] = $row->up_value;
                        }
+
+                       //null skin if User::mId is loaded out of session data without persistant credentials
+                       if ( !isset( $_SESSION['wsToken'] ) && !isset( $_COOKIE["{$wgCookiePrefix}Token"] ) )
+                               $this->mOptions['skin'] = null;
+
                }
 
                $this->mOptionsLoaded = true;