Admin
This commit is contained in:
parent
85f107e8bd
commit
b2e90d2f42
@ -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;
|
||||
|
1
www/data/css/styles.min.css
vendored
1
www/data/css/styles.min.css
vendored
@ -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}
|
||||
|
@ -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%);
|
||||
}
|
||||
}
|
||||
|
||||
.admindberr { color: $COL_ADMIN_STATUS_DB_ERROR; }
|
@ -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;
|
||||
|
||||
|
||||
// ------------------------------------ ------------------------------------
|
||||
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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/
|
||||
|
@ -1,261 +1,238 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<?php
|
||||
require_once (__DIR__ . '/../internals/base.php');
|
||||
require_once (__DIR__ . '/../internals/highscores.php');
|
||||
require_once (__DIR__ . '/../internals/alephnoteStatistics.php');
|
||||
require_once (__DIR__ . '/../internals/blog.php');
|
||||
require_once (__DIR__ . '/../internals/euler.php');
|
||||
require_once (__DIR__ . '/../internals/adventofcode.php');
|
||||
require_once (__DIR__ . '/../internals/highscores.php');
|
||||
require_once (__DIR__ . '/../internals/mikeschergitgraph.php');
|
||||
require_once (__DIR__ . '/../internals/programs.php');
|
||||
require_once (__DIR__ . '/../internals/books.php');
|
||||
require_once (__DIR__ . '/../internals/updateslog.php');
|
||||
|
||||
$connected = Database::tryconnect();
|
||||
|
||||
$consistency_blog = Blog::checkConsistency();
|
||||
$consistency_prog = Programs::checkConsistency();
|
||||
$consistency_euler = Euler::checkConsistency();
|
||||
$consistency_books = Books::checkConsistency();
|
||||
$consistency_egg = MikescherGitGraph::checkConsistency();
|
||||
$consistency_progimg = Programs::checkThumbnails();
|
||||
$consistency_bookimg = Books::checkThumbnails();
|
||||
$consistency_aoc = AdventOfCode::checkConsistency();
|
||||
require_once (__DIR__ . '/../internals/website.php');
|
||||
|
||||
/** @var PageFrameOptions $FRAME_OPTIONS */ global $FRAME_OPTIONS;
|
||||
/** @var URLRoute $ROUTE */ global $ROUTE;
|
||||
/** @var Website $SITE */ global $SITE;
|
||||
?>
|
||||
<?php
|
||||
|
||||
function dumpConsistency($c) {
|
||||
<?php
|
||||
$FRAME_OPTIONS->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 "<span class='consistency_result_ok'>OK</span>";
|
||||
else if ($c['result']==='warn') echo "<span class='consistency_result_warn'>".$c['message']."</span>";
|
||||
else echo "<span class='consistency_result_err'>".$c['message']."</span>";
|
||||
}
|
||||
|
||||
?>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Mikescher.com - Admin</title>
|
||||
<link rel="icon" type="image/png" href="/data/images/favicon.png"/>
|
||||
<link rel="canonical" href="https://www.mikescher.com/about"/>
|
||||
<?php printHeaderCSS(); ?>
|
||||
<?php includeAdditionalScript("https://code.jquery.com/jquery-latest.min.js", '', true) ?>
|
||||
<?php includeAdditionalScript("/data/javascript/admin.js", 'defer', true) ?>
|
||||
</head>
|
||||
<body>
|
||||
<div id="mastercontainer">
|
||||
|
||||
<?php $HEADER_ACTIVE = 'admin'; include (__DIR__ . '/../fragments/header.php'); ?>
|
||||
<div class="admincontent">
|
||||
|
||||
<div id="content" class="content-responsive">
|
||||
<div class="contentheader"><h1>Admin</h1><hr/></div>
|
||||
|
||||
<div class="admincontent">
|
||||
<?php if (!$connected): ?>
|
||||
<div class="boxedcontent alertbox">
|
||||
<div class="bc_data">Could not connect to database</div>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<div class="contentheader"><h1>Admin</h1><hr/></div>
|
||||
<!-- - - - - - - - - - - - - - - - - - - - - -->
|
||||
|
||||
<?php if (!$connected): ?>
|
||||
<div class="boxedcontent alertbox">
|
||||
<div class="bc_data">Could not connect to database</div>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<!-- - - - - - - - - - - - - - - - - - - - - -->
|
||||
|
||||
<div class="boxedcontent">
|
||||
<div class="bc_header">Version</div>
|
||||
|
||||
<div class="bc_data keyvaluelist kvl_100">
|
||||
<div><span>Branch:</span> <span><?php echo exec('git rev-parse --abbrev-ref HEAD'); ?></span></div>
|
||||
<div><span>Commit:</span> <span><?php echo exec('git rev-parse HEAD'); ?></span></div>
|
||||
<div><span>Date:</span> <span><?php echo exec('git log -1 --format=%cd'); ?></span></div>
|
||||
<div><span>Message:</span><span><?php echo nl2br(trim(exec('git log -1'))); ?></span></div>
|
||||
<div class="boxedcontent">
|
||||
<div class="bc_header">Version</div>
|
||||
|
||||
<div class="bc_data keyvaluelist kvl_100">
|
||||
<div><span>Branch:</span> <span><?php echo exec('git rev-parse --abbrev-ref HEAD'); ?></span></div>
|
||||
<div><span>Commit:</span> <span><?php echo exec('git rev-parse HEAD'); ?></span></div>
|
||||
<div><span>Date:</span> <span><?php echo exec('git log -1 --format=%cd'); ?></span></div>
|
||||
<div><span>Message:</span><span><?php echo nl2br(trim(exec('git log -1'))); ?></span></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- - - - - - - - - - - - - - - - - - - - - -->
|
||||
|
||||
<div class="boxedcontent">
|
||||
<div class="bc_header">Self test</div>
|
||||
|
||||
<div class="bc_data">
|
||||
<div class="keyvaluelist kvl_200">
|
||||
<div><span>Program thumbnails:</span> <?php dumpConsistency($consistency_progimg); ?></div>
|
||||
<div><span>ExtendedGitGraph:</span> <?php dumpConsistency($consistency_egg); ?></div>
|
||||
<div><span>Book thumbnails:</span> <?php dumpConsistency($consistency_bookimg); ?></div>
|
||||
<div><span>Blog data:</span> <?php dumpConsistency($consistency_blog); ?></div>
|
||||
<div><span>Euler data:</span> <?php dumpConsistency($consistency_euler); ?></div>
|
||||
<div><span>AdventOfCode data:</span> <?php dumpConsistency($consistency_aoc); ?></div>
|
||||
<div><span>Programs data:</span> <?php dumpConsistency($consistency_prog); ?></div>
|
||||
<div><span>Books data:</span> <?php dumpConsistency($consistency_books); ?></div>
|
||||
</div>
|
||||
<br/>
|
||||
<a class="button" href="/api/site::createProgramThumbnails">Update Program Thumbnails</a>
|
||||
<a class="button" href="/api/site::createBookThumbnails">Update Book Thumbnails</a>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- - - - - - - - - - - - - - - - - - - - - -->
|
||||
|
||||
<div class="boxedcontent">
|
||||
<div class="bc_header">Self IP Addr</div>
|
||||
|
||||
<?php
|
||||
$ippath = __DIR__ . '/../dynamic/self_ip_address.auto.cfg';
|
||||
$self_ip = file_exists($ippath) ? file_get_contents($ippath) : 'N/A';
|
||||
$real_ip = get_client_ip();
|
||||
$me = $real_ip == $self_ip
|
||||
?>
|
||||
|
||||
<div class="bc_data keyvaluelist kvl_200">
|
||||
<div><span>Registered IP:</span> <span><?php echo $self_ip; ?></span></div>
|
||||
<div><span>Current IP:</span> <span><?php echo $real_ip; ?></span></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- - - - - - - - - - - - - - - - - - - - - -->
|
||||
|
||||
<div class="boxedcontent">
|
||||
<div class="bc_header">ExtendedGitGraph</div>
|
||||
|
||||
<div class="bc_data">
|
||||
|
||||
<textarea class="egg_ajaxOutput" id="egg_ajaxOutput" readonly="readonly"></textarea>
|
||||
<a class="button" href="javascript:startAjaxRefresh('<?php echo $SITE->config['ajax_secret'] ?>')">Update</a>
|
||||
<a class="button" href="javascript:startAjaxRedraw('<?php echo $SITE->config['ajax_secret'] ?>')">Redraw</a>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<!-- - - - - - - - - - - - - - - - - - - - - -->
|
||||
|
||||
<div class="boxedcontent">
|
||||
<div class="bc_header">AlephNote</div>
|
||||
|
||||
<?php if ($connected): ?>
|
||||
<div class="bc_data">
|
||||
<div class="keyvaluelist kvl_200">
|
||||
<div><span>Total users:</span> <span><?php echo $SITE->modules->AlephNoteStatistics()->getTotalUserCount(); ?></span></div>
|
||||
<div><span>Users on latest version:</span> <span><?php echo $SITE->modules->AlephNoteStatistics()->getUserCountFromLastVersion(); ?></span></div>
|
||||
<div><span>Active users:</span> <span><?php echo $SITE->modules->AlephNoteStatistics()->getActiveUserCount(32); ?></span></div>
|
||||
</div>
|
||||
<br/>
|
||||
<div id="an_ajax_target"></div>
|
||||
<a class="button" href="javascript:startAjaxReplace('#an_ajax_target', '/api/alephnote::show?secret=<?php echo $SITE->config['ajax_secret'] ?>')">Show</a>
|
||||
</div>
|
||||
<?php else: ?>
|
||||
<div class="bc_data keyvaluelist admindberr">Database not connected.</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<!-- - - - - - - - - - - - - - - - - - - - - -->
|
||||
</div>
|
||||
|
||||
<div class="boxedcontent">
|
||||
<div class="bc_header">Self test</div>
|
||||
<!-- - - - - - - - - - - - - - - - - - - - - -->
|
||||
|
||||
<div class="bc_data">
|
||||
<div class="keyvaluelist kvl_200">
|
||||
<div><span>Program thumbnails:</span> <?php dumpConsistency($consistency_progimg); ?></div>
|
||||
<div><span>ExtendedGitGraph:</span> <?php dumpConsistency($consistency_egg); ?></div>
|
||||
<div><span>Book thumbnails:</span> <?php dumpConsistency($consistency_bookimg); ?></div>
|
||||
<div><span>Blog data:</span> <?php dumpConsistency($consistency_blog); ?></div>
|
||||
<div><span>Euler data:</span> <?php dumpConsistency($consistency_euler); ?></div>
|
||||
<div><span>AdventOfCode data:</span> <?php dumpConsistency($consistency_aoc); ?></div>
|
||||
<div><span>Programs data:</span> <?php dumpConsistency($consistency_prog); ?></div>
|
||||
<div><span>Books data:</span> <?php dumpConsistency($consistency_books); ?></div>
|
||||
</div>
|
||||
<br/>
|
||||
<a class="button" href="/api/site::createProgramThumbnails">Update Program Thumbnails</a>
|
||||
<a class="button" href="/api/site::createBookThumbnails">Update Book Thumbnails</a>
|
||||
<div class="boxedcontent">
|
||||
<div class="bc_header">Statics</div>
|
||||
|
||||
</div>
|
||||
<div class="bc_data keyvaluelist kvl_200">
|
||||
<div><span>Blog entries:</span> <span><?php echo count($SITE->modules->Blog()->listAll()); ?></span></div>
|
||||
<div><span>Book entries:</span> <span><?php echo count($SITE->modules->Books()->listAll()); ?></span></div>
|
||||
<div><span>Euler entries:</span> <span><?php echo count($SITE->modules->Euler()->listAll()); ?></span></div>
|
||||
<div><span>Program entries:</span> <span><?php echo count($SITE->modules->Programs()->listAll()); ?></span></div>
|
||||
<div><span>Update entries:</span> <span><?php echo count($SITE->modules->UpdatesLog()->listUpdateData()); ?></span></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- - - - - - - - - - - - - - - - - - - - - -->
|
||||
|
||||
<div class="boxedcontent">
|
||||
<div class="bc_header">UpdatesLog</div>
|
||||
|
||||
<?php if ($connected): ?>
|
||||
<div class="bc_data keyvaluelist kvl_300">
|
||||
<?php foreach ($SITE->modules->UpdatesLog()->listProgramsInformation() as $info): ?>
|
||||
<div><span><?php echo '[' . $info['name'] . '] Count:' ?></span> <span><a href="javascript:startAjaxReplace('#ul_ajax_target', '/api/updates::show?secret=<?php echo $SITE->config['ajax_secret'] ?>&ulname=<?php echo $info['name'] ?>')"><?php echo $info['count_total']; ?></a></span></div>
|
||||
<div><span><?php echo '[' . $info['name'] . '] Last query:' ?></span> <span><?php echo $info['last_query']; ?></span></div>
|
||||
<div><span><?php echo '[' . $info['name'] . '] Count (1 week):' ?></span> <span><?php echo $info['count_week']; ?></span></div>
|
||||
<hr />
|
||||
<?php endforeach; ?>
|
||||
<br/>
|
||||
<div id="ul_ajax_target"></div>
|
||||
</div>
|
||||
<?php else: ?>
|
||||
<div class="bc_data keyvaluelist admindberr">Database not connected.</div>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
|
||||
<!-- - - - - - - - - - - - - - - - - - - - - -->
|
||||
<!-- - - - - - - - - - - - - - - - - - - - - -->
|
||||
|
||||
<div class="boxedcontent">
|
||||
<div class="bc_header">Self IP Addr</div>
|
||||
<div class="boxedcontent">
|
||||
<div class="bc_header">Highscores</div>
|
||||
|
||||
<?php
|
||||
$ippath = __DIR__ . '/../dynamic/self_ip_address.auto.cfg';
|
||||
$self_ip = file_exists($ippath) ? file_get_contents($ippath) : 'N/A';
|
||||
$real_ip = get_client_ip();
|
||||
$me = $real_ip == $self_ip
|
||||
?>
|
||||
<?php if ($connected): ?>
|
||||
<div class="bc_data keyvaluelist kvl_300">
|
||||
|
||||
<div class="bc_data keyvaluelist kvl_200">
|
||||
<div><span>Registered IP:</span> <span><?php echo $self_ip; ?></span></div>
|
||||
<div><span>Current IP:</span> <span><?php echo $real_ip; ?></span></div>
|
||||
</div>
|
||||
</div>
|
||||
<?php foreach ($SITE->modules->Highscores()->getAllGames() as $game): ?>
|
||||
|
||||
<!-- - - - - - - - - - - - - - - - - - - - - -->
|
||||
<div><span><?php echo '[' . $game['NAME'] . '] Entries:' ?></span> <span><a href="/highscores/list?gameid=<?php echo $game['ID']; ?>"><?php echo $SITE->modules->Highscores()->getEntryCountFromGame($game['ID']); ?></a></span></div>
|
||||
<div><span><?php echo '[' . $game['NAME'] . '] Highscore:' ?></span> <span><?php
|
||||
$hs = $SITE->modules->Highscores()->getOrderedEntriesFromGame($game['ID'], 1)[0];
|
||||
echo $hs['POINTS'] . ' (' . $hs['PLAYER'] . ') @ ' . $hs['TIMESTAMP'];
|
||||
?></span></div>
|
||||
<div><span><?php echo '[' . $game['NAME'] . '] Last Update:' ?></span> <span><?php echo $SITE->modules->Highscores()->getNewestEntriesFromGame($game['ID'], 1)[0]['TIMESTAMP']; ?></span></div>
|
||||
|
||||
<div class="boxedcontent">
|
||||
<div class="bc_header">ExtendedGitGraph</div>
|
||||
<hr />
|
||||
|
||||
<div class="bc_data">
|
||||
|
||||
<textarea class="egg_ajaxOutput" id="egg_ajaxOutput" readonly="readonly"></textarea>
|
||||
<a class="button" href="javascript:startAjaxRefresh('<?php echo $CONFIG['ajax_secret'] ?>')">Update</a>
|
||||
<a class="button" href="javascript:startAjaxRedraw('<?php echo $CONFIG['ajax_secret'] ?>')">Redraw</a>
|
||||
|
||||
</div>
|
||||
<?php endforeach; ?>
|
||||
|
||||
</div>
|
||||
<?php else: ?>
|
||||
<div class="bc_data keyvaluelist admindberr">Database not connected.</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<!-- - - - - - - - - - - - - - - - - - - - - -->
|
||||
</div>
|
||||
|
||||
<div class="boxedcontent">
|
||||
<div class="bc_header">AlephNote</div>
|
||||
<!-- - - - - - - - - - - - - - - - - - - - - -->
|
||||
|
||||
<?php if ($connected): ?>
|
||||
<div class="bc_data">
|
||||
<div class="keyvaluelist kvl_200">
|
||||
<div><span>Total users:</span> <span><?php echo AlephNoteStatistics::getTotalUserCount(); ?></span></div>
|
||||
<div><span>Users on latest version:</span> <span><?php echo AlephNoteStatistics::getUserCountFromLastVersion(); ?></span></div>
|
||||
<div><span>Active users:</span> <span><?php echo AlephNoteStatistics::getActiveUserCount(32); ?></span></div>
|
||||
</div>
|
||||
<br/>
|
||||
<div id="an_ajax_target"></div>
|
||||
<a class="button" href="javascript:startAjaxReplace('#an_ajax_target', '/api/alephnote::show?secret=<?php echo $CONFIG['ajax_secret'] ?>')">Show</a>
|
||||
</div>
|
||||
<?php else: ?>
|
||||
<div class="bc_data keyvaluelist">Database not connected.</div>
|
||||
<?php endif; ?>
|
||||
<div class="boxedcontent">
|
||||
<div class="bc_header">Configuration</div>
|
||||
<div class="bc_data keyvaluelist kvl_200">
|
||||
<?php
|
||||
foreach ($SITE->config as $key => $value)
|
||||
{
|
||||
if ($key === 'extendedgitgraph') continue;
|
||||
|
||||
</div>
|
||||
if (is_array($value))
|
||||
echo '<div><span>' . $key . '</span> <span style="white-space: pre">' . json_encode($value, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE) . '</span></div>' . "\n";
|
||||
else
|
||||
echo '<div><span>' . $key . '</span> <span>' . nl2br(var_export($value, true)) . '</span></div>' . "\n";
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- - - - - - - - - - - - - - - - - - - - - -->
|
||||
|
||||
<div class="boxedcontent">
|
||||
<div class="bc_header">Statics</div>
|
||||
|
||||
<div class="bc_data keyvaluelist kvl_200">
|
||||
<div><span>Blog entries:</span> <span><?php echo count(Blog::listAll()); ?></span></div>
|
||||
<div><span>Book entries:</span> <span><?php echo count(Books::listAll()); ?></span></div>
|
||||
<div><span>Euler entries:</span> <span><?php echo count(Euler::listAll()); ?></span></div>
|
||||
<div><span>Program entries:</span> <span><?php echo count(Programs::listAll()); ?></span></div>
|
||||
<div><span>Update entries:</span> <span><?php echo count(Programs::listUpdateData()); ?></span></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- - - - - - - - - - - - - - - - - - - - - -->
|
||||
|
||||
<div class="boxedcontent">
|
||||
<div class="bc_header">UpdatesLog</div>
|
||||
|
||||
<?php if ($connected): ?>
|
||||
<div class="bc_data keyvaluelist kvl_300">
|
||||
<?php foreach (UpdatesLog::listProgramsInformation() as $info): ?>
|
||||
<div><span><?php echo '[' . $info['name'] . '] Count:' ?></span> <span><a href="javascript:startAjaxReplace('#ul_ajax_target', '/api/updates::show?secret=<?php echo $CONFIG['ajax_secret'] ?>&ulname=<?php echo $info['name'] ?>')"><?php echo $info['count_total']; ?></a></span></div>
|
||||
<div><span><?php echo '[' . $info['name'] . '] Last query:' ?></span> <span><?php echo $info['last_query']; ?></span></div>
|
||||
<div><span><?php echo '[' . $info['name'] . '] Count (1 week):' ?></span> <span><?php echo $info['count_week']; ?></span></div>
|
||||
<hr />
|
||||
<?php endforeach; ?>
|
||||
<br/>
|
||||
<div id="ul_ajax_target"></div>
|
||||
</div>
|
||||
<?php else: ?>
|
||||
<div class="bc_data keyvaluelist">Database not connected.</div>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
|
||||
<!-- - - - - - - - - - - - - - - - - - - - - -->
|
||||
|
||||
<div class="boxedcontent">
|
||||
<div class="bc_header">Highscores</div>
|
||||
|
||||
<?php if ($connected): ?>
|
||||
<div class="bc_data keyvaluelist kvl_300">
|
||||
|
||||
<?php foreach (Highscores::getAllGames() as $game): ?>
|
||||
|
||||
<div><span><?php echo '[' . $game['NAME'] . '] Entries:' ?></span> <span><a href="/highscores/list?gameid=<?php echo $game['ID']; ?>"><?php echo Highscores::getEntryCountFromGame($game['ID']); ?></a></span></div>
|
||||
<div><span><?php echo '[' . $game['NAME'] . '] Highscore:' ?></span> <span><?php
|
||||
$hs = Highscores::getOrderedEntriesFromGame($game['ID'], 1)[0];
|
||||
echo $hs['POINTS'] . ' (' . $hs['PLAYER'] . ') @ ' . $hs['TIMESTAMP'];
|
||||
?></span></div>
|
||||
<div><span><?php echo '[' . $game['NAME'] . '] Last Update:' ?></span> <span><?php echo Highscores::getNewestEntriesFromGame($game['ID'], 1)[0]['TIMESTAMP']; ?></span></div>
|
||||
|
||||
<hr />
|
||||
|
||||
<?php endforeach; ?>
|
||||
|
||||
</div>
|
||||
<?php else: ?>
|
||||
<div class="bc_data keyvaluelist">Database not connected.</div>
|
||||
<?php endif; ?>
|
||||
|
||||
</div>
|
||||
|
||||
<!-- - - - - - - - - - - - - - - - - - - - - -->
|
||||
|
||||
<div class="boxedcontent">
|
||||
<div class="bc_header">Configuration</div>
|
||||
<div class="bc_data keyvaluelist kvl_200">
|
||||
<?php
|
||||
foreach ($CONFIG as $key => $value)
|
||||
{
|
||||
if ($key === 'extendedgitgraph') continue;
|
||||
|
||||
if (is_array($value))
|
||||
echo '<div><span>' . $key . '</span> <span style="white-space: pre">' . json_encode($value, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE) . '</span></div>' . "\n";
|
||||
else
|
||||
echo '<div><span>' . $key . '</span> <span>' . nl2br(var_export($value, true)) . '</span></div>' . "\n";
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="boxedcontent">
|
||||
<div class="bc_header">Configuration['extendedgitgraph']</div>
|
||||
<div class="bc_data keyvaluelist kvl_200">
|
||||
<?php
|
||||
foreach ($CONFIG['extendedgitgraph'] as $key => $value)
|
||||
{
|
||||
if (is_array($value))
|
||||
echo '<div><span>' . $key . '</span> <span style="white-space: pre">' . json_encode($value, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE) . '</span></div>' . "\n";
|
||||
else
|
||||
echo '<div><span>' . $key . '</span> <span>' . nl2br(var_export($value, true)) . '</span></div>' . "\n";
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<?php include (__DIR__ . '/../fragments/footer.php'); ?>
|
||||
<div class="boxedcontent">
|
||||
<div class="bc_header">Configuration['extendedgitgraph']</div>
|
||||
<div class="bc_data keyvaluelist kvl_200">
|
||||
<?php
|
||||
foreach ($SITE->config['extendedgitgraph'] as $key => $value)
|
||||
{
|
||||
if (is_array($value))
|
||||
echo '<div><span>' . $key . '</span> <span style="white-space: pre">' . json_encode($value, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE) . '</span></div>' . "\n";
|
||||
else
|
||||
echo '<div><span>' . $key . '</span> <span>' . nl2br(var_export($value, true)) . '</span></div>' . "\n";
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<?php printAdditionalScripts(); ?>
|
||||
<?php printAdditionalStylesheets(); ?>
|
||||
</body>
|
||||
</html>
|
@ -1,18 +1,29 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<?php
|
||||
require_once (__DIR__ . '/../internals/base.php');
|
||||
global $OPTIONS;
|
||||
require_once (__DIR__ . '/../internals/website.php');
|
||||
|
||||
/** @var PageFrameOptions $FRAME_OPTIONS */ global $FRAME_OPTIONS;
|
||||
/** @var URLRoute $ROUTE */ global $ROUTE;
|
||||
/** @var Website $SITE */ global $SITE;
|
||||
?>
|
||||
|
||||
<?php
|
||||
$FRAME_OPTIONS->title = 'Login';
|
||||
$FRAME_OPTIONS->canonical_url = 'https://www.mikescher.com/login';
|
||||
$FRAME_OPTIONS->activeHeader = 'login';
|
||||
|
||||
$FRAME_OPTIONS->addScript('/data/javascript/ms_basic.js', true);
|
||||
?>
|
||||
|
||||
<?php
|
||||
$err = false;
|
||||
|
||||
if (key_exists('username', $_GET) && key_exists('password', $_GET) && key_exists('redirect', $_GET))
|
||||
{
|
||||
if ($_GET['username'] === $CONFIG['admin_username'] && $_GET['password'] === $CONFIG['admin_password'])
|
||||
{
|
||||
setLoginCookie($_GET['username'], $_GET['password']);
|
||||
header('Location: ' . $_GET['redirect']);
|
||||
die();
|
||||
if ($_GET['username'] === $SITE->config['admin_username'] && $_GET['password'] === $SITE->config['admin_password'])
|
||||
{
|
||||
$SITE->setLoginCookie($_GET['username'], $_GET['password']);
|
||||
$FRAME_OPTIONS->setForcedRedirect($_GET['redirect']);
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -20,73 +31,49 @@ if (key_exists('username', $_GET) && key_exists('password', $_GET) && key_exists
|
||||
}
|
||||
}
|
||||
|
||||
$redirect = $OPTIONS['login_target'];
|
||||
$redirect = $ROUTE->parameter['login_target'];
|
||||
if (($redirect === '/' || $redirect === '') && isset($_GET['redirect'])) $redirect = $_GET['redirect'];
|
||||
|
||||
if (($redirect === '/' || $redirect === '')) $redirect = '/admin';
|
||||
?>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Mikescher.com - Login</title>
|
||||
<link rel="icon" type="image/png" href="/data/images/favicon.png"/>
|
||||
<link rel="canonical" href="https://www.mikescher.com/login"/>
|
||||
<?php printHeaderCSS(); ?>
|
||||
</head>
|
||||
<body>
|
||||
<div id="mastercontainer">
|
||||
|
||||
<?php $HEADER_ACTIVE = 'login'; include (__DIR__ . '/../fragments/header.php'); ?>
|
||||
<div class="aboutcontent">
|
||||
|
||||
<div id="content" class="content-responsive">
|
||||
<div class="boxedcontent">
|
||||
<div class="bc_header">Mikescher.com - Login</div>
|
||||
|
||||
<div class="aboutcontent">
|
||||
<div class="bc_data">
|
||||
|
||||
<div class="boxedcontent">
|
||||
<div class="bc_header">Mikescher.com - Login</div>
|
||||
<div class="form">
|
||||
<form id="loginform" action="/login" method="GET">
|
||||
|
||||
<div class="bc_data">
|
||||
<?php if ($err): ?>
|
||||
<span class="loginerror">Wrong username or password</span>
|
||||
<?php endif; ?>
|
||||
|
||||
<div class="form">
|
||||
<form id="loginform" action="/login" method="GET">
|
||||
<div>
|
||||
<label for="username" class="required">Username</label>
|
||||
<input name="username" id="username" type="text" autofocus>
|
||||
</div>
|
||||
|
||||
<?php if ($err): ?>
|
||||
<span class="loginerror">Wrong username or password</span>
|
||||
<?php endif; ?>
|
||||
<div>
|
||||
<label for="password">Password</label>
|
||||
<input name="password" id="password" type="password">
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label for="username" class="required">Username</label>
|
||||
<input name="username" id="username" type="text" autofocus >
|
||||
</div>
|
||||
<div style="display: none; visibility: hidden">
|
||||
<label for="redirect">Redirect</label>
|
||||
<input name="redirect" id="redirect" type="text" value="<?php echo $redirect ?>">
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label for="password">Password</label>
|
||||
<input name="password" id="password" type="password">
|
||||
</div>
|
||||
<div>
|
||||
<button class="button" type="submit" name="yt0">Login</button>
|
||||
</div>
|
||||
|
||||
<div style="display: none; visibility: hidden">
|
||||
<label for="redirect">Redirect</label>
|
||||
<input name="redirect" id="redirect" type="text" value="<?php echo $redirect ?>">
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<button class="button" type="submit" name="yt0">Login</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</form>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<?php include (__DIR__ . '/../fragments/footer.php'); ?>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<?php printAdditionalScripts(); ?>
|
||||
<?php printAdditionalStylesheets(); ?>
|
||||
</body>
|
||||
</html>
|
@ -1,27 +1,16 @@
|
||||
<?php
|
||||
require_once (__DIR__ . '/../internals/base.php');
|
||||
global $OPTIONS;
|
||||
|
||||
$redirect = $OPTIONS['logout_target'];
|
||||
|
||||
clearLoginCookie();
|
||||
require_once (__DIR__ . '/../internals/website.php');
|
||||
|
||||
/** @var PageFrameOptions $FRAME_OPTIONS */ global $FRAME_OPTIONS;
|
||||
/** @var URLRoute $ROUTE */ global $ROUTE;
|
||||
/** @var Website $SITE */ global $SITE;
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Mikescher.com - Logout</title>
|
||||
<link rel="icon" type="image/png" href="/data/images/favicon.png"/>
|
||||
<link rel="canonical" href="https://www.mikescher.com/logout"/>
|
||||
<meta http-equiv="refresh" content="1; url=<?php echo $redirect; ?>" />
|
||||
</head>
|
||||
<body>
|
||||
|
||||
|
||||
<?php
|
||||
$redirect = $ROUTE->parameter['logout_target'];
|
||||
$SITE->clearLoginCookie();
|
||||
?>
|
||||
|
||||
You have been logged out
|
||||
<script>
|
||||
setTimeout(function () { window.location.href = "<?php echo $redirect; ?>"; }, 1000);
|
||||
</script>
|
||||
<?php printAdditionalScripts(); ?>
|
||||
<?php printAdditionalStylesheets(); ?>
|
||||
</body>
|
||||
</html>
|
||||
<script> setTimeout(function () { window.location.href = "<?php echo $redirect; ?>"; }, 1000); </script>
|
||||
|
Loading…
Reference in New Issue
Block a user