r85078 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r85077‎ | r85078 | r85079 >
Date:18:55, 31 March 2011
Author:catrope
Status:ok
Tags:
Comment:
1.17wmf1: Merge r85075 from REL1_17
Modified paths:
  • /branches/wmf/1.17wmf1/includes/specials/SpecialImport.php (modified) (history)

Diff [purge]

Index: branches/wmf/1.17wmf1/includes/specials/SpecialImport.php
@@ -51,7 +51,7 @@
5252 * Execute
5353 */
5454 function execute( $par ) {
55 - global $wgRequest;
 55+ global $wgRequest, $wgUser, $wgOut;
5656
5757 $this->setHeaders();
5858 $this->outputHeader();
@@ -62,6 +62,21 @@
6363 return;
6464 }
6565
 66+ if( !$wgUser->isAllowed( 'import' ) && !$wgUser->isAllowed( 'importupload' ) )
 67+ return $wgOut->permissionRequired( 'import' );
 68+
 69+ # TODO: allow Title::getUserPermissionsErrors() to take an array
 70+ # FIXME: Title::checkSpecialsAndNSPermissions() has a very wierd expectation of what
 71+ # getUserPermissionsErrors() might actually be used for, hence the 'ns-specialprotected'
 72+ $errors = wfMergeErrorArrays(
 73+ $this->getTitle()->getUserPermissionsErrors( 'import', $wgUser, true, array( 'ns-specialprotected' ) ),
 74+ $this->getTitle()->getUserPermissionsErrors( 'importupload', $wgUser, true, array( 'ns-specialprotected' ) )
 75+ );
 76+ if( $errors ){
 77+ $wgOut->showPermissionsErrorPage( $errors );
 78+ return;
 79+ }
 80+
6681 if ( $wgRequest->wasPosted() && $wgRequest->getVal( 'action' ) == 'submit' ) {
6782 $this->doImport();
6883 }
@@ -144,8 +159,6 @@
145160
146161 private function showForm() {
147162 global $wgUser, $wgOut, $wgImportSources, $wgExportMaxLinkDepth;
148 - if( !$wgUser->isAllowed( 'import' ) && !$wgUser->isAllowed( 'importupload' ) )
149 - return $wgOut->permissionRequired( 'import' );
150163
151164 $action = $this->getTitle()->getLocalUrl( array( 'action' => 'submit' ) );
152165

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r85075MFT r85005 & r85006...platonides18:06, 31 March 2011

Status & tagging log