Fix public client IP extraction and hide duplicate footer creation date
- Enhance RequestLogger::getClientIp() with 2-pass detection prioritizing public IPs over proxy/internal IPs - Hide footer creation date when identical to modification date to prevent duplicate date display - Improve AdminAuth log helper and footer template tooltips
This commit is contained in:
@@ -304,14 +304,13 @@ class AdminAuth
|
||||
mkdir($dir, 0755, true);
|
||||
}
|
||||
$timestamp = date('Y-m-d H:i:s');
|
||||
if (class_exists('RequestLogger')) {
|
||||
$ip = RequestLogger::getClientIp();
|
||||
} else {
|
||||
$ip = $_SERVER['HTTP_CF_CONNECTING_IP'] ?? $_SERVER['HTTP_X_REAL_IP'] ?? $_SERVER['HTTP_X_FORWARDED_FOR'] ?? $_SERVER['REMOTE_ADDR'] ?? 'cli';
|
||||
if (($commaPos = strpos($ip, ',')) !== false) {
|
||||
$ip = trim(substr($ip, 0, $commaPos));
|
||||
if (!class_exists('RequestLogger')) {
|
||||
$loggerClass = __DIR__ . '/../../cms/core/class/RequestLogger.php';
|
||||
if (file_exists($loggerClass)) {
|
||||
require_once $loggerClass;
|
||||
}
|
||||
}
|
||||
$ip = class_exists('RequestLogger') ? RequestLogger::getClientIp() : ($_SERVER['REMOTE_ADDR'] ?? '127.0.0.1');
|
||||
file_put_contents($logFile, "[{$timestamp}] [{$level}] [{$ip}] {$message}\n", FILE_APPEND);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user