From b820f409aa50e1bd90cc64a78b3c9e5b436c3cc4 Mon Sep 17 00:00:00 2001 From: Andreas Moik Date: Thu, 28 Jul 2016 16:55:09 +0200 Subject: [PATCH] bugfix --- content/dokumentenakt.pdf.php | 7 ++----- include/dokument_export.class.php | 8 ++++---- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/content/dokumentenakt.pdf.php b/content/dokumentenakt.pdf.php index de6401bdf..95c2ae585 100755 --- a/content/dokumentenakt.pdf.php +++ b/content/dokumentenakt.pdf.php @@ -69,7 +69,6 @@ foreach($prestudent_ids as $pid) cleanUpAndDie($p->t('tools/studentWurdeNichtGefunden')."(".$pid.")", $tmpDir); - /* * Get all Documents */ @@ -108,7 +107,6 @@ foreach($prestudent_ids as $pid) if($filename == "") continue; - /* * Determine the filetype * and convert, if nessecary @@ -148,15 +146,14 @@ foreach($prestudent_ids as $pid) if(!$doc->create('pdf')) die($doc->errormsg); - $document = $doc->output(false); $filename = $tmpDir.'/'.uniqid(); - file_put_contents($filename, $document); + file_put_contents($filename, $doc->output(false)); $doc->close(); $allDocs[] = $filename; $allDocs = array_merge($allDocs, $preDocs); + unset($doc); } - /* * generate the merged PDF */ diff --git a/include/dokument_export.class.php b/include/dokument_export.class.php index f78a8c86e..14aadac40 100644 --- a/include/dokument_export.class.php +++ b/include/dokument_export.class.php @@ -168,7 +168,7 @@ class dokument_export $contentbuffer = $proc->transformToXml($this->xml_data); - $this->temp_folder = '/tmp/fhcunoconv-'.uniqid(); + $this->temp_folder = sys_get_temp_dir().'/fhcunoconv-'.uniqid(); mkdir($this->temp_folder); chdir($this->temp_folder); file_put_contents('content.xml', $contentbuffer); @@ -201,7 +201,8 @@ class dokument_export if(!$vorlage_found) $zipfile = DOC_ROOT.'system/vorlage_zip/'.$this->vorlage_file; - $tempname_zip = 'out.zip'; + $tempname_zip = $this->temp_folder . '/out.zip'; + if(!copy($zipfile, $tempname_zip)) die('copy failed'); @@ -254,7 +255,7 @@ class dokument_export switch($this->outputformat) { case 'pdf': - $this->temp_filename='out.pdf'; + $this->temp_filename = $this->temp_folder . '/out.pdf'; exec("unoconv -e IsSkipEmptyPages=false --stdout -f pdf $tempname_zip > ".$this->temp_filename, $out, $ret); if($ret!=0) @@ -408,7 +409,6 @@ class dokument_export $command = 'unoconv --format %s --output %s %s'; $command = sprintf($command, $format, $outFile, $inFile); - exec($command, $out, $ret); if($ret!=0) {