minor fixes

This commit is contained in:
marko
2024-08-06 22:05:19 +02:00
parent 2bc08549f9
commit 63a832830c
4 changed files with 7 additions and 8 deletions

View File

@@ -3,6 +3,7 @@ setlocale (LC_ALL, 'de_DE@euro', 'de_DE', 'de', 'ge');
set_include_path(get_include_path() . PATH_SEPARATOR . "./lib/"); set_include_path(get_include_path() . PATH_SEPARATOR . "./lib/");
// configs and local data // configs and local data
require_once 'config/participo.php';
require_once './local/cwsvJudo.php'; require_once './local/cwsvJudo.php';
// libraries // libraries

View File

@@ -21,14 +21,12 @@ function init($config)
function authorize() function authorize()
{ {
if (array_key_exists("HTTP_AUTHORIZATION", $_SERVER)) { if (array_key_exists("HTTP_AUTHORIZATION", $_SERVER) && (!empty($_SERVER["HTTP_AUTHORIZATION"])) ) {
if (!empty($_SERVER["HTTP_AUTHORIZATION"])) {
$auth = explode(" ", $_SERVER["HTTP_AUTHORIZATION"]); $auth = explode(" ", $_SERVER["HTTP_AUTHORIZATION"]);
if ($auth[0] = "Basic") { if ($auth[0] = "Basic") {
$allowKey = ApiKey::loadFromDb($auth[1]); $allowKey = ApiKey::loadFromDb($auth[1]);
} }
} }
}
if (!$allowKey || !$allowKey->isValidFor("api")) { if (!$allowKey || !$allowKey->isValidFor("api")) {
die( die(

View File

@@ -3,10 +3,10 @@
function processPostData($db, $post, $redirectLocation = '.') function processPostData($db, $post, $redirectLocation = '.')
{ {
sleep(1); sleep(1);
if ($post['action']) { if (array_key_exists("action", $post)) {
// if there is a redirectlocation, set it // if there is a redirectLocation, set it
if ($post['redirectLocation']) { if (array_key_exists("redirectLocation", $post)) {
$redirectLocation = $post['redirectLocation']; $redirectLocation = filter_var($post['redirectLocation'], FILTER_SANITIZE_URL);
} }
// change a users password // change a users password

View File

@@ -641,7 +641,7 @@ function logLoginsToJsonFile($userName, $fileName = 'lastLogins.json')
function getCurPagesUrl() function getCurPagesUrl()
{ {
$pageURL = 'http'; $pageURL = 'http';
if ($_SERVER['HTTPS'] == 'on') { if ( array_key_exists("HTTPS", $_SERVER) && ($_SERVER['HTTPS'] == 'on')) {
$pageURL .= 's'; $pageURL .= 's';
} }
$pageURL .= '://'; $pageURL .= '://';