From 2162eaa06f7e4764eb3dcfe130ec2c711d0c62ab Mon Sep 17 00:00:00 2001 From: Minteck Date: Thu, 22 Sep 2022 19:47:05 +0200 Subject: Cofronting support and stuff like that --- api/fronter.php | 30 +++++++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) (limited to 'api/fronter.php') diff --git a/api/fronter.php b/api/fronter.php index e74d34a..f962625 100644 --- a/api/fronter.php +++ b/api/fronter.php @@ -31,7 +31,22 @@ switch ($type) { if ($member !== null && $member !== "null") header("Location: /?error=System member not found") and die(); if (!isset($list[$date])) $list[$date] = []; - $list[$date][] = $member; + $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": @@ -48,6 +63,19 @@ switch ($type) { 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(); -- cgit