aboutsummaryrefslogtreecommitdiff
path: root/Neutron-trunk/api/engine-cyclic
diff options
context:
space:
mode:
authorMinteck <nekostarfan@gmail.com>2021-08-24 15:38:16 +0200
committerMinteck <nekostarfan@gmail.com>2021-08-24 15:38:16 +0200
commit529ffcbfa97ab51a64a97f6dff08aeb2bc0cc105 (patch)
tree8a50c30271b9b328cde0d907b1441f2dabdc341b /Neutron-trunk/api/engine-cyclic
parent15e4724761c50b30803df1811a525c85058f70bf (diff)
downloadelectrode-529ffcbfa97ab51a64a97f6dff08aeb2bc0cc105.tar.gz
electrode-529ffcbfa97ab51a64a97f6dff08aeb2bc0cc105.tar.bz2
electrode-529ffcbfa97ab51a64a97f6dff08aeb2bc0cc105.zip
Update
Diffstat (limited to 'Neutron-trunk/api/engine-cyclic')
-rw-r--r--Neutron-trunk/api/engine-cyclic/components/banner.php10
-rw-r--r--Neutron-trunk/api/engine-cyclic/components/content.php22
-rw-r--r--Neutron-trunk/api/engine-cyclic/components/drawer.php54
-rw-r--r--Neutron-trunk/api/engine-cyclic/components/favicon.php88
-rw-r--r--Neutron-trunk/api/engine-cyclic/components/footer.php23
-rw-r--r--Neutron-trunk/api/engine-cyclic/components/init.php14
-rw-r--r--Neutron-trunk/api/engine-cyclic/components/menubar.php52
-rw-r--r--Neutron-trunk/api/engine-cyclic/components/widgets.php18
-rw-r--r--Neutron-trunk/api/engine-cyclic/heads.php40
-rw-r--r--Neutron-trunk/api/engine-cyclic/homepage.php18
-rw-r--r--Neutron-trunk/api/engine-cyclic/includes/cache.php70
-rw-r--r--Neutron-trunk/api/engine-cyclic/includes/getPageContent.php14
-rw-r--r--Neutron-trunk/api/engine-cyclic/includes/getPageName.php18
-rw-r--r--Neutron-trunk/api/engine-cyclic/includes/includes.php4
-rw-r--r--Neutron-trunk/api/engine-cyclic/pages.php18
-rw-r--r--Neutron-trunk/api/engine-cyclic/render.php2
-rw-r--r--Neutron-trunk/api/engine-cyclic/special.php18
-rw-r--r--Neutron-trunk/api/engine-cyclic/tails.php4
-rw-r--r--Neutron-trunk/api/engine-cyclic/wrapper.php42
19 files changed, 529 insertions, 0 deletions
diff --git a/Neutron-trunk/api/engine-cyclic/components/banner.php b/Neutron-trunk/api/engine-cyclic/components/banner.php
new file mode 100644
index 0000000..800ead1
--- /dev/null
+++ b/Neutron-trunk/api/engine-cyclic/components/banner.php
@@ -0,0 +1,10 @@
+<div id="page-banner"></div>
+<style>:root { --mpcms-banner: url(<?php
+rlgps("Loaded banner image");
+if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/resources/upload/banner.jpg")) {
+ echo('"' . $GLOBALS["SYSTEM_ROOT"] . '/resources/upload/banner.jpg"');
+} else {
+ echo('"' . $GLOBALS["SYSTEM_ROOT"] . '/resources/image/default.jpg"');
+}
+
+?>); }</style> \ No newline at end of file
diff --git a/Neutron-trunk/api/engine-cyclic/components/content.php b/Neutron-trunk/api/engine-cyclic/components/content.php
new file mode 100644
index 0000000..e3e3be5
--- /dev/null
+++ b/Neutron-trunk/api/engine-cyclic/components/content.php
@@ -0,0 +1,22 @@
+<article id="page-content">
+ <div id="page-elements">
+ <div id="page-content-inner">
+ <span id="page-content-colorbar"></span>
+ <h1><?= getPageName() ?></h1>
+ <?= getPageContent() ?>
+ </div>
+ <div id="page-content-widgets-desktop"><?php rlgps("Generating desktop widgets..."); ?>
+ <h3><?= $lang["menu"]["info"] ?></h3>
+ <?php require $_SERVER['DOCUMENT_ROOT'] . "/api/engine-cyclic/components/widgets.php"; ?>
+ </div>
+ <div id="page-content-widgets-mobile" data-pushbar-id="widgets" data-pushbar-direction="right"><?php rlgps("Generating mobile widgets..."); ?>
+ <span class="mdc-list-item" onclick="pushbar.close();">
+ <i class="material-icons-outlined mdc-list-item__graphic" aria-hidden="true">close</i>
+ <span class="mdc-list-item__text"><?= $lang["viewer"]["close"] ?></span>
+ </span>
+ <hr class="mdc-list-divider">
+ <h3><?= $lang["menu"]["info"] ?></h3>
+ <?php require $_SERVER['DOCUMENT_ROOT'] . "/api/engine-cyclic/components/widgets.php"; ?>
+ </div>
+ </div>
+</article>
diff --git a/Neutron-trunk/api/engine-cyclic/components/drawer.php b/Neutron-trunk/api/engine-cyclic/components/drawer.php
new file mode 100644
index 0000000..f0e1db7
--- /dev/null
+++ b/Neutron-trunk/api/engine-cyclic/components/drawer.php
@@ -0,0 +1,54 @@
+<?php
+
+if (!file_exists($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/cache/pagelist.mtd") || (file_exists($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/cache/pagelist.mtd") && strpos(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/cache/pagelist.mtd"), "|") === false)) {
+ rlgps("Regenerating cache");
+ require_once $_SERVER['DOCUMENT_ROOT'] . "/api/admin/cache_pages_update.php";
+}
+
+if (!file_exists($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/cache/pagelist-full.mtd") || (file_exists($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/cache/pagelist-full.mtd") && strpos(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/cache/pagelist-full.mtd"), "|") === false)) {
+ rlgps("Regenerating cache");
+ require_once $_SERVER['DOCUMENT_ROOT'] . "/api/admin/cache_pages_update.php";
+}
+
+?>
+
+<aside class="mdc-drawer" data-pushbar-direction="right" data-pushbar-id="navigation">
+ <div class="mdc-drawer__content">
+ <nav class="mdc-list">
+ <a class="mdc-list-item" onclick="pushbar.close();">
+ <i class="material-icons-outlined mdc-list-item__graphic" aria-hidden="true">close</i>
+ <span class="mdc-list-item__text"><?= $lang["viewer"]["close"] ?></span>
+ </a>
+ <hr class="mdc-list-divider">
+ <a class="mdc-list-item <?= $_SERVER['PHP_SELF'] == "/index.php" ? " mdc-list-item--activated" : "" ?>" href="<?= $GLOBALS["SYSTEM_ROOT"] ?>/" aria-current="page">
+ <i class="material-icons-outlined mdc-list-item__graphic" aria-hidden="true">home</i>
+ <span class="mdc-list-item__text"><?= $lang["viewer"]["home"] ?></span>
+ </a>
+ <?php
+ rlgps("Loading pages list from cache...");
+ $preels = explode("\n", file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/cache/pagelist-full.mtd"));
+ $els = [];
+ foreach ($preels as $el) {
+ if (substr($el, 0, 1) != "@") {
+ $parts = explode("|", $el);
+ array_push($els, $parts);
+ }
+ }
+ rlgps("Generating menu");
+ ?>
+ <?php foreach ($els as $el): if (trim($el[0]) !== ""): ?>
+ <a class="mdc-list-item" href="<?= $GLOBALS["SYSTEM_ROOT"] ?>/<?= $el[0] ?>">
+ <i class="material-icons-outlined mdc-list-item__graphic" aria-hidden="true">insert_drive_file</i>
+ <span class="mdc-list-item__text"><?= $el[1] ?></span>
+ </a>
+ <?php endif;endforeach ?>
+ <?php if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/galery/pictures") && count(scandir($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/galery/pictures")) > 2): ?>
+ <a class="mdc-list-item<?= $_SERVER['PHP_SELF'] == "/cms-special/gallery/index.php" ? " mdc-list-item--activated" : "" ?>" href="<?= $GLOBALS["SYSTEM_ROOT"] ?>/cms-special/gallery" aria-current="page">
+ <i class="material-icons-outlined mdc-list-item__graphic" aria-hidden="true">image</i>
+ <span class="mdc-list-item__text"><?= $lang["viewer"]["gallery"] ?></span>
+ </a>
+ <?php rlgps("Putting gallery link");endif ?>
+ </nav>
+ </div>
+</aside>
+<div class="mdc-drawer-app-content"> \ No newline at end of file
diff --git a/Neutron-trunk/api/engine-cyclic/components/favicon.php b/Neutron-trunk/api/engine-cyclic/components/favicon.php
new file mode 100644
index 0000000..3d078a1
--- /dev/null
+++ b/Neutron-trunk/api/engine-cyclic/components/favicon.php
@@ -0,0 +1,88 @@
+<?php
+
+ class CircleCrop
+ {
+
+ private $src_img;
+ private $src_w;
+ private $src_h;
+ private $dst_img;
+ private $dst_w;
+ private $dst_h;
+
+ public function __construct($img, $dstWidth, $dstHeight)
+ {
+ $this->src_img = $img;
+ $this->src_w = imagesx($img);
+ $this->src_h = imagesy($img);
+ $this->dst_w = $dstWidth;
+ $this->dst_h = $dstHeight;
+ }
+
+ public function __destruct()
+ {
+ if (is_resource($this->dst_img))
+ {
+ imagedestroy($this->dst_img);
+ }
+ }
+
+ public function display()
+ {
+ imagepng($this->dst_img, $_SERVER['DOCUMENT_ROOT'] . "/resources/upload/favicon.png");
+ return $this;
+ }
+
+ public function reset()
+ {
+ if (is_resource(($this->dst_img)))
+ {
+ imagedestroy($this->dst_img);
+ }
+ $this->dst_img = imagecreatetruecolor($this->dst_w, $this->dst_h);
+ imagecopy($this->dst_img, $this->src_img, 0, 0, 0, 0, $this->dst_w, $this->dst_h);
+ return $this;
+ }
+
+ public function size($dstWidth, $dstHeight)
+ {
+ $this->dst_w = $dstWidth;
+ $this->dst_h = $dstHeight;
+ return $this->reset();
+ }
+
+ public function crop()
+ {
+ $this->reset();
+
+ $mask = imagecreatetruecolor($this->dst_w, $this->dst_h);
+ $maskTransparent = imagecolorallocate($mask, 255, 0, 255);
+ imagecolortransparent($mask, $maskTransparent);
+ imagefilledellipse($mask, $this->dst_w / 2, $this->dst_h / 2, $this->dst_w, $this->dst_h, $maskTransparent);
+
+ imagecopymerge($this->dst_img, $mask, 0, 0, 0, 0, $this->dst_w, $this->dst_h, 100);
+
+ $dstTransparent = imagecolorallocate($this->dst_img, 255, 0, 255);
+ imagefill($this->dst_img, 0, 0, $dstTransparent);
+ imagefill($this->dst_img, $this->dst_w - 1, 0, $dstTransparent);
+ imagefill($this->dst_img, 0, $this->dst_h - 1, $dstTransparent);
+ imagefill($this->dst_img, $this->dst_w - 1, $this->dst_h - 1, $dstTransparent);
+ imagecolortransparent($this->dst_img, $dstTransparent);
+
+ return $this;
+ }
+
+ }
+
+ if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/resources/upload/siteicon-uncomp.png")) {
+ $path = $_SERVER['DOCUMENT_ROOT'] . "/resources/upload/siteicon-uncomp.png";
+ } else {
+ $path = $_SERVER['DOCUMENT_ROOT'] . "/resources/upload/siteicon.png";
+ }
+
+ $image = imagecreatefrompng($path);
+
+ $width = imagesx($image);
+ $height = imagesy($image);
+ $crop = new CircleCrop($image,$width,$height);
+ $crop->crop()->display(); \ No newline at end of file
diff --git a/Neutron-trunk/api/engine-cyclic/components/footer.php b/Neutron-trunk/api/engine-cyclic/components/footer.php
new file mode 100644
index 0000000..10a89ed
--- /dev/null
+++ b/Neutron-trunk/api/engine-cyclic/components/footer.php
@@ -0,0 +1,23 @@
+<div id="footer-container"><?php rlgps("Generating footer"); ?>
+ <span id="page-footer-colorbar"></span>
+ <footer id="page-footer">
+ <div id="page-footer-title">
+ <div id="page-footer-title-inner" class="title"><?= file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/sitename") ?></div>
+ <div id="page-footer-title-buttons">
+ <a id="page-footer-title-top-button" onclick="$('html, body').animate({scrollTop:0},'20');"><button class="material-icons-outlined mdc-top-app-bar__navigation-icon mdc-icon-button" id="page-footer-title-top-button-inner" onclick="$('html, body').animate({scrollTop:0},'20');">arrow_upward</button></a>
+ <?php /** @var boolean $__electrode */
+ if (isset($__electrode) && $__electrode): ?>
+ <a href="<?= $GLOBALS["SYSTEM_ROOT"] ?>/cms-special/admin/home" id="page-footer-title-settings-button"><button class="material-icons-outlined mdc-top-app-bar__navigation-icon mdc-icon-button" id="page-footer-title-settings-button-inner">settings</button></a>
+ <?php else: ?>
+ <a href="<?= $GLOBALS["SYSTEM_ROOT"] ?>/cms-special/admin" id="page-footer-title-settings-button"><button class="material-icons-outlined mdc-top-app-bar__navigation-icon mdc-icon-button" id="page-footer-title-settings-button-inner">settings</button></a>
+ <?php endif; ?>
+ </div>
+ </div>
+ <div id="page-footer-content">
+ <?= file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/footer") ?>
+ </div>
+ <div id="page-footer-links">
+ <a href="<?= file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/api/public") ?>" target="_blank">Neutron <?= file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/api/version") ?></a> · <a href="<?= file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/api/bugs") ?>" target="_blank"><?= $lang["viewer"]["bugs"] ?></a> · <a href="<?= $GLOBALS["SYSTEM_ROOT"] ?>/cms-special/version"><?= $lang["viewer"]["system"] ?></a>
+ </div>
+ </footer>
+</div> \ No newline at end of file
diff --git a/Neutron-trunk/api/engine-cyclic/components/init.php b/Neutron-trunk/api/engine-cyclic/components/init.php
new file mode 100644
index 0000000..d17792e
--- /dev/null
+++ b/Neutron-trunk/api/engine-cyclic/components/init.php
@@ -0,0 +1,14 @@
+<?php
+rlgps("Loading widgets");
+$json = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/widgets.json"));
+$widgets = $json->list;
+foreach ($widgets as $widget): ?>
+<?php $data = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/widgets/" . $widget . "/feature.json")); ?>
+<?php
+
+if (isset($data->class) && is_string($data->class)) {
+ require $_SERVER['DOCUMENT_ROOT'] . "/widgets/" . $widget . "/source.php";
+}
+
+?>
+<?php endforeach ?> \ No newline at end of file
diff --git a/Neutron-trunk/api/engine-cyclic/components/menubar.php b/Neutron-trunk/api/engine-cyclic/components/menubar.php
new file mode 100644
index 0000000..b6bce59
--- /dev/null
+++ b/Neutron-trunk/api/engine-cyclic/components/menubar.php
@@ -0,0 +1,52 @@
+<?php
+
+if ((!file_exists($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/cache/pagelist-old.mtd") || (file_exists($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/cache/pagelist-full.mtd") && strpos(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/cache/pagelist-old.mtd"), "<a") === false)) || (!file_exists($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/cache/pagelist-full.mtd") || (file_exists($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/cache/pagelist-full.mtd") && strpos(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/cache/pagelist-full.mtd"), "|") === false)) || (!file_exists($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/cache/pagelist-old.mtd") || (file_exists($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/cache/pagelist.mtd") && strpos(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/cache/pagelist.mtd"), "|") === false))) {
+ rlgps("Regenerating pages cache");
+ require_once $_SERVER['DOCUMENT_ROOT'] . "/api/admin/cache_pages_update.php";
+}
+
+?>
+
+<header class="mdc-top-app-bar">
+ <div class="mdc-top-app-bar__row">
+ <section class="mdc-top-app-bar__section mdc-top-app-bar__section--align-start">
+ <a href="<?= $GLOBALS["SYSTEM_ROOT"] ?>/" id="menubar-home-link">
+ <span id="menubar-logo"></span>
+ <span class="mdc-top-app-bar__title title rsp-desktoponly"><?= file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/sitename") ?></span>
+ </a>
+ </section>
+ <section class="mdc-top-app-bar__section mdc-top-app-bar__section--align-end" role="toolbar">
+ <span class="rsp-desktoponly" id="menuitems">
+ <?php
+ rlgps("Loading pages from cache...");
+
+ $preels = explode("\n", file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/cache/pagelist.mtd"));
+ $els = [];
+ foreach ($preels as $el) {
+ if (substr($el, 0, 1) != "@") {
+ $parts = explode("|", $el);
+ array_push($els, $parts);
+ }
+ }
+
+ ?>
+ <?php rlgps("Generating menubar");foreach ($els as $el): ?>
+ <?php if (trim($el[1]) != ""): ?>
+ <a href="<?= $GLOBALS["SYSTEM_ROOT"] ?>/<?= $el[0] ?>" class="mdc-button rsp-desktoponly">
+ <div class="mdc-button__ripple"></div>
+ <span class="mdc-button__label menubutton"><?= $el[1] ?></span>
+ </a>
+ <?php endif;endforeach; ?>
+ <?php if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/galery/pictures") && count(scandir($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/galery/pictures")) > 2): ?>
+ <a href="<?= $GLOBALS["SYSTEM_ROOT"] ?>/cms-special/gallery" class="mdc-button rsp-desktoponly">
+ <div class="mdc-button__ripple"></div>
+ <span class="mdc-button__label menubutton"><?= $lang["viewer"]["gallery"] ?></span>
+ </a>
+ <?php endif ?>
+ </span>
+ <a href="<?= $GLOBALS["SYSTEM_ROOT"] ?>/" class="material-icons-outlined mdc-top-app-bar__navigation-icon mdc-icon-button">home</a>
+ <button class="material-icons-outlined mdc-top-app-bar__navigation-icon mdc-icon-button" onclick="pushbar.open('navigation');">menu</button>
+ <button class="material-icons-outlined mdc-top-app-bar__action-item mdc-icon-button rsp-mobileonly rsp-widgetbar" onclick="pushbar.open('widgets');">info</button>
+ </section>
+ </div>
+</header>
diff --git a/Neutron-trunk/api/engine-cyclic/components/widgets.php b/Neutron-trunk/api/engine-cyclic/components/widgets.php
new file mode 100644
index 0000000..c2a903c
--- /dev/null
+++ b/Neutron-trunk/api/engine-cyclic/components/widgets.php
@@ -0,0 +1,18 @@
+<?php
+rlgps("Loading widgets");
+$json = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/widgets.json"));
+$widgets = $json->list;
+foreach ($widgets as $widget): ?>
+<?php $data = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/widgets/" . $widget . "/feature.json")); ?>
+<h6 class="widgets-header"><?= getName($data) ?></h6>
+<?php
+
+if (isset($data->class) && is_string($data->class)) {
+ $class = $data->class;
+ new $class();
+} else {
+ require $_SERVER['DOCUMENT_ROOT'] . "/widgets/" . $widget . "/source.php";
+}
+
+?>
+<?php endforeach ?> \ No newline at end of file
diff --git a/Neutron-trunk/api/engine-cyclic/heads.php b/Neutron-trunk/api/engine-cyclic/heads.php
new file mode 100644
index 0000000..0eeba9a
--- /dev/null
+++ b/Neutron-trunk/api/engine-cyclic/heads.php
@@ -0,0 +1,40 @@
+<?php rlgps("Start DOM generation"); ?>
+<!DOCTYPE html>
+<html lang="<?= rlgps("Definied language");file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/lang"); ?>">
+<head>
+ <meta charset="UTF-8">
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
+ <title><?php
+
+ rlgps("Title generator");
+ if (isset($MPCMSRendererPageNameValue) && $MPCMSRendererPageNameValue == "index") {
+ echo(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/sitename"));
+ } else {
+ echo(getPageName() . " · " . file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/sitename"));
+ }
+
+ ?></title>
+ <link href="<?= $_MD_INCLUDES ?>/material-components-web.min.css" rel="stylesheet">
+ <script src="<?= $_MD_INCLUDES ?>/material-components-web.min.js"></script>
+ <link rel="stylesheet" href="<?= $_MDI_PATH ?>">
+ <link rel="stylesheet" href="<?= $GLOBALS["SYSTEM_ROOT"] ?>/resources/css/polymer/fonts.css">
+ <link rel="stylesheet" href="<?= $GLOBALS["SYSTEM_ROOT"] ?>/resources/css/themes/<?= file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/color") ?>-<?= file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/theme") ?>.css">
+ <link rel="stylesheet" href="<?= $GLOBALS["SYSTEM_ROOT"] ?>/resources/css/polymer/menubar.css">
+ <link rel="stylesheet" href="<?= $GLOBALS["SYSTEM_ROOT"] ?>/resources/css/polymer/content.css">
+ <link rel="shortcut icon" href="<?= $GLOBALS["SYSTEM_ROOT"] ?>/resources/upload/favicon.png" type="image/png">
+ <link rel="stylesheet" href="<?= $GLOBALS["SYSTEM_ROOT"] ?>/resources/css/polymer/responsive.css">
+ <link rel="stylesheet" href="<?= $GLOBALS["SYSTEM_ROOT"] ?>/resources/css/polymer/scrollbars.css">
+ <link rel="stylesheet" href="<?= $GLOBALS["SYSTEM_ROOT"] ?>/resources/css/polymer/warnings.css">
+ <link rel="stylesheet" href="<?= $GLOBALS["SYSTEM_ROOT"] ?>/resources/css/polymer/gallery.css">
+ <link rel="stylesheet" href="<?= $GLOBALS["SYSTEM_ROOT"] ?>/resources/lib/pushbar.js/library.css">
+ <script src="<?= $GLOBALS["SYSTEM_ROOT"] ?>/resources/lib/pushbar.js/library.js"></script>
+ <?php rlgps("Call <head> headers");require_once $_SERVER['DOCUMENT_ROOT'] . "/resources/private/headers/documenthead.php"; ?>
+</head>
+<body>
+<script>
+ pushbar = new Pushbar({
+ blur: true,
+ overlay: true
+ });
+</script>
+<?php rlgps("Call <body> headers");require_once $_SERVER['DOCUMENT_ROOT'] . "/resources/private/headers/documentbody.php"; ?> \ No newline at end of file
diff --git a/Neutron-trunk/api/engine-cyclic/homepage.php b/Neutron-trunk/api/engine-cyclic/homepage.php
new file mode 100644
index 0000000..995a76a
--- /dev/null
+++ b/Neutron-trunk/api/engine-cyclic/homepage.php
@@ -0,0 +1,18 @@
+<?php
+
+ob_start();
+require_once $_SERVER['DOCUMENT_ROOT'] . "/api/lang/processor.php";
+require_once $_SERVER['DOCUMENT_ROOT'] . "/resources/private/headers/preprocessor.php";
+
+require_once $_SERVER['DOCUMENT_ROOT'] . "/api/engine-cyclic/includes/includes.php";
+
+require_once $_SERVER['DOCUMENT_ROOT'] . "/api/engine-cyclic/heads.php";
+
+require_once $_SERVER['DOCUMENT_ROOT'] . "/api/engine-cyclic/components/init.php";
+require_once $_SERVER['DOCUMENT_ROOT'] . "/api/engine-cyclic/components/menubar.php";
+require_once $_SERVER['DOCUMENT_ROOT'] . "/api/engine-cyclic/components/drawer.php";
+require_once $_SERVER['DOCUMENT_ROOT'] . "/api/engine-cyclic/components/banner.php";
+require_once $_SERVER['DOCUMENT_ROOT'] . "/api/engine-cyclic/components/content.php";
+require_once $_SERVER['DOCUMENT_ROOT'] . "/api/engine-cyclic/components/footer.php";
+
+require_once $_SERVER['DOCUMENT_ROOT'] . "/api/engine-cyclic/tails.php"; \ No newline at end of file
diff --git a/Neutron-trunk/api/engine-cyclic/includes/cache.php b/Neutron-trunk/api/engine-cyclic/includes/cache.php
new file mode 100644
index 0000000..80ea283
--- /dev/null
+++ b/Neutron-trunk/api/engine-cyclic/includes/cache.php
@@ -0,0 +1,70 @@
+<?php
+
+// Create cache dir
+if (!file_exists($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/cache")) {
+ mkdir($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/cache");
+}
+
+function cacheCheck(string $page) {
+ /* // If something goes wrong, use cache anyway
+ $cache = true;
+
+ // Get a list of enabled widgets
+ $widgets = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/widgets.json"));
+ if (json_last_error() != JSON_ERROR_NONE) { // If data is corrupted, silently think there are no widgets
+ $list = [];
+ rlgps("Warning: Widget information is corrupted");
+ } else {
+ $list = $widgets->list;
+ }
+
+ // Check if there is (at least) one widget that disables cache
+ foreach ($list as $widget) {
+ $data = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/widgets/$widget/feature.json"));
+ if (json_last_error() == JSON_ERROR_NONE) {
+ if (isset($data->cache)) {
+ if (is_bool($data->cache)) {
+ $cache = $data->cache;
+ if ($data->cache == false) {
+ rlgps("Widget \"$widget\" prevents the use of cache");
+ }
+ }
+ }
+ } else {
+ rlgps("Warning: Metadata for the widget \"$widget\" is corrupted");
+ }
+ }
+
+ // Check if an update has been installed
+ if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/cache/last_version")) {
+ if (file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/cache/last_version") == file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/api/version")) {} else {
+ $cache = false;
+ require $_SERVER['DOCUMENT_ROOT'] . "/api/admin/cache_content_reset.php";
+ file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/cache/last_version", file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/api/version"));
+ }
+ } else {
+ $cache = false;
+ require $_SERVER['DOCUMENT_ROOT'] . "/api/admin/cache_content_reset.php";
+ file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/cache/last_version", file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/api/version"));
+ }
+
+ // Is there any widget that disables cache?
+ if ($cache) { // no
+ // Does the cached version exists?
+ if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/cache/page-" . $page)) { // yes
+ header("X-FNS-NeutronCache: yes");
+ echo(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/cache/page-" . $page)); // So let's output it
+ require_once $_SERVER['DOCUMENT_ROOT'] . "/resources/private/debug.php";debugDump(); // And debug if needed
+ return true;
+ } else { // no
+ header("X-FNS-NeutronCache: no");
+ return false; // Let the engine-cyclic render the page
+ }
+ } else { // yes
+ header("X-FNS-NeutronCache: no");
+ return false; // Let the engine-cyclic render the page
+ } */
+
+ // Cache is now completely disabled due to problems
+ return false;
+} \ No newline at end of file
diff --git a/Neutron-trunk/api/engine-cyclic/includes/getPageContent.php b/Neutron-trunk/api/engine-cyclic/includes/getPageContent.php
new file mode 100644
index 0000000..31b202c
--- /dev/null
+++ b/Neutron-trunk/api/engine-cyclic/includes/getPageContent.php
@@ -0,0 +1,14 @@
+<?php
+
+function getPageContent() {
+ rlgps("getPageContent() call");
+ global $MPCMSRendererPageMarkup;
+ global $MPCMSRendererPageMarkupDN;
+ global $MPCMSRendererPageNameValue;
+
+ if (isset($MPCMSRendererPageMarkup) && isset($MPCMSRendererPageMarkupDN)) {
+ return $MPCMSRendererPageMarkup;
+ } else {
+ return file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/pages/" . $MPCMSRendererPageNameValue);
+ }
+} \ No newline at end of file
diff --git a/Neutron-trunk/api/engine-cyclic/includes/getPageName.php b/Neutron-trunk/api/engine-cyclic/includes/getPageName.php
new file mode 100644
index 0000000..e364493
--- /dev/null
+++ b/Neutron-trunk/api/engine-cyclic/includes/getPageName.php
@@ -0,0 +1,18 @@
+<?php
+
+function getPageName() {
+ rlgps("getPageName() call");
+ global $MPCMSRendererPageMarkup;
+ global $MPCMSRendererPageMarkupDN;
+ global $MPCMSRendererPageNameValue;
+
+ if (isset($MPCMSRendererPageMarkup) && isset($MPCMSRendererPageMarkupDN)) {
+ return $MPCMSRendererPageMarkupDN;
+ } else {
+ if ($MPCMSRendererPageNameValue == "index") {
+ return file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/sitename");
+ } else {
+ return file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/" . $MPCMSRendererPageNameValue . "/pagename");
+ }
+ }
+} \ No newline at end of file
diff --git a/Neutron-trunk/api/engine-cyclic/includes/includes.php b/Neutron-trunk/api/engine-cyclic/includes/includes.php
new file mode 100644
index 0000000..05f0f23
--- /dev/null
+++ b/Neutron-trunk/api/engine-cyclic/includes/includes.php
@@ -0,0 +1,4 @@
+<?php
+
+require_once $_SERVER['DOCUMENT_ROOT'] . "/api/engine-cyclic/includes/getPageName.php";
+require_once $_SERVER['DOCUMENT_ROOT'] . "/api/engine-cyclic/includes/getPageContent.php"; \ No newline at end of file
diff --git a/Neutron-trunk/api/engine-cyclic/pages.php b/Neutron-trunk/api/engine-cyclic/pages.php
new file mode 100644
index 0000000..995a76a
--- /dev/null
+++ b/Neutron-trunk/api/engine-cyclic/pages.php
@@ -0,0 +1,18 @@
+<?php
+
+ob_start();
+require_once $_SERVER['DOCUMENT_ROOT'] . "/api/lang/processor.php";
+require_once $_SERVER['DOCUMENT_ROOT'] . "/resources/private/headers/preprocessor.php";
+
+require_once $_SERVER['DOCUMENT_ROOT'] . "/api/engine-cyclic/includes/includes.php";
+
+require_once $_SERVER['DOCUMENT_ROOT'] . "/api/engine-cyclic/heads.php";
+
+require_once $_SERVER['DOCUMENT_ROOT'] . "/api/engine-cyclic/components/init.php";
+require_once $_SERVER['DOCUMENT_ROOT'] . "/api/engine-cyclic/components/menubar.php";
+require_once $_SERVER['DOCUMENT_ROOT'] . "/api/engine-cyclic/components/drawer.php";
+require_once $_SERVER['DOCUMENT_ROOT'] . "/api/engine-cyclic/components/banner.php";
+require_once $_SERVER['DOCUMENT_ROOT'] . "/api/engine-cyclic/components/content.php";
+require_once $_SERVER['DOCUMENT_ROOT'] . "/api/engine-cyclic/components/footer.php";
+
+require_once $_SERVER['DOCUMENT_ROOT'] . "/api/engine-cyclic/tails.php"; \ No newline at end of file
diff --git a/Neutron-trunk/api/engine-cyclic/render.php b/Neutron-trunk/api/engine-cyclic/render.php
new file mode 100644
index 0000000..b5d5959
--- /dev/null
+++ b/Neutron-trunk/api/engine-cyclic/render.php
@@ -0,0 +1,2 @@
+<?php
+require_once $_SERVER['DOCUMENT_ROOT'] . "/api/renderer/main.php"; \ No newline at end of file
diff --git a/Neutron-trunk/api/engine-cyclic/special.php b/Neutron-trunk/api/engine-cyclic/special.php
new file mode 100644
index 0000000..995a76a
--- /dev/null
+++ b/Neutron-trunk/api/engine-cyclic/special.php
@@ -0,0 +1,18 @@
+<?php
+
+ob_start();
+require_once $_SERVER['DOCUMENT_ROOT'] . "/api/lang/processor.php";
+require_once $_SERVER['DOCUMENT_ROOT'] . "/resources/private/headers/preprocessor.php";
+
+require_once $_SERVER['DOCUMENT_ROOT'] . "/api/engine-cyclic/includes/includes.php";
+
+require_once $_SERVER['DOCUMENT_ROOT'] . "/api/engine-cyclic/heads.php";
+
+require_once $_SERVER['DOCUMENT_ROOT'] . "/api/engine-cyclic/components/init.php";
+require_once $_SERVER['DOCUMENT_ROOT'] . "/api/engine-cyclic/components/menubar.php";
+require_once $_SERVER['DOCUMENT_ROOT'] . "/api/engine-cyclic/components/drawer.php";
+require_once $_SERVER['DOCUMENT_ROOT'] . "/api/engine-cyclic/components/banner.php";
+require_once $_SERVER['DOCUMENT_ROOT'] . "/api/engine-cyclic/components/content.php";
+require_once $_SERVER['DOCUMENT_ROOT'] . "/api/engine-cyclic/components/footer.php";
+
+require_once $_SERVER['DOCUMENT_ROOT'] . "/api/engine-cyclic/tails.php"; \ No newline at end of file
diff --git a/Neutron-trunk/api/engine-cyclic/tails.php b/Neutron-trunk/api/engine-cyclic/tails.php
new file mode 100644
index 0000000..9e9e5f4
--- /dev/null
+++ b/Neutron-trunk/api/engine-cyclic/tails.php
@@ -0,0 +1,4 @@
+</div>
+</body>
+</html>
+<?php rlgps("Finished generating DOM"); ?> \ No newline at end of file
diff --git a/Neutron-trunk/api/engine-cyclic/wrapper.php b/Neutron-trunk/api/engine-cyclic/wrapper.php
new file mode 100644
index 0000000..196060d
--- /dev/null
+++ b/Neutron-trunk/api/engine-cyclic/wrapper.php
@@ -0,0 +1,42 @@
+<?php
+
+function render(string $page) {
+ global $MPCMSRendererPageNameValue;
+
+ if ($page == "index") {
+ $MPCMSRendererPageNameValue = "index";
+ rlgps("Processing website homepage");
+ if (!cacheCheck("index")) {
+ require_once $_SERVER['DOCUMENT_ROOT'] . "/api/engine-cyclic/homepage.php";
+
+ $content = ob_get_contents();
+ file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/cache/page-index", $content);
+ require_once $_SERVER['DOCUMENT_ROOT'] . "/resources/private/debug.php";debugDump();
+ } else {
+ rlgps("Received page from cache");
+ }
+ } else {
+ $MPCMSRendererPageNameValue = $page;
+ rlgps("Processing /{$page}");
+ if (!cacheCheck($page)) {
+ require_once $_SERVER['DOCUMENT_ROOT'] . "/api/engine-cyclic/pages.php";
+
+ $content = ob_get_contents();
+ file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/cache/page-" . $page, $content);
+ require_once $_SERVER['DOCUMENT_ROOT'] . "/resources/private/debug.php";debugDump();
+ } else {
+ rlgps("Received page from cache");
+ }
+ }
+}
+
+function renderSpecial(string $markup, string $displayName = "Page") {
+ global $MPCMSRendererPageMarkup;
+ global $MPCMSRendererPageMarkupDN;
+
+ $MPCMSRendererPageMarkup = $markup;
+ $MPCMSRendererPageMarkupDN = $displayName;
+ rlgps("Processing special page");
+ require_once $_SERVER['DOCUMENT_ROOT'] . "/api/engine-cyclic/special.php";
+ require_once $_SERVER['DOCUMENT_ROOT'] . "/resources/private/debug.php";debugDump();
+} \ No newline at end of file