Inital commit
This commit is contained in:
+574
@@ -0,0 +1,574 @@
|
||||
<?php
|
||||
/*
|
||||
* Lister - a directory listing, upload and download script - version 1.89
|
||||
* http://www.tilman.de/programme/lister/
|
||||
* Created: 2006-04-03
|
||||
* Last Change: 2008-06-17
|
||||
* Author: Tilman Walther
|
||||
* This work is licensed under the Creative Commons Attribution-ShareAlike 2.0 Germany License.
|
||||
* To view a copy of this license, visit http://creativecommons.org/licenses/by-sa/2.0/de/
|
||||
* or send a letter to Creative Commons, 543 Howard Street, 5th Floor, San Francisco, California, 94105, USA.
|
||||
*
|
||||
* The software is made available free of charge, no express or implied warranties are made.
|
||||
* USE AT YOUR OWN RISK.
|
||||
*/
|
||||
|
||||
//-- Setup ------------------------------------------------------------------------------------------------
|
||||
|
||||
/*
|
||||
* If true, all file names are converted via urlencode when uploading and converted back when using one
|
||||
* of the download buttons.
|
||||
* Advantage: No file system problems with special characters in file names
|
||||
* Disadvantage: If files with special character names are manually copied into the directory, Lister
|
||||
* can't link them. Thus, if set to 'true' Lister should be the only way used to copy files into the
|
||||
* directory.
|
||||
*
|
||||
* Default: true
|
||||
*/
|
||||
define('SAVE_NAMES_URLENCODED', true);
|
||||
|
||||
/*
|
||||
* Defines what file permissions are to be set after uploading a file.
|
||||
*
|
||||
* Default: 644
|
||||
*/
|
||||
define('PERMISSIONS_FOR_UPLOADED_FILES', 0644);
|
||||
|
||||
/*
|
||||
* Defines whether files with unknown extensions are shown in the browser (Content-Type: text/html) or just
|
||||
* being downloaded.
|
||||
*
|
||||
* Default: false
|
||||
*/
|
||||
define('SHOW_UNKNOWN_FILETYPES_IN_BROWSER', false);
|
||||
|
||||
|
||||
// TODO - NOT YET IMPLEMENTED - Zugriff auf Unterverzeichnisse
|
||||
//define('ACCESS_SUBDIRECTORIES', false);
|
||||
|
||||
// TODO - NOT YET IMPLEMENTED - Beschreibungen in Textdatei speichern
|
||||
//define('FILE_DESCRIPTIONS', false);
|
||||
|
||||
//-----------------------------------------------------------------------------------------------------------
|
||||
|
||||
define('PROGRAM_NAME', 'Lister v1.89');
|
||||
define('SCRIPTNAME', basename($_SERVER['PHP_SELF']));
|
||||
|
||||
/*
|
||||
* Try to read the password for uploads and deletion from file "password.txt".
|
||||
* If empty, no password is needed for upload and deletion.
|
||||
*/
|
||||
if (file_exists('password.txt')) {
|
||||
$pwfile = fopen('password.txt', 'r');
|
||||
define('PASSWORD', rtrim(fgets($pwfile)));
|
||||
fclose($pwfile);
|
||||
}
|
||||
else {
|
||||
define('PASSWORD', '');
|
||||
}
|
||||
|
||||
if (substr($_SERVER['HTTP_ACCEPT_LANGUAGE'], 0, 2) == 'de') {
|
||||
define('LANGUAGE', 'de');
|
||||
}
|
||||
else {
|
||||
define('LANGUAGE', 'en');
|
||||
}
|
||||
|
||||
if (LANGUAGE == 'de') {
|
||||
define('FILE_LABEL', 'Datei');
|
||||
define('FILES_LABEL', 'Dateien');
|
||||
define('SIZE_LABEL', 'Größe');
|
||||
define('SELECTION_LABEL', 'Auswahl');
|
||||
define('DELETE_LABEL', 'Markierte löschen');
|
||||
define('DOWNLOAD_LABEL', '[download]');
|
||||
define('PASSWORD_LABEL', 'Passwort');
|
||||
define('OVERWRITE_LABEL', 'vorhandene Datei überschreiben');
|
||||
define('UPLOAD_LABEL', 'Datei hochladen');
|
||||
define('BACK_LABEL', 'zurück');
|
||||
|
||||
define('DELETION_MESSAGE', ' gelöscht');
|
||||
|
||||
define('PASSWORD_ERROR', 'Fehler: Falsches Passwort');
|
||||
define('OVERWRITE_ERROR', 'Fehler: Datei bereits vorhanden');
|
||||
define('NO_FILE_ERROR', 'Fehler: Datei konnte nicht gefunden werden');
|
||||
define('NO_SELECTION_ERROR', 'Fehler: Keine Datei ausgewählt');
|
||||
define('DELETION_ERROR', 'Fehler beim Löschen von Datei');
|
||||
|
||||
define('FILESIZE_ERROR', 'Fehler: Datei zu groß');
|
||||
define('PARTIAL_ERROR', 'Fehler: Datei wurde unvollständig übertragen');
|
||||
define('NO_UPLOAD_FILE_ERROR', 'Fehler: Keine Datei angegeben');
|
||||
define('TMP_DIR_ERROR', 'Fehler: Kann temporäres Verzeichnis nicht finden');
|
||||
define('WRITE_ERROR', 'Fehler: Kann die Datei nicht speichern');
|
||||
define('MOVE_ERROR', 'Fehler: Hochgeladene Datei konnte nicht verschoben werden');
|
||||
|
||||
define('UNKNOWN_ERROR', 'Ein unbekannter Fehler ist aufgetreten');
|
||||
|
||||
}
|
||||
else {
|
||||
define('FILE_LABEL', 'File');
|
||||
define('FILES_LABEL', 'Files');
|
||||
define('SIZE_LABEL', 'Size');
|
||||
define('SELECTION_LABEL', 'Selection');
|
||||
define('DELETE_LABEL', 'Delete selected');
|
||||
define('DOWNLOAD_LABEL', '[download]');
|
||||
define('PASSWORD_LABEL', 'Password');
|
||||
define('OVERWRITE_LABEL', 'overwrite existing file');
|
||||
define('UPLOAD_LABEL', 'Upload file');
|
||||
define('BACK_LABEL', 'back');
|
||||
|
||||
define('DELETION_MESSAGE', ' deleted');
|
||||
|
||||
define('PASSWORD_ERROR', 'Error: Wrong password');
|
||||
define('OVERWRITE_ERROR', 'Error: File already exists');
|
||||
define('NO_FILE_ERROR', 'Error: No such file');
|
||||
define('NO_SELECTION_ERROR', 'Error: No file selected');
|
||||
define('DELETION_ERROR', 'Error on deleting file');
|
||||
|
||||
define('FILESIZE_ERROR', 'Error: File too big');
|
||||
define('PARTIAL_ERROR', 'Error: File was only partially uploaded');
|
||||
define('NO_UPLOAD_FILE_ERROR', 'Error: No upload file specified');
|
||||
define('TMP_DIR_ERROR', 'Error: Missing temp directory');
|
||||
define('WRITE_ERROR', 'Error: Could not write to disk');
|
||||
define('MOVE_ERROR', 'Error: Uploaded file could not be moved from temp directory');
|
||||
|
||||
define('UNKNOWN_ERROR', 'An unknown error occured');
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* Returns the size of a file (given in byte) as a String with kB/MB unit
|
||||
*/
|
||||
function getSizeAsString($size) {
|
||||
if ($size < 2) {
|
||||
return $size." Byte";
|
||||
}
|
||||
else if ($size < 1024) {
|
||||
return $size." Bytes";
|
||||
}
|
||||
else if ($size < 1048576) {
|
||||
return round(($size/1024), 0)." kB";
|
||||
}
|
||||
else {
|
||||
return round(($size/1048576), 1)." MB";
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Returns true if the filename is reserved, false otherwise
|
||||
*/
|
||||
function isReserved($name) {
|
||||
if ($name == SCRIPTNAME) return true;
|
||||
if ($name == '.htaccess') return true;
|
||||
if ($name == 'password.txt') return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
/*
|
||||
* Shows a given message within a HTML-Wrapper
|
||||
*/
|
||||
function showMessage($message) {
|
||||
?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<title><?php echo PROGRAM_NAME; ?></title>
|
||||
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1" />
|
||||
</head>
|
||||
<body style="background-color:#FFFFFF; font-family: 'Trebuchet MS', Georgia, serif;">
|
||||
<div style="text-align: center; margin: 1em;">
|
||||
<?php echo $message; ?><br />
|
||||
<a href="<?php echo SCRIPTNAME; ?>" style="font-size: small; color:#0000CC;"><?php echo BACK_LABEL; ?></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
<?php
|
||||
exit;
|
||||
}
|
||||
|
||||
if ($_GET['action'] == 'upload') {
|
||||
|
||||
// check for submitted file
|
||||
if ($_FILES['uploadfile']['error'] != UPLOAD_ERR_OK) {
|
||||
if (($_FILES['uploadfile']['error'] == UPLOAD_ERR_INI_SIZE) || ($_FILES['uploadfile']['error'] == UPLOAD_ERR_FORM_SIZE)) {
|
||||
showMessage(FILESIZE_ERROR);
|
||||
}
|
||||
else if ($_FILES['uploadfile']['error'] == UPLOAD_ERR_PARTIAL) {
|
||||
showMessage(PARTIAL_ERROR);
|
||||
}
|
||||
else if ($_FILES['uploadfile']['error'] == UPLOAD_ERR_NO_FILE) {
|
||||
showMessage(NO_UPLOAD_FILE_ERROR);
|
||||
}
|
||||
else if ($_FILES['uploadfile']['error'] == UPLOAD_ERR_NO_TMP_DIR) {
|
||||
showMessage(TMP_DIR_ERROR);
|
||||
}
|
||||
else if ($_FILES['uploadfile']['error'] == UPLOAD_ERR_CANT_WRITE) {
|
||||
showMessage(WRITE_ERROR);
|
||||
}
|
||||
showMessage(UNKNOWN_ERROR.': '.$_FILES['uploadfile']['error']);
|
||||
}
|
||||
// check password
|
||||
else if (PASSWORD == '' || $_POST['password'] == PASSWORD) {
|
||||
|
||||
// check for existing file
|
||||
if (SAVE_NAMES_URLENCODED)
|
||||
$physicalFileName = urlencode($_FILES['uploadfile']['name']);
|
||||
else
|
||||
$physicalFileName = $_FILES['uploadfile']['name'];
|
||||
|
||||
$already_exists = file_exists($physicalFileName);
|
||||
|
||||
// if file exists and overwrite option is off, show error message
|
||||
// plus security check - reserved files are not allowed to be overwritten
|
||||
if (($already_exists & ($_POST['overwrite'] != 'on')) || isReserved($physicalFileName)) {
|
||||
showMessage(OVERWRITE_ERROR);
|
||||
}
|
||||
// copy file from temporary location
|
||||
else {
|
||||
$filename = $_FILES['uploadfile']['name'];
|
||||
|
||||
if (SAVE_NAMES_URLENCODED) {
|
||||
$upload_ok = move_uploaded_file($_FILES['uploadfile']['tmp_name'], urlencode($filename));
|
||||
|
||||
// change file permissions
|
||||
chmod(urlencode($filename), PERMISSIONS_FOR_UPLOADED_FILES);
|
||||
}
|
||||
else {
|
||||
$upload_ok = move_uploaded_file($_FILES['uploadfile']['tmp_name'], $filename);
|
||||
|
||||
// change file permissions
|
||||
chmod(urlencode($filename), PERMISSIONS_FOR_UPLOADED_FILES);
|
||||
}
|
||||
|
||||
// if upload successful, reload page
|
||||
if ($upload_ok) {
|
||||
header('Location: http://'.$_SERVER['HTTP_HOST'].rtrim(dirname($_SERVER['PHP_SELF']), '/\\').'/'.SCRIPTNAME);
|
||||
}
|
||||
// show error message
|
||||
else {
|
||||
showMessage(MOVE_ERROR);
|
||||
}
|
||||
}
|
||||
}
|
||||
// wrong password: show error message
|
||||
else {
|
||||
showMessage(PASSWORD_ERROR);
|
||||
}
|
||||
exit;
|
||||
}
|
||||
else if ($_GET['action'] == 'delete') {
|
||||
|
||||
// check password
|
||||
if (PASSWORD == '' || $_POST['password'] == PASSWORD) {
|
||||
if (isset($_REQUEST['del'])) {
|
||||
$message = '';
|
||||
foreach ($_REQUEST['del'] as $idx => $filename) {
|
||||
if (SAVE_NAMES_URLENCODED)
|
||||
$physicalFileName = urlencode($filename);
|
||||
else
|
||||
$physicalFileName = $filename;
|
||||
|
||||
// security check - the file has to be in the same directory
|
||||
$physicalFileName = basename($physicalFileName);
|
||||
|
||||
// security check - reserved files can not be deleted
|
||||
if (!isReserved($physicalFileName)) {
|
||||
if (unlink($physicalFileName))
|
||||
$message = $message.$filename.DELETION_MESSAGE."<br />\n";
|
||||
else
|
||||
$message = $message.DELETION_ERROR.' <em>'.$filename."</em><br />\n";
|
||||
}
|
||||
else {
|
||||
$message = $message.DELETION_ERROR.' <em>'.$filename."</em><br />\n";
|
||||
}
|
||||
}
|
||||
showMessage($message);
|
||||
}
|
||||
else {
|
||||
showMessage(NO_SELECTION_ERROR);
|
||||
}
|
||||
}
|
||||
// wrong password: show error message
|
||||
else {
|
||||
showMessage(PASSWORD_ERROR);
|
||||
}
|
||||
exit;
|
||||
}
|
||||
else if (($_GET['action'] == 'show') || ($_GET['action'] == 'download')) {
|
||||
if (SAVE_NAMES_URLENCODED)
|
||||
$physicalFileName = urlencode($_GET['file']);
|
||||
else
|
||||
$physicalFileName = $_GET['file'];
|
||||
|
||||
// security check - the file has to be in the same directory
|
||||
$physicalFileName = basename($physicalFileName);
|
||||
|
||||
// security check
|
||||
if (file_exists($physicalFileName) & (!isReserved($physicalFileName))) {
|
||||
|
||||
// the MIME type
|
||||
$contentType = '';
|
||||
|
||||
// if ($_GET['action'] == 'show') try to set MIME type for content delivery from file name extension
|
||||
if ($_GET['action'] == 'show') {
|
||||
|
||||
$extension = strtolower(substr($physicalFileName, strrpos($physicalFileName, '.')));
|
||||
|
||||
if (($extension == '.aif') || ($extension == '.aiff')) $contentType = 'Content-Type: audio/x-aiff';
|
||||
else if (($extension == '.asc') || ($extension == '.txt')) $contentType = 'Content-Type: text/plain';
|
||||
else if (($extension == '.asf') || ($extension == '.asx')) $contentType = 'Content-Type: video/x-ms-asf';
|
||||
else if ($extension == '.avi') $contentType = 'Content-Type: video/x-msvideo';
|
||||
else if ($extension == '.bmp') $contentType = 'Content-Type: image/bmp';
|
||||
else if ($extension == '.css') $contentType = 'Content-Type: text/css';
|
||||
else if ($extension == '.doc') $contentType = 'Content-Type: application/msword';
|
||||
else if ($extension == '.gif') $contentType = 'Content-Type: image/gif';
|
||||
else if (($extension == '.htm') || ($extension == '.html')) $contentType = 'Content-Type: text/html';
|
||||
else if ($extension == '.ico') $contentType = 'Content-Type: image/x-icon';
|
||||
else if (($extension == '.jpeg') || ($extension == '.jpg')) $contentType = 'Content-Type: image/jpeg';
|
||||
else if ($extension == '.m3u') $contentType = 'Content-Type: audio/x-mpegurl';
|
||||
else if (($extension == '.mid') || ($extension == '.midi')) $contentType = 'Content-Type: audio/midi';
|
||||
else if (($extension == '.mp2') || ($extension == '.mp3')) $contentType = 'Content-Type: audio/mpeg';
|
||||
else if (($extension == '.mpeg') || ($extension == '.mpg')) $contentType = 'Content-Type: video/mpeg';
|
||||
else if (($extension == '.ogg') || ($extension == '.ogm')) $contentType = 'Content-Type: application/ogg';
|
||||
else if ($extension == '.pdf') $contentType = 'Content-Type: application/pdf';
|
||||
else if ($extension == '.png') $contentType = 'Content-Type: image/png';
|
||||
else if ($extension == '.ppt') $contentType = 'Content-Type: application/vnd.ms-powerpoint';
|
||||
else if (($extension == '.ps') || ($extension == '.eps')) $contentType = 'Content-Type: application/postscript';
|
||||
else if (($extension == '.qt') || ($extension == '.mov')) $contentType = 'Content-Type: video/quicktime';
|
||||
else if (($extension == '.ram') || ($extension == '.rm')) $contentType = 'Content-Type: audio/x-pn-realaudio';
|
||||
else if ($extension == '.rtf') $contentType = 'Content-Type: text/rtf';
|
||||
else if ($extension == '.svg') $contentType = 'Content-Type: image/svg+xml';
|
||||
else if ($extension == '.swf') $contentType = 'Content-Type: application/x-shockwave-flash';
|
||||
else if ($extension == '.tar') $contentType = 'Content-Type: application/x-tar';
|
||||
else if (($extension == '.tif') || ($extension == '.tiff')) $contentType = 'Content-Type: image/tiff';
|
||||
else if ($extension == '.vrml') $contentType = 'Content-Type: model/vrml';
|
||||
else if ($extension == '.wav') $contentType = 'Content-Type: audio/x-wav';
|
||||
else if ($extension == '.wma') $contentType = 'Content-Type: audio/x-ms-wma';
|
||||
else if ($extension == '.wmv') $contentType = 'Content-Type: audio/x-ms-wmv';
|
||||
else if ($extension == '.wvx') $contentType = 'Content-Type: audio/x-ms-wvx';
|
||||
else if ($extension == '.xhtml') $contentType = 'Content-Type: application/xhtml+xml';
|
||||
else if ($extension == '.xls') $contentType = 'Content-Type: application/x-msexcel';
|
||||
else if ($extension == '.xml') $contentType = 'Content-Type: application/xml';
|
||||
else if ($extension == '.zip') $contentType = 'Content-Type: application/zip';
|
||||
}
|
||||
|
||||
// if no valid Content-Type is available and SHOW_UNKNOWN_FILETYPES_IN_BROWSER set true
|
||||
// send the file with Content-Type
|
||||
if (($contentType == '') && (SHOW_UNKNOWN_FILETYPES_IN_BROWSER)) {
|
||||
$contentType = 'text/html';
|
||||
}
|
||||
|
||||
// if
|
||||
// ($_GET['action'] == 'show') and valid Content-Type available
|
||||
// or
|
||||
// SHOW_UNKNOWN_FILETYPES_IN_BROWSER == true
|
||||
// send file to be shown in browser
|
||||
if (($_GET['action'] == 'show') && ($contentType != '')) {
|
||||
// send file to the browser
|
||||
header($contentType);
|
||||
header('Content-Length: '.(string)filesize($physicalFileName));
|
||||
readfile($physicalFileName);
|
||||
}
|
||||
else {
|
||||
// if
|
||||
// ($_GET['action'] == 'download')
|
||||
// or
|
||||
// file extension unknown and SHOW_UNKNOWN_FILETYPES_IN_BROWSER == false
|
||||
// send file for download
|
||||
|
||||
header('Content-Type: application/octet-stream');
|
||||
//header('Content-type: application/force-download');
|
||||
|
||||
header('Content-Disposition: attachment; filename="'.$_GET['file'].'"');
|
||||
header('Content-Length: '.(string)filesize($physicalFileName));
|
||||
header('Cache-Control: no-store, no-cache, must-revalidate');
|
||||
header('Pragma: no-cache');
|
||||
header('Expires: 0');
|
||||
readfile($physicalFileName);
|
||||
}
|
||||
}
|
||||
else {
|
||||
showMessage(NO_FILE_ERROR);
|
||||
}
|
||||
exit;
|
||||
}
|
||||
else if ($_GET['action'] == 'info') {
|
||||
// TODO HIER GEHT'S WEITER - Umgebungsvariablen anzeigen
|
||||
showMessage();
|
||||
}
|
||||
else if ($_GET['action'] == 'icon') {
|
||||
header('Content-type: image/gif');
|
||||
echo pack('H*',
|
||||
'47494638396110001000F7000033333310346F0C3D7E153974143B7A153F7B0D417620507C4242454343474B4B4E4C4C5151'.
|
||||
'51515050565555555656575B5B5B55694D6161616666666A6A6A6B6B6B617566687D656D6D736F6F7471717174747477777C'.
|
||||
'7878787A7A7A7B7B7C7C7C7C7F7F7F57BD31778C7F10498317508A13548C13558F2D51833050832A658324659D2977AB506B'.
|
||||
'9675758476768A39879F3389BB318CBD7F93B23D90C33D94C6349DCA42A1D045ADDA50BDE85AC8F380808081818182828286'.
|
||||
'868684848E88888888888D8A8A8F8C8C8C8E8E8E80809392929298989899999A9C9C9C9E9E9E9F9F9F8799B79898B7A3A3A3'.
|
||||
'A4A4A4A5A5A5A7A7A7AEAEAEB5B5B5B9B9B9BABABABFBFBF9FAEC5BEC8D8C0C0C0C3C3C3C4C4C4C7C7C7C9C9C9CACACACECE'.
|
||||
'CECCCCDED0D0D0D1D1D1D3D3D3D8D8D8DADADADBDBDBDDDDDDDCDDDEDEDEDEDFDFDFCFD6E2E0E0E0E1E1E1E2E2E2E4E4E4E5'.
|
||||
'E5E5E6E6E6E9E9E9EAEAEAEAEAEEECECECEFEFEFF0F0F0F2F2F2F4F4F4F5F5F5F6F6F6F7F7F7F8F8F8F9F9F9FAFAFAFCFCFC'.
|
||||
'FDFDFDFEFEFEFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF'.
|
||||
'FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF'.
|
||||
'FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF'.
|
||||
'FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF'.
|
||||
'FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF'.
|
||||
'FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF'.
|
||||
'FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF'.
|
||||
'FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF2C00000000100010000008E2000709C4326000'.
|
||||
'168108130E0C404040812B6A14225C1360069A16274C3039237110453967D4A4B041624DC739730496992123C68C101D059E'.
|
||||
'384102C78D1233636681C122878E152A602ACC72A70D99033568A848034849C4416ED854E95061CB1E0328E4F4F19225CC9F'.
|
||||
'4154C6A4E1D2464D9E4078E0F0A103464890384B924C211B270C19315A9070B830C2050828528EF47842450C11AA3C246010'.
|
||||
'F180C21D2040BA3809D1E30382222E305888C0C0C3203B56766C1802250380262F1438D010C58C403F75BE1899F023410306'.
|
||||
'40ACBCD123E8751D40C0272C80E003F86E4100003B');
|
||||
}
|
||||
else {
|
||||
?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<title><?php echo PROGRAM_NAME; ?></title>
|
||||
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1" />
|
||||
<meta http-equiv="expires" content="0" />
|
||||
|
||||
<style type="text/css">
|
||||
<!--
|
||||
body { background-color:#FFFFFF; font-family: "Trebuchet MS", Georgia, serif; }
|
||||
a { color:#0000CC; }
|
||||
table { text-align: left; border-collapse: collapse; border: 1px solid black; }
|
||||
th { background-color:#CCCCCC; padding: 5px; border: 1px solid black; font-size: 80%; }
|
||||
td { background-color:#FFFFFF; padding: 5px; border: 1px solid black; }
|
||||
|
||||
.download { font-size: 60%; color:#0000CC; text-decoration: none; font-weight: bold; }
|
||||
.small { font-size: small; }
|
||||
.menu { font-size: 80%; }
|
||||
-->
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div style="margin: 2em;">
|
||||
<form action="<?php echo SCRIPTNAME; ?>?action=delete" method="post">
|
||||
<table style="margin-left:auto; margin-right:auto;">
|
||||
<tr>
|
||||
<th><a href="<?php echo $_SERVER['PHP_SELF']; ?>?action=<?php if (($_GET['action'] == 'ascByName') || ($_GET['action'] == '')) echo "descByName"; else echo 'ascByName'; ?>"><?php echo FILE_LABEL; ?></a></th>
|
||||
<th><a href="<?php echo $_SERVER['PHP_SELF']; ?>?action=<?php if ($_GET['action'] == 'ascBySize') echo "descBySize"; else echo 'ascBySize'; ?>"><?php echo SIZE_LABEL; ?></a></th>
|
||||
<th><?php echo SELECTION_LABEL; ?></th>
|
||||
</tr>
|
||||
<?php
|
||||
// read directory
|
||||
$filenames = scandir('.'); // TODO optional PHP-4-kompatibel mit glob() oder wie im Handbuch unter scandir() vorgeschlagen
|
||||
$filelist = array();
|
||||
if (SAVE_NAMES_URLENCODED) {
|
||||
foreach ($filenames as $filename) {
|
||||
if (!isReserved($filename)) array_push($filelist, array(urldecode($filename), filesize($filename)));
|
||||
}
|
||||
}
|
||||
else {
|
||||
foreach ($filenames as $filename) {
|
||||
if (!isReserved($filename)) array_push($filelist, array($filename, filesize($filename)));
|
||||
}
|
||||
}
|
||||
|
||||
// sort file list
|
||||
if ($_GET['action'] == 'descBySize') {
|
||||
foreach($filelist as $v) $s[] = $v[1];
|
||||
array_multisort($s, SORT_DESC, $filelist);
|
||||
}
|
||||
else if ($_GET['action'] == 'ascBySize') {
|
||||
foreach($filelist as $v) $s[] = $v[1];
|
||||
array_multisort($s, SORT_ASC, $filelist);
|
||||
}
|
||||
else if ($_GET['action'] == 'descByName') {
|
||||
array_multisort($filelist, SORT_DESC);
|
||||
}
|
||||
else {
|
||||
array_multisort($filelist, SORT_ASC);
|
||||
}
|
||||
|
||||
// TODO if ACCESS_DIRECTORIES:
|
||||
// show "cd .."
|
||||
// show directories
|
||||
|
||||
// show file list
|
||||
$filecount = 0;
|
||||
$totalFilesize = 0;
|
||||
foreach ($filelist as $file) {
|
||||
if (!is_dir($file[0])) {
|
||||
$filecount++;
|
||||
$totalFilesize += $file[1];
|
||||
?>
|
||||
<tr>
|
||||
<td><a href="<?php echo SCRIPTNAME; ?>?action=show&file=<?php echo urlencode($file[0]); ?>"><?php echo htmlentities($file[0]); ?></a> <a class="download" href="<?php echo SCRIPTNAME; ?>?action=download&file=<?php echo urlencode($file[0]); ?>"><img style="border: none;" src="<?php echo SCRIPTNAME; ?>?action=icon" alt="<?php echo DOWNLOAD_LABEL; ?>" /></a></td>
|
||||
<td style="text-align: right;"><?php echo getSizeAsString($file[1]); ?></td>
|
||||
<td style="text-align: center;"><input type="checkbox" name="del[]" value="<?php echo htmlentities($file[0]); ?>" /></td>
|
||||
</tr>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
|
||||
if ($filecount > 0) {
|
||||
?>
|
||||
<tr>
|
||||
<td class="menu" style="text-align: right;" colspan="3">
|
||||
<?php
|
||||
if (PASSWORD != '') {
|
||||
?>
|
||||
<?PHP echo PASSWORD_LABEL; ?> <input name="password" type="password" size="10" class="menu" />
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
<input type="submit" value="<?php echo DELETE_LABEL; ?>" class="menu" />
|
||||
</td>
|
||||
</tr>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
<tr>
|
||||
<td class="small" style="text-align: center;" colspan="3">
|
||||
<?php
|
||||
echo $filecount;
|
||||
|
||||
if ($filecount == 1)
|
||||
echo ' '.FILE_LABEL.', ';
|
||||
else
|
||||
echo ' '.FILES_LABEL.', ';
|
||||
|
||||
echo getSizeAsString($totalFilesize)."<br />\n";
|
||||
echo '<a style="font-size: 80%" href="http://www.tilman.de/programme/lister/';
|
||||
if (LANGUAGE == 'en') echo 'index.en.php';
|
||||
echo '">'.PROGRAM_NAME.'</a>';
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<div style="margin: 2em;">
|
||||
<form action="<?php echo SCRIPTNAME; ?>?action=upload" method="post" enctype="multipart/form-data">
|
||||
<table style="margin-left:auto; margin-right:auto;">
|
||||
<tr>
|
||||
<td class="menu" style="border: none;"><?PHP echo FILE_LABEL; ?></td>
|
||||
<td class="menu" style="border: none;"><input name="uploadfile" type="file" class="menu" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="menu" style="border: none;"></td>
|
||||
<td class="menu" style="border: none;"><input name="overwrite" type="checkbox" /><span class="small"><?PHP echo OVERWRITE_LABEL; ?></span></td>
|
||||
</tr>
|
||||
<?php
|
||||
if (PASSWORD != '') {
|
||||
?>
|
||||
<tr>
|
||||
<td class="menu" style="border: none;"><?PHP echo PASSWORD_LABEL; ?></td>
|
||||
<td style="border: none;"><input name="password" type="password" size="10" class="menu" /></td>
|
||||
</tr>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
<tr>
|
||||
<td class="menu" style="border: none; text-align: center;" colspan="2"><input type="submit" value="<?PHP echo UPLOAD_LABEL; ?>" class="menu" /></td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
Reference in New Issue
Block a user