summaryrefslogtreecommitdiff
path: root/includes/specials/SpecialImport.php
diff options
context:
space:
mode:
authorPierre Schmitz <pierre@archlinux.de>2011-04-13 05:42:02 +0200
committerPierre Schmitz <pierre@archlinux.de>2011-04-13 05:42:02 +0200
commit124299758ca7454561118f466a0470905758924f (patch)
treef4d09ea1286d6747ae36aecd4ba28dfb04c9e7c5 /includes/specials/SpecialImport.php
parent3bddedf685051638fdba61268ad195fee041db1c (diff)
update to MediaWiki 1.16.3
Diffstat (limited to 'includes/specials/SpecialImport.php')
-rw-r--r--includes/specials/SpecialImport.php29
1 files changed, 26 insertions, 3 deletions
diff --git a/includes/specials/SpecialImport.php b/includes/specials/SpecialImport.php
index 6beeab7f..248709a8 100644
--- a/includes/specials/SpecialImport.php
+++ b/includes/specials/SpecialImport.php
@@ -45,7 +45,7 @@ class SpecialImport extends SpecialPage {
* Execute
*/
function execute( $par ) {
- global $wgRequest;
+ global $wgRequest, $wgUser, $wgOut;
$this->setHeaders();
$this->outputHeader();
@@ -56,6 +56,28 @@ class SpecialImport extends SpecialPage {
return;
}
+ if( !$wgUser->isAllowed( 'import' ) && !$wgUser->isAllowed( 'importupload' ) )
+ return $wgOut->permissionRequired( 'import' );
+
+ # TODO: allow Title::getUserPermissionsErrors() to take an array
+ # FIXME: Title::checkSpecialsAndNSPermissions() has a very wierd expectation of what
+ # getUserPermissionsErrors() might actually be used for, hence the 'ns-specialprotected'
+ $errors = wfMergeErrorArrays(
+ $this->getTitle()->getUserPermissionsErrors(
+ 'import', $wgUser, true,
+ array( 'ns-specialprotected', 'badaccess-group0', 'badaccess-groups' )
+ ),
+ $this->getTitle()->getUserPermissionsErrors(
+ 'importupload', $wgUser, true,
+ array( 'ns-specialprotected', 'badaccess-group0', 'badaccess-groups' )
+ )
+ );
+
+ if( $errors ){
+ $wgOut->showPermissionsErrorPage( $errors );
+ return;
+ }
+
if ( $wgRequest->wasPosted() && $wgRequest->getVal( 'action' ) == 'submit' ) {
$this->doImport();
}
@@ -84,6 +106,9 @@ class SpecialImport extends SpecialPage {
return $wgOut->permissionRequired( 'importupload' );
}
} elseif ( $sourceName == "interwiki" ) {
+ if( !$wgUser->isAllowed( 'import' ) ){
+ return $wgOut->permissionRequired( 'import' );
+ }
$this->interwiki = $wgRequest->getVal( 'interwiki' );
if ( !in_array( $this->interwiki, $wgImportSources ) ) {
$source = new WikiErrorMsg( "import-invalid-interwiki" );
@@ -133,8 +158,6 @@ class SpecialImport extends SpecialPage {
private function showForm() {
global $wgUser, $wgOut, $wgRequest, $wgImportSources, $wgExportMaxLinkDepth;
- if( !$wgUser->isAllowed( 'import' ) && !$wgUser->isAllowed( 'importupload' ) )
- return $wgOut->permissionRequired( 'import' );
$action = $this->getTitle()->getLocalUrl( array( 'action' => 'submit' ) );