From 07227175af6ba5ae9570006b335cd1a078511719 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mike=20Schw=C3=B6rer?= Date: Sat, 3 Feb 2018 14:43:41 +0100 Subject: [PATCH] admin fixes --- www/index.php | 11 +++++------ www/internals/mikeschergitgraph.php | 2 +- www/internals/programs.php | 2 +- www/pages/admin.php | 14 ++++++++++++++ .../updates/{programupdates.php => _all.php} | 0 5 files changed, 21 insertions(+), 8 deletions(-) rename www/statics/updates/{programupdates.php => _all.php} (100%) diff --git a/www/index.php b/www/index.php index 298ac39..07ffd8f 100644 --- a/www/index.php +++ b/www/index.php @@ -106,7 +106,7 @@ try { if ($partcount !== count($rule['url'])) continue; $urlparams = []; - $opt = key_exists('_opt', $rule['options']) ? explode($rule['options']['_opt'], '|') : []; + $ctrlOpt = key_exists('_opt', $rule['options']) ? explode($rule['options']['_opt'], '|') : []; $target = $rule['target']; $match = true; @@ -129,7 +129,7 @@ try { } if (!$match) continue; - $opt = []; + $opt = [ 'controllerOptions' => $ctrlOpt, 'uri' => $requri ]; foreach($rule['options'] as $optname => $optvalue) { $value = $optvalue; @@ -154,9 +154,9 @@ try { } if (!$match) continue; - if (in_array('disabled', $opt)) continue; + if (in_array('disabled', $ctrlOpt)) continue; - if (in_array('password', $opt)) + if (in_array('password', $ctrlOpt)) { if (!isLoggedInByCookie()) { @@ -167,7 +167,7 @@ try { $is_http = (!isset($_SERVER['HTTPS'])) || empty($_SERVER['HTTPS']) || $_SERVER['HTTPS'] == "off"; - if ($is_http && !in_array('http', $opt)) + if (isProd() && $is_http && !in_array('http', $ctrlOpt)) { ob_clean(); $redirect = 'https://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']; @@ -210,5 +210,4 @@ try { //TODO remove db table prefixes //TODO euler insert+show 32bit | 64bit mode //TODO send cache header (?) -//TODO self update (admin+webhook) //TODO v4 subdomain+static diff --git a/www/internals/mikeschergitgraph.php b/www/internals/mikeschergitgraph.php index 35992e7..070f85b 100644 --- a/www/internals/mikeschergitgraph.php +++ b/www/internals/mikeschergitgraph.php @@ -42,7 +42,7 @@ class MikescherGitGraph { $p = self::getPathRenderedData(); - if (!file($p)) return ['result'=>'err', 'message' => 'Rendered data not found']; + if (!file_exists($p)) return ['result'=>'err', 'message' => 'Rendered data not found']; if (filemtime($p) < time()-(3*7*24*60*60)) return ['result'=>'warn', 'message' => 'Rendered data is older than 3 weeks']; diff --git a/www/internals/programs.php b/www/internals/programs.php index 92fe7f4..b619a12 100644 --- a/www/internals/programs.php +++ b/www/internals/programs.php @@ -63,7 +63,7 @@ class Programs public static function listUpdateData() { - $a = require (__DIR__ . '/../statics/updates/programupdates.php'); + $a = require (__DIR__ . '/../statics/updates/_all.php'); return $a; } diff --git a/www/pages/admin.php b/www/pages/admin.php index 8dd8f44..b977a96 100644 --- a/www/pages/admin.php +++ b/www/pages/admin.php @@ -139,6 +139,20 @@ function dumpConsistency($c) { +
+
Statics
+ +
+
Blog entries:
+
Book entries:
+
Euler entries:
+
Program entries:
+
Update entries:
+
+
+ + +
Highscores
diff --git a/www/statics/updates/programupdates.php b/www/statics/updates/_all.php similarity index 100% rename from www/statics/updates/programupdates.php rename to www/statics/updates/_all.php