-
-
Notifications
You must be signed in to change notification settings - Fork 311
/
install.php
70 lines (57 loc) · 1.8 KB
/
install.php
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
<?php
/*
* Made by Samerton
* https://github.com/NamelessMC/Nameless/
* NamelessMC version 2.0.0-pr13
*
* License: MIT
*
* Installer
*/
require_once __DIR__ . '/vendor/autoload.php';
if (getenv('NAMELESS_DEBUGGING') || isset($_SERVER['NAMELESS_DEBUGGING'])) {
define('DEBUGGING', 1);
}
// Definitions
if (!defined('PATH')) {
define('PATH', '/');
define('ROOT_PATH', __DIR__);
}
$page = 'install';
$install_path = str_replace('\\', '/', substr(__DIR__, strlen($_SERVER['DOCUMENT_ROOT'])));
// Start initialising the page
require(ROOT_PATH . '/core/init.php');
// Disable error reporting
error_reporting(0);
ini_set('display_errors', 0);
// Set default timezone to prevent potential issues
date_default_timezone_set('Europe/London');
// Select language
if (
isset($_SESSION['installer_language'])
&& is_file('modules/Core/language/' . $_SESSION['installer_language'] . '.json')
) {
$language_short_code = $_SESSION['installer_language'];
} else {
// Require default language (English UK)
$language_short_code = 'en_UK';
}
$language = new Language('core', $language_short_code);
// Get installation path
$install_path = substr(str_replace('\\', '/', substr(__DIR__, strlen($_SERVER['DOCUMENT_ROOT']))), 1);
if (Config::exists() && Config::get('core.installed') === true) {
require(ROOT_PATH . '/core/installation/already_installed.php');
return;
}
if (isset($_GET['language'])) {
if (str_contains($_GET['language'], '/')) {
die('Language code must not contain slash');
}
// Set language
if (is_file('modules/Core/language/' . $_GET['language'] . '.json')) {
$_SESSION['installer_language'] = $_GET['language'];
die('OK');
}
die($_GET['language'] . ' is not a valid language');
}
require(ROOT_PATH . '/core/installation/installer.php');