PSR-2. I'm not a huge fan, but ugly consistency beats no consistency...

This commit is contained in:
Shish
2019-05-28 17:59:38 +01:00
parent 5ec3e89884
commit 34b05cca7c
295 changed files with 27094 additions and 24632 deletions

View File

@@ -1,19 +1,21 @@
<?php
// custom routing for stand-alone mode
if(PHP_SAPI !== 'cli-server') die('cli only');
if (PHP_SAPI !== 'cli-server') {
die('cli only');
}
// warehouse files
$matches = array();
if(preg_match('/\/_(images|thumbs)\/([0-9a-f]{32}).*$/', $_SERVER["REQUEST_URI"], $matches)) {
header('Content-Type: image/jpeg');
print(file_get_contents(warehouse_path($matches[1], $matches[2])));
return true;
$matches = [];
if (preg_match('/\/_(images|thumbs)\/([0-9a-f]{32}).*$/', $_SERVER["REQUEST_URI"], $matches)) {
header('Content-Type: image/jpeg');
print(file_get_contents(warehouse_path($matches[1], $matches[2])));
return true;
}
unset($matches);
// use the default handler (serve static files, interpret php files)
if(preg_match('/\.(?:png|jpg|jpeg|gif|css|js|php)(\?.*)?$/', $_SERVER["REQUEST_URI"])) {
return false;
if (preg_match('/\.(?:png|jpg|jpeg|gif|css|js|php)(\?.*)?$/', $_SERVER["REQUEST_URI"])) {
return false;
}
// all other requests (use shimmie routing based on URL)