Show admin page even without db connection
This commit is contained in:
parent
d0aea4e4e7
commit
3f4cc7875d
@ -782,6 +782,12 @@ html, body {
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
.boxedcontent.alertbox {
|
||||
background-color: #F52;
|
||||
font-weight: bold;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.egg_col_x5_0 {
|
||||
fill: #eeeeee;
|
||||
}
|
||||
@ -837,6 +843,7 @@ html, body {
|
||||
.keyvaluelist div span:first-child {
|
||||
font-weight: bold;
|
||||
min-width: 500px;
|
||||
align-self: start;
|
||||
}
|
||||
|
||||
.kvl_100 div span:first-child {
|
||||
|
3
www/data/css/styles.min.css
vendored
3
www/data/css/styles.min.css
vendored
@ -152,6 +152,7 @@ html,body{margin:0;padding:0;height:100%}
|
||||
.about_circles{display:flex;flex-direction:column}
|
||||
.about_circles a{margin:5px 0}
|
||||
.about_circles .iconbutton_light span{text-align:left}
|
||||
.boxedcontent.alertbox{background-color:#F52;font-weight:bold;text-align:center}
|
||||
.egg_col_x5_0{fill:#eee}
|
||||
.egg_col_x5_1{fill:#6bcdff}
|
||||
.egg_col_x5_2{fill:#00a1f3}
|
||||
@ -163,7 +164,7 @@ html,body{margin:0;padding:0;height:100%}
|
||||
.keyvaluelist{display:flex;flex-direction:column}
|
||||
.keyvaluelist div{display:flex;flex-direction:row}
|
||||
.keyvaluelist div span{align-self:center}
|
||||
.keyvaluelist div span:first-child{font-weight:bold;min-width:500px}
|
||||
.keyvaluelist div span:first-child{font-weight:bold;min-width:500px;align-self:start}
|
||||
.kvl_100 div span:first-child{min-width:100px}
|
||||
.kvl_200 div span:first-child{min-width:200px}
|
||||
.kvl_300 div span:first-child{min-width:300px}
|
||||
|
@ -112,6 +112,12 @@
|
||||
|
||||
}
|
||||
|
||||
.boxedcontent.alertbox {
|
||||
background-color: #F52;
|
||||
font-weight: bold;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
@if $CFG_EGG_THEME == 'standard'
|
||||
{
|
||||
// ==== STANDARD ====
|
||||
|
@ -32,6 +32,7 @@
|
||||
span:first-child {
|
||||
font-weight: bold;
|
||||
min-width: 500px;
|
||||
align-self: start;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -4,7 +4,7 @@ function queryStatus(appendix, secret)
|
||||
url: '/api/extendedgitgraph::status?secret='+secret,
|
||||
success: function(result)
|
||||
{
|
||||
let ajaxOutput = $('#egh_ajaxOutput');
|
||||
let ajaxOutput = $('#egg_ajaxOutput');
|
||||
ajaxOutput.val(result + '\r\n' + appendix);
|
||||
ajaxOutput.scrollTop(ajaxOutput[0].scrollHeight);
|
||||
},
|
||||
|
@ -21,6 +21,16 @@ class Database
|
||||
self::$PDO = new PDO($dsn, $CONFIG['user'], $CONFIG['password'], $opt);
|
||||
}
|
||||
|
||||
public static function tryconnect()
|
||||
{
|
||||
try {
|
||||
self::connect();
|
||||
return true;
|
||||
} catch (exception $e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public static function sql_query_num($query)
|
||||
{
|
||||
$r = self::$PDO->query($query)->fetch(PDO::FETCH_NUM)[0];
|
||||
|
@ -13,7 +13,7 @@ require_once (__DIR__ . '/../internals/programs.php');
|
||||
require_once (__DIR__ . '/../internals/books.php');
|
||||
require_once (__DIR__ . '/../internals/updateslog.php');
|
||||
|
||||
Database::connect();
|
||||
$connected = Database::tryconnect();
|
||||
|
||||
$consistency_blog = Blog::checkConsistency();
|
||||
$consistency_prog = Programs::checkConsistency();
|
||||
@ -54,6 +54,12 @@ function dumpConsistency($c) {
|
||||
|
||||
<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">
|
||||
@ -128,6 +134,7 @@ function dumpConsistency($c) {
|
||||
<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>
|
||||
@ -138,6 +145,9 @@ function dumpConsistency($c) {
|
||||
<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>
|
||||
|
||||
@ -160,6 +170,7 @@ function dumpConsistency($c) {
|
||||
<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', '/admin/updates::show?secret=<?php echo $CONFIG['ajax_secret'] ?>&ulname=<?php echo $info['name'] ?>')"><?php echo $info['count_total']; ?></a></span></div>
|
||||
@ -170,6 +181,9 @@ function dumpConsistency($c) {
|
||||
<br/>
|
||||
<div id="ul_ajax_target"></div>
|
||||
</div>
|
||||
<?php else: ?>
|
||||
<div class="bc_data keyvaluelist">Database not connected.</div>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
|
||||
<!-- - - - - - - - - - - - - - - - - - - - - -->
|
||||
@ -177,6 +191,7 @@ function dumpConsistency($c) {
|
||||
<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): ?>
|
||||
@ -193,6 +208,9 @@ function dumpConsistency($c) {
|
||||
<?php endforeach; ?>
|
||||
|
||||
</div>
|
||||
<?php else: ?>
|
||||
<div class="bc_data keyvaluelist">Database not connected.</div>
|
||||
<?php endif; ?>
|
||||
|
||||
</div>
|
||||
|
||||
@ -200,15 +218,34 @@ function dumpConsistency($c) {
|
||||
|
||||
<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;
|
||||
|
||||
<?php foreach ($CONFIG as $key => $value): ?>
|
||||
<div><span><?php echo $key; ?></span> <span><?php echo var_export($value, true); ?></span></div>
|
||||
<?php endforeach; ?>
|
||||
|
||||
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>
|
||||
|
@ -21,6 +21,7 @@ if (key_exists('username', $_GET) && key_exists('password', $_GET) && key_exists
|
||||
}
|
||||
|
||||
$redirect = $OPTIONS['login_target'];
|
||||
if (($redirect === '/' || $redirect === '') && isset($_GET['redirect'])) $redirect = $_GET['redirect'];
|
||||
|
||||
?>
|
||||
<head>
|
||||
|
Loading…
Reference in New Issue
Block a user