Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Change access control to implement more of CORS. Change so OPTIONS re…

…quests don't do an actual search/reverse request
  • Loading branch information...
commit 0dd10c3fff9896ca23b884a7ec7a97002065d083 1 parent 89af917
@twain47 authored
View
8 lib/init-website.php
@@ -1,6 +1,14 @@
<?php
require_once('init.php');
+ if (CONST_NoAccessControl)
+ {
+ header("Access-Control-Allow-Origin: *");
+ header("Access-Control-Allow-Methods: OPTIONS,GET");
+ header("Access-Control-Allow-Headers: ".$_SERVER['HTTP_ACCESS_CONTROL_REQUEST_HEADERS']);
+ }
+ if ($_SERVER['REQUEST_METHOD'] == 'OPTIONS') exit;
+
if (CONST_ClosedForIndexing && strpos(CONST_ClosedForIndexingExceptionIPs, ','.$_SERVER["REMOTE_ADDR"].',') === false)
{
echo "Closed for re-indexing...";
View
7 lib/template/address-xml.php
@@ -1,6 +1,5 @@
<?php
header("content-type: text/xml; charset=UTF-8");
- header("Access-Control-Allow-Origin: *");
echo "<";
echo "?xml version=\"1.0\" encoding=\"UTF-8\" ?";
@@ -29,7 +28,7 @@
if (isset($aPlace['lon'])) echo ' lon="'.htmlspecialchars($aPlace['lon']).'"';
echo ">".htmlspecialchars($aPlace['langaddress'])."</result>";
- if ($bShowAddressDetails) {
+ if ($bShowAddressDetails) {
echo "<addressparts>";
foreach($aAddress as $sKey => $sValue)
{
@@ -39,7 +38,7 @@
echo "</$sKey>";
}
echo "</addressparts>";
- }
+ }
}
-
+
echo "</reversegeocode>";
View
2  lib/template/search-json.php
@@ -1,4 +1,6 @@
<?php
+ header("content-type: application/json; charset=UTF-8");
+
$aFilteredPlaces = array();
foreach($aSearchResults as $iResNum => $aPointDetails)
{
View
1  lib/template/search-xml.php
@@ -1,6 +1,5 @@
<?php
header("content-type: text/xml; charset=UTF-8");
- header("Access-Control-Allow-Origin: *");
echo "<";
echo "?xml version=\"1.0\" encoding=\"UTF-8\" ?";
2  osm2pgsql
@@ -1 +1 @@
-Subproject commit efe87e2740349bdda46dfc44f7806b9f6bc40a3d
+Subproject commit 3586caa0936e052ec14a7172769df4b3b4da2d08
View
1  settings/settings.php
@@ -37,6 +37,7 @@ function user_busy_cost()
}
// Website settings
+ @define('CONST_NoAccessControl', true);
@define('CONST_ClosedForIndexing', false);
@define('CONST_ClosedForIndexingExceptionIPs', '');
@define('CONST_BlockedIPs', '');
View
3  website/reverse.php
@@ -138,8 +138,9 @@
$sSQL .= " get_name_by_language(name, ARRAY['ref']) as ref,";
$sSQL .= " st_y(st_centroid(geometry)) as lat, st_x(st_centroid(geometry)) as lon";
$sSQL .= " from placex where place_id = $iPlaceID ";
-//var_dump($sSQL);
+
$aPlace = $oDB->getRow($sSQL);
+//var_dump($sSQL, $aPlace); exit;
if ($bShowAddressDetails)
{
Please sign in to comment.
Something went wrong with that request. Please try again.