mirror of
https://github.com/osm-search/Nominatim.git
synced 2026-02-16 15:47:58 +00:00
bracket spacing for if/else/for/foreach/while/switch according to PSR2 standard
This commit is contained in:
@@ -13,8 +13,7 @@
|
||||
$aPolygons = chksql($oDB->getAll($sSQL),
|
||||
"Could not get list of deleted OSM elements.");
|
||||
|
||||
if (CONST_DEBUG)
|
||||
{
|
||||
if (CONST_DEBUG) {
|
||||
var_dump($aPolygons);
|
||||
exit;
|
||||
}
|
||||
@@ -71,18 +70,14 @@ table td {
|
||||
if (!$aPolygons) exit;
|
||||
echo "<tr>";
|
||||
//var_dump($aPolygons[0]);
|
||||
foreach($aPolygons[0] as $sCol => $sVal)
|
||||
{
|
||||
foreach ($aPolygons[0] as $sCol => $sVal) {
|
||||
echo "<th>".$sCol."</th>";
|
||||
}
|
||||
echo "</tr>";
|
||||
foreach($aPolygons as $aRow)
|
||||
{
|
||||
foreach ($aPolygons as $aRow) {
|
||||
echo "<tr>";
|
||||
foreach($aRow as $sCol => $sVal)
|
||||
{
|
||||
switch($sCol)
|
||||
{
|
||||
foreach ($aRow as $sCol => $sVal) {
|
||||
switch ($sCol) {
|
||||
case 'osm_id':
|
||||
echo '<td>'.osmLink($aRow).'</td>';
|
||||
break;
|
||||
|
||||
@@ -19,23 +19,18 @@ $iOsmId = $oParams->getInt('osmid', -1);
|
||||
|
||||
$oDB =& getDB();
|
||||
|
||||
if ($sOsmType && $iOsmId > 0)
|
||||
{
|
||||
if ($sOsmType && $iOsmId > 0) {
|
||||
$sPlaceId = chksql($oDB->getOne("select place_id from placex where osm_type = '".$sOsmType."' and osm_id = ".$iOsmId." order by type = 'postcode' asc"));
|
||||
|
||||
// Be nice about our error messages for broken geometry
|
||||
|
||||
if (!$sPlaceId)
|
||||
{
|
||||
if (!$sPlaceId) {
|
||||
$aPointDetails = chksql($oDB->getRow("select osm_type, osm_id, errormessage, class, type, get_name_by_language(name,$sLanguagePrefArraySQL) as localname, ST_AsText(prevgeometry) as prevgeom, ST_AsText(newgeometry) as newgeom from import_polygon_error where osm_type = '".$sOsmType."' and osm_id = ".$iOsmId." order by updated desc limit 1"));
|
||||
if (!PEAR::isError($aPointDetails) && $aPointDetails) {
|
||||
if (preg_match('/\[(-?\d+\.\d+) (-?\d+\.\d+)\]/', $aPointDetails['errormessage'], $aMatches))
|
||||
{
|
||||
if (preg_match('/\[(-?\d+\.\d+) (-?\d+\.\d+)\]/', $aPointDetails['errormessage'], $aMatches)) {
|
||||
$aPointDetails['error_x'] = $aMatches[1];
|
||||
$aPointDetails['error_y'] = $aMatches[2];
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
$aPointDetails['error_x'] = 0;
|
||||
$aPointDetails['error_y'] = 0;
|
||||
}
|
||||
@@ -50,14 +45,12 @@ if (!$sPlaceId) userError("Please select a place id");
|
||||
|
||||
$iPlaceID = (int)$sPlaceId;
|
||||
|
||||
if (CONST_Use_US_Tiger_Data)
|
||||
{
|
||||
if (CONST_Use_US_Tiger_Data) {
|
||||
$iParentPlaceID = chksql($oDB->getOne('select parent_place_id from location_property_tiger where place_id = '.$iPlaceID));
|
||||
if ($iParentPlaceID) $iPlaceID = $iParentPlaceID;
|
||||
}
|
||||
|
||||
if (CONST_Use_Aux_Location_data)
|
||||
{
|
||||
if (CONST_Use_Aux_Location_data) {
|
||||
$iParentPlaceID = chksql($oDB->getOne('select parent_place_id from location_property_aux where place_id = '.$iPlaceID));
|
||||
if ($iParentPlaceID) $iPlaceID = $iParentPlaceID;
|
||||
}
|
||||
@@ -83,16 +76,14 @@ $aPointDetails['icon'] = $aClassType[$aPointDetails['class'].':'.$aPointDetails[
|
||||
// Get all alternative names (languages, etc)
|
||||
$sSQL = "select (each(name)).key,(each(name)).value from placex where place_id = $iPlaceID order by (each(name)).key";
|
||||
$aPointDetails['aNames'] = $oDB->getAssoc($sSQL);
|
||||
if (PEAR::isError($aPointDetails['aNames'])) // possible timeout
|
||||
{
|
||||
if (PEAR::isError($aPointDetails['aNames'])) { // possible timeout
|
||||
$aPointDetails['aNames'] = [];
|
||||
}
|
||||
|
||||
// Extra tags
|
||||
$sSQL = "select (each(extratags)).key,(each(extratags)).value from placex where place_id = $iPlaceID order by (each(extratags)).key";
|
||||
$aPointDetails['aExtraTags'] = $oDB->getAssoc($sSQL);
|
||||
if (PEAR::isError($aPointDetails['aExtraTags'])) // possible timeout
|
||||
{
|
||||
if (PEAR::isError($aPointDetails['aExtraTags'])) { // possible timeout
|
||||
$aPointDetails['aExtraTags'] = [];
|
||||
}
|
||||
|
||||
@@ -106,8 +97,7 @@ $sSQL .= " from placex, (select centroid as placegeometry from placex where plac
|
||||
$sSQL .= " where linked_place_id = $iPlaceID";
|
||||
$sSQL .= " order by rank_address asc,rank_search asc,get_name_by_language(name,$sLanguagePrefArraySQL),housenumber";
|
||||
$aLinkedLines = $oDB->getAll($sSQL);
|
||||
if (PEAR::isError($aLinkedLines)) // possible timeout
|
||||
{
|
||||
if (PEAR::isError($aLinkedLines)) { // possible timeout
|
||||
$aLinkedLines = [];
|
||||
}
|
||||
|
||||
@@ -119,43 +109,36 @@ $sSQL .= " where parent_place_id = $iPlaceID order by rank_address asc,rank_sear
|
||||
$sSQL .= " (select centroid as placegeometry from placex where place_id = $iPlaceID) as x";
|
||||
$sSQL .= " order by rank_address asc,rank_search asc,localname,housenumber";
|
||||
$aParentOfLines = $oDB->getAll($sSQL);
|
||||
if (PEAR::isError($aParentOfLines)) // possible timeout
|
||||
{
|
||||
if (PEAR::isError($aParentOfLines)) { // possible timeout
|
||||
$aParentOfLines = [];
|
||||
}
|
||||
|
||||
$aPlaceSearchNameKeywords = false;
|
||||
$aPlaceSearchAddressKeywords = false;
|
||||
if ($oParams->getBool('keywords'))
|
||||
{
|
||||
if ($oParams->getBool('keywords')) {
|
||||
$sSQL = "select * from search_name where place_id = $iPlaceID";
|
||||
$aPlaceSearchName = $oDB->getRow($sSQL);
|
||||
if (PEAR::isError($aPlaceSearchName)) // possible timeout
|
||||
{
|
||||
if (PEAR::isError($aPlaceSearchName)) { // possible timeout
|
||||
$aPlaceSearchName = [];
|
||||
}
|
||||
|
||||
$sSQL = "select * from word where word_id in (".substr($aPlaceSearchName['name_vector'],1,-1).")";
|
||||
$aPlaceSearchNameKeywords = $oDB->getAll($sSQL);
|
||||
if (PEAR::isError($aPlaceSearchNameKeywords)) // possible timeout
|
||||
{
|
||||
if (PEAR::isError($aPlaceSearchNameKeywords)) { // possible timeout
|
||||
$aPlaceSearchNameKeywords = [];
|
||||
}
|
||||
|
||||
|
||||
$sSQL = "select * from word where word_id in (".substr($aPlaceSearchName['nameaddress_vector'],1,-1).")";
|
||||
$aPlaceSearchAddressKeywords = $oDB->getAll($sSQL);
|
||||
if (PEAR::isError($aPlaceSearchAddressKeywords)) // possible timeout
|
||||
{
|
||||
if (PEAR::isError($aPlaceSearchAddressKeywords)) { // possible timeout
|
||||
$aPlaceSearchAddressKeywords = [];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
logEnd($oDB, $hLog, 1);
|
||||
|
||||
if ($sOutputFormat=='html')
|
||||
{
|
||||
if ($sOutputFormat=='html') {
|
||||
$sDataDate = chksql($oDB->getOne("select TO_CHAR(lastimportdate - '2 minutes'::interval,'YYYY/MM/DD HH24:MI')||' GMT' from import_status limit 1"));
|
||||
$sTileURL = CONST_Map_Tile_URL;
|
||||
$sTileAttribution = CONST_Map_Tile_Attribution;
|
||||
|
||||
@@ -20,17 +20,14 @@ $iOsmId = $oParams->getInt('osmid', -1);
|
||||
|
||||
$oDB =& getDB();
|
||||
|
||||
if ($sOsmType && $iOsmId > 0)
|
||||
{
|
||||
if ($sOsmType && $iOsmId > 0) {
|
||||
$sPlaceId = chksql($oDB->getOne("select place_id from placex where osm_type = '".$sOsmType."' and osm_id = ".$iOsmId." order by type = 'postcode' asc"));
|
||||
|
||||
// Be nice about our error messages for broken geometry
|
||||
if (!$sPlaceId)
|
||||
{
|
||||
if (!$sPlaceId) {
|
||||
$aPointDetails = chksql($oDB->getRow("select osm_type, osm_id, errormessage, class, type, get_name_by_language(name,$sLanguagePrefArraySQL) as localname, ST_AsText(prevgeometry) as prevgeom, ST_AsText(newgeometry) as newgeom from import_polygon_error where osm_type = '".$sOsmType."' and osm_id = ".$iOsmId." order by updated desc limit 1"));
|
||||
if ($aPointDetails) {
|
||||
if (preg_match('/\[(-?\d+\.\d+) (-?\d+\.\d+)\]/', $aPointDetails['errormessage'], $aMatches))
|
||||
{
|
||||
if (preg_match('/\[(-?\d+\.\d+) (-?\d+\.\d+)\]/', $aPointDetails['errormessage'], $aMatches)) {
|
||||
$aPointDetails['error_x'] = $aMatches[1];
|
||||
$aPointDetails['error_y'] = $aMatches[2];
|
||||
}
|
||||
@@ -44,14 +41,12 @@ if (!$sPlaceId) userError("Please select a place id");
|
||||
|
||||
$iPlaceID = (int)$sPlaceId;
|
||||
|
||||
if (CONST_Use_US_Tiger_Data)
|
||||
{
|
||||
if (CONST_Use_US_Tiger_Data) {
|
||||
$iParentPlaceID = chksql($oDB->getOne('select parent_place_id from location_property_tiger where place_id = '.$iPlaceID));
|
||||
if ($iParentPlaceID) $iPlaceID = $iParentPlaceID;
|
||||
}
|
||||
|
||||
if (CONST_Use_Aux_Location_data)
|
||||
{
|
||||
if (CONST_Use_Aux_Location_data) {
|
||||
$iParentPlaceID = chksql($oDB->getOne('select parent_place_id from location_property_aux where place_id = '.$iPlaceID));
|
||||
if ($iParentPlaceID) $iPlaceID = $iParentPlaceID;
|
||||
}
|
||||
@@ -65,16 +60,14 @@ $aPlaceAddress = array_reverse($oPlaceLookup->getAddressDetails($iPlaceID));
|
||||
if (!sizeof($aPlaceAddress)) userError("Unknown place id.");
|
||||
|
||||
$aBreadcrums = array();
|
||||
foreach($aPlaceAddress as $i => $aPlace)
|
||||
{
|
||||
foreach ($aPlaceAddress as $i => $aPlace) {
|
||||
if (!$aPlace['place_id']) continue;
|
||||
$aBreadcrums[] = array('placeId' => $aPlace['place_id'],
|
||||
'osmType' => $aPlace['osm_type'],
|
||||
'osmId' => $aPlace['osm_id'],
|
||||
'localName' => $aPlace['localname']);
|
||||
|
||||
if ($sOutputFormat == 'html')
|
||||
{
|
||||
if ($sOutputFormat == 'html') {
|
||||
$sPlaceUrl = 'hierarchy.php?place_id='.$aPlace['place_id'];
|
||||
if ($i) echo " > ";
|
||||
echo '<a href="'.$sPlaceUrl.'">'.$aPlace['localname'].'</a> ('.osmLink($aPlace).')';
|
||||
@@ -82,8 +75,7 @@ foreach($aPlaceAddress as $i => $aPlace)
|
||||
}
|
||||
|
||||
|
||||
if ($sOutputFormat == 'json')
|
||||
{
|
||||
if ($sOutputFormat == 'json') {
|
||||
header("content-type: application/json; charset=UTF-8");
|
||||
$aDetails = array();
|
||||
$aDetails['breadcrumbs'] = $aBreadcrums;
|
||||
@@ -100,34 +92,28 @@ $sSQL .= " where parent_place_id in (".join(',',$aRelatedPlaceIDs).") and name i
|
||||
$sSQL .= " order by rank_address asc,rank_search asc,localname,class, type,housenumber";
|
||||
$aParentOfLines = chksql($oDB->getAll($sSQL));
|
||||
|
||||
if (sizeof($aParentOfLines))
|
||||
{
|
||||
if (sizeof($aParentOfLines)) {
|
||||
echo '<h2>Parent Of:</h2>';
|
||||
$aClassType = getClassTypesWithImportance();
|
||||
$aGroupedAddressLines = array();
|
||||
foreach($aParentOfLines as $aAddressLine)
|
||||
{
|
||||
foreach ($aParentOfLines as $aAddressLine) {
|
||||
if (isset($aClassType[$aAddressLine['class'].':'.$aAddressLine['type'].':'.$aAddressLine['admin_level']]['label'])
|
||||
&& $aClassType[$aAddressLine['class'].':'.$aAddressLine['type'].':'.$aAddressLine['admin_level']]['label'])
|
||||
{
|
||||
&& $aClassType[$aAddressLine['class'].':'.$aAddressLine['type'].':'.$aAddressLine['admin_level']]['label']
|
||||
) {
|
||||
$aAddressLine['label'] = $aClassType[$aAddressLine['class'].':'.$aAddressLine['type'].':'.$aAddressLine['admin_level']]['label'];
|
||||
}
|
||||
elseif (isset($aClassType[$aAddressLine['class'].':'.$aAddressLine['type']]['label'])
|
||||
&& $aClassType[$aAddressLine['class'].':'.$aAddressLine['type']]['label'])
|
||||
{
|
||||
} elseif (isset($aClassType[$aAddressLine['class'].':'.$aAddressLine['type']]['label'])
|
||||
&& $aClassType[$aAddressLine['class'].':'.$aAddressLine['type']]['label']
|
||||
) {
|
||||
$aAddressLine['label'] = $aClassType[$aAddressLine['class'].':'.$aAddressLine['type']]['label'];
|
||||
}
|
||||
else $aAddressLine['label'] = ucwords($aAddressLine['type']);
|
||||
} else $aAddressLine['label'] = ucwords($aAddressLine['type']);
|
||||
|
||||
if (!isset($aGroupedAddressLines[$aAddressLine['label']])) $aGroupedAddressLines[$aAddressLine['label']] = array();
|
||||
$aGroupedAddressLines[$aAddressLine['label']][] = $aAddressLine;
|
||||
}
|
||||
|
||||
foreach($aGroupedAddressLines as $sGroupHeading => $aParentOfLines)
|
||||
{
|
||||
foreach ($aGroupedAddressLines as $sGroupHeading => $aParentOfLines) {
|
||||
echo "<h3>$sGroupHeading</h3>";
|
||||
foreach($aParentOfLines as $aAddressLine)
|
||||
{
|
||||
foreach ($aParentOfLines as $aAddressLine) {
|
||||
$aAddressLine['localname'] = $aAddressLine['localname']?$aAddressLine['localname']:$aAddressLine['housenumber'];
|
||||
$sOSMType = formatOSMType($aAddressLine['osm_type'], false);
|
||||
|
||||
|
||||
@@ -31,23 +31,20 @@ $oPlaceLookup->setIncludeNameDetails($oParams->getBool('namedetails', false));
|
||||
|
||||
$aOsmIds = explode(',', $oParams->getString('osm_ids', ''));
|
||||
|
||||
if (count($aOsmIds) > CONST_Places_Max_ID_count)
|
||||
{
|
||||
if (count($aOsmIds) > CONST_Places_Max_ID_count) {
|
||||
userError('Bulk User: Only ' . CONST_Places_Max_ID_count . " ids are allowed in one request.");
|
||||
}
|
||||
|
||||
foreach ($aOsmIds AS $sItem)
|
||||
{
|
||||
foreach ($aOsmIds AS $sItem) {
|
||||
// Skip empty sItem
|
||||
if (empty($sItem)) continue;
|
||||
|
||||
$sType = $sItem[0];
|
||||
$iId = (int) substr($sItem, 1);
|
||||
if ( $iId > 0 && ($sType == 'N' || $sType == 'W' || $sType == 'R') )
|
||||
{
|
||||
if ($iId > 0 && ($sType == 'N' || $sType == 'W' || $sType == 'R')) {
|
||||
$aCleanedQueryParts[] = $sType . $iId;
|
||||
$oPlace = $oPlaceLookup->lookupOSMID($sType, $iId);
|
||||
if ($oPlace){
|
||||
if ($oPlace) {
|
||||
// we want to use the search-* output templates, so we need to fill
|
||||
// $aSearchResults and slightly change the (reverse search) oPlace
|
||||
// key names
|
||||
|
||||
@@ -17,8 +17,7 @@
|
||||
$iTotalBroken = (int) chksql($oDB->getOne('select count(*) from import_polygon_error'));
|
||||
|
||||
$aPolygons = array();
|
||||
while($iTotalBroken && !sizeof($aPolygons))
|
||||
{
|
||||
while ($iTotalBroken && !sizeof($aPolygons)) {
|
||||
$sSQL = 'select osm_type as "type",osm_id as "id",class as "key",type as "value",name->\'name\' as "name",';
|
||||
$sSQL .= 'country_code as "country",errormessage as "error message",updated';
|
||||
$sSQL .= " from import_polygon_error";
|
||||
@@ -31,8 +30,7 @@
|
||||
$aPolygons = chksql($oDB->getAll($sSQL));
|
||||
}
|
||||
|
||||
if (CONST_Debug)
|
||||
{
|
||||
if (CONST_Debug) {
|
||||
var_dump($aPolygons);
|
||||
exit;
|
||||
}
|
||||
@@ -89,32 +87,25 @@ table td {
|
||||
echo "<table>";
|
||||
echo "<tr>";
|
||||
//var_dump($aPolygons[0]);
|
||||
foreach($aPolygons[0] as $sCol => $sVal)
|
||||
{
|
||||
foreach ($aPolygons[0] as $sCol => $sVal) {
|
||||
echo "<th>".$sCol."</th>";
|
||||
}
|
||||
echo "<th> </th>";
|
||||
echo "<th> </th>";
|
||||
echo "</tr>";
|
||||
$aSeen = array();
|
||||
foreach($aPolygons as $aRow)
|
||||
{
|
||||
foreach ($aPolygons as $aRow) {
|
||||
if (isset($aSeen[$aRow['type'].$aRow['id']])) continue;
|
||||
$aSeen[$aRow['type'].$aRow['id']] = 1;
|
||||
echo "<tr>";
|
||||
foreach($aRow as $sCol => $sVal)
|
||||
{
|
||||
switch($sCol)
|
||||
{
|
||||
foreach ($aRow as $sCol => $sVal) {
|
||||
switch ($sCol) {
|
||||
case 'error message':
|
||||
if (preg_match('/Self-intersection\\[([0-9.\\-]+) ([0-9.\\-]+)\\]/',$sVal,$aMatch))
|
||||
{
|
||||
if (preg_match('/Self-intersection\\[([0-9.\\-]+) ([0-9.\\-]+)\\]/',$sVal,$aMatch)) {
|
||||
$aRow['lat'] = $aMatch[2];
|
||||
$aRow['lon'] = $aMatch[1];
|
||||
echo "<td><a href=\"http://www.openstreetmap.org/?lat=".$aMatch[2]."&lon=".$aMatch[1]."&zoom=18&layers=M&".$sOSMType."=".$aRow['id']."\">".($sVal?$sVal:' ')."</a></td>";
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
echo "<td>".($sVal?$sVal:' ')."</td>";
|
||||
}
|
||||
break;
|
||||
@@ -127,12 +118,9 @@ table td {
|
||||
}
|
||||
}
|
||||
echo "<td><a href=\"http://localhost:8111/import?url=http://www.openstreetmap.org/api/0.6/".$sOSMType.'/'.$aRow['id']."/full\" target=\"josm\">josm</a></td>";
|
||||
if (isset($aRow['lat']))
|
||||
{
|
||||
if (isset($aRow['lat'])) {
|
||||
echo "<td><a href=\"http://open.mapquestapi.com/dataedit/index_flash.html?lat=".$aRow['lat']."&lon=".$aRow['lon']."&zoom=18\" target=\"potlatch2\">P2</a></td>";
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
echo "<td> </td>";
|
||||
}
|
||||
echo "</tr>";
|
||||
|
||||
@@ -16,14 +16,11 @@ $bAsKML = $oParams->getBool('polygon_kml');
|
||||
$bAsSVG = $oParams->getBool('polygon_svg');
|
||||
$bAsText = $oParams->getBool('polygon_text');
|
||||
if ((($bAsGeoJSON?1:0) + ($bAsKML?1:0) + ($bAsSVG?1:0)
|
||||
+ ($bAsText?1:0)) > CONST_PolygonOutput_MaximumTypes)
|
||||
{
|
||||
if (CONST_PolygonOutput_MaximumTypes)
|
||||
{
|
||||
+ ($bAsText?1:0)) > CONST_PolygonOutput_MaximumTypes
|
||||
) {
|
||||
if (CONST_PolygonOutput_MaximumTypes) {
|
||||
userError("Select only ".CONST_PolygonOutput_MaximumTypes." polgyon output option");
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
userError("Polygon output is disabled");
|
||||
}
|
||||
}
|
||||
@@ -52,12 +49,9 @@ $sOsmType = $oParams->getSet('osm_type', array('N', 'W', 'R'));
|
||||
$iOsmId = $oParams->getInt('osm_id', -1);
|
||||
$fLat = $oParams->getFloat('lat');
|
||||
$fLon = $oParams->getFloat('lon');
|
||||
if ($sOsmType && $iOsmId > 0)
|
||||
{
|
||||
if ($sOsmType && $iOsmId > 0) {
|
||||
$aPlace = $oPlaceLookup->lookupOSMID($sOsmType, $iOsmId);
|
||||
}
|
||||
else if ($fLat !== false && $fLon !== false)
|
||||
{
|
||||
} else if ($fLat !== false && $fLon !== false) {
|
||||
$oReverseGeocode = new ReverseGeocode($oDB);
|
||||
$oReverseGeocode->setZoom($oParams->getInt('zoom', 18));
|
||||
|
||||
@@ -66,14 +60,11 @@ else if ($fLat !== false && $fLon !== false)
|
||||
|
||||
$aPlace = $oPlaceLookup->lookup((int)$aLookup['place_id'],
|
||||
$aLookup['type'], $aLookup['fraction']);
|
||||
}
|
||||
else if ($sOutputFormat != 'html')
|
||||
{
|
||||
} else if ($sOutputFormat != 'html') {
|
||||
userError("Need coordinates or OSM object to lookup.");
|
||||
}
|
||||
|
||||
if ($aPlace)
|
||||
{
|
||||
if ($aPlace) {
|
||||
$oPlaceLookup->setIncludePolygonAsPoints(false);
|
||||
$oPlaceLookup->setIncludePolygonAsText($bAsText);
|
||||
$oPlaceLookup->setIncludePolygonAsGeoJSON($bAsGeoJSON);
|
||||
@@ -86,21 +77,18 @@ if ($aPlace)
|
||||
$aPlace['lon'], $aPlace['lat'],
|
||||
$fRadius);
|
||||
|
||||
if ($aOutlineResult)
|
||||
{
|
||||
if ($aOutlineResult) {
|
||||
$aPlace = array_merge($aPlace, $aOutlineResult);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (CONST_Debug)
|
||||
{
|
||||
if (CONST_Debug) {
|
||||
var_dump($aPlace);
|
||||
exit;
|
||||
}
|
||||
|
||||
if ($sOutputFormat=='html')
|
||||
{
|
||||
if ($sOutputFormat=='html') {
|
||||
$sDataDate = chksql($oDB->getOne("select TO_CHAR(lastimportdate - '2 minutes'::interval,'YYYY/MM/DD HH24:MI')||' GMT' from import_status limit 1"));
|
||||
$sTileURL = CONST_Map_Tile_URL;
|
||||
$sTileAttribution = CONST_Map_Tile_Attribution;
|
||||
|
||||
@@ -20,8 +20,8 @@ if (CONST_Search_ReversePlanForAll
|
||||
|| isset($aLangPrefOrder['name:de'])
|
||||
|| isset($aLangPrefOrder['name:ru'])
|
||||
|| isset($aLangPrefOrder['name:ja'])
|
||||
|| isset($aLangPrefOrder['name:pl']))
|
||||
{
|
||||
|| isset($aLangPrefOrder['name:pl'])
|
||||
) {
|
||||
$oGeocode->setReverseInPlan(true);
|
||||
}
|
||||
|
||||
@@ -29,31 +29,25 @@ if (CONST_Search_ReversePlanForAll
|
||||
$sOutputFormat = $oParams->getSet('format', array('html', 'xml', 'json', 'jsonv2'), 'html');
|
||||
|
||||
// Show / use polygons
|
||||
if ($sOutputFormat == 'html')
|
||||
{
|
||||
if ($sOutputFormat == 'html') {
|
||||
$oGeocode->setIncludePolygonAsText($oParams->getBool('polygon'));
|
||||
$bAsText = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
$bAsPoints = $oParams->getBool('polygon');
|
||||
$bAsGeoJSON = $oParams->getBool('polygon_geojson');
|
||||
$bAsKML = $oParams->getBool('polygon_kml');
|
||||
$bAsSVG = $oParams->getBool('polygon_svg');
|
||||
$bAsText = $oParams->getBool('polygon_text');
|
||||
if ( ( ($bAsGeoJSON?1:0)
|
||||
if (( ($bAsGeoJSON?1:0)
|
||||
+ ($bAsKML?1:0)
|
||||
+ ($bAsSVG?1:0)
|
||||
+ ($bAsText?1:0)
|
||||
+ ($bAsPoints?1:0)
|
||||
) > CONST_PolygonOutput_MaximumTypes)
|
||||
{
|
||||
if (CONST_PolygonOutput_MaximumTypes)
|
||||
{
|
||||
) > CONST_PolygonOutput_MaximumTypes
|
||||
) {
|
||||
if (CONST_PolygonOutput_MaximumTypes) {
|
||||
userError("Select only ".CONST_PolygonOutput_MaximumTypes." polgyon output option");
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
userError("Polygon output is disabled");
|
||||
}
|
||||
exit;
|
||||
@@ -70,12 +64,10 @@ $oGeocode->setPolygonSimplificationThreshold($oParams->getFloat('polygon_thresho
|
||||
|
||||
$oGeocode->loadParamArray($oParams);
|
||||
|
||||
if (CONST_Search_BatchMode && isset($_GET['batch']))
|
||||
{
|
||||
if (CONST_Search_BatchMode && isset($_GET['batch'])) {
|
||||
$aBatch = json_decode($_GET['batch'], true);
|
||||
$aBatchResults = array();
|
||||
foreach($aBatch as $aBatchParams)
|
||||
{
|
||||
foreach ($aBatch as $aBatchParams) {
|
||||
$oBatchGeocode = clone $oGeocode;
|
||||
$oBatchParams = new ParameterParser($aBatchParams);
|
||||
$oBatchGeocode->loadParamArray($oBatchParams);
|
||||
@@ -90,8 +82,7 @@ if (CONST_Search_BatchMode && isset($_GET['batch']))
|
||||
$oGeocode->setQueryFromParams($oParams);
|
||||
|
||||
if (!$oGeocode->getQueryString()
|
||||
&& isset($_SERVER['PATH_INFO']) && $_SERVER['PATH_INFO'][0] == '/')
|
||||
{
|
||||
&& isset($_SERVER['PATH_INFO']) && $_SERVER['PATH_INFO'][0] == '/') {
|
||||
$sQuery = substr(rawurldecode($_SERVER['PATH_INFO']), 1);
|
||||
|
||||
// reverse order of '/' separated string
|
||||
@@ -106,8 +97,7 @@ $hLog = logStart($oDB, 'search', $oGeocode->getQueryString(), $aLangPrefOrder);
|
||||
$aSearchResults = $oGeocode->lookup();
|
||||
if ($aSearchResults === false) $aSearchResults = array();
|
||||
|
||||
if ($sOutputFormat=='html')
|
||||
{
|
||||
if ($sOutputFormat=='html') {
|
||||
$sDataDate = chksql($oDB->getOne("select TO_CHAR(lastimportdate - '2 minutes'::interval,'YYYY/MM/DD HH24:MI')||' GMT' from import_status limit 1"));
|
||||
}
|
||||
logEnd($oDB, $hLog, sizeof($aSearchResults));
|
||||
|
||||
@@ -12,28 +12,23 @@ function statusError($sMsg)
|
||||
}
|
||||
|
||||
$oDB =& DB::connect(CONST_Database_DSN, false);
|
||||
if (!$oDB || PEAR::isError($oDB))
|
||||
{
|
||||
if (!$oDB || PEAR::isError($oDB)) {
|
||||
statusError("No database");
|
||||
}
|
||||
|
||||
$sStandardWord = $oDB->getOne("select make_standard_name('a')");
|
||||
if (PEAR::isError($sStandardWord))
|
||||
{
|
||||
if (PEAR::isError($sStandardWord)) {
|
||||
statusError("Module failed");
|
||||
}
|
||||
if ($sStandardWord != 'a')
|
||||
{
|
||||
if ($sStandardWord != 'a') {
|
||||
statusError("Module call failed");
|
||||
}
|
||||
|
||||
$iWordID = $oDB->getOne("select word_id,word_token, word, class, type, country_code, operator, search_name_count from word where word_token in (' a')");
|
||||
if (PEAR::isError($iWordID))
|
||||
{
|
||||
if (PEAR::isError($iWordID)) {
|
||||
statusError("Query failed");
|
||||
}
|
||||
if (!$iWordID)
|
||||
{
|
||||
if (!$iWordID) {
|
||||
statusError("No value");
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user