Index: trunk/wiki2xml/php/sample_local.php |
— | — | @@ -22,7 +22,7 @@ |
23 | 23 | |
24 | 24 | ### Uncomment and localize the following to offer ODT export |
25 | 25 | #$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! |
27 | 27 | #$xmlg["unzip_odt"] = '7z.exe x $1 -o$2' ; # Command to unzip file $1 to directory $2 |
28 | 28 | |
29 | 29 | |
Index: trunk/wiki2xml/php/w2x.php |
— | — | @@ -110,39 +110,9 @@ |
111 | 111 | |
112 | 112 | # Create ODT structure |
113 | 113 | $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 | | - |
145 | 114 | if ($handle) { |
146 | 115 | fwrite ( $handle , $out ) ; |
| 116 | + fclose ( $handle ) ; |
147 | 117 | # Generate temporary ODT file |
148 | 118 | $out_file = tempnam($dir, "ODT"); |
149 | 119 | $cmd = $xmlg['zip_odt'] ; |