Example #1
0
         SureRemoveDir($dir);
         @rmdir($dir);
         @unlink($dir_file);
         @unlink($out_file);
         chdir($cwd);
     }
     # error occured
 } else {
     if ($format == "docbook_xml") {
         $out = $converter->articles2docbook_xml($xml, $xmlg);
         header('Content-type: text/xml; charset=utf-8');
         print $out;
     } else {
         if ($format == "docbook_pdf" || $format == "docbook_html") {
             $filetype = substr($format, 8);
             $filename = $converter->articles2docbook_pdf($xml, $xmlg, strtoupper($filetype));
             if (file_exists($filename)) {
                 $fp = fopen($filename, 'rb');
                 if ($format == "docbook_pdf") {
                     header('Content-Type: application/pdf');
                     header("Content-Length: " . (string) filesize($filename));
                     header('Content-Disposition: attachment; filename="' . $xmlg["book_title"] . '.pdf"');
                 } else {
                     if ($format == "docbook_html") {
                         header('Content-Type: text/html');
                         header("Content-Length: " . (string) filesize($filename));
                         header('Content-Disposition: inline; filename="' . $xmlg["book_title"] . '.html"');
                     }
                 }
                 fpassthru($fp);
                 fclose($fp);