mirror of
https://github.com/osm-search/Nominatim.git
synced 2026-02-16 15:47:58 +00:00
more generalized javascript_renderData
- handles json/jsonp transparently (avoiding code duplication in templates) - use php's internal json_encode functions (with JSON_UNESCAPED_UNICODE for backward compatibility) - be more liberal with what is allowed as a callback identifier - return a 400 for illegal callbacks - return application/javascript type when jsonp is requested fixes #16, fixes #17
This commit is contained in:
@@ -1,7 +1,4 @@
|
||||
<?php
|
||||
header ("Content-Type: application/json; charset=UTF-8");
|
||||
header("Access-Control-Allow-Origin: *");
|
||||
|
||||
$aFilteredPlaces = array();
|
||||
|
||||
if (!sizeof($aPlace))
|
||||
@@ -27,13 +24,5 @@
|
||||
if ($bShowAddressDetails) $aFilteredPlaces['address'] = $aAddress;
|
||||
}
|
||||
|
||||
if (isset($_GET['json_callback']) && preg_match('/^[-A-Za-z0-9:_.]+$/',$_GET['json_callback']))
|
||||
{
|
||||
echo $_GET['json_callback'].'('.javascript_renderData($aFilteredPlaces).')';
|
||||
}
|
||||
else
|
||||
{
|
||||
echo javascript_renderData($aFilteredPlaces);
|
||||
}
|
||||
|
||||
javascript_renderData($aFilteredPlaces);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user