1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
|
<?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',
),
);
define('REVS', array(
'main.css' => 2,
));
function update_paths(&$data, $path) {
foreach ($data as $key => $value) {
if (is_array($value)) {
update_paths($value, "$path/$key");
$data[$key] = $value;
} else {
$rev = REVS[$value] ?? 1;
$data[$key] = "{$path}/{$value}?rev={$rev}";
}
}
$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);
}
|