diff --git a/config.php b/config.php index 48dde7d..f211e9d 100644 --- a/config.php +++ b/config.php @@ -29,7 +29,7 @@ $config = array( // dList internal path settings - 'path_plugins' => array('plugins/*'), + 'path_plugins' => array('plugins'), 'path_cache' => 'cache', diff --git a/exec/icons.exc.php b/exec/icons.exc.php index 03b6814..674f99f 100644 --- a/exec/icons.exc.php +++ b/exec/icons.exc.php @@ -15,6 +15,52 @@ Author: Jim Myhrberg */ //_SCRIPT; +//========================== +//>STAGE> functions +//========================== + +//>Section> class.start +class Icon { + +//>Section> get_url + function get_url ($ext, $size, $type) { + global $config; + if ( $size == 'large' || $size == 'big' ) { + $size = $config->icons_large; + } else { + $size = $config->icons_small; + } + $icons_path = ICONS_PATH.$size.'/'; + $icons_url = ICONS_URL.$size.'/'; + if ( $type == 'file' ) { + if ( file_exists($icons_path.$ext.$config->icons_ext) ) { + return $icons_url.$ext.$config->icons_ext; + } else { + return $icons_url.'_file'.$config->icons_ext; + } + } elseif ( $type == 'dir' || $type == 'folder' ) { + if ( file_exists($icons_path.'_folder.'.$ext.$config->icons_ext) ) { + return $icons_url.'_folder.'.$ext.$config->icons_ext; + } else { + return $icons_url.'_folder'.$config->icons_ext; + } + } + } + +//>Section> get_parent + function get_parent ($size) { + global $config; + if ( $size == 'large' || $size == 'big' ) { + $size = $config->icons_large; + } else { + $size = $config->icons_small; + } + return ICONS_URL.$size.'/_parent'.$config->icons_ext; + } +//> class.end +} + + //========================== //>STAGE> init //========================== @@ -27,40 +73,6 @@ define('ICONS_URL', DLIST_URL.ICONS_PATH); //>Section> load_config:35 $config->parse(ICONS_PATH.'config.ini', true, 'icons_'); -//>Section> functions -function icons_get_url ($ext, $size, $type) { - global $config; - if ( $size == 'large' || $size == 'big' ) { - $size = $config->icons_large; - } else { - $size = $config->icons_small; - } - $icons_path = ICONS_PATH.$size.'/'; - $icons_url = ICONS_URL.$size.'/'; - if ( $type == 'file' ) { - if ( file_exists($icons_path.$ext.$config->icons_ext) ) { - return $icons_url.$ext.$config->icons_ext; - } else { - return $icons_url.'_file'.$config->icons_ext; - } - } elseif ( $type == 'dir' || $type == 'folder' ) { - if ( file_exists($icons_path.'_folder.'.$ext.$config->icons_ext) ) { - return $icons_url.'_folder.'.$ext.$config->icons_ext; - } else { - return $icons_url.'_folder'.$config->icons_ext; - } - } -} - -function icons_get_parent ($size) { - global $config; - if ( $size == 'large' || $size == 'big' ) { - $size = $config->icons_large; - } else { - $size = $config->icons_small; - } - return ICONS_URL.$size.'/_parent'.$config->icons_ext; -} //_END; ?> \ No newline at end of file diff --git a/exec/output.exc.php b/exec/output.exc.php index 282f8ba..64d0f5e 100644 --- a/exec/output.exc.php +++ b/exec/output.exc.php @@ -26,6 +26,10 @@ Author: Jim Myhrberg //>Section> do_render:5 if ( $do_render ) { + +//>Section> set_parent:10 +$parent = $dlist->parent; + //>Section> do_render.end:95 } diff --git a/libs/dirlist.lib.php b/libs/dirlist.lib.php index c3e4961..e54ac3a 100644 --- a/libs/dirlist.lib.php +++ b/libs/dirlist.lib.php @@ -89,7 +89,6 @@ class dirList { } - // ============================================== // ----- [ Internal Functions ] ----------------- // ============================================== @@ -150,10 +149,9 @@ class dirList { $types = array('bytes', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'); for($n = 0; $bytes >= 1024; $n++) $bytes = $bytes / 1024; $bytes = number_format($bytes, 2); - if ( !empty($bytes[1]) ) { - $bytes = explode('.', $bytes); - $bytes[1] = rtrim($bytes[1], '0'); - $bytes = ( $bytes[1] != '' ) ? $bytes[0].'.'.$bytes[1] : $bytes[0] ; + if ( preg_match("/([0-9]+)\.([0-9]+)/", $bytes, $bytes) ) { + $bytes[2] = rtrim($bytes[2], '0'); + $bytes = ( !empty($bytes[2]) ) ? $bytes[1].'.'.$bytes[2] : $bytes[1] ; } return $bytes.' '.$types[$n]; } diff --git a/libs/exechandler.lib.php b/libs/exechandler.lib.php index 657ddf5..facb3d8 100644 --- a/libs/exechandler.lib.php +++ b/libs/exechandler.lib.php @@ -4,7 +4,7 @@ class execHandler { /* - Class: execHandler v0.7.3 beta + Class: execHandler v0.7.4 beta Copyright © 2006 Jim Myhrberg. All rights reserved. zynode@gmail.com @@ -31,17 +31,19 @@ class execHandler { // Execution Stage Priority var $default_stages = array( - 'init' => 10, - 'query' => 20, - 'main' => 50, - 'render' => 80, - 'term' => 90, + 'functions' => 5, + 'init' => 10, + 'query' => 20, + 'main' => 50, + 'render' => 80, + 'term' => 90, ); // Debug? - var $debug = false; + var $debug = false; + var $show_debug_msg = true; // Misc. Settings @@ -110,7 +112,7 @@ class execHandler { function cache ($force=false) { if ( $force || $this->debug || !$this->check_cache() ) { - if ( $this->debug ) echo "reloading\n"; + if ( $this->debug && $this->show_debug_msg ) echo "reloading\n"; $this->loadFile($this->files_to_load); $this->compile(); $this->save_cache(); @@ -124,9 +126,11 @@ class execHandler { } elseif( is_string($input) ) { $result = glob($input); } - $result = array_filter($result); - if ( is_array($result) ) $result = array_unique($result); - $this->files_to_load = array_merge($this->files_to_load, $result); + if ( !empty($result) ) { + $result = array_filter($result); + if ( is_array($result) ) $result = array_unique($result); + $this->files_to_load = array_merge($this->files_to_load, $result); + } } function loadFile ($input) { diff --git a/templates/simple/index.phtml b/templates/simple/index.phtml index a80a9c9..8d7a596 100644 --- a/templates/simple/index.phtml +++ b/templates/simple/index.phtml @@ -3,44 +3,48 @@ - Index of <?= DIR_URL ?> + Index of <?=DIR_URL?> - - + +
- - - - - - + + + + + + - parent) || $dlist->parent != '/'): $parent = $dlist->parent; ?> + - - - - - - + + + + + + list as $key => $item): ?> - - - - - - + + + + + +
NameSizeDate ModifiedPermissionsOwnerNameSizeDate ModifiedPermissionsOwner
..
+ + + +
diff --git a/templates/simple/render.exc.php b/templates/simple/render.exc.php index 9eff14d..e92120d 100644 --- a/templates/simple/render.exc.php +++ b/templates/simple/render.exc.php @@ -21,7 +21,7 @@ Author: Jim Myhrberg //>After> core.define_constants -$config->parse(TPL_PATH.'settings.php'); +$config->parse(TPL_PATH.'settings.php', true, 'tpl_'); //========================== diff --git a/templates/simple/settings.php b/templates/simple/settings.php index 5d72e1d..cced63b 100644 --- a/templates/simple/settings.php +++ b/templates/simple/settings.php @@ -1,7 +1,7 @@ 'value + 'icon_size' => 'small', ); ?> \ No newline at end of file diff --git a/templates/simple/stylesheets/media.css b/templates/simple/stylesheets/media.css deleted file mode 100644 index 0b0b798..0000000 --- a/templates/simple/stylesheets/media.css +++ /dev/null @@ -1,10 +0,0 @@ -BODY { - background-color: #FFF; -} -#list { - background-color: #666; -} -#list TH, #list TD { - background-color: #FFF; - padding: 5px; -} \ No newline at end of file diff --git a/templates/simple/stylesheets/screen.css b/templates/simple/stylesheets/screen.css new file mode 100644 index 0000000..6988027 --- /dev/null +++ b/templates/simple/stylesheets/screen.css @@ -0,0 +1,74 @@ +BODY { + background-color: #FFF; + color: #000; + font: 11px "Lucida Grande", Tahoma, Verdana, sans-serif; + margin: 0xp; + padding: 18px; +} + +#header { + font: 20px "Myriad Pro", "Trebuchet MS", Verdana, sans-serif; + padding: 15px 15px 20px 35px; +} + +#list { + background-color: #777; + width: 100%; +} + +/* List Headers */ +#list TH { + background-color: #CCC; + padding: 2px 5px 2px 5px; +} +#list TH.name { + text-align: left; +} +#list TH.icon { + padding: 2px; + height: 16px; + width: 16px; +} +#list TH.size { + width: 75px; +} +#list TH.mtime { + width: 175px; +} +#list TH.perms { + width: 100px; +} +#list TH.owner { + width: 85px; +} + +/* List Cells */ +#list TD { + background-color: #FFF; + padding: 2px 5px 2px 5px; +} +#list TD.icon { + padding: 2px; +} +#list TD.size { + text-align: right; +} +#list TD.mtime { + text-align: right; +} +#list TD.perms { + +} +#list TD.owner { + +} + +#list TD.name A { + width: 100%; + display: block; +} + +#stats { + text-align: center; + padding: 10px; +} \ No newline at end of file diff --git a/view.php b/view.php index b93fbae..7426ce2 100644 --- a/view.php +++ b/view.php @@ -30,6 +30,7 @@ if ($config->debug) $debug_timer = new speedometer(); // initialize execHandler and main scripts $exec = new execHandler(); $exec->update_frequency = 0; +$exec->show_debug_msg = false; // configure cache dir for compiled code @@ -46,7 +47,9 @@ $exec->addPath( 'templates/'.$config->template.'/*.exc.php', ) ); -$exec->addPath($config->path_plugins); +foreach( $config->path_plugins as $key => $value ) { + $exec->addPath($value.'/*.exc.php'); +} $exec->cache(); include($exec->include_file);