home *** CD-ROM | disk | FTP | other *** search
- <?
-
- /****************************** LICENSE/LICEN╟A ********************************
-
- PHP Directory Indexer Version 0.2
- Copyright (C) 2002-2003 Projecto Adamastor (info@adamastor.org)
-
- This program is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License
- as published by the Free Software Foundation; either version 2
- of the License, or (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-
- More Info About The Licence At http://www.gnu.org/copyleft/gpl.html
-
- *******************************************************************************/
-
- $import_style = $_REQUEST["estilo"];
- $import_ordenar = $_REQUEST["ordenar"];
- $import_vista = $_REQUEST["showmode"];
-
- if ($import_style != $null) { setcookie("devile-list_style", $import_style, time()+36000*60, "/", ""); }
- if ($import_ordenar != $null) { setcookie("devile-list_ordenar", $import_ordenar, time()+36000*60, "/", ""); }
- if ($import_vista != $null) { setcookie("devile-list_vista", $import_vista, time()+36000*60, "/", ""); }
-
- error_reporting(0);
-
- $directoria = urldecode($_SERVER["REQUEST_URI"]);
- $stringA = $directoria;
- $stringA = strrev($stringA);
- $result = strchr($stringA,"/");
- $subhost = strrev($result);
- /*if(strchr($directoria,"?")) { Header("Location: http://" . $_SERVER["HTTP_HOST"] . $subhost); exit; }
- if ($directoria=="/") { die("<b><center>Permission Denied!</center></b>"); }
- else if ($directoria=="/indexer.php") { die("<b><center>Permission Denied!</center></b>"); }*/
- /*echo "<?xml version=\"1.0\" encoding=\"iso-8859-1\"?>\n";*/
- echo "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\n";
- require "inc_indexer.php";
- global $opcao;
-
- ?>
-
- <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="PT" lang="PT">
- <head>
- <?
- echo "<title>".$opcao['titulo']."</title>\n";
- ?>
- <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
- <style type="text/css" media="screen">
- <!--
- <? put_style(); ?>
- -->
- </style>
- </head>
- <body>
- <?
- put_form();
- if (($opcao['texto-mostrar']==1)&&($vista==0)) { echo "<h1 align=\"center\">".$opcao['texto']."</h1>"; }
- echo "<div class=\"dirview-group\">";
-
- $alias_found=0;
- for($i=0;$i<count($user_alias);$i++) {
- if ($size_alias[$i]!=0) {
- if (strncmp($directoria, $user_alias[$i], $size_alias[$i]) == 0) {
- // $directoria=str_replace($user_alias[$i], $disk_alias[$i], $directoria);
- $directoria=substr_replace($directoria, $disk_alias[$i], 0, $size_alias[$i]);
- $alias_found=1;
- break;
- }
- }
- }
- if($alias_found==0) {
- if (strncmp($directoria, "/~", 2) == 0) {
- $directoria = str_replace("/~", "", $directoria);
- $home = explode("/", $directoria);
- $directoria = "/home/" . $home[0] . "/public_html/";
- $i = 1;
- while($home[$i] != $null) { $directoria = $directoria . "$home[$i]" . "/"; $i++; }
- }
- else { $directoria = $_SERVER["DOCUMENT_ROOT"] . "$directoria"; }
- }
- $dir = @opendir($directoria) or die("Ocorreu Um Erro Ao Tentar Abrir a Directoria: $directoria");
- $i=0;
- while ($file = readdir($dir)) {
- if(is_dir("$directoria$file")) {
- if((strncmp($file,".",1) && ($file!=".."))) {
- $dirs[0][$i]="$file";
- $dirs[1][$i]=date($opcao['data-formato'], filemtime("$directoria$file"));
- $shellfile = str_replace(" ", "\ ", "$directoria$file");
- $shellfile = str_replace(")", "\)", "$shellfile");
- $shellfile = str_replace("(", "\(", "$shellfile");
- $dirs[2][$i]=exec("ls -1 $shellfile | wc -l");
- $i++;
- }
- }
- }
- closedir($dir);
- $i=0;
- $dir = @opendir($directoria) or die("Ocorreu Um Erro Ao Tentar Abrir a Directoria: $directoria");
- while ($file = readdir($dir)) {
- if( is_file("$directoria$file") ) {
- if(strncmp($file,".",1)) {
- $files[0][$i]="$file";
- // $files[1][$i]=date($opcao['data-formato'], filemtime("$directoria$file"));
- $files[1][$i] = filemtime("$directoria$file");
- $files[2][$i]=filesize("$directoria$file");
- if( ($vista == 1) && ($opcao['tipo'] == 1) ) {
- if(is_readable("$directoria$file")) {
- $shellfile = str_replace(")", "\)", "$directoria$file");
- $shellfile = str_replace("(", "\(", "$shellfile");
- $shellfile = str_replace(" ", "\ ", "$shellfile");
- $shellfile = str_replace("'", "\'", "$shellfile");
- $shellfile = str_replace("&", "\&", "$shellfile");
- $files[3][$i]=exec("file -b $shellfile | cut -f 1 -d \",\"");
- }
- else {
- //$files[3][$i]="Cannot Read The File";
- }
- }
- $i++;
- }
- }
- }
- closedir($dir);
- global $ord;
- if($files) {
- // asort($files[$ord], SORT_STRING);
- uasort($files[$ord], 'strnatcasecmp');
- reset ($files);
- }
- if($dirs) {
- uasort($dirs[$ord], 'strnatcasecmp');
- reset ($dirs);
- }
- $i=0;
- if($vista==0) {
- echo "<div class=\"dirview-item\"><div class=\"dirview-info\"><a href=\"../\"><img src=\"$directoria_file\" width=\"".$opcao['icon-width']."\" height=\"".$opcao['icon-height']."\" border=\"0\" alt=\"".$opcao['icon-dir']."\" /><br />../</a></div><div class=\"dirview-extinfo\"> </div></div>\n";
- }
- else if($vista==1) {
- echo "<br /><table border=\"0\" cellpadding=\"2\" cellspacing=\"0\" width=\"100%\" style=\"background-color: #CCCCDD; padding: 1px 1px 1px 1px; margin-top: 0; margin-bottom: 0;\">
- <tr style=\"font: 13px verdana, arial, helvetica, sans-serif; font-weight: bold; background-color: #CCCCDD; text-align: center; margin-top: 0; margin-bottom: 0; padding: 1px 1px 1px 1px;\">
- <td> </td>
- <td nowrap=\"nowrap\"><b>".$opcao['texto']."</b></td>
- <td> </td>
- </tr>
- <tr><td colspan=\"3\">
- <table border=\"2\" cellpadding=\"2\" cellspacing=\"0\" width=\"100%\" style=\"border-color: #ECECEC; background-color: #FFFFFF; border-top-width: 1px; border-left-width: 0px; border-right-width: 0px; border-bottom-width: 0px;\">
- <tr>
- <td width=\"".$opcao['icon-small-width']."\" style=\"border-color: #ECECEC; border-left-width: 0px; border-right-width: 1px; border-top-width: 0px; border-bottom-width: 1px; padding: 1px 1px 1px 1px; font: 11px verdana, arial, helvetica, sans-serif; text-align:center; color: #000000;\" > </td>
- <td style=\"border-color: #ECECEC; border-left-width: 0px; border-right-width: 1px; border-top-width: 0px; border-bottom-width: 1px; padding: 1px 1px 1px 1px; font: 11px verdana, arial, helvetica, sans-serif; text-align:left; color: #000000;\" nowrap=\"nowrap\"><b>".$opcao['lang-nome']."</b></td>";
- if ($opcao['tamanho']==1) { echo "<td style=\"border-color: #ECECEC; border-left-width: 0px; border-right-width: 1px; border-top-width: 0px; border-bottom-width: 1px; padding: 1px 1px 1px 1px; font: 11px verdana, arial, helvetica, sans-serif; text-align:right; color: #000000;\" nowrap=\"nowrap\"><b>".$opcao['lang-tamanho']."</b></td>"; }
- if($opcao['itens']==1) { echo "<td style=\"border-color: #ECECEC; border-left-width: 0px; border-right-width: 1px; border-top-width: 0px; border-bottom-width: 1px; padding: 1px 1px 1px 1px; font: 11px verdana, arial, helvetica, sans-serif; text-align:right; color: #000000;\" nowrap=\"nowrap\"><b>".$opcao['lang-itens']." </b></td>"; }
- if ($opcao['data']==1) { echo "<td style=\"border-color: #ECECEC; border-left-width: 0px; border-right-width: 1px; border-top-width: 0px; border-bottom-width: 1px; padding: 1px 1px 1px 1px; font: 11px verdana, arial, helvetica, sans-serif; text-align:left; color: #000000;\" nowrap=\"nowrap\"><b>".$opcao['lang-modificado']."</b></td>"; }
- if($opcao['tipo'] == 1) { echo "<td style=\"border-color: #ECECEC; border-left-width: 0px; border-right-width: 1px; border-top-width: 0px; border-bottom-width: 1px; padding: 1px 1px 1px 1px; font: 11px verdana, arial, helvetica, sans-serif; text-align:left; color: #000000;\" nowrap=\"nowrap\"><b>".$opcao['lang-tipo']."</b></td>"; }
- echo "</tr>
- <tr>
- <td width=\"".$opcao['icon-small-width']."\" style=\"border-color: #ECECEC; border-left-width: 0px; border-right-width: 1px; border-top-width: 0px; border-bottom-width: 1px; padding: 1px 1px 1px 1px; font: 11px verdana, arial, helvetica, sans-serif; text-align:center; color: #000000;\"><img src=\"$small_directoria_file\" width=\"".$opcao['icon-small-width']."\" height=\"".$opcao['icon-small-height']."\" border=\"0\" alt=\"".$opcao['icon-dir']."\" /></td>
- <td style=\"border-color: #ECECEC; border-left-width: 0px; border-right-width: 1px; border-top-width: 0px; border-bottom-width: 1px; padding: 1px 1px 1px 1px; font: 11px verdana, arial, helvetica, sans-serif; text-align:left; color: #000000;\" align=\"left\" nowrap=\"nowrap\"><a href=\"../\">../</a></td>";
- if ($opcao['tamanho']==1) { echo "<td style=\"border-color: #ECECEC; border-left-width: 0px; border-right-width: 1px; border-top-width: 0px; border-bottom-width: 1px; padding: 1px 1px 1px 1px; font: 11px verdana, arial, helvetica, sans-serif; text-align:left; color: #000000;\" align=\"right\" nowrap=\"nowrap\"> </td>"; }
- if($opcao['itens']==1) { echo "<td style=\"border-color: #ECECEC; border-left-width: 0px; border-right-width: 1px; border-top-width: 0px; border-bottom-width: 1px; padding: 1px 1px 1px 1px; font: 11px verdana, arial, helvetica, sans-serif; text-align:left; color: #000000;\" nowrap=\"nowrap\"> </td>"; }
- if ($opcao['data']==1) { echo "<td style=\"border-color: #ECECEC; border-left-width: 0px; border-right-width: 1px; border-top-width: 0px; border-bottom-width: 1px; padding: 1px 1px 1px 1px; font: 11px verdana, arial, helvetica, sans-serif; text-align:left; color: #000000;\" nowrap=\"nowrap\"> </td>"; }
- if($opcao['tipo'] == 1) { echo "<td style=\"border-color: #ECECEC; border-left-width: 0px; border-right-width: 1px; border-top-width: 0px; border-bottom-width: 1px; padding: 1px 1px 1px 1px; font: 11px verdana, arial, helvetica, sans-serif; text-align:left; color: #000000;\" nowrap=\"nowrap\">".$opcao['icon-dir']."</td>"; }
- echo "</tr>\n";
- }
- //while($dirs[$i]!=$null) {
- if($dirs[0][0]!=$null) {
- while (list($i) = each($dirs[$ord])) {
- if (strlen($dirs[0][$i])<$opcao['max-size']) {$dirs2[$i]=$dirs[0][$i]; }
- else { $dirs2[$i]=substr($dirs[0][$i], 0, $opcao['max-size']-3) . "..."; }
- $date= $dirs[1][$i];
- $items = $dirs[2][$i];
- if($vista==0) {
- echo "<div class=\"dirview-item\"><div class=\"dirview-info\"><a href=\"".$dirs[0][$i]."/\"><img src=\"$directoria_file\" width=\"".$opcao['icon-width']."\" height=\"".$opcao['icon-height']."\" border=\"0\" alt=\"".$opcao['icon-dir']."\" /><br />".$dirs2[$i]."/</a></div><div class=\"dirview-extinfo\"> </div>";
- if (($dirs[0][$i]!="..") && ($opcao['itens']==1)) { echo "<div class=\"dirview-info\">$items Itens</div>";}
- if ($opcao['data']==1) {echo "<div class=\"dirview-date\">$date</div>";}
- echo "</div>\n";
- }
- else if($vista==1) {
- echo "<tr>
- <td width=\"".$opcao['icon-small-width']."\" style=\"border-color: #ECECEC; border-left-width: 0px; border-right-width: 1px; border-top-width: 0px; border-bottom-width: 1px; padding: 1px 1px 1px 1px; font: 11px verdana, arial, helvetica, sans-serif; text-align:center; color: #000000;\"><img src=\"$small_directoria_file\" width=\"".$opcao['icon-small-width']."\" height=\"".$opcao['icon-small-height']."\" border=\"0\" alt=\"".$opcao['icon-dir']."\" /></td>
- <td style=\"border-color: #ECECEC; border-left-width: 0px; border-right-width: 1px; border-top-width: 0px; border-bottom-width: 1px; padding: 1px 1px 1px 1px; font: 11px verdana, arial, helvetica, sans-serif; text-align:left; color: #000000;\" nowrap=\"nowrap\"><a href=\"".$dirs[0][$i]."/\">".$dirs2[$i]."/</a></td>";
- if ($opcao['tamanho']==1) { echo "<td style=\"border-color: #ECECEC; border-left-width: 0px; border-right-width: 1px; border-top-width: 0px; border-bottom-width: 1px; padding: 1px 1px 1px 1px; font: 11px verdana, arial, helvetica, sans-serif; text-align:left; color: #000000;\" nowrap=\"nowrap\"> </td>"; }
- if (($dirs[0][$i]!="..") && ($opcao['itens']==1)) { echo "<td style=\"border-color: #ECECEC; border-left-width: 0px; border-right-width: 1px; border-top-width: 0px; border-bottom-width: 1px; padding: 1px 1px 1px 1px; font: 11px verdana, arial, helvetica, sans-serif; text-align:right; color: #000000;\" nowrap=\"nowrap\">$items ".$opcao['lang-itens']." </td>"; }
- if ($opcao['data']==1) { echo "<td style=\"border-color: #ECECEC; border-left-width: 0px; border-right-width: 1px; border-top-width: 0px; border-bottom-width: 1px; padding: 1px 1px 1px 1px; font: 11px verdana, arial, helvetica, sans-serif; text-align:left; color: #000000;\" nowrap=\"nowrap\">$date</td>";}
- if($opcao['tipo'] == 1) { echo "<td style=\"border-color: #ECECEC; border-left-width: 0px; border-right-width: 1px; border-top-width: 0px; border-bottom-width: 1px; padding: 1px 1px 1px 1px; font: 11px verdana, arial, helvetica, sans-serif; text-align:left; color: #000000;\" nowrap=\"nowrap\">".$opcao['icon-dir']."</td></tr>"; }
- }
- $i++;
- }
- }
- $i=0;
-
- //while($files[$i][0]!=$null) {
- if($files[0][0]!=$null) {
- while (list($i) = each($files[$ord])) {
- $_max_size=$opcao['max-size']+($vista*$opcao['max-size']);
- if (strlen($files[0][$i])<$_max_size) {
- $files2[$i]=$files[0][$i];
- $files2[$i]=str_replace("&", "&", $files2[$i]);
- }
- else {
- $files2[$i]=substr($files[0][$i], 0, $opcao['max-size']-3) . "...";
- $files2[$i]=str_replace("&", "&", $files2[$i]);
- }
- $files[0][$i]=str_replace("&", "&", $files[0][$i]);
- $size=$files[2][$i];
- if ($size<1024) { $unidade="B"; }
- else {
- $size=$size/1024;
- if ($size<1024) { $unidade="KB"; }
- else {
- $size=$size/1024;
- if ($size<1024) { $unidade="MB"; }
- else { $size=$size/1024;
- $unidade="GB";
- }
- }
- }
- $size=round($size,1);
- $tamanho=(strlen("$size") + 12)*6;
- $date=$files[1][$i];
- $extencao = strtolower(substr(strrchr($files[0][$i], "."), 1 ));
- $extencao = "." . $extencao;
- $imagem = "";
- $small_imagem = "";
- if (in_array("imagens", $exts)) { if (in_array ($extencao, $imagens)) { $imagem = $imagens_file; } }
- if (in_array("comprimido", $exts)) { if (in_array ($extencao, $comprimido)) { $imagem = $comprimido_file; } }
- if (in_array("midi", $exts)) { if (in_array ($extencao, $midi)) { $imagem = $midi_file; } }
- if (in_array("html", $exts)) { if (in_array ($extencao, $html)) { $imagem = $html_file; } }
- if (in_array("executavel", $exts)) { if (in_array ($extencao, $executavel)) { $imagem = $executavel_file; } }
- if (in_array("ttf", $exts)) { if (in_array ($extencao, $ttf)) { $imagem = $ttf_file; } }
- if (in_array("php", $exts)) { if (in_array ($extencao, $php)) { $imagem = $php_file; } }
- if (in_array("js", $exts)) { if (in_array ($extencao, $js)) { $imagem = $js_file; } }
- if (in_array("musica", $exts)) { if (in_array ($extencao, $musica)) { $imagem = $musica_file; } }
- if (in_array("video", $exts)) { if (in_array ($extencao, $video)) { $imagem = $video_file; } }
- if (in_array("texto", $exts)) { if (in_array ($extencao, $texto)) { $imagem = $texto_file; } }
- if ( $imagem == "" ) { $imagem = $unknown_file; }
- if (in_array("imagens", $exts)) { if (in_array ($extencao, $imagens)) { $small_imagem = $small_imagens_file; } }
- if (in_array("comprimido", $exts)) { if (in_array ($extencao, $comprimido)) { $small_imagem = $small_comprimido_file; } }
- if (in_array("midi", $exts)) { if (in_array ($extencao, $midi)) { $small_imagem = $small_midi_file; } }
- if (in_array("html", $exts)) { if (in_array ($extencao, $html)) { $small_imagem = $small_html_file; } }
- if (in_array("executavel", $exts)) { if (in_array ($extencao, $executavel)) { $small_imagem = $small_executavel_file; } }
- if (in_array("ttf", $exts)) { if (in_array ($extencao, $ttf)) { $small_imagem = $small_ttf_file; } }
- if (in_array("php", $exts)) { if (in_array ($extencao, $php)) { $small_imagem = $small_php_file; } }
- if (in_array("js", $exts)) { if (in_array ($extencao, $js)) { $small_imagem = $small_js_file; } }
- if (in_array("musica", $exts)) { if (in_array ($extencao, $musica)) { $small_imagem = $small_musica_file; } }
- if (in_array("video", $exts)) { if (in_array ($extencao, $video)) { $small_imagem = $small_video_file; } }
- if (in_array("texto", $exts)) { if (in_array ($extencao, $texto)) { $small_imagem = $small_texto_file; } }
- if ( $small_imagem == "" ) { $small_imagem = $small_unknown_file; }
-
- if($vista==0) {
- echo "<div class=\"dirview-item\"><div class=\"dirview-info\"><a href=\"" . $files[0][$i] . "\"><img src=\"$imagem\" width=\"".$opcao['icon-width']."\" height=\"".$opcao['icon-height']."\" border=\"0\" alt=\"".$opcao['icon-file']."\" /><br />$files2[$i]</a></div>";
- if ($opcao['tamanho']==1) {echo "<div class=\"dirview-info\">$size $unidade</div>"; }
- if ($opcao['data']==1) {echo"<div class=\"dirview-date\">". date($opcao['data-formato'],$date) . "</div>";}
- echo "</div>\n";
- }
- else if($vista==1) {
- echo "<tr>
- <td width=\"".$opcao['icon-small-width']."\" style=\"border-color: #ECECEC; border-left-width: 0px; border-right-width: 1px; border-top-width: 0px; border-bottom-width: 1px; padding: 1px 1px 1px 1px; font: 11px verdana, arial, helvetica, sans-serif; text-align:right; color: #000000;\"><img src=\"$small_imagem\" width=\"".$opcao['icon-small-width']."\" height=\"".$opcao['icon-small-height']."\" border=\"0\" alt=\"".$opcao['icon-file']."\" /></td>
- <td style=\"border-color: #ECECEC; border-left-width: 0px; border-right-width: 1px; border-top-width: 0px; border-bottom-width: 1px; padding: 1px 1px 1px 1px; font: 11px verdana, arial, helvetica, sans-serif; text-align:left; color: #000000;\" nowrap=\"nowrap\"><a href=\"" . $files[0][$i] . "\">".$files2[$i]."</a></td>";
- if ($opcao['tamanho']==1) { echo "<td style=\"border-color: #ECECEC; border-left-width: 0px; border-right-width: 1px; border-top-width: 0px; border-bottom-width: 1px; padding: 1px 1px 1px 1px; font: 11px verdana, arial, helvetica, sans-serif; text-align:right; color: #000000;\" nowrap=\"nowrap\">$size $unidade</td>\n"; }
- if (($dirs[0][$i]!="..") && ($opcao['itens']==1)) { echo "<td style=\"border-color: #ECECEC; border-left-width: 0px; border-right-width: 1px; border-top-width: 0px; border-bottom-width: 1px; padding: 1px 1px 1px 1px; font: 11px verdana, arial, helvetica, sans-serif; text-align:left; color: #000000;\" nowrap=\"nowrap\"> </td>"; }
- if ($opcao['data']==1) { echo "<td style=\"border-color: #ECECEC; border-left-width: 0px; border-right-width: 1px; border-top-width: 0px; border-bottom-width: 1px; padding: 1px 1px 1px 1px; font: 11px verdana, arial, helvetica, sans-serif; text-align:left; color: #000000;\" nowrap=\"nowrap\">". date($opcao['data-formato'],$date) . "</td>"; }
- if($opcao['tipo'] == 1) { echo "<td style=\"border-color: #ECECEC; border-left-width: 0px; border-right-width: 1px; border-top-width: 0px; border-bottom-width: 1px; padding: 1px 1px 1px 1px; font: 11px verdana, arial, helvetica, sans-serif; text-align:left; color: #000000;\" nowrap=\"nowrap\">".$files[3][$i]."</td></tr>"; }
-
- }
-
- $i++;
- }
- }
- if ($vista==1) { echo "</table></td></tr></table><br />"; }
- ?>
- </div>
- </body>
- </html>
-