home *** CD-ROM | disk | FTP | other *** search
/ PC Professionell 2004 December / PCpro_2004_12.ISO / files / webserver / tsw / TSW_3.4.0.exe / Apache2 / admin / inc_indexer.php < prev    next >
Encoding:
PHP Script  |  2004-01-27  |  14.6 KB  |  376 lines

  1. <?
  2. // Configuration Area /\ Area De Configuraτπo \\
  3.  
  4. $opcao['ordenar'] = 1;
  5. $opcao['estilo'] = 1;
  6. $opcao['showmode'] = 1;
  7.  
  8. $opcao['data'] = 1;
  9. $opcao['data-formato'] = "H:i:s d.M Y";
  10. $opcao['tamanho'] = 1;
  11. $opcao['itens'] = 1;
  12. $opcao['tipo'] = 1;
  13. $opcao['icon-path']="/icons/";
  14.  
  15. $opcao['icon-width'] = "50";
  16. $opcao['icon-height'] = "50";
  17. $opcao['icon-small-width'] = "15";
  18. $opcao['icon-small-height'] = "15";
  19.  
  20. $opcao['lang'] = "en";
  21. // $opcao['lang'] = "pt_PT";
  22.  
  23. $opcao['texto-mostrar'] = 1;
  24.  
  25. $opcao['max-size'] = 23;
  26.  
  27. $aliases=array(
  28.         '', ''
  29.            );
  30.  
  31. // End of Configuration Area /\ Fim da Area De Configuraτπo \\
  32.  
  33.  
  34.  
  35.  
  36.  
  37. if($opcao['lang']=="pt_PT") {
  38.   $opcao['titulo'] = "Listagem Da Directoria: $directoria";
  39.   $opcao['form-ordenar'] = "Ordenar Por:";
  40.   $opcao['form-icons'] = "Estilo:";
  41.   $opcao['form-show'] = "Vista:";
  42.   $opcao['form-submeter'] = "ok";
  43.   $opcao['texto'] = "<i>Directoria:</i> $directoria";
  44.   $opcao['icon-file'] = "Ficheiro";
  45.   $opcao['icon-dir'] = "Directoria";
  46.   $opcao['lang-nome'] = "Nome";
  47.   $opcao['lang-tamanho'] = "Tamanho";
  48.   $opcao['lang-itens'] = "Itens";
  49.   $opcao['lang-modificado'] = "Modificado";
  50.   $opcao['lang-tipo'] = "Tipo";
  51.  
  52.   $estilos[0] = "AquaFusion";
  53.   $estilos[1] = "Crystal";
  54.   $estilos[2] = "Konqueror";
  55.   $estilos[3] = "Simples";
  56.   $estilos[4] = "Windows";
  57.  
  58.   $ordenars[0] = "Nome";
  59.   $ordenars[1] = "Data";
  60.   $ordenars[2] = "Tamanho";
  61.  
  62.   $vistas[0] = "Icons";
  63.   $vistas[1] = "Detalhes";
  64. }
  65. else if($opcao['lang']=="en") {
  66.   $opcao['titulo'] = "Listing Directory: $directoria";
  67.   $opcao['form-ordenar'] = "Order By:";
  68.   $opcao['form-icons'] = "Theme:";
  69.   $opcao['form-show'] = "View:";
  70.   $opcao['form-submeter'] = "ok";
  71.   $opcao['texto'] = "<i>Directory:</i> $directoria";
  72.   $opcao['icon-file'] = "File";
  73.   $opcao['icon-dir'] = "Directory";
  74.   $opcao['lang-nome'] = "Name";
  75.   $opcao['lang-tamanho'] = "Size";
  76.   $opcao['lang-itens'] = "Items";
  77.   $opcao['lang-modificado'] = "Modified";
  78.   $opcao['lang-tipo'] = "Type";
  79.  
  80.   $estilos[0] = "AquaFusion";
  81.   $estilos[1] = "Crystal";
  82.   $estilos[2] = "Konqueror";
  83.   $estilos[3] = "Simple";
  84.   $estilos[4] = "Windows";
  85.  
  86.   $ordenars[0] = "Name";
  87.   $ordenars[1] = "Date";
  88.   $ordenars[2] = "Size";
  89.  
  90.   $vistas[0] = "Icons";
  91.   $vistas[1] = "Details";
  92.  
  93. }
  94.  
  95. function put_style() {
  96. echo "a {
  97.     color: #57a;
  98.     text-decoration: none;
  99.     background-color: transparent;
  100. }
  101. a:visited {
  102.     color: #57a;
  103.     background-color: transparent;
  104. }
  105. .dirview-item {
  106.     font-family: arial,sans-serif;
  107.     float: left;
  108.     width: 150px;
  109.     text-align: center;
  110.     font-size: x-small;
  111.     padding-top: 0.5em;
  112. }
  113. .dirview-info {
  114.     color: #999;
  115.     background-color: transparent;
  116. }
  117. .dirview-date {
  118.     color: #999;
  119.     background-color: transparent;
  120. }
  121. ";
  122. }
  123.  
  124. function put_form() {
  125.     global $estilos, $estilo, $ordenar, $ordenars, $opcao, $vista, $vistas;
  126.     if(($opcao['ordenar'] + $opcao['estilo'] + $opcao['showmode'])!=0) {
  127. echo "<div align=\"right\"><form action=\"http://" . $_SERVER["HTTP_HOST"] . $_SERVER["REQUEST_URI"] . "\">\n";
  128.     if($opcao['ordenar']==1) {
  129.     echo"   <label for=\"ordenar\">".$opcao['form-ordenar']."</label>
  130.         <select id=\"ordenar\" name=\"ordenar\">\n";
  131.     echo "<option value=\"$ordenar\"> * $ordenars[$ordenar]</option>\n";
  132.     $i=0;
  133.     foreach ($ordenars as $var) {
  134.         if ($i != $ordenar) { echo "<option value=\"$i\">$var</option>\n"; }
  135.         $i++;
  136.     }
  137.     echo "</select>  ";
  138.     }
  139.  
  140.     if($opcao['estilo']==1) {
  141.         echo "<label for=\"estilo\">".$opcao['form-icons']."</label>
  142.         <select id=\"estilo\" name=\"estilo\">\n";
  143.     echo "<option value=\"$estilo\"> * $estilos[$estilo]</option>\n";
  144.     $i=0;
  145.     foreach ($estilos as $var) {
  146.         if ($i != $estilo) { echo "<option value=\"$i\">$var</option>\n"; }
  147.         $i++;
  148.     }
  149.     echo "</select>  ";
  150.     }
  151.  
  152.     if($opcao['showmode']==1) {
  153.         echo "<label for=\"showmode\">".$opcao['form-show']."</label>
  154.         <select id=\"showmode\" name=\"showmode\">\n";
  155.     echo "<option value=\"$vista\"> * $vistas[$vista]</option>\n";
  156.     $i=0;
  157.     foreach ($vistas as $var) {
  158.         if ($i != $vista) { echo "<option value=\"$i\">$var</option>\n"; }
  159.         $i++;
  160.     }
  161.     echo "</select>  ";
  162.     }
  163.  
  164.     if(($opcao['ordenar'] + $opcao['estilo'] + $opcao['showmode'])!=0) { echo "  <input type=\"submit\" value=\"".$opcao['form-submeter']."\" /></form></div>"; }
  165.     }
  166. }
  167.     if (!$ordenar) { $ordenar = $_COOKIE["devile-list_ordenar"]; }
  168.     if ( ! in_array($ordenar, array(0, 1, 2))) { $ordenar = 0; }
  169.     if ( $ordenar == $null ) { $ordenar = 0; }
  170.     if ( ! is_numeric($ordenar) ) { $ordenar = 0; }
  171.  
  172.     if (!$estilo) { $estilo = $_COOKIE["devile-list_style"]; }
  173.     if ( ! in_array($estilo, array(0, 1, 2, 3, 4))) { $estilo = 3; }
  174.     if ( $estilo == $null ) { $estilo = 3; }
  175.     if ( ! is_numeric($estilo) ) { $estilo = 3; }
  176.  
  177.     if (!$vista) { $vista = $_COOKIE["devile-list_vista"]; }
  178.     if ( ! in_array($vista, array(0, 1))) { $vista = 0; }
  179.     if ( $vista == $null ) { $vista = 0; }
  180.     if ( ! is_numeric($vista) ) { $vista = 0; }
  181.  
  182.     switch($ordenar) {
  183.         case 0: $ord=0; break;
  184.         case 1: $ord=1; break;
  185.         case 2: $ord=2; break;
  186.         Default: $ord=0; break;
  187.     }                
  188.  
  189.  
  190.         // Definir Extenτ⌡es \\
  191.         
  192.     $imagens = array(".jpg", ".gif", ".png", ".jpeg", ".bmp");
  193.     $comprimido = array(".bz2", ".zip", ".gz", ".tar", ".rar", ".ace", ".tgz");
  194.     $midi = array(".mid", ".midi");
  195.     $html = array(".htm", ".html");
  196.     $executavel = array(".exe");
  197.     $ttf = array(".ttf");
  198.     $php = array(".php", ".phps", ".php3", ".php4");
  199.     $texto = array(".txt", ".doc");
  200.     $video = array(".avi", ".mpg", ".mpeg", ".ram", ".asf", ".wmv", ".mov");
  201.     $musica = array(".mp3", ".wav", ".wma", ".ogg");
  202.     $js = array(".js");
  203.  
  204. switch($estilo) {
  205.     case 3:
  206.     
  207.          // . SIMPLES
  208.  
  209.     $exts = array("");
  210.     $unknown_file = $opcao['icon-path']."indexer/simples/simples-file.png";
  211.     $directoria_file = $opcao['icon-path']."indexer/simples/simples-dir.png";
  212.  
  213.     $small_unknown_file = $opcao['icon-path']."indexer/simples/simples_small-file.png";
  214.     $small_directoria_file = $opcao['icon-path']."indexer/simples/simples_small-dir.png";
  215.  
  216.     break;
  217.  
  218.     
  219.     case 1:
  220.     
  221.          // . Crystal
  222.  
  223.     $exts = array("js", "musica", "video", "imagens", "comprimido", "midi", "html", "executavel", "php", "texto", "ttf");
  224.  
  225.     $imagens_file = $opcao['icon-path']."indexer/crystal/crystal-imagem.jpg";
  226.     $comprimido_file = $opcao['icon-path']."indexer/crystal/crystal-comprimido.jpg";
  227.     $midi_file = $opcao['icon-path']."indexer/crystal/crystal-midi.jpg";
  228.     $musica_file = $opcao['icon-path']."indexer/crystal/crystal-musica.jpg";
  229.     $html_file = $opcao['icon-path']."indexer/crystal/crystal-html.jpg";
  230.     $executavel_file = $opcao['icon-path']."indexer/crystal/crystal-executavel.jpg";
  231.     $ttf_file = $opcao['icon-path']."indexer/crystal/crystal-ttf.jpg";
  232.     $texto_file = $opcao['icon-path']."indexer/crystal/crystal-texto.jpg";
  233.     $js_file = $opcao['icon-path']."indexer/crystal/crystal-js.jpg";
  234.     $php_file = $opcao['icon-path']."indexer/crystal/crystal-html.jpg";
  235.     $video_file = $opcao['icon-path']."indexer/crystal/crystal-filme.jpg";
  236.     $directoria_file = $opcao['icon-path']."indexer/crystal/crystal-directoria.jpg";
  237.     $unknown_file = $opcao['icon-path']."indexer/crystal/crystal-unknown.jpg";
  238.  
  239.     $small_imagens_file = $opcao['icon-path']."indexer/crystal/crystal_small-imagem.jpg";
  240.     $small_comprimido_file = $opcao['icon-path']."indexer/crystal/crystal_small-comprimido.jpg";
  241.     $small_midi_file = $opcao['icon-path']."indexer/crystal/crystal_small-midi.jpg";
  242.     $small_musica_file = $opcao['icon-path']."indexer/crystal/crystal_small-musica.jpg";
  243.     $small_html_file = $opcao['icon-path']."indexer/crystal/crystal_small-html.jpg";
  244.     $small_executavel_file = $opcao['icon-path']."indexer/crystal/crystal_small-executavel.jpg";
  245.     $small_ttf_file = $opcao['icon-path']."indexer/crystal/crystal_small-ttf.jpg";
  246.     $small_texto_file = $opcao['icon-path']."indexer/crystal/crystal_small-texto.jpg";
  247.     $small_js_file = $opcao['icon-path']."indexer/crystal/crystal_small-js.jpg";
  248.     $small_php_file = $opcao['icon-path']."indexer/crystal/crystal_small-html.jpg";
  249.     $small_video_file = $opcao['icon-path']."indexer/crystal/crystal_small-filme.jpg";
  250.     $small_directoria_file = $opcao['icon-path']."indexer/crystal/crystal_small-directoria.jpg";
  251.     $small_unknown_file = $opcao['icon-path']."indexer/crystal/crystal_small-unknown.jpg";
  252.  
  253.     break;
  254.     
  255.     case 0:
  256.     
  257.          // . Aqua Fusion
  258.  
  259.     $exts = array("ttf", "js", "musica", "video", "imagens", "comprimido", "midi", "html", "executavel", "php", "texto");
  260.  
  261.     $imagens_file = $opcao['icon-path']."indexer/AquaFusion/AquaFusion-image.png";
  262.     $comprimido_file = $opcao['icon-path']."indexer/AquaFusion/AquaFusion-tgz.png";
  263.     $midi_file = $opcao['icon-path']."indexer/AquaFusion/AquaFusion-midi.png";
  264.     $musica_file = $opcao['icon-path']."indexer/AquaFusion/AquaFusion-sound.png";
  265.     $html_file = $opcao['icon-path']."indexer/AquaFusion/AquaFusion-html.png";
  266.     $executavel_file = $opcao['icon-path']."indexer/AquaFusion/AquaFusion-binary.png";
  267.     $ttf_file = $opcao['icon-path']."indexer/AquaFusion/AquaFusion-font_truetype.png";
  268.     $php_file = $opcao['icon-path']."indexer/AquaFusion/AquaFusion-source.png";
  269.     $texto_file = $opcao['icon-path']."indexer/AquaFusion/AquaFusion-txt.png";
  270.     $js_file = $opcao['icon-path']."indexer/AquaFusion/AquaFusion-source.png";
  271.     $video_file = $opcao['icon-path']."indexer/AquaFusion/AquaFusion-video.png";
  272.     $ttf_file = $opcao['icon-path']."indexer/AquaFusion/AquaFusion-font_truetype.png";
  273.     $directoria_file = $opcao['icon-path']."indexer/AquaFusion/AquaFusion-folder.png";
  274.     $unknown_file = $opcao['icon-path']."indexer/AquaFusion/AquaFusion-unknown.png";
  275.  
  276.     $small_imagens_file = $opcao['icon-path']."indexer/AquaFusion/AquaFusion_small-image.png";
  277.     $small_comprimido_file = $opcao['icon-path']."indexer/AquaFusion/AquaFusion_small-tgz.png";
  278.     $small_midi_file = $opcao['icon-path']."indexer/AquaFusion/AquaFusion_small-midi.png";
  279.     $small_musica_file = $opcao['icon-path']."indexer/AquaFusion/AquaFusion_small-sound.png";
  280.     $small_html_file = $opcao['icon-path']."indexer/AquaFusion/AquaFusion_small-html.png";
  281.     $small_executavel_file = $opcao['icon-path']."indexer/AquaFusion/AquaFusion_small-binary.png";
  282.     $small_ttf_file = $opcao['icon-path']."indexer/AquaFusion/AquaFusion_small-font_truetype.png";
  283.     $small_php_file = $opcao['icon-path']."indexer/AquaFusion/AquaFusion_small-source.png";
  284.     $small_texto_file = $opcao['icon-path']."indexer/AquaFusion/AquaFusion_small-txt.png";
  285.     $small_js_file = $opcao['icon-path']."indexer/AquaFusion/AquaFusion_small-source.png";
  286.     $small_video_file = $opcao['icon-path']."indexer/AquaFusion/AquaFusion_small-video.png";
  287.     $small_ttf_file = $opcao['icon-path']."indexer/AquaFusion/AquaFusion_small-font_truetype.png";
  288.     $small_directoria_file = $opcao['icon-path']."indexer/AquaFusion/AquaFusion_small-folder.png";
  289.     $small_unknown_file = $opcao['icon-path']."indexer/AquaFusion/AquaFusion_small-unknown.png";
  290.  
  291.  
  292.     break;
  293.     
  294.     
  295.  
  296.     case 2:
  297.  
  298.         // . Konqueror
  299.  
  300.     $exts = array("imagens", "comprimido", "midi", "html", "executavel", "ttf", "php", "texto");
  301.  
  302.     $imagens_file = $opcao['icon-path']."indexer/konqueror/konqueror-imagem.png";
  303.     $comprimido_file = $opcao['icon-path']."indexer/konqueror/konqueror-comprimido.png";
  304.     $midi_file = $opcao['icon-path']."indexer/konqueror/konqueror-midi.png";
  305.     $html_file = $opcao['icon-path']."indexer/konqueror/konqueror-html.png";
  306.     $executavel_file = $opcao['icon-path']."indexer/konqueror/konqueror-executavel.png";
  307.     $ttf_file = $opcao['icon-path']."indexer/konqueror/konqueror-ttf.png";
  308.     $php_file = $opcao['icon-path']."indexer/konqueror/konqueror-texto.png";
  309.     $texto_file = $opcao['icon-path']."indexer/konqueror/konqueror-texto.png";
  310.     $directoria_file = $opcao['icon-path']."indexer/konqueror/konqueror-directoria.png";
  311.     $unknown_file = $opcao['icon-path']."indexer/konqueror/konqueror-texto.png";
  312.  
  313.     $small_imagens_file = $opcao['icon-path']."indexer/konqueror/konqueror_small-imagem.png";
  314.     $small_comprimido_file = $opcao['icon-path']."indexer/konqueror/konqueror_small-comprimido.png";
  315.     $small_midi_file = $opcao['icon-path']."indexer/konqueror/konqueror_small-midi.png";
  316.     $small_html_file = $opcao['icon-path']."indexer/konqueror/konqueror_small-html.png";
  317.     $small_executavel_file = $opcao['icon-path']."indexer/konqueror/konqueror_small-executavel.png";
  318.     $small_ttf_file = $opcao['icon-path']."indexer/konqueror/konqueror_small-ttf.png";
  319.     $small_php_file = $opcao['icon-path']."indexer/konqueror/konqueror_small-texto.png";
  320.     $small_texto_file = $opcao['icon-path']."indexer/konqueror/konqueror_small-texto.png";
  321.     $small_directoria_file = $opcao['icon-path']."indexer/konqueror/konqueror_small-directoria.png";
  322.     $small_unknown_file = $opcao['icon-path']."indexer/konqueror/konqueror_small-texto.png";
  323.  
  324.  
  325.     break;
  326.     
  327.     case 4:
  328.         
  329.         // . Windows
  330.         
  331.     $exts = array("js", "musica", "video", "imagens", "comprimido", "midi", "html", "executavel", "php", "texto");
  332.  
  333.     $imagens_file = $opcao['icon-path']."indexer/windows/windows-imagem.png";
  334.     $comprimido_file = $opcao['icon-path']."indexer/windows/windows-comprimido.png";
  335.     $midi_file = $opcao['icon-path']."indexer/windows/windows-musica.png";
  336.     $musica_file = $opcao['icon-path']."indexer/windows/windows-musica.png";
  337.     $html_file = $opcao['icon-path']."indexer/windows/windows-html.png";
  338.     $executavel_file = $opcao['icon-path']."indexer/windows/windows-executavel.png";
  339.     $ttf_file = $opcao['icon-path']."indexer/windows/windows-ttf.png";
  340.     $texto_file = $opcao['icon-path']."indexer/windows/windows-texto.png";
  341.     $js_file = $opcao['icon-path']."indexer/windows/windows-js.png";
  342.     $php_file = $opcao['icon-path']."indexer/windows/windows-html.png";
  343.     $video_file = $opcao['icon-path']."indexer/windows/windows-filme.png";
  344.     $directoria_file = $opcao['icon-path']."indexer/windows/windows-directoria.png";
  345.     $unknown_file = $opcao['icon-path']."indexer/windows/windows-unknown.png";
  346.  
  347.     $small_imagens_file = $opcao['icon-path']."indexer/windows/windows_small-imagem.png";
  348.     $small_comprimido_file = $opcao['icon-path']."indexer/windows/windows_small-comprimido.png";
  349.     $small_midi_file = $opcao['icon-path']."indexer/windows/windows_small-musica.png";
  350.     $small_musica_file = $opcao['icon-path']."indexer/windows/windows_small-musica.png";
  351.     $small_html_file = $opcao['icon-path']."indexer/windows/windows_small-html.png";
  352.     $small_executavel_file = $opcao['icon-path']."indexer/windows/windows_small-executavel.png";
  353.     $small_ttf_file = $opcao['icon-path']."indexer/windows/windows_small-ttf.png";
  354.     $small_texto_file = $opcao['icon-path']."indexer/windows/windows_small-texto.png";
  355.     $small_js_file = $opcao['icon-path']."indexer/windows/windows_small-js.png";
  356.     $small_php_file = $opcao['icon-path']."indexer/windows/windows_small-html.png";
  357.     $small_video_file = $opcao['icon-path']."indexer/windows/windows_small-filme.png";
  358.     $small_directoria_file = $opcao['icon-path']."indexer/windows/windows_small-directoria.png";
  359.     $small_unknown_file = $opcao['icon-path']."indexer/windows/windows_small-unknown.png";
  360.  
  361.     break;
  362.     
  363. }
  364. $i=count($aliases);;
  365. $z=0;
  366. for($f=0;$f<$i;$f++) {
  367.     $user_alias[$z]=$aliases[$f];
  368.     $size_alias[$z]=strlen($aliases[$f]);
  369.     $f++;
  370.     $disk_alias[$z]=$aliases[$f];
  371.     $z++;
  372. }
  373. array_multisort($size_alias,SORT_DESC,SORT_NUMERIC,$user_alias,$disk_alias);
  374.  
  375. ?>
  376.