Instanzname in die Config, Setup-Luecke geschlossen
Instanz: - $instanz in der externen Config bestimmt INSTANZ, UPLOADS_PATH und SESSION_NAME. Der Verzeichnisname waehlt nur noch die Config-Datei aus und ist Fallback, solange $instanz fehlt. - savePDF() schreibt nicht mehr fest nach DOCUMENT_ROOT."kunden", sondern in das Verzeichnis, das es auch aufraeumt. .gitkeep wird nicht mehr mitgeloescht. Sicherheit: - index.php?action=setup war ohne Login auch bei gueltiger Config erreichbar. rebuild-settings.php schrieb $_POST ungeprueft als PHP-Code in die Config (Codeausfuehrung, sofern die Datei schreibbar war). - Setup nur noch ohne gueltige Config, firststart.php und rebuild-settings.php pruefen das zusaetzlich selbst. - Config-Werte werden per var_export() maskiert. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
+12
-8
@@ -1107,13 +1107,19 @@ function writeZahlziel($ktonr,$zahlziel,$gespreis,$wahrung,$rechdate,$kundeid)
|
||||
|
||||
function savePDF($pdf,$PDFpath)
|
||||
{
|
||||
$PDFpathpart = dirname($PDFpath)."/";
|
||||
$PDFfilepart = basename($PDFpath,".pdf");
|
||||
// TCPDF stellt beim Schreiben file:// voran und braucht deshalb einen
|
||||
// absoluten Pfad. Aufgelöst wird relativ zum Arbeitsverzeichnis, also in
|
||||
// der Installation, aus der der Aufruf kommt - früher stand hier fest
|
||||
// DOCUMENT_ROOT."kunden".
|
||||
$PDFpathpart = realpath(dirname($PDFpath));
|
||||
if($PDFpathpart === false || !is_dir($PDFpathpart))
|
||||
die("PDF-Verzeichnis nicht gefunden: ".dirname($PDFpath));
|
||||
$PDFpathpart = str_replace("\\", "/", $PDFpathpart)."/";
|
||||
$handle=opendir($PDFpathpart);
|
||||
while ($file = readdir($handle))
|
||||
{
|
||||
if (preg_match("=^\.{1,2}$=", $file))
|
||||
continue; # . und .. Dateien ignorieren
|
||||
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
|
||||
$lastTime = ceil((time() - filemtime($PDFpathpart.$file)));
|
||||
@@ -1121,11 +1127,9 @@ function savePDF($pdf,$PDFpath)
|
||||
unlink($PDFpathpart.$file);
|
||||
}
|
||||
}
|
||||
}
|
||||
while(str_starts_with($PDFpath, ".")){
|
||||
$PDFpath = substr($PDFpath,1);
|
||||
}
|
||||
$pdf->Output($_SERVER['DOCUMENT_ROOT']."kunden".$PDFpath,"F");
|
||||
closedir($handle);
|
||||
$pdf->Output($PDFpathpart.basename($PDFpath),"F");
|
||||
}
|
||||
|
||||
function outputPDF($pdf)
|
||||
|
||||
Reference in New Issue
Block a user