2025-10-08 14:23:07 +03:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
use Core\Application;
|
|
|
|
|
use Core\Auth;
|
|
|
|
|
use App\Controllers\DashboardController;
|
|
|
|
|
use App\Controllers\DomainController;
|
|
|
|
|
use App\Controllers\NotificationGroupController;
|
|
|
|
|
use App\Controllers\AuthController;
|
|
|
|
|
use App\Controllers\DebugController;
|
|
|
|
|
use App\Controllers\SearchController;
|
|
|
|
|
use App\Controllers\TldRegistryController;
|
2025-10-08 18:54:34 +03:00
|
|
|
use App\Controllers\SettingsController;
|
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
|
|
|
use App\Controllers\ProfileController;
|
|
|
|
|
use App\Controllers\UserController;
|
|
|
|
|
use App\Controllers\InstallerController;
|
|
|
|
|
use App\Controllers\NotificationController;
|
2025-10-10 14:01:19 +03:00
|
|
|
use App\Controllers\ErrorLogController;
|
2025-10-08 14:23:07 +03:00
|
|
|
|
|
|
|
|
$router = Application::$router;
|
|
|
|
|
|
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
|
|
|
// Installer routes (public - before auth)
|
|
|
|
|
$router->get('/install', [InstallerController::class, 'index']);
|
|
|
|
|
$router->get('/install/check-database', [InstallerController::class, 'checkDatabase']);
|
|
|
|
|
$router->post('/install/run', [InstallerController::class, 'install']);
|
|
|
|
|
$router->get('/install/complete', [InstallerController::class, 'complete']);
|
|
|
|
|
$router->get('/install/update', [InstallerController::class, 'showUpdate']);
|
|
|
|
|
$router->post('/install/update', [InstallerController::class, 'runUpdate']);
|
|
|
|
|
|
2025-10-08 14:23:07 +03:00
|
|
|
// Authentication routes (public)
|
|
|
|
|
$router->get('/login', [AuthController::class, 'showLogin']);
|
|
|
|
|
$router->post('/login', [AuthController::class, 'login']);
|
|
|
|
|
$router->get('/logout', [AuthController::class, 'logout']);
|
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
|
|
|
$router->get('/register', [AuthController::class, 'showRegister']);
|
|
|
|
|
$router->post('/register', [AuthController::class, 'register']);
|
|
|
|
|
$router->get('/verify-email', [AuthController::class, 'showVerifyEmail']);
|
|
|
|
|
$router->get('/resend-verification', [AuthController::class, 'resendVerification']);
|
|
|
|
|
$router->get('/forgot-password', [AuthController::class, 'showForgotPassword']);
|
|
|
|
|
$router->post('/forgot-password', [AuthController::class, 'forgotPassword']);
|
|
|
|
|
$router->get('/reset-password', [AuthController::class, 'showResetPassword']);
|
|
|
|
|
$router->post('/reset-password', [AuthController::class, 'resetPassword']);
|
2025-10-08 14:23:07 +03:00
|
|
|
|
|
|
|
|
// Debug route (public - remove in production!)
|
|
|
|
|
$router->get('/debug/whois', [DebugController::class, 'whois']);
|
|
|
|
|
|
|
|
|
|
// Protected routes - require authentication
|
|
|
|
|
Auth::require();
|
|
|
|
|
|
|
|
|
|
// Dashboard
|
|
|
|
|
$router->get('/', [DashboardController::class, 'index']);
|
|
|
|
|
$router->get('/dashboard', [DashboardController::class, 'index']);
|
|
|
|
|
|
|
|
|
|
// Search
|
|
|
|
|
$router->get('/search', [SearchController::class, 'index']);
|
|
|
|
|
$router->get('/api/search/suggest', [SearchController::class, 'suggest']);
|
|
|
|
|
|
|
|
|
|
// Domains
|
|
|
|
|
$router->get('/domains', [DomainController::class, 'index']);
|
|
|
|
|
$router->get('/domains/create', [DomainController::class, 'create']);
|
|
|
|
|
$router->get('/domains/bulk-add', [DomainController::class, 'bulkAdd']);
|
|
|
|
|
$router->post('/domains/bulk-add', [DomainController::class, 'bulkAdd']);
|
|
|
|
|
$router->post('/domains/bulk-refresh', [DomainController::class, 'bulkRefresh']);
|
|
|
|
|
$router->post('/domains/bulk-delete', [DomainController::class, 'bulkDelete']);
|
|
|
|
|
$router->post('/domains/bulk-assign-group', [DomainController::class, 'bulkAssignGroup']);
|
|
|
|
|
$router->post('/domains/bulk-toggle-status', [DomainController::class, 'bulkToggleStatus']);
|
|
|
|
|
$router->post('/domains/store', [DomainController::class, 'store']);
|
|
|
|
|
$router->get('/domains/{id}', [DomainController::class, 'show']);
|
|
|
|
|
$router->get('/domains/{id}/edit', [DomainController::class, 'edit']);
|
|
|
|
|
$router->post('/domains/{id}/update', [DomainController::class, 'update']);
|
2025-10-08 20:56:25 +03:00
|
|
|
$router->post('/domains/{id}/update-notes', [DomainController::class, 'updateNotes']);
|
2025-10-08 14:23:07 +03:00
|
|
|
$router->post('/domains/{id}/refresh', [DomainController::class, 'refresh']);
|
|
|
|
|
$router->post('/domains/{id}/delete', [DomainController::class, 'delete']);
|
|
|
|
|
|
|
|
|
|
// Notification Groups
|
|
|
|
|
$router->get('/groups', [NotificationGroupController::class, 'index']);
|
|
|
|
|
$router->get('/groups/create', [NotificationGroupController::class, 'create']);
|
|
|
|
|
$router->post('/groups/store', [NotificationGroupController::class, 'store']);
|
|
|
|
|
$router->get('/groups/edit', [NotificationGroupController::class, 'edit']);
|
|
|
|
|
$router->post('/groups/update', [NotificationGroupController::class, 'update']);
|
|
|
|
|
$router->get('/groups/delete', [NotificationGroupController::class, 'delete']);
|
2025-10-10 14:01:19 +03:00
|
|
|
$router->post('/groups/bulk-delete', [NotificationGroupController::class, 'bulkDelete']);
|
2025-10-08 14:23:07 +03:00
|
|
|
|
|
|
|
|
// Notification Channels
|
|
|
|
|
$router->post('/channels/add', [NotificationGroupController::class, 'addChannel']);
|
|
|
|
|
$router->get('/channels/delete', [NotificationGroupController::class, 'deleteChannel']);
|
|
|
|
|
$router->get('/channels/toggle', [NotificationGroupController::class, 'toggleChannel']);
|
|
|
|
|
|
|
|
|
|
// TLD Registry
|
|
|
|
|
$router->get('/tld-registry', [TldRegistryController::class, 'index']);
|
|
|
|
|
$router->get('/tld-registry/{id}', [TldRegistryController::class, 'show']);
|
|
|
|
|
$router->post('/tld-registry/import-tld-list', [TldRegistryController::class, 'importTldList']);
|
|
|
|
|
$router->post('/tld-registry/import-rdap', [TldRegistryController::class, 'importRdap']);
|
|
|
|
|
$router->post('/tld-registry/import-whois', [TldRegistryController::class, 'importWhois']);
|
|
|
|
|
$router->post('/tld-registry/start-progressive-import', [TldRegistryController::class, 'startProgressiveImport']);
|
|
|
|
|
$router->get('/tld-registry/import-progress/{log_id}', [TldRegistryController::class, 'importProgress']);
|
|
|
|
|
$router->get('/tld-registry/api/import-progress', [TldRegistryController::class, 'apiGetImportProgress']);
|
|
|
|
|
$router->post('/tld-registry/bulk-delete', [TldRegistryController::class, 'bulkDelete']);
|
|
|
|
|
$router->get('/tld-registry/check-updates', [TldRegistryController::class, 'checkUpdates']);
|
|
|
|
|
$router->get('/tld-registry/{id}/toggle-active', [TldRegistryController::class, 'toggleActive']);
|
|
|
|
|
$router->get('/tld-registry/{id}/refresh', [TldRegistryController::class, 'refresh']);
|
|
|
|
|
$router->get('/tld-registry/import-logs', [TldRegistryController::class, 'importLogs']);
|
|
|
|
|
$router->get('/api/tld-info', [TldRegistryController::class, 'apiGetTldInfo']);
|
|
|
|
|
|
2025-10-08 18:54:34 +03:00
|
|
|
// Settings
|
|
|
|
|
$router->get('/settings', [SettingsController::class, 'index']);
|
|
|
|
|
$router->post('/settings/update', [SettingsController::class, 'update']);
|
|
|
|
|
$router->post('/settings/update-app', [SettingsController::class, 'updateApp']);
|
|
|
|
|
$router->post('/settings/update-email', [SettingsController::class, 'updateEmail']);
|
Add CSRF, CAPTCHA, and input validation improvements
Introduces CSRF protection to all sensitive controller actions, integrates configurable CAPTCHA (reCAPTCHA v2/v3, Turnstile) for authentication and registration flows, and centralizes input validation via a new InputValidator helper. Adds new helpers and services for CSRF and CAPTCHA, updates settings and migration for CAPTCHA configuration, and enhances logging and error handling in TLD registry import processes. Also improves validation for user, domain, group, and profile inputs throughout the application.
2025-10-10 00:04:12 +03:00
|
|
|
$router->post('/settings/update-captcha', [SettingsController::class, 'updateCaptcha']);
|
2025-10-08 18:54:34 +03:00
|
|
|
$router->post('/settings/test-email', [SettingsController::class, 'testEmail']);
|
|
|
|
|
$router->post('/settings/test-cron', [SettingsController::class, 'testCron']);
|
|
|
|
|
$router->post('/settings/clear-logs', [SettingsController::class, 'clearLogs']);
|
|
|
|
|
|
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
|
|
|
// Profile
|
|
|
|
|
$router->get('/profile', [ProfileController::class, 'index']);
|
|
|
|
|
$router->post('/profile/update', [ProfileController::class, 'update']);
|
|
|
|
|
$router->post('/profile/change-password', [ProfileController::class, 'changePassword']);
|
|
|
|
|
$router->get('/profile/delete', [ProfileController::class, 'delete']);
|
|
|
|
|
$router->get('/profile/resend-verification', [ProfileController::class, 'resendVerification']);
|
|
|
|
|
$router->post('/profile/logout-other-sessions', [ProfileController::class, 'logoutOtherSessions']);
|
|
|
|
|
$router->post('/profile/logout-session/{sessionId}', [ProfileController::class, 'logoutSession']);
|
|
|
|
|
|
|
|
|
|
// Notifications
|
|
|
|
|
$router->get('/notifications', [NotificationController::class, 'index']);
|
|
|
|
|
$router->get('/notifications/{id}/mark-read', [NotificationController::class, 'markAsRead']);
|
|
|
|
|
$router->get('/notifications/mark-all-read', [NotificationController::class, 'markAllAsRead']);
|
|
|
|
|
$router->get('/notifications/{id}/delete', [NotificationController::class, 'delete']);
|
|
|
|
|
$router->get('/notifications/clear-all', [NotificationController::class, 'clearAll']);
|
|
|
|
|
$router->get('/api/notifications/unread-count', [NotificationController::class, 'getUnreadCount']);
|
|
|
|
|
$router->get('/api/notifications/recent', [NotificationController::class, 'getRecent']);
|
|
|
|
|
|
|
|
|
|
// User Management (Admin Only)
|
|
|
|
|
$router->get('/users', [UserController::class, 'index']);
|
|
|
|
|
$router->get('/users/create', [UserController::class, 'create']);
|
|
|
|
|
$router->post('/users/store', [UserController::class, 'store']);
|
|
|
|
|
$router->get('/users/edit', [UserController::class, 'edit']);
|
|
|
|
|
$router->post('/users/update', [UserController::class, 'update']);
|
|
|
|
|
$router->get('/users/delete', [UserController::class, 'delete']);
|
|
|
|
|
$router->get('/users/toggle-status', [UserController::class, 'toggleStatus']);
|
2025-10-10 14:01:19 +03:00
|
|
|
$router->post('/users/bulk-toggle-status', [UserController::class, 'bulkToggleStatus']);
|
|
|
|
|
$router->post('/users/bulk-delete', [UserController::class, 'bulkDelete']);
|
|
|
|
|
|
|
|
|
|
// Error Logs (Admin Only)
|
|
|
|
|
$router->get('/errors', [ErrorLogController::class, 'index']);
|
|
|
|
|
$router->get('/errors/{id}', [ErrorLogController::class, 'show']);
|
|
|
|
|
$router->post('/errors/{id}/resolve', [ErrorLogController::class, 'markResolved']);
|
|
|
|
|
$router->post('/errors/{id}/unresolve', [ErrorLogController::class, 'markUnresolved']);
|
|
|
|
|
$router->post('/errors/{id}/delete', [ErrorLogController::class, 'delete']);
|
|
|
|
|
$router->post('/errors/bulk-delete', [ErrorLogController::class, 'bulkDelete']);
|
|
|
|
|
$router->post('/errors/clear-resolved', [ErrorLogController::class, 'clearResolved']);
|
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
|
|
|
|