diff --git a/www/data/css/styles.css b/www/data/css/styles.css index 4a06e09..10726a5 100644 --- a/www/data/css/styles.css +++ b/www/data/css/styles.css @@ -25,6 +25,9 @@ body { @media (min-width: 1200px) { .content-responsive { width: 1170px; } } +.content-fullheight { + flex-grow: 1; } + .contentheader { width: 100%; color: #333; @@ -134,6 +137,8 @@ html, body { height: 100%; } #mastercontainer { + display: flex; + flex-direction: column; min-height: 100%; position: relative; } @@ -448,6 +453,27 @@ html, body { .bce_pag05 { flex-direction: row; } } +.ev_master { + align-self: center; } + @media (min-width: 850px) { + .ev_master { + padding-bottom: 80px; } } + .ev_master .ev_code { + color: #000; + 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; } + @media (max-width: 767px) { + .ev_master .ev_code { + font-size: 75pt; } + .ev_master .ev_msg { + font-size: 15pt; } } + .euler_pnl_base { display: inline-flex; flex-direction: column; diff --git a/www/data/css/styles.scss b/www/data/css/styles.scss index d5c6b05..3ddb832 100644 --- a/www/data/css/styles.scss +++ b/www/data/css/styles.scss @@ -6,6 +6,7 @@ @import 'styles_bloglist'; @import 'styles_blogview'; @import 'styles_blogview_befunge'; +@import 'styles_errorview'; @import 'styles_eulerpanel'; @import 'styles_bfjoustrunner'; diff --git a/www/data/css/styles_errorview.scss b/www/data/css/styles_errorview.scss new file mode 100644 index 0000000..e5eb586 --- /dev/null +++ b/www/data/css/styles_errorview.scss @@ -0,0 +1,28 @@ +@import 'styles_config'; + +.ev_master { + + align-self: center; + + @media(min-width:850px) {padding-bottom: 80px;} + + .ev_code { + color: #000; + text-align: center; + font-size: 150pt; + font-weight: 500; + font-family: $FONT_CODE; + } + + .ev_msg { + color: #888; + text-align: center; + font-size: 25pt; + } + + @media(max-width:767px) { + .ev_code { font-size: 75pt; } + .ev_msg { font-size: 15pt; } + } + +} \ No newline at end of file diff --git a/www/data/css/styles_footer.scss b/www/data/css/styles_footer.scss index b76d6b6..a1e0b37 100644 --- a/www/data/css/styles_footer.scss +++ b/www/data/css/styles_footer.scss @@ -9,6 +9,8 @@ html, body { // https://stackoverflow.com/a/19723677/1761622 #mastercontainer { + display:flex; + flex-direction: column; min-height:100%; position:relative; } @@ -18,6 +20,7 @@ html, body { #content { padding-bottom:60px; /* Height of the footer */ } + #footerdiv { position:absolute; bottom:0; diff --git a/www/data/css/styles_global.scss b/www/data/css/styles_global.scss index 989764c..ca3f7b8 100644 --- a/www/data/css/styles_global.scss +++ b/www/data/css/styles_global.scss @@ -24,6 +24,8 @@ body { @media(min-width:992px) { .content-responsive { width: 724px; } } @media(min-width:1200px){ .content-responsive { width: 1170px; } } +.content-fullheight { flex-grow: 1;} + .contentheader { width: 100%; color: $COL_TEXT_DARK; diff --git a/www/fragments/blogview_euler_single.php b/www/fragments/blogview_euler_single.php index 2cafa19..0b30eed 100644 --- a/www/fragments/blogview_euler_single.php +++ b/www/fragments/blogview_euler_single.php @@ -9,7 +9,7 @@ $subview = $OPTIONS['subview']; $euler = Euler::listAll(); $problem = Euler::getEulerProblemFromStrIdent($subview); -if ($post === NULL) httpError(404, 'problem not found'); +if ($problem === NULL) httpError(404, 'Project Euler entry not found'); $pd = new ParsedownCustom(); diff --git a/www/index.php b/www/index.php index 54b40e5..2b8be96 100644 --- a/www/index.php +++ b/www/index.php @@ -70,73 +70,89 @@ $URL_RULES = //############################################################################# -$path = strtolower(parse_url($_SERVER['REQUEST_URI'])['path']); -$pathparts = preg_split('@/@', $path, NULL, PREG_SPLIT_NO_EMPTY); -$partcount = count($pathparts); +try { + InitPHP(); -global $OPTIONS; -global $HEADER_ACTIVE; + $path = strtolower(parse_url($_SERVER['REQUEST_URI'])['path']); + $pathparts = preg_split('@/@', $path, NULL, PREG_SPLIT_NO_EMPTY); + $partcount = count($pathparts); -$HEADER_ACTIVE = 'none'; + global $OPTIONS; + global $HEADER_ACTIVE; -foreach ($URL_RULES as $rule) -{ - if ($partcount !== count($rule['url'])) continue; - - $urlparams = []; - - $match = true; - for($i = 0; $i < $partcount; $i++) + $HEADER_ACTIVE = 'none'; + + foreach ($URL_RULES as $rule) { - $comp = $rule['url'][$i]; - if (startsWith($comp, '?{') && endsWith($comp, '}')) - { - $ident = substr($comp, 2, strlen($comp)-3); - $urlparams[$ident] = $pathparts[$i]; - } - else - { - if (strtolower($comp) !== strtolower($pathparts[$i])) { $match = false; break; } - } - } - if (!$match) continue; - - $opt = []; - foreach($rule['options'] as $optname => $optvalue) - { - $value = $optvalue; - - if ($value === '%GET%') - { - if (!isset($_GET[$optname])) { $match = false; break; } - $value = $_GET[$optname]; - } - else if ($value === '%POST%') - { - if (!isset($_POST[$optname])) { $match = false; break; } - $value = $_POST[$optname]; - } - else if ($value === '%URL%') - { - if (!isset($urlparams[$optname])) { $match = false; break; } - $value = $urlparams[$optname]; - } - - $opt[strtolower($optname)] = $value; - } - if (!$match) continue; - - $OPTIONS = $opt; - include $rule['target']; - return; - -} + if ($partcount !== count($rule['url'])) continue; + + $urlparams = []; + + $match = true; + for($i = 0; $i < $partcount; $i++) + { + $comp = $rule['url'][$i]; + if (startsWith($comp, '?{') && endsWith($comp, '}')) + { + $ident = substr($comp, 2, strlen($comp)-3); + $urlparams[$ident] = $pathparts[$i]; + } + else + { + if (strtolower($comp) !== strtolower($pathparts[$i])) { $match = false; break; } + } + } + if (!$match) continue; + + $opt = []; + foreach($rule['options'] as $optname => $optvalue) + { + $value = $optvalue; + + if ($value === '%GET%') + { + if (!isset($_GET[$optname])) { $match = false; break; } + $value = $_GET[$optname]; + } + else if ($value === '%POST%') + { + if (!isset($_POST[$optname])) { $match = false; break; } + $value = $_POST[$optname]; + } + else if ($value === '%URL%') + { + if (!isset($urlparams[$optname])) { $match = false; break; } + $value = $urlparams[$optname]; + } + + $opt[strtolower($optname)] = $value; + } + if (!$match) continue; + + $OPTIONS = $opt; + include $rule['target']; + return; + + } + + { + // [404] - Page Not Found + $OPTIONS = []; + httpError('404', 'Page not found'); + return; + } + +} catch (Exception $e) { + + if (isProd()) + { + httpError('500 ', 'Internal server error'); + } + else + { + echo '