-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.php
More file actions
34 lines (28 loc) · 1 KB
/
index.php
File metadata and controls
34 lines (28 loc) · 1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
<?php
// Main entry point - handles installation check and redirects
declare(strict_types=1);
// Check if system is installed
$installLockFile = __DIR__ . '/install.lock';
$isInstalled = file_exists($installLockFile);
// If not installed, redirect to installer
if (!$isInstalled) {
// Check if we're already on the install page to avoid redirect loops
$currentPath = $_SERVER['REQUEST_URI'] ?? '';
if (!str_starts_with($currentPath, '/install')) {
header('Location: /install/');
exit;
}
}
// If installed, redirect to admin login
if ($isInstalled) {
// Check if we're already on the admin page to avoid redirect loops
$currentPath = $_SERVER['REQUEST_URI'] ?? '';
if (!str_starts_with($currentPath, '/admin')) {
header('Location: /admin/');
exit;
}
}
// Fallback - should not reach here in normal operation
http_response_code(200);
header('Content-Type: text/plain; charset=utf-8');
echo 'Codev Support Chat backend is installed. Use /api for API routes.';