X-Git-Url: http://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Fspecials%2FSpecialExport.php;h=c30d962a99f70d6dfc2cf8ad7178d2bd4d7ca23e;hb=53af02ed8202d1663deb1b9af85ed4488357eed8;hp=2cf5bfe73e2b4e66e6183584c54d8e5751732457;hpb=46343ca0dd56a8299f1a4078f45a7efe26de1213;p=lhc%2Fweb%2Fwiklou.git
diff --git a/includes/specials/SpecialExport.php b/includes/specials/SpecialExport.php
index 2cf5bfe73e..c30d962a99 100644
--- a/includes/specials/SpecialExport.php
+++ b/includes/specials/SpecialExport.php
@@ -37,12 +37,9 @@ class SpecialExport extends SpecialPage {
}
public function execute( $par ) {
- global $wgSitename, $wgExportAllowListContributors, $wgExportFromNamespaces;
- global $wgExportAllowHistory, $wgExportMaxHistory, $wgExportMaxLinkDepth;
- global $wgExportAllowAll;
-
$this->setHeaders();
$this->outputHeader();
+ $config = $this->getConfig();
// Set some variables
$this->curonly = true;
@@ -74,7 +71,7 @@ class SpecialExport extends SpecialPage {
}
}
}
- } elseif ( $request->getCheck( 'addns' ) && $wgExportFromNamespaces ) {
+ } elseif ( $request->getCheck( 'addns' ) && $config->get( 'ExportFromNamespaces' ) ) {
$page = $request->getText( 'pages' );
$nsindex = $request->getText( 'nsindex', '' );
@@ -87,7 +84,7 @@ class SpecialExport extends SpecialPage {
$page .= "\n" . implode( "\n", $nspages );
}
}
- } elseif ( $request->getCheck( 'exportall' ) && $wgExportAllowAll ) {
+ } elseif ( $request->getCheck( 'exportall' ) && $config->get( 'ExportAllowAll' ) ) {
$this->doExport = true;
$exportall = true;
@@ -108,19 +105,20 @@ class SpecialExport extends SpecialPage {
$offset = null;
}
+ $maxHistory = $config->get( 'ExportMaxHistory' );
$limit = $request->getInt( 'limit' );
$dir = $request->getVal( 'dir' );
$history = array(
'dir' => 'asc',
'offset' => false,
- 'limit' => $wgExportMaxHistory,
+ 'limit' => $maxHistory,
);
$historyCheck = $request->getCheck( 'history' );
if ( $this->curonly ) {
$history = WikiExporter::CURRENT;
} elseif ( !$historyCheck ) {
- if ( $limit > 0 && ( $wgExportMaxHistory == 0 || $limit < $wgExportMaxHistory ) ) {
+ if ( $limit > 0 && ( $maxHistory == 0 || $limit < $maxHistory ) ) {
$history['limit'] = $limit;
}
@@ -152,13 +150,13 @@ class SpecialExport extends SpecialPage {
}
}
- if ( !$wgExportAllowHistory ) {
+ if ( !$config->get( 'ExportAllowHistory' ) ) {
// Override
$history = WikiExporter::CURRENT;
}
$list_authors = $request->getCheck( 'listauthors' );
- if ( !$this->curonly || !$wgExportAllowListContributors ) {
+ if ( !$this->curonly || !$config->get( 'ExportAllowListContributors' ) ) {
$list_authors = false;
}
@@ -172,7 +170,7 @@ class SpecialExport extends SpecialPage {
if ( $request->getCheck( 'wpDownload' ) ) {
// Provide a sane filename suggestion
- $filename = urlencode( $wgSitename . '-' . wfTimestampNow() . '.xml' );
+ $filename = urlencode( $config->get( 'Sitename' ) . '-' . wfTimestampNow() . '.xml' );
$request->response()->header( "Content-disposition: attachment;filename={$filename}" );
}
@@ -184,20 +182,27 @@ class SpecialExport extends SpecialPage {
$out = $this->getOutput();
$out->addWikiMsg( 'exporttext' );
+ if ( $page == '' ) {
+ $categoryName = $request->getText( 'catname' );
+ } else {
+ $categoryName = '';
+ }
+
$form = Xml::openElement( 'form', array( 'method' => 'post',
'action' => $this->getPageTitle()->getLocalURL( 'action=submit' ) ) );
$form .= Xml::inputLabel(
$this->msg( 'export-addcattext' )->text(),
'catname',
'catname',
- 40
+ 40,
+ $categoryName
) . ' ';
$form .= Xml::submitButton(
$this->msg( 'export-addcat' )->text(),
array( 'name' => 'addcat' )
) . '
';
- if ( $wgExportFromNamespaces ) {
+ if ( $config->get( 'ExportFromNamespaces' ) ) {
$form .= Html::namespaceSelector(
array(
'selected' => $nsindex,
@@ -214,7 +219,7 @@ class SpecialExport extends SpecialPage {
) . '
';
}
- if ( $wgExportAllowAll ) {
+ if ( $config->get( 'ExportAllowAll' ) ) {
$form .= Xml::checkLabel(
$this->msg( 'exportall' )->text(),
'exportall',
@@ -231,7 +236,7 @@ class SpecialExport extends SpecialPage {
);
$form .= '
';
- if ( $wgExportAllowHistory ) {
+ if ( $config->get( 'ExportAllowHistory' ) ) {
$form .= Xml::checkLabel(
$this->msg( 'exportcuronly' )->text(),
'curonly',
@@ -249,7 +254,7 @@ class SpecialExport extends SpecialPage {
$request->wasPosted() ? $request->getCheck( 'templates' ) : false
) . '
';
- if ( $wgExportMaxLinkDepth || $this->userCanOverrideExportDepth() ) {
+ if ( $config->get( 'ExportMaxLinkDepth' ) || $this->userCanOverrideExportDepth() ) {
$form .= Xml::inputLabel(
$this->msg( 'export-pagelinks' )->text(),
'pagelink-depth',
@@ -274,7 +279,7 @@ class SpecialExport extends SpecialPage {
$request->wasPosted() ? $request->getCheck( 'wpDownload' ) : true
) . '
';
- if ( $wgExportAllowListContributors ) {
+ if ( $config->get( 'ExportAllowListContributors' ) ) {
$form .= Xml::checkLabel(
$this->msg( 'exportlistauthors' )->text(),
'listauthors',
@@ -487,15 +492,14 @@ class SpecialExport extends SpecialPage {
* @return int
*/
private function validateLinkDepth( $depth ) {
- global $wgExportMaxLinkDepth;
-
if ( $depth < 0 ) {
return 0;
}
if ( !$this->userCanOverrideExportDepth() ) {
- if ( $depth > $wgExportMaxLinkDepth ) {
- return $wgExportMaxLinkDepth;
+ $maxLinkDepth = $this->getConfig()->get( 'ExportMaxLinkDepth' );
+ if ( $depth > $maxLinkDepth ) {
+ return $maxLinkDepth;
}
}