From 02eda3e4c9b4ba718f1fff70b7328ed8cdd5e63b Mon Sep 17 00:00:00 2001
From: RaindropsSys <contact@minteck.org>
Date: Sun, 2 Apr 2023 23:03:02 +0200
Subject: Updated 35 files, added 11 files and deleted
 includes/components/search.inc (automated)

---
 app.php | 19 +++++++++++++++++--
 1 file changed, 17 insertions(+), 2 deletions(-)

(limited to 'app.php')

diff --git a/app.php b/app.php
index b6651c9..ec85fbe 100644
--- a/app.php
+++ b/app.php
@@ -1,12 +1,21 @@
 <?php
 
-ob_start();
+$start = microtime(true);
+$GLOBALS["ColdHazeStart"] = microtime(true);
+$GLOBALS["ColdHazePerformance"] = [];
+
+if (!function_exists("formatPonypush")) {
+    function formatPonypush($message) {
+        return "Update to Ponypush 3.1.0 or later — (\$PA1$\$" . base64_encode($message) . "\$\$)";
+    }
+}
 
 require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/util/language.inc"; global $lang; global $pages;
 require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/util/session.inc"; global $isLoggedIn; global $isLowerLoggedIn;
 require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/util/functions.inc";
 
-$app = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/app.json"), true);
+global $app;
+$app = $GLOBALS["ColdHazeApp"] = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/app.json"), true);
 
 if (str_ends_with($_GET['_'], "/")) {
     $pagename = substr($_GET['_'], 0, strlen($_GET['_']) - 1);
@@ -25,6 +34,7 @@ if (in_array($toplevel, ["editor", "icons", "species", "uploads"])) {
     }
 } elseif ($toplevel === "") {
     $pageFile = $_SERVER['DOCUMENT_ROOT'] . "/pages/home.inc";
+    $GLOBALS["ColdHazePerformance"]["router"] = (microtime(true) - $start) * 1000;
     require_once $_SERVER['DOCUMENT_ROOT'] . "/pages/home.inc";
 } else {
     if ($toplevel === "-") {
@@ -33,6 +43,7 @@ if (in_array($toplevel, ["editor", "icons", "species", "uploads"])) {
 
         if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/pages/" . $toplevel . ".inc")) {
             $pageFile = $_SERVER['DOCUMENT_ROOT'] . "/pages/" . $toplevel . ".inc";
+            $GLOBALS["ColdHazePerformance"]["router"] = (microtime(true) - $start) * 1000;
             require_once $_SERVER['DOCUMENT_ROOT'] . "/pages/" . $toplevel . ".inc";
         } else {
             peh_error("Page not found: " . strip_tags($pagename), 404);
@@ -40,6 +51,7 @@ if (in_array($toplevel, ["editor", "icons", "species", "uploads"])) {
     } else if ($toplevel === "api") {
         if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/pages/" . $toplevel . ".inc")) {
             $pageFile = $_SERVER['DOCUMENT_ROOT'] . "/pages/" . $toplevel . ".inc";
+            $GLOBALS["ColdHazePerformance"]["router"] = (microtime(true) - $start) * 1000;
             require_once $_SERVER['DOCUMENT_ROOT'] . "/pages/" . $toplevel . ".inc";
         }
     } else if ($toplevel === "cloudburst" || $toplevel === "raindrops" || (($isLoggedIn || $isLowerLoggedIn) && $toplevel === $app["other"]["slug"])) {
@@ -60,6 +72,7 @@ if (in_array($toplevel, ["editor", "icons", "species", "uploads"])) {
         }
 
         $pageFile = $_SERVER['DOCUMENT_ROOT'] . "/pages/page.inc";
+        $GLOBALS["ColdHazePerformance"]["router"] = (microtime(true) - $start) * 1000;
         require_once $_SERVER['DOCUMENT_ROOT'] . "/pages/page.inc";
     } else {
         if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/pages/" . $toplevel . ".inc")) {
@@ -81,10 +94,12 @@ if (in_array($toplevel, ["editor", "icons", "species", "uploads"])) {
 
             if ((in_array($toplevel, $namesCloudburst) || in_array($toplevel, $namesRaindrops) || in_array($toplevel, $namesOther)) && $toplevel !== "unknown") {
                 $pageFile = $_SERVER['DOCUMENT_ROOT'] . "/pages/page.inc";
+                $GLOBALS["ColdHazePerformance"]["router"] = (microtime(true) - $start) * 1000;
                 require_once $_SERVER['DOCUMENT_ROOT'] . "/pages/page.inc";
             } else {
                 global $toplevel;
                 $pageFile = $_SERVER['DOCUMENT_ROOT'] . "/includes/util/short.inc";
+                $GLOBALS["ColdHazePerformance"]["router"] = (microtime(true) - $start) * 1000;
                 require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/util/short.inc";
             }
         }
-- 
cgit