Admin
Admin
+ Update Program Thumbnails + Update Book Thumbnails + +
+ + Show
- Update Program Thumbnails - Update Book Thumbnails +
diff --git a/www/data/css/styles.css b/www/data/css/styles.css index 562b2e8..144d2d7 100644 --- a/www/data/css/styles.css +++ b/www/data/css/styles.css @@ -887,6 +887,10 @@ html, body { background: -webkit-radial-gradient(circle, rgba(0, 0, 0, 0.1) 0%, rgba(0, 0, 0, 0) 100%); } +.admindberr { + color: #BB2222; +} + /* 400px */ #loginform div { display: flex; diff --git a/www/data/css/styles.min.css b/www/data/css/styles.min.css index 3245623..ebb23e3 100644 --- a/www/data/css/styles.min.css +++ b/www/data/css/styles.min.css @@ -173,6 +173,7 @@ html,body{margin:0;padding:0;height:100%} .consistency_result_warn{background:#ff0} .consistency_result_err{background:red} .admincontent .boxedcontent hr{width:95%;height:1px;border:0;color:#FFFFFF00;background:-moz-radial-gradient(circle,rgba(0,0,0,0.1),rgba(0,0,0,0));background:-webkit-radial-gradient(circle,rgba(0,0,0,0.1) 0,rgba(0,0,0,0) 100%)} +.admindberr{color:#b22} #loginform div{display:flex;flex-direction:column} #loginform div button{margin:10px 0;padding:0} .loginerror{display:flex;background:#f44;color:#222;border:1px solid #a44;border-radius:2px;font-weight:bold;padding:0 5px;margin:5px 0 20px 0} diff --git a/www/data/css/styles_admin.scss b/www/data/css/styles_admin.scss index 43495f4..b8bce2f 100644 --- a/www/data/css/styles_admin.scss +++ b/www/data/css/styles_admin.scss @@ -61,4 +61,6 @@ color: $COL_TRANSPARENT; background: -moz-radial-gradient( circle, rgba(0, 0, 0, 0.1), rgba(0, 0, 0, 0.0)); background: -webkit-radial-gradient(circle, rgba(0, 0, 0, 0.1) 0%,rgba(0, 0, 0, 0.0) 100%); -} \ No newline at end of file +} + +.admindberr { color: $COL_ADMIN_STATUS_DB_ERROR; } \ No newline at end of file diff --git a/www/data/css/styles_config.scss b/www/data/css/styles_config.scss index 21e7ffd..bd47959 100644 --- a/www/data/css/styles_config.scss +++ b/www/data/css/styles_config.scss @@ -156,6 +156,8 @@ $COL_ADMIN_ERROR: #FF0000; $COL_ADMIN_STATUS_FG: #222222; $COL_ADMIN_STATUS_BORDER: 1px solid #888; +$COL_ADMIN_STATUS_DB_ERROR: #BB2222; + // ------------------------------------ ------------------------------------ diff --git a/www/internals/modules.php b/www/internals/modules.php index 08821ef..ef80514 100644 --- a/www/internals/modules.php +++ b/www/internals/modules.php @@ -44,7 +44,7 @@ class Modules public function Books(): Books { - if ($this->books === null) { require_once 'modules/books.php'; $this->books = new Books(); } + if ($this->books === null) { require_once 'modules/books.php'; $this->books = new Books($this->site); } return $this->books; } diff --git a/www/internals/modules/books.php b/www/internals/modules/books.php index 6206f96..ee5f2b6 100644 --- a/www/internals/modules/books.php +++ b/www/internals/modules/books.php @@ -2,11 +2,15 @@ class Books { + /** @var Website */ + private $site; + /** @var array */ private $staticData; - public function __construct() + public function __construct(Website $site) { + $this->site = $site; $this->load(); } @@ -104,12 +108,10 @@ class Books public function createPreview($prog) { - global $CONFIG; - $src = $prog['imgfront_path']; $dst = $prog['preview_path']; - if ($CONFIG['use_magick']) + if ($this->site->config['use_magick']) magick_resize_image($src, 200, 0, $dst); else smart_resize_image($src, 200, 0, true, $dst); diff --git a/www/internals/modules/programs.php b/www/internals/modules/programs.php index 6cf2738..0d23560 100644 --- a/www/internals/modules/programs.php +++ b/www/internals/modules/programs.php @@ -223,7 +223,7 @@ class Programs if (strpos($prog['internal_name'], ' ') !== FALSE) return ['result'=>'err', 'message' => 'Internal name contains spaces ' . $prog['name']]; - foreach (explode('|', $prog['ui_language']) as $lang) if (convertLanguageToFlag($lang) === null) return ['result'=>'err', 'message' => 'Unknown ui-lang ' . $prog['name']];; + foreach (explode('|', $prog['ui_language']) as $lang) if ($this->convertLanguageToFlag($lang) === null) return ['result'=>'err', 'message' => 'Unknown ui-lang ' . $prog['name']];; if (!in_array($prog['prog_language'], self::PROG_LANGS)) return ['result'=>'err', 'message' => 'Unknown prog-lang ' . $prog['name']]; @@ -232,11 +232,11 @@ class Programs if ($prog['license'] !== null && !array_key_exists($prog['license'], self::LICENSES)) return ['result'=>'err', 'message' => 'Unknown license ' . $prog['name']]; $isdl = false; - foreach (self::getURLs($prog) as $xurl) + foreach ($this->getURLs($prog) as $xurl) { if (!in_array($xurl['type'], self::URL_ORDER)) return ['result'=>'err', 'message' => 'Unknown url ' . $xurl['type']]; - if ($xurl['type']==='download' && $xurl['isdirect'] && !file_exists(self::getDirectDownloadPath($prog))) return ['result'=>'err', 'message' => 'Direct download not found ' . $prog['name']]; + if ($xurl['type']==='download' && $xurl['isdirect'] && !file_exists($this->getDirectDownloadPath($prog))) return ['result'=>'err', 'message' => 'Direct download not found ' . $prog['name']]; if ($xurl['type']==='download' || $xurl['type']==='playstore' || $xurl['type']==='itunesstore') $isdl = true; } diff --git a/www/internals/utils.php b/www/internals/utils.php index ef90b1d..c877e98 100644 --- a/www/internals/utils.php +++ b/www/internals/utils.php @@ -63,11 +63,6 @@ function formatMilliseconds($millis) } } -function isProd() { - global $CONFIG; - return $CONFIG['prod']; -} - /** * easy image resize function * @author http://www.nimrodstech.com/php-image-resize/ diff --git a/www/pages/admin.php b/www/pages/admin.php index 2736487..7026043 100644 --- a/www/pages/admin.php +++ b/www/pages/admin.php @@ -1,261 +1,238 @@ - - -title = 'Admin'; +$FRAME_OPTIONS->canonical_url = 'https://www.mikescher.com/admin'; +$FRAME_OPTIONS->activeHeader = 'admin'; + +$FRAME_OPTIONS->addScript('https://code.jquery.com/jquery-latest.min.js', true); +$FRAME_OPTIONS->addScript('/data/javascript/admin.js', true); + + +$connected = true; try { $SITE->modules->Database(); } catch (Exception $e) { $connected = false; } + +$rok = ['result'=>'ok','message'=>'']; + +$consistency_blog = $rok; try { $consistency_blog = $SITE->modules->Blog()->checkConsistency(); } catch (Exception $e) { $consistency_blog = ['result'=>'ok', 'message'=>"$e"]; } +$consistency_prog = $rok; try { $consistency_prog = $SITE->modules->Programs()->checkConsistency(); } catch (Exception $e) { $consistency_prog = ['result'=>'ok', 'message'=>"$e"]; } +$consistency_euler = $rok; try { $consistency_euler = $SITE->modules->Euler()->checkConsistency(); } catch (Exception $e) { $consistency_euler = ['result'=>'ok', 'message'=>"$e"]; } +$consistency_books = $rok; try { $consistency_books = $SITE->modules->Books()->checkConsistency(); } catch (Exception $e) { $consistency_books = ['result'=>'ok', 'message'=>"$e"]; } +$consistency_egg = $rok; try { $consistency_egg = $SITE->modules->ExtendedGitGraph()->checkConsistency(); } catch (Exception $e) { $consistency_egg = ['result'=>'ok', 'message'=>"$e"]; } +$consistency_progimg = $rok; try { $consistency_progimg = $SITE->modules->Programs()->checkThumbnails(); } catch (Exception $e) { $consistency_progimg = ['result'=>'ok', 'message'=>"$e"]; } +$consistency_bookimg = $rok; try { $consistency_bookimg = $SITE->modules->Books()->checkThumbnails(); } catch (Exception $e) { $consistency_bookimg = ['result'=>'ok', 'message'=>"$e"]; } +$consistency_aoc = $rok; try { $consistency_aoc = $SITE->modules->AdventOfCode()->checkConsistency(); } catch (Exception $e) { $consistency_aoc = ['result'=>'ok', 'message'=>"$e"]; } + +function dumpConsistency($c) +{ if ($c['result']==='ok') echo "OK"; else if ($c['result']==='warn') echo "".$c['message'].""; else echo "".$c['message'].""; } ?> -
- -