Commit 80e130418be869780a99f00616a29682847fc479

Authored by Edmar Moretti
1 parent 917983af

Desenvolvimento da página de teste de instalação com bootstrap

.settings/org.eclipse.core.resources.prefs
1 1 eclipse.preferences.version=1
2 2 encoding//interface/openlayersdebug.htm=UTF-8
3 3 encoding//temas/_lbiomashp.map=ISO-8859-1
  4 +encoding//testainstal/index.php=ISO-8859-1
4 5 encoding/<project>=ISO-8859-1
... ...
init/dicionario.js
... ... @@ -234,7 +234,7 @@ g_traducao_init =
234 234 ],
235 235 "18a" : [
236 236 {
237   - pt : "Crie mapas interativos com funções básicas, defina os botões e outras características com uma URL parametrizada.",
  237 + pt : "Crie mapas interativos com fun&ccedil;&otilde;es b&aacute;sicas, defina os bot&otilde;es e outras caracter&iacute;sticas com uma URL parametrizada.",
238 238 en : "",
239 239 es : ""
240 240 }
... ... @@ -409,7 +409,7 @@ g_traducao_init =
409 409 ],
410 410 35 : [
411 411 {
412   - pt : "Bem vindo à página principal do i3Geo. Aqui você encontrará os links de acesso aos mapas, documentação, sistema de administração e outros aplicativos. Colabore com o aprimoramento do i3Geo participando da comunidade de usuários!",
  412 + pt : "Bem vindo &agrave; p&aacute;gina principal do i3Geo. Aqui voc&ecirc; encontrar&aacute; os links de acesso aos mapas, documenta&ccedil;&atilde;o, sistema de administra&ccedil;&atilde;o e outros aplicativos. Colabore com o aprimoramento do i3Geo participando da comunidade de usu&aacute;rios!",
413 413 en : "",
414 414 es : ""
415 415 }
... ...
init/head.php
1 1 <!DOCTYPE html>
2 2 <html lang="pt-br">
3 3 <head>
  4 +<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=ISO-8859-1">
4 5 <?php
5 6 //utilizado para o cabecalho das paginas que nao sao mapas e que usam bootstrap com material design
6 7 echo "
... ... @@ -41,6 +42,7 @@ echo &quot;
41 42 <script src='" . ONDEI3GEO . "/pacotes/bootstrap/js/bootstrap.min.js'></script>
42 43 <!-- IE10 viewport hack for Surface/desktop Windows 8 bug -->
43 44 <script src='" . ONDEI3GEO . "/pacotes/bootstrap/js/ie10-viewport-bug-workaround.js'></script>
  45 + <script src='" . ONDEI3GEO . "/pacotes/bootstrap-material-design/dist/js/material.min.js'></script>
44 46 ";
45 47 ?>
46 48 <style>
... ...
init/index.js
... ... @@ -99,7 +99,7 @@ botoesIni = [
99 99 "target": "_blank"
100 100 },{
101 101 "img":"certificate-server.png",
102   - "href":"../testainstal.php",
  102 + "href":"../testainstal/index.php",
103 103 "titulo":$trad(2,g_traducao_init),
104 104 "subtitulo": $trad("2a",g_traducao_init),
105 105 "fa": "cogs",
... ...
init/index.php
... ... @@ -77,7 +77,6 @@ include &quot;head.php&quot;;
77 77 </ul>
78 78 <div id="mensagemLogin"></div>
79 79 </div>
80   -
81 80 </div>
82 81 </nav>
83 82  
... ... @@ -188,6 +187,7 @@ include &quot;head.php&quot;;
188 187  
189 188 return t;
190 189 }(document, "script", "twitter-wjs"));
  190 + $.material.init();
191 191 });
192 192 </script>
193 193 </body>
... ...
testainstal/index.js 0 → 100755
... ... @@ -0,0 +1,225 @@
  1 +botoesIni = [
  2 +{
  3 + "img":"openlayers.png",
  4 + "href": customDir + "/black_ol.htm",
  5 + "titulo":$trad(4,g_traducao_init),
  6 + "subtitulo": $trad("4a",g_traducao_init),
  7 + "fa": "map-o",
  8 + "target": "_blank"
  9 +},{
  10 + "img":"osm.png",
  11 + "href": customDir + "/black_osm.htm",
  12 + "titulo":$trad(23,g_traducao_init),
  13 + "subtitulo": $trad("23a",g_traducao_init),
  14 + "fa": "map-o",
  15 + "target": "_blank"
  16 +},{
  17 + "img":"googlemaps.png",
  18 + "href": customDir + "/black_gm.phtml",
  19 + "titulo":$trad(6,g_traducao_init),
  20 + "subtitulo": $trad("6a",g_traducao_init),
  21 + "fa": "map-o",
  22 + "target": "_blank"
  23 +},{
  24 + "img":"mashup.png",
  25 + "href":"../mashups",
  26 + "titulo":$trad(18,g_traducao_init) + "<br><a href='../mashups/osm.php?temas=&largura=800&altura=500' target=_blank >OSM</a>" + " - <a href='../mashups/openlayers.php?temas=&largura=800&altura=500' target=_blank >OpenLayers</a>",
  27 + "subtitulo": $trad("18a",g_traducao_init),
  28 + "fa": "map-o",
  29 + "target": "_self"
  30 +},{
  31 + "img":"googleearth.png",
  32 + "href": customDir + "/googleearth.phtml",
  33 + "titulo":$trad(7,g_traducao_init),
  34 + "subtitulo": $trad("7a",g_traducao_init),
  35 + "fa": "map-o",
  36 + "target": "_blank"
  37 +},{
  38 + "img":"cartogramas.png",
  39 + "href": customDir + "/black_carto_ol.htm",
  40 + "titulo":$trad(8,g_traducao_init),
  41 + "subtitulo": $trad("8a",g_traducao_init),
  42 + "fa": "map-o",
  43 + "target": "_blank"
  44 +},{
  45 + "img":"editor.png",
  46 + "href":"../ferramentas/metaestat/editorlimites.php",
  47 + "titulo":$trad(9,g_traducao_init),
  48 + "subtitulo": $trad("9a",g_traducao_init),
  49 + "fa": "map-o",
  50 + "target": "_blank"
  51 +},{
  52 + "img":"window-duplicate.png",
  53 + "href":"../ferramentas/salvamapa/lista.htm",
  54 + "titulo":$trad(34,g_traducao_init),
  55 + "subtitulo": $trad("34a",g_traducao_init),
  56 + "fa": "map-o",
  57 + "target": "_self"
  58 +},{
  59 + "img":"svn-update.png",
  60 + "href":"../datadownload.htm",
  61 + "titulo":$trad(10,g_traducao_init),
  62 + "subtitulo": $trad("10a",g_traducao_init),
  63 + "fa": "download",
  64 + "target": "_self"
  65 +},{
  66 + "img":"ogc_logo.jpg",
  67 + "href":"../ogc.htm",
  68 + "titulo":$trad(11,g_traducao_init),
  69 + "subtitulo": $trad("11a",g_traducao_init),
  70 + "fa": "download",
  71 + "target": "_self"
  72 +},{
  73 + "img":"application-vnd-google-earth-kml.png",
  74 + "href":"../kml.php",
  75 + "titulo":$trad(12,g_traducao_init),
  76 + "subtitulo": $trad("12a",g_traducao_init),
  77 + "fa": "download",
  78 + "target": "_self"
  79 +},{
  80 + "img":"../imagens/saiku_free_small.png",
  81 + "href":"../ferramentas/saiku/esquemaxml.php?locaplic="+window.location.href.replace("/init/index.php",""),
  82 + "titulo":$trad(25,g_traducao_init),
  83 + "subtitulo": $trad("25a",g_traducao_init),
  84 + "fa": "bar-chart",
  85 + "target": "_self"
  86 +},{
  87 + "img":"insert-link.png",
  88 + "href":"../geradordelinks.htm",
  89 + "titulo":$trad(13,g_traducao_init),
  90 + "subtitulo": $trad("13a",g_traducao_init),
  91 + "fa": "map-o",
  92 + "target": "_self"
  93 +},{
  94 + "img":"openlayersdebug.png",
  95 + "href": customDir + "/openlayersdebug.htm",
  96 + "titulo":$trad(5,g_traducao_init),
  97 + "subtitulo": $trad("5a",g_traducao_init),
  98 + "fa": "cogs",
  99 + "target": "_blank"
  100 +},{
  101 + "img":"certificate-server.png",
  102 + "href":"../testainstal/index.php",
  103 + "titulo":$trad(2,g_traducao_init),
  104 + "subtitulo": $trad("2a",g_traducao_init),
  105 + "fa": "cogs",
  106 + "target": "_self"
  107 +},{
  108 + "img":"applications-development-web.png",
  109 + "href":"../admin",
  110 + "titulo":$trad(3,g_traducao_init),
  111 + "subtitulo": $trad("3a",g_traducao_init),
  112 + "fa": "cogs",
  113 + "target": "_self"
  114 +},{
  115 + "img":"folder-image.png",
  116 + "href":"../exemplos",
  117 + "titulo":$trad(14,g_traducao_init),
  118 + "subtitulo": $trad("14a",g_traducao_init),
  119 + "fa": "cogs",
  120 + "target": "_self"
  121 +},{
  122 + "img":"applications-development.png",
  123 + "href":"../pacotes/utils/index.php",
  124 + "titulo":$trad(33,g_traducao_init),
  125 + "subtitulo": $trad("33a",g_traducao_init),
  126 + "fa": "wrench",
  127 + "target": "_self"
  128 +},{
  129 + "img":"guiamigracao.png",
  130 + "href":"../guia_de_migracao.txt",
  131 + "titulo":$trad(17,g_traducao_init),
  132 + "subtitulo": $trad("17a",g_traducao_init),
  133 + "fa": "cogs",
  134 + "target": "_self"
  135 +},{
  136 + "img":"docapi.png",
  137 + "href":"../documentacao",
  138 + "titulo":$trad(24,g_traducao_init),
  139 + "subtitulo": $trad("24a",g_traducao_init),
  140 + "fa": "book",
  141 + "target": "_self"
  142 +},{
  143 + "img":"gvsigtraining.png",
  144 + "href":"http://moodle.gvsig-training.com/course/view.php?id=11",
  145 + "titulo":$trad(28,g_traducao_init),
  146 + "subtitulo": $trad("28a",g_traducao_init),
  147 + "fa": "book",
  148 + "target": "_self"
  149 +},{
  150 + "img":"tools-report-bug.png",
  151 + "href":"https://softwarepublico.gov.br/gitlab/i3geo/i3geo/issues",
  152 + "titulo":$trad(16,g_traducao_init),
  153 + "subtitulo": $trad("16a",g_traducao_init),
  154 + "fa": "group",
  155 + "target": "_self"
  156 +},{
  157 + "img":"../imagens/apple-touch-icon.png",
  158 + "href":"https://softwarepublico.gov.br/gitlab/groups/i3geo",
  159 + "titulo":$trad(30,g_traducao_init),
  160 + "subtitulo": $trad("30a",g_traducao_init),
  161 + "fa": "group",
  162 + "target": "_self"
  163 +},{
  164 + "img":"logo_psp.png",
  165 + "href":"https://portal.softwarepublico.gov.br/social/i3geo/",
  166 + "titulo":$trad(31,g_traducao_init),
  167 + "subtitulo": $trad("31a",g_traducao_init),
  168 + "fa": "group",
  169 + "target": "_self"
  170 +},{
  171 + "img":"mailman.jpg",
  172 + "href":"http://lists.osgeo.org/cgi-bin/mailman/listinfo/i3geo",
  173 + "titulo":$trad(32,g_traducao_init),
  174 + "subtitulo": $trad("32a",g_traducao_init),
  175 + "fa": "group",
  176 + "target": "_self"
  177 +}
  178 +];
  179 +function mostraBotoes(){
  180 + $i("mensagemLogin").innerHTML = men;
  181 + i3GEO.configura = {"locaplic" : ".."};
  182 + i3GEO.idioma.IDSELETOR = "bandeiras";
  183 + i3GEO.idioma.mostraSeletor();
  184 + //i3GEO.barraDeBotoes.ATIVA = false;
  185 + var ins = [],i,n = botoesIni.length,texto;
  186 + for(i=0;i<n;i++){
  187 + texto = '<div class="r" ><div class="ri" ><a target=_blank href="'+botoesIni[i].href+'" ><img style="max-height:77px;" src="'+botoesIni[i].img+'" /><br><br>'+botoesIni[i].titulo+'</a>';
  188 + if(botoesIni[i].subtitulo){
  189 + //texto += botoesIni[i].subtitulo;
  190 + }
  191 + texto += '</div></div>';
  192 + ins.push(texto);
  193 + }
  194 + $i("botoes").innerHTML = ins.join("");
  195 + $i("conteudo").style.height = i3GEO.util.getScrollHeight() + "px";
  196 +}
  197 +//TODO um dia, remover as imagens da pasta init e deixar apenas as da pasta init/imagens
  198 +function mostraBotoesBT(men){
  199 + var html = "";
  200 + //menu
  201 + html = Mustache.to_html(
  202 + $("#menuTpl").html(),
  203 + i3GEO.idioma.objetoIdioma(g_traducao_init)
  204 + );
  205 + $("#menuTpl").html(html);
  206 + //
  207 + $("#mensagemLogin").html(men);
  208 + html = Mustache.to_html(
  209 + $("#jumbotron").html(),
  210 + {
  211 + "jumbotron" : $trad(35,g_traducao_init),
  212 + "host" : location.host,
  213 + "href" : location.href
  214 + }
  215 + );
  216 + $("#jumbotron").html(html);
  217 + i3GEO.configura = {"locaplic" : ".."};
  218 + i3GEO.idioma.IDSELETOR = "bandeiras";
  219 + i3GEO.idioma.mostraSeletor();
  220 + html = Mustache.to_html(
  221 + "{{#d}}" + $("#botoesTpl").html() + "{{/d}}",
  222 + {"d":botoesIni,"abrir" : $trad(36,g_traducao_init)}
  223 + );
  224 + $("#botoesTpl").html(html);
  225 +}
... ...
testainstal/index.php 0 → 100755
... ... @@ -0,0 +1,621 @@
  1 +<?php
  2 +/**
  3 + * Pagina inicial do i3Geo
  4 + * Voce pode utilizar o parametro customDir para indicar a pasta onde
  5 + * as interfaces de mapa estao. Nesse caso, os links utilizarao esse parametro
  6 + * Exemplo: localhost/i3geo/init/index.php?customDir=minhaPasta
  7 + *
  8 + * minhaPasta deve estar dentor da pasta i3geo.
  9 + *
  10 + * Se dentro da pasta $customDir existir um arquivo chamado index.php sera feito o include
  11 + * na pagina.
  12 + */
  13 +/**
  14 + * Cria as pastas temporarias que o i3Geo precisa, caso nao existam
  15 + */
  16 +define ( ONDEI3GEO, ".." );
  17 +include "../init/head.php";
  18 +?>
  19 +<body style="background-color: #eeeeee; padding-top: 90px;" id="topo">
  20 + <nav class="navbar navbar-fixed-top navbar-inverse" role="navigation">
  21 + <div class="container-fluid">
  22 + <div class="navbar-header">
  23 + <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar">
  24 + <span class="sr-only"></span> <span class="icon-bar"></span> <span class="icon-bar"></span> <span class="icon-bar"></span>
  25 + </button>
  26 + <a class="navbar-brand" href="../init/index.php">i3Geo <i class="fa fa-home fa-1x"></i></a>
  27 + </div>
  28 + <div id="navbar" class="collapse navbar-collapse">
  29 + <ul class="nav navbar-nav">
  30 + <li class="fa"><a href="#"><div id="bandeiras"></div></a></li>
  31 + </ul>
  32 + </div>
  33 + </div>
  34 + </nav>
  35 + <nav class="navbar-fixed-bottom">
  36 + <div class="container-fluid" id="mensagemLogin">
  37 + </div>
  38 + </nav>
  39 + <div class="container-fluid">
  40 + <?php
  41 + //TODO Incluir opcoes para carregar as listas default do i3Geo como sistemas de identificacao e WMS
  42 + /*
  43 + Testa a instala&ccedil;&atilde;o do i3Geo
  44 +
  45 + Executa testes e aponta erros na instala&ccedil;&atilde;o.
  46 +
  47 + Licenca
  48 +
  49 + GPL2
  50 +
  51 + i3Geo Interface Integrada de Ferramentas de Geoprocessamento para Internet
  52 +
  53 + Direitos Autorais Reservados (c) 2006 Minist&eacute;rio do Meio Ambiente Brasil
  54 + Desenvolvedor: Edmar Moretti edmar.moretti@gmail.com
  55 +
  56 + Este programa &eacute; software livre; voc&ecirc; pode redistribu&iacute;-lo
  57 + e/ou modific&aacute;-lo sob os termos da Licen&ccedil;a P&uacute;blica Geral
  58 + GNU conforme publicada pela Free Software Foundation;
  59 +
  60 + Este programa &eacute; distribu&iacute;do na expectativa de que seja &uacute;til,
  61 + por&eacute;m, SEM NENHUMA GARANTIA; nem mesmo a garantia impl&iacute;cita
  62 + de COMERCIABILIDADE OU ADEQUA&Ccedil;&Atilde;O A UMA FINALIDADE ESPEC&Iacute;FICA.
  63 + Consulte a Licen&ccedil;a P&uacute;blica Geral do GNU para mais detalhes.
  64 + Voc&ecirc; deve ter recebido uma cópia da Licen&ccedil;a P&uacute;blica Geral do
  65 + GNU junto com este programa; se n&atilde;o, escreva para a
  66 + Free Software Foundation, Inc., no endere&ccedil;o
  67 + 59 Temple Street, Suite 330, Boston, MA 02111-1307 USA.
  68 +
  69 + */
  70 + $locaplic = dirname(dirname(__FILE__));
  71 + include_once("../admin/php/admin.php");
  72 + include_once("../ms_configura.php");
  73 +
  74 + ?>
  75 + <script src='../classesjs/compactados/dicionario_compacto.js'></script>
  76 + <script src='../classesjs/compactados/classe_util_compacto.js'></script>
  77 + <script src='../classesjs/compactados/classe_idioma_compacto.js'></script>
  78 + <script src='../init/dicionario.js'></script>
  79 + <script>
  80 + <?php
  81 + if ($i3geomaster [0] ["usuario"] == "admin" && $i3geomaster [0] ["senha"] == "admin") {
  82 + echo "var men = '<div class=\'alert alert-danger\' style=\'margin-bottom:0px;\' >' + $" . "trad(19,g_traducao_init) + '</div>';";
  83 + } else {
  84 + echo "var men = '';";
  85 + }
  86 + ?>
  87 + $("#mensagemLogin").html(men);
  88 + </script>
  89 + <?php
  90 + if(empty($_POST["senha"]) || empty($_POST["usuario"])){
  91 +
  92 + //opcoes de criacao de pastas
  93 + if (strtoupper(substr(PHP_OS, 0, 3) != 'WIN')){
  94 + $d = dirname(dirname(__FILE__));
  95 +echo <<<HTML
  96 + <div class="alert alert-danger" role="alert">
  97 + Essa conexão pode não ser segura e os dados de usuário/senha podem ser descobertos
  98 + </div>
  99 + <div class="col-lg-2 col-md-0">
  100 + </div>
  101 + <div class="well bs-component col-lg-8 col-md-12">
  102 + <form action="index.php" method="post" id="formularioLoginMaster">
  103 + <div class="form-group">
  104 + <label for="inputUsuario" >Digite o nome do usuário master cadastrado em ms_configura.php</label>
  105 + <input type="text" class="form-control" id="inputUsuario" placeholder="usu&aacute;rio" name="usuario">
  106 + </div>
  107 + <div class="form-group">
  108 + <label for="inputSenha" >Digite a senha</label>
  109 + <input type="password" class="form-control" id="inputSenha" placeholder="senha" name="senha">
  110 + </div>
  111 + <button type="submit" class="btn btn-primary">Enviar</button>
  112 + <div class="checkbox">
  113 + <label>
  114 + <input type=checkbox name="criaPastaMstmp" > Cria a pasta $dir_tmp
  115 + </label>
  116 + </div>
  117 + <div class="checkbox">
  118 + <label>
  119 + <input type=checkbox name=criaLink /> Cria o link simbolico $d/../ms_tmp
  120 + </label>
  121 + </div>
  122 + <div class="checkbox">
  123 + <label>
  124 + <input type=checkbox name=permPastaI3geo /> Altera as permissoes da pasta $locaplic <br>
  125 + </label>
  126 + </div>
  127 + </form>
  128 + </div>
  129 + <div class="col-lg-2 col-md-0">
  130 + </div>
  131 + <script>
  132 + $.material.init();
  133 + </script>
  134 +HTML;
  135 + }
  136 + exit;
  137 + }
  138 + else{
  139 + $continua = verificaMaster($_POST["usuario"],$_POST["senha"],$i3geomaster);
  140 + if($continua == false){
  141 + echo "Usu&aacute;rio n&atilde;o registrado em i3geo/ms_configura.php na vari&aacute;vel i3geomaster";
  142 + exit;
  143 + }
  144 + }
  145 + error_reporting(0);
  146 + //echo "<pre>\n";
  147 + echo "<span style=font-size:10px >Observa&ccedil;&atilde;o: se voc&ecirc; estiver usando Linux e a biblioteca CAIRO estiver instalada corretamente no Mapserver, edite os arquivos i3geo/aplicmap/geral1fedorav6.map e geral1debianv6.map para remover os coment&aacute;rios do OUTPUTFORMAT que utiliza SVG com o drive Cairo</span><br>\n";
  148 + echo "<br><b>TESTE DE INSTALA&Ccedil;&Atilde;O DO i3Geo</b><br>\n";
  149 + include ("../versao.php");
  150 + echo "<br><b>$mensagemInicia </b><br> \n";
  151 + echo "<br>Para mais informa&ccedil;&otilde;es sobre a instala&ccedil;&atilde;o de pacotes complementares, como o SAIKU e ferramentas que precisam de softwares espec&iacute;ficos, veja o link <a href='http://moodle.gvsig-training.com/course/view.php?id=11' >http://moodle.gvsig-training.com/course/view.php?id=11</a></b><br> \n";
  152 + //ip
  153 + $ip = "UNKNOWN";
  154 + if (getenv("HTTP_CLIENT_IP")) $ip = getenv("HTTP_CLIENT_IP");
  155 + else if(getenv("HTTP_X_FORWARDED_FOR")) $ip = getenv("HTTP_X_FORWARDED_FOR");
  156 + else if(getenv("REMOTE_ADDR")) $ip = getenv("REMOTE_ADDR");
  157 + else $ip = "UNKNOWN";
  158 + echo "<br>Seu endere&ccedil;o IP: ".$ip."<br>\n";
  159 + echo "<br>Sistema operacional: ".PHP_OS."<br>\n";
  160 + echo "<br>PHP (a vers&atilde;o deve ser a 5x): ".phpversion()."<br>\n";
  161 + include_once("../classesphp/carrega_ext.php");
  162 + include_once("../classesphp/funcoes_gerais.php");
  163 + $versao = versao();
  164 + $versao = $versao["principal"];
  165 + $exts = get_loaded_extensions();
  166 + echo "<br>MapServer: <br>";
  167 + echo ms_GetVersion();
  168 + echo "<br><br>";
  169 + echo "Array que armazena os par&acirc;metros da vers&atilde;o:<br><pre>";
  170 + var_dump (versao())."<br><br>";
  171 + echo "</pre>";
  172 + echo "Configura&ccedil;&atilde;o da proje&ccedil;&atilde;o default: (<a href='http://moodle.gvsig-training.com/mod/book/view.php?id=5090&chapterid=114'>saiba mais</a>)<br>";
  173 + if(!isset($i3GeoProjDefault)){
  174 + echo "<span style=color:red >A vari&aacute;vel de configura&ccedil;&atilde;o i3GeoProjDefault n&atilde;o existe no ms_configura.php. Ser&aacute; utilizada a proje&ccedil;&atilde;o 4326</span><br><br>";
  175 + }
  176 + echo "<pre>";
  177 + var_dump (pegaProjecaoDefault())."<br><br>";
  178 + echo "</pre>";
  179 + if(!function_exists("ms_GetVersion"))
  180 + {
  181 + echo "<span style=color:red >PARECE QUE O MAPSERVER NAO ESTA INSTALADO!!!<br><br>";
  182 + }
  183 + if (get_cfg_var("safe_mode") == 1){
  184 + echo "<span style=color:red >Problema: safe_mode no php.ini deveria estar como 'Off'. O i3Geo n&atilde;o ir&aacute; funcionar!!!<br></span>";
  185 + }
  186 + echo "<br>As seguintes letras devem aparecer corretamente acentuadas: ";
  187 + echo "<br><br>çÇãâáÁóÓ";
  188 + echo "<br><br>Caso contr&aacute;rio, verifique os par&acirc;metros de configura&ccedil;&atilde;o do Apache <b>AddDefaultCharset (httpd.conf) e default_charset (php.ini)</b> (default_charset='' no php.ini geralmente funciona).";
  189 + //executa as opcoes linux definidas no formulario
  190 + if(!empty($_POST["criaPastaMstmp"]) && $_POST["criaPastaMstmp"] == "on"){
  191 + echo "<br>Criando a pasta $dir_tmp \n";
  192 + if(!file_exists($dir_tmp)){
  193 + @mkdir ($dir_tmp,0777);
  194 + }
  195 + else{
  196 + chmod($dir_tmp,0777);
  197 + }
  198 + if(!file_exists($dir_tmp)){
  199 + echo "<span style=color:red >Arquivo $dir_tmp n&atilde;o pode ser criado\n";
  200 + }
  201 + else{
  202 + echo "...OK\n";
  203 + }
  204 + }
  205 + if(!empty($_POST["criaPastaMstmp"]) && $_POST["criaLink"] == "on"){
  206 + $d = dirname(dirname(__FILE__))."/../ms_tmp";
  207 + echo "<br>Criando o link simb&oacute;lico $d \n";
  208 + if(!file_exists($d)){
  209 + @symlink($dir_tmp,$d);
  210 + }
  211 + else{
  212 + chmod($d,0777);
  213 + }
  214 + if(!file_exists($d)){
  215 + echo "<span style=color:red >Link $d n&atilde;o pode ser criado\n";
  216 + }
  217 + else{
  218 + echo "...OK\n";
  219 + }
  220 + }
  221 + if(!empty($_POST["criaPastaMstmp"]) && $_POST["permPastaI3geo"] == "on"){
  222 + echo "<br>Alterando permiss&otilde;es i3geo i3geo/temas i3geo/admin i3geo/admin/admin.db\n";
  223 + if(file_exists($locaplic)){
  224 + chmod($locaplic,0777);
  225 + chmod($locaplic."/temas",0777);
  226 + chmod($locaplic."/admin",0777);
  227 + chmod($locaplic."/admin/admin.db",0777);
  228 + echo "...OK\n";
  229 + }
  230 + }
  231 + echo "<br><br>Extens&otilde;es PHP:<br><pre>";
  232 + if (!extension_loaded("curl")){
  233 + echo "<span style=color:red >Problema: n&atilde;o est&aacute; instalado a curl que pode afetar algumas funcionalidades do i3Geo<br></span>";
  234 + }
  235 + if (!extension_loaded("json")){
  236 + echo "<span style=color:red >Problema: n&atilde;o est&aacute; instalado a json<br></span>";
  237 + }
  238 + if (!extension_loaded("libxml")){
  239 + echo "<span style=color:red >Problema: n&atilde;o est&aacute; instalado a libxml<br></span>";
  240 + }
  241 + if (!extension_loaded( "PDO")){
  242 + echo "<span style=color:red >Problema: n&atilde;o est&aacute; instalado a PDO<br></span>";
  243 + }
  244 + if (!extension_loaded( "pdo_sqlite")){
  245 + echo "<span style=color:red >Problema: n&atilde;o est&aacute; instalado a pdo_sqlite<br></span>";
  246 + }
  247 + if (!extension_loaded( "SQLite") && !extension_loaded( "sqlite3")){
  248 + echo "<span style=color:red >Problema: n&atilde;o est&aacute; instalado a SQLite<br></span>";
  249 + }
  250 + if (!extension_loaded( "SimpleXML")){
  251 + echo "<span style=color:red >Problema: n&atilde;o est&aacute; instalado a SimpleXML<br></span>";
  252 + }
  253 + if (!extension_loaded( "dom")){
  254 + echo "<span style=color:red >Problema: n&atilde;o est&aacute; instalado a dom<br></span>";
  255 + }
  256 + if (!extension_loaded( "xml")){
  257 + echo "<span style=color:red >Problema: n&atilde;o est&aacute; instalado a xml<br></span>";
  258 + }
  259 + if (!extension_loaded( "zlib")){
  260 + echo "<span style=color:red >Problema: n&atilde;o est&aacute; instalado a zlib <br></span>";
  261 + }
  262 + if (!extension_loaded( "gd")){
  263 + echo "<span style=color:red >Problema: n&atilde;o est&aacute; instalado a gd<br></span>";
  264 + }
  265 + if (!extension_loaded( "mbstring")){
  266 + echo "<span style=color:red >Obs: n&atilde;o est&aacute; instalado a mbstring<br></span>";
  267 + }
  268 + if (!extension_loaded( "yaml")){
  269 + echo "<span style=color:red >Obs: n&atilde;o est&aacute; instalado a YAML. A ferramenta de melhor tra&ccedil;ado raster precisa dessa extens&atilde;o.<br></span>";
  270 + }
  271 +
  272 + var_dump( $exts );
  273 +
  274 + echo "</pre>Existe o ms_configura.php? <br>";
  275 + if(file_exists("../ms_configura.php")) echo "Sim\n"; else {echo "Nao";saindo(" ms_configura n&atilde;o encontrado");}
  276 + echo "Incluindo...\n<br>";
  277 + include ("../ms_configura.php");
  278 + echo "<br>Mensagem de inicializa&ccedil;&atilde;o: <b>$mensagemInicia </b> \n";
  279 + echo "<br><br>dir_tmp = $dir_tmp \n";
  280 + echo "<br><br>locmapserv = $locmapserv \n";
  281 + echo "<br><br>Este php est&aacute; em ".getcwd()."\n";
  282 + echo "<br><br>O diretorio de arquivos SESSION tempor&aacute;rio &eacute;: ".session_save_path()."\n";
  283 + if($conexaoadmin == "" && file_exists($locaplic."/admin/admin.db")){
  284 + echo "<br><br>As permiss&otilde;es do banco de dados $locaplic/admin/admin.db s&atilde;o (se o arquivo estiver bloqueado, o sistema de administra&ccedil;&atilde;o n&atilde;o ir&aacute; funcionar):<br>";
  285 + echo permissoesarquivo($locaplic."/admin/admin.db");
  286 + }
  287 + include_once("../admin/php/conexao.php");
  288 + echo "<br><br>Verificando banco de dados de administra&ccedil;&atilde;o...\n";
  289 + echo "<pre>";
  290 + //TODO Verificar ao fechar versao - verificar tabelas
  291 + $tabelas = array(
  292 + "i3geoadmin_sistemasf"=>"abrir_funcao,h_funcao,id_funcao,id_sistema,nome_funcao,perfil_funcao,w_funcao",
  293 + "i3geoadmin_tags"=>"id_tag,nome",
  294 + "i3geoadmin_perfis"=>"id_perfil,perfil",
  295 + "i3geoadmin_atlasp"=>"ordem_prancha,desc_prancha,h_prancha,icone_prancha,id_atlas,id_prancha,link_prancha,mapext_prancha,titulo_prancha,w_prancha",
  296 + "i3geoadmin_atlast"=>"ordem_tema,codigo_tema,id_prancha,id_tema,ligado_tema",
  297 + "i3geoadmin_mapas"=>"publicado_mapa,ordem_mapa,perfil_mapa,ligados_mapa,temas_mapa,desc_mapa,ext_mapa,id_mapa,imagem_mapa,linkdireto_mapa,nome_mapa,outros_mapa,mapfile",
  298 + "i3geoadmin_atlas"=>"publicado_atlas,ordem_atlas,basemapfile_atlas,desc_atlas,h_atlas,icone_atlas,id_atlas,link_atlas,pranchadefault_atlas,template_atlas,tipoguias_atlas,titulo_atlas,w_atlas",
  299 + "i3geoadmin_sistemas"=>"publicado_sistema,id_sistema,nome_sistema,perfil_sistema",
  300 + "i3geoadmin_identifica"=>"publicado_i,abrir_i,id_i,nome_i,target_i",
  301 + "i3geoadmin_raiz"=>"ordem,id_tema,id_menu,id_nivel,id_raiz,nivel,perfil",
  302 + "i3geoadmin_n1"=>"publicado,ordem,id_menu,id_grupo,id_n1,n1_perfil",
  303 + "i3geoadmin_n2"=>"publicado,ordem,id_n1,id_n2,id_subgrupo,n2_perfil",
  304 + "i3geoadmin_n3"=>"publicado,ordem,id_n2,id_n3,id_tema,n3_perfil",
  305 + "i3geoadmin_ws"=>"nacessosok,nacessos,autor_ws,desc_ws,id_ws,link_ws,nome_ws,tipo_ws",
  306 + "i3geoadmin_grupos"=>"it,es,en,desc_grupo,id_grupo,nome_grupo",
  307 + "i3geoadmin_subgrupos"=>"it,es,en,desc_subgrupo,id_subgrupo,nome_subgrupo",
  308 + "i3geoadmin_temas"=>"it,es,en,kmz_tema,id_tema,kml_tema,ogc_tema,download_tema,tags_tema,tipoa_tema,link_tema,desc_tema,nome_tema,codigo_tema",
  309 + "i3geoadmin_menus"=>"it,es,en,publicado_menu,perfil_menu,aberto,desc_menu,id_menu,nome_menu",
  310 + "i3geoadmin_comentarios"=>"comentario,data,openidnome,openidimagem,openidservico,openidusuario,openidurl,id_tema",
  311 + "i3geoadmin_acessostema"=>"codigo_tema,nacessos,dia,mes,ano",
  312 + "i3geoadmin_log"=>"id_log,sql,serializedata,usuario,ip,timestamp,outros",
  313 + "i3geousr_usuarios"=>"id_usuario,ativo,data_cadastro,email,login,nome_usuario,senha",
  314 + "i3geousr_papeis"=> "id_papel,nome,descricao",
  315 + "i3geousr_papelusuario"=> "id_usuario,id_papel",
  316 + "i3geousr_operacoes" => "id_operacao,codigo,descricao",
  317 + "i3geousr_operacoespapeis" => "id_operacao,id_papel",
  318 + "i3geousr_grupos" => "id_grupo,nome,descricao",
  319 + "i3geousr_grupotema" => "id_grupo,id_tema",
  320 + "i3geousr_grupousuario" => "id_usuario,id_grupo",
  321 + "i3geoestat_conexao" => "codigo_estat_conexao,bancodedados,host,porta,usuario,senha",
  322 + "i3geoestat_tipo_regiao" => "codigo_tipo_regiao,nome_tipo_regiao,descricao_tipo_regiao,codigo_estat_conexao,esquemadb,tabela,colunageo,data,identificador,colunanomeregiao,srid,colunacentroide,colunasvisiveis,apelidos",
  323 + "i3geoestat_agregaregiao" => "id_agregaregiao,codigo_tipo_regiao,codigo_tipo_regiao_pai,colunaligacao_regiaopai",
  324 + "i3geoestat_tipo_periodo" => "codigo_tipo_periodo,nome,descricao",
  325 + "i3geoestat_unidade_medida" => "codigo_unidade_medida,nome,sigla,permitesoma,permitemedia",
  326 + "i3geoestat_variavel" => "codigo_variavel,nome,descricao",
  327 + "i3geoestat_medida_variavel" => "id_medida_variavel,codigo_unidade_medida,codigo_tipo_periodo,codigo_variavel,codigo_tipo_regiao,codigo_estat_conexao,esquemadb,tabela,colunavalor,colunaidgeo,filtro,nomemedida,colunaidunico",
  328 + "i3geoestat_classificacao" => "id_classificacao,nome,id_medida_variavel,observacao",
  329 + "i3geoestat_classes" => "id_classe,expressao,titulo,vermelho,verde,azul,id_classificacao,tamanho,simbolo,overmelho,overde,oazul,otamanho",
  330 + "i3geoestat_fonteinfo" => "id_fonteinfo,titulo,link",
  331 + "i3geoestat_fonteinfo_medida" => "id_medida_variavel,id_fonteinfo",
  332 + "i3geoestat_medida_variavel_link" => "link,id_medida_variavel,nome,id_link",
  333 + "i3geoestat_parametro_medida" => "id_parametro_medida,coluna,nome,descricao,id_pai,id_medida_variavel,tipo"
  334 + );
  335 + include_once("../admin/php/conexao.php");
  336 + if(!empty($esquemaadmin)){
  337 + $esquemaadmin = str_replace(".","",$esquemaadmin).".";
  338 + }
  339 +
  340 + foreach(array_keys($tabelas) as $tabela)
  341 + {
  342 + echo " Tabela: <b>".$tabela."</b>";
  343 + $sql = "select * from ".$esquemaadmin.$tabela;
  344 + $q = $dbh->query($sql,PDO::FETCH_ASSOC);
  345 + if($q !== false)
  346 + {
  347 + $resultado = $q->fetchAll();
  348 + if(count($resultado) > 0)
  349 + {
  350 + echo "...ok\n";
  351 + foreach(explode(",",$tabelas[$tabela]) as $coluna)
  352 + {
  353 + echo " coluna: ".$coluna;
  354 + if(in_array($coluna,array_keys($resultado[0])))
  355 + {
  356 + echo "...ok\n";
  357 + }
  358 + else
  359 + {echo "<span style=color:red >..n&atilde;o encontrada. Consulte o i3geo/guia_de_migracao.txt</span>\n";
  360 + }
  361 + }
  362 + }
  363 + else
  364 + {echo "<span style=color:red >...n&atilde;o existem registros cadastrados</span>\n";
  365 + }
  366 + }
  367 + else
  368 + {echo "<span style=color:red >..n&atilde;o encontrada. Consulte o i3geo/guia_de_migracao.txt</span>\n";
  369 + }
  370 + }
  371 + echo "\n";
  372 + echo "</pre><br>Localizando o cgi...\n";
  373 + $proto = "http" . ((isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == "on") ? "s" : "") . "://";
  374 + $server = isset($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] : $_SERVER['SERVER_NAME'];
  375 + $enderecocgi = $proto.$server.$locmapserv;
  376 + echo "Voc&ecirc; pode testar o CGI clicando <a href='".$enderecocgi."' target='_blank'>aqui</a>, se o programa responder corretamente, dever&aacute; aparecer na tela algo como 'No query information to decode. QUERY_STRING is set, but empty.'\n" ;
  377 +
  378 + if (file_exists("../temas/teste.txt")){
  379 + echo "<br><br>Removendo arquivo de testes temas/teste.txt";
  380 + unlink("../temas/teste.txt");
  381 + }
  382 + if (file_exists("../temas/teste.txt")){
  383 + echo "<br><span style='color:red'>N&atilde;o foi possivel escrever na pasta temas. O sistema de administracao pode nao funcionar corretamente</span><br>";
  384 + }
  385 + else{
  386 + echo "<br><br>Testando criar arquivo temas/teste.txt";
  387 + $f = @fopen("../temas/teste.txt",w);
  388 + @fclose($f);
  389 + if (!file_exists("../temas/teste.txt")){
  390 + echo "<br><span style='color:red'>N&atilde;o foi possivel escrever na pasta temas. O sistema de administracao pode nao funcionar corretamente</span><br>";
  391 + }
  392 + else{
  393 + unlink("../temas/teste.txt");
  394 + echo "<br>ok.";
  395 + }
  396 + }
  397 + echo "<br><br>Escrevendo nos diret&oacute;rios tempor&aacute;rios...<br><br>";
  398 + if (file_exists($dir_tmp."/teste.txt")){
  399 + //echo "<br><br>Removendo arquivo de testes $dir_tmp/teste.txt<br>";
  400 + unlink($dir_tmp."/teste.txt");
  401 + }
  402 + if (file_exists($dir_tmp."/teste.txt")){
  403 + saindo("\nN&atilde;o foi poss&iacute;vel testar o diret&oacute;rio tempor&aacute;rio $dir_tmp");
  404 + }
  405 + $f = @fopen($dir_tmp."/teste.txt",w);
  406 + @fclose($f);
  407 + if (file_exists($dir_tmp."/teste.txt")) {
  408 + echo " do Mapserver <br>ok<br><br>\n";
  409 + }
  410 + else {
  411 + saindo("\nN&atilde;o foi poss&iacute;vel gravar no diret&oacute;rio tempor&aacute;rio $dir_tmp");
  412 + }
  413 + $f = @fopen(session_save_path()."/teste.txt",w);
  414 + @fclose($f);
  415 + if (file_exists(session_save_path()."/teste.txt")) {
  416 + echo " da SESSION PHP <br>ok<br><br>\n";
  417 + }
  418 + else {
  419 + saindo("\nN&atilde;o foi poss&iacute;vel gravar no diret&oacute;rio tempor&aacute;rio da SESSION");
  420 + }
  421 +
  422 + echo " <br>\n";
  423 + echo "Carregando o map_file base...\n";
  424 + $versao = versao();
  425 + $versao = $versao["principal"];
  426 + if(isset($base) && $base != ""){
  427 + if(file_exists($base)){
  428 + $f = $base;
  429 + }
  430 + else{
  431 + $f = $locaplic."/aplicmap/".$base.".map";
  432 + }
  433 + if(!file_exists($base)){
  434 + echo "<span style=color:red >ARQUIVO $base N&Acirc;O FOI ENCONTRADO. CORRIJA ISSO EM ms_configura.php";
  435 + exit;
  436 + }
  437 + }
  438 + else{
  439 + $f = "";
  440 + if (strtoupper(substr(PHP_OS, 0, 3) == 'WIN')){
  441 + $f = $locaplic."/aplicmap/geral1windowsv".$versao.".map";
  442 + }
  443 + else{
  444 + if($f == "" && file_exists('/var/www/i3geo/aplicmap/geral1debianv'.$versao.'.map')){
  445 + $f = "/var/www/i3geo/aplicmap/geral1debianv".$versao.".map";
  446 + }
  447 + if($f == "" && file_exists('/var/www/html/i3geo/aplicmap/geral1fedorav'.$versao.'.map')){
  448 + $f = "/var/www/html/i3geo/aplicmap/geral1fedorav".$versao.".map";
  449 + }
  450 + if($f == "" && file_exists('/opt/www/html/i3geo/aplicmap/geral1fedorav'.$versao.'.map')){
  451 + $f = "/opt/www/html/i3geo/aplicmap/geral1v".$versao.".map";
  452 + }
  453 + if($f == ""){
  454 + $f = $locaplic."/aplicmap/geral1v".$versao.".map";
  455 + }
  456 + }
  457 + }
  458 + echo "<br>O arquivo mapfile de iniciliza&ccedil;&atilde;o &eacute;: $f<br>\n";
  459 + echo "<br><b>E agora..desenhando o mapa (se o mapa n&atilde;o aparecer &eacute; um problema...\nverifique os caminhos no ms_configura.php e no $f):</b>\n";
  460 + echo "<br><br>Criando o objeto com ms_newMapObj...";
  461 + $mapa = ms_newMapObj($f);
  462 + //para evitar erros que possam ser originados da conexao com o banco
  463 + for($i=0;$i<($mapa->numlayers);$i++){
  464 + $layern = $mapa->getLayer($i);
  465 + if ($layern->connectiontype == MS_POSTGIS ) {
  466 + $layern->set("status",MS_OFF);
  467 + }
  468 + }
  469 + $l = $mapa->getLayerByname("mundo");
  470 + if($l != ""){
  471 + $l->set("status",MS_DEFAULT);
  472 + }
  473 + $imgo = @$mapa->draw();
  474 + $nome = ($imgo->imagepath)."teste.png";
  475 + echo "<br><br>Nome da imagem gerada: $nome ";
  476 +
  477 + if (!$imgo){
  478 + echo "Problemas ao gerar o mapa<br>";
  479 + $error = "";
  480 + $error = ms_GetErrorObj();
  481 + while($error && $error->code != MS_NOERR){
  482 + echo "<br>Error in %s: %s<br>", $error->routine, $error->message;
  483 + $error = $error->next();
  484 + }
  485 + }
  486 + if($imgo->imagepath == "")
  487 + {
  488 + echo "Erro IMAGEPATH vazio";
  489 + }
  490 +
  491 + $imgo->saveImage($nome);
  492 + $nome = ($imgo->imageurl).basename($nome);
  493 + echo "<p><img src=$nome /></p>";
  494 +
  495 + echo " \n";
  496 + $error = "";
  497 + ms_ResetErrorList();
  498 + echo "Carregando o map_file geral1... e acrescentando os limites estaduais (aplicmap/estadosl...) \n";
  499 + if(isset($estadosl))
  500 + {
  501 + $maptemp = ms_newMapObj($locaplic."/aplicmap/".$estadosl.".map");
  502 + }
  503 + else{
  504 + if (strtoupper(substr(PHP_OS, 0, 3) == 'WIN'))
  505 + {
  506 + $maptemp = ms_newMapObj($locaplic."/aplicmap/estadoslwindows.map");
  507 + }
  508 + else
  509 + {$maptemp = ms_newMapObj($locaplic."/aplicmap/estadosl.map");
  510 + }
  511 + }
  512 + while($error && $error->code != MS_NOERR)
  513 + {
  514 + printf("<br>Error in %s: %s<br>\n", $error->routine, $error->message);
  515 + $error = $error->next();
  516 + }
  517 + echo "<b>E agora..desenhando o mapa (se o mapa n&atilde;o aparecer &eacute; um problema...\nverifique os caminhos no ms_configura.php e no estadosl.map ou estadoslwindows.map):</b>\n";
  518 + echo "<br><br>Um problema bastante comum &eacute; o n&atilde;o reconhecimento do diret&oacute;rio ms_tmp pelo Apache. \nO diretorio ms_tmp &eacute; utilizado pelo Mapserver e pelo i3geo para armazenar dados tempor&aacute;rios. \n&Eacute; nesse diretorio que ficam as imagens do mapa.\n";
  519 + echo "Quando o Apache n&atilde;o consegue utilizar esse diret&oacute;rio, a imagem n&atilde;o ser&aacute; mostrada,\n apesar de ser gerada dentro do ms_tmp (vc pode verificar se as imagens do \nmapa est&atilde;o sendo criadas no ms_tmp apos rodar o testainstal.php).\n";
  520 + echo "Para solucionar esse problema, vc pode criar um link simb&oacute;lico (nos sistemas linux),\n no mesmo local onde est&aacute; instalado o i3geo, apontando para o local \nf&iacute;sico onde est&aacute; o ms_tmp.\n";
  521 + echo "<b>O nome do link simbolico deve ser o mesmo que estiver definido em aplicmap/geral1.map ou geral1debian.map na linha IMAGEURL. Esse nome por default &eacute; definido como ms_tmp.\n";
  522 + echo "No wiki do portal do software p&uacute;blico vc poder&aacute; encontrar mais detalhes sobre isso.</b>\n";
  523 +
  524 + for($i=0;$i<($maptemp->numlayers);$i++)
  525 + {
  526 + $layern = $maptemp->getLayer($i);
  527 + if ($layern->name == "estadosl")
  528 + {
  529 + $layern->set("data",$locaplic."/aplicmap/dados/estados.shp");
  530 + }
  531 + ms_newLayerObj($mapa, $layern);
  532 + }
  533 + $imgo = @$mapa->draw();
  534 +
  535 + if (!$imgo){
  536 + echo "Problemas ao gerar o mapa<br>";
  537 + $error = "";
  538 + $error = ms_GetErrorObj();
  539 + while($error && $error->code != MS_NOERR){
  540 + echo "<br>Error in %s: %s<br>", $error->routine, $error->message;
  541 + $error = $error->next();
  542 + }
  543 + }
  544 + if($imgo->imagepath == "")
  545 + {
  546 + echo "Erro IMAGEPATH vazio";
  547 + }
  548 +
  549 + $nome = ($imgo->imagepath)."teste1.png";
  550 + echo "<br><br>Nome da imagem gerada: $nome ";
  551 + $imgo->saveImage($nome);
  552 + $nome = ($imgo->imageurl).basename($nome);
  553 + echo "<p><img src=$nome /></p></body></html>";
  554 +
  555 + function saindo($men){
  556 + echo "<span style=color:red ><br><b>Erro. Saindo...".$men;
  557 + }
  558 + /*
  559 + Retorna as permiss&otilde;es de um arquivo
  560 +
  561 + Parametros:
  562 +
  563 + $arquivo
  564 + */
  565 + function permissoesarquivo($arquivo){
  566 + $perms = fileperms($arquivo);
  567 +
  568 + if (($perms & 0xC000) == 0xC000) {
  569 + // Socket
  570 + $info = 's';
  571 + } elseif (($perms & 0xA000) == 0xA000) {
  572 + // Symbolic Link
  573 + $info = 'l';
  574 + } elseif (($perms & 0x8000) == 0x8000) {
  575 + // Regular
  576 + $info = '-';
  577 + } elseif (($perms & 0x6000) == 0x6000) {
  578 + // Block special
  579 + $info = 'b';
  580 + } elseif (($perms & 0x4000) == 0x4000) {
  581 + // Directory
  582 + $info = 'd';
  583 + } elseif (($perms & 0x2000) == 0x2000) {
  584 + // Character special
  585 + $info = 'c';
  586 + } elseif (($perms & 0x1000) == 0x1000) {
  587 + // FIFO pipe
  588 + $info = 'p';
  589 + } else {
  590 + // Unknown
  591 + $info = 'u';
  592 + }
  593 +
  594 + // Owner
  595 + $info .= (($perms & 0x0100) ? 'r' : '-');
  596 + $info .= (($perms & 0x0080) ? 'w' : '-');
  597 + $info .= (($perms & 0x0040) ?
  598 + (($perms & 0x0800) ? 's' : 'x' ) :
  599 + (($perms & 0x0800) ? 'S' : '-'));
  600 +
  601 + // Group
  602 + $info .= (($perms & 0x0020) ? 'r' : '-');
  603 + $info .= (($perms & 0x0010) ? 'w' : '-');
  604 + $info .= (($perms & 0x0008) ?
  605 + (($perms & 0x0400) ? 's' : 'x' ) :
  606 + (($perms & 0x0400) ? 'S' : '-'));
  607 +
  608 + // World
  609 + $info .= (($perms & 0x0004) ? 'r' : '-');
  610 + $info .= (($perms & 0x0002) ? 'w' : '-');
  611 + $info .= (($perms & 0x0001) ?
  612 + (($perms & 0x0200) ? 't' : 'x' ) :
  613 + (($perms & 0x0200) ? 'T' : '-'));
  614 +
  615 + return $info;
  616 + }
  617 +
  618 + ?>
  619 + </div>
  620 +</body>
  621 +</html>
... ...