1<?php
2define('NEXUS', true);
3
4require_once __DIR__ . '/config.php';
5require_once __DIR__ . '/db.php';
6require_once __DIR__ . '/functions.php';
7
8start_session();
9
10
11if (!file_exists(DATA . '/installed.lock')) {
12 $uri = $_SERVER['REQUEST_URI'] ?? '';
13 if (strpos($uri, '/install') === false) {
14 header('Location: ' . BASE . '/install/');
15 exit;
16 }
17}
18
19
20
21
22static $_dbInited = false;
23if (!$_dbInited) {
24 try {
25 DB::init();
26 $_dbInited = true;
27 } catch (Throwable $e) {
28
29 error_log('Nexus DB::init() failed: ' . $e->getMessage());
30 }
31}
32
33require_once __DIR__ . '/markdown.php';
34require_once __DIR__ . '/addons.php';
35
36
37$USER = current_user();
38
39
40AddonManager::boot();