This repository has been archived by the owner on Aug 1, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
init.php
74 lines (57 loc) · 2.1 KB
/
init.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
71
72
73
74
<?php
define('IN_GMTM', true);
error_reporting(E_ALL ^ E_NOTICE);
$Template = 'Spark';
//! ---------------------------------------------------
//! Filter all user inputs
//! ---------------------------------------------------
$_GET = filter_input_array(
INPUT_GET,
FILTER_SANITIZE_SPECIAL_CHARS
);
$_POST = filter_input_array(
INPUT_POST,
FILTER_SANITIZE_SPECIAL_CHARS
);
$_COOKIE = filter_input_array(
INPUT_COOKIE,
FILTER_SANITIZE_SPECIAL_CHARS
);
$_SERVER = filter_input_array(
INPUT_SERVER,
FILTER_SANITIZE_SPECIAL_CHARS
);
//! ---------------------------------------------------
//! Directories
//! ---------------------------------------------------
define('ROOT', dirname(__FILE__) . "/");
define('INCLUDES_PATH', ROOT . "inc/");
define('FUNCTIONS_PATH', INCLUDES_PATH . "Functions/");
define('CLASS_PATH', INCLUDES_PATH . "Class/");
//! ---------------------------------------------------
//! Are we installed?
//! ---------------------------------------------------
//? Composer autoload
if (!file_exists(INCLUDES_PATH . '/vendor/autoload.php')) {
die('Compose autoload not found! Run `composer install` in the root directory of your GMTM installation.');
}
use Josantonius\Json\Json;
require_once INCLUDES_PATH . '/vendor/autoload.php';
require_once CLASS_PATH . 'steamAPI.php';
require_once FUNCTIONS_PATH . 'system-functions.php';
//! ---------------------------------------------------
//! smarty setup
//! ---------------------------------------------------
$smarty = new Smarty();
$smarty->setTemplateDir(ROOT . "template/$Template/");
$smarty->setConfigDir(ROOT . "template/$Template/config");
$smarty->setCompileDir(ROOT . 'smarty/compile/');
$smarty->setCacheDir(ROOT . 'smarty/cache/');
//! ---------------------------------------------------
//! Initial setup
//! ---------------------------------------------------
$version_json = new Json('version.json');
$version = $version_json->get();
define('GMTM_VERSION', $version['GMTM_VERSION'] ?? 'N/A');
define('GMTM_VERSION_CODENAME', $version['GMTM_BRANCH'] ?? 'N/A');
define('GMTM_BRANCH', $version['GMTM_BRANCH'] ?? 'N/A');