[ Index ] |
|
Code source de CMS made simple 1.0.5 |
1 <?php 2 #CMS - CMS Made Simple 3 #(c)2004 by Ted Kulp (wishy@users.sf.net) 4 #This project's homepage is: http://cmsmadesimple.sf.net 5 # 6 # library written by Thijs Elenbaas (thijs@contemplated.net) 7 # 8 #This program is free software; you can redistribute it and/or modify 9 #it under the terms of the GNU General Public License as published by 10 #the Free Software Foundation; either version 2 of the License, or 11 #(at your option) any later version. 12 # 13 #This program is distributed in the hope that it will be useful, 14 #but WITHOUT ANY WARRANTY; without even the implied warranty of 15 #MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 #GNU General Public License for more details. 17 #You should have received a copy of the GNU General Public License 18 #along with this program; if not, write to the Free Software 19 #Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 20 # 21 #$Id: file.functions.php 3062 2006-07-13 03:10:33Z calguy1000 $ 22 23 /** 24 * File related functions. Used within the file manager and possibly 25 * in filehandling programs 26 * 27 */ 28 29 /** 30 * Finds the file extention to for current filename 31 * to the admin login. 32 * 33 * @since 6.3 ? 34 */ 35 function get_file_extention($filename) { 36 37 global $filetype; 38 39 // get the file extention 40 $extension = strtolower(substr(strrchr($filename, "."), 1)); 41 //extention type if nothing is found: 42 $found_ext = "unknown"; 43 // See if extention is listed 44 if (isset($filetype[$extension]['img']) && $filetype[$extension]['img']) { 45 // Yes, listed! 46 $found_ext = $extension; 47 } else { 48 // apparently not, so let's browse the aliasses 49 foreach ($filetype as $current_ext=>$current_type) { 50 if (isset($current_type['alias']) && $current_type['alias']) { 51 foreach ($current_type['alias'] as $current_alias) { 52 if ($extension == $current_alias) { 53 $found_ext = $current_ext; 54 break(2); 55 }; 56 } 57 } 58 } 59 } 60 return $found_ext; 61 } 62 63 function display_file($filename) { 64 $do_display = true; 65 66 global $excludefilters; 67 68 foreach ($excludefilters as $currentfilter) { 69 if (ereg($currentfilter, $filename)) { 70 $do_display = false; 71 break(1); 72 } 73 } 74 return $do_display; 75 } 76 77 78 function is_removeable($fname) 79 { 80 if( is_dir( $fname ) ) 81 { 82 $folder = opendir($fname); 83 while($file = readdir( $folder )) 84 if($file != '.' && $file != '..' && 85 ( !is_writable( $fname."/".$file ) || 86 ( is_dir( $fname."/".$file ) && !is_removeable( $fname."/".$file ) ) )) 87 { 88 closedir($fname); 89 return false; 90 } 91 closedir($fname); 92 return true; 93 } 94 else 95 { 96 return is_writable( $fname ); 97 } 98 } 99 # vim:ts=4 sw=4 noet 100 ?>
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Tue Apr 3 18:50:37 2007 | par Balluche grâce à PHPXref 0.7 |