From bbff35093f05b1930b0ca5eb660b07061d469d32 Mon Sep 17 00:00:00 2001 From: Edmar Moretti Date: Sun, 14 Nov 2010 01:20:45 +0000 Subject: [PATCH] --- menutemas/admin.db | Bin 67584 -> 0 bytes twitter2kml.php | 162 ------------------------------------------------------------------------------------------------------------------------------------------------------------------ 2 files changed, 0 insertions(+), 162 deletions(-) delete mode 100644 twitter2kml.php diff --git a/menutemas/admin.db b/menutemas/admin.db index 56b7ccf..cb6b1d2 100644 Binary files a/menutemas/admin.db and b/menutemas/admin.db differ diff --git a/twitter2kml.php b/twitter2kml.php deleted file mode 100644 index 8e2a14a..0000000 --- a/twitter2kml.php +++ /dev/null @@ -1,162 +0,0 @@ -Title: twitter2geo.php - Converte mensagens registradas no twitter, para um determinado TAG, em um arquivo georreferenciado - As mensagens são consideradas apenas qd possuírem as TAGs #x ou #y, ou então, #lat ou #long - São aceitos todos os parâmetros de busca da API do Twitter, como definidos em http://search.twitter.com/ - - Parametros: - - ajuda - se for definida na URL, mostra uma ajuda ao usuário - tipo - tipo de arquivo que será retornado - - Valores: - - twitter - retona os resultados originais encontrados - kml - retorna os dados no formato kml - - Exemplos: - - twitter2geo.php?ajuda - twitter2geo.php?tipo=kml&q=twit2kml"; - exit; -} -$query = array(); -foreach($chaves as $chave) -{$query[] = $chave."=".$par[$chave];} -$query = implode("&",$query); -$s = PHP_SHLIB_SUFFIX; -if(!function_exists('curl_init')) -{@dl( 'php_curl'.'.'.$s );} -if(!function_exists('curl_init')) -{echo "curl não instalado";} -$curl = curl_init(); -curl_setopt ($curl, CURLOPT_URL, "http://search.twitter.com/search.json?".($query)); -curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); -$result = curl_exec ($curl); -curl_close ($curl); -$result = fixEncoding($result); -if(strtolower($par["tipo"]) == "twitter"){ - //echo header("Content-type: application/json"); - echo $result; - exit; -} -$result = json_decode( $result, true ); -$kml = 'twitter'; -$kml .= ''.$q.''.$q.'1'; -$icon = array(); -if(!$result["results"]) -{exit;} -foreach($result["results"] as $r) -{ - if(!in_array($r["from_user"],$icon)) - { - $kml .= ''; - } - $icon[] = $r["from_user"]; -} -$id = 0; -foreach($result["results"] as $r) -{ - $xy = retornaXY($r["text"]); - if($xy != "") - { - $html = ""; - $html .= ""; - $html .= "
".$r["from_user"]."
"; - $html .= $r["created_at"]."

"; - $html .= $r["text"]."
"; - $kml .=''.$id.''; - $kml .= ''; - $kml .= ''.$r["from_user"].''; - $kml .= ''.$xy.''; - $id++; - } -} -$kml .= '
'; -echo header("Content-type: application/xml"); -echo $kml; -function retornaXY($s) -{ - $x = preg_replace("/(.*#x)|(\s.*)/i","",$s); - if($x == "") - {$x = preg_replace("/(.*#long)|(\s.*)/i","",$s);} - if($x == "") - {$x = preg_replace("/(.*#lon)|(\s.*)/i","",$s);} - $y = preg_replace("/(.*#y)|(\s.*)/i","",$s); - if($y == "") - {$y = preg_replace("/(.*#lat)|(\s.*)/i","",$s);} - $x = str_replace(",",".",$x); - $y = str_replace(",",".",$y); - if(!is_numeric($x) || !is_numeric($y)) - {return "";} - else - {return $x.",".$y;} -} -function fixEncoding($in_str) -{ - $cur_encoding = mb_detect_encoding($in_str) ; - if($cur_encoding == "UTF-8" && mb_check_encoding($in_str,"UTF-8")) - {return $in_str;} - else - {return utf8_encode($in_str);} -} -?> \ No newline at end of file -- libgit2 0.21.2