Css and code cleaning

This commit is contained in:
Dusk 2021-08-29 21:09:13 +02:00
parent 5d6086de98
commit 61793bdb5f
2 changed files with 34 additions and 14 deletions

View File

@ -22,6 +22,8 @@
die(); die();
} }
//Check if home and back buttons are needed //Check if home and back buttons are needed
if($currentdir != $basedir) { if($currentdir != $basedir) {
echo("<div id=\"navigation\">"); echo("<div id=\"navigation\">");
@ -39,32 +41,48 @@
echo("<hr style=\"border:2px dashed #e87d3e; margin-bottom: 65px\"/>"); echo("<hr style=\"border:2px dashed #e87d3e; margin-bottom: 65px\"/>");
$is_there_files = false; $directories = [];
$files = [];
$dirs = scandir($currentdir);
foreach($dirs as $file) {
if ($file[0] != '.') {
if (is_dir("$currentdir/$file")) {
array_push($directories, $file);
}
else {
array_push($files, $file);
}
}
}
//Show folder links //Show folder links
$dirs = scandir($currentdir); if(count($directories) > 0) {
echo("<h2>Carpetes</h2>"); echo("<h2>Carpetes</h2>");
foreach($dirs as $file) { foreach($directories as $file) {
if ($file[0] != '.' && is_dir("$currentdir/$file")) { printf('<a href="?q=%s%s"><b>/%s/</b></a><br/>' . "\n" ,
echo("<a href=\"?q=" . ($_GET["q"] ? $_GET["q"] . "/" : "") . "$file\"><b>/$file/</b></a><br/>\n"); $_GET["q"] ? $_GET["q"] . "/" : "", $file, $file);
} }
if(!is_dir("$currentdir/$file")) $is_there_files = true;
} }
if($is_there_files){ //Show Files
echo("<hr/>"); if(count($files) > 0) {
if (count($directories) > 0) echo("<hr/>");
//Show file links //Show file links
echo("<h2>Fitxers</h2>"); echo("<h2>Fitxers</h2>");
echo("<div id=\"files\">"); echo("<div id=\"files\">");
foreach($dirs as $file) {
if ($file[0] != '.' && !is_dir("$currentdir/$file")) { foreach($files as $file) {
echo("<a href=\"$currentdir/$file\"><b>$file</b></a><br/>\n"); printf('<a href="%s/%s"><b>%s</b></a><br/>' ,
} $currentdir, $file, $file);
printf("\n");
} }
echo("</div>"); echo("</div>");
} }
printf('<p class="path">/%s</p>', $_GET["q"]); printf('<p class="path">/%s</p>', $_GET["q"]);
?> ?>
</body> </body>

View File

@ -40,7 +40,7 @@ a:hover {
position: fixed; position: fixed;
bottom: 25px; bottom: 25px;
left: 25px; left: 25px;
background-color: #2e2e2e; background-color: #101010;
} }
#files { #files {
@ -48,6 +48,8 @@ a:hover {
text-align: left; text-align: left;
display: inline-block; display: inline-block;
border: 2px dashed #d6d6d6; border: 2px dashed #d6d6d6;
min-width: 400px;
background-color: #101010;
} }
.path { .path {