feat(reading): clean and refactor routing for books -> reading to separate paths
This commit is contained in:
parent
8d9455940e
commit
d1d107ce36
21 changed files with 42 additions and 88 deletions
|
@ -9,18 +9,12 @@
|
|||
$requestUri = $_SERVER["REQUEST_URI"];
|
||||
$url = trim(parse_url($requestUri, PHP_URL_PATH), "/");
|
||||
|
||||
if (!preg_match('/^watching\/movies\/[\w-]+$/', $url)) {
|
||||
echo file_get_contents(__DIR__ . "/../../404/index.html");
|
||||
exit();
|
||||
}
|
||||
if (!preg_match('/^watching\/movies\/[\w-]+$/', $url)) redirectTo404();
|
||||
|
||||
$fetcher = new MovieFetcher();
|
||||
$movie = $fetcher->fetch($url);
|
||||
|
||||
if (!$movie) {
|
||||
echo file_get_contents(__DIR__ . "/../../404/index.html");
|
||||
exit();
|
||||
}
|
||||
if (!$movie) redirectTo404();
|
||||
|
||||
$movie["description"] = parseMarkdown($movie["description"]);
|
||||
$pageTitle = htmlspecialchars("Movies • " . $movie["title"], ENT_QUOTES, "UTF-8");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue