* Partial revert of r25680 (The bit that allowed people to provide a null $user and...
authorAndrew Garrett <werdna@users.mediawiki.org>
Mon, 10 Sep 2007 03:01:09 +0000 (03:01 +0000)
committerAndrew Garrett <werdna@users.mediawiki.org>
Mon, 10 Sep 2007 03:01:09 +0000 (03:01 +0000)
* Minor bug, pointed out by Simetrical, in currently unused edge cases where $user passed to getUserPermissionsErrors is not $wgUser, and $user is blocked.

includes/Title.php

index 7b8f173..63ec737 100644 (file)
@@ -1030,16 +1030,12 @@ class Title {
         * @param bool $doExpensiveQueries Set this to false to avoid doing unnecessary queries.
         * @return array Array of arrays of the arguments to wfMsg to explain permissions problems.
        */
-       public function getUserPermissionsErrors( $action, $user = null, $doExpensiveQueries = true ) {
+       public function getUserPermissionsErrors( $action, $user, $doExpensiveQueries = true ) {
                $errors = $this->getUserPermissionsErrorsInternal( $action, $user, $doExpensiveQueries );
 
                global $wgContLang;
                global $wgLang;
 
-               # Be kinder to people who forget to supply a user, assuming they mean $wgUser
-               if (!$user)
-                       $user = $wgUser;
-
                if ( wfReadOnly() && $action != 'read' ) {
                        global $wgReadOnly;
                        $errors[] = array( 'readonlytext', $wgReadOnly );
@@ -1071,7 +1067,7 @@ class Title {
                        $link = '[[' . $wgContLang->getNsText( NS_USER ) . ":{$name}|{$name}]]";
                        $blockid = $block->mId;
                        $blockExpiry = $user->mBlock->mExpiry;
-                       $blockTimestamp = $wgLang->timeanddate( wfTimestamp( TS_MW, $wgUser->mBlock->mTimestamp ), true );
+                       $blockTimestamp = $wgLang->timeanddate( wfTimestamp( TS_MW, $user->mBlock->mTimestamp ), true );
 
                        if ( $blockExpiry == 'infinity' ) {
                                // Entry in database (table ipblocks) is 'infinity' but 'ipboptions' uses 'infinite' or 'indefinite'