mirror of
https://github.com/jimeh/dlist.git
synced 2026-02-19 07:56:41 +00:00
- 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
This commit is contained in:
14
config.php
14
config.php
@@ -1,11 +1,19 @@
|
||||
<?php
|
||||
|
||||
$config = array(
|
||||
/*
|
||||
|
||||
dList's main configuration file.
|
||||
|
||||
*/
|
||||
|
||||
|
||||
$config = array(
|
||||
|
||||
|
||||
// Main settings
|
||||
|
||||
'url' => '/dlist/',
|
||||
'index_files' => array('index', 'default', 'main'),
|
||||
'dlist_url' => '/dlist/',
|
||||
'index_files' => array('index.html', 'index.php', 'index.htm'),
|
||||
'debug' => true,
|
||||
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
36
exec/timer.exc.php
Normal file
36
exec/timer.exc.php
Normal file
@@ -0,0 +1,36 @@
|
||||
<?php die();
|
||||
|
||||
//
|
||||
// Exec: timer
|
||||
//
|
||||
// Copyright © 2006 Jim Myhrberg. All rights reserved.
|
||||
// zynode@gmail.com
|
||||
//
|
||||
|
||||
//_HEAD;
|
||||
/* --- Configuration ---
|
||||
Name: timer
|
||||
Priority: 10
|
||||
Author: Jim Myhrberg
|
||||
*/
|
||||
//_SCRIPT;
|
||||
|
||||
//==========================
|
||||
//>STAGE> init
|
||||
//==========================
|
||||
|
||||
|
||||
//>Section> start
|
||||
$timer = new speedometer();
|
||||
|
||||
|
||||
//==========================
|
||||
//>STAGE> render
|
||||
//==========================
|
||||
|
||||
|
||||
//>Section> end
|
||||
$timer->end();
|
||||
|
||||
//_END;
|
||||
?>
|
||||
@@ -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) {
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
<?php
|
||||
|
||||
class dirlist {
|
||||
class dirList {
|
||||
|
||||
/*
|
||||
|
||||
Class: dirlist v2.0 beta
|
||||
Class: dirList v2.0 beta
|
||||
|
||||
Copyright © 2006 Jim Myhrberg. All rights reserved.
|
||||
zynode@gmail.com
|
||||
|
||||
@@ -251,7 +251,11 @@ class execHandler {
|
||||
if ( preg_match("/(.*)".$this->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]);
|
||||
|
||||
|
||||
@@ -2,6 +2,13 @@
|
||||
|
||||
class speedometer {
|
||||
|
||||
/*
|
||||
|
||||
Class: Speedometer v0.1
|
||||
Created to simplify script execution statistics...
|
||||
|
||||
*/
|
||||
|
||||
var $digits = 6;
|
||||
|
||||
var $start;
|
||||
|
||||
@@ -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) ) {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<?php
|
||||
|
||||
$config = array(
|
||||
'template_name' => 'simple',
|
||||
// 'key' => 'value
|
||||
);
|
||||
|
||||
?>
|
||||
Reference in New Issue
Block a user