Add location broadcast (Netsyms/HelpingHelenaApp/issues/5)

master
Skylar Ittner 5 years ago
parent b15c2a0b99
commit 3af45b33d0

@ -0,0 +1,21 @@
<?php
/*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
$accountid = $database->get("authkeys", "accountid", ["key" => $VARS["key"]]);
if (!$database->has("accounts", ["AND" => ["accountid" => $accountid, "type" => 2]])) {
sendJsonResp($Strings->get("Only receivers may broadcast their location to the map.", false), "ERROR");
}
$database->update("accounts", [
"latitude" => $VARS["latitude"],
"longitude" => $VARS["longitude"],
"lastgpsfix" => date("Y-m-d H:i:s")
], ["accountid" => $accountid]);
sendJsonResp();

@ -76,4 +76,12 @@ $APIS = [
"format (optional)" => "/(geojson)/"
]
],
"broadcast" => [
"load" => "broadcast.php",
"vars" => [
"key" => $keyregex,
"latitude" => "/-?[0-9]{2}\.[0-9]+/",
"longitude" => "/-?[0-9]{2,3}\.[0-9]+/"
]
],
];

Loading…
Cancel
Save