[ Index ] |
|
Code source de Mantis 1.1.0rc3 |
1 <?php 2 # Mantis - a php based bugtracking system 3 4 # Copyright (C) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org 5 # Copyright (C) 2002 - 2007 Mantis Team - mantisbt-dev@lists.sourceforge.net 6 7 # Mantis is free software: you can redistribute it and/or modify 8 # it under the terms of the GNU General Public License as published by 9 # the Free Software Foundation, either version 2 of the License, or 10 # (at your option) any later version. 11 # 12 # Mantis is distributed in the hope that it will be useful, 13 # but WITHOUT ANY WARRANTY; without even the implied warranty of 14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 # GNU General Public License for more details. 16 # 17 # You should have received a copy of the GNU General Public License 18 # along with Mantis. If not, see <http://www.gnu.org/licenses/>. 19 20 # -------------------------------------------------------- 21 # $Id: php_api.php,v 1.19.2.1 2007-10-13 22:35:38 giallu Exp $ 22 # -------------------------------------------------------- 23 24 ### PHP Compatibility API ### 25 26 # Functions to help in backwards compatibility of PHP versions, etc. 27 28 # Constant for our minimum required PHP version 29 define( 'PHP_MIN_VERSION', '4.3.0' ); 30 31 # cache array of comparisons 32 $g_cached_version = array(); 33 34 # -------------------- 35 # Returns true if the current PHP version is higher than the one 36 # specified in the given string 37 function php_version_at_least( $p_version_string ) { 38 global $g_cached_version; 39 40 if ( isset( $g_cached_version[$p_version_string] ) ) { 41 return $g_cached_version[$p_version_string]; 42 } 43 44 $t_curver = array_pad( explode( '.', phpversion() ), 3, 0 ); 45 $t_minver = array_pad( explode( '.', $p_version_string ), 3, 0 ); 46 47 for ($i = 0 ; $i < 3 ; $i = $i + 1 ) { 48 $t_cur = (int)$t_curver[$i]; 49 $t_min = (int)$t_minver[$i]; 50 51 if ( $t_cur < $t_min ) { 52 $g_cached_version[$p_version_string] = false; 53 return false; 54 } else if ( $t_cur > $t_min ) { 55 $g_cached_version[$p_version_string] = true; 56 return true; 57 } 58 } 59 60 # if we get here, the versions must match exactly so: 61 $g_cached_version[$p_version_string] = true; 62 return true; 63 } 64 65 # -------------------- 66 # Enforce our minimum requirements 67 if ( !php_version_at_least( PHP_MIN_VERSION ) ) { 68 @ob_end_clean(); 69 PRINT '<b>FATAL ERROR: Your version of PHP is too old. Mantis requires PHP version ' . PHP_MIN_VERSION . ' or newer</b><br />Your version of PHP is version ' . phpversion(); 70 die(); 71 } 72 73 # -------------------- 74 ini_set('magic_quotes_runtime', 0); 75 76 # -------------------- 77 # file_put_contents is normally in PEAR 78 if (!function_exists('file_put_contents')) { 79 function file_put_contents($filename, $data) { 80 if (($h = fopen($filename, 'w')) === false) { 81 return false; 82 } 83 if (($bytes = @fwrite($h, $data)) === false) { 84 return false; 85 } 86 fclose($h); 87 return $bytes; 88 } 89 } 90 91 # -------------------- 92 # vsprintf is normally in PEAR 93 if ( !function_exists( 'vsprintf' ) ) { 94 function vsprintf( $format, $args ) { 95 array_unshift( $args, $format ); 96 return call_user_func_array( 'sprintf', $args ); 97 } 98 } 99 100 ?>
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Thu Nov 29 09:42:17 2007 | par Balluche grâce à PHPXref 0.7 |
![]() |