Changeset 523 for trunk/lib/Utilities.inc.php
- Timestamp:
- May 24, 2015 3:01:42 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/lib/Utilities.inc.php
r520 r523 609 609 /** 610 610 * Tests the existence of a file anywhere in the include path. 611 * Replaced by stream_resolve_include_path() in PHP 5 >= 5.3.2 611 612 * 612 613 * @param string $file File in include path. … … 897 898 { 898 899 // Translate the human string date into SQL-safe date format. 899 if (empty($date) || mb_strpos($date, '0000-00-00') !== false || strtotime($date) === -1 || strtotime($date) === false ) {900 if (empty($date) || mb_strpos($date, '0000-00-00') !== false || strtotime($date) === -1 || strtotime($date) === false || strtotime($date) === null) { 900 901 // Return a string of zero time, formatted the same as $format. 901 902 return strtr($format, array( … … 920 921 * @return mixed $var, minus any magic quotes. 921 922 */ 922 function dispelMagicQuotes($var )923 function dispelMagicQuotes($var, $always=false) 923 924 { 924 925 static $magic_quotes_gpc; … … 928 929 } 929 930 930 if ($ magic_quotes_gpc) {931 if ($always || $magic_quotes_gpc) { 931 932 if (!is_array($var)) { 932 933 $var = stripslashes($var); … … 934 935 foreach ($var as $key=>$val) { 935 936 if (is_array($val)) { 936 $var[$key] = dispelMagicQuotes($val );937 $var[$key] = dispelMagicQuotes($val, $always); 937 938 } else { 938 939 $var[$key] = stripslashes($val); … … 956 957 function getFormData($var=null, $default=null) 957 958 { 959 $app =& App::getInstance(); 960 958 961 if ('POST' == getenv('REQUEST_METHOD') && is_null($var)) { 959 return dispelMagicQuotes($_POST );962 return dispelMagicQuotes($_POST, $app->getParam('always_dispel_magicquotes')); 960 963 } else if ('GET' == getenv('REQUEST_METHOD') && is_null($var)) { 961 return dispelMagicQuotes($_GET );964 return dispelMagicQuotes($_GET, $app->getParam('always_dispel_magicquotes')); 962 965 } 963 966 if (isset($_POST[$var])) { 964 return dispelMagicQuotes($_POST[$var] );967 return dispelMagicQuotes($_POST[$var], $app->getParam('always_dispel_magicquotes')); 965 968 } else if (isset($_GET[$var])) { 966 return dispelMagicQuotes($_GET[$var] );969 return dispelMagicQuotes($_GET[$var], $app->getParam('always_dispel_magicquotes')); 967 970 } else { 968 971 return $default; 969 972 } 970 973 } 974 971 975 function getPost($var=null, $default=null) 972 976 { 977 $app =& App::getInstance(); 978 973 979 if (is_null($var)) { 974 return dispelMagicQuotes($_POST );980 return dispelMagicQuotes($_POST, $app->getParam('always_dispel_magicquotes')); 975 981 } 976 982 if (isset($_POST[$var])) { 977 return dispelMagicQuotes($_POST[$var] );983 return dispelMagicQuotes($_POST[$var], $app->getParam('always_dispel_magicquotes')); 978 984 } else { 979 985 return $default; 980 986 } 981 987 } 988 982 989 function getGet($var=null, $default=null) 983 990 { 991 $app =& App::getInstance(); 984 992 if (is_null($var)) { 985 return dispelMagicQuotes($_GET );993 return dispelMagicQuotes($_GET, $app->getParam('always_dispel_magicquotes')); 986 994 } 987 995 if (isset($_GET[$var])) { 988 return dispelMagicQuotes($_GET[$var] );996 return dispelMagicQuotes($_GET[$var], $app->getParam('always_dispel_magicquotes')); 989 997 } else { 990 998 return $default;
Note: See TracChangeset
for help on using the changeset viewer.