BMLT Root Server
GetSearchResults.php
Go to the documentation of this file.
1 <?php
2 /****************************************************************************************//**
3 * \file GetSearchResults.php *
4 * \brief Returns an XML response, containing the schema for the GetSearchResults XML call. *
5 * The schema is adaptive, and will form itself to the data structure of the root server. *
6 
7  This file is part of the Basic Meeting List Toolbox (BMLT).
8 
9  Find out more at: https://bmlt.app
10 
11  BMLT is free software: you can redistribute it and/or modify
12  it under the terms of the MIT License.
13 
14  BMLT is distributed in the hope that it will be useful,
15  but WITHOUT ANY WARRANTY; without even the implied warranty of
16  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17  MIT License for more details.
18 
19  You should have received a copy of the MIT License along with this code.
20  If not, see <https://opensource.org/licenses/MIT>.
21 ********************************************************************************************/
22 
23 defined('BMLT_EXEC') or define('BMLT_EXEC', true); // This is a security verifier. Keeps files from being executed outside of the context
24 $file_dir = str_replace('/client_interface/xsd', '', dirname(__FILE__)).'/server/c_comdef_server.class.php';
25 require_once($file_dir);
26 $server = c_comdef_server::MakeServer();
27 $ret = null;
28 
29 if ($server instanceof c_comdef_server) {
30  // The caller can request compression. Not all clients can deal with compressed replies.
31  if (isset($_GET['compress_xml']) || isset($_POST['compress_xml'])) {
32  if (zlib_get_coding_type() === false) {
33  ob_start("ob_gzhandler");
34  } else {
35  header('Content-Type:application/xml; charset=UTF-8');
36  ob_start();
37  }
38  } else {
39  header('Content-Type:application/xml; charset=UTF-8');
40  ob_start();
41  }
42  echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"; ?>
43 <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
44  xmlns:xsn="http://<?php echo $_SERVER['SERVER_NAME'] ?>"
45  targetNamespace="http://<?php echo $_SERVER['SERVER_NAME'] ?>"
46  elementFormDefault="qualified">
47  <xs:element name="meetings">
48  <xs:complexType>
49  <xs:sequence>
50  <xs:element maxOccurs="unbounded" name="row">
51  <xs:complexType mixed="true">
52  <xs:sequence id="data_item_names">
53  <?php
55 
56  foreach ($keys as $key) {
57  echo "\t\t\t\t\t\t\t<xs:element minOccurs=\"0\" maxOccurs=\"1\" name=\"".htmlspecialchars($key)."\" type=\"xs:";
58  switch ($key) {
59  case 'weekday_tinyint':
60  case 'service_body_bigint':
61  case 'shared_group_id_bigint':
62  case 'id_bigint':
63  case 'published':
64  echo "integer";
65  break;
66 
67  case 'longitude':
68  case 'latitude':
69  case 'distance_in_km':
70  case 'distance_in_miles':
71  echo "decimal";
72  break;
73 
74  default:
75  echo "string";
76  break;
77  }
78 
79  echo "\"/>\n";
80  }
81  ?>
82  <xs:element name="root_server_uri" type="xs:string" minOccurs="0"/>
83  <xs:element name="format_shared_id_list" type="xs:string" minOccurs="0"/>
84  </xs:sequence>
85  <xs:attribute name="sequence_index" use="required" type="xs:integer"/>
86  </xs:complexType>
87  </xs:element>
88  <xs:element name="formats" minOccurs="0">
89  <xs:complexType>
90  <xs:sequence>
91  <xs:element name="row" maxOccurs="unbounded">
92  <xs:complexType>
93  <xs:sequence>
94  <xs:element name="key_string" type="xs:string"/>
95  <xs:element name="name_string" type="xs:string"/>
96  <xs:element name="description_string" type="xs:string"/>
97  <xs:element name="lang" type="xs:string"/>
98  <xs:element name="id" type="xs:integer"/>
99  <xs:element name="world_id" type="xs:string" minOccurs="0"/>
100  </xs:sequence>
101  <xs:attribute name="sequence_index" use="required" type="xs:integer"/>
102  </xs:complexType>
103  </xs:element>
104  </xs:sequence>
105  </xs:complexType>
106  </xs:element>
107  <xs:element ref='xsn:locationInfo' minOccurs="0"/>
108  </xs:sequence>
109  </xs:complexType>
110  </xs:element>
111  <xs:element name='locationInfo'>
112  <xs:complexType>
113  <xs:sequence>
114  <xs:element ref='xsn:search_average'/>
115  <xs:element ref='xsn:search_center'/>
116  </xs:sequence>
117  </xs:complexType>
118  </xs:element>
119  <xs:element name='search_average'>
120  <xs:complexType>
121  <xs:sequence>
122  <xs:element ref='xsn:location'/>
123  <xs:element ref='xsn:radius'/>
124  </xs:sequence>
125  </xs:complexType>
126  </xs:element>
127  <xs:element name='search_center'>
128  <xs:complexType>
129  <xs:sequence>
130  <xs:element ref='xsn:location'/>
131  <xs:element ref='xsn:radius'/>
132  </xs:sequence>
133  </xs:complexType>
134  </xs:element>
135  <xs:element name='longitude' type='xs:decimal'/>
136  <xs:element name='latitude' type='xs:decimal'/>
137  <xs:element name='location'>
138  <xs:complexType>
139  <xs:sequence>
140  <xs:element ref='xsn:latitude'/>
141  <xs:element ref='xsn:longitude'/>
142  </xs:sequence>
143  </xs:complexType>
144  </xs:element>
145  <xs:element name='radius'>
146  <xs:complexType>
147  <xs:sequence>
148  <xs:element ref='xsn:miles'/>
149  <xs:element ref='xsn:kilometers'/>
150  </xs:sequence>
151  </xs:complexType>
152  </xs:element>
153  <xs:element name='miles' type='xs:decimal'/>
154  <xs:element name='kilometers' type='xs:decimal'/>
155 </xs:schema><?php
156  ob_end_flush();
157 } else {
158  echo ( 'No Server' );
159 }
160 ?>
defined('BMLT_EXEC') or define('BMLT_EXEC' true
if($handler instanceof c_comdef_admin_ajax_handler)
const BMLT_EXEC
Definition: index.php:21
static GetAllMeetingKeys()
Returns an array of strings, containing the keys (table columns) used for all meetings (specified in ...
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
$_GET['switcher']