diff options
author | Aaron Parecki <aaron@parecki.com> | 2019-10-19 21:19:48 +0100 |
---|---|---|
committer | Aaron Parecki <aaron@parecki.com> | 2019-10-19 21:19:48 +0100 |
commit | e8b68115a4d5ba488832dbf45f149935635510fe (patch) | |
tree | 92e3265c37f6d584b74f1b15c65420ed0d3c482a /controllers | |
parent | cbbf10c7f30dbf5e82e3cef71e3fc864aba5b851 (diff) |
drop flight tracking stuff
the API dropped their free tier
Diffstat (limited to 'controllers')
-rw-r--r-- | controllers/controllers.php | 99 |
1 files changed, 0 insertions, 99 deletions
diff --git a/controllers/controllers.php b/controllers/controllers.php index bf1cb86..a4baa0f 100644 --- a/controllers/controllers.php +++ b/controllers/controllers.php @@ -200,105 +200,6 @@ $app->get('/itinerary', function() use($app) { } }); -$app->get('/flight', function() use($app) { - if($user=require_login($app)) { - $params = $app->request()->params(); - - render('new-flight', array( - 'title' => 'Flight', - 'authorizing' => false - )); - } -}); - -$app->post('/flight', function() use($app) { - if($user=require_login($app)) { - $params = $app->request()->params(); - - $location = false; - - if($params['action'] == 'find') { - - } elseif($params['action'] == 'checkin') { - - $payload = [ - 'type' => ['h-entry'], - 'properties' => [ - 'checkin' => [ - [ - 'type' => ['h-card'], - 'properties' => [ - 'name' => [$params['flight']], - 'url' => ['http://flightaware.com/live/flight/'.$params['flight']], - ] - ] - ] - ] - ]; - - $r = micropub_post_for_user($user, $payload, null, true); - - $location = $r['location']; - - if($location) { - // Store the checkin in the database to enable the cron job tracking the flight - $flight = ORM::for_table('flights')->create(); - $flight->user_id = $_SESSION['user_id']; - $flight->date_created = date('Y-m-d H:i:s'); - $flight->active = 1; - $flight->url = $location; - $flight->flight = $params['flight']; - $flight->save(); - } - } - - $app->response()['Content-type'] = 'application/json'; - $app->response()->body(json_encode(array( - 'result' => 'ok', - 'location' => $location - ))); - } -}); - -$app->get('/flight/:id/:flightID/route.json', function($id, $flightID) use($app) { - $route = false; - - $flight = ORM::for_table('flights')->where('id', $id)->find_one(); - if($flight) { - $lastPosition = json_decode($flight->lastposition, true); - if($lastPosition['InFlightInfoResult']['faFlightID'] == $flightID) { - - // {"type":"FeatureCollection","features":[{"type":"Feature","geometry":{"type":"Point","coordinates":[-122.638351,45.52217]},"properties":{"date":"2016-01-02T23:13:49Z","altitude":42.666666666667}} - - $route = [ - 'type' => 'FeatureCollection', - 'features' => [] - ]; - - $positions = json_decode($flight->positions, true); - foreach($positions as $p) { - $route['features'][] = [ - 'type' => 'Feature', - 'geometry' => [ - 'type' => 'Point', - 'coordinates' => [$p['lng'], $p['lat']] - ], - 'properties' => [ - 'date' => $p['date'], - 'altitude' => $p['altitude'], - 'heading' => $p['heading'], - 'speed' => $p['speed'] - ] - ]; - } - - } - } - - $app->response()['Content-type'] = 'application/json'; - $app->response()->body(json_encode($route)); -}); - $app->get('/photo', function() use($app) { if($user=require_login($app)) { $params = $app->request()->params(); |