API
This commit is contained in:
parent
5302868327
commit
f5a9552dbd
@ -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>
|
||||
|
9
www/frames/api_frame.php
Normal file
9
www/frames/api_frame.php
Normal file
@ -0,0 +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;
|
||||
|
||||
print($FRAME_OPTIONS->raw);
|
128
www/index.php
128
www/index.php
@ -7,77 +7,77 @@ $site->init();
|
||||
|
||||
$URL_RULES =
|
||||
[
|
||||
[ 'url' => [], 'target' => 'main.php', 'options' => [ 'http' ], 'parameter' => [ ], ],
|
||||
[ 'url' => ['index'], 'target' => 'main.php', 'options' => [ 'http' ], 'parameter' => [ ], ],
|
||||
[ 'url' => ['index.php'], 'target' => 'main.php', 'options' => [ 'http' ], 'parameter' => [ ], ],
|
||||
[ 'url' => ['msmain', 'index'], 'target' => 'main.php', 'options' => [ 'http' ], 'parameter' => [ ], ],
|
||||
[ 'url' => ['about'], 'target' => 'about.php', 'options' => [ 'http' ], 'parameter' => [ ], ],
|
||||
[ 'url' => ['msmain', 'about'], 'target' => 'about.php', 'options' => [ 'http' ], 'parameter' => [ ], ],
|
||||
[ 'url' => ['login'], 'target' => 'login.php', 'options' => [ 'http' ], 'parameter' => [ 'login_target' => '/' ], ],
|
||||
[ 'url' => ['logout'], 'target' => 'logout.php', 'options' => [ 'http' ], 'parameter' => [ 'logout_target' => '/' ], ],
|
||||
[ 'url' => [], 'target' => 'main.php', 'options' => [ 'http' ], 'parameter' => [ ], ],
|
||||
[ 'url' => ['index'], 'target' => 'main.php', 'options' => [ 'http' ], 'parameter' => [ ], ],
|
||||
[ 'url' => ['index.php'], 'target' => 'main.php', 'options' => [ 'http' ], 'parameter' => [ ], ],
|
||||
[ 'url' => ['msmain', 'index'], 'target' => 'main.php', 'options' => [ 'http' ], 'parameter' => [ ], ],
|
||||
[ 'url' => ['about'], 'target' => 'about.php', 'options' => [ 'http' ], 'parameter' => [ ], ],
|
||||
[ 'url' => ['msmain', 'about'], 'target' => 'about.php', 'options' => [ 'http' ], 'parameter' => [ ], ],
|
||||
[ 'url' => ['login'], 'target' => 'login.php', 'options' => [ 'http' ], 'parameter' => [ 'login_target' => '/' ], ],
|
||||
[ 'url' => ['logout'], 'target' => 'logout.php', 'options' => [ 'http' ], 'parameter' => [ 'logout_target' => '/' ], ],
|
||||
|
||||
[ 'url' => ['programs'], 'target' => 'programs_list.php', 'options' => [ 'http' ], 'parameter' => [ 'categoryfilter' => '' ], ],
|
||||
[ 'url' => ['programs', 'index'], 'target' => 'programs_list.php', 'options' => [ 'http' ], 'parameter' => [ 'categoryfilter' => '%GET%' ], ],
|
||||
[ 'url' => ['programs', 'index'], 'target' => 'programs_list.php', 'options' => [ 'http' ], 'parameter' => [ 'categoryfilter' => '' ], ],
|
||||
[ 'url' => ['programs', 'cat', '?{categoryfilter}'], 'target' => 'programs_list.php', 'options' => [ 'http' ], 'parameter' => [ 'categoryfilter' => '%URL%' ], ],
|
||||
[ 'url' => ['downloads', 'details.php'], 'target' => 'programs_list.php', 'options' => [ 'http' ], 'parameter' => [ 'categoryfilter' => '' ], ],
|
||||
[ 'url' => ['downloads', 'downloads.php'], 'target' => 'programs_list.php', 'options' => [ 'http' ], 'parameter' => [ 'categoryfilter' => '' ], ],
|
||||
[ 'url' => ['programs', 'view', '?{id}'], 'target' => 'programs_view.php', 'options' => [ 'http' ], 'parameter' => [ 'id' => '%URL%' ], ],
|
||||
[ 'url' => ['programs', 'view'], 'target' => 'programs_view.php', 'options' => [ 'http' ], 'parameter' => [ 'id' => '%GET%' ], ],
|
||||
[ 'url' => ['downloads', '?{id}'], 'target' => 'programs_download.php', 'options' => [ 'http' ], 'parameter' => [ 'id' => '%URL%' ], ],
|
||||
[ 'url' => ['programs', 'download', '?{id}'], 'target' => 'programs_download.php', 'options' => [ 'http' ], 'parameter' => [ 'id' => '%URL%' ], ],
|
||||
[ 'url' => ['programs', 'download'], 'target' => 'programs_download.php', 'options' => [ 'http' ], 'parameter' => [ 'id' => '%GET%' ], ],
|
||||
[ 'url' => ['programs'], 'target' => 'programs_list.php', 'options' => [ 'http' ], 'parameter' => [ 'categoryfilter' => '' ], ],
|
||||
[ 'url' => ['programs', 'index'], 'target' => 'programs_list.php', 'options' => [ 'http' ], 'parameter' => [ 'categoryfilter' => '%GET%' ], ],
|
||||
[ 'url' => ['programs', 'index'], 'target' => 'programs_list.php', 'options' => [ 'http' ], 'parameter' => [ 'categoryfilter' => '' ], ],
|
||||
[ 'url' => ['programs', 'cat', '?{categoryfilter}'], 'target' => 'programs_list.php', 'options' => [ 'http' ], 'parameter' => [ 'categoryfilter' => '%URL%' ], ],
|
||||
[ 'url' => ['downloads', 'details.php'], 'target' => 'programs_list.php', 'options' => [ 'http' ], 'parameter' => [ 'categoryfilter' => '' ], ],
|
||||
[ 'url' => ['downloads', 'downloads.php'], 'target' => 'programs_list.php', 'options' => [ 'http' ], 'parameter' => [ 'categoryfilter' => '' ], ],
|
||||
[ 'url' => ['programs', 'view', '?{id}'], 'target' => 'programs_view.php', 'options' => [ 'http' ], 'parameter' => [ 'id' => '%URL%' ], ],
|
||||
[ 'url' => ['programs', 'view'], 'target' => 'programs_view.php', 'options' => [ 'http' ], 'parameter' => [ 'id' => '%GET%' ], ],
|
||||
[ 'url' => ['downloads', '?{id}'], 'target' => 'programs_download.php', 'options' => [ 'http' ], 'parameter' => [ 'id' => '%URL%' ], ],
|
||||
[ 'url' => ['programs', 'download', '?{id}'], 'target' => 'programs_download.php', 'options' => [ 'http' ], 'parameter' => [ 'id' => '%URL%' ], ],
|
||||
[ 'url' => ['programs', 'download'], 'target' => 'programs_download.php', 'options' => [ 'http' ], 'parameter' => [ 'id' => '%GET%' ], ],
|
||||
|
||||
[ 'url' => ['books'], 'target' => 'books_list.php', 'options' => [ 'http' ], 'parameter' => [ ], ],
|
||||
[ 'url' => ['books', 'list'], 'target' => 'books_list.php', 'options' => [ 'http' ], 'parameter' => [ ], ],
|
||||
[ 'url' => ['books', 'view', '?{id}'], 'target' => 'books_view.php', 'options' => [ 'http' ], 'parameter' => [ 'id' => '%GET%' ], ],
|
||||
[ 'url' => ['books', 'view', '?{id}', '*'], 'target' => 'books_view.php', 'options' => [ 'http' ], 'parameter' => [ 'id' => '%URL%' ], ],
|
||||
[ 'url' => ['books'], 'target' => 'books_list.php', 'options' => [ 'http' ], 'parameter' => [ ], ],
|
||||
[ 'url' => ['books', 'list'], 'target' => 'books_list.php', 'options' => [ 'http' ], 'parameter' => [ ], ],
|
||||
[ 'url' => ['books', 'view', '?{id}'], 'target' => 'books_view.php', 'options' => [ 'http' ], 'parameter' => [ 'id' => '%GET%' ], ],
|
||||
[ 'url' => ['books', 'view', '?{id}', '*'], 'target' => 'books_view.php', 'options' => [ 'http' ], 'parameter' => [ 'id' => '%URL%' ], ],
|
||||
|
||||
[ 'url' => ['update.php'], 'target' => 'api.php', 'options' => [ 'http' ], 'parameter' => [ 'cmd' => 'progs::updatecheck' ], ],
|
||||
[ 'url' => ['update.php', '?{Name}'], 'target' => 'api.php', 'options' => [ 'http' ], 'parameter' => [ 'cmd' => 'progs::updatecheck' ], ],
|
||||
[ 'url' => ['update'], 'target' => 'api.php', 'options' => [ 'http' ], 'parameter' => [ 'cmd' => 'progs::updatecheck' ], ],
|
||||
[ 'url' => ['update', '?{Name}'], 'target' => 'api.php', 'options' => [ 'http' ], 'parameter' => [ 'cmd' => 'progs::updatecheck' ], ],
|
||||
[ 'url' => ['update2'], 'target' => 'api.php', 'options' => [ 'http' ], 'parameter' => [ 'cmd' => 'progs::updatecheck' ], ],
|
||||
[ 'url' => ['api', 'update'], 'target' => 'api.php', 'options' => [ 'http' ], 'parameter' => [ 'cmd' => 'progs::updatecheck' ], ],
|
||||
[ 'url' => ['api', 'update', '?{Name}'], 'target' => 'api.php', 'options' => [ 'http' ], 'parameter' => [ 'cmd' => 'progs::updatecheck' ], ],
|
||||
[ 'url' => ['api', 'test'], 'target' => 'api.php', 'options' => [ 'http' ], 'parameter' => [ 'cmd' => 'base::test' ], ],
|
||||
[ 'url' => ['api', 'setselfadress'], 'target' => 'api.php', 'options' => [ 'http' ], 'parameter' => [ 'cmd' => 'server::setselfaddress' ], ],
|
||||
[ 'url' => ['api', 'statsping'], 'target' => 'api.php', 'options' => [ 'http' ], 'parameter' => [ 'cmd' => 'alephnote::statsping' ], ],
|
||||
[ 'url' => ['api', 'webhook', '?{target}'], 'target' => 'api.php', 'options' => [ 'http' ], 'parameter' => [ 'cmd' => 'server::gitwebhook' ], ],
|
||||
[ 'url' => ['api', 'backupupload'], 'target' => 'api.php', 'options' => [ 'http' ], 'parameter' => [ 'cmd' => 'server::backupupload' ], ],
|
||||
[ 'url' => ['api', '?{cmd}'], 'target' => 'api.php', 'options' => [ ], 'parameter' => [ 'cmd' => '%URL%' ], ],
|
||||
[ 'url' => ['update.php'], 'target' => 'api.php', 'options' => [ 'http', 'api' ], 'parameter' => [ 'cmd' => 'progs::updatecheck' ], ],
|
||||
[ 'url' => ['update.php', '?{Name}'], 'target' => 'api.php', 'options' => [ 'http', 'api' ], 'parameter' => [ 'cmd' => 'progs::updatecheck' ], ],
|
||||
[ 'url' => ['update'], 'target' => 'api.php', 'options' => [ 'http', 'api' ], 'parameter' => [ 'cmd' => 'progs::updatecheck' ], ],
|
||||
[ 'url' => ['update', '?{Name}'], 'target' => 'api.php', 'options' => [ 'http', 'api' ], 'parameter' => [ 'cmd' => 'progs::updatecheck' ], ],
|
||||
[ 'url' => ['update2'], 'target' => 'api.php', 'options' => [ 'http', 'api' ], 'parameter' => [ 'cmd' => 'progs::updatecheck' ], ],
|
||||
[ 'url' => ['api', 'update'], 'target' => 'api.php', 'options' => [ 'http', 'api' ], 'parameter' => [ 'cmd' => 'progs::updatecheck' ], ],
|
||||
[ 'url' => ['api', 'update', '?{Name}'], 'target' => 'api.php', 'options' => [ 'http', 'api' ], 'parameter' => [ 'cmd' => 'progs::updatecheck' ], ],
|
||||
[ 'url' => ['api', 'test'], 'target' => 'api.php', 'options' => [ 'http', 'api' ], 'parameter' => [ 'cmd' => 'base::test' ], ],
|
||||
[ 'url' => ['api', 'setselfadress'], 'target' => 'api.php', 'options' => [ 'http', 'api' ], 'parameter' => [ 'cmd' => 'server::setselfaddress' ], ],
|
||||
[ 'url' => ['api', 'statsping'], 'target' => 'api.php', 'options' => [ 'http', 'api' ], 'parameter' => [ 'cmd' => 'alephnote::statsping' ], ],
|
||||
[ 'url' => ['api', 'webhook', '?{target}'], 'target' => 'api.php', 'options' => [ 'http', 'api' ], 'parameter' => [ 'cmd' => 'server::gitwebhook' ], ],
|
||||
[ 'url' => ['api', 'backupupload'], 'target' => 'api.php', 'options' => [ 'http', 'api' ], 'parameter' => [ 'cmd' => 'server::backupupload' ], ],
|
||||
[ 'url' => ['api', '?{cmd}'], 'target' => 'api.php', 'options' => [ 'api' ], 'parameter' => [ 'cmd' => '%URL%' ], ],
|
||||
|
||||
[ 'url' => ['admin'], 'target' => 'admin.php', 'options' => [ 'password' ], 'parameter' => [ ] ],
|
||||
[ 'url' => ['admin'], 'target' => 'admin.php', 'options' => [ 'password' ], 'parameter' => [ ] ],
|
||||
|
||||
[ 'url' => ['blog'], 'target' => 'blog_list.php', 'options' => [ ], 'parameter' => [ ], ],
|
||||
[ 'url' => ['log'], 'target' => 'blog_list.php', 'options' => [ ], 'parameter' => [ ], ],
|
||||
[ 'url' => ['blogpost', 'index'], 'target' => 'blog_list.php', 'options' => [ ], 'parameter' => [ ], ],
|
||||
[ 'url' => ['blog', '?{id}'], 'target' => 'blog_view.php', 'options' => [ ], 'parameter' => [ 'id' => '%URL%', 'subview' => '' ], ],
|
||||
[ 'url' => ['blog', '?{id}'], 'target' => 'blog_view.php', 'options' => [ ], 'parameter' => [ 'id' => '%URL%', 'subview' => '' ], ],
|
||||
[ 'url' => ['blog', '?{id}', '?{name}'], 'target' => 'blog_view.php', 'options' => [ ], 'parameter' => [ 'id' => '%URL%', 'subview' => '' ], ],
|
||||
[ 'url' => ['blog', '?{id}', '?{name}', '?{subview}'], 'target' => 'blog_view.php', 'options' => [ ], 'parameter' => [ 'id' => '%URL%', 'subview' => '%URL%' ], ],
|
||||
[ 'url' => ['log', '?{id}'], 'target' => 'blog_view.php', 'options' => [ ], 'parameter' => [ 'id' => '%URL%', 'subview' => '' ], ],
|
||||
[ 'url' => ['log', '?{id}'], 'target' => 'blog_view.php', 'options' => [ ], 'parameter' => [ 'id' => '%URL%', 'subview' => '' ], ],
|
||||
[ 'url' => ['log', '?{id}', '?{name}'], 'target' => 'blog_view.php', 'options' => [ ], 'parameter' => [ 'id' => '%URL%', 'subview' => '' ], ],
|
||||
[ 'url' => ['log', '?{id}', '?{name}', '?{subview}'], 'target' => 'blog_view.php', 'options' => [ ], 'parameter' => [ 'id' => '%URL%', 'subview' => '%URL%' ], ],
|
||||
[ 'url' => ['blogpost', 'view'], 'target' => 'blog_view.php', 'options' => [ ], 'parameter' => [ 'id' => '%GET%', 'subview' => '' ], ],
|
||||
[ 'url' => ['blog'], 'target' => 'blog_list.php', 'options' => [ ], 'parameter' => [ ], ],
|
||||
[ 'url' => ['log'], 'target' => 'blog_list.php', 'options' => [ ], 'parameter' => [ ], ],
|
||||
[ 'url' => ['blogpost', 'index'], 'target' => 'blog_list.php', 'options' => [ ], 'parameter' => [ ], ],
|
||||
[ 'url' => ['blog', '?{id}'], 'target' => 'blog_view.php', 'options' => [ ], 'parameter' => [ 'id' => '%URL%', 'subview' => '' ], ],
|
||||
[ 'url' => ['blog', '?{id}'], 'target' => 'blog_view.php', 'options' => [ ], 'parameter' => [ 'id' => '%URL%', 'subview' => '' ], ],
|
||||
[ 'url' => ['blog', '?{id}', '?{name}'], 'target' => 'blog_view.php', 'options' => [ ], 'parameter' => [ 'id' => '%URL%', 'subview' => '' ], ],
|
||||
[ 'url' => ['blog', '?{id}', '?{name}', '?{subview}'], 'target' => 'blog_view.php', 'options' => [ ], 'parameter' => [ 'id' => '%URL%', 'subview' => '%URL%' ], ],
|
||||
[ 'url' => ['log', '?{id}'], 'target' => 'blog_view.php', 'options' => [ ], 'parameter' => [ 'id' => '%URL%', 'subview' => '' ], ],
|
||||
[ 'url' => ['log', '?{id}'], 'target' => 'blog_view.php', 'options' => [ ], 'parameter' => [ 'id' => '%URL%', 'subview' => '' ], ],
|
||||
[ 'url' => ['log', '?{id}', '?{name}'], 'target' => 'blog_view.php', 'options' => [ ], 'parameter' => [ 'id' => '%URL%', 'subview' => '' ], ],
|
||||
[ 'url' => ['log', '?{id}', '?{name}', '?{subview}'], 'target' => 'blog_view.php', 'options' => [ ], 'parameter' => [ 'id' => '%URL%', 'subview' => '%URL%' ], ],
|
||||
[ 'url' => ['blogpost', 'view'], 'target' => 'blog_view.php', 'options' => [ ], 'parameter' => [ 'id' => '%GET%', 'subview' => '' ], ],
|
||||
|
||||
[ 'url' => ['webapps'], 'target' => 'webapps_list.php', 'options' => [ ], 'parameter' => [ ], ],
|
||||
[ 'url' => ['webapps'], 'target' => 'webapps_list.php', 'options' => [ ], 'parameter' => [ ], ],
|
||||
|
||||
[ 'url' => ['highscores', 'list.php'], 'target' => 'highscores_listentries.php', 'options' => [ 'http' ], 'parameter' => [ 'gameid' => '%GET%' ], ],
|
||||
[ 'url' => ['highscores', 'list'], 'target' => 'highscores_listentries.php', 'options' => [ 'http' ], 'parameter' => [ 'gameid' => '%GET%' ], ],
|
||||
[ 'url' => ['highscores', 'listentries'], 'target' => 'highscores_listentries.php', 'options' => [ 'http' ], 'parameter' => [ 'gameid' => '%GET%' ], ],
|
||||
[ 'url' => ['highscores', 'list.php'], 'target' => 'highscores_listgames.php', 'options' => [ 'http' ], 'parameter' => [ ], ],
|
||||
[ 'url' => ['highscores', 'list'], 'target' => 'highscores_listgames.php', 'options' => [ 'http' ], 'parameter' => [ ], ],
|
||||
[ 'url' => ['highscores', 'listgames'], 'target' => 'highscores_listgames.php', 'options' => [ 'http' ], 'parameter' => [ ], ],
|
||||
[ 'url' => ['highscores', 'insert.php'], 'target' => 'highscores_insert.php', 'options' => [ 'http' ], 'parameter' => [ 'gameid' => '%GET%', 'check' => '%GET%', 'name' => '%GET%', 'rand' => '%GET%', 'points' => '%GET%' ], ],
|
||||
[ 'url' => ['highscores', 'insert'], 'target' => 'highscores_insert.php', 'options' => [ 'http' ], 'parameter' => [ 'gameid' => '%GET%', 'check' => '%GET%', 'name' => '%GET%', 'rand' => '%GET%', 'points' => '%GET%' ], ],
|
||||
[ 'url' => ['highscores', 'update.php'], 'target' => 'highscores_update.php', 'options' => [ 'http' ], 'parameter' => [ 'gameid' => '%GET%', 'check' => '%GET%', 'name' => '%GET%', 'rand' => '%GET%', 'points' => '%GET%', 'nameid' => '%GET%' ], ],
|
||||
[ 'url' => ['highscores', 'update'], 'target' => 'highscores_update.php', 'options' => [ 'http' ], 'parameter' => [ 'gameid' => '%GET%', 'check' => '%GET%', 'name' => '%GET%', 'rand' => '%GET%', 'points' => '%GET%', 'nameid' => '%GET%' ], ],
|
||||
[ 'url' => ['highscores', 'list_top50.php'], 'target' => 'highscores_top50.php', 'options' => [ 'http' ], 'parameter' => [ 'gameid' => '%GET%' ], ],
|
||||
[ 'url' => ['highscores', 'list_top50'], 'target' => 'highscores_top50.php', 'options' => [ 'http' ], 'parameter' => [ 'gameid' => '%GET%' ], ],
|
||||
[ 'url' => ['highscores', 'getNewID.php'], 'target' => 'highscores_newid.php', 'options' => [ 'http' ], 'parameter' => [ 'gameid' => '%GET%' ], ],
|
||||
[ 'url' => ['highscores', 'newid'], 'target' => 'highscores_newid.php', 'options' => [ 'http' ], 'parameter' => [ 'gameid' => '%GET%' ], ],
|
||||
[ 'url' => ['highscores', 'list.php'], 'target' => 'highscores_listentries.php', 'options' => [ 'http' ], 'parameter' => [ 'gameid' => '%GET%' ], ],
|
||||
[ 'url' => ['highscores', 'list'], 'target' => 'highscores_listentries.php', 'options' => [ 'http' ], 'parameter' => [ 'gameid' => '%GET%' ], ],
|
||||
[ 'url' => ['highscores', 'listentries'], 'target' => 'highscores_listentries.php', 'options' => [ 'http' ], 'parameter' => [ 'gameid' => '%GET%' ], ],
|
||||
[ 'url' => ['highscores', 'list.php'], 'target' => 'highscores_listgames.php', 'options' => [ 'http' ], 'parameter' => [ ], ],
|
||||
[ 'url' => ['highscores', 'list'], 'target' => 'highscores_listgames.php', 'options' => [ 'http' ], 'parameter' => [ ], ],
|
||||
[ 'url' => ['highscores', 'listgames'], 'target' => 'highscores_listgames.php', 'options' => [ 'http' ], 'parameter' => [ ], ],
|
||||
[ 'url' => ['highscores', 'insert.php'], 'target' => 'highscores_insert.php', 'options' => [ 'http' ], 'parameter' => [ 'gameid' => '%GET%', 'check' => '%GET%', 'name' => '%GET%', 'rand' => '%GET%', 'points' => '%GET%' ], ],
|
||||
[ 'url' => ['highscores', 'insert'], 'target' => 'highscores_insert.php', 'options' => [ 'http' ], 'parameter' => [ 'gameid' => '%GET%', 'check' => '%GET%', 'name' => '%GET%', 'rand' => '%GET%', 'points' => '%GET%' ], ],
|
||||
[ 'url' => ['highscores', 'update.php'], 'target' => 'highscores_update.php', 'options' => [ 'http' ], 'parameter' => [ 'gameid' => '%GET%', 'check' => '%GET%', 'name' => '%GET%', 'rand' => '%GET%', 'points' => '%GET%', 'nameid' => '%GET%' ], ],
|
||||
[ 'url' => ['highscores', 'update'], 'target' => 'highscores_update.php', 'options' => [ 'http' ], 'parameter' => [ 'gameid' => '%GET%', 'check' => '%GET%', 'name' => '%GET%', 'rand' => '%GET%', 'points' => '%GET%', 'nameid' => '%GET%' ], ],
|
||||
[ 'url' => ['highscores', 'list_top50.php'], 'target' => 'highscores_top50.php', 'options' => [ 'http' ], 'parameter' => [ 'gameid' => '%GET%' ], ],
|
||||
[ 'url' => ['highscores', 'list_top50'], 'target' => 'highscores_top50.php', 'options' => [ 'http' ], 'parameter' => [ 'gameid' => '%GET%' ], ],
|
||||
[ 'url' => ['highscores', 'getNewID.php'], 'target' => 'highscores_newid.php', 'options' => [ 'http' ], 'parameter' => [ 'gameid' => '%GET%' ], ],
|
||||
[ 'url' => ['highscores', 'newid'], 'target' => 'highscores_newid.php', 'options' => [ 'http' ], 'parameter' => [ 'gameid' => '%GET%' ], ],
|
||||
];
|
||||
|
||||
$site->serve($URL_RULES);
|
||||
|
@ -18,6 +18,16 @@ class MikescherGitGraph
|
||||
return __DIR__ . '/../../dynamic/egg/cache_fullrenderer.html';
|
||||
}
|
||||
|
||||
public function update()
|
||||
{
|
||||
return $this->extgitgraph->update();
|
||||
}
|
||||
|
||||
public function updateCache()
|
||||
{
|
||||
return $this->extgitgraph->updateCache();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string|null
|
||||
*/
|
||||
|
@ -76,4 +76,11 @@ class PageFrameOptions
|
||||
$this->force_redirect = true;
|
||||
$this->force_redirect_url = $url;
|
||||
}
|
||||
|
||||
public function forceResult(int $statuscode, string $content)
|
||||
{
|
||||
$this->statuscode = $statuscode;
|
||||
ob_clean();
|
||||
echo $content;
|
||||
}
|
||||
}
|
@ -88,6 +88,8 @@ class RuleEngine
|
||||
}
|
||||
if (!$match) return null;
|
||||
|
||||
$route->urlParameter = $urlparams;
|
||||
|
||||
$ctrlOpt = $rule['options'];
|
||||
|
||||
if (in_array('disabled', $ctrlOpt)) return null;
|
||||
|
@ -16,12 +16,20 @@ class URLRoute
|
||||
/** @var int */
|
||||
public $needsAdminLogin;
|
||||
|
||||
/** @var array */
|
||||
public $urlParameter;
|
||||
|
||||
/** @var bool */
|
||||
public $isAPI;
|
||||
|
||||
public function __construct(string $target, string $url)
|
||||
{
|
||||
$this->targetpath = __DIR__ . '/../pages/' . $target;
|
||||
$this->targetpath = (__DIR__ . '/../pages/' . $target);
|
||||
$this->full_url = $url;
|
||||
$this->parameter = [];
|
||||
$this->needsAdminLogin = false;
|
||||
$this->urlParameter = [];
|
||||
$this->isAPI = false;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -17,7 +17,7 @@ class Website
|
||||
public $config;
|
||||
|
||||
/** @var bool|null */
|
||||
public $isLoggedIn = null;
|
||||
private $isLoggedIn = null;
|
||||
|
||||
/** @var Modules */
|
||||
public $modules;
|
||||
|
@ -1,8 +1,15 @@
|
||||
<?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;
|
||||
|
||||
$FRAME_OPTIONS->title = null;
|
||||
$FRAME_OPTIONS->canonical_url = null;
|
||||
$FRAME_OPTIONS->activeHeader = null;
|
||||
$FRAME_OPTIONS->frame = 'api_frame.php';
|
||||
|
||||
require_once (__DIR__ . '/../internals/base.php');
|
||||
|
||||
$API_COMMANDS =
|
||||
[
|
||||
@ -29,7 +36,7 @@ $API_COMMANDS =
|
||||
'html::panel_aoc_calendar' => [ 'src' => __DIR__.'/../commands/html_panel-aoc-calendar.php', 'auth' => 'none' ],
|
||||
];
|
||||
|
||||
$cmd = strtolower($OPTIONS['cmd']);
|
||||
$cmd = strtolower($ROUTE->parameter['cmd']);
|
||||
|
||||
if (!array_key_exists($cmd, $API_COMMANDS))
|
||||
{
|
||||
@ -66,17 +73,17 @@ $config = $API_COMMANDS[$cmd];
|
||||
|
||||
$secret = isset($_GET['secret']) ? $_GET['secret'] : '';
|
||||
|
||||
if ($config['auth'] === 'webhook_secret' && $secret !== $CONFIG['webhook_secret']) httpDie(401, 'Unauthorized.');
|
||||
if ($config['auth'] === 'ajax_secret' && $secret !== $CONFIG['ajax_secret']) httpDie(401, 'Unauthorized.');
|
||||
if ($config['auth'] === 'upload_secret' && $secret !== $CONFIG['upload_secret']) httpDie(401, 'Unauthorized.');
|
||||
if ($config['auth'] === 'admin' && !isLoggedInByCookie()) httpDie(401, 'Unauthorized.');
|
||||
if ($config['auth'] === 'webhook_secret' && $secret !== $CONFIG['webhook_secret']) { $FRAME_OPTIONS->forceResult(401, "Unauthorized."); return; }
|
||||
if ($config['auth'] === 'ajax_secret' && $secret !== $CONFIG['ajax_secret']) { $FRAME_OPTIONS->forceResult(401, "Unauthorized."); return; }
|
||||
if ($config['auth'] === 'upload_secret' && $secret !== $CONFIG['upload_secret']) { $FRAME_OPTIONS->forceResult(401, "Unauthorized."); return; }
|
||||
if ($config['auth'] === 'admin' && !$SITE->isLoggedInByCookie()) { $FRAME_OPTIONS->forceResult(401, "Unauthorized."); return; }
|
||||
|
||||
|
||||
global $API_OPTIONS;
|
||||
|
||||
$API_OPTIONS = [];
|
||||
foreach ($_GET as $k => $v) $API_OPTIONS[strtolower($k)] = $v;
|
||||
foreach ($OPTIONS['_urlparams'] as $k => $v) $API_OPTIONS[strtolower($k)] = $v;
|
||||
foreach ($ROUTE->urlParameter as $k => $v) $API_OPTIONS[strtolower($k)] = $v;
|
||||
|
||||
try
|
||||
{
|
||||
@ -85,15 +92,16 @@ try
|
||||
}
|
||||
catch (exception $e)
|
||||
{
|
||||
print("API Command failed with exception");
|
||||
print($e);
|
||||
|
||||
$content =
|
||||
"REQUEST: " . var_export($_REQUEST) . "\r\n\r\n" .
|
||||
"IP: " . get_client_ip() . "\r\n\r\n" .
|
||||
"ERROR: " . $e . "\r\n\r\n";
|
||||
|
||||
if (isProd()) sendMail("Website API call failed", $content, 'virtualadmin@mikescher.de', 'webserver-info@mikescher.com');
|
||||
if ($SITE->isProd()) sendMail("Website API call failed", $content, 'virtualadmin@mikescher.de', 'webserver-info@mikescher.com');
|
||||
|
||||
httpDie(500, 'Error.');
|
||||
$msg = "Error.";
|
||||
if (!$SITE->isProd()) $msg = "Error.\n" . "API Command failed with exception.\n" . $e;
|
||||
|
||||
$FRAME_OPTIONS->forceResult(500, $msg);
|
||||
return;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user