-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.php
42 lines (34 loc) · 1.13 KB
/
index.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
<?php
if (version_compare($ver = PHP_VERSION, $req = "8.0.0", "<")) {
exit(sprintf("You are running PHP %s, but GreenCheap needs at least <strong>PHP %s</strong> to run.", $ver, $req));
}
if (PHP_SAPI == "cli-server" && is_file(__DIR__ . parse_url($_SERVER["REQUEST_URI"], PHP_URL_PATH))) {
return false;
}
if (!isset($_SERVER["HTTP_MOD_REWRITE"]) && !isset($_SERVER["REDIRECT_HTTP_MOD_REWRITE"])) {
$_SERVER["HTTP_MOD_REWRITE"] = "Off";
} else {
$_SERVER["HTTP_MOD_REWRITE"] = "On";
}
date_default_timezone_set("UTC");
$env = "system";
$path = __DIR__;
$config = [
"path" => $path,
"path.packages" => $path . "/packages",
"path.storage" => $path . "/storage",
"path.temp" => $path . "/tmp/temp",
"path.cache" => $path . "/tmp/cache",
"path.logs" => $path . "/tmp/logs",
"path.vendor" => $path . "/vendor",
"path.artifact" => $path . "/tmp/packages",
"config.file" => realpath($path . "/config.php"),
"system.api" => "https://greencheap.net",
];
if (!$config["config.file"]) {
$env = "installer";
}
if (PHP_SAPI == "cli") {
$env = "console";
}
require_once "$path/app/$env/app.php";