[Phpcms-plugins-cvs] admin4phpCMS/modules/filemanager/includes vfs.ini,NONE,1.1 class.filemanager.ph
Brought to you by:
mjahn
From: Martin J. <mj...@us...> - 2005-05-26 15:55:39
|
Update of /cvsroot/phpcms-plugins/admin4phpCMS/modules/filemanager/includes In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19290/modules/filemanager/includes Added Files: vfs.ini class.filemanager.php class.file_util.php config.filemanager.php Log Message: beginning of phpcms-content and filemanager --- NEW FILE: class.filemanager.php --- <?php /** * Admin4phpCMS * * <b>License</b> * * 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 * * @author Martin Jahn <mj...@us...> * @license http://opensource.org/licenses/gpl-license.php GNU Public License * @copyright Copyright (c) 2005, Martin Jahn * @version $Id: class.filemanager.php,v 1.1 2005/05/26 15:55:26 mjahn Exp $ * @package admin4phpCMS * @subpackage module_filemanager */ /* * $Log: class.filemanager.php,v $ * Revision 1.1 2005/05/26 15:55:26 mjahn * beginning of phpcms-content and filemanager * */ /** * This class contains the Modell-Layer of the MVC-structure of the new filemanager. * It is an abstract class, that only contains the methods for working with the * filesystem. Thus it is possible to use this class externally. * @author Martin Jahn <mj...@us...> * @copyright Copyright (c) 2005, Martin Jahn */ class filemanager { function delete ($path, $recursively = false) { } function move ($source, $dest, $recursively = false) { } function copy ($source, $dest, $recursively = false) { } function mkdir ($path) { } function touch ($file) { } function rmdir ($path) { } function unlink ($path) { } } ?> --- NEW FILE: vfs.ini --- [standard] filter = "*" file = "class.filesystem.php" class = "filesystem" name = "Standard Fallback File System Driver" [zipfiles] filter = "*.zip,*.xpi" file = "class.zipfiles.php" class = "zipfiles" name = "File System Driver for ZIP-compressed files" [tarfiles] filter = "*.tar,*.tar.gz,*.tgz" file = "class.tarfiles.php" class = "tarfiles" name = "File System Driver for TAR-packaged (and ZIP-compressed) files" --- NEW FILE: class.file_util.php --- <?php /** * Utility-class for filemanager-module * * <b>License</b> * * 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 * * @author Martin Jahn <mj...@us...> * @license http://opensource.org/licenses/gpl-license.php GNU Public License * @copyright Copyright (c) 2004, Martin Jahn * @version $Id: class.file_util.php,v 1.1 2005/05/26 15:55:26 mjahn Exp $ * @package admin4phpCMS * @subpackage module_filemanager **/ /* * $Log: class.file_util.php,v $ * Revision 1.1 2005/05/26 15:55:26 mjahn * beginning of phpcms-content and filemanager * * Revision 1.4 2004/09/29 20:10:46 mjahn * completed phpCMS-config-part * began the statistic part * * Revision 1.3 2004/08/25 21:16:48 mjahn * step 1 is taken * * Revision 1.2 2004/07/24 08:58:25 mjahn * changed some things * */ /** * Utility-class for administrative work in the filesystem * * @package admin4phpCMS * @subpackage module_filemanager **/ class file_util { function chmodstr($in_Perms) { $sP = ''; /* if(($in_Perms & 0xC000) == 0xC000) // Socket $sP = 's'; elseif(($in_Perms & 0xA000) == 0xA000) // Symbolic Link $sP = 'l'; elseif(($in_Perms & 0x8000) == 0x8000) // Regular $sP = '−'; elseif(($in_Perms & 0x6000) == 0x6000) // Block special $sP = 'b'; elseif(($in_Perms & 0x4000) == 0x4000) // Directory $sP = 'd'; elseif(($in_Perms & 0x2000) == 0x2000) // Character special $sP = 'c'; elseif(($in_Perms & 0x1000) == 0x1000) // FIFO pipe $sP = 'p'; else // UNKNOWN $sP = 'u'; */ // owner $sP .= (($in_Perms & 0x0100) ? 'r' : '-').(($in_Perms & 0x0080) ? 'w' : '-'). (($in_Perms & 0x0040) ? (($in_Perms & 0x0800) ? 's' : 'x' ):(($in_Perms & 0x0800) ? 'S' : '-')); // group $sP .= (($in_Perms & 0x0020) ? 'r' : '-') . (($in_Perms & 0x0010) ? 'w' : '-') . (($in_Perms & 0x0008) ? (($in_Perms & 0x0400) ? 's' : 'x' ) : (($in_Perms & 0x0400) ? 'S' : '-')); // world $sP .= (($in_Perms & 0x0004) ? 'r' : '-') . (($in_Perms & 0x0002) ? 'w' : '-') . (($in_Perms & 0x0001) ? (($in_Perms & 0x0200) ? 't' : 'x' ) : (($in_Perms & 0x0200) ? 'T' : '-')); return $sP; } function chmodoct($in_Perms) { $sP = ''; /* if(($in_Perms & 0xC000) == 0xC000) // Socket $sP = 's'; elseif(($in_Perms & 0xA000) == 0xA000) // Symbolic Link $sP = 'l'; elseif(($in_Perms & 0x8000) == 0x8000) // Regular $sP = '−'; elseif(($in_Perms & 0x6000) == 0x6000) // Block special $sP = 'b'; elseif(($in_Perms & 0x4000) == 0x4000) // Directory $sP = 'd'; elseif(($in_Perms & 0x2000) == 0x2000) // Character special $sP = 'c'; elseif(($in_Perms & 0x1000) == 0x1000) // FIFO pipe $sP = 'p'; else // UNKNOWN $sP = 'u'; */ // owner $sP .= (($in_Perms & 0x0100) ? 4 : 0) + (($in_Perms & 0x0080) ? 2 : 0) + (($in_Perms & 0x0040) ? (($in_Perms & 0x0800) ? 1 : 1 ):(($in_Perms & 0x0800) ? 1 : 0)); // group $sP .= (($in_Perms & 0x0020) ? 4 : 0) + (($in_Perms & 0x0010) ? 2 : 0) + (($in_Perms & 0x0008) ? (($in_Perms & 0x0400) ? 1 : 1 ) : (($in_Perms & 0x0400) ? 1 : 0)); // world $sP .= (($in_Perms & 0x0004) ? 4 : 0) + (($in_Perms & 0x0002) ? 2 : 0) + (($in_Perms & 0x0001) ? (($in_Perms & 0x0200) ? 1 : 1 ) : (($in_Perms & 0x0200) ? 1 : 0)); return $sP; } function fileperms($filepath, $rwx = false) { $decperms = fileperms($filepath); list (,,,,$fileuid,$filegid,,,,,,,) = stat ($filepath); $octalperms = sprintf("%o",$decperms); if ($rwx) { $ret = file_util::chmodstr ($decperms); if ($fileuid == posix_getuid ()) { return '<em>'.substr ($ret, 0, 3).'</em>'.substr ($ret, 3, 6); } if ($filegid == posix_getgid ()) { return substr ($ret, 0, 3).'<em>'.substr ($ret, 3, 6).'</em>'.substr ($ret, 6, 3); } return substr ($ret, 0, 6).'<em>'.substr ($ret, 6, 3).'</em>'; } else { $ret = file_util::chmodoct ($decperms); // $ret = chmosubstr($octalperms,-4); if ($fileuid == posix_getuid ()) { return '<em>'.substr ($ret, 0, 1).'</em>'.substr ($ret, 1, 2); } if ($filegid == posix_getgid ()) { return substr ($ret, 0, 1).'<em>'.substr ($ret, 1, 1).'</em>'.substr ($ret, 2, 1); } return substr ($ret, 0, 2).'<em>'.substr ($ret, 2, 1).'</em>'; } } function checkpath ($ref, $check) { if (strpos ($check, $ref) === false) { return false; } return true; } function filesize($file, $dec = 0) { if (is_int ($file)) { $size = $file; } elseif (is_dir ($file) || is_file ($file)) { if (!file_exists ($file)) { return ''; } $size = filesize ($file); } else { } $factor = 0; while ($size > 1024) { $factor++; $size /= 1024; } $fact = 1; while ($dec > 0) { $fact = $fact * 10; $dec--; } switch ($factor) { case 3: return round($size*$fact) / $fact.' GB'; case 2: return round($size*$fact) / $fact.' MB'; case 1: return round($size*$fact) / $fact.' kB'; default:return $size.' B'; } return round ($size / $factor); } function filetime($file) { if (is_int ($file)) { $time = $file; } elseif (is_dir ($file) || is_file ($file)) { if (!file_exists ($file)) { return '00.00.0000 00:00:00'; } $time = filemtime ($file); } return strftime ($time, '%d.%m.%Y %H:%M%S'); } 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 /** * Configuration of the filemanager-module * * <b>License</b> * * 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 * * @author Martin Jahn <mj...@us...> * @license http://opensource.org/licenses/gpl-license.php GNU Public License * @copyright Copyright (c) 2004, Martin Jahn * @version $Id: config.filemanager.php,v 1.1 2005/05/26 15:55:26 mjahn Exp $ * @package admin4phpCMS * @subpackage module_filemanager **/ /* * $Log: config.filemanager.php,v $ * Revision 1.1 2005/05/26 15:55:26 mjahn * beginning of phpcms-content and filemanager * * Revision 1.2 2004/07/24 08:58:25 mjahn * changed some things * */ /** * Configuration of the filemanager-class * * @package admin4phpCMS * @subpackage module_filemanager **/ /* +----------------------------------------------------------------------+ | 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' ), ); ?> |