Removed thumb area restriction code, added code to chck for zero-sized thumbnails
[lhc/web/wiklou.git] / includes / SpecialExport.php
index b70e8b2..4ce8d3c 100644 (file)
@@ -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 = "<mediawiki version=\"0.1\" xml:ns=\"$wgLanguageCode\">\n";
+       $xml = "<" . "?xml version=\"1.0\" encoding=\"UTF-8\" ?" . ">\n" .
+               "<mediawiki version=\"0.1\" xml:lang=\"$wgLanguageCode\">\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 .= "      <comment>$c</comment>\n";
        }
-       $t = htmlspecialchars( $s->text );
+       $t = htmlspecialchars( Article::getRevisionText( $s, "" ) );
        $xml .= "      <text>$t</text>\n";
        $xml .= "    </revision>\n";
        return $xml;