Updates log calls to new syntax
parent
1e975f7b18
commit
bbccb54059
|
@ -94,11 +94,11 @@ class Component {
|
||||||
$result = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
$result = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
||||||
|
|
||||||
if (!empty($result)) {
|
if (!empty($result)) {
|
||||||
$logObject->insertLog(0, "Retrieved " . count($result) . " Jitsi component events");
|
$logObject->log('info', "Retrieved " . count($result) . " Jitsi component events", ['user_id' => $userId, 'scope' => 'system']);
|
||||||
}
|
}
|
||||||
return $result;
|
return $result;
|
||||||
} catch (PDOException $e) {
|
} catch (PDOException $e) {
|
||||||
$logObject->insertLog(0, "Failed to retrieve Jitsi component events: " . $e->getMessage());
|
$logObject->log('error', "Failed to retrieve Jitsi component events: " . $e->getMessage(), ['user_id' => $userId, 'scope' => 'system']);
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -162,7 +162,7 @@ class Component {
|
||||||
$result = $stmt->fetch(PDO::FETCH_ASSOC);
|
$result = $stmt->fetch(PDO::FETCH_ASSOC);
|
||||||
return (int)$result['total'];
|
return (int)$result['total'];
|
||||||
} catch (PDOException $e) {
|
} catch (PDOException $e) {
|
||||||
$logObject->insertLog(0, "Failed to retrieve component events count: " . $e->getMessage());
|
$logObject->log('error', "Failed to retrieve component events count: " . $e->getMessage(), ['user_id' => $userId, 'scope' => 'system']);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -140,7 +140,7 @@ class Config {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!empty($allLogs)) {
|
if (!empty($allLogs)) {
|
||||||
$logObject->insertLog($userId, implode("\n", $allLogs), 'system');
|
$logObject->log('info', implode("\n", $allLogs), ['user_id' => $userId, 'scope' => 'system']);
|
||||||
}
|
}
|
||||||
|
|
||||||
return [
|
return [
|
||||||
|
@ -148,7 +148,7 @@ class Config {
|
||||||
'updated' => $updated
|
'updated' => $updated
|
||||||
];
|
];
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
$logObject->insertLog($userId, "Config update error: " . $e->getMessage(), 'system');
|
$logObject->log('error', "Config update error: " . $e->getMessage(), ['user_id' => $userId, 'scope' => 'system']);
|
||||||
return [
|
return [
|
||||||
'success' => false,
|
'success' => false,
|
||||||
'error' => $e->getMessage()
|
'error' => $e->getMessage()
|
||||||
|
|
|
@ -232,7 +232,7 @@ class RateLimiter {
|
||||||
if ($this->isIpBlacklisted($ip)) {
|
if ($this->isIpBlacklisted($ip)) {
|
||||||
$message = "Cannot whitelist {$ip} - IP is currently blacklisted";
|
$message = "Cannot whitelist {$ip} - IP is currently blacklisted";
|
||||||
if ($userId) {
|
if ($userId) {
|
||||||
$this->logger->info("IP Whitelist: {$message}", ['user_id' => $userId]);
|
$this->logger->log('info', "IP Whitelist: {$message}", ['user_id' => $userId, 'scope' => 'system']);
|
||||||
Feedback::flash('ERROR', 'DEFAULT', $message);
|
Feedback::flash('ERROR', 'DEFAULT', $message);
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
@ -256,14 +256,14 @@ class RateLimiter {
|
||||||
$createdBy,
|
$createdBy,
|
||||||
$description
|
$description
|
||||||
);
|
);
|
||||||
$this->logger->info($logMessage, ['user_id' => $userId ?? null]);
|
$this->logger->log('info', $logMessage, ['user_id' => $userId ?? null, 'scope' => 'system']);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $result;
|
return $result;
|
||||||
|
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
if ($userId) {
|
if ($userId) {
|
||||||
$this->logger->error("IP Whitelist: Failed to add {$ip}: " . $e->getMessage(), ['user_id' => $userId]);
|
$this->logger->log('error', "IP Whitelist: Failed to add {$ip}: " . $e->getMessage(), ['user_id' => $userId, 'scope' => 'system']);
|
||||||
Feedback::flash('ERROR', 'DEFAULT', "IP Whitelist: Failed to add {$ip}: " . $e->getMessage());
|
Feedback::flash('ERROR', 'DEFAULT', "IP Whitelist: Failed to add {$ip}: " . $e->getMessage());
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
@ -291,14 +291,14 @@ class RateLimiter {
|
||||||
$removedBy,
|
$removedBy,
|
||||||
$ipDetails['created_by']
|
$ipDetails['created_by']
|
||||||
);
|
);
|
||||||
$this->logger->info($logMessage, ['user_id' => $userId ?? null]);
|
$this->logger->log('info', $logMessage, ['user_id' => $userId ?? null, 'scope' => 'system']);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $result;
|
return $result;
|
||||||
|
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
if ($userId) {
|
if ($userId) {
|
||||||
$this->logger->error("IP Whitelist: Failed to remove {$ip}: " . $e->getMessage(), ['user_id' => $userId]);
|
$this->logger->log('error', "IP Whitelist: Failed to remove {$ip}: " . $e->getMessage(), ['user_id' => $userId, 'scope' => 'system']);
|
||||||
Feedback::flash('ERROR', 'DEFAULT', "IP Whitelist: Failed to remove {$ip}: " . $e->getMessage());
|
Feedback::flash('ERROR', 'DEFAULT', "IP Whitelist: Failed to remove {$ip}: " . $e->getMessage());
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
@ -311,7 +311,7 @@ class RateLimiter {
|
||||||
if ($this->isIpWhitelisted($ip)) {
|
if ($this->isIpWhitelisted($ip)) {
|
||||||
$message = "Cannot blacklist {$ip} - IP is currently whitelisted";
|
$message = "Cannot blacklist {$ip} - IP is currently whitelisted";
|
||||||
if ($userId) {
|
if ($userId) {
|
||||||
$this->logger->info("IP Blacklist: {$message}", ['user_id' => $userId]);
|
$this->logger->log('info', "IP Blacklist: {$message}", ['user_id' => $userId, 'scope' => 'system']);
|
||||||
Feedback::flash('ERROR', 'DEFAULT', $message);
|
Feedback::flash('ERROR', 'DEFAULT', $message);
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
@ -339,13 +339,13 @@ class RateLimiter {
|
||||||
$reason,
|
$reason,
|
||||||
$expiryTime ?? 'never'
|
$expiryTime ?? 'never'
|
||||||
);
|
);
|
||||||
$this->logger->info($logMessage, ['user_id' => $userId ?? null]);
|
$this->logger->log('info', $logMessage, ['user_id' => $userId ?? null, 'scope' => 'system']);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $result;
|
return $result;
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
if ($userId) {
|
if ($userId) {
|
||||||
$this->logger->error("IP Blacklist: Failed to add {$ip}: " . $e->getMessage(), ['user_id' => $userId]);
|
$this->logger->log('error', "IP Blacklist: Failed to add {$ip}: " . $e->getMessage(), ['user_id' => $userId, 'scope' => 'system']);
|
||||||
Feedback::flash('ERROR', 'DEFAULT', "IP Blacklist: Failed to add {$ip}: " . $e->getMessage());
|
Feedback::flash('ERROR', 'DEFAULT', "IP Blacklist: Failed to add {$ip}: " . $e->getMessage());
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
@ -373,13 +373,13 @@ class RateLimiter {
|
||||||
$ipDetails['created_by'],
|
$ipDetails['created_by'],
|
||||||
$ipDetails['reason']
|
$ipDetails['reason']
|
||||||
);
|
);
|
||||||
$this->logger->info($logMessage, ['user_id' => $userId ?? null]);
|
$this->logger->log('info', $logMessage, ['user_id' => $userId ?? null, 'scope' => 'system']);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $result;
|
return $result;
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
if ($userId) {
|
if ($userId) {
|
||||||
$this->logger->error("IP Blacklist: Failed to remove {$ip}: " . $e->getMessage(), ['user_id' => $userId]);
|
$this->logger->log('error', "IP Blacklist: Failed to remove {$ip}: " . $e->getMessage(), ['user_id' => $userId, 'scope' => 'system']);
|
||||||
Feedback::flash('ERROR', 'DEFAULT', "IP Blacklist: Failed to remove {$ip}: " . $e->getMessage());
|
Feedback::flash('ERROR', 'DEFAULT', "IP Blacklist: Failed to remove {$ip}: " . $e->getMessage());
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
@ -414,7 +414,7 @@ class RateLimiter {
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
$this->logger->error("Failed to cleanup expired entries: " . $e->getMessage());
|
$this->logger->log('error', "Failed to cleanup expired entries: " . $e->getMessage(), ['user_id' => $userId ?? null, 'scope' => 'system']);
|
||||||
Feedback::flash('ERROR', 'DEFAULT', "Failed to cleanup expired entries: " . $e->getMessage());
|
Feedback::flash('ERROR', 'DEFAULT', "Failed to cleanup expired entries: " . $e->getMessage());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,7 +40,7 @@ function applyCsrfMiddleware() {
|
||||||
$_GET['page'] ?? 'unknown',
|
$_GET['page'] ?? 'unknown',
|
||||||
$_SESSION['username'] ?? 'anonymous'
|
$_SESSION['username'] ?? 'anonymous'
|
||||||
);
|
);
|
||||||
$logObject->insertLog(null, $logMessage, 'system');
|
$logObject->log('error', $logMessage, ['user_id' => null, 'scope' => 'system']);
|
||||||
|
|
||||||
// Return error message
|
// Return error message
|
||||||
http_response_code(403);
|
http_response_code(403);
|
||||||
|
|
|
@ -204,7 +204,7 @@ if ($page == 'logout') {
|
||||||
setcookie('username', "", time() - 100, $config['folder'], $config['domain'], isset($_SERVER['HTTPS']), true);
|
setcookie('username', "", time() - 100, $config['folder'], $config['domain'], isset($_SERVER['HTTPS']), true);
|
||||||
|
|
||||||
// Log successful logout
|
// Log successful logout
|
||||||
$logObject->insertLog($userId, "Logout: User \"$currentUser\" logged out. IP: $user_IP", 'user');
|
$logObject->log('info', "Logout: User \"$currentUser\" logged out. IP: $user_IP", ['user_id' => $userId, 'scope' => 'user']);
|
||||||
|
|
||||||
// Set success message
|
// Set success message
|
||||||
Feedback::flash('LOGIN', 'LOGOUT_SUCCESS');
|
Feedback::flash('LOGIN', 'LOGOUT_SUCCESS');
|
||||||
|
|
Loading…
Reference in New Issue