feat: Add timezone setting in preferences + clickable logo
- Add timezone dropdown to settings modal with common timezones - Save/load timezone preference per user - Apply user's timezone preference after authentication - Override system default with user preference if set - Make dashboard logo clickable (returns to default filters) - Show current timezone in settings Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
15
index.php
15
index.php
@@ -36,6 +36,21 @@ if (!str_starts_with($requestPath, '/api/')) {
|
||||
|
||||
// Initialize audit log model
|
||||
$GLOBALS['auditLog'] = new AuditLogModel($conn);
|
||||
|
||||
// Check if user has a timezone preference and apply it
|
||||
if ($currentUser && isset($currentUser['user_id'])) {
|
||||
require_once 'models/UserPreferencesModel.php';
|
||||
$prefsModel = new UserPreferencesModel($conn);
|
||||
$userTimezone = $prefsModel->getPreference($currentUser['user_id'], 'timezone', null);
|
||||
if ($userTimezone) {
|
||||
// Override system timezone with user preference
|
||||
date_default_timezone_set($userTimezone);
|
||||
$GLOBALS['config']['TIMEZONE'] = $userTimezone;
|
||||
$now = new DateTime('now', new DateTimeZone($userTimezone));
|
||||
$GLOBALS['config']['TIMEZONE_OFFSET'] = $now->getOffset() / 60;
|
||||
$GLOBALS['config']['TIMEZONE_ABBREV'] = $now->format('T');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Simple router
|
||||
|
||||
Reference in New Issue
Block a user