- made simple template almost feature complete by implementing view modes and more

- other general fixes to things a bit all over the place

git-svn-id: file:///Users/jimeh/Desktop/dlist/trunk@12 a5845835-ea0f-0410-a762-dd0bfe9bfde8
This commit is contained in:
jim
2006-04-04 23:15:55 +00:00
parent a8fe6d5a8c
commit 80fd008b9d
20 changed files with 411 additions and 105 deletions

View File

@@ -33,12 +33,13 @@ class config {
// Parse settings from an array
function parse_array ($input, $overwrite=true) {
$pad = '';
if ( is_array($input) ) {
foreach( $input as $key => $value ) {
if ( is_array($value) ) {
if ( !empty($this->_config_pad) ) $key = $this->_config_pad.$key;
foreach( $value as $k => $v ) {
if ( ($empty = empty($this->$key)) || $overwrite ) {
if ( !empty($this->_config_pad) ) $k = $this->_config_pad.$k;
$this->$key = ( $empty ) ? array($k=>$v) : array_merge($this->$key, array($k=>$v)) ;
}
}

View File

@@ -4,7 +4,7 @@ class dirList {
/*
Class: dirList v2.0.4 beta
Class: dirList v2.0.6 beta
Copyright © 2006 Jim Myhrberg. All rights reserved.
zynode@gmail.com
@@ -12,13 +12,16 @@ class dirList {
*/
// General settings
var $default_sort = 'name,mtime,size';
var $sort_by = 'name';
var $folders_first = true;
var $show_hidden = false;
// Sorting
var $sort_items = true;
var $reverse = false;
var $sort_order = array();
// Smart date formatting
var $use_smartdate = true;
@@ -27,13 +30,7 @@ class dirList {
var $smartdate_time = '%H:%M';
var $standard_date_format = '%B %d, %Y, %H:%M';
/*
var $smartdate = '{date}, {time}';
var $smartdate_date = 'F d, Y';
var $smartdate_time = 'H:i';
var $standard_date_format = 'F d, Y, H:i';
*/
// Smart date language settings
var $lang_tomorrow = 'Tomorrow';
var $lang_today = 'Today';
@@ -46,7 +43,6 @@ class dirList {
var $error = false;
var $parent;
var $list = array();
var $sort_by = array();
var $stats_count = 0;
var $stats_files = 0;
@@ -56,6 +52,20 @@ class dirList {
// Construtor - does nothing, but is here just
// incase it might do something in the future...
function dirlist() {
// sorting orders
$this->sort_order = array(
'name' => 'name,mtime,size',
'size' => 'size,name,mtime',
'mtime' => 'mtime,name,size',
'type' => 'type,name,size,mtime',
'ext' => 'ext,name,size,mtime',
'group' => 'group,name,size,mtime',
'owner' => 'owner,name,size,mtime',
'chmod' => 'chmod,name,size,mtime',
'perms' => 'chmod,name,size,mtime',
'groupid' => 'groupid,name,size,mtime',
'ownerid' => 'ownerid,name,size,mtime',
);
}
@@ -65,7 +75,8 @@ class dirList {
function read ($dir) {
if(!preg_match("/\/$/", $dir)) $dir .= '/';
$this->sort_by = explode(',', $this->default_sort);
$sort_by = ( !empty($this->sort_order[$this->sort_by]) ) ? $this->sort_order[$this->sort_by] : $this->sort_order['name'] ;
$sort_by = explode(',', $sort_by);
if($dh = @opendir($dir)) {
$this->parent = $this->getDetails($dir);
while(false !== ($item = readdir($dh))) {
@@ -83,7 +94,7 @@ class dirList {
// sorting
if ( $this->sort_items ) {
$list_key = ( $this->folders_first ) ? $item_details['type'].'|' : '' ;
foreach( $this->sort_by as $v ) {
foreach( $sort_by as $v ) {
if ( $v == 'size' ) $v = 'size_raw';
if ( $v == 'mtime' ) $v = 'mtime_raw';
$list_key .= ( $v == 'size_raw' || $v == 'mtime' ) ? str_pad($item_details[$v], 28, '0', STR_PAD_LEFT).'|' : $item_details[$v].'|' ;

View File

@@ -4,7 +4,7 @@ class execHandler {
/*
Class: execHandler v0.7.4 beta
Class: execHandler v0.7.5 beta
Copyright © 2006 Jim Myhrberg. All rights reserved.
zynode@gmail.com
@@ -43,7 +43,7 @@ class execHandler {
// Debug?
var $debug = false;
var $show_debug_msg = true;
var $show_debug_msg = false;
// Misc. Settings
@@ -206,14 +206,16 @@ class execHandler {
function parse ($string, $file) {
// parse order statistics
$this->parsing_order[] = $file;
// Filter Out Main Content
$file_start = $this->addslashes($this->file_start);
$code_delim = $this->addslashes($this->code_delim);
$file_end = $this->addslashes($this->file_end);
preg_match("/^".$file_start."$(.*)^".$code_delim."$(.*)^".$file_end."$/ims", $string, $code);
if ( preg_match("/^".$file_start."$(.*)^".$code_delim."$(.*)^".$file_end."$/ims", $string, $code) ) {
$this->parsing_order[] = $file;
} else {
$this->parsing_order[] = 'INVALID:'.$file;
return false;
}
// Read Settings
$settings = $this->read_file_settings($code[1], $file);

View File

@@ -4,12 +4,13 @@ class speedometer {
/*
Class: Speedometer v0.1.1
Class: Speedometer v0.2
Created to simplify script execution statistics...
*/
var $digits = 6;
var $pattern = '%s'; // must contain %s
var $start;
var $time;
@@ -19,7 +20,17 @@ class speedometer {
$this->start = $this->getmicrotime();
}
function end ($digits=false) {
// return with pattern
function end ($digits=false, $pattern=false) {
$end = $this->getmicrotime();
$digits = ( preg_match("/[0-9]{1,2}/", $digits) ) ? $digits : $this->digits ;
$pattern = ( stristr($pattern, '%s') != false ) ? $pattern : $this->pattern ;
$this->time = number_format( ($end - $this->start), $digits);
return str_replace('%s', $this->time, $pattern);
}
// return time only ignoring pattern
function term ($digits=false) {
$end = $this->getmicrotime();
$digits = ( preg_match("/[0-9]{1,2}/", $digits) ) ? $digits : $this->digits ;
return $this->time = number_format( ($end - $this->start), $digits);