- Patch #279516 by c960657: removed many PHP4-isms. Great patch.
parent
4a6243aff2
commit
424250196a
|
@ -42,12 +42,6 @@ function _unicode_check() {
|
|||
// Set the standard C locale to ensure consistent, ASCII-only string handling.
|
||||
setlocale(LC_CTYPE, 'C');
|
||||
|
||||
// Check for outdated PCRE library
|
||||
// Note: we check if U+E2 is in the range U+E0 - U+E1. This test returns TRUE on old PCRE versions.
|
||||
if (preg_match('/[à-á]/u', 'â')) {
|
||||
return array(UNICODE_ERROR, $t('The PCRE library in your PHP installation is outdated. This will cause problems when handling Unicode text. If you are running PHP 4.3.3 or higher, make sure you are using the PCRE library supplied by PHP. Please refer to the <a href="@url">PHP PCRE documentation</a> for more information.', array('@url' => 'http://www.php.net/pcre')));
|
||||
}
|
||||
|
||||
// Check for mbstring extension
|
||||
if (!function_exists('mb_strlen')) {
|
||||
return array(UNICODE_SINGLEBYTE, $t('Operations on Unicode strings are emulated on a best-effort basis. Install the <a href="@url">PHP mbstring extension</a> for improved Unicode support.', array('@url' => 'http://www.php.net/mbstring')));
|
||||
|
|
|
@ -695,9 +695,7 @@ function aggregator_refresh($feed) {
|
|||
}
|
||||
|
||||
if (!empty($image['LINK']) && !empty($image['URL']) && !empty($image['TITLE'])) {
|
||||
// TODO: we should really use theme_image() here, but that only works with
|
||||
// local images. It won't work with images fetched with a URL unless PHP version > 5.
|
||||
$image = '<a href="' . check_url($image['LINK']) . '" class="feed-image"><img src="' . check_url($image['URL']) . '" alt="' . check_plain($image['TITLE']) . '" /></a>';
|
||||
$image = l(theme('image', $image['URL'], $image['TITLE']), $image['LINK'], array('html' => TRUE));
|
||||
}
|
||||
else {
|
||||
$image = '';
|
||||
|
@ -864,9 +862,9 @@ function aggregator_parse_feed(&$data, $feed) {
|
|||
}
|
||||
}
|
||||
|
||||
$timestamp = strtotime($date); // As of PHP 5.1.0, strtotime returns FALSE on failure instead of -1.
|
||||
$timestamp = strtotime($date);
|
||||
|
||||
if ($timestamp <= 0) {
|
||||
if ($timestamp === FALSE) {
|
||||
$timestamp = aggregator_parse_w3cdtf($date); // Aggregator_parse_w3cdtf() returns FALSE on failure.
|
||||
}
|
||||
|
||||
|
|
|
@ -1134,8 +1134,7 @@ function comment_validate($edit) {
|
|||
comment_invoke_comment($edit, 'validate');
|
||||
|
||||
if (isset($edit['date'])) {
|
||||
// As of PHP 5.1.0, strtotime returns FALSE upon failure instead of -1.
|
||||
if (strtotime($edit['date']) <= 0) {
|
||||
if (strtotime($edit['date']) === FALSE) {
|
||||
form_set_error('date', t('You have to specify a valid date.'));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -977,7 +977,7 @@ function filter_xss($string, $allowed_tags = array('a', 'em', 'strong', 'cite',
|
|||
/**
|
||||
* Processes an HTML tag.
|
||||
*
|
||||
* @param @m
|
||||
* @param $m
|
||||
* An array with various meaning depending on the value of $store.
|
||||
* If $store is TRUE then the array contains the allowed tags.
|
||||
* If $store is FALSE then the array has one element, the HTML tag to process.
|
||||
|
@ -1025,10 +1025,9 @@ function _filter_xss_split($m, $store = FALSE) {
|
|||
}
|
||||
|
||||
// Is there a closing XHTML slash at the end of the attributes?
|
||||
// In PHP 5.1.0+ we could count the changes, currently we need a separate match
|
||||
$xhtml_slash = preg_match('%\s?/\s*$%', $attrlist) ? ' /' : '';
|
||||
$attrlist = preg_replace('%(\s?)/\s*$%', '\1', $attrlist);
|
||||
|
||||
$attrlist = preg_replace('%(\s?)/\s*$%', '\1', $attrlist, -1, $count);
|
||||
$xhtml_slash = $count ? ' /' : '';
|
||||
|
||||
// Clean up attributes
|
||||
$attr2 = implode(' ', _filter_xss_attributes($attrlist));
|
||||
$attr2 = preg_replace('/[<>]/', '', $attr2);
|
||||
|
|
|
@ -842,8 +842,8 @@ function node_validate($node, $form = array()) {
|
|||
form_set_error('name', t('The username %name does not exist.', array('%name' => $node->name)));
|
||||
}
|
||||
|
||||
// Validate the "authored on" field. As of PHP 5.1.0, strtotime returns FALSE instead of -1 upon failure.
|
||||
if (!empty($node->date) && strtotime($node->date) <= 0) {
|
||||
// Validate the "authored on" field.
|
||||
if (!empty($node->date) && strtotime($node->date) === FALSE) {
|
||||
form_set_error('date', t('You have to specify a valid date.'));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -446,21 +446,3 @@ function _openid_get_params($str) {
|
|||
}
|
||||
return $data;
|
||||
}
|
||||
|
||||
/**
|
||||
* Provide bcpowmod support for PHP4.
|
||||
*/
|
||||
if (!function_exists('bcpowmod')) {
|
||||
function bcpowmod($base, $exp, $mod) {
|
||||
$square = bcmod($base, $mod);
|
||||
$result = 1;
|
||||
while (bccomp($exp, 0) > 0) {
|
||||
if (bcmod($exp, 2)) {
|
||||
$result = bcmod(bcmul($result, $square), $mod);
|
||||
}
|
||||
$square = bcmod(bcmul($square, $square), $mod);
|
||||
$exp = bcdiv($exp, 2);
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue