From a64213940a971d7d7f0f0a92b40b5a4487625fe0 Mon Sep 17 00:00:00 2001 From: Bartek Fabiszewski Date: Fri, 14 Apr 2017 17:22:52 +0200 Subject: [PATCH] Fix: public tracks config option has no effect --- utils/download.php | 2 +- utils/getpositions.php | 7 ++++--- utils/gettracks.php | 2 +- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/utils/download.php b/utils/download.php index bc51ee9..a82112b 100755 --- a/utils/download.php +++ b/utils/download.php @@ -57,7 +57,7 @@ $type = isset($_REQUEST["type"]) ? $_REQUEST["type"] : "kml"; $userId = (isset($_REQUEST["userid"]) && is_numeric($_REQUEST["userid"])) ? (int) $_REQUEST["userid"] : NULL; $trackId = (isset($_REQUEST["trackid"]) && is_numeric($_REQUEST["trackid"])) ? (int) $_REQUEST["trackid"] : NULL; -if ($config::$require_authentication && !$user->isAdmin && $user->id !== $userId) { +if (!$config::$public_tracks && !$user->isAdmin && $user->id !== $userId) { // unauthorized $mysqli->close(); exit(); diff --git a/utils/getpositions.php b/utils/getpositions.php index fb9753b..86b6f99 100755 --- a/utils/getpositions.php +++ b/utils/getpositions.php @@ -26,15 +26,16 @@ $trackId = (isset($_REQUEST["trackid"]) && is_numeric($_REQUEST["trackid"])) ? ( if ($userId) { $positionsArr = []; - if (!$config::$require_authentication || $user->isAdmin || $user->id === $userId) { + if ($config::$public_tracks || $user->isAdmin || $user->id === $userId) { $position = new uPosition(); if ($trackId) { // get all track data $positionsArr = $position->getAll($userId, $trackId); } else { // get data only for latest point - $position->getLast($userId); - $positionsArr[] = $position; + if ($position->getLast($userId)->isValid) { + $positionsArr[] = $position; + } } } diff --git a/utils/gettracks.php b/utils/gettracks.php index b2223b6..d803908 100755 --- a/utils/gettracks.php +++ b/utils/gettracks.php @@ -25,7 +25,7 @@ $userId = (isset($_REQUEST["userid"]) && is_numeric($_REQUEST["userid"])) ? (int if ($userId) { $tracksArr = []; - if (!$config::$require_authentication || $user->isAdmin || $user->id === $userId) { + if ($config::$public_tracks || $user->isAdmin || $user->id === $userId) { $track = new uTrack(); $tracksArr = $track->getAll($userId); }