First
This commit is contained in:
commit
415eae4374
|
@ -0,0 +1,2 @@
|
|||
content/*
|
||||
favicon.apng
|
|
@ -0,0 +1,5 @@
|
|||
# Kino-PHP
|
||||
## What is this
|
||||
PHP script that allows the navigation of folders and shows files within the "/content" folder.
|
||||
|
||||
It is styled with a custom css that you may edit. It is also in catalan, which you may also change.
|
|
@ -0,0 +1,71 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="ca">
|
||||
<head>
|
||||
<meta charset="utf-8"/>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
|
||||
<title>Dusk Kino</title>
|
||||
<link rel="icon" type="image/png" href="./favicon.apng" sizes="32x32">
|
||||
<link href="./normal.css" rel="stylesheet" type="text/css" media="all"/>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Dusk Kino</h1>
|
||||
|
||||
<?php
|
||||
$basedir = "./content";
|
||||
$_GET["q"] = $_GET["q"] ?? "";
|
||||
|
||||
$currentdir = $basedir . ($_GET["q"] ? "/" . $_GET["q"] : "");
|
||||
|
||||
//Avoid being able to go back in directory structure
|
||||
if(strstr($currentdir, "..") || !is_dir($currentdir)) {
|
||||
echo("404");
|
||||
die();
|
||||
}
|
||||
|
||||
//Check if home and back buttons are needed
|
||||
if($currentdir != $basedir) {
|
||||
echo("<div id=\"navigation\">");
|
||||
echo("<a href=\"/\">Inici</a><br/>");
|
||||
|
||||
//Solve ocurrences where url has ?q=./
|
||||
if (dirname($_GET["q"]) == ".") {
|
||||
$parentdir = "";
|
||||
}
|
||||
else $parentdir = dirname($_GET["q"]);
|
||||
|
||||
echo("<a href=\"?q=" . $parentdir . "\">Arrere</a><br/>");
|
||||
echo("</div>");
|
||||
}
|
||||
|
||||
echo("<hr style=\"border:2px dashed #e87d3e; margin-bottom: 65px\"/>");
|
||||
|
||||
$is_there_files = false;
|
||||
|
||||
//Show folder links
|
||||
$dirs = scandir($currentdir);
|
||||
echo("<h2>Carpetes</h2>");
|
||||
foreach($dirs as $file) {
|
||||
if ($file[0] != '.' && is_dir("$currentdir/$file")) {
|
||||
echo("<a href=\"?q=" . ($_GET["q"] ? $_GET["q"] . "/" : "") . "$file\"><b>/$file/</b></a><br/>\n");
|
||||
}
|
||||
if(!is_dir("$currentdir/$file")) $is_there_files = true;
|
||||
}
|
||||
|
||||
if($is_there_files){
|
||||
echo("<hr/>");
|
||||
|
||||
//Show file links
|
||||
echo("<h2>Fitxers</h2>");
|
||||
|
||||
echo("<div id=\"files\">");
|
||||
foreach($dirs as $file) {
|
||||
if ($file[0] != '.' && !is_dir("$currentdir/$file")) {
|
||||
echo("<a href=\"$currentdir/$file\"><b>$file</b></a><br/>\n");
|
||||
}
|
||||
}
|
||||
echo("</div>");
|
||||
}
|
||||
printf('<p class="path">/%s</p>', $_GET["q"]);
|
||||
?>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,59 @@
|
|||
body {
|
||||
background-color: #2e2e2e;
|
||||
color: #d6d6d6;
|
||||
font-family: "Courier New", monospace;
|
||||
font-size: 1.25em;
|
||||
margin: 75px 20%;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
h1 {
|
||||
font-size: 4em;
|
||||
}
|
||||
/* unvisited link */
|
||||
a:link {
|
||||
color: #e87d3e;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
/* visited link */
|
||||
a:visited {
|
||||
color: #e87d3e;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
/* mouse over link */
|
||||
a:hover {
|
||||
color: #2e2e2e;
|
||||
background-color: #e87d3e;
|
||||
transition: color 0.1s, background-color 0.1s;
|
||||
}
|
||||
|
||||
/* selected link */
|
||||
/*a:active {
|
||||
} */
|
||||
|
||||
#navigation {
|
||||
border: 2px dashed #d6d6d6;
|
||||
padding: 10px;
|
||||
display: inline-block;
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
#files {
|
||||
padding: 20px;
|
||||
text-align: left;
|
||||
display: inline-block;
|
||||
border: 2px dashed #d6d6d6;
|
||||
}
|
||||
|
||||
.path {
|
||||
font-style: italic;
|
||||
font-size: 0.75em;
|
||||
color: rgba(255,255,255,0.5);
|
||||
}
|
||||
|
||||
hr {
|
||||
border: 1.5px solid #d6d6d6;
|
||||
}
|
||||
|
Loading…
Reference in New Issue