ndex route works again
This commit is contained in:
parent
f9a692e635
commit
588e9b089a
@ -1900,6 +1900,7 @@ html, body {
|
|||||||
/* 400px */
|
/* 400px */
|
||||||
.ev_master {
|
.ev_master {
|
||||||
align-self: center;
|
align-self: center;
|
||||||
|
width: 100%;
|
||||||
}
|
}
|
||||||
@media (min-width: 851px) {
|
@media (min-width: 851px) {
|
||||||
.ev_master {
|
.ev_master {
|
||||||
@ -1918,6 +1919,15 @@ html, body {
|
|||||||
text-align: center;
|
text-align: center;
|
||||||
font-size: 25pt;
|
font-size: 25pt;
|
||||||
}
|
}
|
||||||
|
.ev_master .ev_statusmore {
|
||||||
|
color: #333333;
|
||||||
|
background-color: #BBBBBB;
|
||||||
|
text-align: left;
|
||||||
|
padding: 4px;
|
||||||
|
overflow-x: auto;
|
||||||
|
white-space: nowrap;
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
@media (max-width: 767px) {
|
@media (max-width: 767px) {
|
||||||
.ev_master .ev_code {
|
.ev_master .ev_code {
|
||||||
font-size: 75pt;
|
font-size: 75pt;
|
||||||
|
3
www/data/css/styles.min.css
vendored
3
www/data/css/styles.min.css
vendored
@ -360,10 +360,11 @@ html,body{margin:0;padding:0;height:100%}
|
|||||||
.wle_date{border-bottom:1px solid transparent;padding:2px;font-size:.8em;font-style:italic}
|
.wle_date{border-bottom:1px solid transparent;padding:2px;font-size:.8em;font-style:italic}
|
||||||
.wle_title{font-weight:bold;font-size:1.2em;text-align:left;margin:2px 0 2px 10px}
|
.wle_title{font-weight:bold;font-size:1.2em;text-align:left;margin:2px 0 2px 10px}
|
||||||
@media(max-width:767px){.wle_title{font-size:1.25em}}
|
@media(max-width:767px){.wle_title{font-size:1.25em}}
|
||||||
.ev_master{align-self:center}
|
.ev_master{align-self:center;width:100%}
|
||||||
@media(min-width:851px){.ev_master{padding-bottom:80px}}
|
@media(min-width:851px){.ev_master{padding-bottom:80px}}
|
||||||
.ev_master .ev_code{color:#333;text-align:center;font-size:150pt;font-weight:500;font-family:Consolas,Monaco,"Courier New",Menlo,monospace}
|
.ev_master .ev_code{color:#333;text-align:center;font-size:150pt;font-weight:500;font-family:Consolas,Monaco,"Courier New",Menlo,monospace}
|
||||||
.ev_master .ev_msg{color:#888;text-align:center;font-size:25pt}
|
.ev_master .ev_msg{color:#888;text-align:center;font-size:25pt}
|
||||||
|
.ev_master .ev_statusmore{color:#333;background-color:#bbb;text-align:left;padding:4px;overflow-x:auto;white-space:nowrap;width:100%}
|
||||||
@media(max-width:767px){
|
@media(max-width:767px){
|
||||||
.ev_master .ev_code{font-size:75pt}
|
.ev_master .ev_code{font-size:75pt}
|
||||||
.ev_master .ev_msg{font-size:15pt}
|
.ev_master .ev_msg{font-size:15pt}
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
.ev_master {
|
.ev_master {
|
||||||
|
|
||||||
align-self: center;
|
align-self: center;
|
||||||
|
width: 100%;
|
||||||
|
|
||||||
@include rdmedia_range(2,4) {padding-bottom: 80px;}
|
@include rdmedia_range(2,4) {padding-bottom: 80px;}
|
||||||
|
|
||||||
@ -20,6 +21,18 @@
|
|||||||
font-size: 25pt;
|
font-size: 25pt;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.ev_statusmore {
|
||||||
|
color: $LAYER1_FG;
|
||||||
|
background-color: $LAYER1_BG_DARKER;
|
||||||
|
text-align: left;
|
||||||
|
padding: 4px;
|
||||||
|
|
||||||
|
overflow-x: auto;
|
||||||
|
white-space: nowrap;
|
||||||
|
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
@include rdmedia(0) {
|
@include rdmedia(0) {
|
||||||
.ev_code { font-size: 75pt; }
|
.ev_code { font-size: 75pt; }
|
||||||
.ev_msg { font-size: 15pt; }
|
.ev_msg { font-size: 15pt; }
|
||||||
|
@ -1,22 +1,28 @@
|
|||||||
<?php
|
<?php
|
||||||
require_once(__DIR__ . '/../internals/adventofcode.php');
|
require_once (__DIR__ . '/../internals/website.php');
|
||||||
|
|
||||||
$years = AdventOfCode::listYears();
|
/** @var PageFrameOptions $FRAME_OPTIONS */ global $FRAME_OPTIONS;
|
||||||
$year = end($years);
|
/** @var URLRoute $ROUTE */ global $ROUTE;
|
||||||
|
/** @var Website $SITE */ global $SITE;
|
||||||
|
|
||||||
|
global $FRAGMENT_PARAM;
|
||||||
|
/** @var array $parameter */
|
||||||
|
$parameter = $FRAGMENT_PARAM;
|
||||||
|
?>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
$years = $SITE->modules->AdventOfCode()->listYears();
|
||||||
|
$year = intval(end($years));
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<div class="index_pnl_base">
|
<div class="index_pnl_base">
|
||||||
|
|
||||||
<div class="index_pnl_header">
|
<div class="index_pnl_header">
|
||||||
<a href="<?php echo AdventOfCode::getURLForYear($year); ?>">Advent of Code</a>
|
<a href="<?php echo $SITE->modules->AdventOfCode()->getURLForYear($year); ?>">Advent of Code</a>
|
||||||
</div>
|
</div>
|
||||||
<div class="index_pnl_content">
|
<div class="index_pnl_content">
|
||||||
|
|
||||||
<?php
|
<?php $SITE->fragments->PanelAdventOfCodeCalendar($year, true, true, true); ?>
|
||||||
global $PARAM_AOCCALENDAR;
|
|
||||||
$PARAM_AOCCALENDAR = ['year' => $year, 'nav'=>true, 'linkheader'=>true, 'ajax'=>true];
|
|
||||||
require (__DIR__ . '/../fragments/panel_aoc_calendar.php')
|
|
||||||
?>
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -1,19 +1,30 @@
|
|||||||
<?php
|
<?php
|
||||||
|
require_once (__DIR__ . '/../internals/website.php');
|
||||||
|
|
||||||
global $PARAM_AOCCALENDAR;
|
/** @var PageFrameOptions $FRAME_OPTIONS */ global $FRAME_OPTIONS;
|
||||||
|
/** @var URLRoute $ROUTE */ global $ROUTE;
|
||||||
|
/** @var Website $SITE */ global $SITE;
|
||||||
|
|
||||||
$year = $PARAM_AOCCALENDAR['year'];
|
global $FRAGMENT_PARAM;
|
||||||
$shownav = $PARAM_AOCCALENDAR['nav'];
|
/** @var array $parameter */
|
||||||
$linkheader = $PARAM_AOCCALENDAR['linkheader'];
|
$parameter = $FRAGMENT_PARAM;
|
||||||
$ajax = $PARAM_AOCCALENDAR['ajax'];
|
?>
|
||||||
$frame = isset($PARAM_AOCCALENDAR['frame']) ? $PARAM_AOCCALENDAR['frame'] : true;
|
|
||||||
$frameid = isset($PARAM_AOCCALENDAR['frameid']) ? $PARAM_AOCCALENDAR['frameid'] : ('aoc_frame_' . getRandomToken(16));
|
|
||||||
|
|
||||||
$assocdays = AdventOfCode::listSingleYearAssociative($year);
|
<?php
|
||||||
$prev_year = $shownav ? AdventOfCode::getPrevYear($year) : null;
|
$year = $parameter['year'];
|
||||||
$next_year = $shownav ? AdventOfCode::getNextYear($year) : null;
|
$shownav = $parameter['nav'];
|
||||||
|
$linkheader = $parameter['linkheader'];
|
||||||
|
$ajax = $parameter['ajax'];
|
||||||
|
$frame = $parameter['frame'];
|
||||||
|
$frameid = $parameter['frameid'];
|
||||||
|
|
||||||
if ($ajax) includeAdditionalScript("/data/javascript/aoc_panel_interactive.js", 'defer', true);
|
$AOC = $SITE->modules->AdventOfCode();
|
||||||
|
|
||||||
|
$assocdays = $AOC->listSingleYearAssociative($year);
|
||||||
|
$prev_year = $shownav ? $AOC->getPrevYear($year) : null;
|
||||||
|
$next_year = $shownav ? $AOC->getNextYear($year) : null;
|
||||||
|
|
||||||
|
if ($ajax) $FRAME_OPTIONS->addScript("/data/javascript/aoc_panel_interactive.js", true);
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
||||||
@ -26,14 +37,14 @@ if ($ajax) includeAdditionalScript("/data/javascript/aoc_panel_interactive.js",
|
|||||||
if ($ajax)
|
if ($ajax)
|
||||||
echo '<a href="javascript:void();" onclick="javascript:changeAOCPanel(' . $prev_year . ', ' . ($shownav?'true':'false') . ', ' . ($linkheader?'true':'false') . ', ' . ($ajax?'true':'false') . ', \'' . $frameid . '\')" class="aoc_calendar_header_link aoc_prev" ><</a>';
|
echo '<a href="javascript:void();" onclick="javascript:changeAOCPanel(' . $prev_year . ', ' . ($shownav?'true':'false') . ', ' . ($linkheader?'true':'false') . ', ' . ($ajax?'true':'false') . ', \'' . $frameid . '\')" class="aoc_calendar_header_link aoc_prev" ><</a>';
|
||||||
else
|
else
|
||||||
echo '<a href="' . AdventOfCode::getURLForYear($prev_year) . '" class="aoc_calendar_header_link aoc_prev" ><</a>';
|
echo '<a href="' . $AOC->getURLForYear($prev_year) . '" class="aoc_calendar_header_link aoc_prev" ><</a>';
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
echo '<a href="#" class="aoc_calendar_header_link aoc_prev aoc_link_hidden" ><</a>';
|
echo '<a href="#" class="aoc_calendar_header_link aoc_prev aoc_link_hidden" ><</a>';
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($linkheader) echo '<span class="aoc_calendar_header_title"><a href="' . AdventOfCode::getURLForYear($year) . '">'.$year.'</a></span>';
|
if ($linkheader) echo '<span class="aoc_calendar_header_title"><a href="' . $AOC->getURLForYear($year) . '">'.$year.'</a></span>';
|
||||||
else echo '<span class="aoc_calendar_header_title">'.$year.'</span>';
|
else echo '<span class="aoc_calendar_header_title">'.$year.'</span>';
|
||||||
|
|
||||||
if ($next_year !== null)
|
if ($next_year !== null)
|
||||||
@ -41,7 +52,7 @@ if ($ajax) includeAdditionalScript("/data/javascript/aoc_panel_interactive.js",
|
|||||||
if ($ajax)
|
if ($ajax)
|
||||||
echo '<a href="javascript:void();" onclick="javascript:changeAOCPanel(' . $next_year . ', ' . ($shownav?'true':'false') . ', ' . ($linkheader?'true':'false') . ', ' . ($ajax?'true':'false') . ', \'' . $frameid . '\')" class="aoc_calendar_header_link aoc_next" >></a>';
|
echo '<a href="javascript:void();" onclick="javascript:changeAOCPanel(' . $next_year . ', ' . ($shownav?'true':'false') . ', ' . ($linkheader?'true':'false') . ', ' . ($ajax?'true':'false') . ', \'' . $frameid . '\')" class="aoc_calendar_header_link aoc_next" >></a>';
|
||||||
else
|
else
|
||||||
echo '<a href="' . AdventOfCode::getURLForYear($next_year) . '" class="aoc_calendar_header_link aoc_next" >></a>';
|
echo '<a href="' . $AOC->getURLForYear($next_year) . '" class="aoc_calendar_header_link aoc_next" >></a>';
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -1,7 +1,19 @@
|
|||||||
<?php
|
<?php
|
||||||
require_once(__DIR__ . '/../internals/blog.php');
|
require_once (__DIR__ . '/../internals/website.php');
|
||||||
|
|
||||||
$allposts = Blog::listAllNewestFirst();
|
/** @var PageFrameOptions $FRAME_OPTIONS */ global $FRAME_OPTIONS;
|
||||||
|
/** @var URLRoute $ROUTE */ global $ROUTE;
|
||||||
|
/** @var Website $SITE */ global $SITE;
|
||||||
|
|
||||||
|
global $FRAGMENT_PARAM;
|
||||||
|
/** @var array $parameter */
|
||||||
|
$parameter = $FRAGMENT_PARAM;
|
||||||
|
?>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
$BLOG = $SITE->modules->Blog();
|
||||||
|
|
||||||
|
$allposts = $BLOG->listAllNewestFirst();
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<div class="index_pnl_base">
|
<div class="index_pnl_base">
|
||||||
|
@ -1,7 +1,19 @@
|
|||||||
<?php
|
<?php
|
||||||
require_once(__DIR__ . '/../internals/books.php');
|
require_once (__DIR__ . '/../internals/website.php');
|
||||||
|
|
||||||
$allbooks = Books::listAllNewestFirst();
|
/** @var PageFrameOptions $FRAME_OPTIONS */ global $FRAME_OPTIONS;
|
||||||
|
/** @var URLRoute $ROUTE */ global $ROUTE;
|
||||||
|
/** @var Website $SITE */ global $SITE;
|
||||||
|
|
||||||
|
global $FRAGMENT_PARAM;
|
||||||
|
/** @var array $parameter */
|
||||||
|
$parameter = $FRAGMENT_PARAM;
|
||||||
|
?>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
$BOOKS = $SITE->modules->Books();
|
||||||
|
|
||||||
|
$allbooks = $BOOKS->listAllNewestFirst();
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<div class="index_pnl_base">
|
<div class="index_pnl_base">
|
||||||
|
@ -1,7 +1,19 @@
|
|||||||
<?php
|
<?php
|
||||||
require_once(__DIR__ . '/../internals/euler.php');
|
require_once (__DIR__ . '/../internals/website.php');
|
||||||
|
|
||||||
$euler = Euler::listAll();
|
/** @var PageFrameOptions $FRAME_OPTIONS */ global $FRAME_OPTIONS;
|
||||||
|
/** @var URLRoute $ROUTE */ global $ROUTE;
|
||||||
|
/** @var Website $SITE */ global $SITE;
|
||||||
|
|
||||||
|
global $FRAGMENT_PARAM;
|
||||||
|
/** @var array $parameter */
|
||||||
|
$parameter = $FRAGMENT_PARAM;
|
||||||
|
?>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
$EULER = $SITE->modules->Euler();
|
||||||
|
|
||||||
|
$data = $EULER->listAll();
|
||||||
|
|
||||||
$RATING_CLASSES = ['euler_pnl_celltime_perfect', 'euler_pnl_celltime_good', 'euler_pnl_celltime_ok', 'euler_pnl_celltime_bad', 'euler_pnl_celltime_fail'];
|
$RATING_CLASSES = ['euler_pnl_celltime_perfect', 'euler_pnl_celltime_good', 'euler_pnl_celltime_ok', 'euler_pnl_celltime_bad', 'euler_pnl_celltime_fail'];
|
||||||
?>
|
?>
|
||||||
@ -18,7 +30,7 @@
|
|||||||
$arr = [];
|
$arr = [];
|
||||||
|
|
||||||
$max = 0;
|
$max = 0;
|
||||||
foreach ($euler as $problem)
|
foreach ($data as $problem)
|
||||||
{
|
{
|
||||||
$max = max($max, $problem['number']);
|
$max = max($max, $problem['number']);
|
||||||
$arr[$problem['number']] = $problem;
|
$arr[$problem['number']] = $problem;
|
||||||
|
@ -1,7 +1,19 @@
|
|||||||
<?php
|
<?php
|
||||||
require_once(__DIR__ . '/../internals/programs.php');
|
require_once (__DIR__ . '/../internals/website.php');
|
||||||
|
|
||||||
$allprograms = Programs::listAllNewestFirst();
|
/** @var PageFrameOptions $FRAME_OPTIONS */ global $FRAME_OPTIONS;
|
||||||
|
/** @var URLRoute $ROUTE */ global $ROUTE;
|
||||||
|
/** @var Website $SITE */ global $SITE;
|
||||||
|
|
||||||
|
global $FRAGMENT_PARAM;
|
||||||
|
/** @var array $parameter */
|
||||||
|
$parameter = $FRAGMENT_PARAM;
|
||||||
|
?>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
$PROGRAMS = $SITE->modules->Programs();
|
||||||
|
|
||||||
|
$allprograms = $PROGRAMS->listAllNewestFirst();
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<div class="index_pnl_base">
|
<div class="index_pnl_base">
|
||||||
|
@ -20,7 +20,7 @@ require_once (__DIR__ . '/../internals/website.php');
|
|||||||
foreach ($FRAME_OPTIONS->stylesheets as $cssfile) echo '<link rel="stylesheet" href="' . $cssfile . '"/>';
|
foreach ($FRAME_OPTIONS->stylesheets as $cssfile) echo '<link rel="stylesheet" href="' . $cssfile . '"/>';
|
||||||
foreach ($FRAME_OPTIONS->scripts as $scriptfile)
|
foreach ($FRAME_OPTIONS->scripts as $scriptfile)
|
||||||
{
|
{
|
||||||
if ($scriptfile[1]) echo '<script src="' . $scriptfile[0] . '" defer/>';
|
if ($scriptfile[1]) echo '<script src="' . $scriptfile[0] . '" defer></script>';
|
||||||
else echo '<script src="' . $scriptfile[0] . '" type="text/javascript" ></script>';
|
else echo '<script src="' . $scriptfile[0] . '" type="text/javascript" ></script>';
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
52
www/frames/error_frame.php
Normal file
52
www/frames/error_frame.php
Normal file
@ -0,0 +1,52 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
|
||||||
|
require_once (__DIR__ . '/../internals/website.php');
|
||||||
|
|
||||||
|
/** @var PageFrameOptions $FRAME_OPTIONS */ global $FRAME_OPTIONS;
|
||||||
|
/** @var URLRoute $ROUTE */ global $ROUTE;
|
||||||
|
/** @var Website $SITE */ global $SITE;
|
||||||
|
?>
|
||||||
|
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<title><?php echo $FRAME_OPTIONS->title; ?></title>
|
||||||
|
<meta name="google-site-verification" content="pZOhmjeJcQbRMNa8xRLam4dwJ2oYwMwISY1lRKreSSs"/>
|
||||||
|
<link rel="icon" type="image/png" href="/data/images/favicon.png"/>
|
||||||
|
<link rel="stylesheet" href="/data/css/styles.css" />
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div id="mastercontainer">
|
||||||
|
|
||||||
|
<div id="headerdiv">
|
||||||
|
<div class="logowrapper">
|
||||||
|
<a href="/"><img class="logo" src="/data/images/logo.png" alt="Mikescher.com Logo" /></a>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="tabrow">
|
||||||
|
<a class="tab" href="/">Home</a>
|
||||||
|
<a class="tab" href="/blog/1/Project_Euler_with_Befunge">Project Euler</a>
|
||||||
|
<a class="tab" href="/blog">Blog</a>
|
||||||
|
<a class="tab" href="/programs">Programs</a>
|
||||||
|
<a class="tab" href="/webapps">Tools</a>
|
||||||
|
<a class="tab" href="/about">About</a>
|
||||||
|
<div class="tab_split" ></div>
|
||||||
|
<a class="tab tab_github" href="https://github.com/Mikescher/">Github</a>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div id="content" class="<?php echo join(' ', $FRAME_OPTIONS->contentCSSClasses); ?>">
|
||||||
|
<?php echo $FRAME_OPTIONS->raw; ?>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div id="footerdiv" class="content-responsive">
|
||||||
|
<hr />
|
||||||
|
made with vanilla PHP and MySQL<span class="footerspan2">, no frameworks, no bootstrap, no unnecessary* javascript</span>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
@ -1,34 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
require_once 'website.php';
|
|
||||||
|
|
||||||
class AlephNoteStatistics
|
|
||||||
{
|
|
||||||
/** @var Website */
|
|
||||||
private $site;
|
|
||||||
|
|
||||||
public function __construct(Website $site)
|
|
||||||
{
|
|
||||||
$this->site = $site;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getTotalUserCount()
|
|
||||||
{
|
|
||||||
return $this->site->Database()->sql_query_num('SELECT COUNT(*) FROM an_statslog WHERE NoteCount>0');
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getUserCountFromLastVersion()
|
|
||||||
{
|
|
||||||
return $this->site->Database()->sql_query_num('SELECT COUNT(*) FROM an_statslog WHERE NoteCount>0 GROUP BY Version ORDER BY INET_ATON(Version) DESC LIMIT 1');
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getActiveUserCount($days)
|
|
||||||
{
|
|
||||||
return $this->site->Database()->sql_query_num('SELECT COUNT(*) FROM an_statslog WHERE NoteCount>0 AND LastChanged > NOW() - INTERVAL '.$days.' DAY');
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getAllActiveEntriesOrdered()
|
|
||||||
{
|
|
||||||
return $this->site->Database()->sql_query_assoc('SELECT * FROM an_statslog WHERE NoteCount>0 ORDER BY LastChanged DESC');
|
|
||||||
}
|
|
||||||
}
|
|
48
www/internals/fragments.php
Normal file
48
www/internals/fragments.php
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
class Fragments
|
||||||
|
{
|
||||||
|
public function PanelEuler()
|
||||||
|
{
|
||||||
|
global $FRAGMENT_PARAM;
|
||||||
|
$FRAGMENT_PARAM = [ ];
|
||||||
|
include (__DIR__ . '/../fragments/panel_euler.php');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function PanelPrograms()
|
||||||
|
{
|
||||||
|
global $FRAGMENT_PARAM;
|
||||||
|
$FRAGMENT_PARAM = [ ];
|
||||||
|
include (__DIR__ . '/../fragments/panel_programs.php');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function PanelBlog()
|
||||||
|
{
|
||||||
|
global $FRAGMENT_PARAM;
|
||||||
|
$FRAGMENT_PARAM = [ ];
|
||||||
|
include (__DIR__ . '/../fragments/panel_blog.php');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function PanelBooks()
|
||||||
|
{
|
||||||
|
global $FRAGMENT_PARAM;
|
||||||
|
$FRAGMENT_PARAM = [ ];
|
||||||
|
include (__DIR__ . '/../fragments/panel_books.php');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function PanelAdventOfCode()
|
||||||
|
{
|
||||||
|
global $FRAGMENT_PARAM;
|
||||||
|
$FRAGMENT_PARAM = [ ];
|
||||||
|
include (__DIR__ . '/../fragments/panel_aoc.php');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function PanelAdventOfCodeCalendar(int $year, bool $shownav, bool $linkheader, bool $ajax, bool $frame=true, $frameid=null)
|
||||||
|
{
|
||||||
|
if ($frameid == null) $frameid = 'aoc_frame_' . getRandomToken(16);
|
||||||
|
|
||||||
|
global $FRAGMENT_PARAM;
|
||||||
|
$FRAGMENT_PARAM = [ 'year' => $year, 'nav'=>$shownav, 'linkheader'=>$linkheader, 'ajax'=>$ajax, 'frame'=>$frame, 'frameid'=>$frameid ];
|
||||||
|
include (__DIR__ . '/../fragments/panel_aoc_calendar.php');
|
||||||
|
}
|
||||||
|
}
|
86
www/internals/modules.php
Normal file
86
www/internals/modules.php
Normal file
@ -0,0 +1,86 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
require_once 'website.php';
|
||||||
|
|
||||||
|
class Modules
|
||||||
|
{
|
||||||
|
/** @var Database|null */ private $database = null;
|
||||||
|
/** @var AdventOfCode|null */ private $adventOfCode = null;
|
||||||
|
/** @var Blog|null */ private $blog = null;
|
||||||
|
/** @var Books|null */ private $books = null;
|
||||||
|
/** @var Euler|null */ private $euler = null;
|
||||||
|
/** @var Programs|null */ private $programs = null;
|
||||||
|
/** @var AlephNoteStatistics|null */ private $anstats = null;
|
||||||
|
/** @var UpdatesLog|null */ private $updateslog = null;
|
||||||
|
/** @var WebApps|null */ private $webapps = null;
|
||||||
|
/** @var MikescherGitGraph|null */ private $extendedgitgraph = null;
|
||||||
|
|
||||||
|
/** @var Website */
|
||||||
|
private $site;
|
||||||
|
|
||||||
|
public function __construct(Website $site)
|
||||||
|
{
|
||||||
|
$this->site = $site;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function Database()
|
||||||
|
{
|
||||||
|
if ($this->database === null) { require_once 'modules/database.php'; $this->database = new Database($this->site); }
|
||||||
|
return $this->database;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function AdventOfCode(): AdventOfCode
|
||||||
|
{
|
||||||
|
if ($this->adventOfCode === null) { require_once 'modules/adventofcode.php'; $this->adventOfCode = new AdventOfCode(); }
|
||||||
|
return $this->adventOfCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function Blog(): Blog
|
||||||
|
{
|
||||||
|
if ($this->blog === null) { require_once 'modules/blog.php'; $this->blog = new Blog(); }
|
||||||
|
return $this->blog;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function Books(): Books
|
||||||
|
{
|
||||||
|
if ($this->books === null) { require_once 'modules/books.php'; $this->books = new Books(); }
|
||||||
|
return $this->books;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function Euler(): Euler
|
||||||
|
{
|
||||||
|
if ($this->euler === null) { require_once 'modules/euler.php'; $this->euler = new Euler(); }
|
||||||
|
return $this->euler;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function Programs(): Programs
|
||||||
|
{
|
||||||
|
if ($this->programs === null) { require_once 'modules/programs.php'; $this->programs = new Programs(); }
|
||||||
|
return $this->programs;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function AlephNoteStatistics(): AlephNoteStatistics
|
||||||
|
{
|
||||||
|
if ($this->anstats === null) { require_once 'modules/alephnoteStatistics.php'; $this->anstats = new AlephNoteStatistics($this->site); }
|
||||||
|
return $this->anstats;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function UpdatesLog(): UpdatesLog
|
||||||
|
{
|
||||||
|
if ($this->updateslog === null) { require_once 'modules/updateslog.php'; $this->updateslog = new UpdatesLog($this->site); }
|
||||||
|
return $this->updateslog;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function WebApps(): WebApps
|
||||||
|
{
|
||||||
|
if ($this->webapps === null) { require_once 'modules/webapps.php'; $this->webapps = new WebApps(); }
|
||||||
|
return $this->webapps;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function ExtendedGitGraph(): MikescherGitGraph
|
||||||
|
{
|
||||||
|
if ($this->extendedgitgraph === null) { require_once 'modules/mikeschergitgraph.php'; $this->extendedgitgraph = new MikescherGitGraph($this->site); }
|
||||||
|
return $this->extendedgitgraph;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -1,7 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
require_once 'website.php';
|
|
||||||
|
|
||||||
class AdventOfCode
|
class AdventOfCode
|
||||||
{
|
{
|
||||||
const YEARS =
|
const YEARS =
|
||||||
@ -35,7 +33,7 @@ class AdventOfCode
|
|||||||
|
|
||||||
private function load()
|
private function load()
|
||||||
{
|
{
|
||||||
$all = require (__DIR__ . '/../statics/aoc/__all.php');
|
$all = require (__DIR__ . '/../../statics/aoc/__all.php');
|
||||||
|
|
||||||
array_walk($all, function(&$value, $year) { array_walk($value, function (&$innervalue) use ($year) { $innervalue = self::readSingle($year, $innervalue); }); });
|
array_walk($all, function(&$value, $year) { array_walk($value, function (&$innervalue) use ($year) { $innervalue = self::readSingle($year, $innervalue); }); });
|
||||||
|
|
32
www/internals/modules/alephnoteStatistics.php
Normal file
32
www/internals/modules/alephnoteStatistics.php
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
class AlephNoteStatistics
|
||||||
|
{
|
||||||
|
/** @var Website */
|
||||||
|
private $site;
|
||||||
|
|
||||||
|
public function __construct(Website $site)
|
||||||
|
{
|
||||||
|
$this->site = $site;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getTotalUserCount()
|
||||||
|
{
|
||||||
|
return $this->site->modules->Database()->sql_query_num('SELECT COUNT(*) FROM an_statslog WHERE NoteCount>0');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getUserCountFromLastVersion()
|
||||||
|
{
|
||||||
|
return $this->site->modules->Database()->sql_query_num('SELECT COUNT(*) FROM an_statslog WHERE NoteCount>0 GROUP BY Version ORDER BY INET_ATON(Version) DESC LIMIT 1');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getActiveUserCount($days)
|
||||||
|
{
|
||||||
|
return $this->site->modules->Database()->sql_query_num('SELECT COUNT(*) FROM an_statslog WHERE NoteCount>0 AND LastChanged > NOW() - INTERVAL '.$days.' DAY');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getAllActiveEntriesOrdered()
|
||||||
|
{
|
||||||
|
return $this->site->modules->Database()->sql_query_assoc('SELECT * FROM an_statslog WHERE NoteCount>0 ORDER BY LastChanged DESC');
|
||||||
|
}
|
||||||
|
}
|
@ -1,7 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
require_once 'website.php';
|
|
||||||
|
|
||||||
class Blog
|
class Blog
|
||||||
{
|
{
|
||||||
/** @var array */
|
/** @var array */
|
||||||
@ -14,7 +12,7 @@ class Blog
|
|||||||
|
|
||||||
private function load()
|
private function load()
|
||||||
{
|
{
|
||||||
$all = require (__DIR__ . '/../statics/blog/__all.php');
|
$all = require (__DIR__ . '/../../statics/blog/__all.php');
|
||||||
|
|
||||||
$this->staticData = array_map(function($a){return self::readSingle($a);}, $all);
|
$this->staticData = array_map(function($a){return self::readSingle($a);}, $all);
|
||||||
}
|
}
|
||||||
@ -66,8 +64,7 @@ class Blog
|
|||||||
$eulerproblem = null;
|
$eulerproblem = null;
|
||||||
if ($isSubEuler)
|
if ($isSubEuler)
|
||||||
{
|
{
|
||||||
require_once(__DIR__ . '/../internals/euler.php');
|
$eulerproblem = Website::inst()->modules->Euler()->getEulerProblemFromStrIdent($subview);
|
||||||
$eulerproblem = Website::inst()->Euler()->getEulerProblemFromStrIdent($subview);
|
|
||||||
if ($eulerproblem === null) { $error="Project Euler entry not found"; return null; }
|
if ($eulerproblem === null) { $error="Project Euler entry not found"; return null; }
|
||||||
$post['submodel'] = $eulerproblem;
|
$post['submodel'] = $eulerproblem;
|
||||||
$post['issubview'] = true;
|
$post['issubview'] = true;
|
||||||
@ -77,8 +74,7 @@ class Blog
|
|||||||
$adventofcodeday = null;
|
$adventofcodeday = null;
|
||||||
if ($isSubAdventOfCode)
|
if ($isSubAdventOfCode)
|
||||||
{
|
{
|
||||||
require_once(__DIR__ . '/../internals/adventofcode.php');
|
$adventofcodeday = Website::inst()->modules->AdventOfCode()->getDayFromStrIdent($post['extras']['aoc:year'], $subview);
|
||||||
$adventofcodeday = Website::inst()->AdventOfCode()->getDayFromStrIdent($post['extras']['aoc:year'], $subview);
|
|
||||||
if ($adventofcodeday === null) { $error="AdventOfCode entry not found"; return null; }
|
if ($adventofcodeday === null) { $error="AdventOfCode entry not found"; return null; }
|
||||||
$post['submodel'] = $adventofcodeday;
|
$post['submodel'] = $adventofcodeday;
|
||||||
$post['issubview'] = true;
|
$post['issubview'] = true;
|
@ -1,7 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
require_once 'website.php';
|
|
||||||
|
|
||||||
class Books
|
class Books
|
||||||
{
|
{
|
||||||
/** @var array */
|
/** @var array */
|
||||||
@ -14,7 +12,7 @@ class Books
|
|||||||
|
|
||||||
private function load()
|
private function load()
|
||||||
{
|
{
|
||||||
$all = require (__DIR__ . '/../statics/books/__all.php');
|
$all = require (__DIR__ . '/../../statics/books/__all.php');
|
||||||
|
|
||||||
$this->staticData = array_map(function($a){return self::readSingle($a);}, $all);
|
$this->staticData = array_map(function($a){return self::readSingle($a);}, $all);
|
||||||
}
|
}
|
@ -1,7 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
require_once 'website.php';
|
|
||||||
|
|
||||||
class Database
|
class Database
|
||||||
{
|
{
|
||||||
/* @var PDO $pdo */
|
/* @var PDO $pdo */
|
@ -1,7 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
require_once 'website.php';
|
|
||||||
|
|
||||||
class Euler
|
class Euler
|
||||||
{
|
{
|
||||||
/** @var array */
|
/** @var array */
|
||||||
@ -14,7 +12,7 @@ class Euler
|
|||||||
|
|
||||||
private function load()
|
private function load()
|
||||||
{
|
{
|
||||||
$all = require (__DIR__ . '/../statics/euler/__all.php');
|
$all = require (__DIR__ . '/../../statics/euler/__all.php');
|
||||||
|
|
||||||
$this->staticData = array_map(function($a){return self::readSingle($a);}, $all);
|
$this->staticData = array_map(function($a){return self::readSingle($a);}, $all);
|
||||||
}
|
}
|
@ -1,7 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
require_once 'website.php';
|
require_once (__DIR__ . '/../../extern/egg/ExtendedGitGraph2.php');
|
||||||
require_once (__DIR__ . '/../extern/egg/ExtendedGitGraph2.php');
|
|
||||||
|
|
||||||
class MikescherGitGraph
|
class MikescherGitGraph
|
||||||
{
|
{
|
||||||
@ -16,7 +15,7 @@ class MikescherGitGraph
|
|||||||
|
|
||||||
public function getPathRenderedData()
|
public function getPathRenderedData()
|
||||||
{
|
{
|
||||||
return __DIR__ . '/../dynamic/egg/cache_fullrenderer.html';
|
return __DIR__ . '/../../dynamic/egg/cache_fullrenderer.html';
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
@ -1,7 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
require_once 'website.php';
|
|
||||||
|
|
||||||
class Programs
|
class Programs
|
||||||
{
|
{
|
||||||
const PROG_LANGS = [ 'Java', 'C#', 'Delphi', 'PHP', 'C++' ];
|
const PROG_LANGS = [ 'Java', 'C#', 'Delphi', 'PHP', 'C++' ];
|
||||||
@ -43,7 +41,7 @@ class Programs
|
|||||||
|
|
||||||
private function load()
|
private function load()
|
||||||
{
|
{
|
||||||
$all = require (__DIR__ . '/../statics/programs/__all.php');
|
$all = require (__DIR__ . '/../../statics/programs/__all.php');
|
||||||
|
|
||||||
$this->staticData = array_map(function($a){return self::readSingle($a);}, $all);
|
$this->staticData = array_map(function($a){return self::readSingle($a);}, $all);
|
||||||
}
|
}
|
||||||
@ -197,7 +195,7 @@ class Programs
|
|||||||
|
|
||||||
public function getDirectDownloadPath($prog)
|
public function getDirectDownloadPath($prog)
|
||||||
{
|
{
|
||||||
return (__DIR__ . '/../data/binaries/'.$prog['internal_name'].'.zip');
|
return (__DIR__ . '/../../data/binaries/'.$prog['internal_name'].'.zip');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function checkConsistency()
|
public function checkConsistency()
|
@ -1,7 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
require_once (__DIR__ . '/../internals/database.php');
|
|
||||||
|
|
||||||
class UpdatesLog
|
class UpdatesLog
|
||||||
{
|
{
|
||||||
/** @var Website */
|
/** @var Website */
|
||||||
@ -18,7 +16,7 @@ class UpdatesLog
|
|||||||
|
|
||||||
private function load()
|
private function load()
|
||||||
{
|
{
|
||||||
$all = require (__DIR__ . '/../statics/blog/__all.php');
|
$all = require (__DIR__ . '/../../statics/blog/__all.php');
|
||||||
|
|
||||||
$this->staticData = array_map(function($a){return self::readSingle($a);}, $all);
|
$this->staticData = array_map(function($a){return self::readSingle($a);}, $all);
|
||||||
}
|
}
|
||||||
@ -37,12 +35,12 @@ class UpdatesLog
|
|||||||
{
|
{
|
||||||
$ip = get_client_ip();
|
$ip = get_client_ip();
|
||||||
|
|
||||||
$ippath = (__DIR__ . '/../dynamic/self_ip_address.auto.cfg');
|
$ippath = (__DIR__ . '/../../dynamic/self_ip_address.auto.cfg');
|
||||||
$self_ip = file_exists($ippath) ? file_get_contents($ippath) : 'N/A';
|
$self_ip = file_exists($ippath) ? file_get_contents($ippath) : 'N/A';
|
||||||
|
|
||||||
if ($self_ip === $ip) $ip = "self";
|
if ($self_ip === $ip) $ip = "self";
|
||||||
|
|
||||||
$this->site->Database()->sql_exec_prep("INSERT INTO updateslog (programname, ip, version, date) VALUES (:pn, :ip, :vn, NOW())",
|
$this->site->modules->Database()->sql_exec_prep("INSERT INTO updateslog (programname, ip, version, date) VALUES (:pn, :ip, :vn, NOW())",
|
||||||
[
|
[
|
||||||
[':pn', $name, PDO::PARAM_STR],
|
[':pn', $name, PDO::PARAM_STR],
|
||||||
[':ip', $ip, PDO::PARAM_STR],
|
[':ip', $ip, PDO::PARAM_STR],
|
||||||
@ -52,12 +50,12 @@ class UpdatesLog
|
|||||||
|
|
||||||
public function listProgramsInformation()
|
public function listProgramsInformation()
|
||||||
{
|
{
|
||||||
return $this->site->Database()->sql_query_assoc('SELECT programname AS name, Count(*) as count_total, MAX(date) AS last_query, (SELECT COUNT(*) FROM updateslog AS u1 WHERE u1.programname=u0.programname AND NOW() - INTERVAL 7 DAY < u1.date) AS count_week FROM updateslog AS u0 GROUP BY programname');
|
return $this->site->modules->Database()->sql_query_assoc('SELECT programname AS name, Count(*) as count_total, MAX(date) AS last_query, (SELECT COUNT(*) FROM updateslog AS u1 WHERE u1.programname=u0.programname AND NOW() - INTERVAL 7 DAY < u1.date) AS count_week FROM updateslog AS u0 GROUP BY programname');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getEntries($name, $limit)
|
public function getEntries($name, $limit)
|
||||||
{
|
{
|
||||||
return $this->site->Database()->sql_query_assoc_prep('SELECT * FROM updateslog WHERE programname = :pn ORDER BY date DESC LIMIT :lt',
|
return $this->site->modules->Database()->sql_query_assoc_prep('SELECT * FROM updateslog WHERE programname = :pn ORDER BY date DESC LIMIT :lt',
|
||||||
[
|
[
|
||||||
[':pn', $name, PDO::PARAM_STR],
|
[':pn', $name, PDO::PARAM_STR],
|
||||||
[':lt', $limit, PDO::PARAM_INT],
|
[':lt', $limit, PDO::PARAM_INT],
|
@ -1,7 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
require_once 'website.php';
|
|
||||||
|
|
||||||
class WebApps
|
class WebApps
|
||||||
{
|
{
|
||||||
/** @var array */
|
/** @var array */
|
||||||
@ -14,7 +12,7 @@ class WebApps
|
|||||||
|
|
||||||
private function load()
|
private function load()
|
||||||
{
|
{
|
||||||
$all = require (__DIR__ . '/../statics/webapps/__all.php');
|
$all = require (__DIR__ . '/../../statics/webapps/__all.php');
|
||||||
|
|
||||||
$this->staticData = array_map(function($a){return self::readSingle($a);}, $all);
|
$this->staticData = array_map(function($a){return self::readSingle($a);}, $all);
|
||||||
}
|
}
|
||||||
@ -31,5 +29,3 @@ class WebApps
|
|||||||
return $data;
|
return $data;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -101,7 +101,6 @@ class RuleEngine
|
|||||||
{
|
{
|
||||||
// enforce https
|
// enforce https
|
||||||
$redirect = 'https://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
|
$redirect = 'https://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
|
||||||
ob_end_clean();
|
|
||||||
header('HTTP/1.1 301 Moved Permanently');
|
header('HTTP/1.1 301 Moved Permanently');
|
||||||
header('Location: ' . $redirect);
|
header('Location: ' . $redirect);
|
||||||
exit();
|
exit();
|
||||||
|
@ -44,7 +44,8 @@ class URLRoute
|
|||||||
*/
|
*/
|
||||||
public function getDirect(Website $site, PageFrameOptions $pfo): PageFrameOptions
|
public function getDirect(Website $site, PageFrameOptions $pfo): PageFrameOptions
|
||||||
{
|
{
|
||||||
@ob_end_clean();
|
try
|
||||||
|
{
|
||||||
ob_start();
|
ob_start();
|
||||||
|
|
||||||
global $ROUTE;
|
global $ROUTE;
|
||||||
@ -57,10 +58,15 @@ class URLRoute
|
|||||||
/** @noinspection PhpIncludeInspection */
|
/** @noinspection PhpIncludeInspection */
|
||||||
require $this->targetpath;
|
require $this->targetpath;
|
||||||
|
|
||||||
$FRAME_OPTIONS->raw = ob_get_clean();
|
$FRAME_OPTIONS->raw = ob_get_contents();
|
||||||
|
|
||||||
return $FRAME_OPTIONS;
|
return $FRAME_OPTIONS;
|
||||||
}
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
ob_end_clean();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param URLRoute $route
|
* @param URLRoute $route
|
||||||
|
@ -23,25 +23,6 @@ function endsWith($haystack, $needle)
|
|||||||
return $length === 0 || (substr($haystack, -$length) === $needle);
|
return $length === 0 || (substr($haystack, -$length) === $needle);
|
||||||
}
|
}
|
||||||
|
|
||||||
function httpError($errorcode, $message)
|
|
||||||
{
|
|
||||||
ob_clean();
|
|
||||||
|
|
||||||
http_response_code($errorcode);
|
|
||||||
|
|
||||||
global $OPTIONS;
|
|
||||||
$OPTIONS = [ 'code' => $errorcode, 'message' => $message ];
|
|
||||||
require (__DIR__ . '/../pages/errorview.php');
|
|
||||||
die();
|
|
||||||
}
|
|
||||||
|
|
||||||
function httpDie($errorcode, $message)
|
|
||||||
{
|
|
||||||
ob_flush();
|
|
||||||
http_response_code($errorcode);
|
|
||||||
die($message);
|
|
||||||
}
|
|
||||||
|
|
||||||
function destructiveUrlEncode($str) {
|
function destructiveUrlEncode($str) {
|
||||||
$str = str_replace(' ', '_', $str);
|
$str = str_replace(' ', '_', $str);
|
||||||
$str = str_replace('+', '_', $str);
|
$str = str_replace('+', '_', $str);
|
||||||
@ -342,6 +323,7 @@ function formatException($e)
|
|||||||
$xdbg = str_replace('<br />', "\n", $xdbg);
|
$xdbg = str_replace('<br />', "\n", $xdbg);
|
||||||
$xdbg = str_replace('<br/>', "\n", $xdbg);
|
$xdbg = str_replace('<br/>', "\n", $xdbg);
|
||||||
$xdbg = str_replace('<br>', "\n", $xdbg);
|
$xdbg = str_replace('<br>', "\n", $xdbg);
|
||||||
|
$xdbg = str_replace('><', "> <", $xdbg);
|
||||||
$xdbg = strip_tags($xdbg);
|
$xdbg = strip_tags($xdbg);
|
||||||
$xdbg = htmlspecialchars($xdbg);
|
$xdbg = htmlspecialchars($xdbg);
|
||||||
$r .= $xdbg . "\n";
|
$r .= $xdbg . "\n";
|
||||||
|
@ -3,6 +3,8 @@
|
|||||||
require_once 'ruleengine.php';
|
require_once 'ruleengine.php';
|
||||||
require_once 'urlroute.php';
|
require_once 'urlroute.php';
|
||||||
require_once 'pageframeoptions.php';
|
require_once 'pageframeoptions.php';
|
||||||
|
require_once 'modules.php';
|
||||||
|
require_once 'fragments.php';
|
||||||
|
|
||||||
require_once 'utils.php';
|
require_once 'utils.php';
|
||||||
|
|
||||||
@ -17,16 +19,11 @@ class Website
|
|||||||
/** @var bool|null */
|
/** @var bool|null */
|
||||||
public $isLoggedIn = null;
|
public $isLoggedIn = null;
|
||||||
|
|
||||||
/** @var Database|null */ private $database = null;
|
/** @var Modules */
|
||||||
/** @var AdventOfCode|null */ private $adventOfCode = null;
|
public $modules;
|
||||||
/** @var Blog|null */ private $blog = null;
|
|
||||||
/** @var Books|null */ private $books = null;
|
/** @var Fragments */
|
||||||
/** @var Euler|null */ private $euler = null;
|
public $fragments;
|
||||||
/** @var Programs|null */ private $programs = null;
|
|
||||||
/** @var AlephNoteStatistics|null */ private $anstats = null;
|
|
||||||
/** @var UpdatesLog|null */ private $updateslog = null;
|
|
||||||
/** @var WebApps|null */ private $webapps = null;
|
|
||||||
/** @var MikescherGitGraph|null */ private $extendedgitgraph = null;
|
|
||||||
|
|
||||||
public function init()
|
public function init()
|
||||||
{
|
{
|
||||||
@ -43,6 +40,10 @@ class Website
|
|||||||
error_reporting(E_ALL);
|
error_reporting(E_ALL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$this->modules = new Modules($this);
|
||||||
|
|
||||||
|
$this->fragments = new Fragments();
|
||||||
|
|
||||||
self::$instance = $this;
|
self::$instance = $this;
|
||||||
}
|
}
|
||||||
catch (exception $e)
|
catch (exception $e)
|
||||||
@ -70,16 +71,11 @@ class Website
|
|||||||
exit();
|
exit();
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($result->contentType !== null) header('Content-Type: ' . $result->contentType);
|
|
||||||
http_response_code($result->statuscode);
|
|
||||||
|
|
||||||
$this->output($result, $route);
|
$this->output($result, $route);
|
||||||
|
|
||||||
exit();
|
|
||||||
}
|
}
|
||||||
catch (Exception $e)
|
catch (Exception $e)
|
||||||
{
|
{
|
||||||
$this->serveServerError(null, formatException($e), null);
|
$this->serveServerError("Internal Server Error", formatException($e), null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -87,8 +83,6 @@ class Website
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@ob_end_clean();
|
|
||||||
|
|
||||||
$frameOpt->statuscode = 404;
|
$frameOpt->statuscode = 404;
|
||||||
$frameOpt->title = 'Page not found';
|
$frameOpt->title = 'Page not found';
|
||||||
|
|
||||||
@ -100,23 +94,21 @@ class Website
|
|||||||
}
|
}
|
||||||
catch (Exception $e)
|
catch (Exception $e)
|
||||||
{
|
{
|
||||||
$this->serveServerError(null, formatException($e), null);
|
$this->serveServerError("Internal Server Error", formatException($e), null);
|
||||||
}
|
}
|
||||||
|
|
||||||
exit();
|
exit();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param string|null $message
|
* @param string $message
|
||||||
* @param string|null $debugInfo
|
* @param string|null $debugInfo
|
||||||
* @param PageFrameOptions|null $frameOpt
|
* @param PageFrameOptions|null $frameOpt
|
||||||
*/
|
*/
|
||||||
private function serveServerError($message, $debugInfo, $frameOpt)
|
private function serveServerError(string $message, $debugInfo, $frameOpt)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@ob_end_clean();
|
|
||||||
|
|
||||||
if ($frameOpt === null) $frameOpt = new PageFrameOptions();
|
if ($frameOpt === null) $frameOpt = new PageFrameOptions();
|
||||||
|
|
||||||
$frameOpt->statuscode = 500;
|
$frameOpt->statuscode = 500;
|
||||||
@ -157,66 +149,6 @@ class Website
|
|||||||
require __DIR__ . '/../frames/' . $FRAME_OPTIONS->frame;
|
require __DIR__ . '/../frames/' . $FRAME_OPTIONS->frame;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function Database()
|
|
||||||
{
|
|
||||||
if ($this->database === null) { require_once 'database.php'; $this->database = new Database($this); }
|
|
||||||
return $this->database;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function AdventOfCode(): AdventOfCode
|
|
||||||
{
|
|
||||||
if ($this->adventOfCode === null) { require_once 'adventofcode.php'; $this->adventOfCode = new AdventOfCode(); }
|
|
||||||
return $this->adventOfCode;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function Blog(): Blog
|
|
||||||
{
|
|
||||||
if ($this->blog === null) { require_once 'blog.php'; $this->blog = new Blog(); }
|
|
||||||
return $this->blog;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function Books(): Books
|
|
||||||
{
|
|
||||||
if ($this->books === null) { require_once 'books.php'; $this->books = new Books(); }
|
|
||||||
return $this->books;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function Euler(): Euler
|
|
||||||
{
|
|
||||||
if ($this->euler === null) { require_once 'euler.php'; $this->euler = new Euler(); }
|
|
||||||
return $this->euler;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function Programs(): Programs
|
|
||||||
{
|
|
||||||
if ($this->programs === null) { require_once 'programs.php'; $this->programs = new Programs(); }
|
|
||||||
return $this->programs;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function AlephNoteStatistics(): AlephNoteStatistics
|
|
||||||
{
|
|
||||||
if ($this->anstats === null) { require_once 'alephnoteStatistics.php'; $this->anstats = new AlephNoteStatistics($this); }
|
|
||||||
return $this->anstats;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function UpdatesLog(): UpdatesLog
|
|
||||||
{
|
|
||||||
if ($this->updateslog === null) { require_once 'updateslog.php'; $this->updateslog = new UpdatesLog($this); }
|
|
||||||
return $this->updateslog;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function WebApps(): WebApps
|
|
||||||
{
|
|
||||||
if ($this->webapps === null) { require_once 'webapps.php'; $this->webapps = new WebApps(); }
|
|
||||||
return $this->webapps;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function ExtendedGitGraph(): MikescherGitGraph
|
|
||||||
{
|
|
||||||
if ($this->extendedgitgraph === null) { require_once 'mikeschergitgraph.php'; $this->extendedgitgraph = new MikescherGitGraph($this); }
|
|
||||||
return $this->extendedgitgraph;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
|
@ -1,34 +1,26 @@
|
|||||||
<!DOCTYPE html>
|
|
||||||
<html lang="en">
|
|
||||||
<?php
|
<?php
|
||||||
require_once (__DIR__ . '/../internals/base.php');
|
require_once (__DIR__ . '/../internals/website.php');
|
||||||
global $OPTIONS;
|
|
||||||
|
|
||||||
$errorcode = $OPTIONS['code'];
|
/** @var PageFrameOptions $FRAME_OPTIONS */ global $FRAME_OPTIONS;
|
||||||
$errormsg = $OPTIONS['message'];
|
/** @var URLRoute $ROUTE */ global $ROUTE;
|
||||||
|
/** @var Website $SITE */ global $SITE;
|
||||||
?>
|
?>
|
||||||
<head>
|
|
||||||
<meta charset="utf-8">
|
|
||||||
<title>Mikescher.com - <?php echo $errormsg; ?></title>
|
|
||||||
<link rel="icon" type="image/png" href="/data/images/favicon.png"/>
|
|
||||||
<?php printHeaderCSS(); ?>
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<div id="mastercontainer">
|
|
||||||
|
|
||||||
<?php $HEADER_ACTIVE='none'; include (__DIR__ . '/../fragments/header.php'); ?>
|
<?php
|
||||||
|
$FRAME_OPTIONS->title = 'Mikescher.com - Error';
|
||||||
|
$FRAME_OPTIONS->canonical_url = null;
|
||||||
|
$FRAME_OPTIONS->activeHeader = null;
|
||||||
|
$FRAME_OPTIONS->contentCSSClasses []= 'content-fullheight';
|
||||||
|
|
||||||
|
$message = $ROUTE->parameter['message'];
|
||||||
|
$debuginfo = $ROUTE->parameter['debuginfo'];
|
||||||
|
?>
|
||||||
|
|
||||||
<div id="content" class="content-responsive content-fullheight">
|
|
||||||
|
|
||||||
<div class="ev_master">
|
<div class="ev_master">
|
||||||
<div class="ev_code"><?php echo $errorcode; ?></div>
|
<div class="ev_code">500</div>
|
||||||
<div class="ev_msg"><?php echo $errormsg; ?></div>
|
<div class="ev_msg">asdasd<?php echo $message; ?></div>
|
||||||
|
<?php if ($debuginfo !== null && strlen($debuginfo)>0 && ($SITE != null && !$SITE->isProd())): ?>
|
||||||
|
<p class="ev_statusmore"><?php echo nl2br($debuginfo); ?></p>
|
||||||
|
<?php endif; ?>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
<?php printAdditionalScripts(); ?>
|
|
||||||
<?php printAdditionalStylesheets(); ?>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
@ -6,12 +6,18 @@ require_once (__DIR__ . '/../internals/website.php');
|
|||||||
/** @var Website $SITE */ global $SITE;
|
/** @var Website $SITE */ global $SITE;
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<?php include (__DIR__ . '/../fragments/panel_euler.php'); ?>
|
<?php
|
||||||
|
$FRAME_OPTIONS->title = 'Mikescher.com';
|
||||||
|
$FRAME_OPTIONS->canonical_url = 'https://www.mikescher.com';
|
||||||
|
$FRAME_OPTIONS->activeHeader = 'home';
|
||||||
|
?>
|
||||||
|
|
||||||
<?php include (__DIR__ . '/../fragments/panel_programs.php'); ?>
|
<?php $SITE->fragments->PanelEuler(); ?>
|
||||||
|
|
||||||
<?php include (__DIR__ . '/../fragments/panel_blog.php'); ?>
|
<?php $SITE->fragments->PanelPrograms(); ?>
|
||||||
|
|
||||||
<?php include (__DIR__ . '/../fragments/panel_books.php'); ?>
|
<?php $SITE->fragments->PanelBlog(); ?>
|
||||||
|
|
||||||
<?php include (__DIR__ . '/../fragments/panel_aoc.php'); ?>
|
<?php $SITE->fragments->PanelBooks(); ?>
|
||||||
|
|
||||||
|
<?php $SITE->fragments->PanelAdventOfCode(); ?>
|
||||||
|
Loading…
Reference in New Issue
Block a user