if (isset($xmlg["zip_odt_path"])) { # Windows strange bug workaround $zipdir = $xmlg["zip_odt_path"]; } chdir($zipdir); # Unzip template $cmd = $xmlg['unzip_odt']; $cmd = str_replace('$1', escapeshellarg($template_file), $cmd); $cmd = str_replace('$2', escapeshellarg($dir), $cmd); exec($cmd); # Convert XML to ODT chdir($cwd); if ($format == "odt_xml") { $content_provider->block_file_download = true; } $out = $converter->articles2odt($xml, $xmlg); chdir($zipdir); # Create ODT structure $handle = fopen($dir . "/content.xml", "w"); if ($handle) { fwrite($handle, $out); fclose($handle); # Generate temporary ODT file $out_file = tempnam('', "ODT"); $cmd = $xmlg['zip_odt']; $cmd = str_replace('$1', escapeshellarg($out_file), $cmd); if ($xmlg['is_windows']) { $cmd = str_replace('$2', escapeshellarg($dir . "/"), $cmd); } else { $cmd = str_replace('$2', escapeshellarg('./'), $cmd); # linux/unix zip needs to be in the directory, otherwise it will