*
*/
function wfSpecialExport( $page = '' ) {
- global $wgOut, $wgRequest, $wgExportAllowListContributors;
+ global $wgOut, $wgRequest, $wgSitename, $wgExportAllowListContributors;
global $wgExportAllowHistory, $wgExportMaxHistory;
$curonly = true;
// This should provide safer streaming for pages with history
wfResetOutputBuffers();
header( "Content-type: application/xml; charset=utf-8" );
+ if( $wgRequest->getCheck( 'wpDownload' ) ) {
+ // Provide a sane filename suggestion
+ $filename = $wgSitename . '-' . wfTimestampNow() . '.xml';
+ $wgRequest->response()->header( "Content-disposition: attachment;filename={$filename}" );
+ }
$pages = explode( "\n", $page );
$db = wfGetDB( DB_SLAVE );
return;
}
- $wgOut->addWikiText( wfMsg( "exporttext" ) );
- $titleObj = SpecialPage::getTitleFor( "Export" );
+ $self = SpecialPage::getTitleFor( 'Export' );
+ $wgOut->addHtml( wfMsgExt( 'exporttext', 'parse' ) );
+
+ $form = Xml::openElement( 'form', array( 'method' => 'post',
+ 'action' => $self->getLocalUrl( 'action=submit' ) ) );
+
+ $form .= Xml::inputLabel( wfMsg( 'export-addcattext' ) , 'catname', 'catname', 40 ) . ' ';
+ $form .= Xml::submitButton( wfMsg( 'export-addcat' ), array( 'name' => 'addcat' ) ) . '<br />';
+
+ $form .= Xml::openElement( 'textarea', array( 'name' => 'pages', 'cols' => 40, 'rows' => 10 ) );
+ $form .= htmlspecialchars( $page );
+ $form .= Xml::closeElement( 'textarea' );
+ $form .= '<br />';
- $form = wfOpenElement( 'form', array( 'method' => 'post', 'action' => $titleObj->getLocalUrl() ) );
-
- $form .= wfInputLabel( wfMsg( 'export-addcattext' ), 'catname', 'catname', 40 ) . ' ';
- $form .= wfSubmitButton( wfMsg( 'export-addcat' ), array( 'name' => 'addcat' ) ) . '<br />';
-
- $form .= wfOpenElement( 'textarea', array( 'name' => 'pages', 'cols' => 40, 'rows' => 10 ) ) . htmlspecialchars($page). '</textarea><br />';
-
if( $wgExportAllowHistory ) {
- $form .= wfCheck( 'curonly', true, array( 'value' => 'true', 'id' => 'curonly' ) );
- $form .= wfLabel( wfMsg( 'exportcuronly' ), 'curonly' ) . '<br />';
+ $form .= Xml::checkLabel( wfMsg( 'exportcuronly' ), 'curonly', 'curonly', true ) . '<br />';
} else {
- $wgOut->addWikiText( wfMsg( 'exportnohistory' ) );
+ $wgOut->addHtml( wfMsgExt( 'exportnohistory', 'parse' ) );
}
- $form .= wfHidden( 'action', 'submit' );
- $form .= wfSubmitButton( wfMsg( 'export-submit' ) ) . '</form>';
+ $form .= Xml::checkLabel( wfMsg( 'export-download' ), 'wpDownload', 'wpDownload', true ) . '<br />';
+
+ $form .= Xml::submitButton( wfMsg( 'export-submit' ) );
+ $form .= Xml::closeElement( 'form' );
$wgOut->addHtml( $form );
-}
-
-
+}
\ No newline at end of file
select whether you want the current version as well as all old versions, with the page
history lines, or just the current version with the info about the last edit.
-In the latter case you can also use a link, e.g. [[{{ns:Special}}:Export/{{MediaWiki:mainpage}}]] for the page {{MediaWiki:mainpage}}.',
+In the latter case you can also use a link, e.g. [[{{ns:Special}}:Export/{{MediaWiki:mainpage}}]] for the page "[[{{MediaWiki:mainpage}}]]".',
'exportcuronly' => 'Include only the current revision, not the full history',
'exportnohistory' => "----
'''Note:''' Exporting the full history of pages through this form has been disabled due to performance reasons.",
'export-submit' => 'Export',
'export-addcattext' => 'Add pages from category:',
'export-addcat' => 'Add',
+'export-download' => 'Offer to save as a file',
# Namespace 8 related
'allmessages' => 'System messages',