log irgendwas
This commit is contained in:
@@ -1 +1 @@
|
||||
1.2.18
|
||||
1.2.19
|
||||
@@ -1,6 +1,25 @@
|
||||
<?php
|
||||
require_once __DIR__ . '/../config/fileload.php';
|
||||
|
||||
$debugDir = dirname(__DIR__) . '/debug';
|
||||
if (!is_dir($debugDir)) {
|
||||
@mkdir($debugDir, 0777, true);
|
||||
@chmod($debugDir, 0777);
|
||||
}
|
||||
$clientIp = '';
|
||||
if (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) {
|
||||
$clientIp = trim(explode(',', (string)$_SERVER['HTTP_X_FORWARDED_FOR'])[0]);
|
||||
} elseif (!empty($_SERVER['HTTP_CF_CONNECTING_IP'])) {
|
||||
$clientIp = (string)$_SERVER['HTTP_CF_CONNECTING_IP'];
|
||||
} elseif (!empty($_SERVER['HTTP_X_REAL_IP'])) {
|
||||
$clientIp = (string)$_SERVER['HTTP_X_REAL_IP'];
|
||||
} else {
|
||||
$clientIp = (string)($_SERVER['REMOTE_ADDR'] ?? '');
|
||||
}
|
||||
$clientIp = trim($clientIp);
|
||||
$accessLine = date(DATE_ATOM) . ' | ' . ($clientIp !== '' ? $clientIp : 'unknown') . "\n";
|
||||
@file_put_contents($debugDir . '/last_access.log', $accessLine);
|
||||
|
||||
$pageTitle = 'Email Template System – Admin';
|
||||
$pageId = 'home';
|
||||
$navLinks = [];
|
||||
|
||||
@@ -4895,7 +4895,7 @@ SQL;
|
||||
|
||||
private function debugDir(): string
|
||||
{
|
||||
return dirname(__DIR__) . '/debug';
|
||||
return rtrim(sys_get_temp_dir(), '/') . '/emailtemplate_debug';
|
||||
}
|
||||
|
||||
private function writeDebugLog(string $name, array $payload): void
|
||||
@@ -4917,12 +4917,14 @@ SQL;
|
||||
}
|
||||
$dir = $this->debugDir();
|
||||
if (!is_dir($dir)) {
|
||||
@mkdir($dir, 0775, true);
|
||||
@mkdir($dir, 0777, true);
|
||||
}
|
||||
@chmod($dir, 0777);
|
||||
$safeName = preg_replace('/[^a-zA-Z0-9_\.\-]/', '_', $name) ?: 'debug';
|
||||
$file = rtrim($dir, '/') . '/' . $safeName . '.log';
|
||||
$data = json_encode($payload, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES | JSON_PRETTY_PRINT);
|
||||
@file_put_contents($file, $data ?: '');
|
||||
@chmod($file, 0666);
|
||||
|
||||
$fallback = sys_get_temp_dir() . '/emailtemplate_debug.log';
|
||||
$line = json_encode([
|
||||
|
||||
Reference in New Issue
Block a user