From 529ffcbfa97ab51a64a97f6dff08aeb2bc0cc105 Mon Sep 17 00:00:00 2001 From: Minteck Date: Tue, 24 Aug 2021 15:38:16 +0200 Subject: Update --- .../api/engine-cyclic/components/banner.php | 10 +++ .../api/engine-cyclic/components/content.php | 22 ++++++ .../api/engine-cyclic/components/drawer.php | 54 +++++++++++++ .../api/engine-cyclic/components/favicon.php | 88 ++++++++++++++++++++++ .../api/engine-cyclic/components/footer.php | 23 ++++++ .../api/engine-cyclic/components/init.php | 14 ++++ .../api/engine-cyclic/components/menubar.php | 52 +++++++++++++ .../api/engine-cyclic/components/widgets.php | 18 +++++ Neutron-trunk/api/engine-cyclic/heads.php | 40 ++++++++++ Neutron-trunk/api/engine-cyclic/homepage.php | 18 +++++ Neutron-trunk/api/engine-cyclic/includes/cache.php | 70 +++++++++++++++++ .../api/engine-cyclic/includes/getPageContent.php | 14 ++++ .../api/engine-cyclic/includes/getPageName.php | 18 +++++ .../api/engine-cyclic/includes/includes.php | 4 + Neutron-trunk/api/engine-cyclic/pages.php | 18 +++++ Neutron-trunk/api/engine-cyclic/render.php | 2 + Neutron-trunk/api/engine-cyclic/special.php | 18 +++++ Neutron-trunk/api/engine-cyclic/tails.php | 4 + Neutron-trunk/api/engine-cyclic/wrapper.php | 42 +++++++++++ 19 files changed, 529 insertions(+) create mode 100644 Neutron-trunk/api/engine-cyclic/components/banner.php create mode 100644 Neutron-trunk/api/engine-cyclic/components/content.php create mode 100644 Neutron-trunk/api/engine-cyclic/components/drawer.php create mode 100644 Neutron-trunk/api/engine-cyclic/components/favicon.php create mode 100644 Neutron-trunk/api/engine-cyclic/components/footer.php create mode 100644 Neutron-trunk/api/engine-cyclic/components/init.php create mode 100644 Neutron-trunk/api/engine-cyclic/components/menubar.php create mode 100644 Neutron-trunk/api/engine-cyclic/components/widgets.php create mode 100644 Neutron-trunk/api/engine-cyclic/heads.php create mode 100644 Neutron-trunk/api/engine-cyclic/homepage.php create mode 100644 Neutron-trunk/api/engine-cyclic/includes/cache.php create mode 100644 Neutron-trunk/api/engine-cyclic/includes/getPageContent.php create mode 100644 Neutron-trunk/api/engine-cyclic/includes/getPageName.php create mode 100644 Neutron-trunk/api/engine-cyclic/includes/includes.php create mode 100644 Neutron-trunk/api/engine-cyclic/pages.php create mode 100644 Neutron-trunk/api/engine-cyclic/render.php create mode 100644 Neutron-trunk/api/engine-cyclic/special.php create mode 100644 Neutron-trunk/api/engine-cyclic/tails.php create mode 100644 Neutron-trunk/api/engine-cyclic/wrapper.php (limited to 'Neutron-trunk/api/engine-cyclic') 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 @@ +
+ \ 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 @@ +
+
+
+ +

+ +
+
+

+ +
+
+ + + + +
+

+ +
+
+
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 @@ + + + +
\ 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 @@ +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 @@ + \ 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 @@ +list; +foreach ($widgets as $widget): ?> + +class) && is_string($data->class)) { + require $_SERVER['DOCUMENT_ROOT'] . "/widgets/" . $widget . "/source.php"; +} + +?> + \ 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 @@ + + +
+ +
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 @@ +list; +foreach ($widgets as $widget): ?> + +
+class) && is_string($data->class)) { + $class = $data->class; + new $class(); +} else { + require $_SERVER['DOCUMENT_ROOT'] . "/widgets/" . $widget . "/source.php"; +} + +?> + \ 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("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")); + } + + ?> + + + + /resources/css/polymer/fonts.css"> + /resources/css/themes/-.css"> + /resources/css/polymer/menubar.css"> + /resources/css/polymer/content.css"> + /resources/upload/favicon.png" type="image/png"> + /resources/css/polymer/responsive.css"> + /resources/css/polymer/scrollbars.css"> + /resources/css/polymer/warnings.css"> + /resources/css/polymer/gallery.css"> + /resources/lib/pushbar.js/library.css"> + + headers");require_once $_SERVER['DOCUMENT_ROOT'] . "/resources/private/headers/documenthead.php"; ?> + + + + 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 @@ +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 @@ + + + + \ 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 @@ +