Code/Resource
Windows Develop
Linux-Unix program
Internet-Socket-Network
Web Server
Browser Client
Ftp Server
Ftp Client
Browser Plugins
Proxy Server
Email Server
Email Client
WEB Mail
Firewall-Security
Telnet Server
Telnet Client
ICQ-IM-Chat
Search Engine
Sniffer Package capture
Remote Control
xml-soap-webservice
P2P
WEB(ASP,PHP,...)
TCP/IP Stack
SNMP
Grid Computing
SilverLight
DNS
Cluster Service
Network Security
Communication-Mobile
Game Program
Editor
Multimedia program
Graph program
Compiler program
Compress-Decompress algrithms
Crypt_Decrypt algrithms
Mathimatics-Numerical algorithms
MultiLanguage
Disk/Storage
Java Develop
assembly language
Applications
Other systems
Database system
Embeded-SCM Develop
FlashMX/Flex
source in ebook
Delphi VCL
OS Develop
MiddleWare
MPI
MacOS develop
LabView
ELanguage
Software/Tools
E-Books
Artical/Document
filelist_file.php
Package: Generateur_v13.rar [view]
Upload User: feiyaoda
Upload Date: 2016-11-21
Package Size: 9556k
Code Size: 14k
Category:
WEB Mail
Development Platform:
PHP
- <body bgcolor='#c3daf9'>
- <?php
- include ('config.php');
- $order_key = $_GET['order_key'];
- if (!$order_key) $order_key = $_INI['order_default_key'];
- $order_way = $_GET['order_way'];
- if (!$order_way) $order_way = $_INI['order_default_way'];
- if ($order_way == 'ASC')
- {
- $order_icon = './icones/ASC.png';
- $order_onclick = 'DESC';
- }
- else
- {
- $order_icon = './icones/DESC.png';
- $order_onclick = 'ASC';
- }
- // caching
- $use_cache_name = 'file-'.md5($_GET['path']).'-'.$order_key.'-'.$order_way.'-'.$_INI['limit_name_length'];
- include('pat_cache_begin.php');
- /******************************************************************
- *
- * FILE LISTING SCRIPT
- *
- ******************************************************************/
- include ('filelist_common.php');
- include ('file_type.php');
- include ('./extensions/AudioFile.class.php');
- $current_target_type = 'file';
- include('filelist_common_header.php');
- /******************************************************************
- *
- * initialising variables
- *
- ******************************************************************/
- // icon size : max width and height
- $icon_size = $_INI['icon_size'];
- // total size of all files in this folder
- $dirsize = 0;
- // arrays corresponding to file and folder for listing
- $filelist = array();
- $folderlist = array();
- // total of music in this folder in seconds
- $total_of_music_length = 0;
- // this parameter is increased each time a line is rendered. for javascript selection of elements
- $element_counter = 0;
- /******************************************************************
- *
- * Functions
- *
- ******************************************************************/
- /*
- * this function return a human readable information
- * about a kind of file. it's an array with named keys
- */
- function get_file_additionnal_info($info_type,$path)
- {
- $ret = array();
- switch ($info_type)
- {
- case 'image' :
- {
- // this function doesn't need gd lib to be installed
- list($w,$h) = getimagesize($path);
- $ret['info'] = $w.'w x '.$h.'h';
- break;
- }
- case 'text' :
- {
- break;
- }
- case 'sound' :
- {
- //uses AudioFile.class.php
- $AF = new AudioFile;
- $AF->loadFile($path);
- $alt_str = 'id : '.$AF->wave_id."n";
- $alt_str .= 'type : '.$AF->wave_type."n";
- $alt_str .= 'compression : '.$AF->wave_compression."n";
- $alt_str .= 'channels : '.$AF->wave_channels."n";
- $alt_str .= 'framerate : '.$AF->wave_framerate."n";
- $alt_str .= 'byterate : '.$AF->wave_byterate."n";
- $alt_str .= 'bits : '.$AF->wave_bits."n";
- $alt_str .= 'length : '.$AF->wave_length."n";
- // this is this file length in seconds
- $ret['music_length'] = $AF->wave_length;
- if ($AF->id3_tag)
- {
- $alt_str .= "nID3 Tag :n";
- $alt_str .= 'title : '.$AF->id3_title."n";
- $alt_str .= 'artist : '.$AF->id3_artist."n";
- $alt_str .= 'album : '.$AF->id3_album."n";
- $alt_str .= 'year : '.$AF->id3_year."n";
- $alt_str .= 'comment : '.$AF->id3_comment."n";
- $alt_str .= 'genre : '.$AF->id3_genre."n";
- }
- $ret['info'] = '<acronym title="'.$alt_str.'">Infos</acronym>';
- break;
- }
- default:
- {
- //$fileinfo .= "unknownn";
- break;
- }
- }
- return $ret;
- }
- /*
- * returns the url to perform action link to affected action
- *
- */
- function get_url_for_action($action,$path)
- {
- switch ($action)
- {
- case 'php_highlight' :
- {
- $actionurl = 'view_source.php?hltype=php&path='.$path;
- $target = '_blank';
- break;
- }
- case 'xml_highlight' :
- {
- $actionurl = 'view_source.php?hltype=xml&path='.$path;
- $target = '_blank';
- break;
- }
- case 'view' :
- {
- $actionurl = $path;
- $target = '_blank';
- break;
- }
- default:
- {
- $actionurl = 'pat_default_action.php?target_file='.$path;
- break;
- }
- }
- return array($actionurl,$target);
- }
- /******************************************************************
- *
- * Rendering html header and javascript
- *
- ******************************************************************/
- if (FALSE == is_dir($_GET['path']))
- {
- echo "<body bgcolor='#CFE3E3'><p class="error_box">ERROR, there is no folder at that place. url : ".$_SERVER["REQUEST_URI"]."n";
- exit;
- }
- $dp = opendir($_GET['path']);
- if (FALSE == $dp)
- {
- echo "<body bgcolor='#CFE3E3'><p class="error_box">ERROR, impossible to reach this folder. check php user permission on it</p>n";
- exit;
- }
- /******************************************************************
- *
- * We read entire folder and set for each element all values
- * needed to render or to sort it
- *
- ******************************************************************/
- while (false !== ($file = readdir($dp)))
- {
- if ('.' == $file) continue;
- if ('..' == $file) continue;
- // ALL THIS PARAMETERS WILL BE SET IN $filelist or $folderlist arrays WITH THE SAME NAME
- // relative path to object for use in php functions
- $path = $_GET['path'].$file;
- // this parameter is used in form to store in independent *slashes() functions
- // path to current file
- $url = urlencode($url);
- // last modification time
- $file_mod_time = filemtime($path);
- // permissions
- $file_perms = fileperms($_GET['path'].$file);
- // size
- $filesize = '';
- // extension of file if it's one. used in filetype.php to know what to do with
- // this kind of file
- $ext = '';
- // icon related to this kind of file
- $icon = '';
- // what to display when mouse is over icon
- $icon_alt = '';
- // type is the one get from filetype.php
- $type = '';
- // name is what will be displayed on screen for this file
- $name = '';
- // on click : what to do?
- $actionurl = '';
- // on click : where to?
- $target = '';
- // additionnal informations about file (try on a sound file like a mp3 ;)
- $fileinfo = '';
- if (is_dir($_GET['path'].$file))
- {
- $icon = $_INT['theme_path'].'icones/folder.png';
- $type = 'Dossier';
- $name = $file;
- $actionurl = 'filelist_file.php?path='.$_GET['path'].$file.'/';
- $folderlist[$path]['path'] = $path;
- $folderlist[$path]['url'] = $url;
- $folderlist[$path]['file_mod_time'] = $file_mod_time;
- $folderlist[$path]['file_perms'] = $file_perms;
- $folderlist[$path]['filesize'] = $filesize;
- $folderlist[$path]['ext'] = $ext;
- $folderlist[$path]['icon'] = $icon;
- $folderlist[$path]['icon_alt'] = $icon_alt;
- $folderlist[$path]['type'] = $type;
- $folderlist[$path]['name'] = $name;
- $folderlist[$path]['actionurl'] = $actionurl;
- $folderlist[$path]['fileinfo'] = $fileinfo;
- }
- else
- {
- // file size
- $filesize = filesize($path);
- // adding size of this file to total folder size
- $dirsize += $filesize;
- // getting extensions
- $parts = explode('.',$file);
- $ext = strtolower($parts[(count($parts)-1)]);
- // NAME parameter
- // get the filename with or without extension and replaces under score with spaces
- if (FALSE != $_INI['leave_name_extension'])
- {
- $name = $file;
- }
- else
- {
- unset($parts[(count($parts)-1)]);
- $name = implode(' ',$parts);
- $name = str_replace('_',' ',$name);
- }
- // getting settings for this kind of file (in filetype.php)
- if (is_array($file_type[$ext]))
- {
- $type = $file_type[$ext]['name'];
- $icon = $_INT['theme_path'].'icones/'.$file_type[$ext]['icon'];
- $action = $file_type[$ext]['action'];
- $info_type = $file_type[$ext]['type'];
- list($actionurl,$target) = get_url_for_action($action,$path);
- }
- else
- {
- // default action when we got nothing
- $actionurl = './pat_default_action.php?target_file='.$_GET['path'].$file;
- $type = '';
- $icon = '';
- $action = '';
- }
- // over-ridding with default values if needed
- if ('' == $type)
- $type = $ext.' Fichier';
- if (!is_file($icon))
- {
- $icon = $_INT['theme_path'].'icones/unknown.png';
- }
- // for each type of file if a specific information is usable then we draw it
- if ($_INI['show_fileinfo'])
- $file_infos = get_file_additionnal_info($info_type,$_GET['path'].$file);
- $fileinfo = $file_infos['info'];
- if ($file_infos['music_length']) $total_of_music_length += $file_infos['music_length'];
- $filelist[$path]['path'] = $path;
- $filelist[$path]['url'] = $url;
- $filelist[$path]['file_mod_time'] = $file_mod_time;
- $filelist[$path]['file_perms'] = $file_perms;
- $filelist[$path]['filesize'] = $filesize;
- $filelist[$path]['ext'] = $ext;
- $filelist[$path]['icon'] = $icon;
- $filelist[$path]['icon_alt'] = $icon_alt;
- $filelist[$path]['type'] = $type;
- $filelist[$path]['name'] = $name;
- $filelist[$path]['actionurl'] = $actionurl;
- $filelist[$path]['target'] = $target;
- $filelist[$path]['fileinfo'] = $fileinfo;
- }
- }
- closedir($dp);
- /******************************************************************
- *
- * Rendering html body
- *
- ******************************************************************/
- echo "<form name="data_container_element_table">n";
- echo "<table cellpadding=2 cellspacing=0>n";
- echo "<tr>n";
- // rerender
- foreach ($_GET as $key => $val) $get_line .= $key.'='.$val.'&';
- $get_line .= 'cache-re-render=1';
- $rerender = "<a href="".basename($_SERVER["SCRIPT_FILENAME"])."?$get_line"><img src="".$_INT['theme_path']."icones/refresh.png" width=16 height=16 border=0></a>n";
- //$order_icon$order_onclick
- $classes['name'] = 'colomn_header';
- $classes['type'] = 'colomn_header';
- $classes['filesize'] = 'colomn_header';
- $classes['mod'] = 'colomn_header';
- $classes[$order_key] = 'colomn_header_ordered';
- $order_link = "<a href="filelist_file.php?order_way=$order_onclick&order_key=name&path=".$_GET['path']."">n";
- $order_link .= "<img src="".$_INT['theme_path']."$order_icon" border="O"></a>n";
- echo " <th class="".$classes['name']."" align="left" colspan=2>$rerender$order_link Nom</th>n";
- // size
- if ($_INI['show_size'])
- {
- $order_link = "<a href="filelist_file.php?order_way=$order_onclick&order_key=filesize&path=".$_GET['path'].""><img src="".$_INT['theme_path']."$order_icon" border="O"></a>n";
- echo " <th class="".$classes['filesize']."" align="right">$order_link Taille</th>n";
- }
- //type
- if ($_INI['show_filetype'])
- {
- $order_link = "<a href="filelist_file.php?order_way=$order_onclick&order_key=type&path=".$_GET['path'].""><img src="".$_INT['theme_path']."$order_icon" border="O"></a>n";
- echo " <th class="".$classes['type']."">$order_link Type</th>n";
- }
- // file additionnal informations
- if ($_INI['show_fileinfo'])
- {
- echo " <th class="colomn_header">Informations</th>n";
- }
- // lastmod
- if ($_INI['show_lastmod'])
- {
- $order_link = "<a href="filelist_file.php?order_way=$order_onclick&order_key=mod&path=".$_GET['path'].""><img src="".$_INT['theme_path']."$order_icon" border="O"></a>n";
- echo " <th class="".$classes['mod']."">$order_link Derni鑢e Modification</th>n";
- }
- // file rights
- if ($_INI['show_rights'])
- echo " <th class="colomn_header">Rights</th>n";
- echo "</tr>n";
- // 1. merging
- if($_INI['mix_files_and_folders'])
- {
- $full_list = array_merge($folderlist,$filelist);
- if (is_array($full_list))
- {
- $array_to_render = adv_sort($full_list);
- render_list($array_to_render);
- }
- }
- else
- {
- if (is_array($folderlist))
- {
- $array_to_render = adv_sort($folderlist);
- render_list($array_to_render);
- }
- if (is_array($filelist))
- {
- $array_to_render = adv_sort($filelist);
- render_list($array_to_render);
- }
- }
- echo "</table>n";
- /******************************************************************
- *
- * Rendering html footer
- *
- ******************************************************************/
- echo "<hr>n";
- echo "<body bgcolor='#E1E4FA'><table border=0>n";
- echo " <tr><th>Chemin</th><td>".realpath_alternative($_GET['path'],true)."</td></tr>n";
- echo " <tr><th>Dossiers</th><td>".count($folderlist)."</td></tr>n";
- echo " <tr><th>fichiers</th><td>".count($filelist)."</td></tr>n";
- echo " <tr><th>Taille total</th><td>".FormatTailleFichier($dirsize,'octets')."</td></tr>n";
- if ($total_of_music_length)
- echo "<tr><th>Total music time</th><td>".timetohms($total_of_music_length)."</b> ($total_of_music_length)</td>n";
- echo "</table>n";
- echo "<input type="hidden" name="total_elements" value="".$element_counter."">n";
- echo "</form>n";
- /******************************************************************
- *
- * storing in cache
- *
- ******************************************************************/
- include('pat_cache_store.php');