-
Notifications
You must be signed in to change notification settings - Fork 21
/
Copy path404.php
48 lines (48 loc) · 1.8 KB
/
404.php
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
<?php
include('includes/vars.php');
include("includes/functions.php");
$base_url = get_base_url();
$request = $_SERVER['REQUEST_URI'];
logger::info('REDIRECT','Uri is',$_SERVER['REQUEST_URI']);
// Send temporary redirects for missing images
if (preg_match('#prefs/userstreams/.*\.jpg#', $request) || preg_match('#prefs/userstreams/.*\.png#', $request)) {
$redirect = $base_url.'/newimages/broadcast.svg';
logger::log("404", "Request for missing userstream image. Redirecting to ".$redirect);
http_response_code(307);
header("Location: ".$redirect);
} else if (preg_match('#prefs/podcasts/.*\.jpg#', $request) || preg_match('#prefs/podcasts/.*\.png#', $request)) {
$redirect = $base_url.'/newimages/podcast-logo.svg';
logger::log("404", "Request for missing podcast image. Redirecting to ".$redirect);
http_response_code(307);
header("Location: ".$redirect);
} else if (preg_match('#themes/.*\.js#', $request)) {
logger::trace('404', 'Request for nonexistent theme manager script. This is normal');
http_response_code(204);
} else if (preg_match('#albumart/.*?\.[jpg|png|svg|gif|webp]#', $request)) {
$redirect = $base_url.'/newimages/vinyl_record.svg';
http_response_code(307);
header("Location: ".$redirect);
} else {
http_response_code(404);
?>
<html>
<head>
<link rel="stylesheet" type="text/css" href="css/layout-january.css" />
<link rel="stylesheet" type="text/css" href="themes/Darkness.css" />
<title>Badgers!</title>
</head>
<body>
<br><br><br>
<table align="center"><tr><td><img src="newimages/favicon-196.png"></td></tr></table>
<h2 align="center">404 Error!</h2>
<br><br>
<h2 align="center">It's all gone horribly wrong</h2>
<br><br>
<?php
print '<h3 align="center">The document "'.$request."" doesn't exist. Are you sure you know what you're doing?</h3>";
?>
</body>
</html>
<?php
}
?>