2 # Copyright (C) 2003 Brion Vibber <brion@pobox.com>
3 # http://www.mediawiki.org/
5 # This program is free software; you can redistribute it and/or modify
6 # it under the terms of the GNU General Public License as published by
7 # the Free Software Foundation; either version 2 of the License, or
8 # (at your option) any later version.
10 # This program is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 # GNU General Public License for more details.
15 # You should have received a copy of the GNU General Public License along
16 # with this program; if not, write to the Free Software Foundation, Inc.,
17 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18 # http://www.gnu.org/copyleft/gpl.html
22 * @subpackage SpecialPage
26 require_once( 'Export.php' );
31 function wfSpecialExport( $page = '' ) {
32 global $wgOut, $wgRequest, $wgExportAllowListContributors;
33 global $wgExportAllowHistory;
35 if( $wgRequest->getVal( 'action' ) == 'submit') {
36 $page = $wgRequest->getText( 'pages' );
37 if( $wgExportAllowHistory ) {
38 $curonly = $wgRequest->getCheck( 'curonly' );
43 # Pre-check the 'current version only' box in the UI
47 $list_authors = $wgRequest->getCheck( 'listauthors' );
48 if ( !$curonly ||
!$wgExportAllowListContributors ) $list_authors = false ;
52 header( "Content-type: application/xml; charset=utf-8" );
53 $pages = explode( "\n", $page );
55 $db =& wfGetDB( DB_SLAVE
);
56 $history = $curonly ? MW_EXPORT_CURRENT
: MW_EXPORT_FULL
;
57 $exporter = new WikiExporter( $db, $history );
58 $exporter->list_authors
= $list_authors ;
59 $exporter->openStream();
60 $exporter->pagesByName( $pages );
61 $exporter->closeStream();
65 $wgOut->addWikiText( wfMsg( "exporttext" ) );
66 $titleObj = Title
::makeTitle( NS_SPECIAL
, "Export" );
67 $action = $titleObj->escapeLocalURL( 'action=submit' );
68 if( $wgExportAllowHistory ) {
69 $checkbox = "<label><input type='checkbox' name='curonly' value='true' checked='checked' />
70 " . wfMsgHtml( 'exportcuronly' ) . "</label><br />";
73 $wgOut->addWikiText( wfMsg( "exportnohistory" ) );
76 <form method='post' action=\"$action\">
77 <input type='hidden' name='action' value='submit' />
78 <textarea name='pages' cols='40' rows='10'></textarea><br />
80 <input type='submit' />