diff options
author | Gitea <gitea@fake.local> | 2021-11-10 17:53:50 +0100 |
---|---|---|
committer | Gitea <gitea@fake.local> | 2021-11-10 17:53:50 +0100 |
commit | 8fabf77b2a7720a357c63817c07035a9908818a0 (patch) | |
tree | d689fcac1403e2473010fe80bc337599a78c21a4 /Neutron-trunk/resources/private/headers | |
parent | 7b4af63a90a726b98a59b83e53f040a7a566a11d (diff) | |
download | electrode-8fabf77b2a7720a357c63817c07035a9908818a0.tar.gz electrode-8fabf77b2a7720a357c63817c07035a9908818a0.tar.bz2 electrode-8fabf77b2a7720a357c63817c07035a9908818a0.zip |
Update
Diffstat (limited to 'Neutron-trunk/resources/private/headers')
4 files changed, 0 insertions, 385 deletions
diff --git a/Neutron-trunk/resources/private/headers/csettings-base.json b/Neutron-trunk/resources/private/headers/csettings-base.json deleted file mode 100644 index 51909c0..0000000 --- a/Neutron-trunk/resources/private/headers/csettings-base.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "customResources": { - "styles": "", - "script": "" - }, - "hiddenPages": [], - "showAdminButton": true -} diff --git a/Neutron-trunk/resources/private/headers/documentbody.php b/Neutron-trunk/resources/private/headers/documentbody.php deleted file mode 100644 index 3f8d8c1..0000000 --- a/Neutron-trunk/resources/private/headers/documentbody.php +++ /dev/null @@ -1,12 +0,0 @@ -<pjse-placeholder class="hide"> - <pjse-window> - <pjse-window-inner> - <pjse-title><?= $lang["header"]["pjseDefault"][0] ?></pjse-title> - <pjse-message><?= $lang["header"]["pjseDefault"][1] ?></pjse-message><br><br> - <pjse-close onclick="closeError()"><span><?= $lang["header"]["pjseDefault"][2] ?></span></pjse-close> - </pjse-window-inner> - </pjse-window> -</pjse-placeholder> - -<div id="snackbar"><?= $lang["header"]["snackbarDefault"] ?></div> -<div id="snowapi-placeholder"><div snowapi-enable-snowfall></div></div>
\ No newline at end of file diff --git a/Neutron-trunk/resources/private/headers/documenthead.php b/Neutron-trunk/resources/private/headers/documenthead.php deleted file mode 100644 index a628016..0000000 --- a/Neutron-trunk/resources/private/headers/documenthead.php +++ /dev/null @@ -1,139 +0,0 @@ -<?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> diff --git a/Neutron-trunk/resources/private/headers/preprocessor.php b/Neutron-trunk/resources/private/headers/preprocessor.php deleted file mode 100644 index 673a62d..0000000 --- a/Neutron-trunk/resources/private/headers/preprocessor.php +++ /dev/null @@ -1,226 +0,0 @@ -<?php - -if (!function_exists("rlgps")) { - function rlgps(string $message) {} -} - -// Check if website is ready -if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent")) { - $ready = true; -} else { - $ready = false; -} - -// Disable removed widgets -if ($ready) { - $json = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/widgets.json")); - if (!isset($json->_neutronMigrationDone)) { - $widgets = $json->list; - - $index = 0; - foreach ($widgets as $widget) { - if ($widget === "notes" || $widget === "contact") { - array_splice($widgets, $index, 1); - } - $index++; - } - - file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/widgets.json", json_encode([ - "list" => $widgets, - "_neutronMigrationDone" => true - ])); - } -} - -global $__root; - -$_MD_INCLUDES = $GLOBALS["SYSTEM_ROOT"] . "/resources/lib/material"; // Path to Material Design files, can be changed if files are bundled with the code -$_MDI_PATH = $GLOBALS["SYSTEM_ROOT"] . "/resources/lib/material/iconfont.css"; // Path to Material Icons font, can be changed if files are bundled with the code - -// Generate favicon if not yet generated -if (!file_exists($_SERVER['DOCUMENT_ROOT'] . "/resources/upload/favicon.png") && $ready) { - require_once $_SERVER['DOCUMENT_ROOT'] . "/api/engine-cyclic/components/favicon.php"; -} - -// Dark/light/dynamic theme + color -if (!file_exists($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/theme") && $ready) { - file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/theme", "auto"); -} - -if (!file_exists($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/color") && $ready) { - file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/color", "blue"); -} - -// Trim Build Values -try { - file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/api/version", trim(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/api/version"))); -} catch (E_WARNING $err) {} -try { - file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/api/codename", trim(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/api/codename"))); -} catch (E_WARNING $err) {} -try { - file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/api/experimental", trim(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/api/experimental"))); -} catch (E_WARNING $err) {} -try { - file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/api/public", trim(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/api/public"))); -} catch (E_WARNING $err) {} -try { - file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/api/bugs", trim(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/api/bugs"))); -} catch (E_WARNING $err) {} - -// Functions to get localized name and description of a plugin -function getDescription($config) { - $langsel = file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/lang"); - - if (isset($config->description->$langsel)) { - return $config->description->$langsel; - } else { - return $config->description->en; - } -} - -function getName($config) { - $langsel = file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/lang"); - - if (isset($config->name->$langsel)) { - return $config->name->$langsel; - } else { - return $config->name->en; - } -} - -// Language Loader -require $_SERVER['DOCUMENT_ROOT'] . "/api/lang/processor.php"; - -if (!file_exists($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/cache") && $ready) { // Cache directory - mkdir($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/cache"); -} - -// Function to check if a JSON string is valid -function dataValid($string) { - json_decode($string); - return (json_last_error() == JSON_ERROR_NONE); -} - -// Custom Styles, create directory -if (!file_exists($_SERVER['DOCUMENT_ROOT'] . "/resources/upload/styles.json")) { - file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/resources/upload/styles.json", "[]"); -} - -// Connections Log -if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/system.log") && $ready) { - if (strpos($_SERVER['HTTP_USER_AGENT'], "MinteckProjectsAutoUptime") !== false) {} else { // Don't log for Auto-Uptime bot - file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/system.log", file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/system.log") . date("d/m/Y H:i:s") . " - INTERFACE/" . $_SERVER['REQUEST_METHOD'] . " - " . $_SERVER['REQUEST_URI'] . " - " . $_SERVER['HTTP_USER_AGENT'] . "\n\n"); - } -} else { - if (strpos($_SERVER['HTTP_USER_AGENT'], "MinteckProjectsAutoUptime") !== false || !$ready) {} else { // Don't log for Auto-Uptime bot - file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/system.log", date("d/m/Y H:i:s") . " - INTERFACE/" . $_SERVER['REQUEST_METHOD'] . " - " . $_SERVER['REQUEST_URI'] . " - " . $_SERVER['HTTP_USER_AGENT'] . "\n\n"); - } -} - -// Migrate old "adminkey" to new "authkey" -if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/data/adminkey")) { - copy($_SERVER['DOCUMENT_ROOT'] . "/data/adminkey", $_SERVER['DOCUMENT_ROOT'] . "/data/authkey"); - unlink($_SERVER['DOCUMENT_ROOT'] . "/data/adminkey"); -} - -/* Old statistics system, not used anymore */ -/*try { // Failing is not important - // Statistics directory - if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/stats")) {} else { - if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent")) { - mkdir($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/stats"); - } - } - - // Only if website ready - if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/")) { - if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/stats/" . date("Y-m-d"))) { - if (strpos($_SERVER['HTTP_USER_AGENT'], "MinteckProjectsAutoUptime") !== false) {} else { // Don't log for Auto-Uptime bot - (int)$actual = file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/stats/" . date("Y-m-d")); - $actual = $actual + 1; - file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/stats/" . date("Y-m-d"), $actual); - } - } else { - file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/stats/" . date("Y-m-d"), "1"); - } - } -} catch (E_WARNING $err) { -}*/ - -// New statistics system -if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/newstats")) {} else { - if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent")) { - mkdir($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/newstats"); - } -} - -if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/")) { - if (isset($_SERVER['REMOTE_ADDR']) && file_exists($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/newstats")) { - //$hash = @password_hash($_SERVER['REMOTE_ADDR'], PASSWORD_DEFAULT, [ "salt" => "net.minteckprojects.fns.neutron.stats" ]); // Storing IP addresses is illegal in EU, so just a hashed IP addresses - $hash = md5($_SERVER['REMOTE_ADDR']); // Changed to MD5 sum instead of encrypted IP because salt not supported anymore - if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/newstats/" . date('Y'))) {} else { - mkdir($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/newstats/" . date('Y')); - } - if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/newstats/" . date('Y') . "/" . date('m'))) {} else { - mkdir($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/newstats/" . date('Y') . "/" . date('m')); - } - if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/newstats/" . date('Y') . "/" . date('m') . "/" . date('d'))) { - $file = file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/newstats/" . date('Y') . "/" . date('m') . "/" . date('d')); - $lines = explode("\n", $file); - - $already = false; - foreach ($lines as $line) { - if (trim($line) == "" || trim($line) == "\n") {} else { - if (trim($line) == trim($hash)) { - $already = true; - } - } - } - - if (!$already) { - file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/newstats/" . date('Y') . "/" . date('m') . "/" . date('d'), file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/newstats/" . date('Y') . "/" . date('m') . "/" . date('d')) . $hash . "\n"); - } - } else { - file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/newstats/" . date('Y') . "/" . date('m') . "/" . date('d'), $hash . "\n"); - } - } -} - -// Check for updates at random intervals -if (rand(0, 10) == 5) { - try { - $version = explode("-", file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/api/version"))[0]; - $json = json_decode(@file_get_contents(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/api/update") . "/" . $version . "/updates.json")); - - if (isset($json)) { - if (json_last_error() != JSON_ERROR_NONE) { - $updates = -1; - } - - if ($json->version->name != $version) { - $updates = -1; - } - - foreach ($json->updates as $update) { - if (!isset($updates)) { - $updates = 1; - } - } - - if (!isset($updates)) { - $updates = 0; - } - } else { - $updates = -1; - } - - if ($updates == 1) { - file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/updates", ""); - } else { - if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/updates")) { - unlink($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/updates"); - } - } - } catch (E_WARNING $err) {} -} |