diff --git a/config.php b/config.php index 25b0252..cb9e483 100644 --- a/config.php +++ b/config.php @@ -27,12 +27,19 @@ $config = array( # show hidden files & folders who's names begin with . (dot) 'show_hidden' => false, + # what info to show for each file/folder, valid values are: + # name, size, mtime, perms, chmod, owner, ownerid, group, groupid, ext + 'fields' => 'name,size,mtime,perms,owner', + // Display settings # if the corresponding language file can't be found # dList will default to english. 'language' => 'english', + # name of the cookie dList will check for language settings per user + 'lang_cookie' => 'dList_language', + # Smart Date shows relative time stamps ("Yesterday, 09:34") when applicable 'smartdate' => true, diff --git a/exec/icons.exc.php b/exec/icons.exc.php index 674f99f..77ab0c8 100644 --- a/exec/icons.exc.php +++ b/exec/icons.exc.php @@ -24,6 +24,7 @@ class Icon { //>Section> get_url function get_url ($ext, $size, $type) { + //TODO enable thumbnail support using phpThumbs global $config; if ( $size == 'large' || $size == 'big' ) { $size = $config->icons_large; diff --git a/exec/language.exc.php b/exec/language.exc.php index bcc3b16..e2b85bd 100644 --- a/exec/language.exc.php +++ b/exec/language.exc.php @@ -15,20 +15,36 @@ Author: Jim Myhrberg */ //_SCRIPT; +//========================== +//>STAGE> functions +//========================== + + + function installed_languages () { + $return = glob('languages/*.lang.php'); + foreach( $return as $key => $value ) { + $return[$key] = preg_replace("/languages\/(.*)\.lang\.php/", "$1", $value); + } + return $return; + } + + //========================== //>STAGE> init //========================== //>Section> init:10 -if ( empty($config->language) ) $config->language = 'english'; -if ( is_readable('languages/'.$config->language.'.lang.php') ) { - include('languages/'.$config->language.'.lang.php'); +if ( !empty($_REQUEST[$config->lang_cookie]) && is_readable('languages/'.$_REQUEST[$config->lang_cookie].'.lang.php')) { + $language = $_REQUEST[$config->lang_cookie]; +} elseif ( is_readable('languages/'.$config->language.'.lang.php') ) { + $language = $config->language; } elseif ( is_readable('languages/'.$config->default_lang.'.lang.php') ) { - include('languages/'.$config->default_lang.'.lang.php'); + $language = $config->default_lang; } else { die("ERROR: Can't open language file."); } +include('languages/'.$language.'.lang.php'); //>Section> create_object:10 @@ -58,7 +74,6 @@ setlocale(LC_ALL, array_merge($lang->_locale, $config->default_locale)); define('LANG', $lang->_language); define('LANG_VER', $lang->_version); - //========================== //>STAGE> main //========================== diff --git a/exec/output.exc.php b/exec/output.exc.php index 4f67fe7..878697f 100644 --- a/exec/output.exc.php +++ b/exec/output.exc.php @@ -19,11 +19,32 @@ Author: Jim Myhrberg //>STAGE> functions //========================== +//>Section> class_path.start +class Path { + + //>Section> path.url2links + function url2links ($path, $root='') { + if ( !empty($path) ) { + $return = ''; + $previous = ''; + $path = str_replace("\\", '/', $path); + $path = explode('/', rtrim($path, '/')); + $last = count($path)-1; + foreach( $path as $key => $value ) { + $return .= ($key != $last) ? ''.$value.'/' : $value.'/'; + $previous .= $value.'/'; + } + return $return; + } else return false; + } + + //>Section> path_class.end +} -//>Section> sort_class.start +//>Section> class_sort.start class Sort { - //>Section> get_url + //>Section> sort.get_url function get_url ($sortby) { global $config; $return = array(); @@ -84,11 +105,22 @@ $is_root = ( DIR_URL != '' && DIR_URL != '/' ) ? false : true; //>Section> do_render:5 if ( $do_render ) { -//>Section> set_parent:10 +//>Section> set_vars:10 $parent = $dlist->parent; +if ( !empty($_REQUEST['sort']) && !empty($dlist->sort_order[strtolower($_REQUEST['sort'])]) ) { + $current_sort = $_REQUEST['sort']; +} else { + $current_sort = $config->default_sort; +} +//>Section> set_fields:10 +$fields = explode(',', $config->fields); +//foreach( $fields as $key => $value ) $fields[$key] = trim($value); +$fields = array_flip(array_filter($fields)); + //>Section> do_render.end:95 } + //_END; ?> \ No newline at end of file diff --git a/languages/english.lang.php b/languages/english.lang.php index 21d63d6..155ca57 100644 --- a/languages/english.lang.php +++ b/languages/english.lang.php @@ -32,6 +32,8 @@ class lang { var $icons = 'Icons'; var $details = 'Details'; + var $powered_by = 'Powered by dList'; + // Smart Date var $sd_tomorrow = 'Tomorrow'; diff --git a/languages/swedish.lang.php b/languages/swedish.lang.php index 6c05b0d..c5d1555 100644 --- a/languages/swedish.lang.php +++ b/languages/swedish.lang.php @@ -32,6 +32,8 @@ class lang { var $icons = 'Ikoner'; var $details = 'Detaljer'; + var $powered_by = 'Driven av dList'; + // Smart Date var $sd_tomorrow = 'Imorgon'; diff --git a/libs/dirlist.lib.php b/libs/dirlist.lib.php index e2faac5..dc8a042 100644 --- a/libs/dirlist.lib.php +++ b/libs/dirlist.lib.php @@ -53,7 +53,7 @@ class dirList { // incase it might do something in the future... function dirlist() { // sorting orders - $this->sort_order = array( + $this->sort_order = array( 'name' => 'name,mtime,size', 'size' => 'size,name,mtime', 'mtime' => 'mtime,name,size', diff --git a/templates/simple/_details.phtml b/templates/simple/_details.phtml index 6a6c814..d8edc3f 100644 --- a/templates/simple/_details.phtml +++ b/templates/simple/_details.phtml @@ -1,34 +1,26 @@
| - | =$lang->name?> | -=$lang->size?> | -=$lang->mtime?> | -=$lang->perms?> | -=$lang->owner?> | + foreach ($fields as $key => $value): ?>=$lang->$key?> | + endforeach ?>|
|---|---|---|---|---|---|---|---|
| .. | -- | -- | -=$parent['perms']?> | -=$parent['owner']?> | + foreach ($fields as $key => $value): + if ($key == 'name'):?>.. | + else: ?>endif ?> + endforeach ?> | |
|
-
- |
- =$item['name']?> | -=$item['size']?> | -=$item['mtime']?> | -=$item['perms']?> | -=$item['owner']?> | + foreach ($fields as $key => $value): + if ($key == 'name'):?>=$item['name']?> | + else: ?>=$item[$key]?> | endif ?> endforeach ?>
- =$lang->index_of.' '.DIR_URL?>
+ =$lang->index_of.' '.Path::url2links(DIR_URL)?>
=SERVER_INFO?>
include(TPL_PATH.$config->tpl_mode) ?>
-
Powered by dList. =$timer->end()?>.
+ =$lang->powered_by?>. =$timer->end()?>.
+ foreach ($installed_languages as $key => $value): ?>=ucfirst($value)?> if(count($installed_languages)-1 != $key) echo ' | '; endforeach ?>
|