diff options
Diffstat (limited to 'Neutron-trunk/cms-special/admin/index.php')
-rw-r--r-- | Neutron-trunk/cms-special/admin/index.php | 135 |
1 files changed, 135 insertions, 0 deletions
diff --git a/Neutron-trunk/cms-special/admin/index.php b/Neutron-trunk/cms-special/admin/index.php new file mode 100644 index 0000000..8e388b6 --- /dev/null +++ b/Neutron-trunk/cms-special/admin/index.php @@ -0,0 +1,135 @@ +<?php require_once "../../resources/private/relative.php"; getRelativeDetails("cms-special"); ?> +<?php + +if (isset($_GET['pr']) || isset($_GET['pa'])) { + if (isset($_GET['pr']) && !isset($_GET['pa'])) { + header("Location: {$GLOBALS["SYSTEM_ROOT"]}/cms-special/admin/login/?pr=" . $_GET['pr']); + require $_SERVER['DOCUMENT_ROOT'] . "/api/electrode/quit.php";quit(); + } + if (!isset($_GET['pr']) && isset($_GET['pa'])) { + header("Location: {$GLOBALS["SYSTEM_ROOT"]}/cms-special/admin/login/?pa=" . $_GET['pa']); + require $_SERVER['DOCUMENT_ROOT'] . "/api/electrode/quit.php";quit(); + } + if (isset($_GET['pr']) && isset($_GET['pa'])) { + header("Location: {$GLOBALS["SYSTEM_ROOT"]}/cms-special/admin/login/?pr=" . $_GET['pr'] . "&pa=" . $_GET['pa']); + require $_SERVER['DOCUMENT_ROOT'] . "/api/electrode/quit.php";quit(); + } +} + +/** @var boolean $__electrode */ +if (isset($__electrode) && $__electrode) { + header("Location: {$GLOBALS["SYSTEM_ROOT"]}/cms-special/admin/home"); + require $_SERVER['DOCUMENT_ROOT'] . "/api/electrode/quit.php";quit(); +} + +?> + +<!DOCTYPE html> +<html lang="en"> +<head> + <meta charset="UTF-8"> + <meta name="viewport" content="width=device-width, initial-scale=1.0"> + <title>Neutron</title> + <link rel="stylesheet" href="<?= $GLOBALS["SYSTEM_ROOT"] ?>/resources/css/ajax.css"> + <link rel="icon" href="<?= $GLOBALS["SYSTEM_ROOT"] ?>/resources/image/siteicon.png"> + <script src="<?= $GLOBALS["SYSTEM_ROOT"] ?>/resources/js/jquery.js"></script> +</head> +<body> + <iframe id="content" src="<?= $GLOBALS["SYSTEM_ROOT"] ?>/cms-special/admin/login" style="border:none;"></iframe> + <div id="loader"> + <svg class="spinner" width="48px" height="48px" viewBox="0 0 66 66" xmlns="http://www.w3.org/2000/svg"> + <circle class="path" fill="none" stroke-width="6" stroke-linecap="round" cx="33" cy="33" r="30"></circle> + </svg> + </div> +</body> + +<script> + function iframeURLChange(iframe, callback) { + var unloadHandler = function () { + setTimeout(function () { + callback(iframe.contentWindow.location.href); + }, 0); + }; + + function attachUnload() { + iframe.contentWindow.removeEventListener("unload", unloadHandler); + iframe.contentWindow.addEventListener("unload", unloadHandler); + } + + iframe.addEventListener("load", attachUnload); + attachUnload(); + } + + iframeURLChange(document.getElementById("content"), function (newURL) { + $("#loader").fadeIn(200); + }); + + document.getElementById('content').onbeforeunload = () => { + $("#loader").fadeIn(200); + } + + document.getElementById('content').onload = () => { + $("#loader").fadeOut(200); + + setTimeout(() => { + $("#loader").fadeOut(200); + }, 300) + + els2 = document.getElementById('content').contentWindow.location.href.split("/"); + + els2.shift(); + els2.shift(); + els2.shift(); + + url = "/" + els2.join("/"); + if (!url.startsWith("<?= $GLOBALS["SYSTEM_ROOT"] ?>/cms-special/admin")) { + document.getElementById('content').contentWindow.history.back(); + window.open(url); + } + + els = document.getElementById('content').contentWindow.location.href.split("/"); + + els.shift(); + els.shift(); + els.shift(); + els.shift(); + els.shift(); + <?php if ($GLOBALS["SYSTEM_PREFIXED"]): ?> + els.shift(); + <?php endif; ?> + + oldu = "/" + els.join("/"); + + window.history.replaceState("Neutron", "Neutron", "#/" + els.join("/")); + console.log("<?= $GLOBALS["SYSTEM_ROOT"] ?>/cms-special/admin/" + els.join("/")); + + document.title = document.getElementById('content').contentWindow.document.title; + } + + oldu = null; + setInterval(() => { + hash = location.hash.substr(1); + + if (hash == "" && hash != oldu) { + document.getElementById('content').src = "<?= $GLOBALS["SYSTEM_ROOT"] ?>/cms-special/admin/home"; + console.log("<?= $GLOBALS["SYSTEM_ROOT"] ?>/cms-special/admin/home"); + $("#loader").fadeIn(200); + + oldu = hash; + } else if (hash != oldu) { + if (hash.startsWith("/") && (hash.substr(1, 1) != "/")) { + document.getElementById('content').src = "<?= $GLOBALS["SYSTEM_ROOT"] ?>/cms-special/admin" + hash; + console.log("<?= $GLOBALS["SYSTEM_ROOT"] ?>/cms-special/admin" + hash); + $("#loader").fadeIn(200); + } else { + document.getElementById('content').src = "<?= $GLOBALS["SYSTEM_ROOT"] ?>/cms-special/admin/home"; + console.log("<?= $GLOBALS["SYSTEM_ROOT"] ?>/cms-special/admin/home"); + $("#loader").fadeIn(200); + } + + oldu = hash; + } + }, 200) +</script> + +</html>
\ No newline at end of file |