Add optional API key for cron, rename entry point
parent
ea2fffa872
commit
6c22684b2f
|
@ -1,5 +1,5 @@
|
||||||
<?php
|
<?php
|
||||||
$RUNTIME['PDO'] = new PDO('mysql:host=...;dbname=...', '...', '...');
|
$RUNTIME['PDO'] = new PDO('mysql:host=...;dbname=...', '...', '...');
|
||||||
|
|
||||||
$RUNTIME['GRID']['NAME'] = "OpenSim";
|
$RUNTIME['GRID']['NAME'] = "OpenSim";
|
||||||
$RUNTIME['GRID']['MAIN_NEWS'] = "Yet an other OpenSim Grid.";
|
$RUNTIME['GRID']['MAIN_NEWS'] = "Yet an other OpenSim Grid.";
|
||||||
|
@ -24,4 +24,6 @@ $RUNTIME['DOMAIN'] = "mcp.4creative.net";
|
||||||
$RUNTIME['IAR']['BASEURL'] = "https://mcp.4creative.net/data/";
|
$RUNTIME['IAR']['BASEURL'] = "https://mcp.4creative.net/data/";
|
||||||
|
|
||||||
$RUNTIME['PASSWORD_MIN_LENGTH'] = 8;
|
$RUNTIME['PASSWORD_MIN_LENGTH'] = 8;
|
||||||
?>
|
|
||||||
|
$RUNTIME['CRON_RESTRICTION'] = 'key';
|
||||||
|
$RUNTIME['CRON_KEY'] = 'changeme';
|
||||||
|
|
|
@ -0,0 +1,24 @@
|
||||||
|
<?php
|
||||||
|
$RUNTIME = array();
|
||||||
|
$RUNTIME['BASEDIR'] = __DIR__;
|
||||||
|
set_include_path('.:'.$RUNTIME['BASEDIR']);
|
||||||
|
include_once "config.php";
|
||||||
|
|
||||||
|
if(!isset($RUNTIME['CRON_RESTRICTION'])) {
|
||||||
|
http_response_code(500);
|
||||||
|
die();
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($RUNTIME['CRON_RESTRICTION'] != 'none' && (!isset($RUNTIME['CRON_KEY']) || !isset($REQUEST['key']) || $_REQUEST['key'] !== $RUNTIME['CRON_KEY'])) {
|
||||||
|
http_response_code(401);
|
||||||
|
die();
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($handle = opendir('./cron/')) {
|
||||||
|
while (false !== ($entry = readdir($handle))) {
|
||||||
|
if ($entry != "." && $entry != "..") {
|
||||||
|
include_once "./cron/".$entry;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
closedir($handle);
|
||||||
|
}
|
26
crone.php
26
crone.php
|
@ -1,26 +0,0 @@
|
||||||
<?php
|
|
||||||
date_default_timezone_set("Europe/Berlin");
|
|
||||||
error_reporting(E_ALL);
|
|
||||||
session_start();
|
|
||||||
|
|
||||||
$RUNTIME = array();
|
|
||||||
$RUNTIME['BASEDIR'] = __DIR__;
|
|
||||||
set_include_path('.:'.$RUNTIME['BASEDIR']);
|
|
||||||
include_once("app/utils.php");
|
|
||||||
include_once("app/HTML.php");
|
|
||||||
include_once("config.php");
|
|
||||||
|
|
||||||
if ($handle = opendir('./cron/'))
|
|
||||||
{
|
|
||||||
while (false !== ($entry = readdir($handle)))
|
|
||||||
{
|
|
||||||
if ($entry != "." && $entry != "..")
|
|
||||||
{
|
|
||||||
include_once "./cron/".$entry;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
closedir($handle);
|
|
||||||
}
|
|
||||||
|
|
||||||
?>
|
|
Loading…
Reference in New Issue