Validate track when adding position
This commit is contained in:
parent
919cb4d9d3
commit
dccb90d6df
@ -85,6 +85,8 @@
|
||||
public function add($userId, $trackId, $time, $lat, $lon, $altitude, $speed, $bearing, $accuracy, $provider, $comment, $imageId) {
|
||||
$positionId = false;
|
||||
if (!is_null($lat) && !is_null($lon) && !is_null($time) && !empty($userId) && !empty($trackId)) {
|
||||
$track = new uTrack($trackId);
|
||||
if ($track->isValid && $track->userId == $userId) {
|
||||
$query = "INSERT INTO `" . self::$db->table('positions') . "`
|
||||
(user_id, track_id,
|
||||
time, latitude, longitude, altitude, speed, bearing, accuracy, provider, comment, image_id)
|
||||
@ -99,6 +101,7 @@
|
||||
}
|
||||
$stmt->close();
|
||||
}
|
||||
}
|
||||
return $positionId;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user