summaryrefslogtreecommitdiff
path: root/includes/specials
diff options
context:
space:
mode:
Diffstat (limited to 'includes/specials')
-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' ) );