http://www.mediawiki.org/wiki/Special:Code/MediaWiki/71882

Revision: 71882
Author:   siebrand
Date:     2010-08-29 12:31:42 +0000 (Sun, 29 Aug 2010)

Log Message:
-----------
(bug 24391) Prevent use of Special:ContactPage for blocked users.

Patch contributed by Thomas Shone. Committer updated indentation and variable 
name.

Modified Paths:
--------------
    trunk/extensions/ContactPage/SpecialContact.php

Modified: trunk/extensions/ContactPage/SpecialContact.php
===================================================================
--- trunk/extensions/ContactPage/SpecialContact.php     2010-08-29 11:40:28 UTC 
(rev 71881)
+++ trunk/extensions/ContactPage/SpecialContact.php     2010-08-29 12:31:42 UTC 
(rev 71882)
@@ -52,6 +52,26 @@
                        return;
                }
 
+               // Blocked users cannot use the contact form.
+               if ( $wgUser->isBlocked() ) {
+                       $wgOut->setPageTitle( wfMsg( 'blockedtitle' ) );
+                       $wgOut->setRobotPolicy( 'noindex,nofollow' );
+                       $wgOut->setArticleRelated( false );
+
+                       $ip = wfGetIP();
+                       $blocker = User::whoIs( $wgUser->mBlock->mBy );
+                       $blockReason = $wgUser->mBlock->mReason;
+
+                       if ( strval( $blockReason ) === '' ) {
+                               $blockReason = wfMsg( 'blockednoreason' );
+                       }
+
+                       $wgOut->addWikiMsg( 'blockedtext', $ip, $blockReason, 
$blocker );
+                       $wgOut->returnToMain( false );
+
+                       return;
+               }
+
                $f = new EmailContactForm( $nu );
 
                if ( 'success' == $action ) {



_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs

Reply via email to