summaryrefslogtreecommitdiff
path: root/api/fronter.php
diff options
context:
space:
mode:
authorMinteck <contact@minteck.org>2023-02-23 19:34:56 +0100
committerMinteck <contact@minteck.org>2023-02-23 19:34:56 +0100
commit3d1cd02f27518f1a04374c7c8320cd5d82ede6e9 (patch)
tree75be5fba4368472fb11c8015aee026b2b9a71888 /api/fronter.php
parent8cc1f13c17fa2fb5a4410542d39e650e02945634 (diff)
downloadpluralconnect-3d1cd02f27518f1a04374c7c8320cd5d82ede6e9.tar.gz
pluralconnect-3d1cd02f27518f1a04374c7c8320cd5d82ede6e9.tar.bz2
pluralconnect-3d1cd02f27518f1a04374c7c8320cd5d82ede6e9.zip
Updated 40 files, added 37 files, deleted 1103 files and renamed 3905 files (automated)
Diffstat (limited to 'api/fronter.php')
-rw-r--r--api/fronter.php113
1 files changed, 0 insertions, 113 deletions
diff --git a/api/fronter.php b/api/fronter.php
deleted file mode 100644
index c41562f..0000000
--- a/api/fronter.php
+++ /dev/null
@@ -1,113 +0,0 @@
-<?php
-
-require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/session.inc"; global $isLoggedIn; global $isLowerLoggedIn;
-if (!$isLoggedIn || $isLowerLoggedIn) {
- header("Location: /-/login");
- die();
-}
-
-$system = $_GET['s'] ?? null;
-$member = $_GET['m'] ?? null;
-$index = (int)$_GET['i'] ?? null;
-$type = $_GET['t'] ?? null;
-$date = $_GET['d'] ?? null;
-
-if (!isset($system) || trim($system) === "" || strlen($system) !== 5 || !preg_match("/[a-z]/i", $system) || ($system !== "gdapd" && $system !== "ynmuc"))
- header("Location: /?error=System not found") and die();
-
-if (!isset($type) || trim($type) === "")
- header("Location: /?error=Type not found") and die();
-
-if (!isset($date) || trim($date) === "" || strlen($date) !== 10 || !preg_match("/[\d-]/i", $date))
- header("Location: /?error=Date not found") and die();
-
-$list = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/planner/$system.json"), true);
-
-function moveElement(&$array, $a, $b) {
- $out = array_splice($array, $a, 1);
- array_splice($array, $b, 0, $out);
-}
-
-switch ($type) {
- case "add":
- if (!isset($member) || trim($member) === "" || strlen($member) !== 5 || !preg_match("/[a-z]/i", $member))
- if ($member !== null && $member !== "null") header("Location: /?error=System member not found") and die();
-
- if (!isset($list[$date])) $list[$date] = [];
- $list[$date][] = [$member, null];
- break;
-
- case "cofront":
- if (!isset($index) || trim($index) === "" || is_integer($index))
- if ($index !== null && $index !== "null") header("Location: /?error=Invalid index") and die();
-
- $day = $list[$date];
-
- if (!isset($day[$index]))
- if ($index !== null && $index !== "null") header("Location: /?error=Index not found") and die();
-
- if (!isset($member) || trim($member) === "" || strlen($member) !== 5 || !preg_match("/[a-z]/i", $member))
- if ($member !== null && $member !== "null") header("Location: /?error=System member not found") and die();
-
- $list[$date][$index][1] = $member;
- break;
-
- case "delete":
- if (!isset($index) || trim($index) === "" || is_integer($index))
- if ($index !== null && $index !== "null") header("Location: /?error=Invalid index") and die();
-
- $day = $list[$date];
-
- if (!isset($day[$index]))
- if ($index !== null && $index !== "null") header("Location: /?error=Index not found") and die();
-
- unset($day[$index]);
- $list[$date] = array_values($day);
-
- break;
-
- case "codelete":
- if (!isset($index) || trim($index) === "" || is_integer($index))
- if ($index !== null && $index !== "null") header("Location: /?error=Invalid index") and die();
-
- $day = $list[$date];
-
- if (!isset($day[$index]))
- if ($index !== null && $index !== "null") header("Location: /?error=Index not found") and die();
-
- $list[$date][$index][1] = null;
-
- break;
-
- case "down":
- if (!isset($index) || trim($index) === "" || is_integer($index))
- if ($index !== null && $index !== "null") header("Location: /?error=Invalid index") and die();
-
- if (!isset($day[$index]))
- if ($index !== null && $index !== "null") header("Location: /?error=Index not found") and die();
-
- $day = $list[$date];
- moveElement($list[$date], $index, $index + 1 < count($list[$date]) ? $index + 1 : $index);
-
- break;
-
- case "up":
- if (!isset($index) || trim($index) === "" || is_integer($index))
- if ($index !== null && $index !== "null") header("Location: /?error=Invalid index") and die();
-
- if (!isset($day[$index]))
- if ($index !== null && $index !== "null") header("Location: /?error=Index not found") and die();
-
- $day = $list[$date];
- moveElement($list[$date], $index, $index - 1 > -1 ? $index - 1 : $index);
-
- break;
-
- default:
- header("Location: /?error=Invalid type name") and die();
- break;
-}
-
-file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/planner/$system.json", json_encode($list));
-
-die(); \ No newline at end of file