mirror of
https://github.com/moodle/moodle.git
synced 2025-04-21 16:32:18 +02:00
all MDL-20821 Removed more deprecated functions
This commit is contained in:
parent
e998effa3d
commit
6959330979
@ -9,7 +9,6 @@
|
||||
* See http://bennu.sourceforge.net/ for more information and downloads.
|
||||
*
|
||||
* @author Ioannis Papaioannou
|
||||
* @version $Id$
|
||||
* @license http://www.gnu.org/copyleft/lesser.html GNU Lesser General Public License
|
||||
*/
|
||||
|
||||
@ -139,13 +138,13 @@ function rfc2445_is_valid_value($value, $type) {
|
||||
}
|
||||
|
||||
if($scheme === 'mailto') {
|
||||
$regexp = '^[a-zA-Z0-9]+[_a-zA-Z0-9\-]*(\.[_a-z0-9\-]+)*@(([0-9a-zA-Z\-]+\.)+[a-zA-Z][0-9a-zA-Z\-]+|([0-9]{1,3}\.){3}[0-9]{1,3})$';
|
||||
$regexp = '#^[a-zA-Z0-9]+[_a-zA-Z0-9\-]*(\.[_a-z0-9\-]+)*@(([0-9a-zA-Z\-]+\.)+[a-zA-Z][0-9a-zA-Z\-]+|([0-9]{1,3}\.){3}[0-9]{1,3})$#';
|
||||
}
|
||||
else {
|
||||
$regexp = '^//(.+(:.*)?@)?(([0-9a-zA-Z\-]+\.)+[a-zA-Z][0-9a-zA-Z\-]+|([0-9]{1,3}\.){3}[0-9]{1,3})(:[0-9]{1,5})?(/.*)?$';
|
||||
$regexp = '#^//(.+(:.*)?@)?(([0-9a-zA-Z\-]+\.)+[a-zA-Z][0-9a-zA-Z\-]+|([0-9]{1,3}\.){3}[0-9]{1,3})(:[0-9]{1,5})?(/.*)?$#';
|
||||
}
|
||||
|
||||
return ereg($regexp, $remain);
|
||||
return preg_match($regexp, $remain);
|
||||
break;
|
||||
|
||||
case RFC2445_TYPE_BINARY:
|
||||
|
27
lib/bennu/readme_moodle.txt
Normal file
27
lib/bennu/readme_moodle.txt
Normal file
@ -0,0 +1,27 @@
|
||||
18 Nov 2009
|
||||
Description of Bennu modifications to remove functions deprecated as of php 5.3
|
||||
|
||||
Index: iCalendar_rfc2445.php
|
||||
===================================================================
|
||||
RCS file: /cvsroot/moodle/moodle/lib/bennu/iCalendar_rfc2445.php,v
|
||||
retrieving revision 1.5
|
||||
diff -u -r1.5 iCalendar_rfc2445.php
|
||||
--- iCalendar_rfc2445.php 4 Nov 2009 20:06:40 -0000 1.5
|
||||
+++ iCalendar_rfc2445.php 18 Nov 2009 03:50:16 -0000
|
||||
@@ -138,13 +138,13 @@
|
||||
}
|
||||
|
||||
if($scheme === 'mailto') {
|
||||
- $regexp = '^[a-zA-Z0-9]+[_a-zA-Z0-9\-]*(\.[_a-z0-9\-]+)*@(([0-9a-zA-Z\-]+\.)+[a-zA-Z][0-9a-zA-Z\-]+|([0-9]{1,3}\.){3}[0-9]{1,3})$';
|
||||
+ $regexp = '#^[a-zA-Z0-9]+[_a-zA-Z0-9\-]*(\.[_a-z0-9\-]+)*@(([0-9a-zA-Z\-]+\.)+[a-zA-Z][0-9a-zA-Z\-]+|([0-9]{1,3}\.){3}[0-9]{1,3})$#';
|
||||
}
|
||||
else {
|
||||
- $regexp = '^//(.+(:.*)?@)?(([0-9a-zA-Z\-]+\.)+[a-zA-Z][0-9a-zA-Z\-]+|([0-9]{1,3}\.){3}[0-9]{1,3})(:[0-9]{1,5})?(/.*)?$';
|
||||
+ $regexp = '#^//(.+(:.*)?@)?(([0-9a-zA-Z\-]+\.)+[a-zA-Z][0-9a-zA-Z\-]+|([0-9]{1,3}\.){3}[0-9]{1,3})(:[0-9]{1,5})?(/.*)?$#';
|
||||
}
|
||||
|
||||
- return ereg($regexp, $remain);
|
||||
+ return preg_match($regexp, $remain);
|
||||
break;
|
||||
|
||||
case RFC2445_TYPE_BINARY:
|
@ -320,7 +320,7 @@ function detect_munged_arguments($string, $allowdots=1) {
|
||||
if (substr_count($string, '..') > $allowdots) { // Sometimes we allow dots in references
|
||||
return true;
|
||||
}
|
||||
if (ereg('[\|\`]', $string)) { // check for other bad characters
|
||||
if (preg_match('/[\|\`]/', $string)) { // check for other bad characters
|
||||
return true;
|
||||
}
|
||||
if (empty($string) or $string == '/') {
|
||||
|
@ -466,7 +466,7 @@ class Parser
|
||||
{
|
||||
return(pack("C", $this->ptg[$token]));
|
||||
}
|
||||
elseif(preg_match("/[A-Z0-9À-Ü\.]+/",$token))
|
||||
elseif(preg_match("/[A-Z0-9<EFBFBD>-<2D>\.]+/",$token))
|
||||
{
|
||||
return($this->_convert_function($token,$this->_func_args));
|
||||
}
|
||||
@ -723,21 +723,21 @@ class Parser
|
||||
break;
|
||||
default:
|
||||
// if it's a reference
|
||||
if(eregi("^[A-I]?[A-Z][0-9]+$",$token) and
|
||||
!ereg("[0-9]",$this->_lookahead) and
|
||||
if(preg_match("/^[A-I]?[A-Z][0-9]+$/i",$token) and
|
||||
!preg_match("/[0-9]/",$this->_lookahead) and
|
||||
($this->_lookahead != ':') and ($this->_lookahead != '.'))
|
||||
{
|
||||
return($token);
|
||||
}
|
||||
// if it's a range (A1:A2)
|
||||
elseif(eregi("^[A-I]?[A-Z][0-9]+:[A-I]?[A-Z][0-9]+$",$token) and
|
||||
!ereg("[0-9]",$this->_lookahead))
|
||||
elseif(preg_match("/^[A-I]?[A-Z][0-9]+:[A-I]?[A-Z][0-9]+$/i",$token) and
|
||||
!preg_match("/[0-9]/",$this->_lookahead))
|
||||
{
|
||||
return($token);
|
||||
}
|
||||
// if it's a range (A1..A2)
|
||||
elseif(eregi("^[A-I]?[A-Z][0-9]+\.\.[A-I]?[A-Z][0-9]+$",$token) and
|
||||
!ereg("[0-9]",$this->_lookahead))
|
||||
elseif(preg_match("/^[A-I]?[A-Z][0-9]+\.\.[A-I]?[A-Z][0-9]+$/i",$token) and
|
||||
!preg_match("/[0-9]/",$this->_lookahead))
|
||||
{
|
||||
return($token);
|
||||
}
|
||||
@ -746,7 +746,7 @@ class Parser
|
||||
return($token);
|
||||
}
|
||||
// if it's a function call
|
||||
elseif(eregi("^[A-Z0-9À-Ü\.]+$",$token) and ($this->_lookahead == "("))
|
||||
elseif(preg_match("/^[A-Z0-9<>-<2D>\.]+$/i",$token) and ($this->_lookahead == "("))
|
||||
|
||||
{
|
||||
return($token);
|
||||
@ -857,15 +857,15 @@ class Parser
|
||||
return($result);
|
||||
}
|
||||
// if it's a reference
|
||||
if (eregi("^[A-I]?[A-Z][0-9]+$",$this->_current_token))
|
||||
if (preg_match("/^[A-I]?[A-Z][0-9]+$/i",$this->_current_token))
|
||||
{
|
||||
$result = $this->_create_tree($this->_current_token, '', '');
|
||||
$this->_advance();
|
||||
return($result);
|
||||
}
|
||||
// if it's a range
|
||||
elseif (eregi("^[A-I]?[A-Z][0-9]+:[A-I]?[A-Z][0-9]+$",$this->_current_token) or
|
||||
eregi("^[A-I]?[A-Z][0-9]+\.\.[A-I]?[A-Z][0-9]+$",$this->_current_token))
|
||||
elseif (preg_match("/^[A-I]?[A-Z][0-9]+:[A-I]?[A-Z][0-9]+$/i",$this->_current_token) or
|
||||
preg_match("/^[A-I]?[A-Z][0-9]+\.\.[A-I]?[A-Z][0-9]+$/i",$this->_current_token))
|
||||
{
|
||||
$result = $this->_current_token;
|
||||
$this->_advance();
|
||||
@ -878,7 +878,7 @@ class Parser
|
||||
return($result);
|
||||
}
|
||||
// if it's a function call
|
||||
elseif (eregi("^[A-Z0-9À-Ü\.]+$",$this->_current_token))
|
||||
elseif (preg_match("/^[A-Z0-9<>-<2D>\.]+$/i",$this->_current_token))
|
||||
{
|
||||
$result = $this->_func();
|
||||
return($result);
|
||||
|
@ -1264,10 +1264,10 @@ class Worksheet extends BIFFwriter
|
||||
}
|
||||
|
||||
// Strip the '=' or '@' sign at the beginning of the formula string
|
||||
if (ereg("^=",$formula)) {
|
||||
if (preg_match("/^=/",$formula)) {
|
||||
$formula = preg_replace("/(^=)/","",$formula);
|
||||
}
|
||||
elseif(ereg("^@",$formula)) {
|
||||
elseif(preg_match("/^@/",$formula)) {
|
||||
$formula = preg_replace("/(^@)/","",$formula);
|
||||
}
|
||||
else {
|
||||
|
104
lib/excel/readme_moodle.txt
Normal file
104
lib/excel/readme_moodle.txt
Normal file
@ -0,0 +1,104 @@
|
||||
18 Nov 2009
|
||||
Description of WriteExcel modifications to remove functions deprecated as of php 5.3
|
||||
|
||||
Index: Parser.php
|
||||
===================================================================
|
||||
RCS file: /cvsroot/moodle/moodle/lib/excel/Parser.php,v
|
||||
retrieving revision 1.1
|
||||
diff -u -r1.1 Parser.php
|
||||
--- Parser.php 26 Sep 2003 04:18:02 -0000 1.1
|
||||
+++ Parser.php 18 Nov 2009 03:58:49 -0000
|
||||
@@ -466,7 +466,7 @@
|
||||
{
|
||||
return(pack("C", $this->ptg[$token]));
|
||||
}
|
||||
- elseif(preg_match("/[A-Z0-9À-Ü\.]+/",$token))
|
||||
+ elseif(preg_match("/[A-Z0-9ᅵ-ᅵ\.]+/",$token))
|
||||
{
|
||||
return($this->_convert_function($token,$this->_func_args));
|
||||
}
|
||||
@@ -723,21 +723,21 @@
|
||||
break;
|
||||
default:
|
||||
// if it's a reference
|
||||
- if(eregi("^[A-I]?[A-Z][0-9]+$",$token) and
|
||||
- !ereg("[0-9]",$this->_lookahead) and
|
||||
+ if(preg_match("/^[A-I]?[A-Z][0-9]+$/i",$token) and
|
||||
+ !preg_match("/[0-9]/",$this->_lookahead) and
|
||||
($this->_lookahead != ':') and ($this->_lookahead != '.'))
|
||||
{
|
||||
return($token);
|
||||
}
|
||||
// if it's a range (A1:A2)
|
||||
- elseif(eregi("^[A-I]?[A-Z][0-9]+:[A-I]?[A-Z][0-9]+$",$token) and
|
||||
- !ereg("[0-9]",$this->_lookahead))
|
||||
+ elseif(preg_match("/^[A-I]?[A-Z][0-9]+:[A-I]?[A-Z][0-9]+$/i",$token) and
|
||||
+ !preg_match("/[0-9]/",$this->_lookahead))
|
||||
{
|
||||
return($token);
|
||||
}
|
||||
// if it's a range (A1..A2)
|
||||
- elseif(eregi("^[A-I]?[A-Z][0-9]+\.\.[A-I]?[A-Z][0-9]+$",$token) and
|
||||
- !ereg("[0-9]",$this->_lookahead))
|
||||
+ elseif(preg_match("/^[A-I]?[A-Z][0-9]+\.\.[A-I]?[A-Z][0-9]+$/i",$token) and
|
||||
+ !preg_match("/[0-9]/",$this->_lookahead))
|
||||
{
|
||||
return($token);
|
||||
}
|
||||
@@ -746,7 +746,7 @@
|
||||
return($token);
|
||||
}
|
||||
// if it's a function call
|
||||
- elseif(eregi("^[A-Z0-9À-Ü\.]+$",$token) and ($this->_lookahead == "("))
|
||||
+ elseif(preg_match("/^[A-Z0-9ᅵ-ᅵ\.]+$/i",$token) and ($this->_lookahead == "("))
|
||||
|
||||
{
|
||||
return($token);
|
||||
@@ -857,15 +857,15 @@
|
||||
return($result);
|
||||
}
|
||||
// if it's a reference
|
||||
- if (eregi("^[A-I]?[A-Z][0-9]+$",$this->_current_token))
|
||||
+ if (preg_match("/^[A-I]?[A-Z][0-9]+$/i",$this->_current_token))
|
||||
{
|
||||
$result = $this->_create_tree($this->_current_token, '', '');
|
||||
$this->_advance();
|
||||
return($result);
|
||||
}
|
||||
// if it's a range
|
||||
- elseif (eregi("^[A-I]?[A-Z][0-9]+:[A-I]?[A-Z][0-9]+$",$this->_current_token) or
|
||||
- eregi("^[A-I]?[A-Z][0-9]+\.\.[A-I]?[A-Z][0-9]+$",$this->_current_token))
|
||||
+ elseif (preg_match("/^[A-I]?[A-Z][0-9]+:[A-I]?[A-Z][0-9]+$/i",$this->_current_token) or
|
||||
+ preg_match("/^[A-I]?[A-Z][0-9]+\.\.[A-I]?[A-Z][0-9]+$/i",$this->_current_token))
|
||||
{
|
||||
$result = $this->_current_token;
|
||||
$this->_advance();
|
||||
@@ -878,7 +878,7 @@
|
||||
return($result);
|
||||
}
|
||||
// if it's a function call
|
||||
- elseif (eregi("^[A-Z0-9À-Ü\.]+$",$this->_current_token))
|
||||
+ elseif (preg_match("/^[A-Z0-9ᅵ-ᅵ\.]+$/i",$this->_current_token))
|
||||
{
|
||||
$result = $this->_func();
|
||||
return($result);
|
||||
Index: Worksheet.php
|
||||
===================================================================
|
||||
RCS file: /cvsroot/moodle/moodle/lib/excel/Worksheet.php,v
|
||||
retrieving revision 1.1
|
||||
diff -u -r1.1 Worksheet.php
|
||||
--- Worksheet.php 26 Sep 2003 04:18:02 -0000 1.1
|
||||
+++ Worksheet.php 18 Nov 2009 03:58:50 -0000
|
||||
@@ -1264,10 +1264,10 @@
|
||||
}
|
||||
|
||||
// Strip the '=' or '@' sign at the beginning of the formula string
|
||||
- if (ereg("^=",$formula)) {
|
||||
+ if (preg_match("/^=/",$formula)) {
|
||||
$formula = preg_replace("/(^=)/","",$formula);
|
||||
}
|
||||
- elseif(ereg("^@",$formula)) {
|
||||
+ elseif(preg_match("/^@/",$formula)) {
|
||||
$formula = preg_replace("/(^@)/","",$formula);
|
||||
}
|
||||
else {
|
@ -1193,7 +1193,7 @@ function mimeinfo($element, $filename) {
|
||||
global $CFG;
|
||||
$mimeinfo = get_mimetypes_array();
|
||||
|
||||
if (eregi('\.([a-z0-9]+)$', $filename, $match)) {
|
||||
if (preg_match('/\.([a-z0-9]+)$/i', $filename, $match)) {
|
||||
if (isset($mimeinfo[strtolower($match[1])][$element])) {
|
||||
return $mimeinfo[strtolower($match[1])][$element];
|
||||
} else {
|
||||
|
@ -493,7 +493,7 @@ function getdnsattributes ($l,$ip){
|
||||
$r->nameservers = array("ws1.maxmind.com");
|
||||
$p = $r->search($l."." . $ip .".s.maxmind.com","TXT","IN");
|
||||
$str = is_object($p->answer[0])?$p->answer[0]->string():'';
|
||||
ereg("\"(.*)\"",$str,$regs);
|
||||
preg_match("#\"(.*)\"#",$str,$regs);
|
||||
$str = $regs[1];
|
||||
return $str;
|
||||
}
|
||||
|
20
lib/geoip/readme_moodle.txt
Normal file
20
lib/geoip/readme_moodle.txt
Normal file
@ -0,0 +1,20 @@
|
||||
18 Nov 2009
|
||||
Description of geoip modifications to remove ereg related functions deprecated as of php 5.3. Patch below.
|
||||
|
||||
Index: geoip.inc
|
||||
===================================================================
|
||||
RCS file: /cvsroot/moodle/moodle/lib/geoip/geoip.inc,v
|
||||
retrieving revision 1.2
|
||||
diff -u -r1.2 geoip.inc
|
||||
--- geoip.inc 19 Jul 2009 13:54:11 -0000 1.2
|
||||
+++ geoip.inc 18 Nov 2009 04:03:48 -0000
|
||||
@@ -493,7 +493,7 @@
|
||||
$r->nameservers = array("ws1.maxmind.com");
|
||||
$p = $r->search($l."." . $ip .".s.maxmind.com","TXT","IN");
|
||||
$str = is_object($p->answer[0])?$p->answer[0]->string():'';
|
||||
- ereg("\"(.*)\"",$str,$regs);
|
||||
+ preg_match("#\"(.*)\"#",$str,$regs);
|
||||
$str = $regs[1];
|
||||
return $str;
|
||||
}
|
||||
|
@ -28,3 +28,127 @@ To run the codesniffer, you can call the runsniffer script using your command-li
|
||||
Example: /usr/bin/php lib/pear/PHP/runsniffer mod/forum
|
||||
|
||||
|
||||
|
||||
18 Nov 2009
|
||||
Description of modifications to remove ereg related functions deprecated as of php 5.3. Patch below.
|
||||
|
||||
Index: Spreadsheet/Excel/Writer/Parser.php
|
||||
===================================================================
|
||||
RCS file: /cvsroot/moodle/moodle/lib/pear/Spreadsheet/Excel/Writer/Parser.php,v
|
||||
retrieving revision 1.2
|
||||
diff -u -r1.2 Parser.php
|
||||
--- Spreadsheet/Excel/Writer/Parser.php 4 Jan 2006 08:23:42 -0000 1.2
|
||||
+++ Spreadsheet/Excel/Writer/Parser.php 18 Nov 2009 04:11:09 -0000
|
||||
@@ -1206,7 +1206,7 @@
|
||||
default:
|
||||
// if it's a reference
|
||||
if (preg_match('/^\$?[A-Ia-i]?[A-Za-z]\$?[0-9]+$/',$token) and
|
||||
- !ereg("[0-9]",$this->_lookahead) and
|
||||
+ !preg_match("/[0-9]/",$this->_lookahead) and
|
||||
($this->_lookahead != ':') and ($this->_lookahead != '.') and
|
||||
($this->_lookahead != '!'))
|
||||
{
|
||||
@@ -1214,39 +1214,39 @@
|
||||
}
|
||||
// If it's an external reference (Sheet1!A1 or Sheet1:Sheet2!A1)
|
||||
elseif (preg_match("/^\w+(\:\w+)?\![A-Ia-i]?[A-Za-z][0-9]+$/u",$token) and
|
||||
- !ereg("[0-9]",$this->_lookahead) and
|
||||
+ !preg("/[0-9]/",$this->_lookahead) and
|
||||
($this->_lookahead != ':') and ($this->_lookahead != '.'))
|
||||
{
|
||||
return $token;
|
||||
}
|
||||
// If it's an external reference ('Sheet1'!A1 or 'Sheet1:Sheet2'!A1)
|
||||
elseif (preg_match("/^'[\w -]+(\:[\w -]+)?'\![A-Ia-i]?[A-Za-z][0-9]+$/u",$token) and
|
||||
- !ereg("[0-9]",$this->_lookahead) and
|
||||
+ !preg("/[0-9]/",$this->_lookahead) and
|
||||
($this->_lookahead != ':') and ($this->_lookahead != '.'))
|
||||
{
|
||||
return $token;
|
||||
}
|
||||
// if it's a range (A1:A2)
|
||||
elseif (preg_match("/^(\$)?[A-Ia-i]?[A-Za-z](\$)?[0-9]+:(\$)?[A-Ia-i]?[A-Za-z](\$)?[0-9]+$/",$token) and
|
||||
- !ereg("[0-9]",$this->_lookahead))
|
||||
+ !preg_match("/[0-9]/",$this->_lookahead))
|
||||
{
|
||||
return $token;
|
||||
}
|
||||
// if it's a range (A1..A2)
|
||||
elseif (preg_match("/^(\$)?[A-Ia-i]?[A-Za-z](\$)?[0-9]+\.\.(\$)?[A-Ia-i]?[A-Za-z](\$)?[0-9]+$/",$token) and
|
||||
- !ereg("[0-9]",$this->_lookahead))
|
||||
+ !preg_match("/[0-9]/",$this->_lookahead))
|
||||
{
|
||||
return $token;
|
||||
}
|
||||
// If it's an external range like Sheet1!A1 or Sheet1:Sheet2!A1:B2
|
||||
elseif (preg_match("/^\w+(\:\w+)?\!([A-Ia-i]?[A-Za-z])?[0-9]+:([A-Ia-i]?[A-Za-z])?[0-9]+$/u",$token) and
|
||||
- !ereg("[0-9]",$this->_lookahead))
|
||||
+ !preg_match("/[0-9]/",$this->_lookahead))
|
||||
{
|
||||
return $token;
|
||||
}
|
||||
// If it's an external range like 'Sheet1'!A1 or 'Sheet1:Sheet2'!A1:B2
|
||||
elseif (preg_match("/^'[\w -]+(\:[\w -]+)?'\!([A-Ia-i]?[A-Za-z])?[0-9]+:([A-Ia-i]?[A-Za-z])?[0-9]+$/u",$token) and
|
||||
- !ereg("[0-9]",$this->_lookahead))
|
||||
+ !preg_match("/[0-9]/",$this->_lookahead))
|
||||
{
|
||||
return $token;
|
||||
}
|
||||
@@ -1258,12 +1258,12 @@
|
||||
return $token;
|
||||
}
|
||||
// If it's a string (of maximum 255 characters)
|
||||
- elseif (ereg("^\"[^\"]{0,255}\"$",$token))
|
||||
+ elseif (preg_match("/^\"[^\"]{0,255}\"$/",$token))
|
||||
{
|
||||
return $token;
|
||||
}
|
||||
// if it's a function call
|
||||
- elseif (eregi("^[A-Z0-9\xc0-\xdc\.]+$",$token) and ($this->_lookahead == "("))
|
||||
+ elseif (preg_match("/^[A-Z0-9\xc0-\xdc\.]+$/i",$token) and ($this->_lookahead == "("))
|
||||
{
|
||||
return $token;
|
||||
}
|
||||
@@ -1363,7 +1363,7 @@
|
||||
function _expression()
|
||||
{
|
||||
// If it's a string return a string node
|
||||
- if (ereg("^\"[^\"]{0,255}\"$", $this->_current_token)) {
|
||||
+ if (preg_match("/^\"[^\"]{0,255}\"$/", $this->_current_token)) {
|
||||
$result = $this->_createTree($this->_current_token, '', '');
|
||||
$this->_advance();
|
||||
return $result;
|
||||
@@ -1521,7 +1521,7 @@
|
||||
return $result;
|
||||
}
|
||||
// if it's a function call
|
||||
- elseif (eregi("^[A-Z0-9\xc0-\xdc\.]+$",$this->_current_token))
|
||||
+ elseif (preg_match("/^[A-Z0-9\xc0-\xdc\.]+$/",$this->_current_token))
|
||||
{
|
||||
$result = $this->_func();
|
||||
return $result;
|
||||
Index: XML/Parser.php
|
||||
===================================================================
|
||||
RCS file: /cvsroot/moodle/moodle/lib/pear/XML/Parser.php,v
|
||||
retrieving revision 1.1
|
||||
diff -u -r1.1 Parser.php
|
||||
--- XML/Parser.php 22 Jun 2009 18:35:56 -0000 1.1
|
||||
+++ XML/Parser.php 18 Nov 2009 04:11:10 -0000
|
||||
@@ -417,7 +417,7 @@
|
||||
/**
|
||||
* check, if file is a remote file
|
||||
*/
|
||||
- if (eregi('^(http|ftp)://', substr($file, 0, 10))) {
|
||||
+ if (preg_match('#^(http|ftp)://#i', substr($file, 0, 10))) {
|
||||
if (!ini_get('allow_url_fopen')) {
|
||||
return $this->
|
||||
raiseError('Remote files cannot be parsed, as safe mode is enabled.',
|
||||
@@ -474,7 +474,7 @@
|
||||
if (is_resource($fp)) {
|
||||
$this->fp = $fp;
|
||||
return true;
|
||||
- } elseif (eregi('^[a-z]+://', substr($fp, 0, 10))) {
|
||||
+ } elseif (preg_match('#^[a-z]+://#i', substr($fp, 0, 10))) {
|
||||
// see if it's an absolute URL (has a scheme at the beginning)
|
||||
return $this->setInputFile($fp);
|
||||
} elseif (file_exists($fp)) {
|
||||
|
@ -1206,7 +1206,7 @@ class Spreadsheet_Excel_Writer_Parser extends PEAR
|
||||
default:
|
||||
// if it's a reference
|
||||
if (preg_match('/^\$?[A-Ia-i]?[A-Za-z]\$?[0-9]+$/',$token) and
|
||||
!ereg("[0-9]",$this->_lookahead) and
|
||||
!preg_match("/[0-9]/",$this->_lookahead) and
|
||||
($this->_lookahead != ':') and ($this->_lookahead != '.') and
|
||||
($this->_lookahead != '!'))
|
||||
{
|
||||
@ -1214,39 +1214,39 @@ class Spreadsheet_Excel_Writer_Parser extends PEAR
|
||||
}
|
||||
// If it's an external reference (Sheet1!A1 or Sheet1:Sheet2!A1)
|
||||
elseif (preg_match("/^\w+(\:\w+)?\![A-Ia-i]?[A-Za-z][0-9]+$/u",$token) and
|
||||
!ereg("[0-9]",$this->_lookahead) and
|
||||
!preg("/[0-9]/",$this->_lookahead) and
|
||||
($this->_lookahead != ':') and ($this->_lookahead != '.'))
|
||||
{
|
||||
return $token;
|
||||
}
|
||||
// If it's an external reference ('Sheet1'!A1 or 'Sheet1:Sheet2'!A1)
|
||||
elseif (preg_match("/^'[\w -]+(\:[\w -]+)?'\![A-Ia-i]?[A-Za-z][0-9]+$/u",$token) and
|
||||
!ereg("[0-9]",$this->_lookahead) and
|
||||
!preg("/[0-9]/",$this->_lookahead) and
|
||||
($this->_lookahead != ':') and ($this->_lookahead != '.'))
|
||||
{
|
||||
return $token;
|
||||
}
|
||||
// if it's a range (A1:A2)
|
||||
elseif (preg_match("/^(\$)?[A-Ia-i]?[A-Za-z](\$)?[0-9]+:(\$)?[A-Ia-i]?[A-Za-z](\$)?[0-9]+$/",$token) and
|
||||
!ereg("[0-9]",$this->_lookahead))
|
||||
!preg_match("/[0-9]/",$this->_lookahead))
|
||||
{
|
||||
return $token;
|
||||
}
|
||||
// if it's a range (A1..A2)
|
||||
elseif (preg_match("/^(\$)?[A-Ia-i]?[A-Za-z](\$)?[0-9]+\.\.(\$)?[A-Ia-i]?[A-Za-z](\$)?[0-9]+$/",$token) and
|
||||
!ereg("[0-9]",$this->_lookahead))
|
||||
!preg_match("/[0-9]/",$this->_lookahead))
|
||||
{
|
||||
return $token;
|
||||
}
|
||||
// If it's an external range like Sheet1!A1 or Sheet1:Sheet2!A1:B2
|
||||
elseif (preg_match("/^\w+(\:\w+)?\!([A-Ia-i]?[A-Za-z])?[0-9]+:([A-Ia-i]?[A-Za-z])?[0-9]+$/u",$token) and
|
||||
!ereg("[0-9]",$this->_lookahead))
|
||||
!preg_match("/[0-9]/",$this->_lookahead))
|
||||
{
|
||||
return $token;
|
||||
}
|
||||
// If it's an external range like 'Sheet1'!A1 or 'Sheet1:Sheet2'!A1:B2
|
||||
elseif (preg_match("/^'[\w -]+(\:[\w -]+)?'\!([A-Ia-i]?[A-Za-z])?[0-9]+:([A-Ia-i]?[A-Za-z])?[0-9]+$/u",$token) and
|
||||
!ereg("[0-9]",$this->_lookahead))
|
||||
!preg_match("/[0-9]/",$this->_lookahead))
|
||||
{
|
||||
return $token;
|
||||
}
|
||||
@ -1258,12 +1258,12 @@ class Spreadsheet_Excel_Writer_Parser extends PEAR
|
||||
return $token;
|
||||
}
|
||||
// If it's a string (of maximum 255 characters)
|
||||
elseif (ereg("^\"[^\"]{0,255}\"$",$token))
|
||||
elseif (preg_match("/^\"[^\"]{0,255}\"$/",$token))
|
||||
{
|
||||
return $token;
|
||||
}
|
||||
// if it's a function call
|
||||
elseif (eregi("^[A-Z0-9\xc0-\xdc\.]+$",$token) and ($this->_lookahead == "("))
|
||||
elseif (preg_match("/^[A-Z0-9\xc0-\xdc\.]+$/i",$token) and ($this->_lookahead == "("))
|
||||
{
|
||||
return $token;
|
||||
}
|
||||
@ -1363,7 +1363,7 @@ class Spreadsheet_Excel_Writer_Parser extends PEAR
|
||||
function _expression()
|
||||
{
|
||||
// If it's a string return a string node
|
||||
if (ereg("^\"[^\"]{0,255}\"$", $this->_current_token)) {
|
||||
if (preg_match("/^\"[^\"]{0,255}\"$/", $this->_current_token)) {
|
||||
$result = $this->_createTree($this->_current_token, '', '');
|
||||
$this->_advance();
|
||||
return $result;
|
||||
@ -1521,7 +1521,7 @@ class Spreadsheet_Excel_Writer_Parser extends PEAR
|
||||
return $result;
|
||||
}
|
||||
// if it's a function call
|
||||
elseif (eregi("^[A-Z0-9\xc0-\xdc\.]+$",$this->_current_token))
|
||||
elseif (preg_match("/^[A-Z0-9\xc0-\xdc\.]+$/",$this->_current_token))
|
||||
{
|
||||
$result = $this->_func();
|
||||
return $result;
|
||||
|
@ -417,7 +417,7 @@ class XML_Parser extends PEAR
|
||||
/**
|
||||
* check, if file is a remote file
|
||||
*/
|
||||
if (eregi('^(http|ftp)://', substr($file, 0, 10))) {
|
||||
if (preg_match('#^(http|ftp)://#i', substr($file, 0, 10))) {
|
||||
if (!ini_get('allow_url_fopen')) {
|
||||
return $this->
|
||||
raiseError('Remote files cannot be parsed, as safe mode is enabled.',
|
||||
@ -474,7 +474,7 @@ class XML_Parser extends PEAR
|
||||
if (is_resource($fp)) {
|
||||
$this->fp = $fp;
|
||||
return true;
|
||||
} elseif (eregi('^[a-z]+://', substr($fp, 0, 10))) {
|
||||
} elseif (preg_match('#^[a-z]+://#i', substr($fp, 0, 10))) {
|
||||
// see if it's an absolute URL (has a scheme at the beginning)
|
||||
return $this->setInputFile($fp);
|
||||
} elseif (file_exists($fp)) {
|
||||
|
277
lib/soap/README_MOODLE.txt
Normal file
277
lib/soap/README_MOODLE.txt
Normal file
@ -0,0 +1,277 @@
|
||||
18 Nov 2009
|
||||
Description of modifications to remove ereg related functions deprecated as of php 5.3. Patch below.
|
||||
|
||||
Index: nusoap.php
|
||||
===================================================================
|
||||
RCS file: /cvsroot/moodle/moodle/lib/soap/nusoap.php,v
|
||||
retrieving revision 1.2
|
||||
diff -u -r1.2 nusoap.php
|
||||
--- nusoap.php 3 Jan 2007 14:44:42 -0000 1.2
|
||||
+++ nusoap.php 18 Nov 2009 05:29:27 -0000
|
||||
@@ -503,7 +503,7 @@
|
||||
case (is_array($val) || $type):
|
||||
// detect if struct or array
|
||||
$valueType = $this->isArraySimpleOrStruct($val);
|
||||
- if($valueType=='arraySimple' || ereg('^ArrayOf',$type)){
|
||||
+ if($valueType=='arraySimple' || preg_match('/^ArrayOf/',$type)){
|
||||
$i = 0;
|
||||
if(is_array($val) && count($val)> 0){
|
||||
foreach($val as $v){
|
||||
@@ -698,7 +698,7 @@
|
||||
*/
|
||||
function expandQname($qname){
|
||||
// get element prefix
|
||||
- if(strpos($qname,':') && !ereg('^http://',$qname)){
|
||||
+ if(strpos($qname,':') && !preg_match('#^http://#',$qname)){
|
||||
// get unqualified name
|
||||
$name = substr(strstr($qname,':'),1);
|
||||
// get ns prefix
|
||||
@@ -826,7 +826,8 @@
|
||||
function timestamp_to_iso8601($timestamp,$utc=true){
|
||||
$datestr = date('Y-m-d\TH:i:sO',$timestamp);
|
||||
if($utc){
|
||||
- $eregStr =
|
||||
+ $regStr =
|
||||
+ '/'.
|
||||
'([0-9]{4})-'. // centuries & years CCYY-
|
||||
'([0-9]{2})-'. // months MM-
|
||||
'([0-9]{2})'. // days DD
|
||||
@@ -834,9 +835,10 @@
|
||||
'([0-9]{2}):'. // hours hh:
|
||||
'([0-9]{2}):'. // minutes mm:
|
||||
'([0-9]{2})(\.[0-9]*)?'. // seconds ss.ss...
|
||||
- '(Z|[+\-][0-9]{2}:?[0-9]{2})?'; // Z to indicate UTC, -/+HH:MM:SS.SS... for local tz's
|
||||
+ '(Z|[+\-][0-9]{2}:?[0-9]{2})?'. // Z to indicate UTC, -/+HH:MM:SS.SS... for local tz's
|
||||
+ '/';
|
||||
|
||||
- if(ereg($eregStr,$datestr,$regs)){
|
||||
+ if(preg_match($eregStr,$datestr,$regs)){
|
||||
return sprintf('%04d-%02d-%02dT%02d:%02d:%02dZ',$regs[1],$regs[2],$regs[3],$regs[4],$regs[5],$regs[6]);
|
||||
}
|
||||
return false;
|
||||
@@ -852,7 +854,8 @@
|
||||
* @access public
|
||||
*/
|
||||
function iso8601_to_timestamp($datestr){
|
||||
- $eregStr =
|
||||
+ $regStr =
|
||||
+ '/'.
|
||||
'([0-9]{4})-'. // centuries & years CCYY-
|
||||
'([0-9]{2})-'. // months MM-
|
||||
'([0-9]{2})'. // days DD
|
||||
@@ -860,8 +863,9 @@
|
||||
'([0-9]{2}):'. // hours hh:
|
||||
'([0-9]{2}):'. // minutes mm:
|
||||
'([0-9]{2})(\.[0-9]+)?'. // seconds ss.ss...
|
||||
- '(Z|[+\-][0-9]{2}:?[0-9]{2})?'; // Z to indicate UTC, -/+HH:MM:SS.SS... for local tz's
|
||||
- if(ereg($eregStr,$datestr,$regs)){
|
||||
+ '(Z|[+\-][0-9]{2}:?[0-9]{2})?'. // Z to indicate UTC, -/+HH:MM:SS.SS... for local tz's
|
||||
+ '/';
|
||||
+ if(preg_match($regStr,$datestr,$regs)){
|
||||
// not utc
|
||||
if($regs[8] != 'Z'){
|
||||
$op = substr($regs[8],0,1);
|
||||
@@ -1171,7 +1175,7 @@
|
||||
if(count($attrs) > 0){
|
||||
foreach($attrs as $k => $v){
|
||||
// if ns declarations, add to class level array of valid namespaces
|
||||
- if(ereg("^xmlns",$k)){
|
||||
+ if(preg_match("/^xmlns/",$k)){
|
||||
//$this->xdebug("$k: $v");
|
||||
//$this->xdebug('ns_prefix: '.$this->getPrefix($k));
|
||||
if($ns_prefix = substr(strrchr($k,':'),1)){
|
||||
@@ -1281,7 +1285,7 @@
|
||||
// minOccurs="0" maxOccurs="unbounded" />
|
||||
// </sequence>
|
||||
// </complexType>
|
||||
- if(isset($attrs['base']) && ereg(':Array$',$attrs['base'])){
|
||||
+ if(isset($attrs['base']) && preg_match('/:Array$/',$attrs['base'])){
|
||||
$this->xdebug('complexType is unusual array');
|
||||
$this->complexTypes[$this->currentComplexType]['phpType'] = 'array';
|
||||
} else {
|
||||
@@ -1300,7 +1304,7 @@
|
||||
// minOccurs="0" maxOccurs="unbounded" />
|
||||
// </sequence>
|
||||
// </complexType>
|
||||
- if(isset($attrs['base']) && ereg(':Array$',$attrs['base'])){
|
||||
+ if(isset($attrs['base']) && preg_match('/:Array$/',$attrs['base'])){
|
||||
$this->xdebug('complexType is unusual array');
|
||||
$this->complexTypes[$this->currentComplexType]['phpType'] = 'array';
|
||||
} else {
|
||||
@@ -1698,7 +1702,7 @@
|
||||
} elseif(isset($this->attributes[$type])){
|
||||
$this->xdebug("in getTypeDef, found attribute $type");
|
||||
return $this->attributes[$type];
|
||||
- } elseif (ereg('_ContainedType$', $type)) {
|
||||
+ } elseif (preg_match('/_ContainedType$/', $type)) {
|
||||
$this->xdebug("in getTypeDef, have an untyped element $type");
|
||||
$typeDef['typeClass'] = 'simpleType';
|
||||
$typeDef['phpType'] = 'scalar';
|
||||
@@ -2041,7 +2045,7 @@
|
||||
function soap_transport_http($url){
|
||||
parent::nusoap_base();
|
||||
$this->setURL($url);
|
||||
- ereg('\$Revisio' . 'n: ([^ ]+)', $this->revision, $rev);
|
||||
+ preg_match('/\$Revisio' . 'n: ([^ ]+)/', $this->revision, $rev);
|
||||
$this->outgoing_headers['User-Agent'] = $this->title.'/'.$this->version.' ('.$rev[1].')';
|
||||
$this->debug('set User-Agent: ' . $this->outgoing_headers['User-Agent']);
|
||||
}
|
||||
@@ -2580,7 +2584,7 @@
|
||||
}
|
||||
}
|
||||
// remove 100 header
|
||||
- if(isset($lb) && ereg('^HTTP/1.1 100',$data)){
|
||||
+ if(isset($lb) && preg_match('/^HTTP/1.1 100/',$data)){
|
||||
unset($lb);
|
||||
$data = '';
|
||||
}//
|
||||
@@ -2733,7 +2737,7 @@
|
||||
curl_close($this->ch);
|
||||
|
||||
// remove 100 header(s)
|
||||
- while (ereg('^HTTP/1.1 100',$data)) {
|
||||
+ while (preg_match('#^HTTP/1.1 100#',$data)) {
|
||||
if ($pos = strpos($data,"\r\n\r\n")) {
|
||||
$data = ltrim(substr($data,$pos));
|
||||
} elseif($pos = strpos($data,"\n\n") ) {
|
||||
@@ -3267,7 +3271,7 @@
|
||||
}
|
||||
$this->debug("In service, query string=$qs");
|
||||
|
||||
- if (ereg('wsdl', $qs) ){
|
||||
+ if (preg_match('/wsdl/', $qs) ){
|
||||
$this->debug("In service, this is a request for WSDL");
|
||||
if($this->externalWSDLURL){
|
||||
if (strpos($this->externalWSDLURL,"://")!==false) { // assume URL
|
||||
@@ -3338,7 +3342,7 @@
|
||||
// get the character encoding of the incoming request
|
||||
if(isset($this->headers['content-type']) && strpos($this->headers['content-type'],'=')){
|
||||
$enc = str_replace('"','',substr(strstr($this->headers["content-type"],'='),1));
|
||||
- if(eregi('^(ISO-8859-1|US-ASCII|UTF-8)$',$enc)){
|
||||
+ if(preg_match('/^(ISO-8859-1|US-ASCII|UTF-8)$/i',$enc)){
|
||||
$this->xml_encoding = strtoupper($enc);
|
||||
} else {
|
||||
$this->xml_encoding = 'US-ASCII';
|
||||
@@ -3367,7 +3371,7 @@
|
||||
$enc = substr(strstr($v, '='), 1);
|
||||
$enc = str_replace('"', '', $enc);
|
||||
$enc = str_replace('\\', '', $enc);
|
||||
- if (eregi('^(ISO-8859-1|US-ASCII|UTF-8)$', $enc)) {
|
||||
+ if (preg_match('/^(ISO-8859-1|US-ASCII|UTF-8)$/i', $enc)) {
|
||||
$this->xml_encoding = strtoupper($enc);
|
||||
} else {
|
||||
$this->xml_encoding = 'US-ASCII';
|
||||
@@ -3401,7 +3405,7 @@
|
||||
$enc = substr(strstr($v, '='), 1);
|
||||
$enc = str_replace('"', '', $enc);
|
||||
$enc = str_replace('\\', '', $enc);
|
||||
- if (eregi('^(ISO-8859-1|US-ASCII|UTF-8)$', $enc)) {
|
||||
+ if (preg_match('/^(ISO-8859-1|US-ASCII|UTF-8)$/i', $enc)) {
|
||||
$this->xml_encoding = strtoupper($enc);
|
||||
} else {
|
||||
$this->xml_encoding = 'US-ASCII';
|
||||
@@ -3730,7 +3734,7 @@
|
||||
$payload .= $this->getDebugAsXMLComment();
|
||||
}
|
||||
$this->outgoing_headers[] = "Server: $this->title Server v$this->version";
|
||||
- ereg('\$Revisio' . 'n: ([^ ]+)', $this->revision, $rev);
|
||||
+ preg_match('/\$Revisio' . 'n: ([^ ]+)/', $this->revision, $rev);
|
||||
$this->outgoing_headers[] = "X-SOAP-Server: $this->title/$this->version (".$rev[1].")";
|
||||
// Let the Web server decide about this
|
||||
//$this->outgoing_headers[] = "Connection: Close\r\n";
|
||||
@@ -3818,7 +3822,7 @@
|
||||
if (strpos($headers['content-type'], '=')) {
|
||||
$enc = str_replace('"', '', substr(strstr($headers["content-type"], '='), 1));
|
||||
$this->debug('Got response encoding: ' . $enc);
|
||||
- if(eregi('^(ISO-8859-1|US-ASCII|UTF-8)$',$enc)){
|
||||
+ if(preg_match('/^(ISO-8859-1|US-ASCII|UTF-8)$/i',$enc)){
|
||||
$this->xml_encoding = strtoupper($enc);
|
||||
} else {
|
||||
$this->xml_encoding = 'US-ASCII';
|
||||
@@ -4336,7 +4340,7 @@
|
||||
$this->currentSchema->schemaStartElement($parser, $name, $attrs);
|
||||
$this->appendDebug($this->currentSchema->getDebug());
|
||||
$this->currentSchema->clearDebug();
|
||||
- } elseif (ereg('schema$', $name)) {
|
||||
+ } elseif (preg_match('/schema$/', $name)) {
|
||||
$this->debug('Parsing WSDL schema');
|
||||
// $this->debug("startElement for $name ($attrs[name]). status = $this->status (".$this->getLocalPart($name).")");
|
||||
$this->status = 'schema';
|
||||
@@ -4355,7 +4359,7 @@
|
||||
if (count($attrs) > 0) {
|
||||
// register namespace declarations
|
||||
foreach($attrs as $k => $v) {
|
||||
- if (ereg("^xmlns", $k)) {
|
||||
+ if (preg_match("/^xmlns/", $k)) {
|
||||
if ($ns_prefix = substr(strrchr($k, ':'), 1)) {
|
||||
$this->namespaces[$ns_prefix] = $v;
|
||||
} else {
|
||||
@@ -4380,7 +4384,7 @@
|
||||
$attrs = array();
|
||||
}
|
||||
// get element prefix, namespace and name
|
||||
- if (ereg(':', $name)) {
|
||||
+ if (preg_match('/:/', $name)) {
|
||||
// get ns prefix
|
||||
$prefix = substr($name, 0, strpos($name, ':'));
|
||||
// get ns
|
||||
@@ -4545,7 +4549,7 @@
|
||||
*/
|
||||
function end_element($parser, $name){
|
||||
// unset schema status
|
||||
- if (/*ereg('types$', $name) ||*/ ereg('schema$', $name)) {
|
||||
+ if (/*preg_match('/types$/', $name) ||*/ preg_match('/schema$/', $name)) {
|
||||
$this->status = "";
|
||||
$this->appendDebug($this->currentSchema->getDebug());
|
||||
$this->currentSchema->clearDebug();
|
||||
@@ -5995,7 +5999,7 @@
|
||||
$key_localpart = $this->getLocalPart($key);
|
||||
// if ns declarations, add to class level array of valid namespaces
|
||||
if($key_prefix == 'xmlns'){
|
||||
- if(ereg('^http://www.w3.org/[0-9]{4}/XMLSchema$',$value)){
|
||||
+ if(preg_match('#^http://www.w3.org/[0-9]{4}/XMLSchema$#',$value)){
|
||||
$this->XMLSchemaVersion = $value;
|
||||
$this->namespaces['xsd'] = $this->XMLSchemaVersion;
|
||||
$this->namespaces['xsi'] = $this->XMLSchemaVersion.'-instance';
|
||||
@@ -6031,8 +6035,8 @@
|
||||
[5] length ::= nextDimension* Digit+
|
||||
[6] nextDimension ::= Digit+ ','
|
||||
*/
|
||||
- $expr = '([A-Za-z0-9_]+):([A-Za-z]+[A-Za-z0-9_]+)\[([0-9]+),?([0-9]*)\]';
|
||||
- if(ereg($expr,$value,$regs)){
|
||||
+ $expr = '/([A-Za-z0-9_]+):([A-Za-z]+[A-Za-z0-9_]+)\[([0-9]+),?([0-9]*)\]/';
|
||||
+ if(preg_match($expr,$value,$regs)){
|
||||
$this->message[$pos]['typePrefix'] = $regs[1];
|
||||
$this->message[$pos]['arrayTypePrefix'] = $regs[1];
|
||||
if (isset($this->namespaces[$regs[1]])) {
|
||||
@@ -6758,7 +6762,7 @@
|
||||
// detect transport
|
||||
switch(true){
|
||||
// http(s)
|
||||
- case ereg('^http',$this->endpoint):
|
||||
+ case preg_match('/^http/',$this->endpoint):
|
||||
$this->debug('transporting via HTTP');
|
||||
if($this->persistentConnection == true && is_object($this->persistentConnection)){
|
||||
$http =& $this->persistentConnection;
|
||||
@@ -6780,10 +6784,10 @@
|
||||
$http->setEncoding($this->http_encoding);
|
||||
}
|
||||
$this->debug('sending message, length='.strlen($msg));
|
||||
- if(ereg('^http:',$this->endpoint)){
|
||||
+ if(preg_match('/^http:/',$this->endpoint)){
|
||||
//if(strpos($this->endpoint,'http:')){
|
||||
$this->responseData = $http->send($msg,$timeout,$response_timeout,$this->cookies);
|
||||
- } elseif(ereg('^https',$this->endpoint)){
|
||||
+ } elseif(preg_match('/^https/',$this->endpoint)){
|
||||
//} elseif(strpos($this->endpoint,'https:')){
|
||||
//if(phpversion() == '4.3.0-dev'){
|
||||
//$response = $http->send($msg,$timeout,$response_timeout);
|
||||
@@ -6841,7 +6845,7 @@
|
||||
if (strpos($headers['content-type'], '=')) {
|
||||
$enc = str_replace('"', '', substr(strstr($headers["content-type"], '='), 1));
|
||||
$this->debug('Got response encoding: ' . $enc);
|
||||
- if(eregi('^(ISO-8859-1|US-ASCII|UTF-8)$',$enc)){
|
||||
+ if(preg_match('/^(ISO-8859-1|US-ASCII|UTF-8)$/i',$enc)){
|
||||
$this->xml_encoding = strtoupper($enc);
|
||||
} else {
|
||||
$this->xml_encoding = 'US-ASCII';
|
@ -503,7 +503,7 @@ class nusoap_base {
|
||||
case (is_array($val) || $type):
|
||||
// detect if struct or array
|
||||
$valueType = $this->isArraySimpleOrStruct($val);
|
||||
if($valueType=='arraySimple' || ereg('^ArrayOf',$type)){
|
||||
if($valueType=='arraySimple' || preg_match('/^ArrayOf/',$type)){
|
||||
$i = 0;
|
||||
if(is_array($val) && count($val)> 0){
|
||||
foreach($val as $v){
|
||||
@ -698,7 +698,7 @@ class nusoap_base {
|
||||
*/
|
||||
function expandQname($qname){
|
||||
// get element prefix
|
||||
if(strpos($qname,':') && !ereg('^http://',$qname)){
|
||||
if(strpos($qname,':') && !preg_match('#^http://#',$qname)){
|
||||
// get unqualified name
|
||||
$name = substr(strstr($qname,':'),1);
|
||||
// get ns prefix
|
||||
@ -826,7 +826,8 @@ class nusoap_base {
|
||||
function timestamp_to_iso8601($timestamp,$utc=true){
|
||||
$datestr = date('Y-m-d\TH:i:sO',$timestamp);
|
||||
if($utc){
|
||||
$eregStr =
|
||||
$regStr =
|
||||
'/'.
|
||||
'([0-9]{4})-'. // centuries & years CCYY-
|
||||
'([0-9]{2})-'. // months MM-
|
||||
'([0-9]{2})'. // days DD
|
||||
@ -834,9 +835,10 @@ function timestamp_to_iso8601($timestamp,$utc=true){
|
||||
'([0-9]{2}):'. // hours hh:
|
||||
'([0-9]{2}):'. // minutes mm:
|
||||
'([0-9]{2})(\.[0-9]*)?'. // seconds ss.ss...
|
||||
'(Z|[+\-][0-9]{2}:?[0-9]{2})?'; // Z to indicate UTC, -/+HH:MM:SS.SS... for local tz's
|
||||
'(Z|[+\-][0-9]{2}:?[0-9]{2})?'. // Z to indicate UTC, -/+HH:MM:SS.SS... for local tz's
|
||||
'/';
|
||||
|
||||
if(ereg($eregStr,$datestr,$regs)){
|
||||
if(preg_match($eregStr,$datestr,$regs)){
|
||||
return sprintf('%04d-%02d-%02dT%02d:%02d:%02dZ',$regs[1],$regs[2],$regs[3],$regs[4],$regs[5],$regs[6]);
|
||||
}
|
||||
return false;
|
||||
@ -852,7 +854,8 @@ function timestamp_to_iso8601($timestamp,$utc=true){
|
||||
* @access public
|
||||
*/
|
||||
function iso8601_to_timestamp($datestr){
|
||||
$eregStr =
|
||||
$regStr =
|
||||
'/'.
|
||||
'([0-9]{4})-'. // centuries & years CCYY-
|
||||
'([0-9]{2})-'. // months MM-
|
||||
'([0-9]{2})'. // days DD
|
||||
@ -860,8 +863,9 @@ function iso8601_to_timestamp($datestr){
|
||||
'([0-9]{2}):'. // hours hh:
|
||||
'([0-9]{2}):'. // minutes mm:
|
||||
'([0-9]{2})(\.[0-9]+)?'. // seconds ss.ss...
|
||||
'(Z|[+\-][0-9]{2}:?[0-9]{2})?'; // Z to indicate UTC, -/+HH:MM:SS.SS... for local tz's
|
||||
if(ereg($eregStr,$datestr,$regs)){
|
||||
'(Z|[+\-][0-9]{2}:?[0-9]{2})?'. // Z to indicate UTC, -/+HH:MM:SS.SS... for local tz's
|
||||
'/';
|
||||
if(preg_match($regStr,$datestr,$regs)){
|
||||
// not utc
|
||||
if($regs[8] != 'Z'){
|
||||
$op = substr($regs[8],0,1);
|
||||
@ -1171,7 +1175,7 @@ class XMLSchema extends nusoap_base {
|
||||
if(count($attrs) > 0){
|
||||
foreach($attrs as $k => $v){
|
||||
// if ns declarations, add to class level array of valid namespaces
|
||||
if(ereg("^xmlns",$k)){
|
||||
if(preg_match("/^xmlns/",$k)){
|
||||
//$this->xdebug("$k: $v");
|
||||
//$this->xdebug('ns_prefix: '.$this->getPrefix($k));
|
||||
if($ns_prefix = substr(strrchr($k,':'),1)){
|
||||
@ -1281,7 +1285,7 @@ class XMLSchema extends nusoap_base {
|
||||
// minOccurs="0" maxOccurs="unbounded" />
|
||||
// </sequence>
|
||||
// </complexType>
|
||||
if(isset($attrs['base']) && ereg(':Array$',$attrs['base'])){
|
||||
if(isset($attrs['base']) && preg_match('/:Array$/',$attrs['base'])){
|
||||
$this->xdebug('complexType is unusual array');
|
||||
$this->complexTypes[$this->currentComplexType]['phpType'] = 'array';
|
||||
} else {
|
||||
@ -1300,7 +1304,7 @@ class XMLSchema extends nusoap_base {
|
||||
// minOccurs="0" maxOccurs="unbounded" />
|
||||
// </sequence>
|
||||
// </complexType>
|
||||
if(isset($attrs['base']) && ereg(':Array$',$attrs['base'])){
|
||||
if(isset($attrs['base']) && preg_match('/:Array$/',$attrs['base'])){
|
||||
$this->xdebug('complexType is unusual array');
|
||||
$this->complexTypes[$this->currentComplexType]['phpType'] = 'array';
|
||||
} else {
|
||||
@ -1698,7 +1702,7 @@ class XMLSchema extends nusoap_base {
|
||||
} elseif(isset($this->attributes[$type])){
|
||||
$this->xdebug("in getTypeDef, found attribute $type");
|
||||
return $this->attributes[$type];
|
||||
} elseif (ereg('_ContainedType$', $type)) {
|
||||
} elseif (preg_match('/_ContainedType$/', $type)) {
|
||||
$this->xdebug("in getTypeDef, have an untyped element $type");
|
||||
$typeDef['typeClass'] = 'simpleType';
|
||||
$typeDef['phpType'] = 'scalar';
|
||||
@ -2041,7 +2045,7 @@ class soap_transport_http extends nusoap_base {
|
||||
function soap_transport_http($url){
|
||||
parent::nusoap_base();
|
||||
$this->setURL($url);
|
||||
ereg('\$Revisio' . 'n: ([^ ]+)', $this->revision, $rev);
|
||||
preg_match('/\$Revisio' . 'n: ([^ ]+)/', $this->revision, $rev);
|
||||
$this->outgoing_headers['User-Agent'] = $this->title.'/'.$this->version.' ('.$rev[1].')';
|
||||
$this->debug('set User-Agent: ' . $this->outgoing_headers['User-Agent']);
|
||||
}
|
||||
@ -2580,7 +2584,7 @@ class soap_transport_http extends nusoap_base {
|
||||
}
|
||||
}
|
||||
// remove 100 header
|
||||
if(isset($lb) && ereg('^HTTP/1.1 100',$data)){
|
||||
if(isset($lb) && preg_match('/^HTTP/1.1 100/',$data)){
|
||||
unset($lb);
|
||||
$data = '';
|
||||
}//
|
||||
@ -2733,7 +2737,7 @@ class soap_transport_http extends nusoap_base {
|
||||
curl_close($this->ch);
|
||||
|
||||
// remove 100 header(s)
|
||||
while (ereg('^HTTP/1.1 100',$data)) {
|
||||
while (preg_match('#^HTTP/1.1 100#',$data)) {
|
||||
if ($pos = strpos($data,"\r\n\r\n")) {
|
||||
$data = ltrim(substr($data,$pos));
|
||||
} elseif($pos = strpos($data,"\n\n") ) {
|
||||
@ -3267,7 +3271,7 @@ class soap_server extends nusoap_base {
|
||||
}
|
||||
$this->debug("In service, query string=$qs");
|
||||
|
||||
if (ereg('wsdl', $qs) ){
|
||||
if (preg_match('/wsdl/', $qs) ){
|
||||
$this->debug("In service, this is a request for WSDL");
|
||||
if($this->externalWSDLURL){
|
||||
if (strpos($this->externalWSDLURL,"://")!==false) { // assume URL
|
||||
@ -3338,7 +3342,7 @@ class soap_server extends nusoap_base {
|
||||
// get the character encoding of the incoming request
|
||||
if(isset($this->headers['content-type']) && strpos($this->headers['content-type'],'=')){
|
||||
$enc = str_replace('"','',substr(strstr($this->headers["content-type"],'='),1));
|
||||
if(eregi('^(ISO-8859-1|US-ASCII|UTF-8)$',$enc)){
|
||||
if(preg_match('/^(ISO-8859-1|US-ASCII|UTF-8)$/i',$enc)){
|
||||
$this->xml_encoding = strtoupper($enc);
|
||||
} else {
|
||||
$this->xml_encoding = 'US-ASCII';
|
||||
@ -3367,7 +3371,7 @@ class soap_server extends nusoap_base {
|
||||
$enc = substr(strstr($v, '='), 1);
|
||||
$enc = str_replace('"', '', $enc);
|
||||
$enc = str_replace('\\', '', $enc);
|
||||
if (eregi('^(ISO-8859-1|US-ASCII|UTF-8)$', $enc)) {
|
||||
if (preg_match('/^(ISO-8859-1|US-ASCII|UTF-8)$/i', $enc)) {
|
||||
$this->xml_encoding = strtoupper($enc);
|
||||
} else {
|
||||
$this->xml_encoding = 'US-ASCII';
|
||||
@ -3401,7 +3405,7 @@ class soap_server extends nusoap_base {
|
||||
$enc = substr(strstr($v, '='), 1);
|
||||
$enc = str_replace('"', '', $enc);
|
||||
$enc = str_replace('\\', '', $enc);
|
||||
if (eregi('^(ISO-8859-1|US-ASCII|UTF-8)$', $enc)) {
|
||||
if (preg_match('/^(ISO-8859-1|US-ASCII|UTF-8)$/i', $enc)) {
|
||||
$this->xml_encoding = strtoupper($enc);
|
||||
} else {
|
||||
$this->xml_encoding = 'US-ASCII';
|
||||
@ -3730,7 +3734,7 @@ class soap_server extends nusoap_base {
|
||||
$payload .= $this->getDebugAsXMLComment();
|
||||
}
|
||||
$this->outgoing_headers[] = "Server: $this->title Server v$this->version";
|
||||
ereg('\$Revisio' . 'n: ([^ ]+)', $this->revision, $rev);
|
||||
preg_match('/\$Revisio' . 'n: ([^ ]+)/', $this->revision, $rev);
|
||||
$this->outgoing_headers[] = "X-SOAP-Server: $this->title/$this->version (".$rev[1].")";
|
||||
// Let the Web server decide about this
|
||||
//$this->outgoing_headers[] = "Connection: Close\r\n";
|
||||
@ -3818,7 +3822,7 @@ class soap_server extends nusoap_base {
|
||||
if (strpos($headers['content-type'], '=')) {
|
||||
$enc = str_replace('"', '', substr(strstr($headers["content-type"], '='), 1));
|
||||
$this->debug('Got response encoding: ' . $enc);
|
||||
if(eregi('^(ISO-8859-1|US-ASCII|UTF-8)$',$enc)){
|
||||
if(preg_match('/^(ISO-8859-1|US-ASCII|UTF-8)$/i',$enc)){
|
||||
$this->xml_encoding = strtoupper($enc);
|
||||
} else {
|
||||
$this->xml_encoding = 'US-ASCII';
|
||||
@ -4336,7 +4340,7 @@ class wsdl extends nusoap_base {
|
||||
$this->currentSchema->schemaStartElement($parser, $name, $attrs);
|
||||
$this->appendDebug($this->currentSchema->getDebug());
|
||||
$this->currentSchema->clearDebug();
|
||||
} elseif (ereg('schema$', $name)) {
|
||||
} elseif (preg_match('/schema$/', $name)) {
|
||||
$this->debug('Parsing WSDL schema');
|
||||
// $this->debug("startElement for $name ($attrs[name]). status = $this->status (".$this->getLocalPart($name).")");
|
||||
$this->status = 'schema';
|
||||
@ -4355,7 +4359,7 @@ class wsdl extends nusoap_base {
|
||||
if (count($attrs) > 0) {
|
||||
// register namespace declarations
|
||||
foreach($attrs as $k => $v) {
|
||||
if (ereg("^xmlns", $k)) {
|
||||
if (preg_match("/^xmlns/", $k)) {
|
||||
if ($ns_prefix = substr(strrchr($k, ':'), 1)) {
|
||||
$this->namespaces[$ns_prefix] = $v;
|
||||
} else {
|
||||
@ -4380,7 +4384,7 @@ class wsdl extends nusoap_base {
|
||||
$attrs = array();
|
||||
}
|
||||
// get element prefix, namespace and name
|
||||
if (ereg(':', $name)) {
|
||||
if (preg_match('/:/', $name)) {
|
||||
// get ns prefix
|
||||
$prefix = substr($name, 0, strpos($name, ':'));
|
||||
// get ns
|
||||
@ -4545,7 +4549,7 @@ class wsdl extends nusoap_base {
|
||||
*/
|
||||
function end_element($parser, $name){
|
||||
// unset schema status
|
||||
if (/*ereg('types$', $name) ||*/ ereg('schema$', $name)) {
|
||||
if (/*preg_match('/types$/', $name) ||*/ preg_match('/schema$/', $name)) {
|
||||
$this->status = "";
|
||||
$this->appendDebug($this->currentSchema->getDebug());
|
||||
$this->currentSchema->clearDebug();
|
||||
@ -5995,7 +5999,7 @@ class soap_parser extends nusoap_base {
|
||||
$key_localpart = $this->getLocalPart($key);
|
||||
// if ns declarations, add to class level array of valid namespaces
|
||||
if($key_prefix == 'xmlns'){
|
||||
if(ereg('^http://www.w3.org/[0-9]{4}/XMLSchema$',$value)){
|
||||
if(preg_match('#^http://www.w3.org/[0-9]{4}/XMLSchema$#',$value)){
|
||||
$this->XMLSchemaVersion = $value;
|
||||
$this->namespaces['xsd'] = $this->XMLSchemaVersion;
|
||||
$this->namespaces['xsi'] = $this->XMLSchemaVersion.'-instance';
|
||||
@ -6031,8 +6035,8 @@ class soap_parser extends nusoap_base {
|
||||
[5] length ::= nextDimension* Digit+
|
||||
[6] nextDimension ::= Digit+ ','
|
||||
*/
|
||||
$expr = '([A-Za-z0-9_]+):([A-Za-z]+[A-Za-z0-9_]+)\[([0-9]+),?([0-9]*)\]';
|
||||
if(ereg($expr,$value,$regs)){
|
||||
$expr = '/([A-Za-z0-9_]+):([A-Za-z]+[A-Za-z0-9_]+)\[([0-9]+),?([0-9]*)\]/';
|
||||
if(preg_match($expr,$value,$regs)){
|
||||
$this->message[$pos]['typePrefix'] = $regs[1];
|
||||
$this->message[$pos]['arrayTypePrefix'] = $regs[1];
|
||||
if (isset($this->namespaces[$regs[1]])) {
|
||||
@ -6758,7 +6762,7 @@ class soap_client extends nusoap_base {
|
||||
// detect transport
|
||||
switch(true){
|
||||
// http(s)
|
||||
case ereg('^http',$this->endpoint):
|
||||
case preg_match('/^http/',$this->endpoint):
|
||||
$this->debug('transporting via HTTP');
|
||||
if($this->persistentConnection == true && is_object($this->persistentConnection)){
|
||||
$http =& $this->persistentConnection;
|
||||
@ -6780,10 +6784,10 @@ class soap_client extends nusoap_base {
|
||||
$http->setEncoding($this->http_encoding);
|
||||
}
|
||||
$this->debug('sending message, length='.strlen($msg));
|
||||
if(ereg('^http:',$this->endpoint)){
|
||||
if(preg_match('/^http:/',$this->endpoint)){
|
||||
//if(strpos($this->endpoint,'http:')){
|
||||
$this->responseData = $http->send($msg,$timeout,$response_timeout,$this->cookies);
|
||||
} elseif(ereg('^https',$this->endpoint)){
|
||||
} elseif(preg_match('/^https/',$this->endpoint)){
|
||||
//} elseif(strpos($this->endpoint,'https:')){
|
||||
//if(phpversion() == '4.3.0-dev'){
|
||||
//$response = $http->send($msg,$timeout,$response_timeout);
|
||||
@ -6841,7 +6845,7 @@ class soap_client extends nusoap_base {
|
||||
if (strpos($headers['content-type'], '=')) {
|
||||
$enc = str_replace('"', '', substr(strstr($headers["content-type"], '='), 1));
|
||||
$this->debug('Got response encoding: ' . $enc);
|
||||
if(eregi('^(ISO-8859-1|US-ASCII|UTF-8)$',$enc)){
|
||||
if(preg_match('/^(ISO-8859-1|US-ASCII|UTF-8)$/i',$enc)){
|
||||
$this->xml_encoding = strtoupper($enc);
|
||||
} else {
|
||||
$this->xml_encoding = 'US-ASCII';
|
||||
|
@ -29,3 +29,24 @@ by David Mudrak <david.mudrak@gmail.com>
|
||||
accessible directly. However, it doesn't seem to be used within the
|
||||
library code.
|
||||
|
||||
|
||||
|
||||
18 Nov 2009
|
||||
Description of modifications to remove ereg related functions deprecated as of php 5.3. Patch below.
|
||||
|
||||
Index: tcpdf.php
|
||||
===================================================================
|
||||
RCS file: /cvsroot/moodle/moodle/lib/tcpdf/tcpdf.php,v
|
||||
retrieving revision 1.3
|
||||
diff -u -r1.3 tcpdf.php
|
||||
--- tcpdf.php 20 Jul 2009 17:31:48 -0000 1.3
|
||||
+++ tcpdf.php 18 Nov 2009 05:48:56 -0000
|
||||
@@ -7595,7 +7595,7 @@
|
||||
if (isset($dash)) {
|
||||
$dash_string = '';
|
||||
if ($dash) {
|
||||
- if (ereg('^.+,', $dash)) {
|
||||
+ if (preg_match('/^.+,/', $dash)) {
|
||||
$tab = explode(',', $dash);
|
||||
} else {
|
||||
$tab = array($dash);
|
||||
|
@ -7595,7 +7595,7 @@ if (!class_exists('TCPDF', false)) {
|
||||
if (isset($dash)) {
|
||||
$dash_string = '';
|
||||
if ($dash) {
|
||||
if (ereg('^.+,', $dash)) {
|
||||
if (preg_match('/^.+,/', $dash)) {
|
||||
$tab = explode(',', $dash);
|
||||
} else {
|
||||
$tab = array($dash);
|
||||
|
@ -987,13 +987,13 @@ class t3lib_cs {
|
||||
|
||||
// Detect type if not done yet: (Done on first real line)
|
||||
// The "whitespaced" type is on the syntax "0x0A 0x000A #LINE FEED" while "ms-token" is like "B9 = U+00B9 : SUPERSCRIPT ONE"
|
||||
if (!$detectedType) $detectedType = ereg('[[:space:]]*0x([[:alnum:]]*)[[:space:]]+0x([[:alnum:]]*)[[:space:]]+',$value) ? 'whitespaced' : 'ms-token';
|
||||
if (!$detectedType) $detectedType = preg_match('/[[:space:]]*0x([[:alnum:]]*)[[:space:]]+0x([[:alnum:]]*)[[:space:]]+/',$value) ? 'whitespaced' : 'ms-token';
|
||||
|
||||
if ($detectedType=='ms-token') {
|
||||
list($hexbyte,$utf8) = split('=|:',$value,3);
|
||||
} elseif ($detectedType=='whitespaced') {
|
||||
$regA=array();
|
||||
ereg('[[:space:]]*0x([[:alnum:]]*)[[:space:]]+0x([[:alnum:]]*)[[:space:]]+',$value,$regA);
|
||||
preg_match('/[[:space:]]*0x([[:alnum:]]*)[[:space:]]+0x([[:alnum:]]*)[[:space:]]+/',$value,$regA);
|
||||
$hexbyte = $regA[1];
|
||||
$utf8 = 'U+'.$regA[2];
|
||||
}
|
||||
@ -1097,7 +1097,7 @@ class t3lib_cs {
|
||||
|
||||
// accented Latin letters without "official" decomposition
|
||||
$match = array();
|
||||
if (ereg('^LATIN (SMALL|CAPITAL) LETTER ([A-Z]) WITH',$name,$match) && !$decomp) {
|
||||
if (preg_match('/^LATIN (SMALL|CAPITAL) LETTER ([A-Z]) WITH/',$name,$match) && !$decomp) {
|
||||
$c = ord($match[2]);
|
||||
if ($match[1] == 'SMALL') $c += 32;
|
||||
|
||||
@ -1106,7 +1106,7 @@ class t3lib_cs {
|
||||
}
|
||||
|
||||
$match = array();
|
||||
if (ereg('(<.*>)? *(.+)',$decomp,$match)) {
|
||||
if (preg_match('/(<.*>)? *(.+)/',$decomp,$match)) {
|
||||
switch($match[1]) {
|
||||
case '<circle>': // add parenthesis as circle replacement, eg (1)
|
||||
$match[2] = '0028 '.$match[2].' 0029';
|
||||
@ -1117,7 +1117,7 @@ class t3lib_cs {
|
||||
break;
|
||||
|
||||
case '<compat>': // ignore multi char decompositions that start with a space
|
||||
if (ereg('^0020 ',$match[2])) continue 2;
|
||||
if (preg_match('/^0020 /',$match[2])) continue 2;
|
||||
break;
|
||||
|
||||
// ignore Arabic and vertical layout presentation decomposition
|
||||
|
@ -1063,7 +1063,7 @@ final class t3lib_div {
|
||||
*/
|
||||
public static function split_fileref($fileref) {
|
||||
$reg = array();
|
||||
if ( ereg('(.*/)(.*)$',$fileref,$reg) ) {
|
||||
if ( preg_match('#(.*/)(.*)$#',$fileref,$reg) ) {
|
||||
$info['path'] = $reg[1];
|
||||
$info['file'] = $reg[2];
|
||||
} else {
|
||||
@ -1071,7 +1071,7 @@ final class t3lib_div {
|
||||
$info['file'] = $fileref;
|
||||
}
|
||||
$reg='';
|
||||
if ( ereg('(.*)\.([^\.]*$)',$info['file'],$reg) ) {
|
||||
if ( preg_match('#(.*)\.([^\.]*$)#',$info['file'],$reg) ) {
|
||||
$info['filebody'] = $reg[1];
|
||||
$info['fileext'] = strtolower($reg[2]);
|
||||
$info['realFileext'] = $reg[2];
|
||||
@ -1423,7 +1423,7 @@ final class t3lib_div {
|
||||
if (strpos($email,' ') !== false) {
|
||||
return false;
|
||||
}
|
||||
return ereg('^[A-Za-z0-9\._-]+[@][A-Za-z0-9\._-]+[\.].[A-Za-z0-9]+$',$email) ? TRUE : FALSE;
|
||||
return preg_match('/^[A-Za-z0-9\._-]+[@][A-Za-z0-9\._-]+[\.].[A-Za-z0-9]+$/',$email) ? TRUE : FALSE;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -2713,7 +2713,7 @@ final class t3lib_div {
|
||||
// Checking if the "subdir" is found:
|
||||
$subdir = substr($fI['dirname'],strlen($dirName));
|
||||
if ($subdir) {
|
||||
if (ereg('^[[:alnum:]_]+\/$',$subdir) || ereg('^[[:alnum:]_]+\/[[:alnum:]_]+\/$',$subdir)) {
|
||||
if (preg_match('#^[[:alnum:]_]+\/$#',$subdir) || preg_match('#^[[:alnum:]_]+\/[[:alnum:]_]+\/$#',$subdir)) {
|
||||
$dirName.= $subdir;
|
||||
if (!@is_dir($dirName)) {
|
||||
t3lib_div::mkdir_deep(PATH_site.'typo3temp/', $subdir);
|
||||
@ -3785,7 +3785,7 @@ final class t3lib_div {
|
||||
*/
|
||||
public static function verifyFilenameAgainstDenyPattern($filename) {
|
||||
if (strcmp($filename,'') && strcmp($GLOBALS['TYPO3_CONF_VARS']['BE']['fileDenyPattern'],'')) {
|
||||
$result = eregi($GLOBALS['TYPO3_CONF_VARS']['BE']['fileDenyPattern'],$filename);
|
||||
$result = preg_match('/'.$GLOBALS['TYPO3_CONF_VARS']['BE']['fileDenyPattern'].'/i',$filename);
|
||||
if ($result) return false; // so if a matching filename is found, return false;
|
||||
}
|
||||
return true;
|
||||
@ -5103,12 +5103,12 @@ final class t3lib_div {
|
||||
if($quoteActive > -1) {
|
||||
$paramsArr[$quoteActive] .= ' '.$v;
|
||||
unset($paramsArr[$k]);
|
||||
if(ereg('"$', $v)) { $quoteActive = -1; }
|
||||
if(preg_match('/"$/', $v)) { $quoteActive = -1; }
|
||||
|
||||
} elseif(!trim($v)) {
|
||||
unset($paramsArr[$k]); // Remove empty elements
|
||||
|
||||
} elseif(ereg('^"', $v)) {
|
||||
} elseif(preg_match('/^"/', $v)) {
|
||||
$quoteActive = $k;
|
||||
}
|
||||
}
|
||||
|
@ -2,4 +2,126 @@ Description of Typo3 libraries (v 4.2.1) import into Moodle
|
||||
|
||||
skodak, stronk7
|
||||
|
||||
$Id$
|
||||
|
||||
|
||||
18 Nov 2009
|
||||
Description of modifications to remove ereg related functions deprecated as of php 5.3. Patch below.
|
||||
|
||||
Index: class.t3lib_cs.php
|
||||
===================================================================
|
||||
RCS file: /cvsroot/moodle/moodle/lib/typo3/class.t3lib_cs.php,v
|
||||
retrieving revision 1.10
|
||||
diff -u -r1.10 class.t3lib_cs.php
|
||||
--- class.t3lib_cs.php 17 Nov 2009 01:36:35 -0000 1.10
|
||||
+++ class.t3lib_cs.php 18 Nov 2009 05:51:54 -0000
|
||||
@@ -987,13 +987,13 @@
|
||||
|
||||
// Detect type if not done yet: (Done on first real line)
|
||||
// The "whitespaced" type is on the syntax "0x0A 0x000A #LINE FEED" while "ms-token" is like "B9 = U+00B9 : SUPERSCRIPT ONE"
|
||||
- if (!$detectedType) $detectedType = ereg('[[:space:]]*0x([[:alnum:]]*)[[:space:]]+0x([[:alnum:]]*)[[:space:]]+',$value) ? 'whitespaced' : 'ms-token';
|
||||
+ if (!$detectedType) $detectedType = preg_match('/[[:space:]]*0x([[:alnum:]]*)[[:space:]]+0x([[:alnum:]]*)[[:space:]]+/',$value) ? 'whitespaced' : 'ms-token';
|
||||
|
||||
if ($detectedType=='ms-token') {
|
||||
list($hexbyte,$utf8) = split('=|:',$value,3);
|
||||
} elseif ($detectedType=='whitespaced') {
|
||||
$regA=array();
|
||||
- ereg('[[:space:]]*0x([[:alnum:]]*)[[:space:]]+0x([[:alnum:]]*)[[:space:]]+',$value,$regA);
|
||||
+ preg_match('/[[:space:]]*0x([[:alnum:]]*)[[:space:]]+0x([[:alnum:]]*)[[:space:]]+/',$value,$regA);
|
||||
$hexbyte = $regA[1];
|
||||
$utf8 = 'U+'.$regA[2];
|
||||
}
|
||||
@@ -1097,7 +1097,7 @@
|
||||
|
||||
// accented Latin letters without "official" decomposition
|
||||
$match = array();
|
||||
- if (ereg('^LATIN (SMALL|CAPITAL) LETTER ([A-Z]) WITH',$name,$match) && !$decomp) {
|
||||
+ if (preg_match('/^LATIN (SMALL|CAPITAL) LETTER ([A-Z]) WITH/',$name,$match) && !$decomp) {
|
||||
$c = ord($match[2]);
|
||||
if ($match[1] == 'SMALL') $c += 32;
|
||||
|
||||
@@ -1106,7 +1106,7 @@
|
||||
}
|
||||
|
||||
$match = array();
|
||||
- if (ereg('(<.*>)? *(.+)',$decomp,$match)) {
|
||||
+ if (preg_match('/(<.*>)? *(.+)/',$decomp,$match)) {
|
||||
switch($match[1]) {
|
||||
case '<circle>': // add parenthesis as circle replacement, eg (1)
|
||||
$match[2] = '0028 '.$match[2].' 0029';
|
||||
@@ -1117,7 +1117,7 @@
|
||||
break;
|
||||
|
||||
case '<compat>': // ignore multi char decompositions that start with a space
|
||||
- if (ereg('^0020 ',$match[2])) continue 2;
|
||||
+ if (preg_match('/^0020 /',$match[2])) continue 2;
|
||||
break;
|
||||
|
||||
// ignore Arabic and vertical layout presentation decomposition
|
||||
Index: class.t3lib_div.php
|
||||
===================================================================
|
||||
RCS file: /cvsroot/moodle/moodle/lib/typo3/class.t3lib_div.php,v
|
||||
retrieving revision 1.5
|
||||
diff -u -r1.5 class.t3lib_div.php
|
||||
--- class.t3lib_div.php 17 Nov 2009 01:36:35 -0000 1.5
|
||||
+++ class.t3lib_div.php 18 Nov 2009 05:51:59 -0000
|
||||
@@ -1063,7 +1063,7 @@
|
||||
*/
|
||||
public static function split_fileref($fileref) {
|
||||
$reg = array();
|
||||
- if ( ereg('(.*/)(.*)$',$fileref,$reg) ) {
|
||||
+ if ( preg_match('#(.*/)(.*)$#',$fileref,$reg) ) {
|
||||
$info['path'] = $reg[1];
|
||||
$info['file'] = $reg[2];
|
||||
} else {
|
||||
@@ -1071,7 +1071,7 @@
|
||||
$info['file'] = $fileref;
|
||||
}
|
||||
$reg='';
|
||||
- if ( ereg('(.*)\.([^\.]*$)',$info['file'],$reg) ) {
|
||||
+ if ( preg_match('#(.*)\.([^\.]*$)#',$info['file'],$reg) ) {
|
||||
$info['filebody'] = $reg[1];
|
||||
$info['fileext'] = strtolower($reg[2]);
|
||||
$info['realFileext'] = $reg[2];
|
||||
@@ -1423,7 +1423,7 @@
|
||||
if (strpos($email,' ') !== false) {
|
||||
return false;
|
||||
}
|
||||
- return ereg('^[A-Za-z0-9\._-]+[@][A-Za-z0-9\._-]+[\.].[A-Za-z0-9]+$',$email) ? TRUE : FALSE;
|
||||
+ return preg_match('/^[A-Za-z0-9\._-]+[@][A-Za-z0-9\._-]+[\.].[A-Za-z0-9]+$/',$email) ? TRUE : FALSE;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -2713,7 +2713,7 @@
|
||||
// Checking if the "subdir" is found:
|
||||
$subdir = substr($fI['dirname'],strlen($dirName));
|
||||
if ($subdir) {
|
||||
- if (ereg('^[[:alnum:]_]+\/$',$subdir) || ereg('^[[:alnum:]_]+\/[[:alnum:]_]+\/$',$subdir)) {
|
||||
+ if (preg_match('#^[[:alnum:]_]+\/$#',$subdir) || preg_match('#^[[:alnum:]_]+\/[[:alnum:]_]+\/$#',$subdir)) {
|
||||
$dirName.= $subdir;
|
||||
if (!@is_dir($dirName)) {
|
||||
t3lib_div::mkdir_deep(PATH_site.'typo3temp/', $subdir);
|
||||
@@ -3785,7 +3785,7 @@
|
||||
*/
|
||||
public static function verifyFilenameAgainstDenyPattern($filename) {
|
||||
if (strcmp($filename,'') && strcmp($GLOBALS['TYPO3_CONF_VARS']['BE']['fileDenyPattern'],'')) {
|
||||
- $result = eregi($GLOBALS['TYPO3_CONF_VARS']['BE']['fileDenyPattern'],$filename);
|
||||
+ $result = preg_match('/'.$GLOBALS['TYPO3_CONF_VARS']['BE']['fileDenyPattern'].'/i',$filename);
|
||||
if ($result) return false; // so if a matching filename is found, return false;
|
||||
}
|
||||
return true;
|
||||
@@ -5103,12 +5103,12 @@
|
||||
if($quoteActive > -1) {
|
||||
$paramsArr[$quoteActive] .= ' '.$v;
|
||||
unset($paramsArr[$k]);
|
||||
- if(ereg('"$', $v)) { $quoteActive = -1; }
|
||||
+ if(preg_match('/"$/', $v)) { $quoteActive = -1; }
|
||||
|
||||
} elseif(!trim($v)) {
|
||||
unset($paramsArr[$k]); // Remove empty elements
|
||||
|
||||
- } elseif(ereg('^"', $v)) {
|
||||
+ } elseif(preg_match('/^"/', $v)) {
|
||||
$quoteActive = $k;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -174,7 +174,7 @@ function validateUrlSyntax( $urladdr, $options="" ){
|
||||
// $options = strtolower($options);
|
||||
|
||||
// Check Options Parameter
|
||||
if (!ereg( '^([sHSEFuPaIpfqr][+?-])*$', $options ))
|
||||
if (!preg_match( '/^([sHSEFuPaIpfqr][+?-])*$/', $options ))
|
||||
{
|
||||
trigger_error("Options attribute malformed", E_USER_ERROR);
|
||||
}
|
||||
@ -315,7 +315,7 @@ function validateUrlSyntax( $urladdr, $options="" ){
|
||||
// echo '<pre>' . htmlentities(wordwrap($regexp,70,"\n",1)) . '</pre>';
|
||||
|
||||
// Running the regular expression
|
||||
if (eregi( $regexp, $urladdr ))
|
||||
if (preg_match( preg_quote($regexp,'/'), $urladdr ))
|
||||
{
|
||||
return true; // The domain passed
|
||||
}
|
||||
@ -377,7 +377,7 @@ function validateUrlSyntax( $urladdr, $options="" ){
|
||||
function validateEmailSyntax( $emailaddr, $options="" ){
|
||||
|
||||
// Check Options Parameter
|
||||
if (!ereg( '^([sHSEFuPaIpfqr][+?-])*$', $options ))
|
||||
if (!preg_match( '/^([sHSEFuPaIpfqr][+?-])*$/', $options ))
|
||||
{
|
||||
trigger_error("Options attribute malformed", E_USER_ERROR);
|
||||
}
|
||||
@ -485,7 +485,7 @@ function validateEmailSyntax( $emailaddr, $options="" ){
|
||||
function validateFtpSyntax( $ftpaddr, $options="" ){
|
||||
|
||||
// Check Options Parameter
|
||||
if (!ereg( '^([sHSEFuPaIpfqr][+?-])*$', $options ))
|
||||
if (!preg_match( '/^([sHSEFuPaIpfqr][+?-])*$/', $options ))
|
||||
{
|
||||
trigger_error("Options attribute malformed", E_USER_ERROR);
|
||||
}
|
||||
|
@ -178,7 +178,7 @@ class webdav_client {
|
||||
|
||||
$regs = array();
|
||||
/* [1] [2] [3] [4] [5] [6] */
|
||||
if (ereg('^([0-9]{4})-([0-9]{2})-([0-9]{2})T([0-9]{2}):([0-9]{2}):([0-9]{2})Z$', $iso8601, $regs)) {
|
||||
if (preg_match('/^([0-9]{4})-([0-9]{2})-([0-9]{2})T([0-9]{2}):([0-9]{2}):([0-9]{2})Z$/', $iso8601, $regs)) {
|
||||
return mktime($regs[4],$regs[5], $regs[6], $regs[2], $regs[3], $regs[1]);
|
||||
}
|
||||
// to be done: regex for partial-time...apache webdav mod never returns partial-time
|
||||
|
@ -736,11 +736,11 @@ function page_doc_link($text='', $iconpath='') {
|
||||
*/
|
||||
function validate_email($address) {
|
||||
|
||||
return (ereg('^[-!#$%&\'*+\\/0-9=?A-Z^_`a-z{|}~]+'.
|
||||
'(\.[-!#$%&\'*+\\/0-9=?A-Z^_`a-z{|}~]+)*'.
|
||||
return (preg_match('#^[-!\#$%&\'*+\\/0-9=?A-Z^_`a-z{|}~]+'.
|
||||
'(\.[-!\#$%&\'*+\\/0-9=?A-Z^_`a-z{|}~]+)*'.
|
||||
'@'.
|
||||
'[-!#$%&\'*+\\/0-9=?A-Z^_`a-z{|}~]+\.'.
|
||||
'[-!#$%&\'*+\\./0-9=?A-Z^_`a-z{|}~]+$',
|
||||
'[-!\#$%&\'*+\\/0-9=?A-Z^_`a-z{|}~]+\.'.
|
||||
'[-!\#$%&\'*+\\./0-9=?A-Z^_`a-z{|}~]+$#',
|
||||
$address));
|
||||
}
|
||||
|
||||
|
@ -229,7 +229,7 @@ class WikiToMarkdown {
|
||||
// MARKDOWN: no change so leave
|
||||
|
||||
// is this a list line (starts with * # ; :)
|
||||
if (eregi( "^([*]+|[#]+|[;]+|[:]+) ", $line )) {
|
||||
if (preg_match( "/^([*]+|[#]+|[;]+|[:]+) /i", $line )) {
|
||||
$line = $this->do_list( $line );
|
||||
}
|
||||
|
||||
@ -331,7 +331,7 @@ class WikiToMarkdown {
|
||||
// run through lines
|
||||
foreach( $lines as $line ) {
|
||||
// is this a blank line?
|
||||
$blank_line = eregi( "^[[:blank:]\r]*$", $line );
|
||||
$blank_line = preg_match( "/^[[:blank:]\r]*$/i", $line );
|
||||
if ($blank_line) {
|
||||
// first end current block according to state
|
||||
$buffer = $buffer . $this->close_block( $this->block_state );
|
||||
@ -342,13 +342,13 @@ class WikiToMarkdown {
|
||||
// act now depending on current block state
|
||||
if ($this->block_state == STATE_NONE) {
|
||||
// first character of line defines block type
|
||||
if (eregi( "^> ",$line )) {
|
||||
if (preg_match( "/^> /i",$line )) {
|
||||
// blockquote
|
||||
$buffer = $buffer . $this->line_replace( $line ). "\n";
|
||||
$this->block_state = STATE_BLOCKQUOTE;
|
||||
}
|
||||
else
|
||||
if (eregi( "^ ",$line) ) {
|
||||
if (preg_match( "/^ /i",$line) ) {
|
||||
// preformatted text
|
||||
// MARKDOWN: no real equiv. so just use <pre>
|
||||
$buffer = $buffer . "<pre>\n";
|
||||
@ -356,7 +356,7 @@ class WikiToMarkdown {
|
||||
$this->block_state = STATE_PREFORM;
|
||||
}
|
||||
else
|
||||
if (eregi("^\% ",$line) ) {
|
||||
if (preg_match("/^\% /i",$line) ) {
|
||||
// preformatted text - no processing
|
||||
// MARKDOWN: this is MD code form of a paragraph
|
||||
$buffer = $buffer . " " . preg_replace( "/^\%/i","",$line) . "\n";
|
||||
|
@ -314,7 +314,7 @@ function mnet_server_dummy_method($methodname, $argsarray, $functionname) {
|
||||
global $MNET_REMOTE_CLIENT;
|
||||
|
||||
if (is_object($MNET_REMOTE_CLIENT->object_to_call)) {
|
||||
return @call_user_method_array($functionname, $MNET_REMOTE_CLIENT->object_to_call, $argsarray);
|
||||
return @call_user_func_array(array($MNET_REMOTE_CLIENT->object_to_call,$functionname), $argsarray);
|
||||
} else if (!empty($MNET_REMOTE_CLIENT->static_location)) {
|
||||
return @call_user_func_array(array($MNET_REMOTE_CLIENT->static_location, $functionname), $argsarray);
|
||||
} else {
|
||||
|
@ -15,7 +15,7 @@
|
||||
|
||||
|
||||
#-- stupid legacy code
|
||||
if (!eregi("modules.php", $PHP_SELF)) {
|
||||
if (!preg_match("/modules.php/i", $PHP_SELF)) {
|
||||
die ("You can't access this file directly...");
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user