Added PHP directory listing

This commit is contained in:
Matt Burchett
2013-12-31 11:31:21 -06:00
parent dcff67191b
commit ae5dcca69c
74 changed files with 3604 additions and 0 deletions

View File

@ -0,0 +1,114 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html lang='en' xml:lang='en' xmlns='http://www.w3.org/1999/xhtml'>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title><?php echo _('Directory listing for '), host(), $_SERVER['REQUEST_URI']; ?></title>
<link rel="stylesheet" type="text/css" href="<?php echo templateDirectory();?>/style.css" />
</head>
<body>
<div id="headerwrap">
<div id="header">
<h1><?printBreadcrumb();?></h1>
<form action="<?php echo scriptPath();?>" method="get">
<?php // adds the current directory "&directory=blubb/blabl" to the url ?>
<input type="hidden" name="directory" value="<?php echo currentDirectory();?>" />
<ul>
<?php // simple history-back js-command ?>
<li><a href="javascript:history.back()" onclick="history.back()"><?php imgTagIcon('back', 'Back');?></a></li>
<?php if(currentDirectory() != './'): # If this folder is not the folder where pdirl is?>
<li><a href="<?php echo goParent()?>"><?php imgTagIcon('parent', 'Parent Directory')?></a></li>
<li><a href="<?php echo scriptDirectory(); ?>"><?php imgTagIcon('home', 'Home Directory')?></a></li>
<?php else: ?>
<li><?php imgTagIcon('parent-disabled', 'Parent');?></li>
<li><?php imgTagIcon('home-disabled', 'Home Directory');?></li>
<?php endif; ?>
<li><a href="<?php echo $_SERVER['REQUEST_URI']?>"><?php imgTagIcon('reload', 'Reload');?></a></li>
<li style="color: #0C4F5F">|</li>
<li>
<?php imgTagIcon('search', 'Search...')?>
<input name="gosearch" id="search" type="text" value="<?php echo searchInput()?>" onclick=" if(this.value == '<?php echo _('Search...')?>') { this.value = ''; }" /></li>
</ul>
</form>
<div style="clear:left;"></div>
</div>
</div>
<div id="contentwrap">
<?php if ($elements): ?>
<table>
<thead>
<tr>
<td <?php if ($hideMTime) echo 'colspan="2"'; ?>>
<?php sortLink('name', _('Name'));?></td>
<?php if (!$hideMTime): ?>
<td><?php sortLink('mtime', _('Last modification'))?></td>
<?php endif; ?>
<td><?php sortLink('bytes', _('Size'));?></td>
</tr>
</thead>
<tbody>
<?php foreach($elements as $element): ?>
<tr>
<td class="name"
<?php
if(!$element['readable']){
echo 'colspan="3"';
} elseif ($element['countonly']) {
echo 'colspan="2"';
} ?> title="<?php echo filetypeInfo($element['type']);?>">
<img src="<?php echo iconDirectory();?>/<?php echo $element['type'];?>.png" alt="<?php echo _('Directory');?>" />
<?php if(!$element['readable']) { echo imgTagIcon('locked', 'not accessible');} ?>
<a href="<?php echo $element['urlpath'] ?>" id="<?php echo $element['name'];?>">
<?php echo $element['name'];?>
</a>
<?php if(searchTag() && $element['location']): ?>
<small><a href="<?php echo urlPath($element['locationurl']);?>">
<?php echo $element['location'];?>
</a></small>
<?php endif; ?>
</td>
<?php if($element['readable']): ?>
<?php if($element['countonly']): ?>
<td class="size">
<?php printf(_('%s elements'), $element['numberofelements']); ?>
</td>
<?php else: ?>
<td class="mtime">
<?php echo $element['mtimer'];?>
</td>
<td class="size">
<?php echo $element['sizer']['number'].' '.$element['sizer']['unit'];?>
</td>
<?php endif; ?>
<?php endif; ?>
</tr>
<?php endforeach; ?>
</tbody>
</table>
<?php $totalSize = sizeReadable(totalSize()); ?>
<?php $term = (searchTag())? _('Found %s element(s) totalling %s %s in size.') : _('This directory contains %s element(s) totalling %s %s in size.');?>
<?php else: ?>
<div id="nothing">
<p>
<?php if(searchTag()): ?>
<?php echo _('No search result.');?>
<?php else: ?>
<?php echo _('This directory contains no files.');?>
<?php endif; ?>
- <a href="javascript:history.back()" onclick="history.back()"><?php echo _('Back'); ?></a></p>
</div>
<?php endif; ?>
</div>
<div id="footer">
<?php if($elements): ?>
<p><?php echo sprintf($term, numberOfElements(), $totalSize['number'], $totalSize['unit']);?></p>
<?php endif; ?>
<p><small>powered by <a href="http://pdirl.newroots.de/">pdirl - PHP Directory Listing</a>.</small></p>
</div>
</body>
</html>

View File

@ -0,0 +1,101 @@
@CHARSET "UTF-8";
* {
padding:0px; margin:0px;
}
body {
font-family: Helvetica; font-size: 12px; color: #333; background: #FFF3CF;
}
img {
vertical-align: bottom; padding: 0 3px 0 0; border: 0px none;
}
a {
color: #857661; font-size: inherit; text-decoration: none;
}
a:hover {
color: rgb(60,60,60);
}
h1 {
padding-left: 0; margin-bottom: 10px; font-size: 21px; font-weight: bold; color: #FFF3CF;
}
table {
width: 700px;
}
table td {
font-size: 16px; padding: 5px; vertical-align: middle;
}
table td img.locked {
margin-left: -22px;
}
table td small {
display: block; color: #CFC98E; padding-left: 30px;
}
table tr {
background: #ffffff; width: 70%; color:#857661;
}
table thead tr td {
background: #FFF9DF; font-size: 12px; padding: 0px;
}
table thead tr td a {
font-size: 12px; display: block; padding: 5px;
}
table thead tr td a:hover {
background-color: #F6E49C;
}
table tr:hover {
background-color: #FFF9DF;
}
table td.size, table td.mtime {
white-space: nowrap; width: 12%; font-size: 14px;
}
table td.mtime {
width: 18%;
}
div.total {
background: #f8f8f8; padding: 2px;
}
#headerwrap {
background: #083844; padding: 10px 10px 5px; border-bottom: 5px solid #D6C47C;
}
#header {
width: 700px; margin: 0px auto; color: #FFF3CF;
}
#header a {
font-size:inherit; color: #DFD999;
}
#header a:hover {
color: #CFC98E;
}
#header ul {
list-style-type: none;
}
#header ul li {
float: left; margin-right: 5px; font-size: 15px;
}
#header ul a {
font-size: inherit;
}
#contentwrap {
margin: 20px auto; padding: 0; width: 700px; box-shadow: 0px 0px 10px #999;
}
#nothing {
background: #ffffff; color:#857661; font-size: 16px; padding: 10px;
}
#footer {
margin: 20px auto; width: 700px; color: #857661; font-size:12px; margin-top:10px; padding-left: 10px;
}
#footer small a {
font-size: inherit;
}
#search {
width: 100px; border: 0px none; border-bottom: solid 1px #999; color: #999; padding: 2px; height: 14px; font-size:12px; background: transparent;
}
.asc, .desc {
padding-left:15px; background-repeat: no-repeat;
}
.asc {
background-image: url('../../icons/default/asc.gif'); background-position: 3px 10px;
}
.desc {
background-image: url('../../icons/default/desc.gif'); background-position: 3px 8px;
}