diff options
author | Pierre Schmitz <pierre@archlinux.de> | 2007-09-14 13:18:58 +0200 |
---|---|---|
committer | Pierre Schmitz <pierre@archlinux.de> | 2007-09-14 13:18:58 +0200 |
commit | 8f416baead93a48e5799e44b8bd2e2c4859f4e04 (patch) | |
tree | cd47ac55eb80a39e3225e8b4f3161b88ea16c2cf /includes/SpecialExport.php | |
parent | d7d08bd1a17618c7d77a6b9b2989e9f7293d6ed6 (diff) |
auf Version 1.11 aktualisiert; Login-Bug behoben
Diffstat (limited to 'includes/SpecialExport.php')
-rw-r--r-- | includes/SpecialExport.php | 46 |
1 files changed, 27 insertions, 19 deletions
diff --git a/includes/SpecialExport.php b/includes/SpecialExport.php index a597fdd0..12bd4d5c 100644 --- a/includes/SpecialExport.php +++ b/includes/SpecialExport.php @@ -53,7 +53,7 @@ function wfExportGetPagesFromCategory( $title ) { * */ function wfSpecialExport( $page = '' ) { - global $wgOut, $wgRequest, $wgExportAllowListContributors; + global $wgOut, $wgRequest, $wgSitename, $wgExportAllowListContributors; global $wgExportAllowHistory, $wgExportMaxHistory; $curonly = true; @@ -71,7 +71,7 @@ function wfSpecialExport( $page = '' ) { } } } - else if( $wgRequest->wasPosted() ) { + else if( $wgRequest->wasPosted() && $page == '' ) { $page = $wgRequest->getText( 'pages' ); $curonly = $wgRequest->getCheck( 'curonly' ); $rawOffset = $wgRequest->getVal( 'offset' ); @@ -131,6 +131,11 @@ function wfSpecialExport( $page = '' ) { // 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 = urlencode( $wgSitename . '-' . wfTimestampNow() . '.xml' ); + $wgRequest->response()->header( "Content-disposition: attachment;filename={$filename}" ); + } $pages = explode( "\n", $page ); $db = wfGetDB( DB_SLAVE ); @@ -164,25 +169,28 @@ function wfSpecialExport( $page = '' ) { 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 |