3 require_once(CONST_BasePath.'/lib/init-website.php');
4 require_once(CONST_BasePath.'/lib/ParameterParser.php');
5 require_once(CONST_BasePath.'/lib/Status.php');
7 $oParams = new Nominatim\ParameterParser();
8 $sOutputFormat = $oParams->getSet('format', array('text', 'json'), 'text');
10 $oDB = DB::connect(CONST_Database_DSN, false);
11 $oStatus = new Nominatim\Status($oDB);
14 if ($sOutputFormat == 'json') {
15 header('content-type: application/json; charset=UTF-8');
21 } catch (Exception $oErr) {
22 if ($sOutputFormat == 'json') {
24 'status' => $oErr->getCode(),
25 'message' => $oErr->getMessage()
27 javascript_renderData($aResponse);
29 header('HTTP/1.0 500 Internal Server Error');
30 echo 'ERROR: '.$oErr->getMessage();
36 if ($sOutputFormat == 'json') {
37 $epoch = $oStatus->dataDate();
41 'data_updated' => (new DateTime('@'.$epoch))->format(DateTime::RFC3339)
43 javascript_renderData($aResponse);