Upgraded to 1.1.0
1.1.0 (2025-10-09)
- **User Notifications System** - In-app notification center with 7 notification types, filtering, pagination
- **Advanced Session Management** - Database-backed sessions with geolocation (country, city, ISP)
- **Remote Session Control** - Terminate any device instantly with immediate logout validation
- **Enhanced Profile Page** - Sidebar navigation with 4 tabs, hash-based routing (#profile, #security, #sessions)
- **MVC Architecture Refactoring** - 3 new Helpers (Layout, Domain, Session), ~265 lines cleaned from views
- **Geolocation Tracking** - IP-based location detection using ip-api.com, country flags with flag-icons
- **Device Detection** - Browser & device type parsing (Chrome/Firefox/Safari, Desktop/Mobile/Tablet)
- **Auto-Detected Cron Paths** - Settings show actual installation paths (thanks @jadeops)
- **Welcome Notifications** - Sent to new users on registration or fresh install
- **Upgrade Notifications** - Admins notified on system updates with version & migration count
- **Web-Based Installer** - Replaces CLI, auto-generates encryption key, one-time password display
- **Web-Based Updater** - `/install/update` for running new migrations with smart detection
- **User Registration** - Full signup flow with email verification, password reset, resend verification
- **User Management** - CRUD for users with filtering, sorting, pagination (admin-only)
- **Remember Me** - 30-day secure tokens linked to sessions, cascade deletion on logout
- **Session Validator** - Middleware validates sessions on every request for instant remote logout
- **Consistent UI/UX** - Unified filtering, sorting, pagination across Domains, Users, Notifications, TLD Registry
- **Smart Migrations** - Consolidated schema for fresh installs, incremental for upgrades
- **XSS Protection** - htmlspecialchars() applied across all user-facing data (thanks @jadeops)
2025-10-09 18:02:46 +03:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
namespace App\Helpers;
|
|
|
|
|
|
|
|
|
|
use App\Models\Notification;
|
|
|
|
|
use App\Models\Setting;
|
|
|
|
|
|
|
|
|
|
class LayoutHelper
|
|
|
|
|
{
|
|
|
|
|
/**
|
|
|
|
|
* Get notifications for the top nav dropdown
|
|
|
|
|
*/
|
|
|
|
|
public static function getNotifications(int $userId): array
|
|
|
|
|
{
|
|
|
|
|
try {
|
|
|
|
|
$notificationModel = new Notification();
|
|
|
|
|
$notifications = $notificationModel->getRecentUnread($userId, 4);
|
|
|
|
|
$unreadCount = $notificationModel->getUnreadCount($userId);
|
|
|
|
|
|
|
|
|
|
// Format each notification
|
|
|
|
|
foreach ($notifications as &$notif) {
|
|
|
|
|
$notif['time_ago'] = self::timeAgo($notif['created_at']);
|
|
|
|
|
$notif['icon'] = self::getNotificationIcon($notif['type']);
|
|
|
|
|
$notif['color'] = self::getNotificationColor($notif['type']);
|
2026-02-08 22:58:59 +02:00
|
|
|
$notif['login_data'] = self::parseLoginData($notif);
|
Upgraded to 1.1.0
1.1.0 (2025-10-09)
- **User Notifications System** - In-app notification center with 7 notification types, filtering, pagination
- **Advanced Session Management** - Database-backed sessions with geolocation (country, city, ISP)
- **Remote Session Control** - Terminate any device instantly with immediate logout validation
- **Enhanced Profile Page** - Sidebar navigation with 4 tabs, hash-based routing (#profile, #security, #sessions)
- **MVC Architecture Refactoring** - 3 new Helpers (Layout, Domain, Session), ~265 lines cleaned from views
- **Geolocation Tracking** - IP-based location detection using ip-api.com, country flags with flag-icons
- **Device Detection** - Browser & device type parsing (Chrome/Firefox/Safari, Desktop/Mobile/Tablet)
- **Auto-Detected Cron Paths** - Settings show actual installation paths (thanks @jadeops)
- **Welcome Notifications** - Sent to new users on registration or fresh install
- **Upgrade Notifications** - Admins notified on system updates with version & migration count
- **Web-Based Installer** - Replaces CLI, auto-generates encryption key, one-time password display
- **Web-Based Updater** - `/install/update` for running new migrations with smart detection
- **User Registration** - Full signup flow with email verification, password reset, resend verification
- **User Management** - CRUD for users with filtering, sorting, pagination (admin-only)
- **Remember Me** - 30-day secure tokens linked to sessions, cascade deletion on logout
- **Session Validator** - Middleware validates sessions on every request for instant remote logout
- **Consistent UI/UX** - Unified filtering, sorting, pagination across Domains, Users, Notifications, TLD Registry
- **Smart Migrations** - Consolidated schema for fresh installs, incremental for upgrades
- **XSS Protection** - htmlspecialchars() applied across all user-facing data (thanks @jadeops)
2025-10-09 18:02:46 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return [
|
|
|
|
|
'items' => $notifications,
|
|
|
|
|
'unread_count' => $unreadCount
|
|
|
|
|
];
|
|
|
|
|
} catch (\Exception $e) {
|
|
|
|
|
// If table doesn't exist yet
|
|
|
|
|
return ['items' => [], 'unread_count' => 0];
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2025-10-20 18:44:03 +03:00
|
|
|
/**
|
|
|
|
|
* Get domain statistics (centralized function for views)
|
|
|
|
|
*/
|
|
|
|
|
public static function getDomainStats(): array
|
|
|
|
|
{
|
|
|
|
|
$domainModel = new \App\Models\Domain();
|
|
|
|
|
$userId = \Core\Auth::id();
|
|
|
|
|
$settingModel = new \App\Models\Setting();
|
|
|
|
|
$isolationMode = $settingModel->getValue('user_isolation_mode', 'shared');
|
|
|
|
|
|
|
|
|
|
if ($isolationMode === 'isolated') {
|
|
|
|
|
return $domainModel->getStatistics($userId);
|
|
|
|
|
} else {
|
|
|
|
|
return $domainModel->getStatistics();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2026-02-08 22:58:59 +02:00
|
|
|
/**
|
|
|
|
|
* Parse session_new notification message (JSON)
|
|
|
|
|
* Returns structured data for rich display, or null if not parseable
|
|
|
|
|
*/
|
|
|
|
|
public static function parseLoginData(array $notification): ?array
|
|
|
|
|
{
|
|
|
|
|
if ($notification['type'] !== 'session_new' && $notification['type'] !== 'session_failed') {
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$data = json_decode($notification['message'] ?? '', true);
|
|
|
|
|
|
|
|
|
|
if (is_array($data) && isset($data['ip'])) {
|
|
|
|
|
return $data;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Format session_new notification for dropdown display (compact)
|
|
|
|
|
*/
|
|
|
|
|
public static function formatLoginDropdown(array $loginData): string
|
|
|
|
|
{
|
|
|
|
|
$parts = [];
|
|
|
|
|
if ($loginData['city'] !== 'Unknown' && $loginData['city'] !== 'Local') {
|
|
|
|
|
$parts[] = $loginData['city'];
|
|
|
|
|
}
|
|
|
|
|
if ($loginData['country'] !== 'Unknown' && $loginData['country'] !== 'Local') {
|
|
|
|
|
$parts[] = $loginData['country'];
|
|
|
|
|
}
|
|
|
|
|
$location = !empty($parts) ? implode(', ', $parts) : $loginData['ip'];
|
|
|
|
|
|
|
|
|
|
$browser = $loginData['browser'] ?? 'Unknown';
|
|
|
|
|
return "{$location} · {$browser}";
|
|
|
|
|
}
|
|
|
|
|
|
Upgraded to 1.1.0
1.1.0 (2025-10-09)
- **User Notifications System** - In-app notification center with 7 notification types, filtering, pagination
- **Advanced Session Management** - Database-backed sessions with geolocation (country, city, ISP)
- **Remote Session Control** - Terminate any device instantly with immediate logout validation
- **Enhanced Profile Page** - Sidebar navigation with 4 tabs, hash-based routing (#profile, #security, #sessions)
- **MVC Architecture Refactoring** - 3 new Helpers (Layout, Domain, Session), ~265 lines cleaned from views
- **Geolocation Tracking** - IP-based location detection using ip-api.com, country flags with flag-icons
- **Device Detection** - Browser & device type parsing (Chrome/Firefox/Safari, Desktop/Mobile/Tablet)
- **Auto-Detected Cron Paths** - Settings show actual installation paths (thanks @jadeops)
- **Welcome Notifications** - Sent to new users on registration or fresh install
- **Upgrade Notifications** - Admins notified on system updates with version & migration count
- **Web-Based Installer** - Replaces CLI, auto-generates encryption key, one-time password display
- **Web-Based Updater** - `/install/update` for running new migrations with smart detection
- **User Registration** - Full signup flow with email verification, password reset, resend verification
- **User Management** - CRUD for users with filtering, sorting, pagination (admin-only)
- **Remember Me** - 30-day secure tokens linked to sessions, cascade deletion on logout
- **Session Validator** - Middleware validates sessions on every request for instant remote logout
- **Consistent UI/UX** - Unified filtering, sorting, pagination across Domains, Users, Notifications, TLD Registry
- **Smart Migrations** - Consolidated schema for fresh installs, incremental for upgrades
- **XSS Protection** - htmlspecialchars() applied across all user-facing data (thanks @jadeops)
2025-10-09 18:02:46 +03:00
|
|
|
/**
|
|
|
|
|
* Convert timestamp to "time ago" format
|
|
|
|
|
*/
|
|
|
|
|
private static function timeAgo(string $datetime): string
|
|
|
|
|
{
|
|
|
|
|
$timestamp = strtotime($datetime);
|
|
|
|
|
$diff = time() - $timestamp;
|
|
|
|
|
|
|
|
|
|
if ($diff < 60) return 'just now';
|
|
|
|
|
|
|
|
|
|
if ($diff < 3600) {
|
|
|
|
|
$mins = floor($diff / 60);
|
|
|
|
|
return $mins . ' min' . ($mins > 1 ? 's' : '') . ' ago';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ($diff < 86400) {
|
|
|
|
|
$hours = floor($diff / 3600);
|
|
|
|
|
return $hours . ' hour' . ($hours > 1 ? 's' : '') . ' ago';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$days = floor($diff / 86400);
|
|
|
|
|
return $days . ' day' . ($days > 1 ? 's' : '') . ' ago';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Get notification icon based on type
|
|
|
|
|
*/
|
|
|
|
|
private static function getNotificationIcon(string $type): string
|
|
|
|
|
{
|
|
|
|
|
return match($type) {
|
|
|
|
|
'domain_expiring' => 'exclamation-triangle',
|
2026-02-08 22:58:59 +02:00
|
|
|
'domain_expired', 'domain_expired_status' => 'times-circle',
|
|
|
|
|
'domain_available' => 'check-circle',
|
|
|
|
|
'domain_registered' => 'globe',
|
|
|
|
|
'domain_redemption' => 'hourglass-half',
|
|
|
|
|
'domain_pending_delete' => 'trash-alt',
|
Upgraded to 1.1.0
1.1.0 (2025-10-09)
- **User Notifications System** - In-app notification center with 7 notification types, filtering, pagination
- **Advanced Session Management** - Database-backed sessions with geolocation (country, city, ISP)
- **Remote Session Control** - Terminate any device instantly with immediate logout validation
- **Enhanced Profile Page** - Sidebar navigation with 4 tabs, hash-based routing (#profile, #security, #sessions)
- **MVC Architecture Refactoring** - 3 new Helpers (Layout, Domain, Session), ~265 lines cleaned from views
- **Geolocation Tracking** - IP-based location detection using ip-api.com, country flags with flag-icons
- **Device Detection** - Browser & device type parsing (Chrome/Firefox/Safari, Desktop/Mobile/Tablet)
- **Auto-Detected Cron Paths** - Settings show actual installation paths (thanks @jadeops)
- **Welcome Notifications** - Sent to new users on registration or fresh install
- **Upgrade Notifications** - Admins notified on system updates with version & migration count
- **Web-Based Installer** - Replaces CLI, auto-generates encryption key, one-time password display
- **Web-Based Updater** - `/install/update` for running new migrations with smart detection
- **User Registration** - Full signup flow with email verification, password reset, resend verification
- **User Management** - CRUD for users with filtering, sorting, pagination (admin-only)
- **Remember Me** - 30-day secure tokens linked to sessions, cascade deletion on logout
- **Session Validator** - Middleware validates sessions on every request for instant remote logout
- **Consistent UI/UX** - Unified filtering, sorting, pagination across Domains, Users, Notifications, TLD Registry
- **Smart Migrations** - Consolidated schema for fresh installs, incremental for upgrades
- **XSS Protection** - htmlspecialchars() applied across all user-facing data (thanks @jadeops)
2025-10-09 18:02:46 +03:00
|
|
|
'domain_updated' => 'sync-alt',
|
|
|
|
|
'session_new' => 'sign-in-alt',
|
2026-02-08 22:58:59 +02:00
|
|
|
'session_failed' => 'shield-alt',
|
Upgraded to 1.1.0
1.1.0 (2025-10-09)
- **User Notifications System** - In-app notification center with 7 notification types, filtering, pagination
- **Advanced Session Management** - Database-backed sessions with geolocation (country, city, ISP)
- **Remote Session Control** - Terminate any device instantly with immediate logout validation
- **Enhanced Profile Page** - Sidebar navigation with 4 tabs, hash-based routing (#profile, #security, #sessions)
- **MVC Architecture Refactoring** - 3 new Helpers (Layout, Domain, Session), ~265 lines cleaned from views
- **Geolocation Tracking** - IP-based location detection using ip-api.com, country flags with flag-icons
- **Device Detection** - Browser & device type parsing (Chrome/Firefox/Safari, Desktop/Mobile/Tablet)
- **Auto-Detected Cron Paths** - Settings show actual installation paths (thanks @jadeops)
- **Welcome Notifications** - Sent to new users on registration or fresh install
- **Upgrade Notifications** - Admins notified on system updates with version & migration count
- **Web-Based Installer** - Replaces CLI, auto-generates encryption key, one-time password display
- **Web-Based Updater** - `/install/update` for running new migrations with smart detection
- **User Registration** - Full signup flow with email verification, password reset, resend verification
- **User Management** - CRUD for users with filtering, sorting, pagination (admin-only)
- **Remember Me** - 30-day secure tokens linked to sessions, cascade deletion on logout
- **Session Validator** - Middleware validates sessions on every request for instant remote logout
- **Consistent UI/UX** - Unified filtering, sorting, pagination across Domains, Users, Notifications, TLD Registry
- **Smart Migrations** - Consolidated schema for fresh installs, incremental for upgrades
- **XSS Protection** - htmlspecialchars() applied across all user-facing data (thanks @jadeops)
2025-10-09 18:02:46 +03:00
|
|
|
'whois_failed' => 'exclamation-circle',
|
|
|
|
|
'system_welcome' => 'hand-sparkles',
|
|
|
|
|
'system_upgrade' => 'arrow-up',
|
Add import/export and update system
Implement CSV/JSON import and export for domains, notification groups and tags (with masking for sensitive channel data), including size/format validation, in-memory CSV building, and logging. Add tag transfer and bulk transfer actions (admin-only). Introduce a new update system: Add UpdateController and UpdateService, migration 025_add_update_system_v1.1.3.sql, and installer changes to include the new migration and version handling; provide endpoints to check, apply, rollback and configure updates. Update helpers and UI bits: add getUpdateBadgeInfo in LayoutHelper, update notification icons/redirects, and add getMaxUploadSize in ViewHelper. Misc: add NotificationGroup::findByName, tweak .gitignore backups path, and update related views and routes.
2026-02-11 17:43:23 +02:00
|
|
|
'update_available' => 'cloud-download-alt',
|
Upgraded to 1.1.0
1.1.0 (2025-10-09)
- **User Notifications System** - In-app notification center with 7 notification types, filtering, pagination
- **Advanced Session Management** - Database-backed sessions with geolocation (country, city, ISP)
- **Remote Session Control** - Terminate any device instantly with immediate logout validation
- **Enhanced Profile Page** - Sidebar navigation with 4 tabs, hash-based routing (#profile, #security, #sessions)
- **MVC Architecture Refactoring** - 3 new Helpers (Layout, Domain, Session), ~265 lines cleaned from views
- **Geolocation Tracking** - IP-based location detection using ip-api.com, country flags with flag-icons
- **Device Detection** - Browser & device type parsing (Chrome/Firefox/Safari, Desktop/Mobile/Tablet)
- **Auto-Detected Cron Paths** - Settings show actual installation paths (thanks @jadeops)
- **Welcome Notifications** - Sent to new users on registration or fresh install
- **Upgrade Notifications** - Admins notified on system updates with version & migration count
- **Web-Based Installer** - Replaces CLI, auto-generates encryption key, one-time password display
- **Web-Based Updater** - `/install/update` for running new migrations with smart detection
- **User Registration** - Full signup flow with email verification, password reset, resend verification
- **User Management** - CRUD for users with filtering, sorting, pagination (admin-only)
- **Remember Me** - 30-day secure tokens linked to sessions, cascade deletion on logout
- **Session Validator** - Middleware validates sessions on every request for instant remote logout
- **Consistent UI/UX** - Unified filtering, sorting, pagination across Domains, Users, Notifications, TLD Registry
- **Smart Migrations** - Consolidated schema for fresh installs, incremental for upgrades
- **XSS Protection** - htmlspecialchars() applied across all user-facing data (thanks @jadeops)
2025-10-09 18:02:46 +03:00
|
|
|
default => 'bell'
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Get notification color based on type
|
|
|
|
|
*/
|
|
|
|
|
private static function getNotificationColor(string $type): string
|
|
|
|
|
{
|
|
|
|
|
return match($type) {
|
|
|
|
|
'domain_expiring' => 'orange',
|
2026-02-08 22:58:59 +02:00
|
|
|
'domain_expired', 'domain_expired_status' => 'red',
|
|
|
|
|
'domain_available' => 'blue',
|
|
|
|
|
'domain_registered' => 'green',
|
|
|
|
|
'domain_redemption' => 'amber',
|
|
|
|
|
'domain_pending_delete' => 'rose',
|
Upgraded to 1.1.0
1.1.0 (2025-10-09)
- **User Notifications System** - In-app notification center with 7 notification types, filtering, pagination
- **Advanced Session Management** - Database-backed sessions with geolocation (country, city, ISP)
- **Remote Session Control** - Terminate any device instantly with immediate logout validation
- **Enhanced Profile Page** - Sidebar navigation with 4 tabs, hash-based routing (#profile, #security, #sessions)
- **MVC Architecture Refactoring** - 3 new Helpers (Layout, Domain, Session), ~265 lines cleaned from views
- **Geolocation Tracking** - IP-based location detection using ip-api.com, country flags with flag-icons
- **Device Detection** - Browser & device type parsing (Chrome/Firefox/Safari, Desktop/Mobile/Tablet)
- **Auto-Detected Cron Paths** - Settings show actual installation paths (thanks @jadeops)
- **Welcome Notifications** - Sent to new users on registration or fresh install
- **Upgrade Notifications** - Admins notified on system updates with version & migration count
- **Web-Based Installer** - Replaces CLI, auto-generates encryption key, one-time password display
- **Web-Based Updater** - `/install/update` for running new migrations with smart detection
- **User Registration** - Full signup flow with email verification, password reset, resend verification
- **User Management** - CRUD for users with filtering, sorting, pagination (admin-only)
- **Remember Me** - 30-day secure tokens linked to sessions, cascade deletion on logout
- **Session Validator** - Middleware validates sessions on every request for instant remote logout
- **Consistent UI/UX** - Unified filtering, sorting, pagination across Domains, Users, Notifications, TLD Registry
- **Smart Migrations** - Consolidated schema for fresh installs, incremental for upgrades
- **XSS Protection** - htmlspecialchars() applied across all user-facing data (thanks @jadeops)
2025-10-09 18:02:46 +03:00
|
|
|
'domain_updated' => 'green',
|
|
|
|
|
'session_new' => 'blue',
|
2026-02-08 22:58:59 +02:00
|
|
|
'session_failed' => 'red',
|
Upgraded to 1.1.0
1.1.0 (2025-10-09)
- **User Notifications System** - In-app notification center with 7 notification types, filtering, pagination
- **Advanced Session Management** - Database-backed sessions with geolocation (country, city, ISP)
- **Remote Session Control** - Terminate any device instantly with immediate logout validation
- **Enhanced Profile Page** - Sidebar navigation with 4 tabs, hash-based routing (#profile, #security, #sessions)
- **MVC Architecture Refactoring** - 3 new Helpers (Layout, Domain, Session), ~265 lines cleaned from views
- **Geolocation Tracking** - IP-based location detection using ip-api.com, country flags with flag-icons
- **Device Detection** - Browser & device type parsing (Chrome/Firefox/Safari, Desktop/Mobile/Tablet)
- **Auto-Detected Cron Paths** - Settings show actual installation paths (thanks @jadeops)
- **Welcome Notifications** - Sent to new users on registration or fresh install
- **Upgrade Notifications** - Admins notified on system updates with version & migration count
- **Web-Based Installer** - Replaces CLI, auto-generates encryption key, one-time password display
- **Web-Based Updater** - `/install/update` for running new migrations with smart detection
- **User Registration** - Full signup flow with email verification, password reset, resend verification
- **User Management** - CRUD for users with filtering, sorting, pagination (admin-only)
- **Remember Me** - 30-day secure tokens linked to sessions, cascade deletion on logout
- **Session Validator** - Middleware validates sessions on every request for instant remote logout
- **Consistent UI/UX** - Unified filtering, sorting, pagination across Domains, Users, Notifications, TLD Registry
- **Smart Migrations** - Consolidated schema for fresh installs, incremental for upgrades
- **XSS Protection** - htmlspecialchars() applied across all user-facing data (thanks @jadeops)
2025-10-09 18:02:46 +03:00
|
|
|
'whois_failed' => 'gray',
|
|
|
|
|
'system_welcome' => 'purple',
|
|
|
|
|
'system_upgrade' => 'indigo',
|
Add import/export and update system
Implement CSV/JSON import and export for domains, notification groups and tags (with masking for sensitive channel data), including size/format validation, in-memory CSV building, and logging. Add tag transfer and bulk transfer actions (admin-only). Introduce a new update system: Add UpdateController and UpdateService, migration 025_add_update_system_v1.1.3.sql, and installer changes to include the new migration and version handling; provide endpoints to check, apply, rollback and configure updates. Update helpers and UI bits: add getUpdateBadgeInfo in LayoutHelper, update notification icons/redirects, and add getMaxUploadSize in ViewHelper. Misc: add NotificationGroup::findByName, tweak .gitignore backups path, and update related views and routes.
2026-02-11 17:43:23 +02:00
|
|
|
'update_available' => 'blue',
|
Upgraded to 1.1.0
1.1.0 (2025-10-09)
- **User Notifications System** - In-app notification center with 7 notification types, filtering, pagination
- **Advanced Session Management** - Database-backed sessions with geolocation (country, city, ISP)
- **Remote Session Control** - Terminate any device instantly with immediate logout validation
- **Enhanced Profile Page** - Sidebar navigation with 4 tabs, hash-based routing (#profile, #security, #sessions)
- **MVC Architecture Refactoring** - 3 new Helpers (Layout, Domain, Session), ~265 lines cleaned from views
- **Geolocation Tracking** - IP-based location detection using ip-api.com, country flags with flag-icons
- **Device Detection** - Browser & device type parsing (Chrome/Firefox/Safari, Desktop/Mobile/Tablet)
- **Auto-Detected Cron Paths** - Settings show actual installation paths (thanks @jadeops)
- **Welcome Notifications** - Sent to new users on registration or fresh install
- **Upgrade Notifications** - Admins notified on system updates with version & migration count
- **Web-Based Installer** - Replaces CLI, auto-generates encryption key, one-time password display
- **Web-Based Updater** - `/install/update` for running new migrations with smart detection
- **User Registration** - Full signup flow with email verification, password reset, resend verification
- **User Management** - CRUD for users with filtering, sorting, pagination (admin-only)
- **Remember Me** - 30-day secure tokens linked to sessions, cascade deletion on logout
- **Session Validator** - Middleware validates sessions on every request for instant remote logout
- **Consistent UI/UX** - Unified filtering, sorting, pagination across Domains, Users, Notifications, TLD Registry
- **Smart Migrations** - Consolidated schema for fresh installs, incremental for upgrades
- **XSS Protection** - htmlspecialchars() applied across all user-facing data (thanks @jadeops)
2025-10-09 18:02:46 +03:00
|
|
|
default => 'gray'
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Get application settings
|
|
|
|
|
*/
|
|
|
|
|
public static function getAppSettings(): array
|
|
|
|
|
{
|
|
|
|
|
try {
|
|
|
|
|
$settingModel = new Setting();
|
|
|
|
|
$appSettings = $settingModel->getAppSettings();
|
|
|
|
|
|
|
|
|
|
return [
|
|
|
|
|
'app_name' => htmlspecialchars($appSettings['app_name']),
|
|
|
|
|
'app_timezone' => $appSettings['app_timezone'],
|
|
|
|
|
'app_version' => $appSettings['app_version']
|
|
|
|
|
];
|
|
|
|
|
} catch (\Exception $e) {
|
|
|
|
|
// Fallback defaults
|
|
|
|
|
$settingModel = new Setting();
|
|
|
|
|
return [
|
|
|
|
|
'app_name' => 'Domain Monitor',
|
|
|
|
|
'app_timezone' => 'UTC',
|
|
|
|
|
'app_version' => $settingModel->getAppVersion()
|
|
|
|
|
];
|
|
|
|
|
}
|
|
|
|
|
}
|
Add import/export and update system
Implement CSV/JSON import and export for domains, notification groups and tags (with masking for sensitive channel data), including size/format validation, in-memory CSV building, and logging. Add tag transfer and bulk transfer actions (admin-only). Introduce a new update system: Add UpdateController and UpdateService, migration 025_add_update_system_v1.1.3.sql, and installer changes to include the new migration and version handling; provide endpoints to check, apply, rollback and configure updates. Update helpers and UI bits: add getUpdateBadgeInfo in LayoutHelper, update notification icons/redirects, and add getMaxUploadSize in ViewHelper. Misc: add NotificationGroup::findByName, tweak .gitignore backups path, and update related views and routes.
2026-02-11 17:43:23 +02:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Get update badge info for the top menu (admin only).
|
|
|
|
|
* Uses cached update check data; no GitHub API call.
|
|
|
|
|
* Returns ['show' => bool, 'available' => bool, 'label' => string].
|
|
|
|
|
*/
|
|
|
|
|
public static function getUpdateBadgeInfo(): array
|
|
|
|
|
{
|
|
|
|
|
try {
|
|
|
|
|
$settingModel = new Setting();
|
|
|
|
|
$updateSettings = $settingModel->getUpdateSettings();
|
|
|
|
|
$badgeEnabled = ($updateSettings['update_badge_enabled'] ?? '1') !== '0';
|
|
|
|
|
if (!$badgeEnabled) {
|
|
|
|
|
return ['show' => false, 'available' => false, 'label' => ''];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$current = $settingModel->getAppVersion();
|
|
|
|
|
$latestVersion = $updateSettings['latest_available_version'] ?? null;
|
|
|
|
|
$channel = $updateSettings['update_channel'] ?? 'stable';
|
|
|
|
|
$commitsBehind = (int) ($updateSettings['commits_behind_count'] ?? 0);
|
2026-02-11 19:24:39 +02:00
|
|
|
$installedSha = $updateSettings['installed_commit_sha'] ?? '';
|
|
|
|
|
$remoteSha = $updateSettings['latest_remote_sha'] ?? '';
|
|
|
|
|
|
|
|
|
|
// If installed SHA matches remote SHA, the cached commits_behind is stale
|
|
|
|
|
if ($installedSha !== '' && $remoteSha !== '' && str_starts_with($installedSha, $remoteSha)) {
|
|
|
|
|
$commitsBehind = 0;
|
|
|
|
|
}
|
Add import/export and update system
Implement CSV/JSON import and export for domains, notification groups and tags (with masking for sensitive channel data), including size/format validation, in-memory CSV building, and logging. Add tag transfer and bulk transfer actions (admin-only). Introduce a new update system: Add UpdateController and UpdateService, migration 025_add_update_system_v1.1.3.sql, and installer changes to include the new migration and version handling; provide endpoints to check, apply, rollback and configure updates. Update helpers and UI bits: add getUpdateBadgeInfo in LayoutHelper, update notification icons/redirects, and add getMaxUploadSize in ViewHelper. Misc: add NotificationGroup::findByName, tweak .gitignore backups path, and update related views and routes.
2026-02-11 17:43:23 +02:00
|
|
|
|
|
|
|
|
$available = false;
|
|
|
|
|
$label = '';
|
|
|
|
|
|
|
|
|
|
if ($latestVersion && version_compare($latestVersion, $current, '>')) {
|
|
|
|
|
$available = true;
|
|
|
|
|
$label = 'v' . $latestVersion;
|
|
|
|
|
}
|
|
|
|
|
if ($channel === 'latest' && $commitsBehind > 0 && !$available) {
|
|
|
|
|
$available = true;
|
|
|
|
|
$label = $commitsBehind . ' commit' . ($commitsBehind !== 1 ? 's' : '');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return [
|
|
|
|
|
'show' => $available,
|
|
|
|
|
'available' => $available,
|
|
|
|
|
'label' => $label,
|
|
|
|
|
];
|
|
|
|
|
} catch (\Exception $e) {
|
|
|
|
|
return ['show' => false, 'available' => false, 'label' => ''];
|
|
|
|
|
}
|
|
|
|
|
}
|
Upgraded to 1.1.0
1.1.0 (2025-10-09)
- **User Notifications System** - In-app notification center with 7 notification types, filtering, pagination
- **Advanced Session Management** - Database-backed sessions with geolocation (country, city, ISP)
- **Remote Session Control** - Terminate any device instantly with immediate logout validation
- **Enhanced Profile Page** - Sidebar navigation with 4 tabs, hash-based routing (#profile, #security, #sessions)
- **MVC Architecture Refactoring** - 3 new Helpers (Layout, Domain, Session), ~265 lines cleaned from views
- **Geolocation Tracking** - IP-based location detection using ip-api.com, country flags with flag-icons
- **Device Detection** - Browser & device type parsing (Chrome/Firefox/Safari, Desktop/Mobile/Tablet)
- **Auto-Detected Cron Paths** - Settings show actual installation paths (thanks @jadeops)
- **Welcome Notifications** - Sent to new users on registration or fresh install
- **Upgrade Notifications** - Admins notified on system updates with version & migration count
- **Web-Based Installer** - Replaces CLI, auto-generates encryption key, one-time password display
- **Web-Based Updater** - `/install/update` for running new migrations with smart detection
- **User Registration** - Full signup flow with email verification, password reset, resend verification
- **User Management** - CRUD for users with filtering, sorting, pagination (admin-only)
- **Remember Me** - 30-day secure tokens linked to sessions, cascade deletion on logout
- **Session Validator** - Middleware validates sessions on every request for instant remote logout
- **Consistent UI/UX** - Unified filtering, sorting, pagination across Domains, Users, Notifications, TLD Registry
- **Smart Migrations** - Consolidated schema for fresh installs, incremental for upgrades
- **XSS Protection** - htmlspecialchars() applied across all user-facing data (thanks @jadeops)
2025-10-09 18:02:46 +03:00
|
|
|
}
|
|
|
|
|
|