From 74d351e9cd953dee861ff57a8d2bfc91c2dc02d1 Mon Sep 17 00:00:00 2001
From: Bye <bye@byecorps.com>
Date: Sun, 17 Mar 2024 15:48:32 +0000
Subject: [PATCH] I don't know if this is OK to publish. YOLO

---
 dashboard.php | 17 +++++++++++------
 head.php      | 42 ++++--------------------------------------
 index.php     | 29 ++++++++++++++++++-----------
 profile.php   |  3 ++-
 signin.php    |  2 +-
 5 files changed, 36 insertions(+), 57 deletions(-)

diff --git a/dashboard.php b/dashboard.php
index 58d5592..9542481 100644
--- a/dashboard.php
+++ b/dashboard.php
@@ -1,12 +1,17 @@
 <?php
 
+if (empty($_SESSION)) {
+    http_response_code(307);
+    header('Location: /signin?callback=/dashboard');
+    exit();
+}
 if (!$_SESSION['auth']) {
-    echo("You are being redirected...");
-    http_response_code(302);
-    header('Location '. BASE_URL .'/signin?callback=/dashboard');
-    die();
+    http_response_code(307);
+    header('Location: /signin?callback=/dashboard');
+    exit;
 }
 
-?>
+$doc_title = get_display_name($user['id']) . "'s Dashboard" ;
 
-<h1>Hey there <?= $user['display_name'] ?>!</h1>
+$output = $output .
+    "<h1>Hey there ". $user['display_name'] ."!</h1>";
diff --git a/head.php b/head.php
index 37e681a..1998630 100644
--- a/head.php
+++ b/head.php
@@ -1,9 +1,11 @@
-
+<meta charset="UTF-8">
+<meta http-equiv="X-UA-Compatible" content="IE=edge">
+<meta name="viewport" content="width=device-width, initial-scale=1.0">
 <script
         src="https://js.sentry-cdn.com/15d71a72983891268a3298cdc2bd1498.min.js"
         crossorigin="anonymous"
 ></script>
-<!--<title>--><?php //if (isset($doc_title)) { echo $doc_title." | "; } ?><!--ByeCorps ID</title>-->
+<title><?php if (isset($doc_title)) { echo $doc_title." | "; } ?>ByeCorps ID</title>
 
 <link rel="shortcut icon" href="favicon.svg" type="image/svg" />
 
@@ -15,41 +17,5 @@
 
 <meta name="apple-mobile-web-app-capable" content="yes">
 
-<link rel="apple-touch-startup-image" href="/assets/icons/apple-splash-2048-2732.png" media="(device-width: 1024px) and (device-height: 1366px) and (-webkit-device-pixel-ratio: 2) and (orientation: portrait)">
-<link rel="apple-touch-startup-image" href="/assets/icons/apple-splash-2732-2048.png" media="(device-width: 1024px) and (device-height: 1366px) and (-webkit-device-pixel-ratio: 2) and (orientation: landscape)">
-<link rel="apple-touch-startup-image" href="/assets/icons/apple-splash-1668-2388.png" media="(device-width: 834px) and (device-height: 1194px) and (-webkit-device-pixel-ratio: 2) and (orientation: portrait)">
-<link rel="apple-touch-startup-image" href="/assets/icons/apple-splash-2388-1668.png" media="(device-width: 834px) and (device-height: 1194px) and (-webkit-device-pixel-ratio: 2) and (orientation: landscape)">
-<link rel="apple-touch-startup-image" href="/assets/icons/apple-splash-1536-2048.png" media="(device-width: 768px) and (device-height: 1024px) and (-webkit-device-pixel-ratio: 2) and (orientation: portrait)">
-<link rel="apple-touch-startup-image" href="/assets/icons/apple-splash-2048-1536.png" media="(device-width: 768px) and (device-height: 1024px) and (-webkit-device-pixel-ratio: 2) and (orientation: landscape)">
-<link rel="apple-touch-startup-image" href="/assets/icons/apple-splash-1488-2266.png" media="(device-width: 744px) and (device-height: 1133px) and (-webkit-device-pixel-ratio: 2) and (orientation: portrait)">
-<link rel="apple-touch-startup-image" href="/assets/icons/apple-splash-2266-1488.png" media="(device-width: 744px) and (device-height: 1133px) and (-webkit-device-pixel-ratio: 2) and (orientation: landscape)">
-<link rel="apple-touch-startup-image" href="/assets/icons/apple-splash-1640-2360.png" media="(device-width: 820px) and (device-height: 1180px) and (-webkit-device-pixel-ratio: 2) and (orientation: portrait)">
-<link rel="apple-touch-startup-image" href="/assets/icons/apple-splash-2360-1640.png" media="(device-width: 820px) and (device-height: 1180px) and (-webkit-device-pixel-ratio: 2) and (orientation: landscape)">
-<link rel="apple-touch-startup-image" href="/assets/icons/apple-splash-1668-2224.png" media="(device-width: 834px) and (device-height: 1112px) and (-webkit-device-pixel-ratio: 2) and (orientation: portrait)">
-<link rel="apple-touch-startup-image" href="/assets/icons/apple-splash-2224-1668.png" media="(device-width: 834px) and (device-height: 1112px) and (-webkit-device-pixel-ratio: 2) and (orientation: landscape)">
-<link rel="apple-touch-startup-image" href="/assets/icons/apple-splash-1620-2160.png" media="(device-width: 810px) and (device-height: 1080px) and (-webkit-device-pixel-ratio: 2) and (orientation: portrait)">
-<link rel="apple-touch-startup-image" href="/assets/icons/apple-splash-2160-1620.png" media="(device-width: 810px) and (device-height: 1080px) and (-webkit-device-pixel-ratio: 2) and (orientation: landscape)">
-<link rel="apple-touch-startup-image" href="/assets/icons/apple-splash-1290-2796.png" media="(device-width: 430px) and (device-height: 932px) and (-webkit-device-pixel-ratio: 3) and (orientation: portrait)">
-<link rel="apple-touch-startup-image" href="/assets/icons/apple-splash-2796-1290.png" media="(device-width: 430px) and (device-height: 932px) and (-webkit-device-pixel-ratio: 3) and (orientation: landscape)">
-<link rel="apple-touch-startup-image" href="/assets/icons/apple-splash-1179-2556.png" media="(device-width: 393px) and (device-height: 852px) and (-webkit-device-pixel-ratio: 3) and (orientation: portrait)">
-<link rel="apple-touch-startup-image" href="/assets/icons/apple-splash-2556-1179.png" media="(device-width: 393px) and (device-height: 852px) and (-webkit-device-pixel-ratio: 3) and (orientation: landscape)">
-<link rel="apple-touch-startup-image" href="/assets/icons/apple-splash-1284-2778.png" media="(device-width: 428px) and (device-height: 926px) and (-webkit-device-pixel-ratio: 3) and (orientation: portrait)">
-<link rel="apple-touch-startup-image" href="/assets/icons/apple-splash-2778-1284.png" media="(device-width: 428px) and (device-height: 926px) and (-webkit-device-pixel-ratio: 3) and (orientation: landscape)">
-<link rel="apple-touch-startup-image" href="/assets/icons/apple-splash-1170-2532.png" media="(device-width: 390px) and (device-height: 844px) and (-webkit-device-pixel-ratio: 3) and (orientation: portrait)">
-<link rel="apple-touch-startup-image" href="/assets/icons/apple-splash-2532-1170.png" media="(device-width: 390px) and (device-height: 844px) and (-webkit-device-pixel-ratio: 3) and (orientation: landscape)">
-<link rel="apple-touch-startup-image" href="/assets/icons/apple-splash-1125-2436.png" media="(device-width: 375px) and (device-height: 812px) and (-webkit-device-pixel-ratio: 3) and (orientation: portrait)">
-<link rel="apple-touch-startup-image" href="/assets/icons/apple-splash-2436-1125.png" media="(device-width: 375px) and (device-height: 812px) and (-webkit-device-pixel-ratio: 3) and (orientation: landscape)">
-<link rel="apple-touch-startup-image" href="/assets/icons/apple-splash-1242-2688.png" media="(device-width: 414px) and (device-height: 896px) and (-webkit-device-pixel-ratio: 3) and (orientation: portrait)">
-<link rel="apple-touch-startup-image" href="/assets/icons/apple-splash-2688-1242.png" media="(device-width: 414px) and (device-height: 896px) and (-webkit-device-pixel-ratio: 3) and (orientation: landscape)">
-<link rel="apple-touch-startup-image" href="/assets/icons/apple-splash-828-1792.png" media="(device-width: 414px) and (device-height: 896px) and (-webkit-device-pixel-ratio: 2) and (orientation: portrait)">
-<link rel="apple-touch-startup-image" href="/assets/icons/apple-splash-1792-828.png" media="(device-width: 414px) and (device-height: 896px) and (-webkit-device-pixel-ratio: 2) and (orientation: landscape)">
-<link rel="apple-touch-startup-image" href="/assets/icons/apple-splash-1242-2208.png" media="(device-width: 414px) and (device-height: 736px) and (-webkit-device-pixel-ratio: 3) and (orientation: portrait)">
-<link rel="apple-touch-startup-image" href="/assets/icons/apple-splash-2208-1242.png" media="(device-width: 414px) and (device-height: 736px) and (-webkit-device-pixel-ratio: 3) and (orientation: landscape)">
-<link rel="apple-touch-startup-image" href="/assets/icons/apple-splash-750-1334.png" media="(device-width: 375px) and (device-height: 667px) and (-webkit-device-pixel-ratio: 2) and (orientation: portrait)">
-<link rel="apple-touch-startup-image" href="/assets/icons/apple-splash-1334-750.png" media="(device-width: 375px) and (device-height: 667px) and (-webkit-device-pixel-ratio: 2) and (orientation: landscape)">
-<link rel="apple-touch-startup-image" href="/assets/icons/apple-splash-640-1136.png" media="(device-width: 320px) and (device-height: 568px) and (-webkit-device-pixel-ratio: 2) and (orientation: portrait)">
-<link rel="apple-touch-startup-image" href="/assets/icons/apple-splash-1136-640.png" media="(device-width: 320px) and (device-height: 568px) and (-webkit-device-pixel-ratio: 2) and (orientation: landscape)">
-
-
 <link rel="stylesheet" href="/styles/global.css" />
 <link rel="stylesheet" href="/fontawesome/css/all.css" />
\ No newline at end of file
diff --git a/index.php b/index.php
index b5fde9e..354cb19 100755
--- a/index.php
+++ b/index.php
@@ -3,6 +3,8 @@ require_once __DIR__ . '/vendor/autoload.php';
 
 session_start();
 
+error_reporting(E_ERROR | E_WARNING | E_PARSE);
+
 if (empty($_SESSION)) {
     $_SESSION['auth'] = false;
 }
@@ -124,10 +126,10 @@ $paths = array(
     // Settings
     "/dashboard" => ["dashboard.php", "Dashboard", true],
 
-    "/account" => ["account.php", "Your account", true],
+    "/account" => ["account.php", "Your account"],
     "/signin" => ["signin.php", "Sign in"],
     "/signup" => ["signup.php", "Sign up"],
-    "/signout" => ["signout.php", "Signed out". false, true],
+    "/signout" => ["signout.php", "Signed out"],
     "/forgot/password" => ["forgot_password.php", "Forgot password"],
     "/reset/password" => ["reset_password.php", "Reset password"],
     "/docs" => ["docs.php", "Docs"],
@@ -148,15 +150,14 @@ if (!empty($uri) ) { // Go to jail. Go directly to jail. Do not pass Go.
     }
 }
 
+$migrated = false;
 if (isset($paths[$path])) {
     $include = $paths[$path][0];
     if (isset($paths[$path][1])) {
         $doc_title = $paths[$path][1];
     }
-    if (array_key_exists(3, $paths[$path])) {
-        if ($paths[$path][3]) {
-            goto skip_formalities;
-        }
+    if (isset($paths[$path][2])) {
+        $migrated = $paths[$path][2];
     }
 }
 
@@ -165,10 +166,12 @@ else {
     http_response_code(404);
 }
 
-if ($include == "login_external_basic.php") {
-    goto skip_formalities;
-}
 
+if ($migrated) {
+    $output = "";
+
+    include($include);
+}
 ?>
 
 <!DOCTYPE html>
@@ -197,8 +200,12 @@ if ($include == "login_external_basic.php") {
             }
         }
 
-        skip_formalities:
-        include($include);
+        if ($migrated) {
+            echo $output;
+        }
+        else {
+            include ($include);
+        }
         ?>
     </main>
     <?php include("footer.php"); ?>
diff --git a/profile.php b/profile.php
index 75829b8..4f65db5 100644
--- a/profile.php
+++ b/profile.php
@@ -1,10 +1,11 @@
 
-<link rel="stylesheet" href="/styles/profiles.css">
+<link rel="stylesheet" href="/styles/profiles.css" />
 
 <?php
 
 if (!$_SESSION['auth']) {
     header('Location: /signin?callback=/profile');
+    exit();
 }
 
 $profile = db_execute("SELECT * FROM `profiles` WHERE id = ? LIMIT 1", [$user['id']]);
diff --git a/signin.php b/signin.php
index 88f8619..7814a1a 100644
--- a/signin.php
+++ b/signin.php
@@ -1,7 +1,7 @@
 <?php 
 
 if ($_SESSION['auth']) {
-    header('Location: /account');
+    header('Location: /profile');
 }
 
 if (isset($query['callback'])) {
-- 
GitLab