From 49ccc270a175d2bdb1b89560d5772544fd3ce6e0 Mon Sep 17 00:00:00 2001 From: jim Date: Thu, 30 Mar 2006 23:43:05 +0000 Subject: [PATCH] - updated configuration file. - edited init script so it will only look for specific file names. "index.html", "index.php", so on, instead of running glob() on "index.*". - moved internal timer to seperate exec file. git-svn-id: file:///Users/jimeh/Desktop/dlist/trunk@7 a5845835-ea0f-0410-a762-dd0bfe9bfde8 --- config.php | 14 +++++++++++--- exec/core.exc.php | 11 ++--------- exec/timer.exc.php | 36 +++++++++++++++++++++++++++++++++++ libs/config.lib.php | 10 +++++----- libs/dirlist.lib.php | 4 ++-- libs/exechandler.lib.php | 6 +++++- libs/speedometer.lib.php | 7 +++++++ resources/init.php | 8 ++++++-- templates/simple/settings.php | 2 +- 9 files changed, 75 insertions(+), 23 deletions(-) create mode 100644 exec/timer.exc.php diff --git a/config.php b/config.php index 1fa8430..bc51af5 100644 --- a/config.php +++ b/config.php @@ -1,11 +1,19 @@ '/dlist/', - 'index_files' => array('index', 'default', 'main'), + 'dlist_url' => '/dlist/', + 'index_files' => array('index.html', 'index.php', 'index.htm'), 'debug' => true, diff --git a/exec/core.exc.php b/exec/core.exc.php index eebb39d..6a00b66 100644 --- a/exec/core.exc.php +++ b/exec/core.exc.php @@ -19,9 +19,6 @@ Author: Jim Myhrberg //>STAGE> init //========================== -//>Section> start_timer:10 -$timer = new speedometer(); - //>Section> port_correction:20 if ( stristr($_SERVER['HTTP_HOST'], ':') !== false ) { @@ -38,7 +35,7 @@ define('DIR_URL', $dir_url); define('DIR_PATH', $dir_path); define('QUERY_STRING', $query_string); -define('DLIST_URL', $config->url); +define('DLIST_URL', $config->dlist_url); define('TEMPLATE', $config->template); define('TPL_PATH', 'templates/'.TEMPLATE.'/'); define('TPL_URL', DLIST_URL.TPL_PATH); @@ -59,7 +56,7 @@ $do_sort_reverse = false; //>Section> readdir if ( $do_readdir ) { //>Section> readdir.start - $dlist = new dirlist(); + $dlist = new dirList(); //>Section> readdir.options if ( empty($do_sort_items) ) { $dlist->sort_items = false; @@ -75,10 +72,6 @@ if ( $do_readdir ) { //========================== -//>Section> end_timer:10 -$timer->end(); - - //>Section> echo print_r($dlist->list); print_r($config); diff --git a/exec/timer.exc.php b/exec/timer.exc.php new file mode 100644 index 0000000..ab53afd --- /dev/null +++ b/exec/timer.exc.php @@ -0,0 +1,36 @@ +STAGE> init +//========================== + + +//>Section> start +$timer = new speedometer(); + + +//========================== +//>STAGE> render +//========================== + + +//>Section> end +$timer->end(); + +//_END; +?> \ No newline at end of file diff --git a/libs/config.lib.php b/libs/config.lib.php index d9a089b..3728322 100644 --- a/libs/config.lib.php +++ b/libs/config.lib.php @@ -2,14 +2,14 @@ class config { - /* +/* - Class: config v0.1 beta + Class: config v0.1 beta - Copyright © 2006 Jim Myhrberg. All rights reserved. - zynode@gmail.com + Copyright © 2006 Jim Myhrberg. All rights reserved. + zynode@gmail.com - */ +*/ function config ($input=false) { diff --git a/libs/dirlist.lib.php b/libs/dirlist.lib.php index 90820b9..7100616 100644 --- a/libs/dirlist.lib.php +++ b/libs/dirlist.lib.php @@ -1,10 +1,10 @@ priority_delim."(.*)/", $section, $priority) ) { $section = $priority[1]; $priority = $priority[2]; - } else { $priority = $this->default_priority; } + } elseif ( !empty($settings['priority']) ) { + $priority = $settings['priority']; + }else { + $priority = $this->default_priority; + } $section_code = $this->clean_up_code($section_code[2]); diff --git a/libs/speedometer.lib.php b/libs/speedometer.lib.php index a932a47..265ae03 100644 --- a/libs/speedometer.lib.php +++ b/libs/speedometer.lib.php @@ -2,6 +2,13 @@ class speedometer { +/* + + Class: Speedometer v0.1 + Created to simplify script execution statistics... + +*/ + var $digits = 6; var $start; diff --git a/resources/init.php b/resources/init.php index 08bd6c3..33e78dd 100644 --- a/resources/init.php +++ b/resources/init.php @@ -2,6 +2,8 @@ /* + dList Intialization + Copyright © 2006 Jim Myhrberg. All rights reserved. zynode@gmail.com @@ -28,8 +30,10 @@ if(!preg_match("/\/$/", $dir_url)) $redirect = '/'; // check for index files and redirect if found if ( empty($redirect) ) { foreach($config['index_files'] as $what) { - $indexsearch = glob($dir_path.$what.'.*'); - if(isset($indexsearch[0])) { $redirect = basename($indexsearch[0]); break; } + if ( file_exists($dir_path.$what) ) { + $redirect = basename($what); + break; + } } } if ( !empty($redirect) ) { diff --git a/templates/simple/settings.php b/templates/simple/settings.php index a2615c4..5d72e1d 100644 --- a/templates/simple/settings.php +++ b/templates/simple/settings.php @@ -1,7 +1,7 @@ 'simple', + // 'key' => 'value ); ?> \ No newline at end of file