Moved all directory-lister folder to resources and styled page

This commit is contained in:
Chris Kankiewicz
2010-11-27 14:48:39 -07:00
parent 053e7fa45f
commit 7e0f3535d4
26 changed files with 384 additions and 163 deletions

View File

@@ -1,131 +0,0 @@
/**************
* CK-LISTER *
**************/
body {
color: #333;
background: #FFF;
font-family: sans-serif, serif, helvetica;
font-size: 100%;
margin: 0;
padding: 0;
}
#dir-lister {
font-size: .9em;
margin: 20px auto;
width: 760px;
}
/*********
* ROWS *
*********/
#dir-lister #header {
border-bottom: 2px solid #000;
float: left;
font-weight: bold;
padding: 0;
width: 100%;
}
#dir-lister img {
border: none;
float: left;
margin: 3px;
width: 16px;
}
#dir-lister .file-name {
float: left;
font-weight: bold;
margin: 3px;
width: 470px;
}
#dir-lister #header .file-name {
margin: 1px 3px;
width: 492px;
}
#dir-lister .file-size {
float: left;
margin: 3px;
width: 100px;
text-align: right;
}
#dir-lister #header .file-size {
margin: 1px 3px;
}
#dir-lister .file-time {
float: right;
margin: 3px;
text-align: right;
width: 135px;
}
#dir-lister #header .file-time {
margin: 1px 3px;
}
/**********
* LINKS *
**********/
#dir-lister .dark-bg a,#dir-lister .light-bg a {
border-bottom: 1px solid #3269AA;
color: #000;
cursor: pointer;
display: block;
float: left;
margin: 0;
padding: 0;
text-decoration: none;
width: 100%;
}
#dir-lister .dark-bg a {
background-color: #EFEFEF;
}
#dir-lister .light-bg a {
background-color: #DEDEDE;
}
#dir-lister .dark-bg a:hover, #dir-lister .light-bg a:hover {
background-color: #3269AA;
color: #FFF;
}
/***********
* FOOTER *
***********/
#lister-footer {
color: #999;
float: left;
font-size: .8em;
height: 20px;
margin: 0;
padding: 0;
width: 100%;
}
#lister-footer .footer-left {
float: left;
margin: 1px 3px;
width: 78%;
}
#lister-footer .footer-right {
float: right;
margin: 1px 3px;
text-align: right;
width: 20%;
}
#lister-footer a {
color: #999;
}
#lister-footer a:hover {
color: #3269AA;
}

View File

@@ -1,5 +1,49 @@
<?php
include('directory-lister/DirectoryLister.php');
$lister = new DirectoryLister();
$lister->listDirectory();
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Directory listing of &lt;DIRECTORY&gt;</title>
<link rel="shortcut icon" href="resources/images/icons/folder.png" />
<link rel="stylesheet" type="text/css" href="resources/css/rebase.css" />
<link rel="stylesheet" type="text/css" href="resources/css/directorylister.css" />
<link rel="stylesheet" type="text/css" href="resources/css/colorbox.css" />
<body>
<?php include('resources/DirectoryLister.php'); $lister = new DirectoryLister(); ?>
<div id="contentWraper">
<div id="header" class="clearfix">
<span class="fileName">File</span>
<span class="fileSize">Size</span>
<span class="fileModTime">Last Modified</span>
</div>
<ul id="directoryListing">
<?php foreach($lister->listDirectory() as $name => $fileInfo): ?>
<li>
<a href="?dir=<?php echo $fileInfo['file_path']; ?>" class="clearfix">
<span class="fileName"><?php echo $name; ?></span>
<span class="fileSize"><?php echo $fileInfo['file_size']; ?>KB</span>
<span class="fileModTime"><?php echo $fileInfo['mod_time']; ?></span>
</a>
</li>
<?php endforeach; ?>
</ul>
</div>
<div id="footer" class="clearfix">
<div class="path left"><a href="home">Home</a> &raquo; dir &raquo; another_dir</div>
<div id="credit right"></div>
</div>
<hr/>
<pre>
<?php print_r($lister->listDirectory()); ?>
</pre>
</body>
</html>

View File

@@ -6,52 +6,54 @@
class DirectoryLister {
// Set some default variables
protected $_directoryPath = '.';
protected $_hiddenFiles = NULL;
protected $_directory = NULL;
protected $_hiddenFiles = NULL;
/**
* DirectoryLister construct function. Runs on object creation.
*/
function __construct() {
// Add trailing slash if none present
if(substr($this->_directoryPath,-1,1) === '/') {
$this->_directoryPath = substr_replace($this->_directoryPath, '', -1, 1);
// Set the directory to list
if (@$_GET['dir']) {
$this->_directory = $_GET['dir'];
} else {
$this->_directory = '.';
}
// Remove trailing slash if present
if(substr($this->_directory, -1, 1) == '/') {
$this->_directory = substr($this->_directory, 0, -1);
}
// Set class directory constant
if(!defined('__DIR__')) {
$iPos = strrpos(__FILE__, '/');
define('__DIR__', substr(__FILE__, 0, $iPos) . '/');
}
// Get hidden files and add them to
// $this->_hiddenFiles = $this->_readHiddenFiles();
print_r($this->listDirectory());
}
/**
* DirectoryLister destruct function. Runs on object destruction.
*/
function __destruct() {
echo "<br/>" . PHP_EOL . "END OF LINE"; // TODO: Remove me
// NULL
}
/**
* Creates the directory listing and returns the formatted XHTML
* @param string $path Relative path of directory to list
*/
public function listDirectory($path = NULL) {
public function listDirectory($directory = NULL) {
// Set directory path if specified
if ($path === NULL) {
$path = $this->_directoryPath;
// Set directory varriable if left blank
if ($directory === NULL) {
$directory = $this->_directory;
}
return $this->_readDirectory($path);
}
/**
* Loop through directory and return array with pertinent information
*/
protected function _readDirectory($directory, $sort = 'natcase') {
// Instantiate image array
$directoryArray = array();
@@ -61,13 +63,20 @@ class DirectoryLister {
while (false !== ($file = readdir($handle))) {
if ($file != "." && $file != "..") {
// Get files real path
$realPath = realpath($directory . '/' . $file);
// Get files relative and absolute path
$relativePath = $directory . '/' . $file;
if (substr($relativePath, 0, 2) == './') {
$relativePath = substr($relativePath, 2);
}
$realPath = realpath($relativePath);
// Add file info to the array
$directoryArray[pathinfo($realPath, PATHINFO_BASENAME)] = array(
'file_path' => $relativePath,
'file_size' => round(filesize($realPath) / 1024),
'mod_time' => date("Y-m-d H:i:s", filemtime("$realPath"))
'mod_time' => date("Y-m-d H:i:s", filemtime($realPath))
);
}
}
@@ -79,6 +88,14 @@ class DirectoryLister {
// Return the file array
return $directoryArray;
}
/**
* Loop through directory and return array with pertinent information
*/
protected function _readDirectory($directory, $sort = 'natcase') {
}
}

View File

@@ -0,0 +1,50 @@
/*
ColorBox Core Style
The following rules are the styles that are consistant between themes.
Avoid changing this area to maintain compatability with future versions of ColorBox.
*/
#colorbox, #cboxOverlay, #cboxWrapper{position:absolute; top:0; left:0; z-index:9999; overflow:hidden;}
#cboxOverlay{position:fixed; width:100%; height:100%;}
#cboxMiddleLeft, #cboxBottomLeft{clear:left;}
#cboxContent{position:relative; overflow:visible;}
#cboxLoadedContent{overflow:auto;}
#cboxLoadedContent iframe{display:block; width:100%; height:100%; border:0;}
#cboxTitle{margin:0;}
#cboxLoadingOverlay, #cboxLoadingGraphic{position:absolute; top:0; left:0; width:100%;}
#cboxPrevious, #cboxNext, #cboxClose, #cboxSlideshow{cursor:pointer;}
/*
ColorBox example user style
The following rules are ordered and tabbed in a way that represents the
order/nesting of the generated HTML, so that the structure easier to understand.
*/
#cboxOverlay{background:#000;}
#colorbox{}
#cboxTopLeft{width:14px; height:14px; background:url(../images/controls.png) 0 0 no-repeat;}
#cboxTopCenter{height:14px; background:url(../images/border.png) top left repeat-x;}
#cboxTopRight{width:14px; height:14px; background:url(../images/controls.png) -36px 0 no-repeat;}
#cboxBottomLeft{width:14px; height:43px; background:url(../images/controls.png) 0 -32px no-repeat;}
#cboxBottomCenter{height:43px; background:url(../images/border.png) bottom left repeat-x;}
#cboxBottomRight{width:14px; height:43px; background:url(../images/controls.png) -36px -32px no-repeat;}
#cboxMiddleLeft{width:14px; background:url(../images/controls.png) -175px 0 repeat-y;}
#cboxMiddleRight{width:14px; background:url(../images/controls.png) -211px 0 repeat-y;}
#cboxContent{background:#fff;}
#cboxLoadedContent{margin-bottom:5px;}
#cboxLoadingOverlay{background:url(../images/loading_background.png) center center no-repeat;}
#cboxLoadingGraphic{background:url(../images/loading.gif) center center no-repeat;}
#cboxTitle{position:absolute; bottom:-25px; left:0; text-align:center; width:100%; font-size: .9em; color:#7C7C7C;}
#cboxCurrent{position:absolute; bottom:-25px; left:58px; font-weight:bold; color:#7C7C7C; display: none !important;}
#cboxPrevious, #cboxNext, #cboxClose, #cboxSlideshow{position:absolute; bottom:-29px; background:url(../images/controls.png) 0px 0px no-repeat; width:23px; height:23px; text-indent:-9999px;}
#cboxPrevious{left:0px; background-position: -51px -25px;}
#cboxPrevious.hover{background-position:-51px 0px;}
#cboxNext{left:27px; background-position:-75px -25px;}
#cboxNext.hover{background-position:-75px 0px;}
#cboxClose{right:0; background-position:-100px -25px;}
#cboxClose.hover{background-position:-100px 0px;}
.cboxSlideshow_on #cboxSlideshow{background-position:-125px 0px; right:27px;}
.cboxSlideshow_on #cboxSlideshow.hover{background-position:-150px 0px;}
.cboxSlideshow_off #cboxSlideshow{background-position:-150px -25px; right:27px;}
.cboxSlideshow_off #cboxSlideshow.hover{background-position:-125px 0px;}

View File

@@ -0,0 +1,83 @@
/* -------------------------------------------------------------------------- */
/* -----| DIRECTORYLISTER |-------------------------------------------------- */
/* -------------------------------------------------------------------------- */
html {
font-size: 100%;
}
body {
color: #333;
background: #FFF url(../images/bg.png) repeat top left;
font-family: sans-serif, serif, helvetica;
font-size: .8em;
}
#contentWraper {
background-color: #555;
margin: 20px auto 0;
padding: 0 5px 5px;
width: 760px;
}
#header {
color: #FFF;
font-weight: bold;
padding: 3px 0 2px;
}
.fileName {
float: left;
margin: 3px;
overflow: none;
width: 490px;
}
.fileSize {
float: left;
margin: 3px;
text-align: right;
width: 100px;
}
.fileModTime {
float: right;
margin: 3px;
text-align: right;
width: 130px;
}
#directoryListing {
margin: 0;
}
#directoryListing li {
background-color: #FFF;
border-top: 1px solid #555;
display: block;
list-style: none;
}
#directoryListing li a {
background: #FFF url(../images/icons/blank.png) no-repeat 3px center;
color: #333;
display: block;
padding-left: 20px;
text-decoration: none;
}
#directoryListing li a:hover {
background-color: #DC4C00;
color: #FFF;
}
/* -------------------------------------------------------------------------- */
/* -----| FOOTER |----------------------------------------------------------- */
/* -------------------------------------------------------------------------- */
#footer {
font-size: .9em;
margin: 2px auto 20px;
width: 760px;
}

158
resources/css/rebase.css Normal file
View File

@@ -0,0 +1,158 @@
/*****************************************************************************\
*******************| |*******************
*******************| DO NOT ADD TO OR MODIFY THIS FILE |*******************
*******************| I'M SERIOUS, |*******************
*******************| PLEASE GO MEDDLE SOMEPLACE ELSE |*******************
*******************| |*******************
\*****************************************************************************/
/* -------------------------------------------------------------------------- */
/* -----| RESET.CSS (http://developer.yahoo.com/yui/reset/) |---------------- */
/* -------------------------------------------------------------------------- */
body,div,dl,dt,dd,ul,ol,li,h1,h2,h3,h4,h5,h6,pre,
form,fieldset,input,textarea,p,blockquote,th,td {
margin:0;
padding:0;
}
table {
border-collapse:collapse;
border-spacing:0;
}
fieldset,img {
border:0;
}
address,caption,cite,code,dfn,em,strong,th,var {
font-style:normal;
font-weight:normal;
}
ol,ul {
list-style:none;
}
caption,th {
text-align:left;
}
h1,h2,h3,h4,h5,h6 {
font-size:100%;
font-weight:normal;
}
q:before,q:after {
content:'';
}
abbr,acronym { border:0;
}
/* -------------------------------------------------------------------------- */
/* -----| BASE.CSS (http://developer.yahoo.com/yui/base/) |------------------ */
/* -------------------------------------------------------------------------- */
h1 {
/*18px via YUI Fonts CSS foundation*/
font-size:138.5%;
}
h2 {
/*16px via YUI Fonts CSS foundation*/
font-size:123.1%;
}
h3 {
/*14px via YUI Fonts CSS foundation*/
font-size:108%;
}
h1,h2,h3 {
/* top & bottom margin based on font size */
margin:1em 0;
}
h1,h2,h3,h4,h5,h6,strong {
/*bringing boldness back to headers and the strong element*/
font-weight:bold;
}
abbr,acronym {
/*indicating to users that more info is available */
border-bottom:1px dotted #000;
cursor:help;
}
em {
/*bringing italics back to the em element*/
font-style:italic;
}
blockquote,ul,ol,dl {
/*giving blockquotes and lists room to breath*/
margin:1em;
}
ol,ul,dl {
/*bringing lists on to the page with breathing room */
margin-left:2em;
}
ol li {
/*giving OL's LIs generated numbers*/
list-style: decimal outside;
}
ul li {
/*giving UL's LIs generated disc markers*/
list-style: disc outside;
}
dl dd {
/*giving UL's LIs generated numbers*/
margin-left:1em;
}
th,td {
/*borders and padding to make the table readable*/
border:none;
padding:0;
}
th {
/*distinguishing table headers from data cells*/
font-weight:bold;
text-align:center;
}
caption {
/*coordinated marking to match cell's padding*/
margin-bottom:.5em;
/*centered so it doesn't blend in to other content*/
text-align:center;
}
p,fieldset,table {
/*so things don't run into each other*/
margin-bottom:1em;
}
/* -------------------------------------------------------------------------- */
/* -----| GENERAL |---------------------------------------------------------- */
/* -------------------------------------------------------------------------- */
/* NULL */
/* -------------------------------------------------------------------------- */
/* -----| MISCELANEOUS |----------------------------------------------------- */
/* -------------------------------------------------------------------------- */
.hidden {
display: none;
}
.left {
float: left;
width: auto;
}
.right {
float: right;
width: auto;
}
/* --- CLEAR FIX --- */
.clearfix:after {
content: ".";
display:block;
height:0;
clear:both;
visibility:hidden;}
.clearfix {display:inline-block;}
/* Hides from IE-mac \*/
* html .clearfix { height:1%;}
.clearfix {display:block;}
/* End hide from IE-mac */

BIN
resources/images/bg.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 946 B

View File

Before

Width:  |  Height:  |  Size: 467 B

After

Width:  |  Height:  |  Size: 467 B

View File

Before

Width:  |  Height:  |  Size: 766 B

After

Width:  |  Height:  |  Size: 766 B

View File

Before

Width:  |  Height:  |  Size: 595 B

After

Width:  |  Height:  |  Size: 595 B

View File

Before

Width:  |  Height:  |  Size: 294 B

After

Width:  |  Height:  |  Size: 294 B

View File

Before

Width:  |  Height:  |  Size: 673 B

After

Width:  |  Height:  |  Size: 673 B

View File

Before

Width:  |  Height:  |  Size: 603 B

After

Width:  |  Height:  |  Size: 603 B

View File

Before

Width:  |  Height:  |  Size: 663 B

After

Width:  |  Height:  |  Size: 663 B

View File

Before

Width:  |  Height:  |  Size: 679 B

After

Width:  |  Height:  |  Size: 679 B

View File

Before

Width:  |  Height:  |  Size: 582 B

After

Width:  |  Height:  |  Size: 582 B

View File

Before

Width:  |  Height:  |  Size: 537 B

After

Width:  |  Height:  |  Size: 537 B

View File

Before

Width:  |  Height:  |  Size: 516 B

After

Width:  |  Height:  |  Size: 516 B

View File

Before

Width:  |  Height:  |  Size: 641 B

After

Width:  |  Height:  |  Size: 641 B

View File

Before

Width:  |  Height:  |  Size: 385 B

After

Width:  |  Height:  |  Size: 385 B

View File

Before

Width:  |  Height:  |  Size: 591 B

After

Width:  |  Height:  |  Size: 591 B

View File

Before

Width:  |  Height:  |  Size: 507 B

After

Width:  |  Height:  |  Size: 507 B

View File

Before

Width:  |  Height:  |  Size: 342 B

After

Width:  |  Height:  |  Size: 342 B

View File

Before

Width:  |  Height:  |  Size: 653 B

After

Width:  |  Height:  |  Size: 653 B

View File

Before

Width:  |  Height:  |  Size: 651 B

After

Width:  |  Height:  |  Size: 651 B

View File

@@ -1,5 +1,5 @@
; This is the default UberGallery config file.
; Change the following values to customize your gallery.
; This is the default DirectoryLister config file.
; Change the following values to customize DirectoryLister.
[basic_settings]
thumbnail_size = 100