Fix: no tracks if both require_authentication and public_tracks set to false

This commit is contained in:
Bartek Fabiszewski 2017-04-08 09:57:15 +02:00
parent 629578fb33
commit a68e355ae3

View File

@ -54,12 +54,10 @@ class uConfig {
// other // other
// require login/password authentication // require login/password authentication
// (0 = no, 1 = yes) static $require_authentication = true;
static $require_authentication = 1;
// all users tracks are visible to authenticated user // all users tracks are visible to authenticated user
// (0 = no, 1 = yes) static $public_tracks = false;
static $public_tracks = 0;
// admin user who has access to all users locations // admin user who has access to all users locations
// none if empty // none if empty
@ -106,11 +104,16 @@ class uConfig {
if (isset($dbpass)) { self::$dbpass = $dbpass; } if (isset($dbpass)) { self::$dbpass = $dbpass; }
if (isset($dbname)) { self::$dbname = $dbname; } if (isset($dbname)) { self::$dbname = $dbname; }
if (isset($require_authentication)) { self::$require_authentication = (bool) $require_authentication; } 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($admin_user)) { self::$admin_user = $admin_user; }
if (isset($interval)) { self::$interval = $interval; } if (isset($interval)) { self::$interval = $interval; }
if (isset($lang)) { self::$lang = $lang; } if (isset($lang)) { self::$lang = $lang; }
if (isset($units)) { self::$units = $units; } 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() { private function setFromCookies() {
if (isset($_COOKIE["ulogger_api"])) { self::$mapapi = $_COOKIE["ulogger_api"]; } if (isset($_COOKIE["ulogger_api"])) { self::$mapapi = $_COOKIE["ulogger_api"]; }