* Move the "user is blocked" page to OutputPage
authorRob Church <robchurch@users.mediawiki.org>
Fri, 6 Jan 2006 23:09:37 +0000 (23:09 +0000)
committerRob Church <robchurch@users.mediawiki.org>
Fri, 6 Jan 2006 23:09:37 +0000 (23:09 +0000)
* Disallow users to use rollback when blocked

RELEASE-NOTES
includes/Article.php
includes/EditPage.php
includes/OutputPage.php

index 7509a20..27fa13e 100644 (file)
@@ -411,6 +411,7 @@ fully support the editing toolbar, but was found to be too confusing.
   which are not of known image types. This is in response to
   http://en.wikipedia.org/wiki/Windows_Metafile_vulnerability
 * (bug 4507) Adjust FULLPAGENAMEE escaping to standard form
+* Disallow users to use rollback when blocked
 
 
 === Caveats ===
index c84f1a0..c5ef0ce 100644 (file)
@@ -1965,10 +1965,16 @@ class Article {
                global $wgUser, $wgOut, $wgRequest, $wgUseRCPatrol;
                $fname = 'Article::rollback';
 
-               if ( ! $wgUser->isAllowed('rollback') ) {
+               if( $wgUser->isAllowed( 'rollback' ) ) {
+                       if( $wgUser->isBlocked() ) {
+                               $wgOut->blockedPage();
+                               return;
+                       }
+               } else {
                        $wgOut->sysopRequired();
                        return;
                }
+
                if ( wfReadOnly() ) {
                        $wgOut->readOnlyPage( $this->getContent( true ) );
                        return;
index a873d0a..a99328c 100644 (file)
@@ -185,7 +185,7 @@ class EditPage {
                        # When previewing, don't check blocked state - will get caught at save time.
                        # Also, check when starting edition is done against slave to improve performance.
                        wfDebug( "$fname: user is blocked\n" );
-                       $this->blockedIPpage();
+                       $wgOut->blockedPage();
                        wfProfileOut( $fname );
                        return;
                }
@@ -1128,26 +1128,8 @@ END
         * @todo document
         */
        function blockedIPpage() {
-               global $wgOut, $wgUser, $wgContLang;
-
-               $wgOut->setPageTitle( wfMsg( 'blockedtitle' ) );
-               $wgOut->setRobotpolicy( 'noindex,nofollow' );
-               $wgOut->setArticleRelated( false );
-
-               $id = $wgUser->blockedBy();
-               $reason = $wgUser->blockedFor();
-               $ip = wfGetIP();
-
-               if ( is_numeric( $id ) ) {
-                       $name = User::whoIs( $id );
-               } else {
-                       $name = $id;
-               }
-               $link = '[[' . $wgContLang->getNsText( NS_USER ) .
-                 ":{$name}|{$name}]]";
-
-               $wgOut->addWikiText( wfMsg( 'blockedtext', $link, $reason, $ip, $name ) );
-               $wgOut->returnToMain( false );
+               global $wgOut;
+               $wgOut->blockedPage();
        }
 
        /**
index 53f3f17..21839a3 100644 (file)
@@ -598,6 +598,31 @@ class OutputPage {
                $time = wfReportTime();
                return $time;
        }
+       
+       /**
+        * Produce a "user is blocked" page
+        */
+       function blockedPage() {
+               global $wgUser, $wgContLang;
+
+               $this->setPageTitle( wfMsg( 'blockedtitle' ) );
+               $this->setRobotpolicy( 'noindex,nofollow' );
+               $this->setArticleRelated( false );
+
+               $id = $wgUser->blockedBy();
+               $reason = $wgUser->blockedFor();
+               $ip = wfGetIP();
+
+               if ( is_numeric( $id ) ) {
+                       $name = User::whoIs( $id );
+               } else {
+                       $name = $id;
+               }
+               $link = '[[' . $wgContLang->getNsText( NS_USER ) . ":{$name}|{$name}]]";
+
+               $this->addWikiText( wfMsg( 'blockedtext', $link, $reason, $ip, $name ) );
+               $this->returnToMain( false );
+       }
 
        /**
         * Note: these arguments are keys into wfMsg(), not text!