Fix: public tracks config option has no effect

This commit is contained in:
Bartek Fabiszewski 2017-04-14 17:22:52 +02:00
parent 77d1a5a012
commit a64213940a
3 changed files with 6 additions and 5 deletions

View File

@ -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();

View File

@ -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;
}
}
}

View File

@ -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);
}