aboutsummaryrefslogtreecommitdiff
path: root/Neutron-trunk/api/admin/cache_pages_update.php
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/admin/cache_pages_update.php
parent15e4724761c50b30803df1811a525c85058f70bf (diff)
downloadelectrode-529ffcbfa97ab51a64a97f6dff08aeb2bc0cc105.tar.gz
electrode-529ffcbfa97ab51a64a97f6dff08aeb2bc0cc105.tar.bz2
electrode-529ffcbfa97ab51a64a97f6dff08aeb2bc0cc105.zip
Update
Diffstat (limited to 'Neutron-trunk/api/admin/cache_pages_update.php')
-rw-r--r--Neutron-trunk/api/admin/cache_pages_update.php72
1 files changed, 72 insertions, 0 deletions
diff --git a/Neutron-trunk/api/admin/cache_pages_update.php b/Neutron-trunk/api/admin/cache_pages_update.php
new file mode 100644
index 0000000..3122731
--- /dev/null
+++ b/Neutron-trunk/api/admin/cache_pages_update.php
@@ -0,0 +1,72 @@
+<?php
+
+require_once $_SERVER['DOCUMENT_ROOT'] . "/api/lang/processor.php";
+
+$customSettings = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/customSettings.json"));
+global $cache;
+$cache = "";
+
+function append(string $text) {
+ global $cache;
+ $cache = $cache . $text;
+}
+
+function compareASCII($a, $b) {
+ $at = iconv('UTF-8', 'ASCII//TRANSLIT', $a);
+ $bt = iconv('UTF-8', 'ASCII//TRANSLIT', $b);
+ return strcmp($at, $bt);
+}
+
+$pages = scandir($_SERVER['DOCUMENT_ROOT']);
+uasort($pages, 'compareASCII');
+$index = 0;
+if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/galery/enabled")) {$index = 1;}
+append("@home|@indexHomeIcon");
+foreach ($pages as $page) {
+ if ((($page != ".." && $page != ".") && $index < 6) && (is_dir($_SERVER['DOCUMENT_ROOT'] . "/" . $page)) && (file_exists($_SERVER['DOCUMENT_ROOT'] . "/" . $page . "/pagename")) && (!in_array($page, $customSettings->hiddenPages))) {
+ append("\n{$page}|" . file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/" . $page . "/pagename"));
+ $index++;
+ }
+}
+if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/galery/enabled")) {
+ append("\n@galery|" . $lang["viewer"]["galery"]);
+}
+
+file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/cache/pagelist.mtd", $cache);
+
+$cache = "";
+$index = 0;
+if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/galery/enabled")) {$index = 1;}
+append("@home|@indexHomeIcon");
+foreach ($pages as $page) {
+ if ((($page != ".." && $page != ".")) && (is_dir($_SERVER['DOCUMENT_ROOT'] . "/" . $page)) && (file_exists($_SERVER['DOCUMENT_ROOT'] . "/" . $page . "/pagename")) && (!in_array($page, $customSettings->hiddenPages))) {
+ append("\n{$page}|" . file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/" . $page . "/pagename"));
+ $index++;
+ }
+}
+if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/galery/enabled")) {
+ append("\n@galery|" . $lang["viewer"]["galery"]);
+}
+
+file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/cache/pagelist-full.mtd", $cache);
+
+/* --------------------------- */
+// Backwards compatibility with the old engine-cyclic
+$cache = "";
+
+$pages = scandir($_SERVER['DOCUMENT_ROOT']);
+uasort($pages, 'compareASCII');
+foreach ($pages as $page) {
+ if ($page != ".." && $page != ".") {
+ if (is_dir($_SERVER['DOCUMENT_ROOT'] . "/" . $page)) {
+ if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/" . $page . "/pagename")) {
+ if (!in_array($page, $customSettings->hiddenPages)) {
+ append("<a href=\"/{$page}\" title=\"/{$page}\" class=\"menulink-desktop\">" . file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/" . $page . "/pagename") . "</a>");
+ }
+ }
+ }
+ }
+}
+if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/galery/enabled")) {append("<a href=\"/cms-special/gallery\" title=\"/cms-special/gallery\" class=\"menulink-desktop\">" . $lang["viewer"]["galery"] . "</a>");}
+
+file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/cache/pagelist-old.mtd", $cache); \ No newline at end of file