summaryrefslogtreecommitdiff
path: root/index.php
diff options
context:
space:
mode:
Diffstat (limited to 'index.php')
-rw-r--r--index.php166
1 files changed, 166 insertions, 0 deletions
diff --git a/index.php b/index.php
new file mode 100644
index 0000000..447b300
--- /dev/null
+++ b/index.php
@@ -0,0 +1,166 @@
+<?php
+/// RIT.WTF --- Daddy munson
+/// Copyright © 2024 Freya Murphy <freya@freyacat.org>
+
+
+// Create global assets object
+
+function __make_assets(): object {
+ $assets = array(
+ // 80x33 buttons
+ 'buttons' => array(
+ 'amd' => 'amd.gif',
+ 'apocalypse' => 'apocalypse.gif',
+ 'dither' => 'dither.gif',
+ 'download' => 'download.gif',
+ 'html' => 'html.gif',
+ 'ie' => 'ie.gif',
+ 'netscape' => 'netscape.gif',
+ ),
+ // css styles
+ 'css' => array(
+ 'main' => 'main.css', // main style
+ 'anim' => 'anim.css', // animations
+
+ 'home' => 'home.css',
+ 'fire' => 'fire.css',
+ 'gallery' => 'gallery.css',
+ 'error' => 'error.css',
+ ),
+ // why does rit keep catching on fire!
+ 'fires' => array(
+ 'battery' => 'battery.jpg',
+ 'gosnell' => 'gosnell.jpg',
+ 'sol' => 'sol.jpg',
+ 'stadium' => 'stadium.jpg',
+ ),
+ // standard imaged images
+ 'images' => array(
+ 'rit' => 'rit.jpg',
+ 'rotchie' => 'rotchie.jpg',
+ ),
+ // goofy ahh memes
+ 'memes' => array(
+ 'awshit' => 'awshit.jpg',
+ 'bean' => 'bean.jpg',
+ 'bisexual' => 'bisexual.jpg',
+ 'counter' => 'counter.jpg',
+ 'election' => 'election.jpg',
+ 'girl' => 'girl.jpg',
+ 'gracies' => 'gracies.jpg',
+ 'obama' => 'obama.jpg',
+ 'onion' => 'onion.jpg',
+ 'pepsi' => 'pepsi.jpg',
+ 'phone' => 'phone.jpg',
+ 'rats' => 'rats.jpg',
+ 'recharge' => 'recharge.jpg',
+ 'roo' => 'roo.jpg',
+ 'silence' => 'silence.jpg',
+ 'twitter' => 'twitter.jpg',
+ 'ul' => 'ul.jpg',
+ 'umbrella' => 'umbrella.jpg',
+ ),
+ // munson art gallery
+ 'munson' => array(
+ '1.jpg',
+ '3.jpg',
+ '4.jpg',
+ '5.jpg',
+ '6.jpg',
+ '7.jpg',
+ '8.jpg',
+ '9.jpg',
+ '10.jpg',
+ ),
+ // sanders art gallery
+ 'sanders' => array(
+ '1.jpg',
+ '2.jpg',
+ '3.jpg',
+ ),
+ // text gifs
+ 'text' => array(
+ 'counting' => 'counting.gif',
+ 'education' => 'education.gif',
+ 'food' => 'food.gif',
+ 'housing' => 'housing.gif',
+ ),
+ // feature films
+ 'videos' => array(
+ 'review' => '2012 - Rap in Review.mp4',
+ 'jedi' => '2015 - The Return of the Holiday Rap: A Jedi\'s Chant.mp4',
+ 'brick' => '2022 - In the Brick of Time.mp4',
+ 'raiders' => '2023 - Raiders of the Golden Brick.mp4',
+ 'wizard' => '2024 - The Wonderful Wizard of RIT.mp4',
+ ),
+ );
+
+ function update_paths(&$data, $path) {
+ foreach ($data as $key => $value) {
+ if (is_array($value)) {
+ update_paths($value, "$path/$key");
+ $data[$key] = $value;
+ } else {
+ $data[$key] = "$path/$value?rev=1";
+ }
+ }
+ $data = (object) $data;
+ }
+ update_paths($assets, 'public');
+ return $assets;
+}
+
+define('ASSETS', __make_assets());
+
+// Helper functions
+
+// Parse request route
+
+function __get_route() {
+ $method = $_SERVER['REQUEST_METHOD'];
+ $uri_str = $_SERVER['REQUEST_URI'];
+ $uri = parse_url($uri_str);
+
+ $path = '/';
+ if ($uri && array_key_exists('path', $uri))
+ $path = $uri['path'];
+
+ return [$method, $path];
+}
+
+define('ROUTE', __get_route());
+
+// Pages
+
+function home() {
+ $css = ASSETS->css->home;
+ include('web/home.php');
+}
+
+function fire() {
+ $css = ASSETS->css->fire;
+ include('web/fire.php');
+}
+
+function gallery() {
+ $css = ASSETS->css->gallery;
+ include('web/gallery.php');
+}
+
+function error($code) {
+ $css = ASSETS->css->error;
+ include('web/error.php');
+}
+
+// Dispatch
+
+try {
+ match (ROUTE) {
+ ['GET', '/'] => home(),
+ ['GET', '/fire'] => fire(),
+ ['GET', '/gallery'] => gallery(),
+ default => error(404)
+ };
+} catch (Throwable $e) {
+ error(500);
+}