Commit 5e50a90d9ddce8e824ec625b14cc31f317d9a617
1 parent
75c44476
Exists in
master
and in
6 other branches
Correção no gerador de RSS quando o banco de dados de administração utiliza um e…
…squema diferente do public
Showing
2 changed files
with
273 additions
and
268 deletions
Show diff stats
admin/metaestat/variaveis/medidas/classificacoes/funcoes.php
... | ... | @@ -25,7 +25,7 @@ function adicionar($id_medida_variavel, $nome, $observacao,$dbhw) { |
25 | 25 | "id_medida_variavel"=>$id_medida_variavel |
26 | 26 | ); |
27 | 27 | $id_classificacao = \admin\php\funcoesAdmin\i3GeoAdminInsertUnico ( $dbhw, "i3geoestat_classificacao", $dataCol, "nome", "id_classificacao" ); |
28 | - $retorna = \admin\metaestat\variaveis\medidas\classificacoes\alterar ( $id_medida_variavel, $id_classificacao, $nome, $link, $dbhw ); | |
28 | + $retorna = \admin\metaestat\variaveis\medidas\classificacoes\alterar ( $id_medida_variavel, $id_classificacao, $nome, $observacao, $dbhw ); | |
29 | 29 | return $retorna; |
30 | 30 | } catch ( PDOException $e ) { |
31 | 31 | return false; | ... | ... |
classesphp/wscliente.php
1 | -<?php | |
2 | -/* | |
3 | -Title: wscliente.php | |
4 | - | |
5 | -Executa requisições a Web Services convencionais ou nos padrões OGC. | |
6 | - | |
7 | -Possibilita a leitura dos metadados dos serviços e também a execução das funções existentes. | |
8 | - | |
9 | -É utilizado apenas pela aplicação wscliente e as requisições são feitas por meio de AJAX utilizando-se abiblioteca CPAINT. | |
10 | - | |
11 | -Licenca: | |
12 | - | |
13 | -GPL2 | |
14 | - | |
15 | -i3Geo Interface Integrada de Ferramentas de Geoprocessamento para Internet | |
16 | - | |
17 | -Direitos Autorais Reservados (c) 2006 Ministério do Meio Ambiente Brasil | |
18 | -Desenvolvedor: Edmar Moretti edmar.moretti@gmail.com | |
19 | - | |
20 | -Este programa é software livre; você pode redistribuí-lo | |
21 | -e/ou modificá-lo sob os termos da Licença Pública Geral | |
22 | -GNU conforme publicada pela Free Software Foundation; | |
23 | - | |
24 | -Este programa é distribuído na expectativa de que seja útil, | |
25 | -porém, SEM NENHUMA GARANTIA; nem mesmo a garantia implícita | |
26 | -de COMERCIABILIDADE OU ADEQUAÇÃO A UMA FINALIDADE ESPECÍFICA. | |
27 | -Consulte a Licença Pública Geral do GNU para mais detalhes. | |
28 | -Você deve ter recebido uma copia da Licença Pública Geral do | |
29 | -GNU junto com este programa; se não, escreva para a | |
30 | -Free Software Foundation, Inc., no endereço | |
31 | -59 Temple Street, Suite 330, Boston, MA 02111-1307 USA. | |
32 | - | |
33 | -Arquivo: | |
34 | - | |
35 | -i3geo/classesphp/wscliente.php | |
36 | - | |
37 | -Parametros: | |
38 | - | |
39 | -$funcao {string} - nome da função que será executada | |
40 | - | |
41 | -$cp {CPAINT} - objeto CPAINT contendo os parâmetros da API CPAINT | |
42 | - | |
43 | -As variáveis globais de cada função devem ser enviadas como prâmetros ao ser feita a requisição | |
44 | - | |
45 | -*/ | |
46 | -include_once (dirname(__FILE__)."/sani_request.php"); | |
47 | -$_GET = array_merge($_GET,$_POST); | |
48 | -include_once("lews/wms_functions.php"); | |
49 | -include_once(dirname(__FILE__)."/../pacotes/cpaint/cpaint2.inc.php"); | |
50 | -include_once("carrega_ext.php"); | |
51 | -include(dirname(__FILE__)."/../ms_configura.php"); | |
52 | - | |
53 | -$cp = new cpaint(); | |
54 | - | |
55 | -$onlineresource = $_GET["onlineresource"]; | |
56 | -$tipo = $_GET["tipo"]; | |
57 | -$servico = $_GET["servico"]; | |
58 | -$param = $_GET["param"]; | |
59 | -$funcaows = $_GET["funcaows"]; | |
60 | -$rss = $_GET["rss"]; | |
61 | -// | |
62 | -//busca o getcapabilities de um wms | |
63 | -// | |
64 | -$funcao = $_GET["funcao"]; | |
65 | - | |
66 | -if ($funcao == "getcapabilities") | |
67 | -{ | |
68 | - $cp->register('getcapabilities'); | |
69 | - $cp->start(); | |
70 | - $cp->return_data(); | |
71 | - exit; | |
72 | -} | |
73 | -/* | |
74 | -Function: getcapabilities | |
75 | - | |
76 | -Retorna a resposta da função getcapabilities de um serviço WMS. | |
77 | - | |
78 | -Globais: | |
79 | - | |
80 | -$cp {CPAINT} - Objeto CPAINT. | |
81 | - | |
82 | -$onlineresource {string} - Endereço do serviço. | |
83 | - | |
84 | -$tipo {string} - Tipo do serviço WMS|WFS. | |
85 | - | |
86 | -Retorno: | |
87 | - | |
88 | -{JSON} - Objeto JSON com as marcações do XML resultante convertidas para HTML | |
89 | -*/ | |
90 | -function getcapabilities() | |
91 | -{ | |
92 | - global $cp,$onlineresource,$tipo; | |
93 | - $teste = explode("=",$onlineresource); | |
94 | - if ( count($teste) > 1 ){$onlineresource = $onlineresource."&";} | |
95 | - # ------------------------------------------------------------- | |
96 | - # Test that there is a wms service defined before proceding. | |
97 | - # | |
98 | - if ( ! $onlineresource ) { | |
99 | - # No WMS service provided. | |
100 | - wms_fatal("No 'onlineresource' defined."); | |
101 | - } | |
102 | - | |
103 | - $wms_service_request = $onlineresource . "REQUEST=GetCapabilities&SERVICE=".$tipo; | |
104 | - | |
105 | - # ------------------------------------------------------------- | |
106 | - # Test that the capabilites file has successfully downloaded. | |
107 | - # | |
108 | - if( !($wms_capabilities = file($wms_service_request)) ) { | |
109 | - # Cannot download the capabilities file. | |
110 | - wms_fatal("Não foi possível ler o retorno do serviço '$wms_service_request'."); | |
111 | - } | |
112 | - | |
113 | - $wms_capabilities = implode("",$wms_capabilities); | |
114 | - | |
115 | - # ------------------------------------------------------------- | |
116 | - # Test that the capabilites file has successfully parsed. | |
117 | - # | |
118 | - $dom = new DomDocument(); | |
119 | - $dom->loadXML($wms_capabilities); | |
120 | - $cp->set_data(xml2html($wms_capabilities)); | |
121 | -} | |
122 | - | |
123 | - | |
124 | -//le links de RSS para ws | |
125 | -if ($funcao == "listaRSSws") | |
126 | -{ | |
127 | - $cp->register('listaRSSws'); | |
128 | - $cp->start(); | |
129 | - ob_clean; | |
130 | - $cp->return_data(); | |
131 | - exit; | |
132 | -} | |
133 | - | |
134 | -if ($funcao == "listaRSSwsARRAY") | |
135 | -{ | |
136 | - $cp->register('listaRSSwsARRAY'); | |
137 | - $cp->start(); | |
138 | - if(ob_get_contents ()){ | |
139 | - ob_end_clean(); | |
140 | - } | |
141 | - $cp->return_data(); | |
142 | - exit; | |
143 | -} | |
144 | - | |
145 | -/* | |
146 | -Function: listaRSSwsARRAY | |
147 | - | |
148 | -Pega os links de um RSS e retorna o resultado como um array. | |
149 | - | |
150 | -Globais: | |
151 | - | |
152 | -$cp {CPAINT} - Objeto CPAINT. | |
153 | - | |
154 | -$rss {string} - Endereços dos RSS. | |
155 | - | |
156 | -$tipo {string} - Tipo de recurso, permite a escolha do programa PHP que será usado GEORSS|WMS|WS|DOWNLOAD|WMSMETAESTAT | |
157 | - | |
158 | -Retorno: | |
159 | - | |
160 | -{JSON} | |
161 | -*/ | |
162 | -function listaRSSwsARRAY() | |
163 | -{ | |
164 | - global $cp,$rss,$locaplic,$tipo; | |
165 | - | |
166 | - if(!isset($tipo)){$tipo = "GEORSS";} | |
167 | - include_once("$locaplic/classesphp/funcoes_gerais.php"); | |
168 | - include_once("$locaplic/classesphp/xml.php"); | |
169 | - include_once("$locaplic/ms_configura.php"); | |
170 | - $rsss = explode("|",$rss); | |
171 | - if(count($rsss) == 0){ | |
172 | - $rsss = array(" "); | |
173 | - } | |
174 | - $erro = "Erro. Nao foi possivel ler o arquivo"; | |
175 | - $protocolo = explode("/",$_SERVER['SERVER_PROTOCOL']); | |
176 | - $urli3geo = strtolower($protocolo[0])."://".$_SERVER['HTTP_HOST']."/".basename($locaplic); | |
177 | - foreach ($rsss as $r){ | |
178 | - if($r == "" || $r == " "){ | |
179 | - | |
180 | - if($tipo == "GEORSS"){ | |
181 | - $canali = simplexml_load_string(geraXmlGeorss($locaplic)); | |
182 | - $linkrss = $urli3geo."/rss/xmlgeorss.php"; | |
183 | - } | |
184 | - if($tipo == "WMS" || $tipo == "WMS-Tile"){ | |
185 | - $canali = simplexml_load_string(geraXmlWMS($locaplic)); | |
186 | - $linkrss = $urli3geo."/rss/xmlservicoswms.php"; | |
187 | - } | |
188 | - if($tipo == "WMSMETAESTAT") { | |
189 | - $canali = simplexml_load_string(geraXmlWMSmetaestat($locaplic)); | |
190 | - $linkrss = $urli3geo."/rss/xmlservicoswms.php"; | |
191 | - } | |
192 | - if($tipo == "WS"){ | |
193 | - $canali = simplexml_load_string(geraXmlWS($locaplic)); | |
194 | - $linkrss = $urli3geo."/rss/xmlservicosws.php"; | |
195 | - } | |
196 | - } else { | |
197 | - $canali = simplexml_load_file($rss); | |
198 | - } | |
199 | - if($r != "") | |
200 | - $linhas["rss"] = "<a href='".$r."' target=blank ><img style='border:0px solid white;' src='../../imagens/rss.gif' /></a>"; | |
201 | - else{ | |
202 | - $linhas["rss"] = "<a href='".$linkrss."' target=blank ><img style='border:0px solid white;' src='../../imagens/rss.gif' /></a>"; | |
203 | - } | |
204 | - //var_dump($canali); | |
205 | - $canais = array(); | |
206 | - foreach ($canali->channel->item as $item){ | |
207 | - $canais[] = array("id_ws"=>(ixml($item,"id")),"title"=>(ixml($item,"title")),"description"=>(ixml($item,"description")),"link"=>(ixml($item,"link")),"author"=>(ixml($item,"author")),"nacessos"=>(ixml($item,"nacessos")),"nacessosok"=>(ixml($item,"nacessosok")),"tipo_ws"=>(ixml($item,"tipo"))); | |
208 | - } | |
209 | - $linhas["canais"] = $canais; | |
210 | - } | |
211 | - $cp->set_data($linhas); | |
212 | -} | |
213 | - | |
214 | -/* | |
215 | -Function: listaRSSws | |
216 | - | |
217 | -Pega os links de um RSS usando a biblioteca magpierss (depreciado). | |
218 | - | |
219 | -Globais: | |
220 | - | |
221 | -$cp {CPAINT} - Objeto CPAINT. | |
222 | - | |
223 | -$rss {string} - Endereços dos RSS. | |
224 | - | |
225 | -Retorno: | |
226 | - | |
227 | -{JSON} | |
228 | -*/ | |
229 | -function listaRSSws() | |
230 | -{ | |
231 | - global $cp,$rss; | |
232 | - require(dirname(__FILE__).'/../pacotes/magpierss/rss_fetch.inc'); | |
233 | - $rsss = explode("|",$rss); | |
234 | - $erro = "Erro. Nao foi possivel ler o arquivo"; | |
235 | - foreach ($rsss as $r) | |
236 | - { | |
237 | - $rss = fetch_rss($r); | |
238 | - if ($rss) | |
239 | - { | |
240 | - $erro = ""; | |
241 | - $linhas[] = "<a href='".$r."' target=blank ><img style='border:0px solid white;' src='imagens/rss.gif' /></a>####"; | |
242 | - foreach ( $rss->items as $item ) | |
243 | - { | |
244 | - $linha[] = $item['title']; | |
245 | - $linha[] = $item['description']; | |
246 | - $linha[] = $item['link']; | |
247 | - $linha[] = $item['author']; | |
248 | - $linha[] = $item['ranking']; | |
249 | - $linha[] = $item['tempo']; | |
250 | - $linhas[] = implode("#",$linha); | |
251 | - $linha = array(); | |
252 | - } | |
253 | - } | |
254 | - } | |
255 | - if ($erro == "") | |
256 | - { | |
257 | - $retorna = implode("|",$linhas); | |
258 | - $retorna = str_replace("\n","",$retorna); | |
259 | - if (function_exists("mb_convert_encoding")) | |
260 | - {$retorna = mb_convert_encoding($retorna,"UTF-8","ISO-88591");} | |
261 | - else | |
262 | - {$retorna = $retorna;} | |
263 | - } | |
264 | - else {$retorna = $erro;} | |
265 | - $cp->set_data($retorna); | |
266 | -} | |
267 | -?> | |
1 | +<?php | |
2 | +/* | |
3 | +Title: wscliente.php | |
4 | + | |
5 | +Executa requisições a Web Services convencionais ou nos padrões OGC. | |
6 | + | |
7 | +Possibilita a leitura dos metadados dos serviços e também a execução das funções existentes. | |
8 | + | |
9 | +É utilizado apenas pela aplicação wscliente e as requisições são feitas por meio de AJAX utilizando-se abiblioteca CPAINT. | |
10 | + | |
11 | +Licenca: | |
12 | + | |
13 | +GPL2 | |
14 | + | |
15 | +i3Geo Interface Integrada de Ferramentas de Geoprocessamento para Internet | |
16 | + | |
17 | +Direitos Autorais Reservados (c) 2006 Ministério do Meio Ambiente Brasil | |
18 | +Desenvolvedor: Edmar Moretti edmar.moretti@gmail.com | |
19 | + | |
20 | +Este programa é software livre; você pode redistribuí-lo | |
21 | +e/ou modificá-lo sob os termos da Licença Pública Geral | |
22 | +GNU conforme publicada pela Free Software Foundation; | |
23 | + | |
24 | +Este programa é distribuído na expectativa de que seja útil, | |
25 | +porém, SEM NENHUMA GARANTIA; nem mesmo a garantia implícita | |
26 | +de COMERCIABILIDADE OU ADEQUAÇÃO A UMA FINALIDADE ESPECÍFICA. | |
27 | +Consulte a Licença Pública Geral do GNU para mais detalhes. | |
28 | +Você deve ter recebido uma copia da Licença Pública Geral do | |
29 | +GNU junto com este programa; se não, escreva para a | |
30 | +Free Software Foundation, Inc., no endereço | |
31 | +59 Temple Street, Suite 330, Boston, MA 02111-1307 USA. | |
32 | + | |
33 | +Arquivo: | |
34 | + | |
35 | +i3geo/classesphp/wscliente.php | |
36 | + | |
37 | +Parametros: | |
38 | + | |
39 | +$funcao {string} - nome da função que será executada | |
40 | + | |
41 | +$cp {CPAINT} - objeto CPAINT contendo os parâmetros da API CPAINT | |
42 | + | |
43 | +As variáveis globais de cada função devem ser enviadas como prâmetros ao ser feita a requisição | |
44 | + | |
45 | +*/ | |
46 | +include_once (dirname(__FILE__)."/sani_request.php"); | |
47 | +$_GET = array_merge($_GET,$_POST); | |
48 | +include_once("lews/wms_functions.php"); | |
49 | +include_once(dirname(__FILE__)."/../pacotes/cpaint/cpaint2.inc.php"); | |
50 | +include_once("carrega_ext.php"); | |
51 | +include(dirname(__FILE__)."/../ms_configura.php"); | |
52 | + | |
53 | +$cp = new cpaint(); | |
54 | + | |
55 | +$onlineresource = $_GET["onlineresource"]; | |
56 | +$tipo = $_GET["tipo"]; | |
57 | +$servico = $_GET["servico"]; | |
58 | +$param = $_GET["param"]; | |
59 | +$funcaows = $_GET["funcaows"]; | |
60 | +$rss = $_GET["rss"]; | |
61 | +// | |
62 | +//busca o getcapabilities de um wms | |
63 | +// | |
64 | +$funcao = $_GET["funcao"]; | |
65 | + | |
66 | +if ($funcao == "getcapabilities") | |
67 | +{ | |
68 | + $cp->register('getcapabilities'); | |
69 | + $cp->start(); | |
70 | + $cp->return_data(); | |
71 | + exit; | |
72 | +} | |
73 | +/* | |
74 | +Function: getcapabilities | |
75 | + | |
76 | +Retorna a resposta da função getcapabilities de um serviço WMS. | |
77 | + | |
78 | +Globais: | |
79 | + | |
80 | +$cp {CPAINT} - Objeto CPAINT. | |
81 | + | |
82 | +$onlineresource {string} - Endereço do serviço. | |
83 | + | |
84 | +$tipo {string} - Tipo do serviço WMS|WFS. | |
85 | + | |
86 | +Retorno: | |
87 | + | |
88 | +{JSON} - Objeto JSON com as marcações do XML resultante convertidas para HTML | |
89 | +*/ | |
90 | +function getcapabilities() | |
91 | +{ | |
92 | + global $cp,$onlineresource,$tipo; | |
93 | + $teste = explode("=",$onlineresource); | |
94 | + if ( count($teste) > 1 ){$onlineresource = $onlineresource."&";} | |
95 | + # ------------------------------------------------------------- | |
96 | + # Test that there is a wms service defined before proceding. | |
97 | + # | |
98 | + if ( ! $onlineresource ) { | |
99 | + # No WMS service provided. | |
100 | + wms_fatal("No 'onlineresource' defined."); | |
101 | + } | |
102 | + | |
103 | + $wms_service_request = $onlineresource . "REQUEST=GetCapabilities&SERVICE=".$tipo; | |
104 | + | |
105 | + # ------------------------------------------------------------- | |
106 | + # Test that the capabilites file has successfully downloaded. | |
107 | + # | |
108 | + if( !($wms_capabilities = file($wms_service_request)) ) { | |
109 | + # Cannot download the capabilities file. | |
110 | + wms_fatal("Não foi possível ler o retorno do serviço '$wms_service_request'."); | |
111 | + } | |
112 | + | |
113 | + $wms_capabilities = implode("",$wms_capabilities); | |
114 | + | |
115 | + # ------------------------------------------------------------- | |
116 | + # Test that the capabilites file has successfully parsed. | |
117 | + # | |
118 | + $dom = new DomDocument(); | |
119 | + $dom->loadXML($wms_capabilities); | |
120 | + $cp->set_data(xml2html($wms_capabilities)); | |
121 | +} | |
122 | + | |
123 | + | |
124 | +//le links de RSS para ws | |
125 | +if ($funcao == "listaRSSws") | |
126 | +{ | |
127 | + $cp->register('listaRSSws'); | |
128 | + $cp->start(); | |
129 | + ob_clean; | |
130 | + $cp->return_data(); | |
131 | + exit; | |
132 | +} | |
133 | + | |
134 | +if ($funcao == "listaRSSwsARRAY") | |
135 | +{ | |
136 | + $cp->register('listaRSSwsARRAY'); | |
137 | + $cp->start(); | |
138 | + if(ob_get_contents ()){ | |
139 | + ob_end_clean(); | |
140 | + } | |
141 | + $cp->return_data(); | |
142 | + exit; | |
143 | +} | |
144 | + | |
145 | +/* | |
146 | +Function: listaRSSwsARRAY | |
147 | + | |
148 | +Pega os links de um RSS e retorna o resultado como um array. | |
149 | + | |
150 | +Globais: | |
151 | + | |
152 | +$cp {CPAINT} - Objeto CPAINT. | |
153 | + | |
154 | +$rss {string} - Endereços dos RSS. | |
155 | + | |
156 | +$tipo {string} - Tipo de recurso, permite a escolha do programa PHP que será usado GEORSS|WMS|WS|DOWNLOAD|WMSMETAESTAT | |
157 | + | |
158 | +Retorno: | |
159 | + | |
160 | +{JSON} | |
161 | +*/ | |
162 | +function listaRSSwsARRAY() | |
163 | +{ | |
164 | + global $cp,$rss,$locaplic,$tipo,$esquemaadmin; | |
165 | + | |
166 | + if(!isset($tipo)){$tipo = "GEORSS";} | |
167 | + include_once("$locaplic/classesphp/funcoes_gerais.php"); | |
168 | + include_once("$locaplic/classesphp/xml.php"); | |
169 | + include("$locaplic/ms_configura.php"); | |
170 | + | |
171 | + if($esquemaadmin != ""){ | |
172 | + $esquemaadmin = $esquemaadmin."."; | |
173 | + } | |
174 | + | |
175 | + $rsss = explode("|",$rss); | |
176 | + if(count($rsss) == 0){ | |
177 | + $rsss = array(" "); | |
178 | + } | |
179 | + $erro = "Erro. Nao foi possivel ler o arquivo"; | |
180 | + $protocolo = explode("/",$_SERVER['SERVER_PROTOCOL']); | |
181 | + $urli3geo = strtolower($protocolo[0])."://".$_SERVER['HTTP_HOST']."/".basename($locaplic); | |
182 | + foreach ($rsss as $r){ | |
183 | + if($r == "" || $r == " "){ | |
184 | + | |
185 | + if($tipo == "GEORSS"){ | |
186 | + $canali = simplexml_load_string(geraXmlGeorss($locaplic)); | |
187 | + $linkrss = $urli3geo."/rss/xmlgeorss.php"; | |
188 | + } | |
189 | + if($tipo == "WMS" || $tipo == "WMS-Tile"){ | |
190 | + $canali = simplexml_load_string(geraXmlWMS($locaplic)); | |
191 | + $linkrss = $urli3geo."/rss/xmlservicoswms.php"; | |
192 | + } | |
193 | + if($tipo == "WMSMETAESTAT") { | |
194 | + $canali = simplexml_load_string(geraXmlWMSmetaestat($locaplic)); | |
195 | + $linkrss = $urli3geo."/rss/xmlservicoswms.php"; | |
196 | + } | |
197 | + if($tipo == "WS"){ | |
198 | + $canali = simplexml_load_string(geraXmlWS($locaplic)); | |
199 | + $linkrss = $urli3geo."/rss/xmlservicosws.php"; | |
200 | + } | |
201 | + } else { | |
202 | + $canali = simplexml_load_file($rss); | |
203 | + } | |
204 | + if($r != "") | |
205 | + $linhas["rss"] = "<a href='".$r."' target=blank ><img style='border:0px solid white;' src='../../imagens/rss.gif' /></a>"; | |
206 | + else{ | |
207 | + $linhas["rss"] = "<a href='".$linkrss."' target=blank ><img style='border:0px solid white;' src='../../imagens/rss.gif' /></a>"; | |
208 | + } | |
209 | + //var_dump($canali); | |
210 | + $canais = array(); | |
211 | + foreach ($canali->channel->item as $item){ | |
212 | + $canais[] = array("id_ws"=>(ixml($item,"id")),"title"=>(ixml($item,"title")),"description"=>(ixml($item,"description")),"link"=>(ixml($item,"link")),"author"=>(ixml($item,"author")),"nacessos"=>(ixml($item,"nacessos")),"nacessosok"=>(ixml($item,"nacessosok")),"tipo_ws"=>(ixml($item,"tipo"))); | |
213 | + } | |
214 | + $linhas["canais"] = $canais; | |
215 | + } | |
216 | + $cp->set_data($linhas); | |
217 | +} | |
218 | + | |
219 | +/* | |
220 | +Function: listaRSSws | |
221 | + | |
222 | +Pega os links de um RSS usando a biblioteca magpierss (depreciado). | |
223 | + | |
224 | +Globais: | |
225 | + | |
226 | +$cp {CPAINT} - Objeto CPAINT. | |
227 | + | |
228 | +$rss {string} - Endereços dos RSS. | |
229 | + | |
230 | +Retorno: | |
231 | + | |
232 | +{JSON} | |
233 | +*/ | |
234 | +function listaRSSws() | |
235 | +{ | |
236 | + global $cp,$rss; | |
237 | + require(dirname(__FILE__).'/../pacotes/magpierss/rss_fetch.inc'); | |
238 | + $rsss = explode("|",$rss); | |
239 | + $erro = "Erro. Nao foi possivel ler o arquivo"; | |
240 | + foreach ($rsss as $r) | |
241 | + { | |
242 | + $rss = fetch_rss($r); | |
243 | + if ($rss) | |
244 | + { | |
245 | + $erro = ""; | |
246 | + $linhas[] = "<a href='".$r."' target=blank ><img style='border:0px solid white;' src='imagens/rss.gif' /></a>####"; | |
247 | + foreach ( $rss->items as $item ) | |
248 | + { | |
249 | + $linha[] = $item['title']; | |
250 | + $linha[] = $item['description']; | |
251 | + $linha[] = $item['link']; | |
252 | + $linha[] = $item['author']; | |
253 | + $linha[] = $item['ranking']; | |
254 | + $linha[] = $item['tempo']; | |
255 | + $linhas[] = implode("#",$linha); | |
256 | + $linha = array(); | |
257 | + } | |
258 | + } | |
259 | + } | |
260 | + if ($erro == "") | |
261 | + { | |
262 | + $retorna = implode("|",$linhas); | |
263 | + $retorna = str_replace("\n","",$retorna); | |
264 | + if (function_exists("mb_convert_encoding")) | |
265 | + {$retorna = mb_convert_encoding($retorna,"UTF-8","ISO-88591");} | |
266 | + else | |
267 | + {$retorna = $retorna;} | |
268 | + } | |
269 | + else {$retorna = $erro;} | |
270 | + $cp->set_data($retorna); | |
271 | +} | |
272 | +?> | ... | ... |