Thread: [Phpcms-plugins-cvs] admin4phpCMS/modules/filemanager class.file_util.php,NONE,1.1 config.filemanage
Brought to you by:
mjahn
From: Martin J. <mj...@us...> - 2004-06-18 15:17:27
|
Update of /cvsroot/phpcms-plugins/admin4phpCMS/modules/filemanager In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28241/modules/filemanager Modified Files: class.module_filemanager.php Added Files: class.file_util.php config.filemanager.php Log Message: module filemanager and editor included Index: class.module_filemanager.php =================================================================== RCS file: /cvsroot/phpcms-plugins/admin4phpCMS/modules/filemanager/class.module_filemanager.php,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- class.module_filemanager.php 5 Jun 2004 12:44:22 -0000 1.2 +++ class.module_filemanager.php 18 Jun 2004 15:17:00 -0000 1.3 @@ -30,6 +30,9 @@ /* * $Log$ +* Revision 1.3 2004/06/18 15:17:00 mjahn +* module filemanager and editor included +* * Revision 1.2 2004/06/05 12:44:22 mjahn * separated layout-files * @@ -37,12 +40,17 @@ * several changes * */ + +/** +* Include the file-utility-class +**/ +include_once (dirname (__FILE__).'/class.file_util.php'); /** * Filemanager-class for administrative work in the filesystem * * @package admin4phpCMS * @subpackage module_filemanager -* @todo Get the class working correctly +* @uses file_editor **/ class module_filemanager extends module { @@ -51,66 +59,123 @@ // connect to actions $this->_registerAction ('doParseParam', 'parseParam'); $this->_registerAction ('doProcess', 'process'); - $this->_registerAction ('doParseMenuMain', 'getMenuMain'); - $this->_registerAction ('doParseStatusbar', 'getContentBar'); - $this->_registerAction ('doParseMenuSub', 'getMenuSub'); - $this->_registerAction ('doParseContent', 'getContent'); + $this->docroot = realpath ($_SERVER['DOCUMENT_ROOT']); + $actiondata = array ('module'=>'filemanager'); + $this->_callEvent ('CONFIG_GET', $actiondata); + $this->CONF =& $actiondata ['config']; + include_once (dirname (__FILE__).'/config.filemanager.php'); } + + /** + * @param array $actiondata + **/ function parseParam (&$actiondata) { $this->display = (isset ($actiondata['request']['moduleid']) && $actiondata['request']['moduleid'] == 'filemanager'); - $this->action = ''; + $this->viewdir = $this->viewfile = $this->editfile = $this->action = ''; if (isset ($actiondata['request']['action'])) { $this->action = $actiondata['request']['action']; } + + $this->basedir = '/'; + if (isset ($actiondata['request']['basedir'])) { + $this->basedir = $actiondata['request']['basedir']; + } + + if ($this->action == 'viewfile' && isset ($actiondata['request']['file'])) { + $this->viewfile = $actiondata['request']['file']; + } + + if ($this->action == 'viewdir' && isset ($actiondata['request']['file'])) { + $this->viewdir = $actiondata['request']['file']; + } + + if ($this->action == 'editfile' && isset ($actiondata['request']['file'])) { + $this->editfile = $actiondata['request']['file']; + } + + if (is_dir ($this->docroot.'/'.$this->basedir.'/'.$this->viewdir)) { + $this->basedir = realpath ($this->docroot.'/'.$this->basedir.'/'.$this->viewdir).'/'; + if (strpos ($this->basedir, $this->docroot) === false) { + $this->basedir = '/'; + $actiondata = array ('errortext'=>'Das Verzeichnis liegt außerhalb des zugelassenen Bereiches!'); + $this->_callEvent ('ERROR_NOTICE', $actiondata); + } else { + $this->basedir = str_replace ($this->docroot, '', $this->basedir); + } + $this->viewdir = ''; + } } + /** + * @param array $actiondata + **/ function process (&$actiondata) { $actiondata = array(); $this->_callEvent ('USER_GET_STATUS', $actiondata); $this->_USER = $actiondata; - } - - function getMenuMain (&$actiondata) { + if (!$this->_USER['isLoggedIn']) { return true; } + + $this->_registerAction ('doParseMenuMain', 'getMenuMain'); + + if (!$this->display) { + return true; + } + + + $this->_registerAction ('doParseStatusbar', 'getContentBar'); + $this->_registerAction ('doParseMenuSub', 'getMenuSub'); + switch ($this->action) { + case 'viewfile': + case 'editfile': + break; + default: + $this->_registerAction ('doParseContent', 'getFileList'); + break; + } + + } + + /** + * @param array $actiondata + **/ + function getMenuMain (&$actiondata) { $root = $actiondata['_root']; - $actiondata = array ('_type'=>'menu_main_entry', '_root'=>$root, 'name'=>'Dateimanager', 'module'=>'filemanager', '_id'=>'filemanager', '_root'=>'mainmenu', 'id'=>'', 'class'=>'', 'params'=>''); + $actiondata = array ('_type'=>'menu_main_entry', '_root'=>$root, 'name'=>'Dateimanager', 'module'=>'filemanager', '_id'=>'filemanager', '_root'=>'mainmenu'); $this->_callEvent('LAYOUT_ADD_ELEMENT', $actiondata); } + /** + * @param array $actiondata + **/ function getMenuSub (&$actiondata) { - if (!$this->_USER['isLoggedIn']) { - return true; - } + return true; - if (!$this->display) { - return true; - } - $root = $actiondata['_root']; - $actiondata = array ('_type'=>'menu_sub_entry', '_root'=>$root, 'name'=>'Dateimanager', 'module'=>'filemanager', '_id'=>'files', 'id'=>'', 'class'=>'', 'param'=>'', 'action'=>''); + $actiondata = array ('_type'=>'menu_sub_entry', '_root'=>$root, 'name'=>'Dateimanager', 'module'=>'filemanager', '_id'=>'files'); if ($this->action == '') { $actiondata['id'] = 'current'; } $this->_callEvent('LAYOUT_ADD_ELEMENT', $actiondata); - $actiondata = array ('_type'=>'menu_sub_entry', '_root'=>$root, 'name'=>'Hochladen', 'module'=>'filemanager', '_id'=>'uploads', 'action'=>'upload', 'id'=>'', 'class'=>'', 'params'=>''); + $actiondata = array ('_type'=>'menu_sub_entry', '_root'=>$root, 'name'=>'Hochladen', 'module'=>'filemanager', '_id'=>'uploads', 'action'=>'upload'); if ($this->action == 'upload') { $actiondata['id'] = 'current'; } $this->_callEvent('LAYOUT_ADD_ELEMENT', $actiondata); - $actiondata = array ('_type'=>'menu_sub_entry', '_root'=>$root, 'name'=>'Backups', 'module'=>'filemanager', '_id'=>'backups', 'action'=>'backup', 'id'=>'', 'class'=>'', 'params'=>''); + $actiondata = array ('_type'=>'menu_sub_entry', '_root'=>$root, 'name'=>'Backups', 'module'=>'filemanager', '_id'=>'backups', 'action'=>'backup'); if ($this->action == 'backup') { $actiondata['id'] = 'current'; } $this->_callEvent('LAYOUT_ADD_ELEMENT', $actiondata); - $actiondata = array ('_type'=>'menu_sub_entry', '_root'=>$root, 'name'=>'Editor', 'module'=>'filemanager', '_id'=>'editor', 'action'=>'editor', 'id'=>'', 'class'=>'', 'params'=>''); + $actiondata = array ('_type'=>'menu_sub_entry', '_root'=>$root, 'name'=>'Editor', 'module'=>'filemanager', '_id'=>'editor', 'action'=>'editor'); if ($this->action == 'editor') { $actiondata['id'] = 'current'; } @@ -118,10 +183,254 @@ } - function getContent (&$actiondata) { + /** + * @param array $actiondata + **/ + function getContentBar (&$actiondata) { } - function getContentBar (&$actiondata) { + /** + * Generates the list of folders and files in the current directory. + * + * + * @param array $actiondata + * @todo The buttons in the beginning of the line (select, edit, view) are sub-elements + * of filelist_entry. This enables the function to provide different buttons dependent + * to the file-entry. + **/ + function getFileList (&$actiondata) { + $root = $actiondata ['_root']; + $dir = $this->docroot.'/'.$this->basedir; + + if (!file_exists ($dir) || !is_dir ($dir)) { + return false; + } + + $files = $dirs = array(); + $dh = opendir ($dir); + while (false !== ($entry = readdir ($dh))) { + // skip selflink + if ($entry == '.') { + continue; + } + + // skip hidden files + if ($entry{0} == '.' && $entry{1} != '.') { + continue; + } + + // entry is file + if (is_file ($dir.'/'.$entry)) { + $files[] = $entry; + } + + // entry is directory + if (is_dir ($dir.'/'.$entry)) { + $dirs[] = $entry; + } + } + closedir ($dh); + sort ($dirs); + sort ($files); + $entries = array_merge ($dirs, $files); + unset ($files, $dirs); + $num = count ($entries); + + $actiondata = array ('_type'=>'headline', '_id'=>'headline', '_root'=>$root, + 'content'=>'Verzeichnis: '.htmlentities ($this->basedir)); + $this->_callEvent ('LAYOUT_ADD_ELEMENT', $actiondata); + + $actiondata = array ('_type'=>'ulist', '_id'=>'filelist', '_root'=>$root, 'extra'=>'id="filelist"',); + $this->_callEvent ('LAYOUT_ADD_ELEMENT', $actiondata); + + $actiondata = array ('_type'=>'filelist_entry', '_id'=>'list-0', '_root'=>'filelist', + 'extra'=>'class="header"', 'filesize'=>'Größe', 'filemtime'=>'Letzte Änderung', + 'chmod'=>'CHMOD', 'gid'=>'GID', 'uid'=>'UID'); + $this->_callEvent ('LAYOUT_ADD_ELEMENT', $actiondata); + + $actiondata = array ('_root'=>'list-0', '_id'=>'list-img-0', '_type'=>'image', + 'src'=>'modules/layout/img/empty.gif', + 'width'=>'16', 'height'=>'16', 'title'=>'', 'alt'=>'', + 'extra'=>'class="input""'); + $this->_callEvent ('LAYOUT_ADD_ELEMENT', $actiondata); + + $actiondata = array ('_root'=>'list-0', '_id'=>'list-img-1', '_type'=>'image', 'src'=>'modules/layout/img/empty.gif', + 'width'=>'16', 'height'=>'16', 'title'=>'', 'alt'=>'', 'extra'=>'class="input""'); + $this->_callEvent ('LAYOUT_ADD_ELEMENT', $actiondata); + + $actiondata = array ('_root'=>'list-0', '_id'=>'list-img-2', '_type'=>'image', 'src'=>'modules/layout/img/empty.gif', + 'width'=>'16', 'height'=>'16', 'title'=>'', 'alt'=>'', 'extra'=>'class="input"'); + $this->_callEvent ('LAYOUT_ADD_ELEMENT', $actiondata); + + // set filename + $actiondata = array ('_root'=>'list-0', '_id'=>'file0', '_type'=>'inline', 'extra'=>'class="filename""', 'content'=>'Name'); + $this->_callEvent ('LAYOUT_ADD_ELEMENT', $actiondata); + + $alternate = 1; + $sum_size = 0; + $num_files = 0; + $num_dirs = 0; + + for ($i = 0; $i < $num; $i++) { + $entry = $entries[$i]; + + // alternate the class of the list-items + if ($alternate == 3) { + $alternate = 1; + } + + // get stat of the entry + $data = stat ($dir.'/'.$entry); + + $file['uid'] = file_util::uid ($data[4]); + $file['gid'] = file_util::gid ($data[5]); + $file['filename'] = $entry; + $file['filemtime'] = strftime ('%d.%m.%Y %H:%M:%S', $data[9]); + $file['filectime'] = strftime ('%d.%m.%Y %H:%M:%S', $data[8]); + $file['fileatime'] = strftime ('%d.%m.%Y %H:%M:%S', $data[10]); + $file['filesize'] = file_util::filesize ($dir.'/'.$entry); + $file['chmod'] = array ('oct'=>file_util::fileperms($dir.'/'.$entry)); + // set file-list-item + $actiondata = array ( + '_type'=>'filelist_entry', '_id'=>'list-'.$entry, '_root'=>'filelist', 'filename'=>htmlentities ($entry), + 'filesize'=>$file['filesize'], 'fileatime'=>$file['fileatime'], 'filectime'=>$file['filectime'], + 'filemtime'=>$file['filemtime'], 'gid'=>$file['gid']['str'], 'uid'=>$file['uid']['str'], 'chmod'=>$file['chmod']['oct'], + 'extra'=>'class="line'.$alternate++.'"'); + $this->_callEvent ('LAYOUT_ADD_ELEMENT', $actiondata); + + // entry is directory + if (is_dir ($dir.'/'.$entry)) { + + $nolink = false; + + // entry is parent directory + if ($entry == '..') { + $type = 'parent'; + $actiondata = array ('_root'=>'list-'.$entry, '_id'=>'img-empty-'.$entry, '_type'=>'image', 'src'=>'modules/layout/img/empty.gif', 'width'=>'16', 'height'=>'16', 'alt'=>'', 'title'=>'', 'extra'=>'class="input" id="input""'); + $this->_callEvent ('LAYOUT_ADD_ELEMENT', $actiondata); + } else { + $num_dirs++; + $type = 'folder'; + + $actiondata = array ('_root'=>'list-'.$entry, '_id'=>'select-'.$entry, '_type'=>'form_checkbox_simple', 'id'=>'select['.$entry.']', 'name'=>'select['.$entry.']', 'value'=>'selected', 'title'=>'Auswählen', 'extra'=>'class="input"'); + $this->_callEvent ('LAYOUT_ADD_ELEMENT', $actiondata); + + if (!is_executable ($dir.'/'.$entry)) { + $type = 'folder_inactive'; + $nolink = true; + } + + if (!is_readable ($dir.'/'.$entry)) { + $type = 'folder_inactive'; + $nolink = true; + } + + if (is_link ($dir.'/'.$entry)) { + $type = 'symlink'; + } + + + } + + if ($nolink) { + // set no link for open directory + $actiondata = array ('_root'=>'list-'.$entry, '_id'=>'view-'.$entry, '_type'=>'empty', 'href'=>'?moduleid=filemanager&basedir='.$this->basedir.'&file='.$entry.'&action=viewdir'); + $this->_callEvent ('LAYOUT_ADD_ELEMENT', $actiondata); + } else { + // set link for open directory + $actiondata = array ('_root'=>'list-'.$entry, '_id'=>'view-'.$entry, '_type'=>'link', 'href'=>'?moduleid=filemanager&basedir='.$this->basedir.'&file='.$entry.'&action=viewdir', 'title'=>'Verzeichnis öffnen'); + $this->_callEvent ('LAYOUT_ADD_ELEMENT', $actiondata); + } + // set image for link + $actiondata = array ('_root'=>'view-'.$entry, '_id'=>'img-view-'.$entry, '_type'=>'image', 'src'=>'modules/layout/img/filetypes/'.$type.'.gif', 'width'=>'16', 'height'=>'16', 'alt'=>'edit', 'extra'=>'class="icon"'); + $this->_callEvent ('LAYOUT_ADD_ELEMENT', $actiondata); + + // set distance image + $actiondata = array ('_root'=>'list-'.$entry, '_id'=>'img-empty-'.$entry, '_type'=>'image', 'src'=>'modules/layout/img/empty.gif', 'width'=>'16', 'height'=>'16', 'alt'=>'', 'title'=>'', 'extra'=>'class="icon"'); + $this->_callEvent ('LAYOUT_ADD_ELEMENT', $actiondata); + + // set filename + $actiondata = array ('_root'=>'list-'.$entry, '_id'=>'file-'.$entry, '_type'=>'inline', 'extra'=>'class="filename"'); + $this->_callEvent ('LAYOUT_ADD_ELEMENT', $actiondata); + + if ($nolink) { + // set no link to filename + $actiondata = array ('_root'=>'file-'.$entry, '_id'=>'file-link-'.$entry, '_type'=>'empty', 'content'=>$entry); + $this->_callEvent ('LAYOUT_ADD_ELEMENT', $actiondata); + } else { + // set link to filename + $actiondata = array ('_root'=>'file-'.$entry, '_id'=>'file-link-'.$entry, '_type'=>'link', 'href'=>'?moduleid=filemanager&basedir='.$this->basedir.'&file='.$entry.'&action=viewdir', 'title'=>'Verzeichnis öffnen', 'content'=>$entry); + $this->_callEvent ('LAYOUT_ADD_ELEMENT', $actiondata); + } + } + + if (is_file ($dir.'/'.$entry)) { + + $num_files++; + $sum_size += $data[7]; + + $type = 'text.gif'; + foreach ($this->FILETYPES as $filetype) { + if (eregi ($filetype[0], $entry)) { + $type = $filetype[1]; + break; + } + } + if (is_link ($dir.'/'.$entry)) { + $type = 'symlink'; + } + + $editor = 'edit'; + + // insert checkbox for selecting files + $actiondata = array ('_root'=>'list-'.$entry, '_id'=>'select-'.$entry, '_type'=>'form_checkbox_simple', 'extra'=>'id="select['.$entry.']"', 'class'=>'input', 'name'=>'select['.$entry.']', 'value'=>'selected', 'title'=>'Auswählen'); + $this->_callEvent ('LAYOUT_ADD_ELEMENT', $actiondata); + + // insert view-link + $actiondata = array ('_root'=>'list-'.$entry, '_id'=>'view-'.$entry, '_type'=>'link', 'href'=>'?moduleid=filemanager&file='.$this->basedir.$entry.'&action=viewfile', 'title'=>'Datei anzeigen'); + $this->_callEvent ('LAYOUT_ADD_ELEMENT', $actiondata); + + // insert image for view-link + $actiondata = array ('_root'=>'view-'.$entry, '_id'=>'img-view-'.$entry, '_type'=>'image', 'src'=>'modules/layout/img/filetypes/'.$type, 'width'=>'16', 'height'=>'16', 'alt'=>'view', 'title'=>'', 'extra'=>'class="icon"'); + $this->_callEvent ('LAYOUT_ADD_ELEMENT', $actiondata); + + // insert edit-link + $actiondata = array ('_root'=>'list-'.$entry, '_id'=>'edit-'.$entry, '_type'=>'link', 'href'=>'?moduleid=filemanager&file='.$this->basedir.$entry.'&action=editfile', 'title'=>'Datei editieren'); + $this->_callEvent ('LAYOUT_ADD_ELEMENT', $actiondata); + + // insert image for edit-link + $actiondata = array ('_root'=>'edit-'.$entry, '_id'=>'img-edit-'.$entry, '_type'=>'image', 'src'=>'modules/layout/img/'.$editor.'.gif', 'width'=>'16', 'height'=>'16', 'alt'=>'edit', 'title'=>'', 'extra'=>'class="icon"'); + $this->_callEvent ('LAYOUT_ADD_ELEMENT', $actiondata); + + // set filename + $actiondata = array ('_root'=>'list-'.$entry, '_id'=>'file-'.$entry, '_type'=>'inline', 'extra'=>'class="filename"', 'content'=>$entry); + $this->_callEvent ('LAYOUT_ADD_ELEMENT', $actiondata); + } + } + $actiondata = array ('_type'=>'filelist_entry', '_id'=>'list1', '_root'=>'filelist', + 'extra'=>'class="header"', 'filename'=>$num_dirs.' Verzeichnisse', 'filesize'=>$sum_size, 'filemtime'=>$num_files.' Dateien', + 'chmod'=>'', 'gid'=>'', ''=>'UID'); + $this->_callEvent ('LAYOUT_ADD_ELEMENT', $actiondata); + + $actiondata = array ('_root'=>'list1', '_id'=>'list-img0', '_type'=>'image', + 'src'=>'modules/layout/img/empty.gif', + 'width'=>'16', 'height'=>'16', 'title'=>'', 'alt'=>'', + 'extra'=>'class="input"'); + $this->_callEvent ('LAYOUT_ADD_ELEMENT', $actiondata); + + $actiondata = array ('_root'=>'list1', '_id'=>'list-img1', '_type'=>'image', + 'src'=>'modules/layout/img/empty.gif', + 'width'=>'16', 'height'=>'16', 'title'=>'', 'alt'=>''); + $this->_callEvent ('LAYOUT_ADD_ELEMENT', $actiondata); + + $actiondata = array ('_root'=>'list1', '_id'=>'list-img2', '_type'=>'image', + 'src'=>'modules/layout/img/empty.gif', + 'width'=>'16', 'height'=>'16', 'title'=>'', 'alt'=>''); + $this->_callEvent ('LAYOUT_ADD_ELEMENT', $actiondata); + + // set filename + $actiondata = array ('_root'=>'list1', '_id'=>'file1', '_type'=>'inline', 'extra'=>'class="filename""', 'content'=>$num_dirs.' Verzeichnisse'); + $this->_callEvent ('LAYOUT_ADD_ELEMENT', $actiondata); } } ?> \ No newline at end of file --- NEW FILE: class.file_util.php --- <?php class file_util { function fileperms($filepath) { $decperms = fileperms($filepath); $octalperms = sprintf("%o",$decperms); // -4 value should include ugo and strange bits for files and folders return substr($octalperms,-4); } function filesize($file) { if (!file_exists($file)) { return ''; } $size = filesize($file); $factor = 0; while ($size > 1024) { $factor++; $size /= 1024; } switch ($factor) { case 3: return round($size).' GB'; case 2: return round($size).' MB'; case 1: return round($size).' kB'; default:return $size.' B'; } return round ($size / $factor); } function gid ($gid) { $data = posix_getgrgid ($gid); return array ('int'=>$gid, 'str'=>$data['name']); } function uid ($uid) { $data = posix_getpwuid ($uid); return array ('int'=>$uid, 'str'=>$data['name']); } } ?> --- NEW FILE: config.filemanager.php --- <?php /* $Id: config.filemanager.php,v 1.1 2004/06/18 15:17:01 mjahn Exp $ */ /* +----------------------------------------------------------------------+ | phpCMS Content Management System - Version 1.2.0 Beta +----------------------------------------------------------------------+ | phpCMS is Copyright (c) 2001-2003 by Michael Brauchl | and Contributing phpCMS Team Members | Filemanager Copyright (c) 2003 Markus Richert +----------------------------------------------------------------------+ | This program is free software; you can redistribute it and/or modify | it under the terms of the GNU General Public License as published by | the Free Software Foundation; either version 2 of the License, or | (at your option) any later version. | | This program is distributed in the hope that it will be useful, but | WITHOUT ANY WARRANTY; without even the implied warranty of | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | General Public License for more details. | | You should have received a copy of the GNU General Public License | along with this program; if not, write to the Free Software | Foundation, Inc., 59 Temple Place - Suite 330, Boston, | MA 02111-1307, USA. +----------------------------------------------------------------------+ | Original Author: Markus Richert (e157m369) | Contributors: | Beate Paland (beate76) +----------------------------------------------------------------------+ */ /////////////////////////////////////////////////////////////////////////////// // This is the filetypes registration. // // Note: The pattern "\.htm" will match on ".htm" as well as ".html"-files // IMPORTANT: Dots must be escaped, so use "\." instead of ".". // First match in the array will break further search // // These are the arrays values: // - regexp pattern on the filename, used with eregi() // - iconfile in /parser/gif/filemanager/filetypes/ // - param for the 'show' & 'edit'-action // ('image': file has to be shown as source of an <img>-tag, // 'text': it is raw-text, so display it with PHP's Code-Highlighting, // and make it editable // false: Don't show the file and even the link to show it, but only the icon) // - browsing allowed, show the link for it (true or false) $this->FILETYPES = array( // phpCMS Files // phpCMS ProjectFile array("\.ini$", 'phpcms.project.gif', 'text', false, ), // phpCMS Template array("\.tpl$", 'phpcms.template.gif', 'text', false, ), // phpCMS MenuFile array("\.mnu$", 'phpcms.menu.gif', 'text', false, ), // phpCMS MenuTemplate array("\.mtpl$", 'phpcms.menutemplate.gif', 'text', false, ), // phpCMS MenuFile array("\.tag$", 'phpcms.tag.gif', 'text', false, ), // Web- and Script-Files // Apache Webserver security settings array("\.(htaccess|htusers|htpasswd)$", 'security.gif', 'text', false, ), // Webscripts (serverside) array("\.(phps|php|php[2-5]?|asp|asa|cgi|pl|shtml|phtml)$", 'serverscript.gif', 'text', true, ), // Webscripts (clientside) array("\.js$", 'clientscript.gif', 'text', true, ), // Webpages array("\.(htm|html)$", 'webpage.gif', 'text', true, ), // XML Files array("\.(xml|xsl|xslt)$", 'xml.gif', 'text', true, ), // Wap Files array("\.(wml|wsl(c|s|sc))$", 'wap.gif', 'text', true, ), // StyleSheet array("\.css$", 'css.gif', 'text', true, ), // Images // WebImages array("\.(gif|png|jp(g|e|eg)|ico)$", 'webimage.gif', 'image', true, ), // Bitmaps array("\.(bmp|wbmp)$", 'bitmap.gif', 'image', true, ), // Targa Images array("\.(tif|tiff)$", 'targa.gif', 'image', true, ), // Audio and Video // Flash Movies array("\.(swf|cab)$", 'flash.gif', false, true, ), // Audiofiles (Waveform) array("\.(wav|mp(2|3|4|a)|vqf|ai(f|ff|fc)|au|snd)$", 'audio.gif', false, true, ), // Audiofiles (Midi) array("\.(mid|midi)$", 'midi.gif', false, true, ), // WindowsMedia Videofiles array("\.(asf|wma|wmv|avi)$", 'winmedia.gif', false, true, ), // QuickTime File array("\.(qt|mov)$", 'quicktime.gif', false, true, ), // RealAudio/RealVideo Files array("\.(rm|ra|ram)$", 'realmedia.gif', false, true, ), // MPEG Movies array("\.(mp(e|g|eg)|m1v|mpv2)$", 'movie.gif', false, true, ), // Specials // Archives array("\.(zip|rar|sit|gz|tar|tar.gz|gtar|gzip|ace|lha|arj|arc)$", 'archive.gif', false, true, ), // Adobe Acrobat-Files array("\.(pdf|fdf)$", 'acrobat.gif', false, true, ), // Adobe Photoshop File array("\.(psd)$", 'photoshop.gif', false, true, ), // Microsoft Excel-Files array("\.xl(s|a)$", 'excel.gif', false, true, ), // Microsoft Word-Files array("\.do(c|t)$", 'word.gif', false, true, ), // Microsoft Powerpoint-Files array("\.pp(t|s|z)$", 'powerpoint.gif', false, true, ), // Microsoft Access-Files array("\.(md(b|a|e)|db)$", 'access.gif', false, true, ), // Helpfiles array("\.(hlp|chm)$", 'help.gif', false, true, ), // Executables array("\.(exe|com|bat|hqx|bin|dll|class)$", 'executable.gif', false, true, ), // Textfiles // Comma/Tab-separated Files array("\.(c|t)sv$", 'csv.gif', 'text', true, ), // RichText Files array("\.rt(f|x)$", 'richtext.gif', 'text', true, ), // PlainText File array("\.txt$", 'text.gif', 'text', true, ), // Link on a file, M$ only array("\.lnk$", 'symlink.gif', false, false, ), ); // set the defaults, used if nothing above matched $this->DEF_FILETYPE['icon'] = 'text.gif'; $this->DEF_FILETYPE['show'] = 'text'; $this->DEF_FILETYPE['browse'] = false; /////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////// // This is the templates registration. // First value is the part of the filename between 'template.' and '.txt' // Second value is the description shown in the selector-field of the FileManager $this->TEMPLATES = array( array( 'html', 'HTML' ), array( 'phpcms', 'phpCMS ContentFile' ), ); ?> |