From 6563d542af0930ebb6b2f9b71f2b7538d7467665 Mon Sep 17 00:00:00 2001
From: Minteck <contact@minteck.org>
Date: Wed, 22 Feb 2023 22:06:58 +0100
Subject: Updated 8 files (automated)

---
 includes/functions.inc |  2 +-
 includes/search.inc    | 11 +++++++----
 pages/actions.inc      |  1 +
 pages/byfront.inc      |  2 +-
 pages/front.inc        |  6 ++----
 pages/home.inc         | 14 ++++++++++----
 pages/pleasure.inc     |  1 +
 pages/toys.inc         |  1 +
 8 files changed, 24 insertions(+), 14 deletions(-)

diff --git a/includes/functions.inc b/includes/functions.inc
index 1345db1..9bc9ba6 100644
--- a/includes/functions.inc
+++ b/includes/functions.inc
@@ -303,7 +303,7 @@ if (!function_exists("showSystem")) {
             $i["system"] = $id;
             $i["equestria"] = $travelling[$i['id']]['travelling'] && $travelling[$i['id']]['equestria'];
             return $i;
-        }, array_filter(json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/$id/members.json"), true), function ($i) use ($travelling) {
+        }, array_filter(json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/" . (isset($app["other"]) && $id === $app["other"]["id"] ? "other" : $id) . "/members.json"), true), function ($i) use ($travelling) {
             return !(isset($travelling[$i['id']]) && $travelling[$i['id']]['travelling'] && (!isset($travelling[$i['id']]['equestria']) || !$travelling[$i['id']]['equestria']));
         })), ...array_map(function ($i) use ($id) {
             $i["travelling"] = true;
diff --git a/includes/search.inc b/includes/search.inc
index 0f0a868..ab9d32f 100644
--- a/includes/search.inc
+++ b/includes/search.inc
@@ -29,10 +29,11 @@
     $list = array_values(array_filter(array_map(function ($i) use ($lang) {
         global $pages;
         global $isLoggedIn;
+        global $isLowerLoggedIn;
 
-        if (in_array(substr($i, 0, strlen($i) - 4), array_keys($pages)) && $pages[substr($i, 0, strlen($i) - 4)]["admin"] && !$isLoggedIn) {
+        if (in_array(substr($i, 0, strlen($i) - 4), array_keys($pages)) && $pages[substr($i, 0, strlen($i) - 4)]["admin"] && !((!$pages[substr($i, 0, strlen($i) - 4)]["limited"] && $isLoggedIn) || ($pages[substr($i, 0, strlen($i) - 4)]["limited"] && $isLowerLoggedIn))) {
             return null;
-        } else {
+        } else if (in_array(substr($i, 0, strlen($i) - 4), array_keys($pages))) {
             return [
                 'name' => in_array(substr($i, 0, strlen($i) - 4), array_keys($pages)) ? $pages[substr($i, 0, strlen($i) - 4)]["name"][$lang["_name"]] : substr($i, 0, strlen($i) - 4),
                 'description' => in_array(substr($i, 0, strlen($i) - 4), array_keys($pages)) ? ($pages[substr($i, 0, strlen($i) - 4)]["short"] ?? $pages[substr($i, 0, strlen($i) - 4)]["name"][$lang["_name"]]) : substr($i, 0, strlen($i) - 4),
@@ -40,6 +41,8 @@
                 'icon' => "/assets/icons/" . (file_exists($_SERVER['DOCUMENT_ROOT'] . "/assets/icons/" . substr($i, 0, strlen($i) - 4) . ".svg") ? substr($i, 0, strlen($i) - 4) : "") . ".svg",
                 'invert' => true
             ];
+        } else {
+            return null;
         }
     }, $base), function ($i) {
         return isset($i);
@@ -104,7 +107,7 @@
 
     global $isLoggedIn;
 
-    if ($isLoggedIn) {
+    if (false && $isLoggedIn) {
         $base = array_values(json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/toys/toys.json"), true));
         $list = array_map(function ($i) {
             return [
@@ -144,7 +147,7 @@
 
     global $isLoggedIn;
 
-    if ($isLoggedIn) {
+    if (false && $isLoggedIn) {
         $base = array_values(json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/actions/actions.json"), true));
         $list = array_map(function ($i) {
             return [
diff --git a/pages/actions.inc b/pages/actions.inc
index 40a359a..630626a 100644
--- a/pages/actions.inc
+++ b/pages/actions.inc
@@ -1,5 +1,6 @@
 <?php
 
+return;
 require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/init.inc"; global $title; global $isLoggedIn; global $lang; global $pages;
 
 if (isset($_POST['deleteAction'])) {
diff --git a/pages/byfront.inc b/pages/byfront.inc
index 93fe3d5..00000b6 100644
--- a/pages/byfront.inc
+++ b/pages/byfront.inc
@@ -110,7 +110,7 @@ $travelling = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includ
                 }
             }
 
-            if (isset($age) && $age > 0 && time() > 1677628800): ?>
+            if ((isset($age) && $age > 0 && time() > 1677628800) || time() <= 1677628800): ?>
             <div class="relation" style="background-color:<?php if ($member["_metadata"]["less_frequent"] || $member["_metadata"]["persecutor"]): ?><?php if ($member["_lastFronted"] > time() - (86400 * 21)): ?>rgba(255, 255, 255, .1)<?php else: ?><?php if ($member["_lastFronted"] > time() - (86400 * 37)): ?>rgba(255, 227, 0, 0.17)rgba(128,54,54,0.17)<?php endif; ?>;<?php endif; ?><?php else: ?><?php if ($member["_lastFronted"] > time() - (86400 * 21)): ?>rgba(255, 255, 255, .1)<?php else: ?><?php if ($member["_lastFronted"] > time() - (86400 * 30)): ?>rgba(255, 227, 0, 0.17)<?php else: ?>rgba(255,55,55,0.17)<?php endif; ?>;<?php endif; ?><?php endif; ?>;margin-bottom:10px;padding:10px;border-radius:10px;display:grid;grid-template-columns: 1fr 2fr max-content;<?php if ($travelling[$member['id']]["travelling"]): ?>opacity: 0.75;<?php endif; ?><?php if (isset($member["_metadata"]["not_fronting"]) && $member["_metadata"]["not_fronting"]): ?>background-color:rgba(255, 255, 255, .1) !important;<?php endif; ?>">
                 <a class="relation-intro" style="background-color:rgba(255, 255, 255, .05);border-right:1px solid rgba(255, 255, 255, .1);margin:-10px;padding:10px;border-top-left-radius:10px;border-bottom-left-radius:10px;color: white;display:flex;align-items:center;text-decoration: none;" href="/<?= $member["name"] ?>">
                     <img src="<?= getAsset($member['system'], $member["id"], "heads") ?>" style="width:24px;">&nbsp;<?= $member["display_name"] ?? $member["name"] ?>
diff --git a/pages/front.inc b/pages/front.inc
index a60be1d..cd4f952 100644
--- a/pages/front.inc
+++ b/pages/front.inc
@@ -2,15 +2,13 @@
 
 $parts = explode("/", $_GET["_"]);
 
-var_dump($parts);
-
 if (isset($parts[2])) {
     if ($parts[2] === "cloudburst") {
         $fronters = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/ynmuc/fronters.json"), true);
     } elseif ($parts[2] === "raindrops") {
         $fronters = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/gdapd/fronters.json"), true);
     } else {
-        header("Location: /");
+        header("Location: /?error=Invalid argument; got " . $parts[2]);
         die();
     }
 
@@ -25,6 +23,6 @@ if (isset($parts[2])) {
         }
     }
 } else {
-    header("Location: /");
+    header("Location: /?error=Missing operand");
     die();
 }
\ No newline at end of file
diff --git a/pages/home.inc b/pages/home.inc
index 44c8d7e..d476991 100644
--- a/pages/home.inc
+++ b/pages/home.inc
@@ -1,4 +1,4 @@
-<?php if (isset($_GET['error'])) header("HTTP/1.1 404 Not Found"); require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.inc'; global $readOnly; global $isNormallyLoggedIn; global $_PROFILE; global $lang; global $pages; global $isLowerLoggedIn; ?>
+<?php if (isset($_GET['error'])) header("HTTP/1.1 404 Not Found"); require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.inc'; global $readOnly; global $isNormallyLoggedIn; global $_PROFILE; global $lang; global $pages; global $isLowerLoggedIn; global $isLoggedIn; ?>
 
 <br>
 <div class="container">
@@ -9,7 +9,7 @@
         </div>
     <?php endif; ?>
 
-    <?php if ($readOnly && $isNormallyLoggedIn): ?>
+    <?php if ($readOnly && $isNormallyLoggedIn || $readOnly && $isLowerLoggedIn): ?>
         <div class="alert alert-warning">
             <b>Notice: </b>This website is temporarily under maintenance and the administrators have locked the database. Although you are logged in as <?= $_PROFILE['name'] ?>, you cannot access any of the logged-in features while the website is under maintenance. <a href="/-/emergency">Alerts dispatching</a> remains possible in case of an emergency.
         </div>
@@ -31,19 +31,23 @@
             <?php if ($_SERVER['HTTP_HOST'] === "fr.equestria.horse"): ?>
                 <p><?= count($byColor) ?> poneys dans une tĂȘte</p>
             <?php else: ?>
+            <?php if ($isLoggedIn || $isLowerLoggedIn): ?>
+            <p><?= count($byColor) ?> ponies in 3 plural systems</p>
+            <?php else: ?>
             <p><?= count($byColor) ?> <?= $lang["home"]["intro"] ?></p>
             <?php endif; ?>
+            <?php endif; ?>
         </div>
     </div>
     <hr style="border-color:rgba(255, 255, 255, .25);">
 
-    <?php global $isLoggedIn; if ($isLoggedIn && ((int)date('H') >= 20 || (int)date('H') < 6)): ?>
+    <!--<?php global $isLoggedIn; if ($isLoggedIn && ((int)date('H') >= 20 || (int)date('H') < 6)): ?>
     <a href="/-/emergency" style="text-decoration: none;margin-top:15px;display:block;">
         <div class="alert alert-danger">
             <b>Are you in need of help?</b> If you need immediate help from a loved one, you may want to enable the emergency alert by clicking here, even if that wakes up the <?= $_PROFILE['name'] === "Raindrops System" ? "Cloudburst System" : "Raindrops System" ?>. Use it as you need.
         </div>
     </a>
-    <?php endif; ?>
+    <?php endif; ?>-->
 
     <!--<div class="alert alert-info">
         <b>Coming soon:</b> Free hosting for Project Scout (the software powering Cold Haze), so you can have your own website for your system. If you are interested and/or want to pre-register, feel free to <a href="https://equestria.horse/contact" target="_blank">contact us</a>.
@@ -55,6 +59,8 @@
         <?php raindrops(false); ?>
         <?php if ($isLoggedIn || $isLowerLoggedIn) other(false); ?>
 
+        <hr>
+
         <div id="hpd-legacy" style="background:rgba(255, 255, 255, .1);border-radius:10px;padding:10px 10px 10px 20px;display:grid;grid-template-columns: 128px 1fr;margin-bottom:10px;">
             <a style="display:flex;margin: -10px -20px;align-items:center;justify-content:center;text-align:center;padding: 10px 20px;border-radius: 10px;background: #77777755;width: 148px;text-decoration:none;color:white;filter:none !important;" class="hpd-system">
                 <div style="text-align:center;"><img src="/assets/icons/legacy.svg" style="width:64px;"><br>Pony Legacy</div>
diff --git a/pages/pleasure.inc b/pages/pleasure.inc
index 30ccf3d..ac59cfd 100644
--- a/pages/pleasure.inc
+++ b/pages/pleasure.inc
@@ -1,5 +1,6 @@
 <?php
 
+return;
 require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/init.inc"; global $title; global $isLoggedIn; global $lang; global $pages;
 $emergencyHeader = true; require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.inc';
 
diff --git a/pages/toys.inc b/pages/toys.inc
index 9032944..4c172c6 100644
--- a/pages/toys.inc
+++ b/pages/toys.inc
@@ -1,5 +1,6 @@
 <?php
 
+return;
 require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/init.inc"; global $title;
 
 if (isset($_POST['deleteAction'])) {
-- 
cgit