From: Rob Church Date: Fri, 6 Jan 2006 23:09:37 +0000 (+0000) Subject: * Move the "user is blocked" page to OutputPage X-Git-Tag: 1.6.0~744 X-Git-Url: http://git.cyclocoop.org/%28?a=commitdiff_plain;h=c1b1b2de50fc6ac4d6c09ab288733cd0c18dae15;p=lhc%2Fweb%2Fwiklou.git * Move the "user is blocked" page to OutputPage * Disallow users to use rollback when blocked --- diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 7509a20fa3..27fa13e86c 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -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 === diff --git a/includes/Article.php b/includes/Article.php index c84f1a0461..c5ef0cedbc 100644 --- a/includes/Article.php +++ b/includes/Article.php @@ -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; diff --git a/includes/EditPage.php b/includes/EditPage.php index a873d0a601..a99328c95c 100644 --- a/includes/EditPage.php +++ b/includes/EditPage.php @@ -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(); } /** diff --git a/includes/OutputPage.php b/includes/OutputPage.php index 53f3f177b5..21839a3aa9 100644 --- a/includes/OutputPage.php +++ b/includes/OutputPage.php @@ -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!