BMLT Root Server
index.php
Go to the documentation of this file.
1 <?php
2 /***********************************************************************/
3 /** \file client_interface/gpx/index.php
4 
5  \brief This file is a very simple interface that is designed to return
6  a GPX (GPS eXchange Format) string, in response to a search.
7  In order to use this, you need to call: <ROOT SERVER BASE URI>/client_interface/gpx/
8  with the same parameters that you would send to an advanced search. The results
9  will be returned as an GPX file.
10 
11  This file can be called from other servers.
12 
13  This file is part of the Basic Meeting List Toolbox (BMLT).
14 
15  Find out more at: https://bmlt.app
16 
17  BMLT is free software: you can redistribute it and/or modify
18  it under the terms of the MIT License.
19 
20  BMLT is distributed in the hope that it will be useful,
21  but WITHOUT ANY WARRANTY; without even the implied warranty of
22  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23  MIT License for more details.
24 
25  You should have received a copy of the MIT License along with this code.
26  If not, see <https://opensource.org/licenses/MIT>.
27 */
28 
29 defined('BMLT_EXEC') or define('BMLT_EXEC', true); // This is a security verifier. Keeps files from being executed outside of the context
30 require_once(dirname(__FILE__).'/../csv/csv.php');
31 
32 try {
34  $ret = null;
35 
36  if ($server instanceof c_comdef_server) {
37  $_GET['switcher'] = 'GetSearchResults';
38  unset($_GET['xml_data']);
39  $_GET['gpx_data'] = true;
40  $_GET['data_field_key'] = 'longitude,latitude,location_city_subsection,location_neighborhood,location_province,location_nation,location_postal_code_1,location_text,location_street,location_info,location_municipality,meeting_name,weekday_tinyint,start_time';
42  // The caller can request compression. Not all clients can deal with compressed replies.
43  if (isset($_GET['compress_output']) || isset($_POST['compress_output'])) {
44  if (zlib_get_coding_type() === false) {
45  ob_start("ob_gzhandler");
46  } else {
47  header('Content-Type:application/xml; charset=UTF-8');
48  header('Content-Disposition: attachment; filename="SearchResults.gpx"');
49  ob_start();
50  }
51  } else {
52  header('Content-Type:application/xml; charset=UTF-8');
53  header('Content-Disposition: attachment; filename="SearchResults.gpx"');
54  ob_start();
55  }
56 
57  echo $ret;
58  ob_end_flush();
59  } else {
60  echo HandleNoServer();
61  }
62 } catch (Exception $e) {
63  echo HandleNoServer();
64 }
const BMLT_EXEC
Definition: index.php:21
$ret
Definition: index.php:33
try
Definition: index.php:31
static MakeServer()
This is the factory for the server instantiation. It makes sure that only one instance exists...
This class is the main server class. It instantiates a PDO database object, and is the starting point...
defined('BMLT_EXEC') or define('BMLT_EXEC'
Definition: index.php:3
parse_redirect(&$server)
Queries the local server, and returns processed CSV data.
Definition: csv.php:45
defined('BMLT_EXEC') or define('BMLT_EXEC' true
Definition: index.php:29
$server
Definition: index.php:32
HandleNoServer()
Handles no server available (error).
Definition: csv.php:1483
$_GET['switcher']