mirror of
https://github.com/jimeh/dlist.git
synced 2026-02-18 23:46:39 +00:00
- thumbnail support is fully functional with custom imageThumb class which supports caching and so on, the class is still considered beta (specially the clean_cache() function)
- updated simple template - added Last Access (atime) to dirlist.lib.php - updated and fixed loads of other things git-svn-id: file:///Users/jimeh/Desktop/dlist/trunk@18 a5845835-ea0f-0410-a762-dd0bfe9bfde8
This commit is contained in:
@@ -27,9 +27,9 @@ $config = array(
|
|||||||
# show hidden files & folders who's names begin with . (dot)
|
# show hidden files & folders who's names begin with . (dot)
|
||||||
'show_hidden' => false,
|
'show_hidden' => false,
|
||||||
|
|
||||||
# what info to show for each file/folder, valid values are:
|
# what info to show for each file/folder in details view, valid values are:
|
||||||
# name, size, mtime, perms, chmod, owner, ownerid, group, groupid, ext
|
# name, size, mtime, perms, chmod, owner, ownerid, group, groupid, ext
|
||||||
# (must contain "name", for basic directory listing functionality)
|
# (must at least contain "name" for basic directory listing functionality)
|
||||||
'fields' => 'name,size,mtime,perms,owner',
|
'fields' => 'name,size,mtime,perms,owner',
|
||||||
|
|
||||||
// Display settings
|
// Display settings
|
||||||
@@ -59,7 +59,7 @@ $config = array(
|
|||||||
'path_plugins' => array('plugins'),
|
'path_plugins' => array('plugins'),
|
||||||
'path_cache' => 'cache',
|
'path_cache' => 'cache',
|
||||||
|
|
||||||
'req_lang_ver' => '1.0.2',
|
'req_lang_ver' => '1.0.5',
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -12,7 +12,7 @@
|
|||||||
Name: core
|
Name: core
|
||||||
Priority: 40
|
Priority: 40
|
||||||
Author: Jim Myhrberg
|
Author: Jim Myhrberg
|
||||||
Include: output.exc.php, language.exc.php
|
Include: language.exc.php, output.exc.php
|
||||||
*/
|
*/
|
||||||
//_SCRIPT;
|
//_SCRIPT;
|
||||||
|
|
||||||
|
|||||||
@@ -23,18 +23,20 @@ Author: Jim Myhrberg
|
|||||||
class Icon {
|
class Icon {
|
||||||
|
|
||||||
//>Section> get_url
|
//>Section> get_url
|
||||||
function get_url ($ext, $size, $type) {
|
function get_url ($file, $size, $type, $thumbnail=false) {
|
||||||
//TODO enable thumbnail support using phpThumbs
|
|
||||||
global $config;
|
global $config;
|
||||||
if ( $size == 'large' || $size == 'big' ) {
|
if ( $size == 'large' || $size == 'big' ) {
|
||||||
$size = $config->icons_large;
|
$size = $config->icons_large;
|
||||||
} else {
|
} else {
|
||||||
$size = $config->icons_small;
|
$size = $config->icons_small;
|
||||||
}
|
}
|
||||||
|
$ext = ( preg_match("/.*\.(.*)/", $file, $ext) ) ? $ext[1] : '' ;
|
||||||
$icons_path = ICONS_PATH.$size.'/';
|
$icons_path = ICONS_PATH.$size.'/';
|
||||||
$icons_url = ICONS_URL.$size.'/';
|
$icons_url = ICONS_URL.$size.'/';
|
||||||
if ( $type == 'file' ) {
|
if ( $type == 'file' ) {
|
||||||
if ( file_exists($icons_path.$ext.$config->icons_ext) ) {
|
if ( preg_match("/jpg|jpeg|png/", $ext) && $thumbnail ) {
|
||||||
|
return DLIST_URL.'thumb.php?src='.urlencode(DIR_URL.$file).'&w=48&h=48';
|
||||||
|
} elseif ( file_exists($icons_path.$ext.$config->icons_ext) ) {
|
||||||
return $icons_url.$ext.$config->icons_ext;
|
return $icons_url.$ext.$config->icons_ext;
|
||||||
} else {
|
} else {
|
||||||
return $icons_url.'_file'.$config->icons_ext;
|
return $icons_url.'_file'.$config->icons_ext;
|
||||||
@@ -58,6 +60,16 @@ class Icon {
|
|||||||
}
|
}
|
||||||
return ICONS_URL.$size.'/_parent'.$config->icons_ext;
|
return ICONS_URL.$size.'/_parent'.$config->icons_ext;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//>Section> is_image
|
||||||
|
function is_image ($file) {
|
||||||
|
if ( preg_match("/.*\.(jpg|jpeg|png|gif|bmp)/", $file) ) {
|
||||||
|
return true;
|
||||||
|
} elseif ( preg_match("/jpg|jpeg|png|gif|bmp/", $file) ) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
//> class.end
|
//> class.end
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -9,5 +9,9 @@ small = 16x16
|
|||||||
; Large icons...
|
; Large icons...
|
||||||
large = 48x48
|
large = 48x48
|
||||||
|
|
||||||
|
; Large icon sizes, used to deterim thumbnails sizes to match icons
|
||||||
|
large_w = 48
|
||||||
|
large_h = 48
|
||||||
|
|
||||||
; File extension of icon files
|
; File extension of icon files
|
||||||
ext = .gif
|
ext = .gif
|
||||||
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
||||||
dList v2.1.4 beta
|
dList v2.2.0 beta
|
||||||
|
|
||||||
Copyright © 2006 Jim Myhrberg. All rights reserved.
|
Copyright © 2006 Jim Myhrberg. All rights reserved.
|
||||||
zynode@gmail.com
|
zynode@gmail.com
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ class lang {
|
|||||||
|
|
||||||
// Language settings
|
// Language settings
|
||||||
var $_language = 'english'; // local language name ("svenska" for swedish)...
|
var $_language = 'english'; // local language name ("svenska" for swedish)...
|
||||||
var $_version = '1.0.4';
|
var $_version = '1.0.5';
|
||||||
|
|
||||||
|
|
||||||
// Locale settings
|
// Locale settings
|
||||||
@@ -18,6 +18,7 @@ class lang {
|
|||||||
var $name = 'Name';
|
var $name = 'Name';
|
||||||
var $size = 'Size';
|
var $size = 'Size';
|
||||||
var $mtime = 'Date Modified';
|
var $mtime = 'Date Modified';
|
||||||
|
var $atime = 'Last Accessed';
|
||||||
var $perms = 'Permissions';
|
var $perms = 'Permissions';
|
||||||
var $chmod = 'CHMOD';
|
var $chmod = 'CHMOD';
|
||||||
var $owner = 'Owner';
|
var $owner = 'Owner';
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ class lang {
|
|||||||
|
|
||||||
// Language settings
|
// Language settings
|
||||||
var $_language = 'svenska'; // local language name ("svenska" for swedish)...
|
var $_language = 'svenska'; // local language name ("svenska" for swedish)...
|
||||||
var $_version = '1.0.4';
|
var $_version = '1.0.5';
|
||||||
|
|
||||||
|
|
||||||
// Locale settings
|
// Locale settings
|
||||||
@@ -18,6 +18,7 @@ class lang {
|
|||||||
var $name = 'Namn';
|
var $name = 'Namn';
|
||||||
var $size = 'Storlek';
|
var $size = 'Storlek';
|
||||||
var $mtime = 'Datum Ändrad';
|
var $mtime = 'Datum Ändrad';
|
||||||
|
var $atime = 'Sisst Öppnad'; //FIXME possibly incorrect
|
||||||
var $perms = 'Rättigheter';
|
var $perms = 'Rättigheter';
|
||||||
var $chmod = 'CHMOD';
|
var $chmod = 'CHMOD';
|
||||||
var $owner = 'Ägare';
|
var $owner = 'Ägare';
|
||||||
@@ -25,7 +26,7 @@ class lang {
|
|||||||
var $owner_id = 'Ägare ID';
|
var $owner_id = 'Ägare ID';
|
||||||
var $group_id = 'Grupp ID';
|
var $group_id = 'Grupp ID';
|
||||||
var $type = 'Typ';
|
var $type = 'Typ';
|
||||||
var $ext = 'Ext'; // incorrect translation
|
var $ext = 'Ext'; //FIXME incorrect translation
|
||||||
|
|
||||||
var $timer_string = 'Sidan genererades på %s sekunder';
|
var $timer_string = 'Sidan genererades på %s sekunder';
|
||||||
|
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ class dirList {
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
||||||
Class: dirList v2.0.6 beta
|
Class: dirList v2.0.7 beta
|
||||||
|
|
||||||
Copyright © 2006 Jim Myhrberg. All rights reserved.
|
Copyright © 2006 Jim Myhrberg. All rights reserved.
|
||||||
zynode@gmail.com
|
zynode@gmail.com
|
||||||
@@ -57,6 +57,7 @@ class dirList {
|
|||||||
'name' => 'name,mtime,size',
|
'name' => 'name,mtime,size',
|
||||||
'size' => 'size,name,mtime',
|
'size' => 'size,name,mtime',
|
||||||
'mtime' => 'mtime,name,size',
|
'mtime' => 'mtime,name,size',
|
||||||
|
'atime' => 'atime,name,size',
|
||||||
'type' => 'type,name,size,mtime',
|
'type' => 'type,name,size,mtime',
|
||||||
'ext' => 'ext,name,size,mtime',
|
'ext' => 'ext,name,size,mtime',
|
||||||
'group' => 'group,name,size,mtime',
|
'group' => 'group,name,size,mtime',
|
||||||
@@ -97,6 +98,7 @@ class dirList {
|
|||||||
foreach( $sort_by as $v ) {
|
foreach( $sort_by as $v ) {
|
||||||
if ( $v == 'size' ) $v = 'size_raw';
|
if ( $v == 'size' ) $v = 'size_raw';
|
||||||
if ( $v == 'mtime' ) $v = 'mtime_raw';
|
if ( $v == 'mtime' ) $v = 'mtime_raw';
|
||||||
|
if ( $v == 'atime' ) $v = 'atime_raw';
|
||||||
$list_key .= ( $v == 'size_raw' || $v == 'mtime' ) ? str_pad($item_details[$v], 28, '0', STR_PAD_LEFT).'|' : $item_details[$v].'|' ;
|
$list_key .= ( $v == 'size_raw' || $v == 'mtime' ) ? str_pad($item_details[$v], 28, '0', STR_PAD_LEFT).'|' : $item_details[$v].'|' ;
|
||||||
}
|
}
|
||||||
$this->list[strtolower($list_key)] = $item_details;
|
$this->list[strtolower($list_key)] = $item_details;
|
||||||
@@ -128,10 +130,13 @@ class dirList {
|
|||||||
|
|
||||||
// Last Modified
|
// Last Modified
|
||||||
$return['mtime_raw'] = filemtime($item);
|
$return['mtime_raw'] = filemtime($item);
|
||||||
|
$return['atime_raw'] = fileatime($item);
|
||||||
if ( $this->use_smartdate ) {
|
if ( $this->use_smartdate ) {
|
||||||
$return['mtime'] = $this->smartDate($return['mtime_raw'], $this->smartdate_date, $this->smartdate_time, $this->smartdate);
|
$return['mtime'] = $this->smartDate($return['mtime_raw'], $this->smartdate_date, $this->smartdate_time, $this->smartdate);
|
||||||
|
$return['atime'] = $this->smartDate($return['atime_raw'], $this->smartdate_date, $this->smartdate_time, $this->smartdate);
|
||||||
} else {
|
} else {
|
||||||
$return['mtime'] = date($this->standard_date_format, $return['mtime_raw']);
|
$return['mtime'] = date($this->standard_date_format, $return['mtime_raw']);
|
||||||
|
$return['atime'] = date($this->standard_date_format, $return['atime_raw']);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Permissions and CHMOD value
|
// Permissions and CHMOD value
|
||||||
|
|||||||
@@ -391,7 +391,7 @@ class execHandler {
|
|||||||
return $file_data;
|
return $file_data;
|
||||||
}
|
}
|
||||||
|
|
||||||
function write2file($file, $string, $mode="wb", $lock=2){
|
function write2file($file, $string, $mode="wt", $lock=2){
|
||||||
if ( !isset($file) ) return false;
|
if ( !isset($file) ) return false;
|
||||||
$fp = fopen($file, $mode);
|
$fp = fopen($file, $mode);
|
||||||
if ($fp != false) {
|
if ($fp != false) {
|
||||||
|
|||||||
203
libs/imagethumb.lib.php
Normal file
203
libs/imagethumb.lib.php
Normal file
@@ -0,0 +1,203 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
class imageThumb {
|
||||||
|
|
||||||
|
/*
|
||||||
|
|
||||||
|
Class: image v0.2 beta
|
||||||
|
|
||||||
|
Copyright © 2006 Jim Myhrberg. All rights reserved.
|
||||||
|
zynode@gmail.com
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
// ==============================================
|
||||||
|
// ----- [ Configuration ] ----------------------
|
||||||
|
// ==============================================
|
||||||
|
|
||||||
|
var $jpg_quality = 85;
|
||||||
|
|
||||||
|
var $cache_dir = 'cache/images/';
|
||||||
|
var $cache_validity = 60; // days
|
||||||
|
var $clean_cache = 0; // hours
|
||||||
|
|
||||||
|
var $output_format;
|
||||||
|
|
||||||
|
var $src_file;
|
||||||
|
var $image;
|
||||||
|
var $type;
|
||||||
|
var $last_modified;
|
||||||
|
var $target_w;
|
||||||
|
var $target_h;
|
||||||
|
var $error = false;
|
||||||
|
var $last_clean_file = 'imagethumb_cleanup';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
function imageThumb ($src=false) {
|
||||||
|
if ( !empty($src) ) $this->load($src);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// ==============================================
|
||||||
|
// ----- [ Public Functions ] -------------------
|
||||||
|
// ==============================================
|
||||||
|
|
||||||
|
|
||||||
|
function quick ($file, $width, $height, $quality=false) {
|
||||||
|
if ( !$this->check_cache($file, $width, $height) ) {
|
||||||
|
$this->load($file);
|
||||||
|
if ( $this->error == false) {
|
||||||
|
$this->resize($width, $height);
|
||||||
|
if ( !empty($quality) ) $this->jpg_quality = $quality;
|
||||||
|
$this->output();
|
||||||
|
$this->save_to_cache();
|
||||||
|
$this->destroy();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$this->clean_cache();
|
||||||
|
}
|
||||||
|
|
||||||
|
function load ($file) {
|
||||||
|
if ( is_readable($file) && preg_match("/.*\.(jpg|jpeg|png)/i", $file, $type) ) {
|
||||||
|
$this->type = $type = $type[1];
|
||||||
|
$this->image = ( $type == 'png' ) ? imagecreatefrompng($file) : imagecreatefromjpeg($file) ;
|
||||||
|
$this->src_file = $file;
|
||||||
|
$this->last_modified = filemtime($file);
|
||||||
|
} else { $this->error = true; return false; }
|
||||||
|
}
|
||||||
|
|
||||||
|
function resize ($width=null, $height=null, $onlydown=true, $keepratio=true) {
|
||||||
|
if ( $width != null || $height != null ) {
|
||||||
|
$src_w = imageSX($this->image);
|
||||||
|
$src_h = imageSY($this->image);
|
||||||
|
if ( $width == null ) $width = 5000;
|
||||||
|
if ( $height == null ) $height = 5000;
|
||||||
|
$size = $this->resize_dimensions($src_w, $src_h, $width, $height, $onlydown, $keepratio);
|
||||||
|
$image = imagecreatetruecolor($size['w'], $size['h']);
|
||||||
|
imagecopyresampled($image, $this->image, 0, 0, 0, 0, $size['w'], $size['h'], $src_w, $src_h);
|
||||||
|
$this->image = $image;
|
||||||
|
$this->target_w = $width;
|
||||||
|
$this->target_h = $height;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function output ($file=null) {
|
||||||
|
$type = ( empty($this->output_format) ) ? $this->type : $this->output_format ;
|
||||||
|
if ( $type == 'png' ) {
|
||||||
|
header('Content-type: image/png');
|
||||||
|
header('Content-disposition: image; filename="'.basename($this->src_file).'"');
|
||||||
|
( empty($file) ) ? imagepng($this->image) : imagepng($this->image, $file) ;
|
||||||
|
} else {
|
||||||
|
header('Content-type: image/jpeg');
|
||||||
|
header('Content-disposition: image; filename="'.basename($this->src_file).'"');
|
||||||
|
imagejpeg($this->image, $file, $this->jpg_quality);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function destroy () {
|
||||||
|
imagedestroy($this->image);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Caching Functions
|
||||||
|
|
||||||
|
function save_to_cache () {
|
||||||
|
if ( !preg_match("/\/$/", $this->cache_dir) ) $this->cache_dir .= '/';
|
||||||
|
if ( is_writable($this->cache_dir) ) {
|
||||||
|
$filename = 'imgt_';
|
||||||
|
$string = $this->src_file.$this->last_modified;
|
||||||
|
if ( !empty($this->target_w) && !empty($this->target_h)) $string .= $this->target_w.$this->target_h;
|
||||||
|
$filename .= md5($string);
|
||||||
|
$filename .= '.'.$this->type;
|
||||||
|
if( !file_exists($filename) ) {
|
||||||
|
if ( $this->type == 'png' ) {
|
||||||
|
imagepng($this->image, $this->cache_dir.$filename);
|
||||||
|
} else {
|
||||||
|
imagejpeg($this->image, $this->cache_dir.$filename);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function check_cache ($file, $target_w=null, $target_h=null) {
|
||||||
|
if ( is_readable($file) ) {
|
||||||
|
$ext = preg_replace("/.*\.(.*)/", "$1", $file);
|
||||||
|
$filename = 'imgt_';
|
||||||
|
$string = $file.filemtime($file);
|
||||||
|
if ( !empty($target_w) && !empty($target_h) ) $string .= $target_w.$target_h;
|
||||||
|
$filename .= md5($string);
|
||||||
|
$filename .= '.'.$ext;
|
||||||
|
if ( is_readable($this->cache_dir.$filename) ) {
|
||||||
|
( $ext == 'png' ) ? header('Content-type: image/png') : header('Content-type: image/jpeg');
|
||||||
|
header('Content-disposition: image; filename="'.basename($this->src_file).'"');
|
||||||
|
echo $this->rfile($this->cache_dir.$filename);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
function clean_cache () {
|
||||||
|
if ( is_readable($this->cache_dir.$this->last_clean_file) ) {
|
||||||
|
$last_clean = $this->rfile($this->cache_dir.$this->last_clean_file);
|
||||||
|
} else { $last_clean = 0; }
|
||||||
|
|
||||||
|
$clean_cache = $this->clean_cache * 3600;
|
||||||
|
$cache_validity = $this->cache_validity * 86400;
|
||||||
|
if ( time() > ($last_clean + $clean_cache) ) {
|
||||||
|
$this->write2file($this->cache_dir.$this->last_clean_file, time());
|
||||||
|
$glob = glob($this->cache_dir.'*');
|
||||||
|
foreach( $glob as $key => $value ) {
|
||||||
|
if ( preg_match("/(?:.*\/|)(imgt_.*?\.(jpg|jpeg|png))/i", $value) && (fileatime($value) + $cache_validity) < time() ) {
|
||||||
|
unlink($value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// ==============================================
|
||||||
|
// ----- [ Internal Functions ] -----------------
|
||||||
|
// ==============================================
|
||||||
|
|
||||||
|
|
||||||
|
function rfile ($file){
|
||||||
|
if (!isset($file)) return false;
|
||||||
|
if (is_file($file)) {
|
||||||
|
if (!($fh = fopen($file,'r'))) return false;
|
||||||
|
$file_data = fread($fh, filesize($file));
|
||||||
|
fclose($fh);
|
||||||
|
} else { return false; }
|
||||||
|
return $file_data;
|
||||||
|
}
|
||||||
|
|
||||||
|
function write2file($file, $string, $mode="wt", $lock=2){
|
||||||
|
if ( !isset($file) ) return false;
|
||||||
|
$fp = fopen($file, $mode);
|
||||||
|
if ($fp != false) {
|
||||||
|
flock($fp,$lock);
|
||||||
|
$re = fwrite($fp,$string);
|
||||||
|
$re2 = fclose($fp);
|
||||||
|
if ($re != false && $re2 != false) return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
function resize_dimensions ($src_w, $src_h, $w, $h, $onlydown=true, $keepratio=true) {
|
||||||
|
$img_w = ( $w >= $src_w && $onlydown ) ? $src_w : $w ;
|
||||||
|
$img_h = ( $h >= $src_h && $onlydown ) ? $src_h : $h ;
|
||||||
|
|
||||||
|
if ( $keepratio ) {
|
||||||
|
$ratio = $src_w / $src_h;
|
||||||
|
if ( $ratio > ($img_w / $img_h) ) {
|
||||||
|
$img_h = $src_h / ($src_w / $img_w);
|
||||||
|
} elseif ( $ratio < ($img_w / $img_h) ) {
|
||||||
|
$img_w = $src_w / ($src_h / $img_h);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return array('w'=>$img_w, 'h'=>$img_h);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
?>
|
||||||
@@ -31,8 +31,12 @@ if(!preg_match("/\/$/", $dir_url)) $redirect = '/';
|
|||||||
if ( empty($redirect) ) {
|
if ( empty($redirect) ) {
|
||||||
|
|
||||||
// path lookup
|
// path lookup
|
||||||
$dir_path = apache_lookup_uri($dir_url);
|
if ( function_exists('apache_lookup_uri') ) {
|
||||||
$dir_path = ( is_array($dir_path) ) ? $dir_path['filename'] : $dir_path->filename ;
|
$dir_path = apache_lookup_uri($dir_url);
|
||||||
|
$dir_path = ( is_array($dir_path) ) ? $dir_path['filename'] : $dir_path->filename ;
|
||||||
|
} else {
|
||||||
|
$dir_path = $_SERVER['DOCUMENT_ROOT'].$dir_url;
|
||||||
|
}
|
||||||
if(!preg_match("/\/$/", $dir_path)) $dir_path .= '/';
|
if(!preg_match("/\/$/", $dir_path)) $dir_path .= '/';
|
||||||
|
|
||||||
// check for index files and redirect if found
|
// check for index files and redirect if found
|
||||||
|
|||||||
@@ -13,7 +13,7 @@
|
|||||||
<? endif ?>
|
<? endif ?>
|
||||||
<? foreach ($dlist->list as $key => $item): ?>
|
<? foreach ($dlist->list as $key => $item): ?>
|
||||||
<tr>
|
<tr>
|
||||||
<td class="icon"><a href="<?=DIR_URL.$item['name']?><? if($item['type'] == 'dir') echo '/'; ?>"><img src="<?=Icon::get_url($item['ext'], 'small', $item['type'])?>" alt="icon" /></a></td>
|
<td class="icon"><a href="<?=DIR_URL.$item['name']?><? if($item['type'] == 'dir') echo '/'; ?>"><img src="<?=Icon::get_url($item['name'], 'small', $item['type'])?>" alt="icon" /></a></td>
|
||||||
<? foreach ($fields as $key => $value):
|
<? foreach ($fields as $key => $value):
|
||||||
if ($key == 'name'):?><td class="name"><a href="<?=DIR_URL.$item['name']?><? if($item['type'] == 'dir') echo '/'; ?>"><?=$item['name']?></a></td>
|
if ($key == 'name'):?><td class="name"><a href="<?=DIR_URL.$item['name']?><? if($item['type'] == 'dir') echo '/'; ?>"><?=$item['name']?></a></td>
|
||||||
<? else: ?><td class="<?=$key?>"><?=$item[$key]?></td><? endif ?><? endforeach ?>
|
<? else: ?><td class="<?=$key?>"><?=$item[$key]?></td><? endif ?><? endforeach ?>
|
||||||
|
|||||||
@@ -6,10 +6,10 @@
|
|||||||
</div>
|
</div>
|
||||||
<ul>
|
<ul>
|
||||||
<? if ( !$is_root ): ?>
|
<? if ( !$is_root ): ?>
|
||||||
<li><a href="../"><img src="<?=Icon::get_parent('large')?>" alt="" /><p class="name">..</p><p class="info"><?=$lang->parent_dir?></p></a></li>
|
<li><a href="../"><p class="icon"><img src="<?=Icon::get_parent('large')?>" alt="" /></p><p class="name">..</p><p class="info"><?=$lang->parent_dir?></p></a></li>
|
||||||
<? endif ?>
|
<? endif ?>
|
||||||
<? foreach ($dlist->list as $key => $item): $info = ($item['type'] == 'file') ? $item['size'] : $item['mtime'] ;?>
|
<? foreach ($dlist->list as $key => $item): $info = ($item['type'] == 'file') ? $item['size'] : $item['mtime'] ;?>
|
||||||
<li><a href="<?=DIR_URL.$item['name']?><? if($item['type'] == 'dir') echo '/'; ?>"><img src="<?=Icon::get_url($item['ext'], 'large', $item['type'])?>" alt="" /><p class="name"><?=$item['name']?></p><p class="info"><?=$info?></p></a></li>
|
<li><a href="<?=DIR_URL.$item['name']?><? if($item['type'] == 'dir') echo '/'; ?>"><p class="icon"><img src="<?=Icon::get_url($item['name'], 'large', $item['type'], true)?>" alt="" /></p><p class="name"><?=$item['name']?></p><p class="info"><?=$info?></p></a></li>
|
||||||
<? endforeach ?>
|
<? endforeach ?>
|
||||||
</ul>
|
</ul>
|
||||||
</td></tr></table>
|
</td></tr></table>
|
||||||
@@ -5,11 +5,7 @@
|
|||||||
<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
|
<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
|
||||||
<title><?=$lang->index_of.' '.DIR_URL?></title>
|
<title><?=$lang->index_of.' '.DIR_URL?></title>
|
||||||
<script src="<?=TPL_URL?>javascripts/main.js" type="text/javascript" language="javascript" charset="utf-8"></script>
|
<script src="<?=TPL_URL?>javascripts/main.js" type="text/javascript" language="javascript" charset="utf-8"></script>
|
||||||
<style type="text/css" media="screen">
|
<link rel="stylesheet" href="<?=TPL_URL?>stylesheets/screen.css.php?dir=<?=TPL_URL?>" type="text/css" media="screen" title="screen" charset="utf-8" />
|
||||||
/* <![CDATA[ */
|
|
||||||
<? include(TPL_PATH.'stylesheets/screen.css') ?>
|
|
||||||
/* ]]> */
|
|
||||||
</style>
|
|
||||||
</head>
|
</head>
|
||||||
<body id="index">
|
<body id="index">
|
||||||
<div id="header">
|
<div id="header">
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
<?php header('Content-type: text/css;'); ( empty($dir) && !empty($_REQUEST['dir']) ) ? $dir = $_REQUEST['dir'] : $dir = '' ; ?>
|
||||||
BODY {
|
BODY {
|
||||||
background-color: #FFF;
|
background-color: #FFF;
|
||||||
color: #000;
|
color: #000;
|
||||||
@@ -21,8 +22,7 @@ BODY {
|
|||||||
#files {
|
#files {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
/* <?=$dir?> */
|
||||||
|
|
||||||
/* Details View (#list) */
|
/* Details View (#list) */
|
||||||
#list {
|
#list {
|
||||||
background-color: #DDD;
|
background-color: #DDD;
|
||||||
@@ -48,6 +48,9 @@ BODY {
|
|||||||
#list TH.mtime {
|
#list TH.mtime {
|
||||||
width: 170px;
|
width: 170px;
|
||||||
}
|
}
|
||||||
|
#list TH.atime {
|
||||||
|
width: 170px;
|
||||||
|
}
|
||||||
#list TH.perms {
|
#list TH.perms {
|
||||||
width: 100px;
|
width: 100px;
|
||||||
}
|
}
|
||||||
@@ -75,6 +78,9 @@ BODY {
|
|||||||
#list TD.mtime {
|
#list TD.mtime {
|
||||||
text-align: right;
|
text-align: right;
|
||||||
}
|
}
|
||||||
|
#list TD.atime {
|
||||||
|
text-align: right;
|
||||||
|
}
|
||||||
#list TD.perms {
|
#list TD.perms {
|
||||||
text-align: right;
|
text-align: right;
|
||||||
}
|
}
|
||||||
@@ -118,6 +124,12 @@ BODY {
|
|||||||
text-align: center;
|
text-align: center;
|
||||||
vertical-align: top;
|
vertical-align: top;
|
||||||
}
|
}
|
||||||
|
#icons LI .icon {
|
||||||
|
display: block;
|
||||||
|
padding: 0px;
|
||||||
|
margin: 0px;
|
||||||
|
height: 48px;
|
||||||
|
}
|
||||||
#icons LI .name {
|
#icons LI .name {
|
||||||
display: block;
|
display: block;
|
||||||
font-size: 12px;
|
font-size: 12px;
|
||||||
26
thumb.php
Normal file
26
thumb.php
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
require_once('libs/imagethumb.lib.php');
|
||||||
|
|
||||||
|
$src = ( !empty($_GET['src']) ) ? $_GET['src'] : false ;
|
||||||
|
$w = ( !empty($_GET['w']) && preg_match("/[0-9]{1,4}/", $_GET['w']) ) ? $_GET['w'] : null ;
|
||||||
|
$h = ( !empty($_GET['h']) && preg_match("/[0-9]{1,4}/", $_GET['w']) ) ? $_GET['h'] : null ;
|
||||||
|
$q = ( !empty($_GET['q']) ) ? $_GET['q'] : false ;
|
||||||
|
|
||||||
|
//TODO load sizes from config instead of from $_GET vars for security reasons...
|
||||||
|
|
||||||
|
if ( preg_match("/^\//", $src) ) {
|
||||||
|
if ( function_exists('apache_lookup_uri') ) {
|
||||||
|
$file = apache_lookup_uri($src);
|
||||||
|
$file = ( is_array($file) ) ? $file['filename'] : $file->filename ;
|
||||||
|
} else {
|
||||||
|
$file = $_SERVER['DOCUMENT_ROOT'].$src;
|
||||||
|
}
|
||||||
|
} else $file = $src;
|
||||||
|
|
||||||
|
$image = new imageThumb();
|
||||||
|
$image->cache_dir = 'cache/thumbnails/';
|
||||||
|
$image->quick($file, $w, $h, $q);
|
||||||
|
|
||||||
|
|
||||||
|
?>
|
||||||
Reference in New Issue
Block a user