API
This commit is contained in:
@@ -1,9 +1,9 @@
|
||||
<?php
|
||||
require_once (__DIR__ . '/../internals/base.php');
|
||||
require_once (__DIR__ . '/../internals/database.php');
|
||||
require_once (__DIR__ . '/../internals/alephnoteStatistics.php');
|
||||
require_once (__DIR__ . '/../internals/website.php');
|
||||
|
||||
Database::connect();
|
||||
/** @var PageFrameOptions $FRAME_OPTIONS */ global $FRAME_OPTIONS;
|
||||
/** @var URLRoute $ROUTE */ global $ROUTE;
|
||||
/** @var Website $SITE */ global $SITE;
|
||||
|
||||
?>
|
||||
<div class="stripedtable_container">
|
||||
@@ -20,7 +20,7 @@ Database::connect();
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach (AlephNoteStatistics::getAllActiveEntriesOrdered() as $entry): ?>
|
||||
<?php foreach ($SITE->modules->AlephNoteStatistics()->getAllActiveEntriesOrdered() as $entry): ?>
|
||||
<tr>
|
||||
<td><?php echo $entry['ClientID']; ?></td>
|
||||
<td><?php echo $entry['Version']; ?></td>
|
||||
|
||||
@@ -1,16 +1,17 @@
|
||||
<?php
|
||||
require_once (__DIR__ . '/../internals/website.php');
|
||||
|
||||
global $API_OPTIONS;
|
||||
/** @var PageFrameOptions $FRAME_OPTIONS */ global $FRAME_OPTIONS;
|
||||
/** @var URLRoute $ROUTE */ global $ROUTE;
|
||||
/** @var Website $SITE */ global $SITE;
|
||||
|
||||
require_once (__DIR__ . '/../internals/base.php');
|
||||
require_once (__DIR__ . '/../internals/database.php');
|
||||
|
||||
if (!isset($API_OPTIONS['name'])) httpDie(400, "Wrong parameters.");
|
||||
if (!isset($API_OPTIONS['clientid'])) httpDie(400, "Wrong parameters.");
|
||||
if (!isset($API_OPTIONS['version'])) httpDie(400, "Wrong parameters.");
|
||||
if (!isset($API_OPTIONS['providerstr'])) httpDie(400, "Wrong parameters.");
|
||||
if (!isset($API_OPTIONS['providerid'])) httpDie(400, "Wrong parameters.");
|
||||
if (!isset($API_OPTIONS['notecount'])) httpDie(400, "Wrong parameters.");
|
||||
if (!isset($API_OPTIONS['name'])) { $FRAME_OPTIONS->forceResult(400, "Wrong parameters."); return; }
|
||||
if (!isset($API_OPTIONS['clientid'])) { $FRAME_OPTIONS->forceResult(400, "Wrong parameters."); return; }
|
||||
if (!isset($API_OPTIONS['version'])) { $FRAME_OPTIONS->forceResult(400, "Wrong parameters."); return; }
|
||||
if (!isset($API_OPTIONS['providerstr'])) { $FRAME_OPTIONS->forceResult(400, "Wrong parameters."); return; }
|
||||
if (!isset($API_OPTIONS['providerid'])) { $FRAME_OPTIONS->forceResult(400, "Wrong parameters."); return; }
|
||||
if (!isset($API_OPTIONS['notecount'])) { $FRAME_OPTIONS->forceResult(400, "Wrong parameters."); return; }
|
||||
|
||||
$nam = $API_OPTIONS['name'];
|
||||
$cid = $API_OPTIONS['clientid'];
|
||||
@@ -22,9 +23,7 @@ $tnc = $API_OPTIONS['notecount'];
|
||||
if ($nam !== 'AlephNote') print('{"success":false, "message":"Unknown AppName"}');
|
||||
|
||||
|
||||
Database::connect();
|
||||
|
||||
Database::sql_exec_prep('INSERT INTO an_statslog (ClientID, Version, ProviderStr, ProviderID, NoteCount) VALUES (:cid1, :ver1, :prv1, :pid1, :tnc1) ON DUPLICATE KEY UPDATE Version=:ver2,ProviderStr=:prv2,ProviderID=:pid2,NoteCount=:tnc2',
|
||||
$SITE->modules->Database()->sql_exec_prep('INSERT INTO an_statslog (ClientID, Version, ProviderStr, ProviderID, NoteCount) VALUES (:cid1, :ver1, :prv1, :pid1, :tnc1) ON DUPLICATE KEY UPDATE Version=:ver2,ProviderStr=:prv2,ProviderID=:pid2,NoteCount=:tnc2',
|
||||
[
|
||||
[':cid1', $cid, PDO::PARAM_STR],
|
||||
[':ver1', $ver, PDO::PARAM_STR],
|
||||
|
||||
@@ -1,3 +1,9 @@
|
||||
<?php
|
||||
require_once (__DIR__ . '/../internals/website.php');
|
||||
|
||||
echo "{}";
|
||||
/** @var PageFrameOptions $FRAME_OPTIONS */ global $FRAME_OPTIONS;
|
||||
/** @var URLRoute $ROUTE */ global $ROUTE;
|
||||
/** @var Website $SITE */ global $SITE;
|
||||
|
||||
|
||||
echo "{}";
|
||||
@@ -1,11 +1,11 @@
|
||||
<?php
|
||||
require_once (__DIR__ . '/../internals/website.php');
|
||||
|
||||
/** @var PageFrameOptions $FRAME_OPTIONS */ global $FRAME_OPTIONS;
|
||||
/** @var URLRoute $ROUTE */ global $ROUTE;
|
||||
/** @var Website $SITE */ global $SITE;
|
||||
|
||||
require_once (__DIR__ . '/../internals/base.php');
|
||||
require_once (__DIR__ . '/../extern/egg/ExtendedGitGraph2.php');
|
||||
require_once (__DIR__ . '/../internals/mikeschergitgraph.php');
|
||||
|
||||
set_time_limit(900); // 15min
|
||||
|
||||
$v = MikescherGitGraph::create();
|
||||
$v->updateCache();
|
||||
|
||||
$v = $SITE->modules->ExtendedGitGraph()->updateCache();
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
<?php
|
||||
require_once (__DIR__ . '/../internals/website.php');
|
||||
|
||||
require_once (__DIR__ . '/../internals/base.php');
|
||||
require_once (__DIR__ . '/../extern/egg/ExtendedGitGraph2.php');
|
||||
require_once (__DIR__ . '/../internals/mikeschergitgraph.php');
|
||||
/** @var PageFrameOptions $FRAME_OPTIONS */ global $FRAME_OPTIONS;
|
||||
/** @var URLRoute $ROUTE */ global $ROUTE;
|
||||
/** @var Website $SITE */ global $SITE;
|
||||
|
||||
set_time_limit(900); // 15min
|
||||
|
||||
$v = MikescherGitGraph::create();
|
||||
$v->update();
|
||||
$v->updateCache();
|
||||
$SITE->modules->ExtendedGitGraph()->update();
|
||||
$SITE->modules->ExtendedGitGraph()->updateCache();
|
||||
|
||||
|
||||
@@ -1,10 +1,14 @@
|
||||
<?php
|
||||
require_once (__DIR__ . '/../internals/website.php');
|
||||
|
||||
global $CONFIG;
|
||||
/** @var PageFrameOptions $FRAME_OPTIONS */ global $FRAME_OPTIONS;
|
||||
/** @var URLRoute $ROUTE */ global $ROUTE;
|
||||
/** @var Website $SITE */ global $SITE;
|
||||
|
||||
if ($CONFIG['extendedgitgraph']['output_file'])
|
||||
|
||||
if ($SITE->config['extendedgitgraph']['output_file'])
|
||||
{
|
||||
$lfile = $CONFIG['extendedgitgraph']['output_filepath'];
|
||||
$lfile = $SITE->config['extendedgitgraph']['output_filepath'];
|
||||
|
||||
if (file_exists($lfile))
|
||||
{
|
||||
@@ -18,11 +22,11 @@ if ($CONFIG['extendedgitgraph']['output_file'])
|
||||
echo '[[ FILE NOT FOUND ]]';
|
||||
}
|
||||
}
|
||||
else if ($CONFIG['extendedgitgraph']['output_file'])
|
||||
else if ($SITE->config['extendedgitgraph']['output_file'])
|
||||
{
|
||||
if (session_status() !== PHP_SESSION_ACTIVE) session_start();
|
||||
|
||||
$svar = $CONFIG['extendedgitgraph']['session_var'];
|
||||
$svar = $SITE->config['extendedgitgraph']['session_var'];
|
||||
|
||||
if (isset($_GET['clear'])) if (key_exists($svar, $_SESSION)) $_SESSION[$svar] = '';
|
||||
|
||||
|
||||
@@ -1,16 +1,21 @@
|
||||
<?php
|
||||
require_once (__DIR__ . '/../internals/website.php');
|
||||
|
||||
require_once (__DIR__ . '/../internals/base.php');
|
||||
require_once (__DIR__ . '/../internals/adventofcode.php');
|
||||
/** @var PageFrameOptions $FRAME_OPTIONS */ global $FRAME_OPTIONS;
|
||||
/** @var URLRoute $ROUTE */ global $ROUTE;
|
||||
/** @var Website $SITE */ global $SITE;
|
||||
|
||||
global $PARAM_AOCCALENDAR;
|
||||
$PARAM_AOCCALENDAR =
|
||||
[
|
||||
'year' => intval($_GET['year']),
|
||||
'nav' => boolval($_GET['nav']),
|
||||
'linkheader' => boolval($_GET['linkheader']),
|
||||
'ajax' => boolval($_GET['ajax']),
|
||||
'frame' => false,
|
||||
'frameid' => strval($_GET['frameid']),
|
||||
];
|
||||
require (__DIR__ . '/../fragments/panel_aoc_calendar.php');
|
||||
|
||||
|
||||
if (!isset($API_OPTIONS['year'])) { $FRAME_OPTIONS->forceResult(400, "Wrong parameters."); return; }
|
||||
if (!isset($API_OPTIONS['nav'])) { $FRAME_OPTIONS->forceResult(400, "Wrong parameters."); return; }
|
||||
if (!isset($API_OPTIONS['linkheader'])) { $FRAME_OPTIONS->forceResult(400, "Wrong parameters."); return; }
|
||||
if (!isset($API_OPTIONS['ajax'])) { $FRAME_OPTIONS->forceResult(400, "Wrong parameters."); return; }
|
||||
|
||||
$year = intval($API_OPTIONS['year']);
|
||||
$shownav = boolval($API_OPTIONS['nav']);
|
||||
$linkheader = boolval($API_OPTIONS['linkheader']);
|
||||
$ajax = boolval($API_OPTIONS['ajax']);
|
||||
$frameid = strval($API_OPTIONS['frameid']);
|
||||
|
||||
$SITE->fragments->PanelAdventOfCodeCalendar($year, $shownav, $linkheader, $ajax, false, $frameid);
|
||||
|
||||
@@ -1,21 +1,21 @@
|
||||
<?php
|
||||
require_once (__DIR__ . '/../internals/website.php');
|
||||
|
||||
global $API_OPTIONS;
|
||||
/** @var PageFrameOptions $FRAME_OPTIONS */ global $FRAME_OPTIONS;
|
||||
/** @var URLRoute $ROUTE */ global $ROUTE;
|
||||
/** @var Website $SITE */ global $SITE;
|
||||
|
||||
require_once (__DIR__ . '/../internals/base.php');
|
||||
require_once (__DIR__ . '/../internals/programs.php');
|
||||
require_once (__DIR__ . '/../internals/updateslog.php');
|
||||
|
||||
if (!isset($API_OPTIONS['name'])) httpDie(400, "Wrong parameters.");
|
||||
if (!isset($API_OPTIONS['name'])) { $FRAME_OPTIONS->forceResult(400, "Wrong parameters."); return; }
|
||||
|
||||
$name = $API_OPTIONS['name'];
|
||||
|
||||
$updatedata = UpdatesLog::listUpdateData();
|
||||
$updatedata = $SITE->modules->UpdatesLog()->listUpdateData();
|
||||
|
||||
if (!array_key_exists($name, $updatedata)) httpError(404, 'Invalid Request - [Name] not found');
|
||||
if (!array_key_exists($name, $updatedata)) { $FRAME_OPTIONS->forceResult(404, 'Invalid Request - [Name] not found'); return; }
|
||||
|
||||
$data = $updatedata[$name];
|
||||
|
||||
UpdatesLog::insert($name, $data['version']);
|
||||
$SITE->modules->UpdatesLog()->insert($name, $data['version']);
|
||||
|
||||
print($name."<hr>".$data['version']."<hr>".$data['url']);
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
<?php
|
||||
require_once (__DIR__ . '/../internals/website.php');
|
||||
|
||||
global $API_OPTIONS;
|
||||
global $OPTIONS;
|
||||
/** @var PageFrameOptions $FRAME_OPTIONS */ global $FRAME_OPTIONS;
|
||||
/** @var URLRoute $ROUTE */ global $ROUTE;
|
||||
/** @var Website $SITE */ global $SITE;
|
||||
|
||||
require_once (__DIR__ . '/../internals/base.php');
|
||||
require_once (__DIR__ . '/../internals/database.php');
|
||||
|
||||
if (!isset($API_OPTIONS['folder'])) httpDie(400, "Wrong parameters.");
|
||||
if (!isset($API_OPTIONS['filename'])) httpDie(400, "Wrong parameters.");
|
||||
if (!isset($API_OPTIONS['folder'])) { $FRAME_OPTIONS->forceResult(400, "Wrong parameters."); return; }
|
||||
if (!isset($API_OPTIONS['filename'])) { $FRAME_OPTIONS->forceResult(400, "Wrong parameters."); return; }
|
||||
|
||||
$folder = $API_OPTIONS['folder'];
|
||||
$filename = $API_OPTIONS['filename'];
|
||||
$uri = $OPTIONS['uri'];
|
||||
$uri = $ROUTE->full_url;
|
||||
|
||||
$reltarget = "Backup/$folder/$filename";
|
||||
|
||||
|
||||
@@ -1,21 +1,27 @@
|
||||
<?php
|
||||
require_once (__DIR__ . '/../internals/website.php');
|
||||
|
||||
global $API_OPTIONS;
|
||||
global $OPTIONS;
|
||||
/** @var PageFrameOptions $FRAME_OPTIONS */ global $FRAME_OPTIONS;
|
||||
/** @var URLRoute $ROUTE */ global $ROUTE;
|
||||
/** @var Website $SITE */ global $SITE;
|
||||
|
||||
require_once (__DIR__ . '/../internals/base.php');
|
||||
require_once (__DIR__ . '/../internals/database.php');
|
||||
|
||||
if (!isset($API_OPTIONS['target'])) httpDie(400, "Wrong parameters.");
|
||||
if (!isset($API_OPTIONS['target'])) { $FRAME_OPTIONS->forceResult(400, "Wrong parameters."); return; }
|
||||
|
||||
$hook = $API_OPTIONS['target'];
|
||||
$uri = $OPTIONS['uri'];
|
||||
$uri = $ROUTE->full_url;
|
||||
|
||||
$cmd = "";
|
||||
|
||||
if ($hook == 'website_mikescher') $cmd = 'git pull';
|
||||
else if ($hook == 'griddominance') $cmd = 'update-gdapi';
|
||||
else httpDie(400, "Unknown webhook: $hook");
|
||||
if ($hook == 'website_mikescher')
|
||||
$cmd = 'git pull';
|
||||
else if ($hook == 'griddominance')
|
||||
$cmd = 'update-gdapi';
|
||||
else
|
||||
{
|
||||
$FRAME_OPTIONS->forceResult(400, "Unknown webhook: $hook");
|
||||
return;
|
||||
}
|
||||
|
||||
$std = shell_exec($cmd);
|
||||
|
||||
|
||||
@@ -1,4 +1,9 @@
|
||||
<?php
|
||||
require_once (__DIR__ . '/../internals/website.php');
|
||||
|
||||
/** @var PageFrameOptions $FRAME_OPTIONS */ global $FRAME_OPTIONS;
|
||||
/** @var URLRoute $ROUTE */ global $ROUTE;
|
||||
/** @var Website $SITE */ global $SITE;
|
||||
|
||||
$ip = get_client_ip();
|
||||
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
<?php
|
||||
require_once (__DIR__ . '/../internals/website.php');
|
||||
|
||||
global $OPTIONS;
|
||||
/** @var PageFrameOptions $FRAME_OPTIONS */ global $FRAME_OPTIONS;
|
||||
/** @var URLRoute $ROUTE */ global $ROUTE;
|
||||
/** @var Website $SITE */ global $SITE;
|
||||
|
||||
require_once (__DIR__ . '/../internals/base.php');
|
||||
require_once (__DIR__ . '/../internals/books.php');
|
||||
require_once (__DIR__ . '/../internals/programs.php');
|
||||
|
||||
echo '<!DOCTYPE html>';
|
||||
echo '<html lang="en">';
|
||||
@@ -17,10 +17,10 @@ echo '<meta http-equiv="refresh" content="3; url=/admin; ?>" />';
|
||||
echo '</head>';
|
||||
echo '<body>';
|
||||
|
||||
foreach (Books::listAll() as $book)
|
||||
foreach ($SITE->modules->Books()->listAll() as $book)
|
||||
{
|
||||
echo 'Create preview for ' . $book['title'] . '<br/>' . "\n";
|
||||
Books::createPreview($book);
|
||||
$SITE->modules->Books()->createPreview($book);
|
||||
}
|
||||
echo 'Finished.' . '<br/>' . "\n";
|
||||
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
<?php
|
||||
require_once (__DIR__ . '/../internals/website.php');
|
||||
|
||||
global $OPTIONS;
|
||||
/** @var PageFrameOptions $FRAME_OPTIONS */ global $FRAME_OPTIONS;
|
||||
/** @var URLRoute $ROUTE */ global $ROUTE;
|
||||
/** @var Website $SITE */ global $SITE;
|
||||
|
||||
require_once (__DIR__ . '/../internals/base.php');
|
||||
require_once (__DIR__ . '/../internals/books.php');
|
||||
require_once (__DIR__ . '/../internals/programs.php');
|
||||
|
||||
echo '<!DOCTYPE html>';
|
||||
echo '<html lang="en">';
|
||||
@@ -17,10 +17,10 @@ echo '<meta http-equiv="refresh" content="3;url=/admin;"/>';
|
||||
echo '</head>';
|
||||
echo '<body>';
|
||||
|
||||
foreach (Programs::listAll() as $prog)
|
||||
foreach ($SITE->modules->Programs()->listAll() as $prog)
|
||||
{
|
||||
echo 'Create preview for ' . $prog['name'] . '<br/>' . "\n";
|
||||
Programs::createPreview($prog);
|
||||
$SITE->modules->Programs()->createPreview($prog);
|
||||
}
|
||||
echo 'Finished.' . '<br/>' . "\n";
|
||||
|
||||
|
||||
@@ -1,10 +1,9 @@
|
||||
<?php
|
||||
require_once (__DIR__ . '/../internals/base.php');
|
||||
require_once (__DIR__ . '/../internals/database.php');
|
||||
require_once (__DIR__ . '/../internals/updateslog.php');
|
||||
|
||||
Database::connect();
|
||||
require_once (__DIR__ . '/../internals/website.php');
|
||||
|
||||
/** @var PageFrameOptions $FRAME_OPTIONS */ global $FRAME_OPTIONS;
|
||||
/** @var URLRoute $ROUTE */ global $ROUTE;
|
||||
/** @var Website $SITE */ global $SITE;
|
||||
?>
|
||||
<div class="stripedtable_container" style="width: 100%;">
|
||||
<table class="stripedtable">
|
||||
@@ -16,7 +15,7 @@ Database::connect();
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach (UpdatesLog::getEntries($_GET['ulname'], 512) as $entry): ?>
|
||||
<?php foreach ($SITE->modules->UpdatesLog()->getEntries($_GET['ulname'], 512) as $entry): ?>
|
||||
<tr>
|
||||
<td><?php echo $entry['ip']; ?></td>
|
||||
<td><?php echo $entry['version']; ?></td>
|
||||
|
||||
Reference in New Issue
Block a user