|
From: <pdo...@us...> - 2021-02-08 20:52:13
|
Revision: 14899
http://sourceforge.net/p/squirrelmail/code/14899
Author: pdontthink
Date: 2021-02-08 20:52:07 +0000 (Mon, 08 Feb 2021)
Log Message:
-----------
Migrate away from using create_function as long as PHP 5.3+ is available
Modified Paths:
--------------
branches/SM-1_4-STABLE/squirrelmail/doc/ChangeLog
branches/SM-1_4-STABLE/squirrelmail/functions/decode/iso_8859_1.php
branches/SM-1_4-STABLE/squirrelmail/functions/decode/utf_8.php
branches/SM-1_4-STABLE/squirrelmail/functions/mime.php
Modified: branches/SM-1_4-STABLE/squirrelmail/doc/ChangeLog
===================================================================
--- branches/SM-1_4-STABLE/squirrelmail/doc/ChangeLog 2021-02-08 07:00:12 UTC (rev 14898)
+++ branches/SM-1_4-STABLE/squirrelmail/doc/ChangeLog 2021-02-08 20:52:07 UTC (rev 14899)
@@ -152,6 +152,7 @@
who a message is from
- Show more accurate filesize for uploaded files and base64-encoded
attachments (when reading a message)
+ - Migrate away from create_function() as long as we have PHP 5.3+
Version 1.4.22 - 12 July 2011
-----------------------------
Modified: branches/SM-1_4-STABLE/squirrelmail/functions/decode/iso_8859_1.php
===================================================================
--- branches/SM-1_4-STABLE/squirrelmail/functions/decode/iso_8859_1.php 2021-02-08 07:00:12 UTC (rev 14898)
+++ branches/SM-1_4-STABLE/squirrelmail/functions/decode/iso_8859_1.php 2021-02-08 20:52:07 UTC (rev 14899)
@@ -24,15 +24,21 @@
return $string;
$string = preg_replace_callback("/([\201-\237])/",
- create_function ('$matches', 'return \'&#\' . ord($matches[1]) . \';\';'),
- $string);
+ (check_php_version(5, 3, 0)
+ ? function($matches) { return '&#' . ord($matches[1]) . ';'; }
+ : create_function ('$matches', 'return \'&#\' . ord($matches[1]) . \';\';')
+ ),
+ $string);
/* I don't want to use 0xA0 (\240) in any ranges. RH73 may dislike it */
$string = str_replace("\240", ' ', $string);
$string = preg_replace_callback("/([\241-\377])/",
- create_function ('$matches', 'return \'&#\' . ord($matches[1]) . \';\';'),
- $string);
+ (check_php_version(5, 3, 0)
+ ? function($matches) { return '&#' . ord($matches[1]) . ';'; }
+ : create_function ('$matches', 'return \'&#\' . ord($matches[1]) . \';\';')
+ ),
+ $string);
return $string;
}
Modified: branches/SM-1_4-STABLE/squirrelmail/functions/decode/utf_8.php
===================================================================
--- branches/SM-1_4-STABLE/squirrelmail/functions/decode/utf_8.php 2021-02-08 07:00:12 UTC (rev 14898)
+++ branches/SM-1_4-STABLE/squirrelmail/functions/decode/utf_8.php 2021-02-08 20:52:07 UTC (rev 14899)
@@ -74,18 +74,27 @@
// decode four byte unicode characters
$string = preg_replace_callback("/([\360-\367])([\200-\277])([\200-\277])([\200-\277])/",
- create_function ('$matches', 'return \'&#\'.((ord($matches[1])-240)*262144+(ord($matches[2])-128)*4096+(ord($matches[3])-128)*64+(ord($matches[4])-128)).\';\';'),
- $string);
+ (check_php_version(5, 3, 0)
+ ? function($matches) { return '&#'.((ord($matches[1])-240)*262144+(ord($matches[2])-128)*4096+(ord($matches[3])-128)*64+(ord($matches[4])-128)).';'; }
+ : create_function ('$matches', 'return \'&#\'.((ord($matches[1])-240)*262144+(ord($matches[2])-128)*4096+(ord($matches[3])-128)*64+(ord($matches[4])-128)).\';\';')
+ ),
+ $string);
// decode three byte unicode characters
$string = preg_replace_callback("/([\340-\357])([\200-\277])([\200-\277])/",
- create_function ('$matches', 'return \'&#\'.((ord($matches[1])-224)*4096+(ord($matches[2])-128)*64+(ord($matches[3])-128)).\';\';'),
- $string);
+ (check_php_version(5, 3, 0)
+ ? function($matches) { return '&#'.((ord($matches[1])-224)*4096+(ord($matches[2])-128)*64+(ord($matches[3])-128)).';'; }
+ : create_function ('$matches', 'return \'&#\'.((ord($matches[1])-224)*4096+(ord($matches[2])-128)*64+(ord($matches[3])-128)).\';\';')
+ ),
+ $string);
// decode two byte unicode characters
$string = preg_replace_callback("/([\300-\337])([\200-\277])/",
- create_function ('$matches', 'return \'&#\'.((ord($matches[1])-192)*64+(ord($matches[2])-128)).\';\';'),
- $string);
+ (check_php_version(5, 3, 0)
+ ? function($matches) { return '&#'.((ord($matches[1])-192)*64+(ord($matches[2])-128)).';'; }
+ : create_function ('$matches', 'return \'&#\'.((ord($matches[1])-192)*64+(ord($matches[2])-128)).\';\';')
+ ),
+ $string);
// remove broken unicode
$string = preg_replace("/[\200-\237]|\240|[\241-\377]/",'?',$string);
Modified: branches/SM-1_4-STABLE/squirrelmail/functions/mime.php
===================================================================
--- branches/SM-1_4-STABLE/squirrelmail/functions/mime.php 2021-02-08 07:00:12 UTC (rev 14898)
+++ branches/SM-1_4-STABLE/squirrelmail/functions/mime.php 2021-02-08 20:52:07 UTC (rev 14899)
@@ -729,8 +729,11 @@
case 'Q':
$replace = str_replace('_', ' ', $res[4]);
$replace = preg_replace_callback('/=([0-9a-f]{2})/i',
- create_function ('$matches', 'return chr(hexdec($matches[1]));'),
- $replace);
+ (check_php_version(5, 3, 0)
+ ? function($matches) { return chr(hexdec($matches[1])); }
+ : create_function ('$matches', 'return chr(hexdec($matches[1]));')
+ ),
+ $replace);
if ($can_be_encoded) {
// string is converted from one charset to another. sanitizing depends on $htmlsave
$replace = charset_convert($res[2], $replace,$default_charset,$htmlsave);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|