Fix: public tracks config option has no effect
This commit is contained in:
parent
77d1a5a012
commit
a64213940a
@ -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();
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user