Commit 5b2896c513fb9a6a13c5310444429e71732032c6

Authored by Edmar Moretti
1 parent 3ecbded3

Inclusão do controle de acesso por grupos de usuários na definição dos mapfiles

admin/admin.db
No preview for this file type
admin/html/editormapfile.html
... ... @@ -74,6 +74,8 @@ body {
74 74 as características de cada LAYER nas opções
75 75 abaixo. <br> Para incluir o tema nos menus, <a
76 76 href='arvore.html'>edite a &aacute;rvore de temas </a> <br>
  77 + <p>Importante: a restri&ccedil;&atilde;o ao tema por meio da defini&ccedil;&atilde;o de grupos de usu&aacute;rios n&atilde;o bloqueia o acesso por meio de download, WMS, KML, etc.
  78 + Para bloquear esse tipo de acesso &eacute; necess&aacute;rio alterar as op&ccedil;&otilde;es espec&iacute;ficas. Por padr&atilde;o, esses servi&ccedil;os s&atilde;o habilitados para qualquer usu&aacute;rio, n&atilde;o sendo poss&iacute;vel bloquear apenas para determinados grupos.
77 79 <div id="letras"></div>
78 80 <p>Mapfiles (arquivos .map existentes no diretório i3geo/temas):</p>
79 81 <div id="tabela" style="left: -5px;"></div>
... ...
admin/js/arvore.js
... ... @@ -854,10 +854,13 @@ function gravaDados(tipo,id)
854 854 }
855 855 if(tipo == "raizmenu" || tipo == "raizgrupo")
856 856 {
857   - var texto = obj.options[obj.selectedIndex].text;
858   - var no = tree.getNodeByProperty("id_raiz",id);
859   - no.getContentEl().getElementsByTagName("span")[0].innerHTML = texto;
860   - no.html = no.getContentEl().innerHTML;
  857 + var obje = document.getElementById("Eid_tema");
  858 + if(obje){
  859 + var texto = obje.options[obje.selectedIndex].text;
  860 + var no = tree.getNodeByProperty("id_raiz",id);
  861 + no.getContentEl().getElementsByTagName("span")[0].innerHTML = texto;
  862 + no.html = no.getContentEl().innerHTML;
  863 + }
861 864 }
862 865 core_carregando("desativa");
863 866 }
... ...
admin/php/classe_arvore.php
... ... @@ -39,6 +39,8 @@ Classe utilizada para compor a &amp;aacute;rvore de temas ou obter dados espec&amp;iacut
39 39 */
40 40 class Arvore
41 41 {
  42 + //temas com acesso restrito e que nao podem ser acessados pelo usuario que esta logado
  43 + public $temassindevidos;
42 44 protected $locaplic;
43 45 //subgrupos que tem pelo menos um tema
44 46 //public $sql_subgrupos = "select i3geoadmin_subgrupos.nome_subgrupo,i3geoadmin_n2.id_n2,i3geoadmin_n2.publicado,i3geoadmin_n2.n2_perfil from i3geoadmin_n2 LEFT JOIN i3geoadmin_subgrupos ON i3geoadmin_n2.id_subgrupo = i3geoadmin_subgrupos.id_subgrupo ";
... ... @@ -73,40 +75,36 @@ class Arvore
73 75 if(!empty($esquemaadmin)){
74 76 $this->esquemaadmin = $esquemaadmin.".";
75 77 }
76   - if(!isset($convUTF))
77   - {
  78 + if(!isset($convUTF)){
78 79 $convUTF = true;
79 80 }
80 81 $this->convUTF = $convUTF;
81 82 $this->dbh = $dbh;
82 83  
83 84 $this->idioma = $idioma;
84   - if($idioma == "pt")
85   - {
  85 + if($idioma == "pt"){
86 86 $coluna = "nome_grupo";
87 87 }
88   - else
89   - {$coluna = $idioma;
  88 + else{
  89 + $coluna = $idioma;
90 90 }
91 91 $this->sql_grupos = "select i3geoadmin_grupos.$coluna as nome_grupo,id_n1,id_menu,i3geoadmin_n1.publicado,n1_perfil from ".$this->esquemaadmin."i3geoadmin_n1 LEFT JOIN ".$this->esquemaadmin."i3geoadmin_grupos ON i3geoadmin_n1.id_grupo = i3geoadmin_grupos.id_grupo ";
92 92  
93   - if($idioma == "pt")
94   - {
  93 + if($idioma == "pt"){
95 94 $coluna = "nome_subgrupo";
96 95 }
97   - else
98   - {$coluna = $idioma;
  96 + else{
  97 + $coluna = $idioma;
99 98 }
100 99 $this->sql_subgrupos = "select i3geoadmin_subgrupos.$coluna as nome_subgrupo,i3geoadmin_n2.id_n2,i3geoadmin_n2.publicado,i3geoadmin_n2.n2_perfil from ".$this->esquemaadmin."i3geoadmin_n2 LEFT JOIN ".$this->esquemaadmin."i3geoadmin_subgrupos ON i3geoadmin_n2.id_subgrupo = i3geoadmin_subgrupos.id_subgrupo ";
101 100  
102   - if($idioma == "pt")
103   - {
  101 + if($idioma == "pt"){
104 102 $coluna = "nome_tema";
105 103 }
106   - else
107   - {$coluna = $idioma;
  104 + else{
  105 + $coluna = $idioma;
108 106 }
109   - $this->sql_temasraiz = "select id_raiz,i3geoadmin_raiz.id_tema,$coluna as nome_tema,tipoa_tema,perfil FROM ".$this->esquemaadmin."i3geoadmin_raiz LEFT JOIN ".$this->esquemaadmin."i3geoadmin_temas ON i3geoadmin_temas.id_tema = i3geoadmin_raiz.id_tema ";
  107 + $this->sql_temasraiz = "select codigo_tema,id_raiz,i3geoadmin_raiz.id_tema,$coluna as nome_tema,tipoa_tema,perfil FROM ".$this->esquemaadmin."i3geoadmin_raiz LEFT JOIN ".$this->esquemaadmin."i3geoadmin_temas ON i3geoadmin_temas.id_tema = i3geoadmin_raiz.id_tema ";
110 108 $this->sql_temasSubgrupo = "select i3geoadmin_temas.tipoa_tema, i3geoadmin_temas.codigo_tema,i3geoadmin_temas.tags_tema,i3geoadmin_n3.id_n3,i3geoadmin_temas.$coluna as nome_tema,i3geoadmin_n3.publicado,i3geoadmin_n3.n3_perfil,i3geoadmin_n3.id_tema,i3geoadmin_temas.download_tema,i3geoadmin_temas.ogc_tema from ".$this->esquemaadmin."i3geoadmin_n3 LEFT JOIN ".$this->esquemaadmin."i3geoadmin_temas ON i3geoadmin_n3.id_tema = i3geoadmin_temas.id_tema ";
111 109  
112 110 //$this->sql_temas = "select kmz_tema,nacessos,id_tema,kml_tema,ogc_tema,download_tema,tags_tema,tipoa_tema,link_tema,desc_tema,$coluna as nome_tema,codigo_tema from i3geoadmin_temas ";
... ... @@ -120,10 +118,13 @@ class Arvore
120 118 $this->editor = false;
121 119 $this->editor = $this->verificaOperacaoSessao("admin/php/classe_arvore/editor");
122 120 $this->pubsql = " (publicado != 'NAO' or publicado isnull) and ";
123   - if($this->editor)
124   - {
  121 + if($this->editor){
125 122 $this->pubsql = "";
126 123 }
  124 + if(!function_exists("listaTemasIndevidos")){
  125 + include_once(__DIR__."/../../classesphp/funcoes_gerais.php");
  126 + }
  127 + $this->temasindevidos = listaTemasIndevidos();
127 128 }
128 129 function __destruct()
129 130 {
... ... @@ -131,6 +132,20 @@ class Arvore
131 132 $this->dbhw = null;
132 133 }
133 134 /*
  135 + Function: validaTemas
  136 +
  137 + Remove de um array os temas que nao sao permitidos ao usuario atualmente logado
  138 + */
  139 + function validaTemas($linhas,$id){
  140 + $res = array();
  141 + foreach($linhas as $l){
  142 + if(!in_array($l[$id],$this->temasindevidos)){
  143 + array_push($res,$l);
  144 + }
  145 + }
  146 + return $res;
  147 + }
  148 + /*
134 149 Function: pegaListaDeMenus
135 150  
136 151 Retorna a lista de menus
... ... @@ -145,20 +160,20 @@ class Arvore
145 160 */
146 161 function pegaListaDeMenus($perfil)
147 162 {
148   - if($this->idioma == "pt")
149   - {
  163 + if($this->idioma == "pt"){
150 164 $coluna = "nome_menu";
151 165 }
152   - else
153   - {$coluna = $this->idioma;
  166 + else{
  167 + $coluna = $this->idioma;
154 168 }
155 169 if($this->editor == true)
156 170 {
157 171 $perfil = "";
158 172 $sql = "SELECT publicado_menu,'' as perfil_menu,aberto,desc_menu,id_menu,$coluna as nome_menu from ".$this->esquemaadmin."i3geoadmin_menus order by nome_menu";
159 173 }
160   - else
  174 + else{
161 175 $sql = "SELECT publicado_menu,perfil_menu,aberto,desc_menu,id_menu,$coluna as nome_menu from ".$this->esquemaadmin."i3geoadmin_menus where publicado_menu != 'NAO' or publicado_menu isnull order by nome_menu";
  176 + }
162 177 $regs = $this->execSQL($sql);
163 178 $resultado = array();
164 179 foreach($regs as $reg)
... ... @@ -460,10 +475,10 @@ class Arvore
460 475  
461 476 {array}
462 477 */
463   - function pegaGruposMenu($id_menu)
464   - {
  478 + function pegaGruposMenu($id_menu){
465 479 $grupos = $this->execSQL($this->sql_grupos."where ".$this->pubsql." id_menu='$id_menu' order by ordem");
466 480 $raiz = $this->execSQL($this->sql_temasraiz."where i3geoadmin_raiz.id_menu='$id_menu' and i3geoadmin_raiz.nivel = 0 order by ordem");
  481 + $raiz = $this->validaTemas($raiz,"codigo_tema");
467 482 return array("raiz"=>$raiz,"grupos"=>$grupos);
468 483 }
469 484 /*
... ... @@ -485,6 +500,7 @@ class Arvore
485 500 {
486 501 $subgrupos = $this->execSQL($this->sql_subgrupos."where ".$this->pubsql." i3geoadmin_n2.id_n1='$id_n1' order by ordem");
487 502 $raiz = $this->execSQL($this->sql_temasraiz."where i3geoadmin_raiz.nivel = 1 and i3geoadmin_raiz.id_nivel = $id_n1 order by ordem");
  503 + $raiz = $this->validaTemas($raiz,"codigo_tema");
488 504 return array("raiz"=>$raiz,"subgrupos"=>$subgrupos);
489 505 }
490 506 /*
... ... @@ -504,7 +520,9 @@ class Arvore
504 520 */
505 521 function pegaTemasRaizGrupo($id_menu,$id_n1)
506 522 {
507   - return $this->execSQL($this->sql_temasraiz."where i3geoadmin_raiz.nivel = 1 and i3geoadmin_raiz.id_nivel = $id_n1 order by ordem");
  523 + $raiz = $this->execSQL($this->sql_temasraiz."where i3geoadmin_raiz.nivel = 1 and i3geoadmin_raiz.id_nivel = $id_n1 order by ordem");
  524 + $raiz = $this->validaTemas($raiz,"codigo_tema");
  525 + return $raiz;
508 526 }
509 527 /*
510 528 Function: pegaTema
... ... @@ -548,7 +566,9 @@ class Arvore
548 566 */
549 567 function pegaTemasSubGrupo($id_n2)
550 568 {
551   - return $this->execSQL($this->sql_temasSubgrupo."where ".$this->pubsql." i3geoadmin_n3.id_n2='$id_n2' order by ordem");
  569 + $temas = $this->execSQL($this->sql_temasSubgrupo."where ".$this->pubsql." i3geoadmin_n3.id_n2='$id_n2' order by ordem");
  570 + $temas = $this->validaTemas($temas,"codigo_tema");
  571 + return $temas;
552 572 }
553 573 /*
554 574 Function: formataGruposMenu
... ... @@ -573,12 +593,10 @@ class Arvore
573 593 $dados = $this->pegaGruposMenu($id_menu);
574 594 $resultado = array();
575 595 $temasraiz = array();
576   - foreach($dados["raiz"] as $temar)
577   - {
  596 + foreach($dados["raiz"] as $temar){
578 597 $temasraiz[] = $this->formataTema($temar["id_tema"]);
579 598 }
580   - if(count($dados["grupos"]) == 0)
581   - {
  599 + if(count($dados["grupos"]) == 0){
582 600 $grupos[] = array();
583 601 }
584 602 foreach($dados["grupos"] as $grupo)
... ...
admin/php/editormapfile.php
... ... @@ -1080,6 +1080,7 @@ function refazerLayer()
1080 1080 $nl = ms_newLayerObj($mapatema,$layernovo);
1081 1081 $nl->set("name",$codigomap);
1082 1082 $nl->setmetadata("nomeoriginal","");
  1083 + $nl->setmetadata("temaoriginal","");
1083 1084 $nl->setmetadata("olopacity","");
1084 1085 $nl->setmetadata("olstatus","");
1085 1086 $nl->setmetadata("gmopacity","");
... ... @@ -1283,7 +1284,7 @@ function adicionaGrupoUsrTema(){
1283 1284 if($q){
1284 1285 $teste = $q->fetchAll();
1285 1286 if(count($teste) == 0){
1286   - $dbhw->query("INSERT INTO ".$esquemaadmin."i3geousr_grupotema (id_tema,id_grupo) VALUES ($id_tema,$id_grupo)");
  1287 + $dbhw->query("INSERT INTO ".$esquemaadmin."i3geousr_grupotema (id_tema,id_grupo) VALUES ($id_tema , $id_grupo)");
1287 1288 }
1288 1289 }
1289 1290 return "ok";
... ...
admin/php/login.php
... ... @@ -106,6 +106,7 @@ switch (strtoupper($funcao))
106 106 $_SESSION["senha"] = $senha;
107 107 $_SESSION["papeis"] = $teste["papeis"];
108 108 $_SESSION["operacoes"] = $teste["operacoes"];
  109 + $_SESSION["gruposusr"] = $teste["gruposusr"];
109 110 $fingerprint = 'I3GEOLOGIN' . $_SERVER['HTTP_USER_AGENT'];
110 111 //var_dump($_SESSION["operacoes"]);exit;
111 112 $_SESSION['fingerprint'] = md5($fingerprint . session_id());
... ... @@ -238,6 +239,7 @@ function autenticaUsuario($usuario,$senha){
238 239 if(count($dados) > 0){
239 240 $pa = pegaDados("select * from ".$esquemaadmin."i3geousr_papelusuario where id_usuario = ".$dados[0]["id_usuario"],$locaplic);
240 241 $op = pegadados("SELECT O.codigo, PU.id_usuario FROM ".$esquemaadmin."i3geousr_operacoes AS O JOIN ".$esquemaadmin."i3geousr_operacoespapeis AS OP ON O.id_operacao = OP.id_operacao JOIN ".$esquemaadmin."i3geousr_papelusuario AS PU ON OP.id_papel = PU.id_papel WHERE id_usuario = ".$dados[0]["id_usuario"],$locaplic);
  242 + $gr = pegadados("SELECT * from ".$esquemaadmin."i3geousr_grupousuario where id_usuario = ".$dados[0]["id_usuario"]);
241 243 $operacoes = array();
242 244 foreach($op as $o){
243 245 $operacoes[$o["codigo"]] = true;
... ... @@ -246,7 +248,11 @@ function autenticaUsuario($usuario,$senha){
246 248 foreach($pa as $p){
247 249 $papeis[] = $p["id_papel"];
248 250 }
249   - $r = array("usuario"=>$dados[0],"papeis"=>$papeis,"operacoes"=>$operacoes);
  251 + $gruposusr = array();
  252 + foreach($gr as $p){
  253 + $gruposusr[] = $p["id_grupo"];
  254 + }
  255 + $r = array("usuario"=>$dados[0],"papeis"=>$papeis,"operacoes"=>$operacoes,"gruposusr"=>$gruposusr);
250 256 return $r;
251 257 }
252 258 else{
... ...
classesphp/classe_mapa.php
... ... @@ -927,6 +927,8 @@ Ao ser adicionado, todos os layers do arquivo indicado ser&amp;atilde;o acrescentado
927 927 Os layers que formam grupos tamb&eacute;m s&atilde;o processados, tendo seus nomes alterados de acordo.
928 928 Cada novo layer receber&aacute; um novo nome, definido de forma aleatória.
929 929 Os nomes dos temas podem conter o caminho completo do mapfile.
  930 +O nome original do LAYER (NAME) sera armazenado no metadata nomeoriginal
  931 +O nome do tema (mapfile) original sera armazenado no metadata temaoriginal
930 932  
931 933 Parametros:
932 934  
... ... @@ -984,6 +986,7 @@ $random - indica se os nomes dos novos layers ser&amp;atilde;o modificados ou nao
984 986 autoClasses($nlayer,$this->mapa);
985 987 $nlayer->set("status",MS_DEFAULT);
986 988 $nlayer->setmetadata("nomeoriginal",$nlayer->name);
  989 + $nlayer->setmetadata("temaoriginal",str_replace(".map","",basename($nomemap)));
987 990 $nlayer->set("name",$nomeunico[$n]);
988 991 //altera o nome do grupo se existir
989 992 if ($nlayer->group != " " && $nlayer->group != "" )
... ...
classesphp/funcoes_gerais.php
... ... @@ -3049,4 +3049,109 @@ function permissoesarquivo($arquivo){
3049 3049  
3050 3050 return $info;
3051 3051 }
  3052 +/*
  3053 +Function: validaAcessoTemas
  3054 +
  3055 +Remocao dos layers com restricoes de acesso registradas no sistema de controle de usuarios
  3056 +*/
  3057 +function validaAcessoTemas($map_file){
  3058 + $indevidos = listaLayersIndevidos($map_file);
  3059 + if(count($indevidos) > 0){
  3060 + $m = ms_newMapObj($map_file);
  3061 + foreach($indevidos as $i){
  3062 + $l = $m->getlayerbyname($i);
  3063 + $l->set("status",MS_DELETE);
  3064 + }
  3065 + $m->save($map_file);
  3066 + }
  3067 + return;
  3068 +}
  3069 +/*
  3070 +Function: listaTemasRestritos
  3071 +
  3072 +Lista os temas que possuem restricao de acesso para apenas alguns grupos de usuarios
  3073 +
  3074 +O retorno e um array com a chave sendo o codigo do tema e o valor um array com a lista de ids de grupos que podem acessar
  3075 +*/
  3076 +function listaTemasRestritos(){
  3077 + include_once(__DIR__."/../admin/php/admin.php");
  3078 + $res = pegaDados("select id_grupo,codigo_tema from ".$esquemaadmin."i3geousr_grupotema as gt,".$esquemaadmin."i3geoadmin_temas as te where gt.id_tema = te.id_tema");
  3079 + $restritos = array();
  3080 + foreach ($res as $r){
  3081 + if($restritos[$r["codigo_tema"]]){
  3082 + array_push($restritos[$r["codigo_tema"]],$r["id_grupo"]);
  3083 + }
  3084 + else{
  3085 + $restritos[$r["codigo_tema"]] = array($r["id_grupo"]);
  3086 + }
  3087 + }
  3088 + return $restritos;
  3089 +}
  3090 +/*
  3091 +Function: listaLayersIndevidos
  3092 +
  3093 +Lista os layers de um mapfile que sao restritos e que nao sao permitidos ao usuario logado
  3094 +*/
  3095 +function listaLayersIndevidos($map_file){
  3096 + $indevidos = array();
  3097 + $restritos = listaTemasRestritos();
  3098 + if(count($restritos) > 0){
  3099 + $gruposusr = listaGruposUsrLogin();
  3100 + $m = ms_newMapObj($map_file);
  3101 + $c = $m->numlayers;
  3102 + for ($i=0;$i < $c;++$i) {
  3103 + $layer = $m->getlayer($i);
  3104 + $meta = $layer->getmetadata("temaoriginal");
  3105 + if($meta != ""){
  3106 + $t = $restritos[$meta];
  3107 + if(!in_array($t,$gruposusr)){
  3108 + array_push($indevidos,$layer->name);
  3109 + }
  3110 + }
  3111 + }
  3112 + }
  3113 + return $indevidos;
  3114 +}
  3115 +/*
  3116 + Function: listaTemasIndevidos
  3117 +
  3118 +Lista os temas que sao restritos e que nao sao permitidos ao usuario logado
  3119 +*/
  3120 +function listaTemasIndevidos(){
  3121 + $indevidos = array();
  3122 + $restritos = listaTemasRestritos();
  3123 + if(count($restritos) > 0){
  3124 + $gruposusr = listaGruposUsrLogin();
  3125 + $c = count($gruposusr);
  3126 + reset($restritos);
  3127 + while (list($key, $val) = each($restritos)) {
  3128 + //var_dump($val);var_dump($gruposusr);exit;
  3129 + if(array_search($gruposusr,$val) === true || $c == 0){
  3130 + array_push($indevidos,$key);
  3131 + }
  3132 + }
  3133 + }
  3134 + return $indevidos;
  3135 +}
  3136 +/*
  3137 + Function: listaGruposUsrLogin
  3138 +
  3139 +Lista os os grupos ao qual pertence o usuario atualmente logado
  3140 +*/
  3141 +function listaGruposUsrLogin(){
  3142 + if(empty($_COOKIE["i3geocodigologin"])){
  3143 + return array();
  3144 + }
  3145 + session_write_close();
  3146 + $nameatual = session_name();
  3147 + $idatual = session_id();
  3148 + session_name("i3GeoLogin");
  3149 + session_id($_COOKIE["i3geocodigologin"]);
  3150 + session_start();
  3151 + $res = $_SESSION["gruposusr"];
  3152 + session_name("$nameatual");
  3153 + session_id($idatual);
  3154 + session_start();
  3155 + return $res;
  3156 +}
3052 3157 ?>
... ...
classesphp/mapa_controle.php
... ... @@ -159,7 +159,9 @@ if (isset($debug) &amp;&amp; strtolower($debug) == &quot;sim&quot;)
159 159 //se as extens&otilde;es j&aacute; estiverem carregadas no PHP, vc pode comentar essa linha para que o processamento fique mais r&aacute;pido
160 160 //
161 161 include_once ("carrega_ext.php");
162   -include_once("funcoes_gerais.php");
  162 +if(!function_exists("sobeAnno")){
  163 + include_once("funcoes_gerais.php");
  164 +}
163 165 if ($funcao == "criaMapa")
164 166 {
165 167 session_name("i3GeoPHP");
... ... @@ -182,6 +184,8 @@ if ($funcao == &quot;criaMapa&quot;)
182 184 include_once("ms_criamapa.php");
183 185 $_SESSION["interface"] = $interfaceTemp;
184 186 cpjson(session_id());
  187 + //ver funcoes_gerais.php
  188 + validaAcessoTemas($_SESSION("map_file"));
185 189 return;
186 190 }
187 191 if (!isset($map_file))
... ... @@ -249,20 +253,6 @@ Inicia o mapa, pegando os par&amp;acirc;metros necess&amp;aacute;rios para a montagem in
249 253 iniciaMapa();
250 254 break;
251 255 /*
252   -Valor: MONTAFLAMINGO
253   -
254   -Gera o arquivo xml de configura&ccedil;&atilde;o para a interface Flamingo.
255   -
256   -O arquivo xml &eacute; gravado no diretório tempor&aacute;rio do mapserver e cont&eacute;m a string de conex&atilde;o com o gerador de webservices classesphp/flamingoogc.php
257   -Esse gerador, recebe como par&acirc;metro o id da se&ccedil;&atilde;o atual e transforma o mapfile atual em um webservcie capaz de ser entendido pelo flamingo.
258   -
259   -<flamingo.inc>
260   -*/
261   - case "MONTAFLAMINGO":
262   - include("flamingo.inc");
263   - $retorno = $host."/ms_tmp/".basename(dirname($map_file))."/flamingo.xml";
264   - break;
265   -/*
266 256 Valor: OPENLAYERS
267 257  
268 258 Prepara o mapa atual para funcionar na interface openlayers.
... ... @@ -1055,11 +1045,11 @@ Adiciona um novo tema ao mapa.
1055 1045 copiaSeguranca($map_file);
1056 1046 $m = new Mapa($map_file);
1057 1047 $salvar = $m->adicionaTema($temas,$locaplic);
1058   - if($salvar)
1059   - {
  1048 + if($salvar){
1060 1049 $m->salva();
1061 1050 $_SESSION["contadorsalva"]++;
1062 1051 }
  1052 + validaAcessoTemas($map_file);
1063 1053 $retorno = "ok";
1064 1054 /*
1065 1055 if($interface != "openlayers"){
... ...
classesphp/mapa_inicia.php
... ... @@ -103,6 +103,14 @@ Retorno:
103 103 function iniciaMapa()
104 104 {
105 105 global $emailInstituicao,$openid,$interfacePadrao,$mensagemInicia,$kmlurl,$tituloInstituicao,$tempo,$navegadoresLocais,$locaplic,$embedLegenda,$map_file,$mapext,$w,$h,$R_path,$locmapserv,$utilizacgi,$expoeMapfile,$interface;
  106 + //
  107 + //verifica se algum tema e restrito a determinado usuario
  108 + //as funcoes de validacao encontram-se em funcoes_gerais.php
  109 + //
  110 + if(!function_exists("validaAcessoTemas")){
  111 + include_once("funcoes_gerais.php");
  112 + }
  113 + validaAcessoTemas($_SESSION["map_file"]);
106 114 if(!isset($kmlurl))
107 115 {$kmlurl = "";}
108 116 error_reporting(0);
... ...
ferramentas/loginusuario/index.js
... ... @@ -113,7 +113,7 @@ i3GEOF.loginusuario = {
113 113 '<input id=i3geosenha type=password style="width:250px;" value=""/><br>' +
114 114 '<p class="paragrafo" ><input id=i3GEOFloginusuario size=20 type=button value="'+$trad("x29")+'" />&nbsp;<input id=i3GEOFlogoutusuario size=20 type=button value="Logout" />' +
115 115 '<p class="paragrafo" onclick="i3GEOF.loginusuario.recuperarSenha()" style="cursor:pointer;color:blue;">'+$trad("x32")+'</p>' +
116   - '<p class="paragrafo" onclick="i3GEOF.loginusuario.alterarSenha()" style="cursor:pointer;color:blue;">'+$trad("x52")+'</p>';
  116 + '<p class="paragrafo" onclick="i3GEOF.loginusuario.alterarSenha()" style="cursor:pointer;color:blue;">'+$trad("x52")+'</p><br>';
117 117 return ins;
118 118 },
119 119 /*
... ...
ms_criamapa.php
... ... @@ -647,7 +647,8 @@ function incluiTemasIniciais()
647 647 {$existeraster = true;}
648 648 if ($layern->name == "estadosl")
649 649 {$layern->set("data",$locaplic."/aplicmap/dados/estados.shp");}
650   - $layern->setmetadata("NOMEORIGINAL",$layern->name);
  650 + $layern->setmetadata("nomeoriginal",$layern->name);
  651 + $layern->setmetadata("temaoriginal",str_replace(".map","",basename($arqtemp)));
651 652 autoClasses($layern,$mapn);
652 653 //
653 654 //necess&aacute;rio para n&atilde;o alterar a extens&atilde;o do mapa por esse par&acirc;metro
... ...
temas/acidmap.map
1 1 MAP
2 2  
3 3  
4   - FONTSET "c:\ms4w\apache\htdocs\i3geo/symbols/fontes.txt"
5   - SYMBOLSET "c:\ms4w\apache\htdocs\i3geo/symbols/simbolos.sym"
  4 + FONTSET "../symbols/fontes.txt"
  5 + SYMBOLSET "../symbols/simbolos.sym"
6 6 LAYER
7 7 CONNECTION "http://localhost:8080/geoserver/wms?VALUE_COLUMN=VALOR&SERVICE=AMS&VERSION=1.1.1&REQUEST=GetMap&SRS=EPSG:4326&FORMAT=image/png&EXCEPTIONS=application/vnd.ogc.se_inimage&TILED=true&TRANSPARENT=FALSE&VALUE_COLUMN=value&SIMPLIFY_METHOD=1&SIMPLIFY_SIZE=400&INTERVALS[]=10,20,45,70,100&INTERVALS_COLORS[]=0xffffff00,0xffb2,0xff00b2,0xffff00b2,0xff0000b2&RENDERER_TYPE=2&INTERPOLATION_STRATEGY=2&RADIUS=32"
8 8 CONNECTIONTYPE WMS
... ...
temas/biomashp.map
1 1 MAP
2   - FONTSET "c:\ms4w\apache\htdocs\i3geo\symbols\fontes.txt"
3   - SYMBOLSET "c:\ms4w\apache\htdocs\i3geo\symbols\simbolos.sym"
4   - LAYER
5   - CONNECTION ""
6   - DATA "c:\ms4w\apache\htdocs\i3geo\aplicmap\dados\biomas.shp"
7   - FOOTER "teste.htm"
8   - GROUP "biomashp"
9   - HEADER "teste.htm"
10   - METADATA
11   - "ltempoitemimagem" ""
12   - "cache" "SIM"
13   - "CLASSE" "SIM"
14   - "ltempoitemdescricao" ""
15   - "palletestep" ""
16   - "ltempoiteminicio" ""
17   - "permitekmz" "sim"
18   - "ltempoitemtip" ""
19   - "iconetema" "http://www.gpsdrive.de/development/map-icons/square.small/leisure/park.png"
20   - "description_template" ""
21   - "ltempoitemtitulo" ""
22   - "ltempoitemlink" ""
23   - "palletefile" ""
24   - "extensao" "-44 -23 -39 -21"
25   - "NOMEORIGINAL" ""
26   - "permitedownload" "sim"
27   - "ltempoformatodata" ""
28   - "ltempoitemicone" ""
29   - "download" "SIM"
30   - "permitekml" "sim"
31   - "permiteogc" ""
32   - "convcaracter" ""
33   - "TEMA" "bioma shp"
34   - "identifica" "NAO"
35   - "editorsql" ""
36   - "ltempoitemfim" ""
37   - END
38   - NAME "biomashp"
39   - STATUS OFF
40   - TEMPLATE "none.htm"
41   - OPACITY 50
42   - TYPE POLYGON
  2 + FONTSET "../symbols/fontes.txt"
  3 + SYMBOLSET "../symbols/simbolos.sym"
  4 + LAYER
  5 + CONNECTION ""
  6 + DATA "/var/www/geodados/brasil/vegetacao/biomas.shp"
  7 + FOOTER "teste.htm"
  8 + GROUP "biomashp"
  9 + HEADER "teste.htm"
  10 + METADATA
  11 + "cache" "SIM"
  12 + "ltempoitemimagem" ""
  13 + "ltempoitemdescricao" ""
  14 + "CLASSE" "SIM"
  15 + "ltempoiteminicio" ""
  16 + "palletestep" ""
  17 + "ltempoitemtip" ""
  18 + "permitekmz" "sim"
  19 + "ltempoitemtitulo" ""
  20 + "description_template" ""
  21 + "iconetema" "http://www.gpsdrive.de/development/map-icons/square.small/leisure/park.png"
  22 + "ltempoitemlink" ""
  23 + "extensao" "-44 -23 -39 -21"
  24 + "palletefile" ""
  25 + "NOMEORIGINAL" ""
  26 + "ltempoformatodata" ""
  27 + "permitedownload" "sim"
  28 + "ltempoitemicone" ""
  29 + "download" "SIM"
  30 + "permiteogc" ""
  31 + "permitekml" "sim"
  32 + "TEMA" "Biomas shapefile"
  33 + "convcaracter" ""
  34 + "editorsql" ""
  35 + "identifica" "NAO"
  36 + "ltempoitemfim" ""
  37 + END # METADATA
  38 + NAME "biomashp"
  39 + PROCESSING "ITEMS=CD_LEGENDA"
  40 + STATUS OFF
  41 + TEMPLATE "none.htm"
  42 + TILEITEM "location"
  43 + OPACITY 50
  44 + TYPE POLYGON
43 45 UNITS METERS
44   - PROCESSING "ITEMS=CD_LEGENDA"
45   - CLASS
46   - NAME "CAATINGA"
47   - EXPRESSION ('[CD_LEGENDA]'eq'CAATINGA')
48   - STYLE
49   - ANGLE 360
50   - COLOR 21 44 114
51   - SYMBOL 0
52   - WIDTH 1
53   - END
54   - TITLE ""
55   - END
56   - CLASS
57   - NAME "PAMPA"
58   - EXPRESSION ('[CD_LEGENDA]'eq'PAMPA')
59   - STYLE
60   - ANGLE 360
61   - COLOR 225 189 199
62   - SYMBOL 0
63   - WIDTH 1
64   - END
65   - TITLE ""
66   - END
67   - CLASS
68   - NAME "CERRADO"
69   - EXPRESSION ('[CD_LEGENDA]'eq'CERRADO')
70   - STYLE
71   - ANGLE 360
72   - COLOR 17 235 39
73   - SYMBOL 0
74   - WIDTH 1
75   - END
76   - TITLE ""
77   - END
78   - CLASS
79   - NAME "PANTANAL"
80   - EXPRESSION ('[CD_LEGENDA]'eq'PANTANAL')
81   - STYLE
82   - ANGLE 360
83   - COLOR 242 192 145
84   - SYMBOL 0
85   - WIDTH 1
86   - END
87   - TITLE ""
88   - END
89   - CLASS
90   - NAME "AMAZONIA"
91   - EXPRESSION ('[CD_LEGENDA]'eq'AMAZONIA')
92   - STYLE
93   - ANGLE 360
94   - COLOR 149 120 37
95   - SYMBOL 0
96   - WIDTH 1
97   - END
98   - TITLE ""
99   - END
100   - CLASS
101   - NAME "MATA ATLANTICA"
102   - EXPRESSION ('[CD_LEGENDA]'eq'MATA ATLANTICA')
103   - STYLE
104   - ANGLE 360
105   - COLOR 208 160 125
106   - SYMBOL 0
107   - WIDTH 1
108   - END
109   - TITLE ""
110   - END
111   - END
112   -
113   -END
114   -
  46 + CLASS
  47 + NAME "CAATINGA"
  48 + EXPRESSION ('[CD_LEGENDA]'eq'CAATINGA')
  49 + STYLE
  50 + COLOR 21 44 114
  51 + OFFSET 0 0
  52 + END # STYLE
  53 + TITLE ""
  54 + END # CLASS
  55 + CLASS
  56 + NAME "PAMPA"
  57 + EXPRESSION ('[CD_LEGENDA]'eq'PAMPA')
  58 + STYLE
  59 + COLOR 225 189 199
  60 + OFFSET 0 0
  61 + END # STYLE
  62 + TITLE ""
  63 + END # CLASS
  64 + CLASS
  65 + NAME "CERRADO"
  66 + EXPRESSION ('[CD_LEGENDA]'eq'CERRADO')
  67 + STYLE
  68 + COLOR 17 235 39
  69 + OFFSET 0 0
  70 + END # STYLE
  71 + TITLE ""
  72 + END # CLASS
  73 + CLASS
  74 + NAME "PANTANAL"
  75 + EXPRESSION ('[CD_LEGENDA]'eq'PANTANAL')
  76 + STYLE
  77 + COLOR 242 192 145
  78 + OFFSET 0 0
  79 + END # STYLE
  80 + TITLE ""
  81 + END # CLASS
  82 + CLASS
  83 + NAME "AMAZONIA"
  84 + EXPRESSION ('[CD_LEGENDA]'eq'AMAZONIA')
  85 + STYLE
  86 + COLOR 149 120 37
  87 + OFFSET 0 0
  88 + END # STYLE
  89 + TITLE ""
  90 + END # CLASS
  91 + CLASS
  92 + NAME "MATA ATLANTICA"
  93 + EXPRESSION ('[CD_LEGENDA]'eq'MATA ATLANTICA')
  94 + STYLE
  95 + COLOR 208 160 125
  96 + OFFSET 0 0
  97 + END # STYLE
  98 + TITLE ""
  99 + END # CLASS
  100 + END # LAYER
  101 +
  102 +END # MAP
  103 +
... ...