First commit

This commit is contained in:
Paolo
2021-10-04 14:05:10 +02:00
parent 825a440ef3
commit ab59c265d4
2 changed files with 148 additions and 35 deletions
+36 -35
View File
@@ -37,7 +37,6 @@ class dokument_export
private $images=array();
private $sourceDir;
public $errormsg;
private $unoconv_version;
private $sign;
private $sign_user;
private $sign_profile;
@@ -50,18 +49,6 @@ class dokument_export
if(!isset($vorlage))
return;
exec('unoconv --version',$ret_arr);
if(isset($ret_arr[0]))
{
$hlp = explode(' ',$ret_arr[0]);
if(isset($hlp[1]))
$this->unoconv_version = $hlp[1];
else
die('Could not get Unoconv Version');
}
else
die('Unoconv not found');
//Vorlage aus der Datenbank holen
$this->vorlage = new vorlage();
if(!$this->vorlage->getAktuelleVorlage($oe_kurzbz, $vorlage, $version))
@@ -281,20 +268,27 @@ class dokument_export
// Unoconv Version 0.6 hat eine Bug wodurch die Berechtigungen des PDF/Doc nicht korrekt gesetzt
// werden. Deshalb wird dies hier speziell behandelt.
// Die 2. Variante hat den Vorteil dass hier eine bessere Fehlerbehandlung moeglich ist
if($this->unoconv_version=='0.6')
$command = 'unoconv -e IsSkipEmptyPages=false -f ' . $this->outputformat . ' %2$s > %1$s';
else
$command = 'unoconv -e IsSkipEmptyPages=false -f ' . $this->outputformat . ' --output %s %s 2>&1';
//if($this->unoconv_version=='0.6')
// $command = 'unoconv -e IsSkipEmptyPages=false -f ' . $this->outputformat . ' %2$s > %1$s';
//else
// $command = 'unoconv -e IsSkipEmptyPages=false -f ' . $this->outputformat . ' --output %s %s 2>&1';
$command = sprintf($command, $this->temp_filename, $tempname_zip);
//$command = sprintf($command, $this->temp_filename, $tempname_zip);
exec($command, $out, $ret);
//exec($command, $out, $ret);
if($ret!=0)
{
$this->errormsg = 'Dokumentenkonvertierung ist derzeit nicht möglich. Bitte versuchen Sie es in einer Minute erneut oder kontaktieren Sie einen Administrator';
return false;
}
require_once('Docsbox.php');
var_dump($tempname_zip);
var_dump($this->temp_filename);
Docsbox::convert($tempname_zip, $this->temp_filename);
//if($ret!=0)
//{
// $this->errormsg = 'Dokumentenkonvertierung ist derzeit nicht möglich. Bitte versuchen Sie es in einer Minute erneut oder kontaktieren Sie einen Administrator';
// return false;
//}
break;
case 'odt':
default:
@@ -455,19 +449,26 @@ class dokument_export
*/
public function convert($inFile, $outFile, $format = "pdf")
{
if($this->unoconv_version=='0.6')
$command = 'unoconv -f %1$s %3$s > %2$s';
else
$command = 'unoconv -f %s --output %s %s 2>&1';
$command = sprintf($command, $format, $outFile, $inFile);
//require_once('Docsbox.php');
exec($command, $out, $ret);
//var_dump($inFile);
//var_dump($outFile);
if($ret!=0)
{
$this->errormsg = 'Dokumentenkonvertierung ist derzeit nicht möglich. Bitte versuchen Sie es in einer Minute erneut oder kontaktieren Sie einen Administrator';
return false;
}
//Docsbox::convert();
//if($this->unoconv_version=='0.6')
// $command = 'unoconv -f %1$s %3$s > %2$s';
//else
// $command = 'unoconv -f %s --output %s %s 2>&1';
//$command = sprintf($command, $format, $outFile, $inFile);
//exec($command, $out, $ret);
//if($ret!=0)
//{
// $this->errormsg = 'Dokumentenkonvertierung ist derzeit nicht möglich. Bitte versuchen Sie es in einer Minute erneut oder kontaktieren Sie einen Administrator';
// return false;
//}
return true;
}