<?php error_reporting(0); if (!isset($locaplic)) { include dirname(__FILE__) . "/../ms_configura.php"; } include_once $locaplic . "/admin/safe.php"; include_once $locaplic . "/admin/php/xml.php"; if (!isset($perfil)) { $perfil = ""; } if (!isset($id_menu)) { $id_menu = ""; } if (!isset($tipo)) { $tipo = ""; } if (!isset($tipoRetorno)) { $tipoRetorno = "xml"; } $dados = geraXmlMenutemas($perfil, $id_menu, $tipo, $locaplic); if ($tipoRetorno == "JSON") { return $dados; } else { echo header("Content-type: application/xml"); echo $dados; }
function fonteTema($tema) { include_once $this->locaplic . "/admin/php/xml.php"; require $this->locaplic . "/classesphp/classe_menutemas.php"; $menutemas = new Menutemas("", "", "", $this->locaplic); $linkfonte = "erro"; $tipo = ""; $this->xml = ""; foreach ($menutemas->pegaListaDeMenus() as $menu) { if (!isset($menu["url"])) { $menu["url"] = ""; } //para efeitos de compatibilidade entre versões do i3geo $ondexml = $menu["arquivo"]; if ($menu["url"] != "") { $ondexml = $menu["url"]; } $verificaXml = false; if ($ondexml != "") { $verificaXml = simplexml_load_file($ondexml); if ($verificaXml) { $this->xml[] = $verificaXml; } } else { $verificaXml = simplexml_load_string(geraXmlMenutemas(implode(" ", $this->perfil), $menu["idmenu"], $tipo, $this->locaplic)); if ($verificaXml) { $this->xml[] = $verificaXml; } } if (!$verificaXml) { $this->xml[] = simplexml_load_string(geraXmlMenutemas(implode(" ", $this->perfil), $menu["idmenu"], $tipo, $this->locaplic)); } } foreach ($this->xml as $xml) { $subgrupo = array(); foreach ($xml->GRUPO as $grupo) { foreach ($grupo->SGRUPO as $sgrupo) { foreach ($sgrupo->TEMA as $t) { $link = ixml($t, "TLINK"); $tid = ixml($t, "TID"); if ($tid == $tema) { $linkfonte = $link; } } } } } return $linkfonte; }
function listaTags($rss = "", $nrss = "") { include_once $this->locaplic . "/admin/php/xml.php"; $tipo = ""; //carrega os títulos e links do rss especificado $noticiasRSS = array(); //guarda as notícias originais do RRS if ($rss != "") { $conta = 0; foreach (simplexml_load_file($rss)->channel->item as $item) { if ($conta < $nrss) { $noticiasRSS[] = array("desc" => $this->ixml($item, "description"), "titulo" => $this->ixml($item, "title"), "link" => $this->ixml($item, "link")); } $conta++; } } $this->xml = array(); foreach ($this->pegaListaDeMenus() as $menu) { $x = geraXmlMenutemas(implode(" ", $this->perfil), $menu["idmenu"], $tipo, $this->locaplic); $this->xml[] = $x; } $resultado = array(); $noticias = array(); foreach ($this->xml as $xml) { $xml = simplexml_load_string($xml); foreach ($xml->GRUPO as $grupo) { $incluigrupo = TRUE; $temp = $this->ixml($grupo, "PERFIL"); if ($temp != "") { $incluigrupo = FALSE; $perfis = explode(",", $temp); if ($this->array_in_array($this->perfil, $perfis)) { $incluigrupo = TRUE; } } if ($incluigrupo == TRUE) { foreach ($grupo->SGRUPO as $sgrupo) { $incluisgrupo = TRUE; if ($this->perfil != "") { $temp = $this->ixml($sgrupo, "PERFIL"); $perfis = str_replace(",", " ", $temp); $perfis = explode(" ", $perfis); if (!$this->array_in_array($this->perfil, $perfis)) { $incluisgrupo = FALSE; } } if ($incluisgrupo == TRUE) { foreach ($sgrupo->TEMA as $tema) { $inclui = TRUE; if ($this->perfil != "") { $perfis = str_replace(",", " ", $temp); $perfis = explode(" ", $perfis); if (!$this->array_in_array($this->perfil, $perfis)) { $inclui = FALSE; } } if ($inclui == TRUE) { $tid = $this->ixml($tema, "TID"); $tags = explode(" ", $this->ixml($tema, "TAGS")); foreach ($tags as $tag) { if ($tag != "") { if (!isset($resultado[$tag])) { $resultado[$tag] = array($tid); //busca noticias if (count($noticiasRSS) > 0) { foreach ($noticiasRSS as $noticia) { $titulo = explode(" ", strtolower($this->removeAcentos($noticia["desc"]))); $t = $this->removeAcentos($tag); if (in_array(strtolower($t), $titulo)) { //echo $noticia["link"]."<br>"; if (!isset($noticias[$tag])) { $noticias[$tag] = array("titulo" => $noticia["titulo"], "link" => $noticia["link"]); } else { $noticias[$tag] = array_merge($noticias[$tag], array("titulo" => $noticia["titulo"], "link" => $noticia["link"])); } } } } } else { $resultado[$tag] = array_merge($resultado[$tag], array($tid)); } } } } } } } } } } ksort($resultado); //var_dump($resultado); foreach (array_keys($resultado) as $k) { if (isset($noticias[$k])) { $not = array($noticias[$k]); } else { $not = array(); } $final[] = array("tag" => $k, "temas" => $resultado[$k], "noticias" => $not); } return $final; }