-
-
Notifications
You must be signed in to change notification settings - Fork 18
/
core.php
55 lines (45 loc) · 1.52 KB
/
core.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
<?php
/*
* rverse
* (c) 2018 RverseTeam
*/
namespace Miiverse;
use Miiverse\Helpers\ConsoleAuth;
require_once 'vendor/autoload.php';
error_reporting(E_ALL ^ E_NOTICE | E_STRICT);
setlocale(LC_TIME, 'English');
ExceptionHandler::register();
Config::load();
DB::connect(config('database'));
Cache::init();
Hashid::init(config('general.link_salt'));
Router::init();
if (php_sapi_name() !== "cli") {
$siteUrl = $_SERVER['SERVER_NAME'];
// 3DS domain check
if (in_array($siteUrl, config('sites.3ds'))) {
$template = '3ds';
// 3DS pjax stuff
if (array_key_exists('_pjax', $_GET) && array_key_exists('HTTP_X_PJAX', $_SERVER)) {
// pjax doesn't like queries on the header, for some reason
$pjaxurl = preg_replace('/\?.+/', '', $_SERVER['REQUEST_URI']);
header('X-PJAX-PATH: '.$pjaxurl);
header('X-PJAX-OK: 1');
}
require_once path('routes/3ds.php');
} else if (in_array($siteUrl, config('sites.wiiu'))) {
$template = 'wiiu';
require_once path('routes/wiiu.php');
} else if (in_array($siteUrl, config('sites.web'))) {
$template = 'web';
require_once path('routes/web.php');
} else if (in_array($siteUrl, config('sites.admin'))) {
$template = 'admin';
require_once path('routes/admin.php');
} else if (in_array($siteUrl, config('sites.pub'))) {
$template = 'pub';
require_once path('routes/pub.php');
} else {
require_once path('routes/default.php');
}
}