X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;ds=sidebyside;f=includes%2Fspecials%2FSpecialExport.php;h=06bf34a1507de736969ce233e983f6adc855c43e;hb=006728faeda236f19cac23de961d068a9fb42835;hp=83d0bbf59951c6f8ed982348c8b047503b7d640b;hpb=c3b448c4ff466da2353d26dc12e83c773f21a5e8;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/specials/SpecialExport.php b/includes/specials/SpecialExport.php index 83d0bbf599..06bf34a150 100644 --- a/includes/specials/SpecialExport.php +++ b/includes/specials/SpecialExport.php @@ -33,6 +33,7 @@ class SpecialExport extends SpecialPage { public function execute( $par ) { global $wgOut, $wgRequest, $wgSitename, $wgExportAllowListContributors; global $wgExportAllowHistory, $wgExportMaxHistory, $wgExportMaxLinkDepth; + global $wgExportFromNamespaces; $this->setHeaders(); $this->outputHeader(); @@ -44,6 +45,7 @@ class SpecialExport extends SpecialPage { $this->images = $wgRequest->getCheck( 'images' ); // Doesn't do anything yet $this->pageLinkDepth = $this->validateLinkDepth( $wgRequest->getIntOrNull( 'pagelink-depth' ) ); + $nsindex = ''; if ( $wgRequest->getCheck( 'addcat' ) ) { $page = $wgRequest->getText( 'pages' ); @@ -62,11 +64,11 @@ class SpecialExport extends SpecialPage { } } } - else if( $wgRequest->getCheck( 'addns' ) ) { + else if( $wgRequest->getCheck( 'addns' ) && $wgExportFromNamespaces ) { $page = $wgRequest->getText( 'pages' ); - $nsindex = $wgRequest->getText( 'nsindex' ); + $nsindex = $wgRequest->getText( 'nsindex', '' ); - if ( $nsindex !== '' && $nsindex !== NULL && $nsindex !== false ) { + if ( $nsindex !== '' && $nsindex !== null && $nsindex !== false ) { /** * Same implementation as above, so same @fixme */ @@ -149,8 +151,10 @@ class SpecialExport extends SpecialPage { $form .= Xml::inputLabel( wfMsg( 'export-addcattext' ) , 'catname', 'catname', 40 ) . ' '; $form .= Xml::submitButton( wfMsg( 'export-addcat' ), array( 'name' => 'addcat' ) ) . '
'; - $form .= Xml::namespaceSelector( '', null, 'nsindex', wfMsg( 'export-addnstext' ) ) . ' '; - $form .= Xml::submitButton( wfMsg( 'export-addns' ), array( 'name' => 'addns' ) ) . '
'; + if ( $wgExportFromNamespaces ) { + $form .= Xml::namespaceSelector( $nsindex, null, 'nsindex', wfMsg( 'export-addnstext' ) ) . ' '; + $form .= Xml::submitButton( wfMsg( 'export-addns' ), array( 'name' => 'addns' ) ) . '
'; + } $form .= Xml::element( 'textarea', array( 'name' => 'pages', 'cols' => 40, 'rows' => 10 ), $page, false ); $form .= '
'; @@ -175,8 +179,8 @@ class SpecialExport extends SpecialPage { private function userCanOverrideExportDepth() { global $wgUser; - - return in_array( 'override-export-depth', $wgUser->getRights()); + + return $wgUser->isAllowed( 'override-export-depth' ); } /** @@ -207,7 +211,13 @@ class SpecialExport extends SpecialPage { */ $pages = array_keys( $pageSet ); - + + // Normalize titles to the same format and remove dupes, see bug 17374 + foreach( $pages as $k => $v ) { + $pages[$k] = str_replace( " ", "_", $v ); + } + $pages = array_unique( $pages ); + /* Ok, let's get to it... */ if( $history == WikiExporter::CURRENT ) { $lb = false; @@ -343,6 +353,7 @@ class SpecialExport extends SpecialPage { $pageSet = $this->getLinks( $inputPages, $pageSet, 'pagelinks', array( 'pl_namespace AS namespace', 'pl_title AS title' ), array( 'page_id=pl_from' ) ); + $inputPages = array_keys( $pageSet ); } return $pageSet; }