X-Git-Url: http://git.cyclocoop.org/?a=blobdiff_plain;f=includes%2FSpecialExport.php;h=4ce8d3c26392542395fa5fdb7ca98b7dcb17a96b;hb=b6927811dce29c610aa5c07ca981df8699a518c4;hp=b70e8b2304c5c33ebe2e09556fcfdb3af1785f64;hpb=eee45843b02c763d541a6422d715aca5798fd9cc;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/SpecialExport.php b/includes/SpecialExport.php index b70e8b2304..4ce8d3c263 100644 --- a/includes/SpecialExport.php +++ b/includes/SpecialExport.php @@ -15,8 +15,7 @@ function wfSpecialExport( $page = "" ) { $pages = explode( "\n", $page ); $xml = pages2xml( $pages, $curonly ); echo $xml; - # exit(1) actually prints 1 in some PHP versions - exit(""); + wfAbruptExit(); } $wgOut->addWikiText( wfMsg( "exporttext" ) ); @@ -34,7 +33,8 @@ function wfSpecialExport( $page = "" ) { function pages2xml( $pages, $curonly = false ) { global $wgLanguageCode, $wgInputEncoding, $wgLang; - $xml = "\n"; + $xml = "<" . "?xml version=\"1.0\" encoding=\"UTF-8\" ?" . ">\n" . + "\n"; foreach( $pages as $page ) { $xml .= page2xml( $page, $curonly ); } @@ -47,6 +47,7 @@ function pages2xml( $pages, $curonly = false ) { function page2xml( $page, $curonly, $full = false ) { global $wgInputCharset, $wgLang; $title = Title::NewFromText( $page ); + if( !$title ) return ""; $t = wfStrencode( $title->getDBKey() ); $ns = $title->getNamespace(); $sql = "SELECT cur_id as id,cur_timestamp as timestamp,cur_user as user,cur_user_text as user_text," . @@ -65,12 +66,12 @@ function page2xml( $page, $curonly, $full = false ) { } if( !$curonly ) { $sql = "SELECT old_id as id,old_timestamp as timestamp, old_user as user, old_user_text as user_text," . - "old_comment as comment, old_text as text FROM old " . + "old_comment as comment, old_text as text, old_flags as flags FROM old " . "WHERE old_namespace=$ns AND old_title='$t' ORDER BY old_timestamp"; $res = wfQuery( $sql, DB_READ ); - while( $s = wfFetchObject( $res ) ) { - $xml .= revision2xml( $s, $full, false ); + while( $s2 = wfFetchObject( $res ) ) { + $xml .= revision2xml( $s2, $full, false ); } } $xml .= revision2xml( $s, $full, true ); @@ -102,7 +103,7 @@ function revision2xml( $s, $full, $cur ) { $c = htmlspecialchars( $s->comment ); $xml .= " $c\n"; } - $t = htmlspecialchars( $s->text ); + $t = htmlspecialchars( Article::getRevisionText( $s, "" ) ); $xml .= " $t\n"; $xml .= " \n"; return $xml;