/admin/ alephnote
This commit is contained in:
parent
e1fec28368
commit
acc6443b55
1
www/ajax/.htaccess
Normal file
1
www/ajax/.htaccess
Normal file
@ -0,0 +1 @@
|
|||||||
|
Deny from all
|
36
www/ajax/an_activeusers.php
Normal file
36
www/ajax/an_activeusers.php
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
<?php
|
||||||
|
require_once (__DIR__ . '/../internals/base.php');
|
||||||
|
require_once (__DIR__ . '/../internals/database.php');
|
||||||
|
require_once (__DIR__ . '/../internals/alephnoteStatistics.php');
|
||||||
|
|
||||||
|
Database::connect();
|
||||||
|
|
||||||
|
?>
|
||||||
|
<div class="stripedtable_container">
|
||||||
|
<table class="stripedtable">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>ClientID</th>
|
||||||
|
<th>Version</th>
|
||||||
|
<th>Provider</th>
|
||||||
|
<th>NoteCount</th>
|
||||||
|
<th>LastChanged</th>
|
||||||
|
<th>CreatedAt</th>
|
||||||
|
<th>Comment</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<?php foreach (AlephNoteStatistics::getAllActiveEntriesOrdered() as $entry): ?>
|
||||||
|
<tr>
|
||||||
|
<td><?php echo $entry['ClientID']; ?></td>
|
||||||
|
<td><?php echo $entry['Version']; ?></td>
|
||||||
|
<td><?php echo $entry['ProviderStr']; ?></td>
|
||||||
|
<td><?php echo $entry['NoteCount']; ?></td>
|
||||||
|
<td><?php echo $entry['LastChanged']; ?></td>
|
||||||
|
<td><?php echo $entry['CreatedAt']; ?></td>
|
||||||
|
<td><?php echo $entry['Comment']; ?></td>
|
||||||
|
</tr>
|
||||||
|
<?php endforeach; ?>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
14
www/ajax/egh_redraw.php
Normal file
14
www/ajax/egh_redraw.php
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
require_once (__DIR__ . '/../internals/base.php');
|
||||||
|
require_once (__DIR__ . '/../extern/egh/ExtendedGitGraph.php');
|
||||||
|
require_once (__DIR__ . '/../internals/mikeschergitgraph.php');
|
||||||
|
|
||||||
|
set_time_limit(900); // 15min
|
||||||
|
|
||||||
|
$v = MikescherGitGraph::create();
|
||||||
|
$v->init();
|
||||||
|
$v->updateFromCache();
|
||||||
|
$v->generate();
|
||||||
|
|
||||||
|
file_put_contents(__DIR__ . '/../dynamic/egh.html', $v->getAll());
|
15
www/ajax/egh_refresh.php
Normal file
15
www/ajax/egh_refresh.php
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
require_once (__DIR__ . '/../internals/base.php');
|
||||||
|
require_once (__DIR__ . '/../extern/egh/ExtendedGitGraph.php');
|
||||||
|
require_once (__DIR__ . '/../internals/mikeschergitgraph.php');
|
||||||
|
|
||||||
|
set_time_limit(900); // 15min
|
||||||
|
|
||||||
|
$v = MikescherGitGraph::create();
|
||||||
|
$v->init();
|
||||||
|
$v->updateFromRemotes();
|
||||||
|
$v->generate();
|
||||||
|
|
||||||
|
file_put_contents(__DIR__ . '/../dynamic/egh.html', $v->getAll());
|
||||||
|
|
10
www/ajax/egh_status.php
Normal file
10
www/ajax/egh_status.php
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
if (session_status() !== PHP_SESSION_ACTIVE) session_start();
|
||||||
|
|
||||||
|
if (key_exists('ajax_progress_egh_refresh', $_SESSION))
|
||||||
|
echo $_SESSION['ajax_progress_egh_refresh'];
|
||||||
|
else
|
||||||
|
echo '[[ NO SESSION STARTED ]]';
|
||||||
|
|
||||||
|
return;
|
@ -159,6 +159,35 @@ body {
|
|||||||
text-align: center;
|
text-align: center;
|
||||||
font-size: 14pt; }
|
font-size: 14pt; }
|
||||||
|
|
||||||
|
.stripedtable_container {
|
||||||
|
overflow-x: auto; }
|
||||||
|
|
||||||
|
.stripedtable {
|
||||||
|
border-collapse: collapse;
|
||||||
|
text-align: left;
|
||||||
|
width: 100%;
|
||||||
|
border: 1px solid #666; }
|
||||||
|
.stripedtable td, .stripedtable th {
|
||||||
|
padding: 3px 10px; }
|
||||||
|
.stripedtable thead th {
|
||||||
|
background-color: #7D7D7D;
|
||||||
|
color: #FFFFFF;
|
||||||
|
font-weight: bold;
|
||||||
|
border-left: 1px solid #444; }
|
||||||
|
.stripedtable thead th:first-child {
|
||||||
|
border: none; }
|
||||||
|
.stripedtable tbody td {
|
||||||
|
border-left: 1px solid #666;
|
||||||
|
font-weight: normal; }
|
||||||
|
.stripedtable tbody .alt td {
|
||||||
|
background: #EBEBEB; }
|
||||||
|
.stripedtable tbody td:first-child {
|
||||||
|
border-left: none; }
|
||||||
|
.stripedtable tbody tr:last-child td {
|
||||||
|
border-bottom: none; }
|
||||||
|
.stripedtable tbody tr:nth-child(odd) {
|
||||||
|
background-color: #ccc; }
|
||||||
|
|
||||||
/* 400px */
|
/* 400px */
|
||||||
#headerdiv {
|
#headerdiv {
|
||||||
z-index: 999;
|
z-index: 999;
|
||||||
|
10
www/data/css/styles.min.css
vendored
10
www/data/css/styles.min.css
vendored
@ -31,6 +31,16 @@ body{background-color:#EEE;color:#CCC;font-family:serif}
|
|||||||
.iconbutton_light:hover{cursor:pointer;background-color:#555}
|
.iconbutton_light:hover{cursor:pointer;background-color:#555}
|
||||||
.iconbutton_light svg{width:14pt;height:14pt;margin:0 4px;fill:#000}
|
.iconbutton_light svg{width:14pt;height:14pt;margin:0 4px;fill:#000}
|
||||||
.iconbutton_light span{flex-grow:1;text-align:center;font-size:14pt}
|
.iconbutton_light span{flex-grow:1;text-align:center;font-size:14pt}
|
||||||
|
.stripedtable_container{overflow-x:auto}
|
||||||
|
.stripedtable{border-collapse:collapse;text-align:left;width:100%;border:1px solid #666}
|
||||||
|
.stripedtable td,.stripedtable th{padding:3px 10px}
|
||||||
|
.stripedtable thead th{background-color:#7d7d7d;color:#fff;font-weight:bold;border-left:1px solid #444}
|
||||||
|
.stripedtable thead th:first-child{border:0}
|
||||||
|
.stripedtable tbody td{border-left:1px solid #666;font-weight:normal}
|
||||||
|
.stripedtable tbody .alt td{background:#ebebeb}
|
||||||
|
.stripedtable tbody td:first-child{border-left:0}
|
||||||
|
.stripedtable tbody tr:last-child td{border-bottom:0}
|
||||||
|
.stripedtable tbody tr:nth-child(odd){background-color:#ccc}
|
||||||
#headerdiv{z-index:999;background-color:#333;display:flex;border-bottom:1px solid #111;box-shadow:0 0 8px #000;position:fixed;width:100%}
|
#headerdiv{z-index:999;background-color:#333;display:flex;border-bottom:1px solid #111;box-shadow:0 0 8px #000;position:fixed;width:100%}
|
||||||
#headerdiv .logowrapper{flex:initial;margin:0;padding:0;height:42px}
|
#headerdiv .logowrapper{flex:initial;margin:0;padding:0;height:42px}
|
||||||
#headerdiv .logowrapper .logo{min-width:197.5px;height:30px;margin:4px 0 8px 6px;flex:initial}
|
#headerdiv .logowrapper .logo{min-width:197.5px;height:30px;margin:4px 0 8px 6px;flex:initial}
|
||||||
|
@ -182,5 +182,51 @@ body {
|
|||||||
|
|
||||||
font-size: 14pt;
|
font-size: 14pt;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.stripedtable_container {
|
||||||
|
overflow-x: auto;
|
||||||
|
}
|
||||||
|
.stripedtable
|
||||||
|
{
|
||||||
|
border-collapse: collapse;
|
||||||
|
text-align: left;
|
||||||
|
width: 100%;
|
||||||
|
border: 1px solid #666;
|
||||||
|
|
||||||
|
td, th {
|
||||||
|
padding: 3px 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
thead th {
|
||||||
|
background-color: #7D7D7D;
|
||||||
|
color: #FFFFFF;
|
||||||
|
font-weight: bold;
|
||||||
|
border-left: 1px solid #444;
|
||||||
|
}
|
||||||
|
|
||||||
|
thead th:first-child {
|
||||||
|
border: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
tbody td {
|
||||||
|
border-left: 1px solid #666;
|
||||||
|
font-weight: normal;
|
||||||
|
}
|
||||||
|
|
||||||
|
tbody .alt td {
|
||||||
|
background: #EBEBEB;
|
||||||
|
}
|
||||||
|
|
||||||
|
tbody td:first-child {
|
||||||
|
border-left: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
tbody tr:last-child td {
|
||||||
|
border-bottom: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
tbody tr:nth-child(odd) {
|
||||||
|
background-color: #ccc;
|
||||||
|
}
|
||||||
}
|
}
|
@ -53,3 +53,20 @@ function startAjaxRedraw(secret)
|
|||||||
async: true
|
async: true
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function startAjaxReplace(target, url)
|
||||||
|
{
|
||||||
|
$(target).html("Waiting ...");
|
||||||
|
jQuery.ajax({
|
||||||
|
url: url,
|
||||||
|
success: function(result)
|
||||||
|
{
|
||||||
|
$(target).html(result);
|
||||||
|
},
|
||||||
|
error: function( jqXHR, textStatus, errorThrown)
|
||||||
|
{
|
||||||
|
$(target).html('AN ERROR OCCURED:' + '<br/>' + textStatus);
|
||||||
|
},
|
||||||
|
async: true
|
||||||
|
});
|
||||||
|
}
|
@ -37,7 +37,10 @@ $URL_RULES =
|
|||||||
[ 'url' => ['api', 'statsping'], 'target' => 'pages/api_stats.php', 'options' => [ 'Name' => '%GET%', 'ClientID' => '%GET%', 'Version' => '%GET%', 'ProviderStr' => '%GET%', 'ProviderID' => '%GET%', 'NoteCount' => '%GET%', ], ],
|
[ 'url' => ['api', 'statsping'], 'target' => 'pages/api_stats.php', 'options' => [ 'Name' => '%GET%', 'ClientID' => '%GET%', 'Version' => '%GET%', 'ProviderStr' => '%GET%', 'ProviderID' => '%GET%', 'NoteCount' => '%GET%', ], ],
|
||||||
|
|
||||||
[ 'url' => ['admin'], 'target' => 'pages/admin.php', 'options' => [ '_opt' => 'password'], ],
|
[ 'url' => ['admin'], 'target' => 'pages/admin.php', 'options' => [ '_opt' => 'password'], ],
|
||||||
[ 'url' => ['admin', 'egh', '?{cmd}'], 'target' => 'pages/admin_egh.php', 'options' => [ 'cmd' => '%URL%', 'secret' => '%GET%' ], ],
|
|
||||||
|
[ 'url' => ['admin', 'egh', '?{cmd}'], 'target' => 'pages/su_ajax.php', 'options' => [ 'suffix' => 'egh', 'cmd' => '%URL%', 'secret' => '%GET%' ], ],
|
||||||
|
[ 'url' => ['su_ajax', '?{cmd}'], 'target' => 'pages/su_ajax.php', 'options' => [ 'suffix' => '', 'cmd' => '%URL%', 'secret' => '%GET%' ], ],
|
||||||
|
[ 'url' => ['su_ajax'], 'target' => 'pages/su_ajax.php', 'options' => [ 'suffix' => '', 'cmd' => '%GET%', 'secret' => '%GET%' ], ],
|
||||||
|
|
||||||
[ 'url' => ['blog'], 'target' => 'pages/blog_list.php', 'options' => [], ],
|
[ 'url' => ['blog'], 'target' => 'pages/blog_list.php', 'options' => [], ],
|
||||||
[ 'url' => ['log'], 'target' => 'pages/blog_list.php', 'options' => [], ],
|
[ 'url' => ['log'], 'target' => 'pages/blog_list.php', 'options' => [], ],
|
||||||
|
26
www/internals/alephnoteStatistics.php
Normal file
26
www/internals/alephnoteStatistics.php
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
<?php if(count(get_included_files()) ==1) exit("Direct access not permitted.");
|
||||||
|
|
||||||
|
require_once (__DIR__ . '/../internals/database.php');
|
||||||
|
|
||||||
|
class AlephNoteStatistics
|
||||||
|
{
|
||||||
|
public static function getTotalUserCount()
|
||||||
|
{
|
||||||
|
return Database::sql_query_num('SELECT COUNT(*) FROM ms4_an_statslog WHERE NoteCount>0');
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function getUserCountFromLastVersion()
|
||||||
|
{
|
||||||
|
return Database::sql_query_num('SELECT COUNT(*) FROM ms4_an_statslog WHERE NoteCount>0 AND Version = (SELECT Version FROM ms4_an_statslog ORDER BY Version DESC LIMIT 1)');
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function getActiveUserCount($days)
|
||||||
|
{
|
||||||
|
return Database::sql_query_num('SELECT COUNT(*) FROM ms4_an_statslog WHERE NoteCount>0 AND LastChanged > NOW() - INTERVAL '.$days.' DAY');
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function getAllActiveEntriesOrdered()
|
||||||
|
{
|
||||||
|
return Database::sql_query_assoc('SELECT * FROM ms4_an_statslog WHERE NoteCount>0 ORDER BY LastChanged DESC');
|
||||||
|
}
|
||||||
|
}
|
29
www/internals/mikeschergitgraph.php
Normal file
29
www/internals/mikeschergitgraph.php
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
<?php if(count(get_included_files()) ==1) exit("Direct access not permitted.");
|
||||||
|
|
||||||
|
require_once (__DIR__ . '/../internals/base.php');
|
||||||
|
require_once (__DIR__ . '/../extern/egh/ExtendedGitGraph.php');
|
||||||
|
|
||||||
|
class MikescherGitGraph
|
||||||
|
{
|
||||||
|
public static function create()
|
||||||
|
{
|
||||||
|
global $CONFIG;
|
||||||
|
|
||||||
|
$v = new ExtendedGitGraph(__DIR__ . '/../temp/egh_cache.bin', ExtendedGitGraph::OUT_SESSION, __DIR__ . '/../temp/egh_log{num}.log');
|
||||||
|
|
||||||
|
$v->addRemote('github-user', null, 'Mikescher', 'Mikescher');
|
||||||
|
//$v->addRemote('github-user', null, 'Mikescher', 'Sam-Development');
|
||||||
|
//$v->addRemote('github-repository', null, 'Mikescher', 'Anastron/ColorRunner');
|
||||||
|
$v->addRemote('gitea-repository', null, 'Mikescher', 'Mikescher/server-scripts');
|
||||||
|
$v->addRemote('gitea-repository', null, 'Mikescher', 'Mikescher/apache-sites');
|
||||||
|
$v->addRemote('gitea-repository', null, 'Mikescher', 'Mikescher/MVU_API');
|
||||||
|
|
||||||
|
$v->setColorScheme($CONFIG['egh_theme']);
|
||||||
|
|
||||||
|
$v->ConnectionGithub->setAPIToken($CONFIG['egh_token']);
|
||||||
|
|
||||||
|
$v->ConnectionGitea->setURL('https://gogs.mikescher.com');
|
||||||
|
|
||||||
|
return $v;
|
||||||
|
}
|
||||||
|
}
|
@ -62,14 +62,15 @@ Database::connect();
|
|||||||
|
|
||||||
<div class="bc_data">
|
<div class="bc_data">
|
||||||
<div class="keyvaluelist kvl_200">
|
<div class="keyvaluelist kvl_200">
|
||||||
<div><span>Total users:</span> <span><?php echo 0; ?></span></div>
|
<div><span>Total users:</span> <span><?php echo AlephNoteStatistics::getTotalUserCount(); ?></span></div>
|
||||||
<div><span>Users on latest version:</span> <span><?php echo 0; ?></span></div>
|
<div><span>Users on latest version:</span> <span><?php echo AlephNoteStatistics::getUserCountFromLastVersion(); ?></span></div>
|
||||||
<div><span>Active users:</span> <span><?php echo 0; ?></span></div>
|
<div><span>Active users:</span> <span><?php echo AlephNoteStatistics::getActiveUserCount(32); ?></span></div>
|
||||||
</div>
|
</div>
|
||||||
|
<br/>
|
||||||
<div id="an_ajax_target"></div>
|
<div id="an_ajax_target"></div>
|
||||||
|
<br/>
|
||||||
|
|
||||||
<a class="button" href="javascript:showAlephNoteData('<?php echo $CONFIG['ajax_secret'] ?>')">Show</a>
|
<a class="button" href="javascript:startAjaxReplace('#an_ajax_target', '/su_ajax/alephNoteTable?secret=<?php echo $CONFIG['ajax_secret'] ?>')">Show</a>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -1,70 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
require_once (__DIR__ . '/../internals/base.php');
|
|
||||||
require_once (__DIR__ . '/../extern/egh/ExtendedGitGraph.php');
|
|
||||||
|
|
||||||
$cmd = $OPTIONS['cmd'];
|
|
||||||
$secret = $OPTIONS['secret'];
|
|
||||||
|
|
||||||
if ($secret !== $CONFIG['ajax_secret'])
|
|
||||||
die('Unauthorized.');
|
|
||||||
|
|
||||||
function create()
|
|
||||||
{
|
|
||||||
global $CONFIG;
|
|
||||||
|
|
||||||
$v = new ExtendedGitGraph(__DIR__ . '/../temp/egh_cache.bin', ExtendedGitGraph::OUT_SESSION, __DIR__ . '/../temp/egh_log{num}.log');
|
|
||||||
|
|
||||||
$v->addRemote('github-user', null, 'Mikescher', 'Mikescher');
|
|
||||||
//$v->addRemote('github-user', null, 'Mikescher', 'Sam-Development');
|
|
||||||
//$v->addRemote('github-repository', null, 'Mikescher', 'Anastron/ColorRunner');
|
|
||||||
$v->addRemote('gitea-repository', null, 'Mikescher', 'Mikescher/server-scripts');
|
|
||||||
$v->addRemote('gitea-repository', null, 'Mikescher', 'Mikescher/apache-sites');
|
|
||||||
$v->addRemote('gitea-repository', null, 'Mikescher', 'Mikescher/MVU_API');
|
|
||||||
|
|
||||||
$v->setColorScheme($CONFIG['egh_theme']);
|
|
||||||
|
|
||||||
$v->ConnectionGithub->setAPIToken($CONFIG['egh_token']);
|
|
||||||
|
|
||||||
$v->ConnectionGitea->setURL('https://gogs.mikescher.com');
|
|
||||||
|
|
||||||
return $v;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($cmd === 'status')
|
|
||||||
{
|
|
||||||
if (session_status() !== PHP_SESSION_ACTIVE) session_start();
|
|
||||||
|
|
||||||
if (key_exists('ajax_progress_egh_refresh', $_SESSION))
|
|
||||||
echo $_SESSION['ajax_progress_egh_refresh'];
|
|
||||||
else
|
|
||||||
echo '[[ NO SESSION STARTED ]]';
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
else if ($cmd === 'refresh')
|
|
||||||
{
|
|
||||||
set_time_limit(900); // 15min
|
|
||||||
|
|
||||||
$v = create();
|
|
||||||
$v->init();
|
|
||||||
$v->updateFromRemotes();
|
|
||||||
$v->generate();
|
|
||||||
|
|
||||||
file_put_contents(__DIR__ . '/../dynamic/egh.html', $v->getAll());
|
|
||||||
}
|
|
||||||
else if ($cmd === 'redraw')
|
|
||||||
{
|
|
||||||
set_time_limit(900); // 15min
|
|
||||||
|
|
||||||
$v = create();
|
|
||||||
$v->init();
|
|
||||||
$v->updateFromCache();
|
|
||||||
$v->generate();
|
|
||||||
|
|
||||||
file_put_contents(__DIR__ . '/../dynamic/egh.html', $v->getAll());
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
die('Wrong command.');
|
|
||||||
}
|
|
20
www/pages/su_ajax.php
Normal file
20
www/pages/su_ajax.php
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
require_once (__DIR__ . '/../internals/base.php');
|
||||||
|
require_once (__DIR__ . '/../extern/egh/ExtendedGitGraph.php');
|
||||||
|
|
||||||
|
$cmd = $OPTIONS['cmd'];
|
||||||
|
$secret = $OPTIONS['secret'];
|
||||||
|
|
||||||
|
if (isset($OPTIONS['suffix'])) $cmd = $OPTIONS['suffix'] . '::' . $cmd;
|
||||||
|
$cmd = strtolower($cmd);
|
||||||
|
|
||||||
|
if ($secret !== $CONFIG['ajax_secret']) die('Unauthorized.');
|
||||||
|
|
||||||
|
if ($cmd === 'egh::status') { include (__DIR__ . '/../ajax/egh_status.php'); exit; }
|
||||||
|
if ($cmd === 'egh::refresh') { include (__DIR__ . '/../ajax/egh_refresh.php'); exit; }
|
||||||
|
if ($cmd === 'egh::redraw') { include (__DIR__ . '/../ajax/egh_redraw.php'); exit; }
|
||||||
|
|
||||||
|
if ($cmd === 'alephnotetable') { include (__DIR__ . '/../ajax/an_activeusers.php'); exit; }
|
||||||
|
|
||||||
|
die('Wrong command.');
|
Loading…
Reference in New Issue
Block a user