mirror of
https://github.com/standardebooks/web.git
synced 2025-07-05 06:10:36 -04:00
26 lines
577 B
PHP
26 lines
577 B
PHP
<?
|
|
use function Safe\glob;
|
|
use function Safe\preg_replace;
|
|
use function Safe\sort;
|
|
|
|
// Redirect to the latest version of the manual
|
|
|
|
$currentManual = Manual::GetLatestVersion();
|
|
|
|
$url = HttpInput::Str(GET, 'url') ?? '';
|
|
|
|
try{
|
|
$url = preg_replace('|^/|ius', '', $url);
|
|
$url = preg_replace('|\.php$|ius', '', $url);
|
|
$url = preg_replace('|/$|ius', '', $url);
|
|
}
|
|
catch(\Exception){
|
|
Template::ExitWithCode(Enums\HttpCode::NotFound);
|
|
}
|
|
|
|
if($url != ''){
|
|
$url = '/' . $url;
|
|
}
|
|
|
|
http_response_code(Enums\HttpCode::Found->value);
|
|
header('Location: /manual/' . $currentManual . $url);
|