[ Index ] |
|
Code source de Joomla 1.0.13 |
1 <?php 2 /** 3 * @version $Id: common.php 4677 2006-08-23 16:55:24Z stingrey $ 4 * @package Joomla 5 * @copyright Copyright (C) 2005 Open Source Matters. All rights reserved. 6 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php 7 * Joomla! is free software. This version may have been modified pursuant 8 * to the GNU General Public License, and as distributed it includes or 9 * is derivative of works licensed under the GNU General Public License or 10 * other free or open source software licenses. 11 * See COPYRIGHT.php for copyright notices and details. 12 */ 13 14 // no direct access 15 defined( '_VALID_MOS' ) or die( 'Restricted access' ); 16 17 error_reporting( E_ALL ); 18 19 header ("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1 20 header ("Pragma: no-cache"); // HTTP/1.0 21 22 /** 23 * Utility function to return a value from a named array or a specified default 24 */ 25 define( "_MOS_NOTRIM", 0x0001 ); 26 define( "_MOS_ALLOWHTML", 0x0002 ); 27 function mosGetParam( &$arr, $name, $def=null, $mask=0 ) { 28 $return = null; 29 if (isset( $arr[$name] )) { 30 if (is_string( $arr[$name] )) { 31 if (!($mask&_MOS_NOTRIM)) { 32 $arr[$name] = trim( $arr[$name] ); 33 } 34 if (!($mask&_MOS_ALLOWHTML)) { 35 $arr[$name] = strip_tags( $arr[$name] ); 36 } 37 if (!get_magic_quotes_gpc()) { 38 $arr[$name] = addslashes( $arr[$name] ); 39 } 40 } 41 return $arr[$name]; 42 } else { 43 return $def; 44 } 45 } 46 47 function mosMakePassword($length) { 48 $salt = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"; 49 $len = strlen($salt); 50 $makepass=""; 51 mt_srand(10000000*(double)microtime()); 52 for ($i = 0; $i < $length; $i++) 53 $makepass .= $salt[mt_rand(0,$len - 1)]; 54 return $makepass; 55 } 56 57 /** 58 * Chmods files and directories recursivel to given permissions 59 * @param path The starting file or directory (no trailing slash) 60 * @param filemode Integer value to chmod files. NULL = dont chmod files. 61 * @param dirmode Integer value to chmod directories. NULL = dont chmod directories. 62 * @return TRUE=all succeeded FALSE=one or more chmods failed 63 */ 64 function mosChmodRecursive($path, $filemode=NULL, $dirmode=NULL) 65 { 66 $ret = TRUE; 67 if (is_dir($path)) { 68 $dh = opendir($path); 69 while ($file = readdir($dh)) { 70 if ($file != '.' && $file != '..') { 71 $fullpath = $path.'/'.$file; 72 if (is_dir($fullpath)) { 73 if (!mosChmodRecursive($fullpath, $filemode, $dirmode)) 74 $ret = FALSE; 75 } else { 76 if (isset($filemode)) 77 if (!@chmod($fullpath, $filemode)) 78 $ret = FALSE; 79 } // if 80 } // if 81 } // while 82 closedir($dh); 83 if (isset($dirmode)) 84 if (!@chmod($path, $dirmode)) 85 $ret = FALSE; 86 } else { 87 if (isset($filemode)) 88 $ret = @chmod($path, $filemode); 89 } // if 90 return $ret; 91 } // mosChmodRecursive 92 93 ?>
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Wed Nov 21 14:43:32 2007 | par Balluche grâce à PHPXref 0.7 |
![]() |