From a68e355ae3967b5c9b60fb6a3054aae0f24fcbde Mon Sep 17 00:00:00 2001 From: Bartek Fabiszewski Date: Sat, 8 Apr 2017 09:57:15 +0200 Subject: [PATCH] Fix: no tracks if both require_authentication and public_tracks set to false --- helpers/config.php | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/helpers/config.php b/helpers/config.php index 7350a8d..5ce8244 100644 --- a/helpers/config.php +++ b/helpers/config.php @@ -54,12 +54,10 @@ class uConfig { // other // require login/password authentication - // (0 = no, 1 = yes) - static $require_authentication = 1; + static $require_authentication = true; // all users tracks are visible to authenticated user - // (0 = no, 1 = yes) - static $public_tracks = 0; + static $public_tracks = false; // admin user who has access to all users locations // none if empty @@ -106,11 +104,16 @@ class uConfig { if (isset($dbpass)) { self::$dbpass = $dbpass; } if (isset($dbname)) { self::$dbname = $dbname; } if (isset($require_authentication)) { self::$require_authentication = (bool) $require_authentication; } - if (isset($public_tracks)) { self::$public_tracks = $public_tracks; } + if (isset($public_tracks)) { self::$public_tracks = (bool) $public_tracks; } if (isset($admin_user)) { self::$admin_user = $admin_user; } if (isset($interval)) { self::$interval = $interval; } if (isset($lang)) { self::$lang = $lang; } if (isset($units)) { self::$units = $units; } + + if (!self::$require_authentication) { + // tracks must be public if we don't require authentication + self::$public_tracks = true; + } } private function setFromCookies() { if (isset($_COOKIE["ulogger_api"])) { self::$mapapi = $_COOKIE["ulogger_api"]; }