Dateigrösse: 12.6 kb
<?php
//require_once "/home/httpd/vhosts/michaelster.ch/httpdocs/testFolder/auth/authinc.php";
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Verzeichnis</title>
<meta content="width=device-width,initial-scale=1.0" name="viewport">
<meta content="IE=edge,chrome=1" http-equiv="X-UA-Compatible">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<!--
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
-->
<script type="text/javascript">
function BlurLinks() {
lnks=document.getElementsByTagName("a");
for(i=0;i<lnks.length;i++) {
lnks[i].onfocus=new Function("if(this.blur)this.blur()");
}
}
window.onload=BlurLinks
</script>
<style type="text/css">
body { font-family:verdana,sans-serif; font-size:12px; padding:0; margin:0; background-color:#f8f8ff; background-image:none; }
h4 { font-size:14px; padding-left:3px; }
img { margin-top:4px; }
blockquote { margin:1em 0 0 2.5em; line-height:24px; border:0px solid grey; }
a span.pp { font-family:arial,sans-serif; font-size:14px; color:green; vertical-align:text-bottom; }
a:hover span.pp { color:#c9c9e5; }
a { text-decoration:none; display:inline-block; }
a.dirUp { width:100%; }
a.dirUp:hover { background-color:#c9c9e5; }
a.adress { font-family:verdana,sans-serif; font-size:12px; font-weight:normal; color:#000; padding:0 1em; width:calc(100% - 25px); overflow:hidden; white-space:nowrap; text-overflow:ellipsis; }
a.dir { font-weight:bold; }
a.src { margin-left: -2px; }
a.adress:hover { color:#f5f5ff; background-color:#000; }
a img.js { margin-top:5px; border:0px solid #f00; }
a:hover img.js { background-color:transparent !important; }
a img.up { padding:1px; margin-top:2px; margin-left:1em; border:1px solid #e6e6fa; }
a:hover img.up { border:1px solid transparent; background-color:#fff; margin-right:3px; }
span.aktuell { font-family:"Lucida Handwriting",arial,sans-serif; font-size:16px; font-weight:bold; }
#schlussstrich { clear:left; width:calc(100% - 40px); border-top:1pt solid #333; height:1px; }
.zero { clear:both; margin:0; padding:0; }
#DIVleft,
#DIVmidle,
#DIVright { float:left; width:calc(100% - 40px); height:24px; }
#DIVmidle { text-align:center; width:48px; font-weight:bold; margin:0 1px; display:none; }
#DIVright { text-align:right; display:none; margin-right:5px; }
@media screen and (min-width : 320px) {
#DIVleft {
width: 200px;
}
#DIVmidle {
display: inline-block;
}
#schlussstrich {
width: 250px;
}
}
@media screen and (min-width : 360px) {
#DIVleft {
width: 220px;
}
#schlussstrich {
width: 270px;
}
}
@media screen and (min-width : 410px) {
body {
background-color: #f8f8ff;
background-image: url(http://www.michaelster.ch/img/avatar33.jpg);
background-repeat: repeat-y;
background-position: top left;
background-attachment: fixed;
}
blockquote {
margin: 1em 0 0 10em;
}
}
@media screen and (min-width : 550px) {
#DIVleft {
width: 270px;
}
#schlussstrich {
width: 320px;
}
}
@media screen and (min-width : 680px) {
blockquote {
margin: 2em 0 0 12em;
}
#DIVright {
display: inline-block;
width: 170px;
}
#schlussstrich {
width: 490px;
}
}
@media screen and (min-width : 780px) {
#DIVleft {
width: 350px;
}
#schlussstrich {
width: 570px;
}
}
@media screen and (min-width : 840px) {
#DIVright {
width: 250px;
}
#schlussstrich {
width: 650px;
}
}
@media screen and (min-width : 980px) {
body {
background-color: #f8f8ff;
background-image: url(http://www.michaelster.ch/img/wp-overlay-body-bg6.png);
background-repeat: repeat-y;
background-position: top left;
background-attachment: fixed;
}
.borderline {
position: absolute;
top: 0;
left: 0;
width: 150px;
height: 99.8%;
border-right: 1.5pt solid #d99e4e;
}
blockquote {
margin: 4em 0 0 18em;
}
#DIVright {
width: 300px;
}
#schlussstrich {
width: 700px;
}
}
</style>
</head>
<body>
<?php
/*
ini_set('error_reporting', E_ALL);
*/
$srcViewPfad = $_SERVER['HTTP_HOST'];
$absoluterPfad = @dirname($_SERVER['SCRIPT_FILENAME']);
$phpself = @dirname($_SERVER['PHP_SELF'])=='/' ? '' : @dirname($_SERVER['PHP_SELF']); //im root-directory ein MUSS!!!
$imgPfad = 'http://www.michaelster.ch/img/';
/* @return $file_data_array Array mit Dateien, die nicht angezeigt werden sollen */
require_once '/home/httpd/vhosts/michaelster.ch/httpdocs/get_array_data.php';
/* Array mit files und directories, die nur in diesem Verzeichnis unsichtbar sein sollen */
$piuArray = array();
/* beide Arrays vermengen */
$excludeDataArray = @array_merge($file_data_array, $piuArray);
/**** directory auslesen ****/
$data_file = array();
$data_dir = array();
$filepfad = $absoluterPfad . '/';
$verzeichniszugriff = dir($filepfad);
while ($datei = $verzeichniszugriff->read())
{
/* Files lesen und im array $data_file ablegen */
if (@is_file($datei) && @!in_array($datei, $excludeDataArray))
{
$data_file[@filesize($datei)] = $datei;
}
/* Directories lesen und im $data_dir ablegen */
if ($datei != "." && @is_dir($datei) && @!in_array($datei, $excludeDataArray))
{
$data_dir[@filemtime($datei)] = $datei; // wenn zwei oder mehrere Dateien zur exakt gleichen filemtime gespeichert wurden, ueberschreiben sich die Dateien. Deshalb nochmals indexieren, als nummerischen Array[].
}
}
$verzeichniszugriff->close();
function arraySort(&$array, $sort='arsort')
{
return @$sort($array);
}
arraySort($data_dir, 'natcasesort');
arraySort($data_file, 'asort');
$zeile1 = '';
$zeile2 = '';
$bgcolor = "#fff";
/*
echo '<pre class="left">';
print_r($data_file);
echo '</pre>';
echo '<pre class="left">';
print_r($data_file_name);
echo '</pre>';
echo '<p class="clear"></p>';
*/
// directories
foreach($data_dir as $key_dir => $value_dir)
{
$bgcolor = $bgcolor == "#fff" ? "#e6e6fa" : "#fff";
$zeile2 .= "<div style='background-color:" . $bgcolor . "' id='DIVleft'>";
$zeile2 .= "<a " . css_class($value_dir) . " href='http://" . $srcViewPfad . $phpself . "/" . $value_dir . "'>" . dirUp_icon($value_dir) . "</a>";
$zeile2 .= "</div>";
$zeile2 .= "<div style='background-color:" . $bgcolor . ";' id='DIVmidle'>" . dir_icon($value_dir) . "</div>";
$zeile2 .= "<div style='background-color:" . $bgcolor . ";' id='DIVright'>" . datum($value_dir, $key_dir) . " </div>";
$zeile2 .= "<div class='zero'></div>";
}
// files
if(!empty($data_file))
{
foreach($data_file as $key => $file)
{
$nb_size = $key . " Bytes"; // in Bytes
$kb_size = round($key / (1000),2) . " KB"; // in KB
$mb_size = round($key / (1000*1000),2) . " MB"; // in MB
$sizeTmp = $key > 1000000 ? $mb_size : $kb_size;
$size = $key < 1000 ? $nb_size : $sizeTmp;
$bgcolor = $bgcolor == "#e6e6fa" ? "#fff" : "#e6e6fa";
$zeile1 .= "<div style='background-color:" . $bgcolor . ";' id='DIVleft'>";
$zeile1 .= "<a class='adress' href='http://" . $srcViewPfad . $phpself . "/" . $file . "'>" . $file . "</a>";
$zeile1 .= "</div>";
$zeile1 .= "<div style='background-color:" . $bgcolor . ";' id='DIVmidle'>" . weiche_endung($file) . "</div>";
$zeile1 .= "<div style='background-color:" . $bgcolor . ";' id='DIVright'>" . $size . " </div>"; // - ". $key ."
$zeile1 .= "<div class='zero'></div>";
}
}
/*************************** OUTPUT ********************************/
echo '<div class="borderline"> </div>';
echo '<blockquote>';
echo '<h4><span class="aktuell">~</span>' . $phpself . '</h4>';
echo $zeile2 . $zeile1;
echo '<div id="schlussstrich"> </div>';
echo '</blockquote>';
function weiche_endung($datei)
{
global $srcViewPfad, $absoluterPfad, $imgPfad;
$endung = array('jpg' => '<img src="' . $imgPfad . 'icon_jpeg_small.gif" height="16" width="18" alt="" />',
'jpeg' => '<img src="' . $imgPfad . 'icon_jpeg_small.gif" height="16" width="18" alt="" />',
'png' => '<img src="' . $imgPfad . 'icon_jpeg_small.gif" height="16" width="18" alt="" />',
'ico' => '<img src="' . $imgPfad . 'icon_jpeg_small.gif" height="16" width="18" alt="" />',
'jpg' => '<img src="' . $imgPfad . 'icon_jpeg_small.gif" height="16" width="18" alt="" />',
'gif' => '<img src="' . $imgPfad . 'icon_gif.gif" height="16" width="16" alt="" />',
'cur' => '<img src="' . $imgPfad . 'icon_cur.gif" height="16" width="16" alt="" />',
'js' => '<img src="' . $imgPfad . 'icon_js.gif" height="16" width="16" alt="" class="js" />',
'mp3' => '<img src="' . $imgPfad . 'icon_mp3.gif" height="18" width="20" alt="" class="js" />',
'css' => '<img src="' . $imgPfad . 'icon_css.gif" height="16" width="16" alt="" />',
'swf' => '<img src="' . $imgPfad . 'icon_swf.gif" height="18" width="16" alt="" />',
'pdf' => '<img src="' . $imgPfad . 'icon_pdf.gif" height="16" width="16" alt="" />',
'zip' => '<img src="' . $imgPfad . 'icon_zip.gif" height="16" width="16" alt="" />',
'rar' => '<img src="' . $imgPfad . 'icon_rar.gif" height="16" width="16" alt="" />',
'tar' => '<img src="' . $imgPfad . 'icon_rar.gif" height="16" width="16" alt="" />',
'gz' => '<img src="' . $imgPfad . 'icon_zip.gif" height="16" width="16" alt="" />',
'ttf' => '<img src="' . $imgPfad . 'icon_ttf.gif" height="17" width="14" alt="" />',
'avi' => '<img src="' . $imgPfad . 'icon_vlc.png" height="16" width="16" alt="" />',
'divx' => '<img src="' . $imgPfad . 'icon_vlc.png" height="16" width="16" alt="" />',
'doc' => '<img src="' . $imgPfad . 'icon_word.gif" height="16" width="16" alt="" />',
'dot' => '<img src="' . $imgPfad . 'icon_dot.gif" height="16" width="16" alt="" />',
'ppt' => '<img src="' . $imgPfad . 'icon_ppt.png" height="16" width="16" alt="" />',
'pdf' => '<img src="' . $imgPfad . 'icon_pdf.gif" height="16" width="16" alt="" />',
'psd' => '<img src="' . $imgPfad . 'icon_psd.gif" height="16" width="16" alt="" />',
'xls' => '<img src="' . $imgPfad . 'icon_excel.gif" height="16" width="16" alt="" />',
'docx' => '<img src="' . $imgPfad . 'icon_wdocx.gif" height="16" width="16" alt="" />',
'dotx' => '<img src="' . $imgPfad . 'icon_dotx.gif" height="16" width="16" alt="" />',
'pptx' => '<img src="' . $imgPfad . 'icon_ppt.png" height="16" width="16" alt="" />',
'xlsx' => '<img src="' . $imgPfad . 'icon_xlsx.gif" height="16" width="16" alt="" />'
);
$ende = explode('.', $datei);
$doctype = array_pop($ende);
$doctype = strtolower($doctype);
if($endung[$doctype] && $doctype!='js')
{
return $endung[$doctype];
}
else
{
$src = $doctype == 'js' ? $endung['js'] : 'src';
$css = $doctype == 'js' ? '' : ' class="adress src"';
$src = $doctype == 'mp3' ? $endung['mp3'] : 'src';
$css = $doctype == 'mp3' ? '' : ' class="adress src"';
return '<a href="http://' . $srcViewPfad . '/src_viewer.php?datei=' . $absoluterPfad . '/' . $datei . '" ' . $css . ' target="_blank">' . $src . '</a>';
}
}
function css_class($datei)
{
if ($datei == "..")
{
return "title='directory up' class='dirUp'";
}
else
{
return "class='adress dir'";
}
}
function dirUp_icon($datei)
{
global $imgPfad;
if ($datei == "..")
{
return '<img class="up" src="' . $imgPfad . 'level_up.png" alt="directory up" width="16" height="16" border="0" /><span class="pp">..</span>';
}
else
{
return $datei;
}
}
function dir_icon($datei)
{
global $imgPfad, $datum;
if ($datei == "..")
{
return '<img src="' . $imgPfad . 'blind.gif" alt="" width="1" height="1" border="0" />';
$datum = '';
}
else
{
return '<img src="' . $imgPfad . 'folder_s.gif" alt="" width="18" height="17" border="0" />';
//return '<img src="' . $imgPfad . 'icon_folder_small.gif" alt="" width="16" height="15" border="0" />';
}
}
function datum($datei, $filemtime)
{
global $imgPfad;
if ($datei == "..")
{
return '<img src="' . $imgPfad . 'blind.gif" alt="" width="1" height="1" border="0" />';
}
else
{
return date("d. m. Y | H:i", $filemtime);
}
}
?>
</body>
</html>