Commit 4e4a117f5c38fcb1518073e54f94fa91884692c8
1 parent
c810613e
Exists in
master
and in
7 other branches
Correção na busca de fotos via Google
Showing
2 changed files
with
19 additions
and
7 deletions
Show diff stats
ferramentas/buscafotos/funcoes.php
| ... | ... | @@ -6,9 +6,8 @@ require_once(dirname(__FILE__)."/../../pacotes/cpaint/cpaint2.inc.php"); |
| 6 | 6 | require_once(dirname(__FILE__)."/../../ms_configura.php"); |
| 7 | 7 | include("../blacklist.php"); |
| 8 | 8 | verificaBlFerramentas(basename(dirname(__FILE__)),$i3geoBlFerramentas,false); |
| 9 | -require_once(dirname(__FILE__)."/../../pacotes/phpflickr/phpFlickr.php"); | |
| 10 | 9 | error_reporting(0); |
| 11 | - | |
| 10 | +require_once(dirname(__FILE__)."/../../pacotes/phpflickr/phpFlickr.php"); | |
| 12 | 11 | |
| 13 | 12 | $funcao = $_GET["funcao"]; |
| 14 | 13 | $key = $_GET["key"]; |
| ... | ... | @@ -52,14 +51,22 @@ function listafotospanoramio() |
| 52 | 51 | $long = $ret[2] - (($ret[2] - $ret[0]) / 2); |
| 53 | 52 | $resultado = ""; |
| 54 | 53 | $curl = curl_init(); |
| 55 | - curl_setopt ($curl, CURLOPT_URL, "https://maps.googleapis.com/maps/api/place/nearbysearch/json?location=$lat,$long&radius=25000&key=".$googleApiKey); | |
| 54 | + $u = "https://maps.googleapis.com/maps/api/place/nearbysearch/json?location=$lat,$long&radius=50000&key=".$googleApiKey; | |
| 55 | + $recent = file_get_contents($u); | |
| 56 | + /* | |
| 57 | + curl_setopt ($curl, CURLOPT_URL, "https://maps.googleapis.com/maps/api/place/nearbysearch/json?location=$lat,$long&radius=50000&key=".$googleApiKey); | |
| 56 | 58 | curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); |
| 59 | + curl_setopt($ch, CURLOPT_TIMEOUT, 120); | |
| 57 | 60 | if(isset($i3geo_proxy_server) && $i3geo_proxy_server != ""){ |
| 58 | 61 | curl_setopt($curl, CURLOPT_PROXY, $i3geo_proxy_server); |
| 59 | 62 | } |
| 60 | 63 | $recent = curl_exec($curl); |
| 61 | 64 | curl_close ($curl); |
| 62 | - | |
| 65 | + */ | |
| 66 | + $recent = str_replace("\n","",$recent); | |
| 67 | + $recent = str_replace("\t","",$recent); | |
| 68 | + $recent = str_replace("'","",$recent); | |
| 69 | + $recent = str_replace('"',"'",$recent); | |
| 63 | 70 | $cp->set_data($recent); |
| 64 | 71 | } |
| 65 | 72 | function listafotoslocr() | ... | ... |
ferramentas/buscafotos/index.js
| ... | ... | @@ -197,7 +197,11 @@ i3GEOF.buscaFotos = { |
| 197 | 197 | |
| 198 | 198 | */ |
| 199 | 199 | busca: function(pagina){ |
| 200 | - if(i3GEO.parametros.mapscale > 3000000){ | |
| 200 | + if(i3GEO.parametros.googleApiKey == ""){ | |
| 201 | + i3GEO.janela.tempoMsg($trad("precisaApiGM")); | |
| 202 | + return; | |
| 203 | + } | |
| 204 | + if(i3GEO.parametros.mapscale > 3000000){ | |
| 201 | 205 | i3GEO.janela.tempoMsg($trad('msgZoom',i3GEOF.buscaFotos.dicionario)); |
| 202 | 206 | return; |
| 203 | 207 | } |
| ... | ... | @@ -288,9 +292,10 @@ i3GEOF.buscaFotos = { |
| 288 | 292 | ins += "<img class='img-rounded' src='https://maps.googleapis.com/maps/api/place/photo?maxwidth=200&photoreference="+data[i].photos[j].photo_reference+"&key=" + i3GEO.parametros.googleApiKey+"'"; |
| 289 | 293 | ins += " onmouseout='i3GEOF.buscaFotos.escondexy()' "; |
| 290 | 294 | ins += " onmouseover='i3GEOF.buscaFotos.mostraxy(\"" + data[i].geometry.location.lat + "," + data[i].geometry.location.lng + "\")'"; |
| 291 | - ins += " onclick='javascript:window.open(\""+data[i].photos[j].html_attributions[0]+"\")' "; | |
| 295 | + //ins += " onclick='javascript:window.open(\""+data[i].photos[j].html_attributions[0]+"\")' "; | |
| 292 | 296 | t = data[i].name; |
| 293 | - ins += "title='"+t+"' style='margin:3px;cursor:pointer;' />"; | |
| 297 | + ins += " title='"+t+"' style='margin:3px;cursor:pointer;' />"; | |
| 298 | + ins += "<h5>" + data[i].photos[j].html_attributions[0] + "</h5><hr>"; | |
| 294 | 299 | } |
| 295 | 300 | } |
| 296 | 301 | } | ... | ... |