summaryrefslogtreecommitdiff
path: root/public
diff options
context:
space:
mode:
authorilotterytea <iltsu@alright.party>2025-03-26 02:07:18 +0500
committerilotterytea <iltsu@alright.party>2025-03-26 02:07:18 +0500
commit4817a5f2e72a29e6f2c7671d5934e78a19184127 (patch)
tree288a7aa3220b0e0a96db3d6f3946acad18467457 /public
parent2bc64b4fafaf7977695e6c0a1805156e00049fea (diff)
feat: display holidays
Diffstat (limited to 'public')
-rw-r--r--public/index.php41
1 files changed, 41 insertions, 0 deletions
diff --git a/public/index.php b/public/index.php
index e69de29..e181b96 100644
--- a/public/index.php
+++ b/public/index.php
@@ -0,0 +1,41 @@
+<?php
+include_once "../holidays.php";
+
+$month = $_GET["month"] ?? date("n");
+$day = $_GET["day"] ?? date("d");
+
+$holidays = [];
+
+foreach (HOLIDAYS[0] as $holiday) {
+ if ($holiday["date"][0] == $month && $holiday["date"][1] == $day) {
+ array_push($holidays, $holiday);
+ }
+}
+
+if (CLIENT_REQUIRES_JSON) {
+ header("Content-Type: application/json");
+ echo json_encode($holidays);
+ exit;
+}
+
+$holiday_count = count($holidays);
+?>
+
+<html>
+
+<head>
+ <title><?php echo $holiday_count ?> holidays on <?php echo "$day.$month" ?></title>
+</head>
+
+<body>
+ <h1><?php echo $holiday_count ?> holidays on <?php echo "$day.$month" ?></h1>
+ <ul>
+ <?php
+ foreach ($holidays as $holiday) {
+ echo '<li>' . $holiday["name"] . '</li>';
+ }
+ ?>
+ </ul>
+</body>
+
+</html> \ No newline at end of file