https://www.mediawiki.org/wiki/Special:Code/MediaWiki/113793

Revision: 113793
Author:   saper
Date:     2012-03-14 01:58:01 +0000 (Wed, 14 Mar 2012)
Log Message:
-----------
(bug 35214) Special:Nuke allows deletions even when blocked

Modified Paths:
--------------
    trunk/extensions/Nuke/Nuke_body.php

Modified: trunk/extensions/Nuke/Nuke_body.php
===================================================================
--- trunk/extensions/Nuke/Nuke_body.php 2012-03-14 01:42:14 UTC (rev 113792)
+++ trunk/extensions/Nuke/Nuke_body.php 2012-03-14 01:58:01 UTC (rev 113793)
@@ -7,14 +7,18 @@
        }
 
        public function execute( $par ) {
-               if( !$this->userCanExecute( $this->getUser() ) ) {
+               if ( !$this->userCanExecute( $this->getUser() ) ) {
                        $this->displayRestrictionError();
-                       return;
                }
-
                $this->setHeaders();
                $this->outputHeader();
 
+               if ( $this->getUser()->isBlocked() ) {
+                       $block = $this->getUser()->getBlock();
+                       throw new UserBlockedError( $block );
+               }
+               $this->checkReadOnly(); 
+               
                $req = $this->getRequest();
 
                $target = trim( $req->getText( 'target', $par ) );
@@ -286,6 +290,12 @@
                        $title = Title::newFromURL( $page );
                        $file = $title->getNamespace() == NS_FILE ? 
wfLocalFile( $title ) : false;
                        
+                       $permission_errors = $title->getUserPermissionsErrors( 
'delete', $this->getUser());
+
+                       if ( count( $permission_errors )) {
+                               throw new PermissionsError( 'delete', 
$permission_errors );
+                       }
+
                        if ( $file ) {
                                $oldimage = null; // Must be passed by reference
                                $ok = FileDeleteForm::doDelete( $title, $file, 
$oldimage, $reason, false )->isOK();


_______________________________________________
MediaWiki-CVS mailing list
MediaWiki-CVS@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs

Reply via email to