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:
12
config.php
12
config.php
@@ -1,11 +1,19 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
/*
|
||||||
|
|
||||||
|
dList's main configuration file.
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
$config = array(
|
$config = array(
|
||||||
|
|
||||||
|
|
||||||
// Main settings
|
// Main settings
|
||||||
|
|
||||||
'url' => '/dlist/',
|
'dlist_url' => '/dlist/',
|
||||||
'index_files' => array('index', 'default', 'main'),
|
'index_files' => array('index.html', 'index.php', 'index.htm'),
|
||||||
'debug' => true,
|
'debug' => true,
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -19,9 +19,6 @@ Author: Jim Myhrberg
|
|||||||
//>STAGE> init
|
//>STAGE> init
|
||||||
//==========================
|
//==========================
|
||||||
|
|
||||||
//>Section> start_timer:10
|
|
||||||
$timer = new speedometer();
|
|
||||||
|
|
||||||
|
|
||||||
//>Section> port_correction:20
|
//>Section> port_correction:20
|
||||||
if ( stristr($_SERVER['HTTP_HOST'], ':') !== false ) {
|
if ( stristr($_SERVER['HTTP_HOST'], ':') !== false ) {
|
||||||
@@ -38,7 +35,7 @@ define('DIR_URL', $dir_url);
|
|||||||
define('DIR_PATH', $dir_path);
|
define('DIR_PATH', $dir_path);
|
||||||
define('QUERY_STRING', $query_string);
|
define('QUERY_STRING', $query_string);
|
||||||
|
|
||||||
define('DLIST_URL', $config->url);
|
define('DLIST_URL', $config->dlist_url);
|
||||||
define('TEMPLATE', $config->template);
|
define('TEMPLATE', $config->template);
|
||||||
define('TPL_PATH', 'templates/'.TEMPLATE.'/');
|
define('TPL_PATH', 'templates/'.TEMPLATE.'/');
|
||||||
define('TPL_URL', DLIST_URL.TPL_PATH);
|
define('TPL_URL', DLIST_URL.TPL_PATH);
|
||||||
@@ -59,7 +56,7 @@ $do_sort_reverse = false;
|
|||||||
//>Section> readdir
|
//>Section> readdir
|
||||||
if ( $do_readdir ) {
|
if ( $do_readdir ) {
|
||||||
//>Section> readdir.start
|
//>Section> readdir.start
|
||||||
$dlist = new dirlist();
|
$dlist = new dirList();
|
||||||
//>Section> readdir.options
|
//>Section> readdir.options
|
||||||
if ( empty($do_sort_items) ) {
|
if ( empty($do_sort_items) ) {
|
||||||
$dlist->sort_items = false;
|
$dlist->sort_items = false;
|
||||||
@@ -75,10 +72,6 @@ if ( $do_readdir ) {
|
|||||||
//==========================
|
//==========================
|
||||||
|
|
||||||
|
|
||||||
//>Section> end_timer:10
|
|
||||||
$timer->end();
|
|
||||||
|
|
||||||
|
|
||||||
//>Section> echo
|
//>Section> echo
|
||||||
print_r($dlist->list);
|
print_r($dlist->list);
|
||||||
print_r($config);
|
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 {
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
||||||
Class: config v0.1 beta
|
Class: config v0.1 beta
|
||||||
|
|
||||||
Copyright © 2006 Jim Myhrberg. All rights reserved.
|
Copyright © 2006 Jim Myhrberg. All rights reserved.
|
||||||
zynode@gmail.com
|
zynode@gmail.com
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
function config ($input=false) {
|
function config ($input=false) {
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
class dirlist {
|
class dirList {
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
||||||
Class: dirlist v2.0 beta
|
Class: dirList v2.0 beta
|
||||||
|
|
||||||
Copyright © 2006 Jim Myhrberg. All rights reserved.
|
Copyright © 2006 Jim Myhrberg. All rights reserved.
|
||||||
zynode@gmail.com
|
zynode@gmail.com
|
||||||
|
|||||||
@@ -251,7 +251,11 @@ class execHandler {
|
|||||||
if ( preg_match("/(.*)".$this->priority_delim."(.*)/", $section, $priority) ) {
|
if ( preg_match("/(.*)".$this->priority_delim."(.*)/", $section, $priority) ) {
|
||||||
$section = $priority[1];
|
$section = $priority[1];
|
||||||
$priority = $priority[2];
|
$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]);
|
$section_code = $this->clean_up_code($section_code[2]);
|
||||||
|
|
||||||
|
|||||||
@@ -2,6 +2,13 @@
|
|||||||
|
|
||||||
class speedometer {
|
class speedometer {
|
||||||
|
|
||||||
|
/*
|
||||||
|
|
||||||
|
Class: Speedometer v0.1
|
||||||
|
Created to simplify script execution statistics...
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
var $digits = 6;
|
var $digits = 6;
|
||||||
|
|
||||||
var $start;
|
var $start;
|
||||||
|
|||||||
@@ -2,6 +2,8 @@
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
||||||
|
dList Intialization
|
||||||
|
|
||||||
Copyright © 2006 Jim Myhrberg. All rights reserved.
|
Copyright © 2006 Jim Myhrberg. All rights reserved.
|
||||||
zynode@gmail.com
|
zynode@gmail.com
|
||||||
|
|
||||||
@@ -28,8 +30,10 @@ if(!preg_match("/\/$/", $dir_url)) $redirect = '/';
|
|||||||
// check for index files and redirect if found
|
// check for index files and redirect if found
|
||||||
if ( empty($redirect) ) {
|
if ( empty($redirect) ) {
|
||||||
foreach($config['index_files'] as $what) {
|
foreach($config['index_files'] as $what) {
|
||||||
$indexsearch = glob($dir_path.$what.'.*');
|
if ( file_exists($dir_path.$what) ) {
|
||||||
if(isset($indexsearch[0])) { $redirect = basename($indexsearch[0]); break; }
|
$redirect = basename($what);
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ( !empty($redirect) ) {
|
if ( !empty($redirect) ) {
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
$config = array(
|
$config = array(
|
||||||
'template_name' => 'simple',
|
// 'key' => 'value
|
||||||
);
|
);
|
||||||
|
|
||||||
?>
|
?>
|
||||||
Reference in New Issue
Block a user