[docker] router.php isn't used any more
This commit is contained in:
parent
cc36f32ffc
commit
21a7912f9b
1 changed files with 0 additions and 36 deletions
|
@ -1,36 +0,0 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Shimmie2;
|
||||
|
||||
// custom routing for stand-alone mode, basically
|
||||
// .htaccess for the built-in php web server
|
||||
if (PHP_SAPI !== 'cli-server') {
|
||||
die('cli only');
|
||||
}
|
||||
|
||||
// warehouse files
|
||||
$matches = [];
|
||||
if (preg_match('/\/_(images|thumbs)\/([0-9a-f]{2})([0-9a-f]{30}).*$/', $_SERVER["REQUEST_URI"], $matches)) {
|
||||
header('Content-Type: image/jpeg');
|
||||
header("Cache-control: public, max-age=86400");
|
||||
print(file_get_contents("data/$matches[1]/$matches[2]/$matches[2]$matches[3]"));
|
||||
return true;
|
||||
}
|
||||
|
||||
// if file exists, serve it as normal
|
||||
elseif (is_file("." . explode("?", $_SERVER["REQUEST_URI"])[0])) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// all other requests (use shimmie routing based on URL)
|
||||
else {
|
||||
unset($matches);
|
||||
// PHP_SELF is very unreliable, but there's no(?) better way to know what
|
||||
// website subdirectory we're installed in - if we're using router.php, then
|
||||
// let's blindly assume that we're in the root directory.
|
||||
$_SERVER["PHP_SELF"] = "/index.php";
|
||||
$_GET['q'] = urldecode(explode("?", $_SERVER["REQUEST_URI"])[0]);
|
||||
require_once "index.php";
|
||||
}
|
Reference in a new issue