PDF: Unicode-Schriften und temporaere Dateien 20 Minuten statt Sekunden

- makepdf.php nutzt FreeSerif/FreeSans (bei TCPDF dabei) statt der
  eingebauten PDF-Schriften Times/Helvetica. Die kennen nur westeuropaeische
  Zeichen, Namen wie Dvorak mit Hacek oder Lukasz mit L-Strich wurden zu
  "?". Die Breiten weichen um hoechstens 0,8 % (Serif) bzw. 3 % (Sans) ab.
  Die Schriften stehen als Konstanten PDF_SCHRIFT_SERIF/-_SANS an einer
  Stelle. Die PDFs werden durch die eingebetteten Zeichen etwa 130 KB
  groesser.
- savePDF() und makeImageFromPDF() raeumten Dateien auf, die aelter als
  20 Sekunden waren; laut Kommentar waren Minuten gemeint. Oeffneten zwei
  Personen kurz nacheinander Dokumente, konnte das PDF der ersten weg sein,
  bevor ihr Browser es geladen hatte. Jetzt PDF_TEMP_MAX_ALTER = 20 Minuten.

Getestet: Rechnungs-PDF fuer alle drei Briefkoepfe mit Namen/Firma in
tschechischen und polnischen Zeichen, im Browser gerendert; Aufraeumen
mit 5, 19 und 25 Minuten alten Dateien.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
2026-09-17 11:33:54 +02:00
co-authored by Claude Opus 5
parent 8fe43d6802
commit 3f7d070d7f
2 changed files with 100 additions and 87 deletions
+1
View File
@@ -106,6 +106,7 @@ SQL wird durchgehend per String-Verkettung gebaut. Escaping ist Handarbeit über
- **`smarty/` enthält Smarty 4.5.6** — der schlichte Verzeichnisname sagt nichts über die Version.
- **PHPMailer liegt in zwei Versionen parallel und beide sind aktiv:** `index.php` lädt `incs/PHPMailer_v6` für den Rechnungsversand, `sites/projectadd.php` dagegen `incs/PHPMailer_v5.1`. Keine der beiden ist entfernbar, ohne den jeweiligen Aufrufer umzustellen.
- **PDF-Schriften nur über `PDF_SCHRIFT_SERIF` / `PDF_SCHRIFT_SANS`** (oben in `incs/makepdf.php`, FreeSerif/FreeSans). Die eingebauten PDF-Schriften Times/Helvetica können nur westeuropäische Zeichen; aus ř, ł, č würde ein „?“.
- **`incs/font/` gehört zu pChart, nicht zu TCPDF.** Die TTFs dort werden von `stats.php` für die Diagramme geladen; TCPDF bringt seine Schriften in `incs/tcpdf/fonts/` selbst mit.
- **`index.php` setzt `error_reporting(E_ERROR | E_PARSE)`.** Warnungen und Notices sind unterdrückt, und der Code verlässt sich darauf — nicht ohne Not hochdrehen, sonst überflutet es die Ausgabe.
- **`templates_c/`, `ajax/templates_c/` und `temp/` müssen für den Webserver schreibbar sein.** Sie sind git-ignoriert und nur über `.gitkeep` im Repo vorhanden.
+99 -87
View File
@@ -1,6 +1,18 @@
<?php
require_once('tcpdf/tcpdf.php');
// Unicode-Schriften statt der eingebauten PDF-Schriften Times/Helvetica: Die kennen
// nur westeuropäische Zeichen, aus ř, ł, č usw. würde ein "?". FreeSerif und
// FreeSans (bei TCPDF dabei) sind im Schriftbild und in der Breite nahezu gleich.
define("PDF_SCHRIFT_SERIF", "freeserif");
define("PDF_SCHRIFT_SANS", "freesans");
// Temporäre PDFs und Vorschaubilder in temp/ werden beim Erzeugen neuer Dateien
// aufgeräumt, wenn sie älter sind als dies (Sekunden). Früher stand hier 20 -
// gemeint waren Minuten: Bei 20 Sekunden konnte ein PDF verschwinden, bevor der
// Browser es geladen hatte, sobald jemand anderes eins erzeugte.
define("PDF_TEMP_MAX_ALTER", 20 * 60);
function makerawPDF($ajax)
{
@@ -45,13 +57,13 @@ function makerawPDF($ajax)
$this->SetY(-16.5);
$linepos=$this->GetY();
$this->setX(30);
$this->SetFont('Times','',9);
$this->SetFont(PDF_SCHRIFT_SERIF,'',9);
$this->SetTextColor(20,47,119);
$this->Cell(180,5,'Seite '.$this->getAliasNumPage().' von '.$this->getAliasNbPages(),0,0,'R');
$this->SetY(-16.3);
$this->setX(15);
//Arial fett 6
$this->SetFont('helvetica','B',7);
$this->SetFont(PDF_SCHRIFT_SANS,'B',7);
//Seitenzahl
$this->SetDrawColor(20,47,119);
@@ -100,12 +112,12 @@ function makerawPDF($ajax)
//Position 1,5 cm von unten
$this->SetY(-23);
$this->setX(30);
$this->SetFont('Times','',9);
$this->SetFont(PDF_SCHRIFT_SERIF,'',9);
$this->SetTextColor(0,0,0);
$this->Cell(180,5,'Seite '.$this->getAliasNumPage().' von '.$this->getAliasNbPages(),0,0,'R');
$this->SetY(-19);
//Arial fett 6
$this->SetFont('helvetica','B',8);
$this->SetFont(PDF_SCHRIFT_SANS,'B',8);
$this->SetTextColor(124,124,138);
//Seitenzahl
$this->setX(15);
@@ -164,13 +176,13 @@ function makerawPDF($ajax)
//Position 1,5 cm von unten
$this->SetY(-17);
$this->setX(30);
$this->SetFont('Times','',9);
$this->SetFont(PDF_SCHRIFT_SERIF,'',9);
$this->SetTextColor(0,0,0);
$this->Cell(180,5,'Seite '.$this->getAliasNumPage().' von '.$this->getAliasNbPages(),0,0,'R');
$this->SetY(-10);
$this->setX(15);
//Arial fett 6
$this->SetFont('helvetica','B',6);
$this->SetFont(PDF_SCHRIFT_SANS,'B',6);
$this->SetTextColor(124,124,138);
//Seitenzahl
@@ -214,7 +226,7 @@ function makeumschlagAddress($ajax, $address){
$pdf->SetAutoPageBreak(true,5);
$pdf->AddPage("L",$pagelayout);
$pdf->SetFont('Times','',12);
$pdf->SetFont(PDF_SCHRIFT_SERIF,'',12);
$pdf->setY(55);
$pdf->setX(140);
$pdf->MultiCell(75,50,str_replace("<br />","\n",$address["adresse"]),0,"L",0);
@@ -261,7 +273,7 @@ function makerawPDFcopy($ajax)
{
$this->SetY(-17);
$this->setX(30);
$this->SetFont('Times','',9);
$this->SetFont(PDF_SCHRIFT_SERIF,'',9);
$this->SetTextColor(0,0,0);
$this->Cell(180,5,'Seite '.$this->getAliasNumPage().' von '.$this->getAliasNbPages(),0,0,'R');
$this->SetY(-10);
@@ -303,7 +315,7 @@ function makerawPDFanfahrt($ajax)
{
$this->SetY(-17);
$this->setX(30);
$this->SetFont('Times','',9);
$this->SetFont(PDF_SCHRIFT_SERIF,'',9);
$this->SetTextColor(0,0,0);
$this->Cell(180,5,'Seite '.$this->getAliasNumPage().' von '.$this->getAliasNbPages(),0,0,'R');
$this->SetY(-10);
@@ -329,13 +341,13 @@ function makefirstpage($pdf,$adresse,$rechnung,$ajax)
//$pdf->SetDrawColor(0,0,0);
if($_SESSION["firma"] == "Wagner Markisen")
{
$pdf->SetFont('helvetica','B',10);
$pdf->SetFont(PDF_SCHRIFT_SANS,'B',10);
$pdf->setY(52);
$pdf->setX(165);
$pdf->cell(40,5,"Öffnungszeiten:",0,0);
$pdf->ln(5);
$pdf->setX(165);
$pdf->SetFont('helvetica','',9);
$pdf->SetFont(PDF_SCHRIFT_SANS,'',9);
$pdf->cell(12,4,"Mo.:");
$pdf->cell(20,4," 8:00 bis 12:00",0,0);
$pdf->ln(3.8);
@@ -361,7 +373,7 @@ function makefirstpage($pdf,$adresse,$rechnung,$ajax)
}
//STORNO!!!
if($rechnung["storno"] == 1){
$pdf->SetFont('helvetica','B',75);
$pdf->SetFont(PDF_SCHRIFT_SANS,'B',75);
$pdf->setY(135);
$pdf->setX(70);
$pdf->SetTextColor(200,0,0);
@@ -372,7 +384,7 @@ function makefirstpage($pdf,$adresse,$rechnung,$ajax)
}
//ADRESSE!!!!
$pdf->SetFont('helvetica','B',6);
$pdf->SetFont(PDF_SCHRIFT_SANS,'B',6);
$pdf->setY(35);
$pdf->setX(25);
@@ -392,7 +404,7 @@ function makefirstpage($pdf,$adresse,$rechnung,$ajax)
$pdf->Cell(0,3,'LSG OBERALLGÄU e.V. PHILIPP WAGNER IM ENGELFELD 13 87509 IMMENSTADT TEL.: 0176/21938558',0,0,'L');
}
$pdf->SetTextColor(0,0,0);
$pdf->SetFont('Times','',12);
$pdf->SetFont(PDF_SCHRIFT_SERIF,'',12);
$pdf->setY(40);
$pdf->setX(25);
$pdf->MultiCell(75,45,str_replace("<br />","\n",$adresse),0,"L",0);
@@ -402,7 +414,7 @@ function makefirstpage($pdf,$adresse,$rechnung,$ajax)
$datum=strftime("%d.%m.%Y",strtotime($rechnung["datetime"]));
$pdf->Cell(0,5,$datum,0,0,'L');
//typ
$pdf->SetFont('Times','B',18);
$pdf->SetFont(PDF_SCHRIFT_SERIF,'B',18);
$pdf->sety(80);
$pdf->setX(20);
if($rechnung["typ"] != "Brief")
@@ -412,19 +424,19 @@ function makefirstpage($pdf,$adresse,$rechnung,$ajax)
if($rechnung["typ"] != "Brief")
{
$pdf->SetFont('Times','B',12);
$pdf->SetFont(PDF_SCHRIFT_SERIF,'B',12);
$pdf->sety(95);
$pdf->setX(20);
$pdf->Cell(0,5,$rechnung["typ"].": ",0,0,'L');
$pdf->SetFont('Times','',12);
$pdf->SetFont(PDF_SCHRIFT_SERIF,'',12);
$pdf->sety(95);
$pdf->setX(60);
$pdf->Cell(0,5,$rechnung["drechnr"],0,0,'L');
if($_SESSION["firma"] == "LSG Oberallgäu")
{
$pdf->SetFont('Times','B',12);
$pdf->SetFont(PDF_SCHRIFT_SERIF,'B',12);
$pdf->Cell(0,5,"Bitte bei der Überweisung angeben!!",0,0,'L');
$pdf->SetFont('Times','',12);
$pdf->SetFont(PDF_SCHRIFT_SERIF,'',12);
}
$currY = 100;
}
@@ -436,11 +448,11 @@ function makefirstpage($pdf,$adresse,$rechnung,$ajax)
if($_SESSION["firma"] == "Wagner Markisen")
{
$pdf->SetFont('Times','B',12);
$pdf->SetFont(PDF_SCHRIFT_SERIF,'B',12);
$pdf->sety(100);
$pdf->setX(20);
$pdf->Cell(0,5,"Kundennummer: ",0,0,'L');
$pdf->SetFont('Times','',12);
$pdf->SetFont(PDF_SCHRIFT_SERIF,'',12);
$pdf->sety(100);
$pdf->setX(60);
$pdf->Cell(0,5,$rechnung["partner_id"],0,0,'L');
@@ -454,7 +466,7 @@ function makefirstpage($pdf,$adresse,$rechnung,$ajax)
//Begrüßung
$pdf->SetFont('Times','B',12);
$pdf->SetFont(PDF_SCHRIFT_SERIF,'B',12);
$pdf->setY($currY);
$pdf->setX(20);
$pdf->Cell(0,5,$rechnung["anrede1"],0,0,'L');
@@ -470,7 +482,7 @@ function makefirstpage($pdf,$adresse,$rechnung,$ajax)
if ($rechnung["typ"] == "Rechnung")
{
// $currY += 5;
// $pdf->SetFont('Times','',12);
// $pdf->SetFont(PDF_SCHRIFT_SERIF,'',12);
// $pdf->sety($currY);
// $pdf->setX(20);
// $pdf->Cell(0,5,"Wir bedanken uns für Ihr Vertrauen.",0,0,'L');
@@ -478,7 +490,7 @@ function makefirstpage($pdf,$adresse,$rechnung,$ajax)
elseif ($rechnung["typ"] == "Auftragsbestätigung")
{
$currY += 5;
$pdf->SetFont('Times','',12);
$pdf->SetFont(PDF_SCHRIFT_SERIF,'',12);
$pdf->sety($currY);
$pdf->setX(20);
if($_SESSION["firma"] == "Ingenieurbüro Wagner")
@@ -489,7 +501,7 @@ function makefirstpage($pdf,$adresse,$rechnung,$ajax)
elseif ($rechnung["typ"] == "Angebot")
{
$currY += 5;
$pdf->SetFont('Times','',12);
$pdf->SetFont(PDF_SCHRIFT_SERIF,'',12);
$pdf->sety($currY);
$pdf->setX(20);
if($rechnung["anrede1"] || $rechnung["anrede2"])
@@ -509,7 +521,7 @@ function makefirstpage($pdf,$adresse,$rechnung,$ajax)
if (rtrim($rechnung["intro"])!="" )
{
$currY += 5;
$pdf->SetFont('Times','',12);
$pdf->SetFont(PDF_SCHRIFT_SERIF,'',12);
$pdf->sety($currY);
$pdf->setX(20);
if($rechnung["typ"] == "Brief")
@@ -553,7 +565,7 @@ function maketable($pdf,$artikel,$rechnung,$ajax)
$newpdf->setX(20);
$newcurrY=3;
$newpdf->setY($newcurrY);
$newpdf->SetFont('Times','',14);
$newpdf->SetFont(PDF_SCHRIFT_SERIF,'',14);
$newpdf->setX(20);
$newpdf->MultiCell(100-$mixedmwst*15,5,$artikel[0]["art"]["bezeichn"],0,'L',0,1);
$newpdf->setX(120-$mixedmwst*15);
@@ -568,7 +580,7 @@ function maketable($pdf,$artikel,$rechnung,$ajax)
$newpdf->Cell(15,5,$artikel[0]["art"]["artmwst"]."%",0,0,'R');
}
$newpdf->setY($newcurrY+2);
$newpdf->SetFont('Times','',12);
$newpdf->SetFont(PDF_SCHRIFT_SERIF,'',12);
foreach($artikel[0]["eig"] as $eig)
{
$newpdf->Cell(100, 3, $eig["bezeichn"], 0, 1, "L", 0);
@@ -582,7 +594,7 @@ function maketable($pdf,$artikel,$rechnung,$ajax)
}
//Table-HEAD
$pdf->SetFont('Times','B',14);
$pdf->SetFont(PDF_SCHRIFT_SERIF,'B',14);
$pdf->sety($pdf->GetY()+5);
$pdf->setX(20);
$pdf->Cell(100-$mixedmwst*15,5,'Bezeichnung',0,0,'L');
@@ -619,7 +631,7 @@ function maketable($pdf,$artikel,$rechnung,$ajax)
$currY = $newpdf->GetY();
if (($currY+$artheight > 255 && $artheight < 219) || ($art["art"]["pagebreak"] && !$wholetablebreak))
{
$newpdf->SetFont('Times','B',14);
$newpdf->SetFont(PDF_SCHRIFT_SERIF,'B',14);
$newpdf->Line(18 , $currY+4.3, 200, $currY+4.3);
$newpdf->setY($currY+7);
$newpdf->setX(130-$mixedmwst*15);
@@ -632,7 +644,7 @@ function maketable($pdf,$artikel,$rechnung,$ajax)
$newpdf->AddPage("P");
//Table-re-HEAD
$currY = $pdf->GetY();
$pdf->SetFont('Times','B',14);
$pdf->SetFont(PDF_SCHRIFT_SERIF,'B',14);
$pdf->setX(20);
$pdf->Cell(100-$mixedmwst*15,5,'Bezeichnung',0,0,'L');
$pdf->setX(120-$mixedmwst*15);
@@ -651,7 +663,7 @@ function maketable($pdf,$artikel,$rechnung,$ajax)
$currY = $pdf->GetY();
$newpdf->SetFont('Times','',14);
$newpdf->SetFont(PDF_SCHRIFT_SERIF,'',14);
}
$currY = $newpdf->GetY();
}
@@ -671,7 +683,7 @@ function maketable($pdf,$artikel,$rechnung,$ajax)
$currY= $newpdf->GetY()+5;
$newpdf->setY($currY);
$newpdf->SetFont('Times','',14);
$newpdf->SetFont(PDF_SCHRIFT_SERIF,'',14);
$newpdf->setX(120-$mixedmwst*15);
$newpdf->Cell(15,5,number_significant($art["art"]["menge"], 3)." ".$art["art"]["einheit"],0,0,'C');
$newpdf->setX(135-$mixedmwst*15);
@@ -689,7 +701,7 @@ function maketable($pdf,$artikel,$rechnung,$ajax)
}
if($art["art"]["rabatt"])
{
$newpdf->SetFont('Times','I',14);
$newpdf->SetFont(PDF_SCHRIFT_SERIF,'I',14);
$newpdf->setX(110-$mixedmwst*15);
if(!$art["art"]["rabatttyp"])
$newpdf->Cell(100,5,"Abzüglich ".$art["art"]["rabatt"]."% Rabatt",0,0,'L');
@@ -707,10 +719,10 @@ function maketable($pdf,$artikel,$rechnung,$ajax)
$newpdf->setY($currY);
$newpdf->setX(20);
$newpdf->SetFont('Times','B',14);
$newpdf->SetFont(PDF_SCHRIFT_SERIF,'B',14);
$newpdf->MultiCell(90-$mixedmwst*15,5,$art["art"]["bezeichn"],0,'L',0,1);
$currY = $newpdf->GetY();
$newpdf->SetFont('Times','',12);
$newpdf->SetFont(PDF_SCHRIFT_SERIF,'',12);
foreach($art["eig"] as $eig)
{
if($eig["einheit"] == "keine")
@@ -728,7 +740,7 @@ function maketable($pdf,$artikel,$rechnung,$ajax)
$currY= $newpdf->GetY()+3;
$newpdf->setY($currY);
$newpdf->SetFont('Times','',14);
$newpdf->SetFont(PDF_SCHRIFT_SERIF,'',14);
$newpdf->setX(120-$mixedmwst*15);
$newpdf->Cell(15,5,number_significant($art["art"]["menge"], 3)." ".$art["art"]["einheit"],0,0,'C');
$newpdf->setX(135-$mixedmwst*15);
@@ -743,7 +755,7 @@ function maketable($pdf,$artikel,$rechnung,$ajax)
$newpdf->Ln();
if($art["art"]["rabatt"])
{
$newpdf->SetFont('Times','I',14);
$newpdf->SetFont(PDF_SCHRIFT_SERIF,'I',14);
$newpdf->setX(110-$mixedmwst*15);
if(!$art["art"]["rabatttyp"])
$newpdf->Cell(100,5,"Abzüglich ".$art["art"]["rabatt"]."% Rabatt",0,0,'L');
@@ -761,10 +773,10 @@ function maketable($pdf,$artikel,$rechnung,$ajax)
$newpdf->setY($currY);
$newpdf->setX(25);
$newpdf->SetFont('Times','',14);
$newpdf->SetFont(PDF_SCHRIFT_SERIF,'',14);
$newpdf->MultiCell(85-$mixedmwst*15,5,"(Optional: " .$art["art"]["bezeichn"].")",0,'L',0,1);
$currY = $newpdf->GetY();
$newpdf->SetFont('Times','',12);
$newpdf->SetFont(PDF_SCHRIFT_SERIF,'',12);
foreach($art["eig"] as $eig)
{
if($eig["einheit"] == "keine")
@@ -780,7 +792,7 @@ function maketable($pdf,$artikel,$rechnung,$ajax)
$currY= $newpdf->GetY()+3;
$newpdf->setY($currY);
$newpdf->SetFont('Times','',14);
$newpdf->SetFont(PDF_SCHRIFT_SERIF,'',14);
$newpdf->setX(120-$mixedmwst*15);
$newpdf->Cell(15,5,number_significant($art["art"]["menge"], 3)." ".$art["art"]["einheit"],0,0,'C');
$newpdf->setX(135-$mixedmwst*15);
@@ -796,7 +808,7 @@ function maketable($pdf,$artikel,$rechnung,$ajax)
if($art["art"]["rabatt"])
{
$newpdf->SetFont('Times','I',14);
$newpdf->SetFont(PDF_SCHRIFT_SERIF,'I',14);
$newpdf->setX(110-$mixedmwst*15);
if(!$art["art"]["rabatttyp"])
$newpdf->Cell(100,5,"Abzüglich ".$art["art"]["rabatt"]."% Rabatt",0,0,'L');
@@ -814,10 +826,10 @@ function maketable($pdf,$artikel,$rechnung,$ajax)
$newpdf->setY($currY);
$newpdf->setX(25);
$newpdf->SetFont('Times','',14);
$newpdf->SetFont(PDF_SCHRIFT_SERIF,'',14);
$newpdf->MultiCell(85-$mixedmwst*15,5,"(Alternativ: " .$art["art"]["bezeichn"].")",0,'L',0,1);
$currY = $newpdf->GetY();
$newpdf->SetFont('Times','',12);
$newpdf->SetFont(PDF_SCHRIFT_SERIF,'',12);
foreach($art["eig"] as $eig)
{
if($eig["einheit"] == "keine")
@@ -837,7 +849,7 @@ function maketable($pdf,$artikel,$rechnung,$ajax)
{
$currY = $pdf->GetY();
//Endbetrag
$pdf->SetFont('Times','B',14);
$pdf->SetFont(PDF_SCHRIFT_SERIF,'B',14);
$pdf->Line(18 , $currY+2, 200, $currY+2);
$pdf->setY($currY+2);
@@ -874,7 +886,7 @@ function maketable($pdf,$artikel,$rechnung,$ajax)
$pdf->Cell(30,6,number_format($ubertr_all,2,",",".")." ".$wahrung,0,1,'R');
$currY=$pdf->GetY()+10;
$pdf->setY($currY);
$pdf->SetFont('Times','',12);
$pdf->SetFont(PDF_SCHRIFT_SERIF,'',12);
$pdf->setX(20);
$currY=$currY;
}
@@ -883,7 +895,7 @@ function maketable($pdf,$artikel,$rechnung,$ajax)
{
$currY = $pdf->GetY();
//Endbetrag
$pdf->SetFont('Times','B',14);
$pdf->SetFont(PDF_SCHRIFT_SERIF,'B',14);
$pdf->Line(18 , $currY+2, 200, $currY+2);
$pdf->setY($currY+2);
$pdf->setX(130-$mixedmwst*15);
@@ -936,7 +948,7 @@ function maketable($pdf,$artikel,$rechnung,$ajax)
$pdf->Cell(30,6,number_format($ubertr_all,2,",",".")." ".$wahrung,0,1,'R');
$currY=$pdf->GetY()+10;
$pdf->setY($currY);
$pdf->SetFont('Times','',12);
$pdf->SetFont(PDF_SCHRIFT_SERIF,'',12);
$pdf->setX(20);
$currY=$currY;
}
@@ -978,7 +990,7 @@ function makeEndPage($pdf,$rechnung,$gesamtpreis,$ajax)
}
if (rtrim($rechnung["outro"]) != "")
{
$newpdf->SetFont('Times','',12);
$newpdf->SetFont(PDF_SCHRIFT_SERIF,'',12);
$newpdf->setX(20);
$newpdf->MultiCell(0,5,rtrim($rechnung["outro"]),0,'L',0);
//ENDE!!
@@ -1121,9 +1133,9 @@ function savePDF($pdf,$PDFpath)
if (preg_match("=^\.=", $file))
continue; # ., .. und versteckte Dateien (.gitkeep) ignorieren
elseif(is_file($PDFpathpart.$file))
{ #Dateien prüfen, und löschen, wenn älter als $delFile - Minuten
{ #Dateien löschen, wenn älter als PDF_TEMP_MAX_ALTER
$lastTime = ceil((time() - filemtime($PDFpathpart.$file)));
if($lastTime > 20){
if($lastTime > PDF_TEMP_MAX_ALTER){
unlink($PDFpathpart.$file);
}
}
@@ -1150,14 +1162,14 @@ function makeImageFromPDF($PDFpath)
if (is_dir($PDFpathpart.$file))
{
$lastTime = ceil((time() - filemtime($PDFpathpart.$file)));
if($lastTime > 20){
if($lastTime > PDF_TEMP_MAX_ALTER){
rrmdir($PDFpathpart.$file."/");
}
}
else
{ #Dateien prüfen, und löschen, wenn älter als $delFile - Minuten
{ #Dateien löschen, wenn älter als PDF_TEMP_MAX_ALTER
$lastTime = ceil((time() - filemtime($PDFpathpart.$file)));
if($lastTime > 20){
if($lastTime > PDF_TEMP_MAX_ALTER){
unlink($PDFpathpart.$file);
}
}
@@ -1202,24 +1214,24 @@ function makezettel($pdf,$termine,$anfahrt,$googleadressen='')
}
$pdf->SetTextColor(0,0,0);
$pdf->SetFont('Times','',14);
$pdf->SetFont(PDF_SCHRIFT_SERIF,'',14);
$pdf->setY(20);
$pdf->setX(25);
$pdf->MultiCell(85,0,str_replace("<br />","\n",$adresse["adresse"]),0,"L",0);
$pdf->Ln(10);
$pdf->SetFont('Times','BU',14);
$pdf->SetFont(PDF_SCHRIFT_SERIF,'BU',14);
$pdf->Cell(0,5,strtoupper($termin["typ"])." - ".$termin["head"],0,1,"C",0);
$pdf->SetFont('Times','B',14);
$pdf->SetFont(PDF_SCHRIFT_SERIF,'B',14);
//$pdf->Line(35,$pdf->GetY(),180,$pdf->GetY());
$notespos = $pdf->GetY();
$pdf->setY(20);
$pdf->Cell(0,5,date("d.m.Y, H:i",strtotime($termin["termtime"]))." Uhr",0,1,"R",0);
$pdf->Cell(0,5,"(".$dauer." geplant)",0,1,"R",0);
$pdf->SetY($notespos);
$pdf->SetFont('Times','',12);
$pdf->SetFont(PDF_SCHRIFT_SERIF,'',12);
$pdf->MultiCell(0,0,$termin["text"],0,"C",0);
$pdf->Ln();
$pdf->SetFont('Times','B',16);
$pdf->SetFont(PDF_SCHRIFT_SERIF,'B',16);
$pdf->Cell(0,5,"Notizen:",0,1,"C",0);
$pdf->Ln(12);
$pdf->SetDrawColor(100,100,100);
@@ -1261,17 +1273,17 @@ function makesingleterminpage($pdf,$termin,$adresse,$telnrn,$anfahrt,$googleadre
$mitarbeiter .= ", ".$termin["uservname4"]." ".$termin["usernname4"];
$pdf->SetTextColor(0,0,0);
$pdf->SetFont('Times','',14);
$pdf->SetFont(PDF_SCHRIFT_SERIF,'',14);
$pdf->setY(20);
$pdf->setX(25);
$pdf->MultiCell(85,0,str_replace("<br />","\n",$adresse["adresse"]),0,"L",0);
$pdf->SetFont('Times','B',12);
$pdf->SetFont(PDF_SCHRIFT_SERIF,'B',12);
$pdf->ln(5);
$pdf->MultiCell(0,0,$telnrn,0,"L",0);
$pdf->Ln(10);
$pdf->SetFont('Times','BU',16);
$pdf->SetFont(PDF_SCHRIFT_SERIF,'BU',16);
$pdf->Cell(0,5,strtoupper($termin["typ"])." - ".$termin["head"],0,1,"C",0);
$pdf->SetFont('Times','B',16);
$pdf->SetFont(PDF_SCHRIFT_SERIF,'B',16);
//$pdf->Line(35,$pdf->GetY(),180,$pdf->GetY());
$notespos = $pdf->GetY();
$pdf->setY(10);
@@ -1279,10 +1291,10 @@ function makesingleterminpage($pdf,$termin,$adresse,$telnrn,$anfahrt,$googleadre
$pdf->Cell(0,5,"(".$dauer." geplant)",0,1,"R",0);
$pdf->MultiCell(0,0,"(".$mitarbeiter.")",0,"R",0);
$pdf->SetY($notespos);
$pdf->SetFont('Times','',12);
$pdf->SetFont(PDF_SCHRIFT_SERIF,'',12);
$pdf->MultiCell(0,0,$termin["text"],0,"C",0);
$pdf->Ln();
$pdf->SetFont('Times','B',16);
$pdf->SetFont(PDF_SCHRIFT_SERIF,'B',16);
$pdf->Cell(0,5,"Notizen:",0,1,"C",0);
$pdf->Ln(12);
$pdf->SetDrawColor(100,100,100);
@@ -1293,7 +1305,7 @@ function makesingleterminpage($pdf,$termin,$adresse,$telnrn,$anfahrt,$googleadre
$pdf->line(10,$pdf->GetY(),200,$pdf->GetY());
$pdf->Ln(12);
}
$pdf->SetFont('Times','',16);
$pdf->SetFont(PDF_SCHRIFT_SERIF,'',16);
$pdf->Cell(0,5,"Ankunft:______________________ Abfahrt:_____________________",0,1,"L",0);
$pdf->Ln(12);
$pdf->Cell(0,5,"Unterschrift Kunde:_____________________",0,1,"C",0);
@@ -1312,7 +1324,7 @@ function makesingleterminpage($pdf,$termin,$adresse,$telnrn,$anfahrt,$googleadre
$pdf->line(120,$pdf->GetY(),200,$pdf->GetY());
$pdf->Ln(12);
}
$pdf->SetFont('Times','',16);
$pdf->SetFont(PDF_SCHRIFT_SERIF,'',16);
$pdf->Cell(0,5,"Ankunft:______________________ Abfahrt:_____________________",0,1,"L",0);
$pdf->Ln(10);
$pdf->Cell(0,5,"Unterschrift Kunde:_____________________",0,1,"C",0);
@@ -1852,7 +1864,7 @@ function makeprojectpage($pdf,$adresse,$telnrn,$project,$work)
else
$picpath = "./pics/";
$pdf->SetFont('helvetica','B',6);
$pdf->SetFont(PDF_SCHRIFT_SANS,'B',6);
$pdf->setY(35);
$pdf->setX(25);
@@ -1872,11 +1884,11 @@ function makeprojectpage($pdf,$adresse,$telnrn,$project,$work)
$pdf->Cell(0,3,'LSG OBERALLGÄU e.V. PHILIPP WAGNER IM ENGELFELD 13 87509 IMMENSTADT TEL.: 0176/21938558',0,0,'L');
}
$pdf->SetTextColor(0,0,0);
$pdf->SetFont('Times','',12);
$pdf->SetFont(PDF_SCHRIFT_SERIF,'',12);
$pdf->setY(40);
$pdf->setX(25);
$pdf->MultiCell(85,0,str_replace("<br />","\n",$adresse["adresse"]),0,"L",0);
$pdf->SetFont('Times','B',10);
$pdf->SetFont(PDF_SCHRIFT_SERIF,'B',10);
$tmpY = $pdf->getY();
$pdf->setY(40);
$pdf->setX(110);
@@ -1885,13 +1897,13 @@ function makeprojectpage($pdf,$adresse,$telnrn,$project,$work)
$tmpY = $pdf->getY();
$pdf->setY($tmpY);
$pdf->Ln(5);
$pdf->SetFont('Times','BU',16);
$pdf->SetFont(PDF_SCHRIFT_SERIF,'BU',16);
$pdf->Cell(0,5,$project["name"],0,1,"C",0);
$pdf->SetFont('Times','B',16);
$pdf->SetFont(PDF_SCHRIFT_SERIF,'B',16);
$pdf->Ln(12);
//Table-re-HEAD
$currY = $pdf->GetY();
$pdf->SetFont('Times','B',14);
$pdf->SetFont(PDF_SCHRIFT_SERIF,'B',14);
$pdf->setX(20);
$pdf->Cell(135,5,'Arbeit',0,0,'C');
$pdf->setX(155);
@@ -1906,7 +1918,7 @@ function makeprojectpage($pdf,$adresse,$telnrn,$project,$work)
$currY = $pdf->GetY();
$pdf->SetDrawColor(100,100,100);
//while($pdf->GetY() < 260)
$pdf->SetFont('Times','',12);
$pdf->SetFont(PDF_SCHRIFT_SERIF,'',12);
$gesstd = 0;
foreach($work as $workline)
{
@@ -1928,7 +1940,7 @@ function makeprojectpage($pdf,$adresse,$telnrn,$project,$work)
$pdf->AddPage("P");
//Table-re-HEAD
$currY = $pdf->GetY();
$pdf->SetFont('Times','B',14);
$pdf->SetFont(PDF_SCHRIFT_SERIF,'B',14);
$pdf->setX(20);
$pdf->Cell(135,5,'Arbeit',0,0,'C');
$pdf->setX(155);
@@ -1939,13 +1951,13 @@ function makeprojectpage($pdf,$adresse,$telnrn,$project,$work)
$pdf->Line(18 , $pdf->GetY(), 200, $pdf->GetY());
$pdf->Line(180 , $pdf->GetY()-5, 180, 270);
$pdf->Line(155 , $pdf->GetY()-5, 155, 270);
$pdf->SetFont('Times','',12);
$pdf->SetFont(PDF_SCHRIFT_SERIF,'',12);
}
}
$pdf->Line(18 , $pdf->GetY()+1, 200, $pdf->GetY());
$pdf->Line(18 , $pdf->GetY()+2, 200, $pdf->GetY()+1);
$pdf->SetY($pdf->GetY()+3);
$pdf->SetFont('Times','B',14);
$pdf->SetFont(PDF_SCHRIFT_SERIF,'B',14);
$pdf->setX(20);
$pdf->Cell(135,5,'Arbeitsstunden Summe:',0,0,'C');
$pdf->setX(155);
@@ -1961,7 +1973,7 @@ function makezeitpage($pdf,$name,$daymins,$zeiten)
else
$picpath = "./pics/";
$pdf->SetFont('helvetica','B',6);
$pdf->SetFont(PDF_SCHRIFT_SANS,'B',6);
$pdf->setY(35);
$pdf->setX(25);
@@ -1981,11 +1993,11 @@ function makezeitpage($pdf,$name,$daymins,$zeiten)
$pdf->Cell(0,3,'LSG OBERALLGÄU e.V. PHILIPP WAGNER IM ENGELFELD 13 87509 IMMENSTADT TEL.: 0176/21938558',0,0,'L');
}
$pdf->SetTextColor(0,0,0);
$pdf->SetFont('Times','',12);
$pdf->SetFont(PDF_SCHRIFT_SERIF,'',12);
$pdf->setY(40);
$pdf->setX(25);
$pdf->MultiCell(85,0,str_replace("<br />","\n",$name),0,"L",0);
$pdf->SetFont('Times','B',10);
$pdf->SetFont(PDF_SCHRIFT_SERIF,'B',10);
$tmpY = $pdf->getY();
$pdf->setY(40);
$pdf->setX(110);
@@ -1994,13 +2006,13 @@ function makezeitpage($pdf,$name,$daymins,$zeiten)
$tmpY = $pdf->getY();
$pdf->setY($tmpY);
$pdf->Ln(5);
$pdf->SetFont('Times','BU',16);
$pdf->SetFont(PDF_SCHRIFT_SERIF,'BU',16);
$pdf->Cell(0,5,$project["name"],0,1,"C",0);
$pdf->SetFont('Times','B',16);
$pdf->SetFont(PDF_SCHRIFT_SERIF,'B',16);
$pdf->Ln(12);
//Table-re-HEAD
$currY = $pdf->GetY();
$pdf->SetFont('Times','B',14);
$pdf->SetFont(PDF_SCHRIFT_SERIF,'B',14);
$pdf->setX(20);
$pdf->Cell(35,5,'Kommen',0,0,'C');
$pdf->setX(55);
@@ -2017,7 +2029,7 @@ function makezeitpage($pdf,$name,$daymins,$zeiten)
$currY = $pdf->GetY();
$pdf->SetDrawColor(100,100,100);
//while($pdf->GetY() < 260)
$pdf->SetFont('Times','',12);
$pdf->SetFont(PDF_SCHRIFT_SERIF,'',12);
$gesstd = 0;
foreach($zeiten as $zeit)
{
@@ -2040,7 +2052,7 @@ function makezeitpage($pdf,$name,$daymins,$zeiten)
$pdf->AddPage("P");
//Table-re-HEAD
$currY = $pdf->GetY();
$pdf->SetFont('Times','B',14);
$pdf->SetFont(PDF_SCHRIFT_SERIF,'B',14);
$pdf->setX(20);
$pdf->Cell(35,5,'Kommen',0,0,'C');
$pdf->setX(55);
@@ -2053,13 +2065,13 @@ function makezeitpage($pdf,$name,$daymins,$zeiten)
$pdf->Line(18 , $pdf->GetY(), 200, $pdf->GetY());
$pdf->Line(180 , $pdf->GetY()-5, 180, 270);
$pdf->Line(155 , $pdf->GetY()-5, 155, 270);
$pdf->SetFont('Times','',12);
$pdf->SetFont(PDF_SCHRIFT_SERIF,'',12);
}
}
$pdf->Line(18 , $pdf->GetY()+1, 200, $pdf->GetY());
$pdf->Line(18 , $pdf->GetY()+2, 200, $pdf->GetY()+1);
$pdf->SetY($pdf->GetY()+3);
$pdf->SetFont('Times','B',14);
$pdf->SetFont(PDF_SCHRIFT_SERIF,'B',14);
$pdf->setX(20);
$pdf->Cell(35,5,'Arbeitsstunden Summe:',0,0,'C');
$pdf->setX(55);