HTML5;
echo $html5;
foreach ($default as $value) {
echo '
';
echo '
';
echo '
' . $value["type"] . '
';
echo '
' . $value["size"] . '
';
echo '
' . $value["date"] . '
';
echo '
';
}
foreach ($directories as $value) {
echo '
';
if ($value["link"] === null) {
echo '
' . $value["name"] . '
';
} else {
echo '
';
}
echo '
' . $value["type"] . '
';
echo '
' . $value["size"] . '
';
echo '
' . $value["date"] . '
';
echo '
';
}
foreach ($files as $value) {
echo '
';
if ($value["link"] === null) {
echo '
' . $value["name"] . '
';
} else {
echo '
';
}
echo '
' . $value["type"] . '
';
echo '
' . $value["size"] . '
';
echo '
' . $value["date"] . '
';
echo '
';
}
$html5 = <<
HTML5;
echo $html5;
# Functions
// String obfuscation
// ROT-13 + Zlib compression + base64 encoding
// See: https://stackoverflow.com/questions/2996049/how-to-compress-decompress-a-long-query-string-in-php
function obfuscate($str)
{
return rtrim(strtr(base64_encode(gzdeflate(str_rot13($str), 9)), '+/', '-_'), '=');
}
function deobfuscate($str)
{
return str_rot13(gzinflate(base64_decode(strtr($str, '-_', '+/'))));
}
// Prettifies file size
function prettysize($size)
{
if ($size < 1024) {
$size = $size;
} elseif (($size < 1048576) && ($size > 1023)) {
$size = round($size / 1024, 1) . "K";
} elseif (($size < 1073741824) && ($size > 1048575)) {
$size = round($size / 1048576, 1) . "M";
} else {
$size = round($size / 1073741824, 1) . "G";
}
return $size;
}
// Prettifies file type
function prettytype($file)
{
// Gets file extension
$extn = pathinfo($file, PATHINFO_EXTENSION);
switch ($extn) {
case "png":
$type = "PNG image";
break;
case "jpg":
$type = "JPEG image";
break;
case "jpeg":
$type = "JPEG image";
break;
case "svg":
$type = "SVG image";
break;
case "gif":
$type = "GIF image";
break;
case "ico":
$type = "Windows icon";
break;
case "txt":
$type = "Text file";
break;
case "log":
$type = "Log file";
break;
case "htm":
$type = "HTML file";
break;
case "html":
$type = "HTML file";
break;
case "xhtml":
$type = "HTML file";
break;
case "shtml":
$type = "HTML file";
break;
case "php":
$type = "PHP script";
break;
case "js":
$type = "Javascript file";
break;
case "css":
$type = "Stylesheet";
break;
case "pdf":
$type = "PDF document";
break;
case "xls":
$type = "Spreadsheet";
break;
case "xlsx":
$type = "Spreadsheet";
break;
case "doc":
$type = "Microsoft Word document";
break;
case "docx":
$type = "Microsoft Word document";
break;
case "zip":
$type = "ZIP archive";
break;
case "htaccess":
$type = "Apache config file";
break;
case "exe":
$type = "Windows executable";
break;
case "torrent":
$type = "BitTorrent file";
break;
default:
if ($extn !== "") {
$type = strtoupper($extn) . " file";
} else {
$type = "Unknown";
}
break;
}
return $type;
}
// Prettifies modification date
function prettydate($file)
{
return date("Y-m-d H:i:s", filemtime($file));
}