diff --git a/index.php b/index.php index f2caa44..0bd1582 100644 --- a/index.php +++ b/index.php @@ -22,6 +22,8 @@ die(); } + + //Check if home and back buttons are needed if($currentdir != $basedir) { echo("
"); @@ -39,32 +41,48 @@ echo("
"); - $is_there_files = false; - - //Show folder links + $directories = []; + $files = []; + $dirs = scandir($currentdir); - echo("

Carpetes

"); + foreach($dirs as $file) { - if ($file[0] != '.' && is_dir("$currentdir/$file")) { - echo("/$file/
\n"); + if ($file[0] != '.') { + if (is_dir("$currentdir/$file")) { + array_push($directories, $file); + } + else { + array_push($files, $file); + } } - if(!is_dir("$currentdir/$file")) $is_there_files = true; } - if($is_there_files){ - echo("
"); + //Show folder links + if(count($directories) > 0) { + echo("

Carpetes

"); + foreach($directories as $file) { + printf('/%s/
' . "\n" , + $_GET["q"] ? $_GET["q"] . "/" : "", $file, $file); + } + } + + //Show Files + if(count($files) > 0) { + if (count($directories) > 0) echo("
"); //Show file links echo("

Fitxers

"); echo("
"); - foreach($dirs as $file) { - if ($file[0] != '.' && !is_dir("$currentdir/$file")) { - echo("$file
\n"); - } + + foreach($files as $file) { + printf('%s
' , + $currentdir, $file, $file); + printf("\n"); } echo("
"); } + printf('

/%s

', $_GET["q"]); ?> diff --git a/normal.css b/normal.css index 19d5e64..35f9cfb 100644 --- a/normal.css +++ b/normal.css @@ -40,7 +40,7 @@ a:hover { position: fixed; bottom: 25px; left: 25px; - background-color: #2e2e2e; + background-color: #101010; } #files { @@ -48,6 +48,8 @@ a:hover { text-align: left; display: inline-block; border: 2px dashed #d6d6d6; + min-width: 400px; + background-color: #101010; } .path {