-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathautoload.php
75 lines (59 loc) · 2.44 KB
/
autoload.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
75
<?php
session_start();
require "system/files/timer.start.php";
$error = false;
/*if (!file_exists(__DIR__ . "/.installed")) {
header("Location: install.php");
die("System not installed.");
}*/
$logged = false;
require "config.php";
$config["debug"] == true ? error_reporting(E_ALL) && ini_set('display_errors', 1) : error_reporting(0) && ini_set('display_errors', 0);
require_once ROOT . "system/files/functions.php";
// Parsedown
require_once ROOT . "software/Parsedown.php";
$parsedown = new Parsedown();
$parsedown->setSafeMode(true);
$parsedown->setBreaksEnabled(true);
// HTML-Purifier
require_once ROOT . "software/HTMLPurifier/HTMLPurifier.auto.php";
$purifier = new HTMLPurifier(HTMLPurifier_Config::createDefault());
// Salt
if (!file_exists(ps(__DIR__ . "/system/data/salt.txt"))) {
die("System needs a salt!! located in 'system/data/salt.txt'");
}
$config["salt"] = file_get_contents(ps(__DIR__ . "/system/data/salt.txt"));
if (empty($config["salt"])) {
die("Salt cannot be empty!!");
}
// Default user lang
// if (!file_exists(ps(__DIR__ . "/system/languages/{$config["default"]["lang"]}.php"))) {
// die("Default language file not found.");
// }
// require_once ps(__DIR__ . "/system/languages/{$config["default"]["lang"]}.php");
// Smarty
require __DIR__ . "/system/themes/{$config["theme"]}/info.php";
require_once ROOT . "software/Smarty/Smarty.class.php";
$smarty = new Smarty();
$smarty->setTemplateDir(ps(__DIR__ . $config["smarty"]["template"] . "/" . $config["theme"] . "/themes/" . $theme["config"]["theme"]));
$smarty->setConfigDir(ps(__DIR__ . $config["smarty"]["config"]));
$smarty->setCompileDir(ps(__DIR__ . $config["smarty"]["compile"]));
$smarty->setCacheDir(ps(__DIR__ . $config["smarty"]["cache"]));
// Getting all plugins for the Theme
foreach ($theme["plugins"] as $reqPlugin) {
if (!file_exists(ps(__DIR__ . "/system/plugins/" . $reqPlugin . ".php"))) {
die("This theme requires following plugin: " . $reqPlugin);
}
require_once ps(__DIR__ . "/system/plugins/" . $reqPlugin . ".php");
}
// Assigning variables
$smarty->assign("theme", $theme);
$smarty->assign("config", $config);
$smarty->assign("version", file_get_contents(ps(__DIR__ . "/version.txt")));
$smarty->assign("parsedown", $parsedown);
// Time Zone
# I know you could solve it date_default_timezone_get() but whatever
$date = new DateTime();
$timeZone = $date->getTimezone();
$timeZone = $timeZone->getName();
$smarty->assign("timeZone", $timeZone);