1
0

/admin/ alephnote

This commit is contained in:
2018-01-27 00:28:32 +01:00
parent e1fec28368
commit acc6443b55
15 changed files with 263 additions and 76 deletions

View File

@@ -62,14 +62,15 @@ Database::connect();
<div class="bc_data">
<div class="keyvaluelist kvl_200">
<div><span>Total users:</span> <span><?php echo 0; ?></span></div>
<div><span>Users on latest version:</span> <span><?php echo 0; ?></span></div>
<div><span>Active 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 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>
<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>

View File

@@ -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
View 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.');