1
0

more dynamic header

This commit is contained in:
2020-01-20 21:13:26 +01:00
parent cf6c496b34
commit 6f90fb912b
13 changed files with 107 additions and 12 deletions

View File

@@ -0,0 +1,21 @@
<?php
require_once (__DIR__ . '/../internals/website.php');
/** @var PageFrameOptions $FRAME_OPTIONS */ global $FRAME_OPTIONS;
/** @var URLRoute $ROUTE */ global $ROUTE;
/** @var Website $SITE */ global $SITE;
?>
<?php
$year = intval($ROUTE->parameter['year']);
$day = intval($ROUTE->parameter['day']);
if ($SITE->modules->AdventOfCode()->getSingleDay($year, $day) === null)
{
$FRAME_OPTIONS->setForced404('Advent of Code not found');
return;
}
$FRAME_OPTIONS->setForcedRedirect($SITE->modules->AdventOfCode()->getSingleDay($year, $day)['url']);
?>

View File

@@ -0,0 +1,32 @@
<?php
require_once (__DIR__ . '/../internals/website.php');
/** @var PageFrameOptions $FRAME_OPTIONS */ global $FRAME_OPTIONS;
/** @var URLRoute $ROUTE */ global $ROUTE;
/** @var Website $SITE */ global $SITE;
?>
<?php
if ($ROUTE->parameter['year'] === '')
{
$year = array_last($SITE->modules->AdventOfCode()->listYears());
$FRAME_OPTIONS->setForcedRedirect($SITE->modules->AdventOfCode()->getURLForYear($year));
return;
}
else
{
$year = intval($ROUTE->parameter['year']);
if (in_array($year, $SITE->modules->AdventOfCode()->listYears()))
{
$FRAME_OPTIONS->setForcedRedirect($SITE->modules->AdventOfCode()->getURLForYear($year));
return;
}
else
{
$FRAME_OPTIONS->setForced404('Advent of Code not found');
return;
}
}
?>

View File

@@ -18,7 +18,7 @@ $FRAME_OPTIONS->canonical_url = $post['canonical'];
if ($post['type'] == 'euler')
$FRAME_OPTIONS->activeHeader = 'euler';
else if ($post['type'] == 'euler' && $post['issubview'])
else if ($post['type'] == 'aoc')
$FRAME_OPTIONS->activeHeader = 'aoc';
else
$FRAME_OPTIONS->activeHeader = 'blog';

View File

@@ -14,7 +14,7 @@ if ($book === null) { $FRAME_OPTIONS->setForced404("Books not found"); return; }
$FRAME_OPTIONS->title = $book['title'];
$FRAME_OPTIONS->canonical_url = $book['url'];
$FRAME_OPTIONS->activeHeader = 'book';
$FRAME_OPTIONS->activeHeader = 'books';
$FRAME_OPTIONS->addScript('/data/javascript/ms_basic.js', true);
?>