*Use appropriate notarget message
authorAaron Schulz <aaron@users.mediawiki.org>
Sun, 22 Mar 2009 12:34:07 +0000 (12:34 +0000)
committerAaron Schulz <aaron@users.mediawiki.org>
Sun, 22 Mar 2009 12:34:07 +0000 (12:34 +0000)
*Moved token check

includes/specials/SpecialRevisiondelete.php

index c888d90..6dc1840 100644 (file)
@@ -41,6 +41,12 @@ class SpecialRevisionDelete extends UnlistedSpecialPage {
                # Only one target set at a time please!
                $i = (bool)$this->file + (bool)$this->oldids + (bool)$this->logids
                        + (bool)$this->artimestamps + (bool)$this->fileids + (bool)$this->oldimgs;
+               # No targets?
+               if( $i == 0 ) {
+                       $wgOut->showErrorPage( 'notargettitle', 'notargettext' );
+                       return;
+               }
+               # Too many targets?
                if( $i !== 1 ) {
                        $wgOut->showErrorPage( 'revdelete-toomanytargets-title', 'revdelete-toomanytargets-text' );
                        return;
@@ -62,11 +68,6 @@ class SpecialRevisionDelete extends UnlistedSpecialPage {
                        $wgOut->showErrorPage( 'revdelete-nologtype-title', 'revdelete-nologtype-text' );
                        return;
                }
-               # Check edit token on submission
-               if( $this->wasPosted && !$wgUser->matchEditToken( $wgRequest->getVal('wpEditToken') ) ) {
-                       $wgOut->addWikiMsg( 'sessionfailure' );
-                       return;
-               }
                # For reviewing deleted files...show it now if allowed
                if( $this->file ) {
                        $oimage = RepoGroup::singleton()->getLocalRepo()->newFromArchiveName( $this->page, $this->file );
@@ -741,7 +742,11 @@ class SpecialRevisionDelete extends UnlistedSpecialPage {
         */
        private function submit( $request ) {
                global $wgUser, $wgOut;
-
+               # Check edit token on submission
+               if( $this->wasPosted && !$wgUser->matchEditToken( $request->getVal('wpEditToken') ) ) {
+                       $wgOut->addWikiMsg( 'sessionfailure' );
+                       return false;
+               }
                $bitfield = $this->extractBitfield( $request );
                $comment = $request->getText( 'wpReason' );
                # Can the user set this field?