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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
|
<?php
global $_FNSN_DUMP_STARTDATE;
$_FNSN_DUMP_STARTDATE = new DateTime("now");
// Preloader, if enabled
if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/semantic_resourcesPreload")) {
echo('<link rel="preload" href="/resources/themes/colors/dark.js" as="script">');
echo('<link rel="preload" href="/resources/themes/icons/classic.js" as="script">');
echo('<link rel="preload" href="/resources/themes/icons/suru.js" as="script">');
echo('<link rel="preload" href="/resources/js/right-click.js" as="script">');
echo('<link rel="preload" href="/resources/js/jquery.js" as="script">');
echo('<link rel="preload" href="/resources/lib/pushbar.js/library.js" as="script">');
echo('<link rel="preload" href="/resources/lib/pushbar.js/library.css" as="style">');
echo('<link rel="preload" href="/resources/css/ui.css" as="style">');
echo('<link rel="preload" href="/resources/css/snowapi.css" as="style">');
echo('<link rel="preload" href="/resources/css/setup.css" as="style">');
echo('<link rel="preload" href="/resources/css/right-click.css" as="style">');
echo('<link rel="preload" href="/resources/css/preview.css" as="style">');
echo('<link rel="preload" href="/resources/css/main.css" as="style">');
echo('<link rel="preload" href="/resources/css/index.php" as="style">');
echo('<link rel="preload" href="/resources/css/error.css" as="style">');
echo('<link rel="preload" href="/resources/css/admin.css" as="style">');
}
// This will run only if the website is ready
if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent")) {
// Custom settings parser
if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/customSettings.json")) {
if (dataValid(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/customSettings.json"))) {
$customSettings = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/customSettings.json"));
if (isset($customSettings->AfficherBoutonAdministration) && isset($customSettings->AdministrationBarreNavigation) && isset($customSettings->RessourcesPersonnalisées) && isset($customSettings->RessourcesPersonnalisées->CSS) && isset($customSettings->RessourcesPersonnalisées->JS) && isset($customSettings->PagesMasquées)) { // If it's using the old system, delete the file and generate a new one.
file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/customSettings.json.bak", file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/customSettings.json"));
file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/customSettings.json", file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/resources/private/headers/csettings-base.json"));
$continue = true;
} else {
$continue = true;
}
if ($continue) {
if (isset($customSettings->showAdminButton) && isset($customSettings->customResources) && isset($customSettings->customResources->styles) && isset($customSettings->customResources->script) && isset($customSettings->hiddenPages)) {
if (!$customSettings->showAdminButton) {
echo("<style>#siteadmin-button{display:none;}</style>");
}
echo("<style type=\"text/css\">" . $customSettings->customResources->styles . "</style>");
echo("<script type=\"text/javascript\">" . $customSettings->customResources->script . "</script>");
} else {
require $_SERVER['DOCUMENT_ROOT'] . "/api/electrode/quit.php";quit("<h1>" . $lang["header"]["internalError"][0] . "</h1><p>" . $lang["header"]["internalError"][1] . "</p><p>" . $lang["header"]["internalError"][2] . "<code>/data/webcontent/customSettings.json</code>" . $lang["header"]["internalError"][3] . "</p><hr><i> " . file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/api/version") . " " . file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/api/codename") . "</i>");
}
}
} else {
require $_SERVER['DOCUMENT_ROOT'] . "/api/electrode/quit.php";quit("<h1>" . $lang["header"]["internalError"][0] . "</h1><p>" . $lang["header"]["internalError"][4] . "</p><p>" . $lang["header"]["internalError"][2] . "<code>/data/webcontent/customSettings.json</code>" . $lang["header"]["internalError"][3] . "</p><hr><i> " . file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/api/version") . " " . file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/api/codename") . "</i>");
}
} else {
file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/customSettings.json", file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/resources/private/headers/csettings-base.json"));
}
}
if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/resources/upload/styles.css")) {
echo('<link rel="stylesheet" href="' . $GLOBALS["SYSTEM_ROOT"] . '/resources/upload/styles.css">'); // Custom styles loader
}
echo('<script src="' . $GLOBALS["SYSTEM_ROOT"] . '/resources/js/jquery.js"></script>'); // JQuery, used at almost all pages
echo("<script>");
require_once $_SERVER['DOCUMENT_ROOT'] . "/resources/private/global.js._/index.php";
echo("</script>"); // Global Scripts
?>
<script>
String.prototype.replaceAll = function(search, replacement) {
var target = this;
return target.replace(new RegExp(search, 'g'), replacement);
};
roo_alert = false;
function alert_full(text, refreshOnOk) {
try {
if (text == "ResizeObserver loop completed with undelivered notifications.") {
return;
}
if (typeof refreshOnOk == "boolean") {
roo_alert = refreshOnOk;
}
if (typeof text == "string") {
document.querySelector('pjse-message').innerHTML = text.replaceAll(">", ">").replaceAll("<", "<").replaceAll("\n", "<br>")
} else {
document.querySelector('pjse-message').innerHTML = "<?= $lang["header"]["pjseDefault"][1] ?>"
}
$("pjse-placeholder").fadeIn(200)
document.querySelector('body').childNodes.forEach((el) => {
if (typeof el.classList != "undefined") {
if (el.localName != "pjse-placeholder") {
el.classList.add("pjse-blurry")
}
}
})
} catch (err) {
alert("<?= $lang["header"]["errorError"] ?>");
}
}
function alert(text, refreshOnOk) {
if (typeof refreshOnOk == "boolean") {
if (refreshOnOk == true) {
console.warn("The refresh on OK feature isn't available on new errors, showing the legacy one");
alert_full(text, refreshOnOk)
return;
}
}
var x = document.getElementById("snackbar");
if (typeof text == "string") {
x.innerHTML = text.replaceAll(">", ">").replaceAll("<", "<").replaceAll("\n", "<br>");
} else {
x.innerHTML = "<?= $lang["header"]["snackbarDefault"] ?>";
}
x.className = "snackbar_show";
setTimeout(function(){ x.className = x.className.replace("show", ""); }, 5000);
}
function closeError() {
$("pjse-placeholder").fadeOut(200)
document.querySelector('body').childNodes.forEach((el) => {
if (typeof el.classList != "undefined") {
if (el.localName != "pjse-placeholder") {
el.classList.remove("pjse-blurry")
}
}
})
if (roo_alert) {
reloadPage()
}
}
</script>
|