r13839 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r13838‎ | r13839 | r13840 >
Date:12:08, 24 April 2006
Author:magnusmanske
Status:old
Tags:
Comment:
small fix for windows
Modified paths:
  • /trunk/wiki2xml/php/sample_local.php (modified) (history)
  • /trunk/wiki2xml/php/w2x.php (modified) (history)

Diff [purge]

Index: trunk/wiki2xml/php/sample_local.php
@@ -22,7 +22,7 @@
2323
2424 ### Uncomment and localize the following to offer ODT export
2525 #$xmlg["zip_odt_path"] = "E:\\Program Files\\7-Zip" ; # Path to the zip/unzip programs; can be omitted if in default execuatable path
26 -#$xmlg["zip_odt"] = '7z.exe a -r -tzip $1 $2' ; # Command to zip directory $1 to file $2
 26+#$xmlg["zip_odt"] = '7z.exe a -r -tzip $1 $2*' ; # Command to zip directory $1 to file $2; NOTE THE '*' AFTER '$2' FOR WINDOWS ONLY!
2727 #$xmlg["unzip_odt"] = '7z.exe x $1 -o$2' ; # Command to unzip file $1 to directory $2
2828
2929
Index: trunk/wiki2xml/php/w2x.php
@@ -110,39 +110,9 @@
111111
112112 # Create ODT structure
113113 $handle = fopen ( $dir . "/content.xml" , "w" ) ;
114 -/* Old code
115 - fwrite ( $handle , $out ) ;
116 - fclose ( $handle ) ;
117 -
118 - # Generate temporary ODT file
119 - $out_file = tempnam($xmlg["temp_dir"], "ODT");
120 - $cmd = $xmlg['zip_odt'] ;
121 - $cmd = str_replace ( '$1' , escapeshellarg ( $out_file ) , $cmd ) ;
122 - $cmd = str_replace ( '$2' , escapeshellarg ( $dir . "/*" ) , $cmd ) ;
123 - @unlink ( $out_file ) ;
124 - exec ( $cmd ) ;
125 -
126 - if ( $format == "odt" ) { # Return ODT file
127 - $filename = $xmlg["book_title"] ;
128 - header('Content-type: application/vnd.oasis.opendocument.text; charset=utf-8');
129 - header('Content-Disposition: inline; filename="'.$filename.'"');
130 - $handle = fopen($out_file, 'rb');
131 - fpassthru ( $handle ) ;
132 - fclose ( $handle ) ;
133 - } else { # Return XML
134 - header('Content-type: text/xml; charset=utf-8');
135 - print str_replace ( ">" , ">\n" , $out ) ;
136 - }
137 -
138 - # Cleanup
139 - SureRemoveDir ( $dir ) ;
140 - @rmdir ( $dir ) ;
141 - @unlink ( $dir_file ) ;
142 - @unlink ( $out_file ) ;
143 - chdir ( $cwd ) ;*/
144 -
145114 if ($handle) {
146115 fwrite ( $handle , $out ) ;
 116+ fclose ( $handle ) ;
147117 # Generate temporary ODT file
148118 $out_file = tempnam($dir, "ODT");
149119 $cmd = $xmlg['zip_odt'] ;

Status & tagging log