diff --git a/directory-lister/css/style.css b/directory-lister/css/style.css
deleted file mode 100644
index 239d753c0..000000000
--- a/directory-lister/css/style.css
+++ /dev/null
@@ -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;
-}
\ No newline at end of file
diff --git a/index.php b/index.php
index 66f65d805..b1d7cf3f6 100644
--- a/index.php
+++ b/index.php
@@ -1,5 +1,49 @@
-listDirectory();
-?>
+
+
+
+
+ Directory listing of <DIRECTORY>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ listDirectory() as $name => $fileInfo): ?>
+ -
+
+
+ KB
+
+
+
+
+
+
+
+
+
+
+
+
+
+ listDirectory()); ?>
+
+
+
+
diff --git a/directory-lister/DirectoryLister.php b/resources/DirectoryLister.php
similarity index 57%
rename from directory-lister/DirectoryLister.php
rename to resources/DirectoryLister.php
index 09a1def4f..d2c947ccf 100644
--- a/directory-lister/DirectoryLister.php
+++ b/resources/DirectoryLister.php
@@ -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 "
" . 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 @@ protected function _readDirectory($directory, $sort = 'natcase') {
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 @@ protected function _readDirectory($directory, $sort = 'natcase') {
// Return the file array
return $directoryArray;
+
+ }
+
+ /**
+ * Loop through directory and return array with pertinent information
+ */
+ protected function _readDirectory($directory, $sort = 'natcase') {
+
}
}
diff --git a/resources/css/colorbox.css b/resources/css/colorbox.css
new file mode 100644
index 000000000..bf2e0a7ad
--- /dev/null
+++ b/resources/css/colorbox.css
@@ -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;}
\ No newline at end of file
diff --git a/resources/css/directorylister.css b/resources/css/directorylister.css
new file mode 100644
index 000000000..71b235cc1
--- /dev/null
+++ b/resources/css/directorylister.css
@@ -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;
+}
\ No newline at end of file
diff --git a/resources/css/rebase.css b/resources/css/rebase.css
new file mode 100644
index 000000000..45679b100
--- /dev/null
+++ b/resources/css/rebase.css
@@ -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 */
\ No newline at end of file
diff --git a/resources/images/bg.png b/resources/images/bg.png
new file mode 100644
index 000000000..ba84bc606
Binary files /dev/null and b/resources/images/bg.png differ
diff --git a/directory-lister/icons/app.png b/resources/images/icons/app.png
similarity index 100%
rename from directory-lister/icons/app.png
rename to resources/images/icons/app.png
diff --git a/directory-lister/icons/archive.png b/resources/images/icons/archive.png
similarity index 100%
rename from directory-lister/icons/archive.png
rename to resources/images/icons/archive.png
diff --git a/directory-lister/icons/back.png b/resources/images/icons/back.png
similarity index 100%
rename from directory-lister/icons/back.png
rename to resources/images/icons/back.png
diff --git a/directory-lister/icons/blank.png b/resources/images/icons/blank.png
similarity index 100%
rename from directory-lister/icons/blank.png
rename to resources/images/icons/blank.png
diff --git a/directory-lister/icons/cd.png b/resources/images/icons/cd.png
similarity index 100%
rename from directory-lister/icons/cd.png
rename to resources/images/icons/cd.png
diff --git a/directory-lister/icons/code.png b/resources/images/icons/code.png
similarity index 100%
rename from directory-lister/icons/code.png
rename to resources/images/icons/code.png
diff --git a/directory-lister/icons/excel.png b/resources/images/icons/excel.png
similarity index 100%
rename from directory-lister/icons/excel.png
rename to resources/images/icons/excel.png
diff --git a/directory-lister/icons/favicon.png b/resources/images/icons/favicon.png
similarity index 100%
rename from directory-lister/icons/favicon.png
rename to resources/images/icons/favicon.png
diff --git a/directory-lister/icons/flash.png b/resources/images/icons/flash.png
similarity index 100%
rename from directory-lister/icons/flash.png
rename to resources/images/icons/flash.png
diff --git a/directory-lister/icons/folder.png b/resources/images/icons/folder.png
similarity index 100%
rename from directory-lister/icons/folder.png
rename to resources/images/icons/folder.png
diff --git a/directory-lister/icons/image.png b/resources/images/icons/image.png
similarity index 100%
rename from directory-lister/icons/image.png
rename to resources/images/icons/image.png
diff --git a/directory-lister/icons/message.png b/resources/images/icons/message.png
similarity index 100%
rename from directory-lister/icons/message.png
rename to resources/images/icons/message.png
diff --git a/directory-lister/icons/music.png b/resources/images/icons/music.png
similarity index 100%
rename from directory-lister/icons/music.png
rename to resources/images/icons/music.png
diff --git a/directory-lister/icons/pdf.png b/resources/images/icons/pdf.png
similarity index 100%
rename from directory-lister/icons/pdf.png
rename to resources/images/icons/pdf.png
diff --git a/directory-lister/icons/terminal.png b/resources/images/icons/terminal.png
similarity index 100%
rename from directory-lister/icons/terminal.png
rename to resources/images/icons/terminal.png
diff --git a/directory-lister/icons/text.png b/resources/images/icons/text.png
similarity index 100%
rename from directory-lister/icons/text.png
rename to resources/images/icons/text.png
diff --git a/directory-lister/icons/video.png b/resources/images/icons/video.png
similarity index 100%
rename from directory-lister/icons/video.png
rename to resources/images/icons/video.png
diff --git a/directory-lister/icons/word.png b/resources/images/icons/word.png
similarity index 100%
rename from directory-lister/icons/word.png
rename to resources/images/icons/word.png
diff --git a/directory-lister/hiddenFiles.ini b/resources/settings.ini
similarity index 57%
rename from directory-lister/hiddenFiles.ini
rename to resources/settings.ini
index 7b5662de9..31dfb4cfc 100644
--- a/directory-lister/hiddenFiles.ini
+++ b/resources/settings.ini
@@ -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