]> git.mjollnir.org Git - moodle.git/commitdiff
all MDL-20821 Removed more deprecated functions
authorAndrew Davis <andrew@affinitysoftware.net>
Wed, 18 Nov 2009 06:05:10 +0000 (06:05 +0000)
committerAndrew Davis <andrew@affinitysoftware.net>
Wed, 18 Nov 2009 06:05:10 +0000 (06:05 +0000)
25 files changed:
lib/bennu/iCalendar_rfc2445.php
lib/bennu/readme_moodle.txt [new file with mode: 0644]
lib/deprecatedlib.php
lib/excel/Parser.php
lib/excel/Worksheet.php
lib/excel/readme_moodle.txt [new file with mode: 0644]
lib/filelib.php
lib/geoip/geoip.inc
lib/geoip/readme_moodle.txt [new file with mode: 0644]
lib/pear/README_MOODLE.txt
lib/pear/Spreadsheet/Excel/Writer/Parser.php
lib/pear/XML/Parser.php
lib/soap/README_MOODLE.txt [new file with mode: 0644]
lib/soap/nusoap.php
lib/tcpdf/README-MOODLE.TXT
lib/tcpdf/tcpdf.php
lib/typo3/class.t3lib_cs.php
lib/typo3/class.t3lib_div.php
lib/typo3/readme_moodle.txt
lib/validateurlsyntax.php
lib/webdavlib.php
lib/weblib.php
lib/wiki_to_markdown.php
mnet/xmlrpc/server.php
mod/wiki/ewiki/fragments/nuke_mod_wiki_index

index 0755319c03b8c0704ce4de502fc7339d95347d37..bdba8b2f09883893b1c823b277d6c8b1aa38e0b5 100644 (file)
@@ -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:
diff --git a/lib/bennu/readme_moodle.txt b/lib/bennu/readme_moodle.txt
new file mode 100644 (file)
index 0000000..84dd693
--- /dev/null
@@ -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:
index e918d1a86d680d93fc7cce7c839944deac87fb17..05bd527da692fa257c216186aee1e26ce6e158fc 100644 (file)
@@ -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 == '/') {
index e1882e725d0b714bbe7ed9222d808b6393002b5d..3d3e92e7da8898b1f257cdf50e257102260bf926 100644 (file)
@@ -466,7 +466,7 @@ class Parser
         {\r
         return(pack("C", $this->ptg[$token]));\r
         }\r
-    elseif(preg_match("/[A-Z0-9À-Ü\.]+/",$token))\r
+    elseif(preg_match("/[A-Z0-9�-�\.]+/",$token))\r
         {\r
         return($this->_convert_function($token,$this->_func_args));\r
         }\r
@@ -723,21 +723,21 @@ class Parser
             break;\r
         default:\r
            // if it's a reference\r
-            if(eregi("^[A-I]?[A-Z][0-9]+$",$token) and \r
-              !ereg("[0-9]",$this->_lookahead) and \r
+            if(preg_match("/^[A-I]?[A-Z][0-9]+$/i",$token) and\r
+              !preg_match("/[0-9]/",$this->_lookahead) and\r
                ($this->_lookahead != ':') and ($this->_lookahead != '.'))\r
                 {\r
                 return($token);\r
                 }\r
             // if it's a range (A1:A2)\r
-            elseif(eregi("^[A-I]?[A-Z][0-9]+:[A-I]?[A-Z][0-9]+$",$token) and \r
-                  !ereg("[0-9]",$this->_lookahead))\r
+            elseif(preg_match("/^[A-I]?[A-Z][0-9]+:[A-I]?[A-Z][0-9]+$/i",$token) and\r
+                  !preg_match("/[0-9]/",$this->_lookahead))\r
                {\r
                return($token);\r
                }\r
             // if it's a range (A1..A2)\r
-            elseif(eregi("^[A-I]?[A-Z][0-9]+\.\.[A-I]?[A-Z][0-9]+$",$token) and \r
-                  !ereg("[0-9]",$this->_lookahead))\r
+            elseif(preg_match("/^[A-I]?[A-Z][0-9]+\.\.[A-I]?[A-Z][0-9]+$/i",$token) and\r
+                  !preg_match("/[0-9]/",$this->_lookahead))\r
                {\r
                return($token);\r
                }\r
@@ -746,7 +746,7 @@ class Parser
                 return($token);\r
                 }\r
             // if it's a function call\r
-            elseif(eregi("^[A-Z0-9À-Ü\.]+$",$token) and ($this->_lookahead == "("))\r
+            elseif(preg_match("/^[A-Z0-9�-�\.]+$/i",$token) and ($this->_lookahead == "("))\r
 \r
                {\r
                return($token);\r
@@ -857,15 +857,15 @@ class Parser
         return($result);\r
         }\r
     // if it's a reference\r
-    if (eregi("^[A-I]?[A-Z][0-9]+$",$this->_current_token))\r
+    if (preg_match("/^[A-I]?[A-Z][0-9]+$/i",$this->_current_token))\r
         {\r
         $result = $this->_create_tree($this->_current_token, '', '');\r
         $this->_advance();\r
         return($result);\r
         }\r
     // if it's a range\r
-    elseif (eregi("^[A-I]?[A-Z][0-9]+:[A-I]?[A-Z][0-9]+$",$this->_current_token) or \r
-            eregi("^[A-I]?[A-Z][0-9]+\.\.[A-I]?[A-Z][0-9]+$",$this->_current_token)) \r
+    elseif (preg_match("/^[A-I]?[A-Z][0-9]+:[A-I]?[A-Z][0-9]+$/i",$this->_current_token) or\r
+            preg_match("/^[A-I]?[A-Z][0-9]+\.\.[A-I]?[A-Z][0-9]+$/i",$this->_current_token))\r
         {\r
         $result = $this->_current_token;\r
         $this->_advance();\r
@@ -878,7 +878,7 @@ class Parser
         return($result);\r
         }\r
     // if it's a function call\r
-    elseif (eregi("^[A-Z0-9À-Ü\.]+$",$this->_current_token))\r
+    elseif (preg_match("/^[A-Z0-9�-�\.]+$/i",$this->_current_token))\r
         {\r
         $result = $this->_func();\r
         return($result);\r
index f512fb88fce3897ce211d89fdac60f4b4cd20912..d3faf06db14f7802ed8bb71eac086f0527e34670 100644 (file)
@@ -1264,10 +1264,10 @@ class Worksheet extends BIFFwriter
         }\r
     \r
         // Strip the '=' or '@' sign at the beginning of the formula string\r
-        if (ereg("^=",$formula)) {\r
+        if (preg_match("/^=/",$formula)) {\r
             $formula = preg_replace("/(^=)/","",$formula);\r
         }\r
-        elseif(ereg("^@",$formula)) {\r
+        elseif(preg_match("/^@/",$formula)) {\r
             $formula = preg_replace("/(^@)/","",$formula);\r
         }\r
         else {\r
diff --git a/lib/excel/readme_moodle.txt b/lib/excel/readme_moodle.txt
new file mode 100644 (file)
index 0000000..0d885f5
--- /dev/null
@@ -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 @@
+         {\r
+         return(pack("C", $this->ptg[$token]));\r
+         }\r
+-    elseif(preg_match("/[A-Z0-9À-Ü\.]+/",$token))\r
++    elseif(preg_match("/[A-Z0-9ᅵ-ᅵ\.]+/",$token))\r
+         {\r
+         return($this->_convert_function($token,$this->_func_args));\r
+         }\r
+@@ -723,21 +723,21 @@
+             break;\r
+         default:\r
+           // if it's a reference\r
+-            if(eregi("^[A-I]?[A-Z][0-9]+$",$token) and \r
+-             !ereg("[0-9]",$this->_lookahead) and \r
++            if(preg_match("/^[A-I]?[A-Z][0-9]+$/i",$token) and\r
++             !preg_match("/[0-9]/",$this->_lookahead) and\r
+                ($this->_lookahead != ':') and ($this->_lookahead != '.'))\r
+                 {\r
+                 return($token);\r
+                 }\r
+             // if it's a range (A1:A2)\r
+-            elseif(eregi("^[A-I]?[A-Z][0-9]+:[A-I]?[A-Z][0-9]+$",$token) and \r
+-                 !ereg("[0-9]",$this->_lookahead))\r
++            elseif(preg_match("/^[A-I]?[A-Z][0-9]+:[A-I]?[A-Z][0-9]+$/i",$token) and\r
++                 !preg_match("/[0-9]/",$this->_lookahead))\r
+               {\r
+               return($token);\r
+               }\r
+             // if it's a range (A1..A2)\r
+-            elseif(eregi("^[A-I]?[A-Z][0-9]+\.\.[A-I]?[A-Z][0-9]+$",$token) and \r
+-                 !ereg("[0-9]",$this->_lookahead))\r
++            elseif(preg_match("/^[A-I]?[A-Z][0-9]+\.\.[A-I]?[A-Z][0-9]+$/i",$token) and\r
++                 !preg_match("/[0-9]/",$this->_lookahead))\r
+               {\r
+               return($token);\r
+               }\r
+@@ -746,7 +746,7 @@
+                 return($token);\r
+                 }\r
+             // if it's a function call\r
+-            elseif(eregi("^[A-Z0-9À-Ü\.]+$",$token) and ($this->_lookahead == "("))\r
++            elseif(preg_match("/^[A-Z0-9ᅵ-ᅵ\.]+$/i",$token) and ($this->_lookahead == "("))\r
\r
+               {\r
+               return($token);\r
+@@ -857,15 +857,15 @@
+         return($result);\r
+         }\r
+     // if it's a reference\r
+-    if (eregi("^[A-I]?[A-Z][0-9]+$",$this->_current_token))\r
++    if (preg_match("/^[A-I]?[A-Z][0-9]+$/i",$this->_current_token))\r
+         {\r
+         $result = $this->_create_tree($this->_current_token, '', '');\r
+         $this->_advance();\r
+         return($result);\r
+         }\r
+     // if it's a range\r
+-    elseif (eregi("^[A-I]?[A-Z][0-9]+:[A-I]?[A-Z][0-9]+$",$this->_current_token) or \r
+-            eregi("^[A-I]?[A-Z][0-9]+\.\.[A-I]?[A-Z][0-9]+$",$this->_current_token)) \r
++    elseif (preg_match("/^[A-I]?[A-Z][0-9]+:[A-I]?[A-Z][0-9]+$/i",$this->_current_token) or\r
++            preg_match("/^[A-I]?[A-Z][0-9]+\.\.[A-I]?[A-Z][0-9]+$/i",$this->_current_token))\r
+         {\r
+         $result = $this->_current_token;\r
+         $this->_advance();\r
+@@ -878,7 +878,7 @@
+         return($result);\r
+         }\r
+     // if it's a function call\r
+-    elseif (eregi("^[A-Z0-9À-Ü\.]+$",$this->_current_token))\r
++    elseif (preg_match("/^[A-Z0-9ᅵ-ᅵ\.]+$/i",$this->_current_token))\r
+         {\r
+         $result = $this->_func();\r
+         return($result);\r
+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 @@
+         }\r
+     \r
+         // Strip the '=' or '@' sign at the beginning of the formula string\r
+-        if (ereg("^=",$formula)) {\r
++        if (preg_match("/^=/",$formula)) {\r
+             $formula = preg_replace("/(^=)/","",$formula);\r
+         }\r
+-        elseif(ereg("^@",$formula)) {\r
++        elseif(preg_match("/^@/",$formula)) {\r
+             $formula = preg_replace("/(^@)/","",$formula);\r
+         }\r
+         else {\r
index c922dcc225f54989cf4d7cac7a335bc62c5974b8..33f50f922f9e7a4b90792b4c8ac7f75716de5f7a 100644 (file)
@@ -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 {
index 193e681c2207b795781b5c83670ee92070f217b3..776b14c471115ba9b719d60e416dad533bb1bb34 100644 (file)
@@ -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;
 }
diff --git a/lib/geoip/readme_moodle.txt b/lib/geoip/readme_moodle.txt
new file mode 100644 (file)
index 0000000..26fbc60
--- /dev/null
@@ -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;
+ }
+
index 5e936936ac2906edbe30b4cecd6f61b4ea987944..151e63bbcb40cf64937c0909ef1071d04912540f 100644 (file)
@@ -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)) {
index a8730343fd029c11e7716a34cff37374efc80fff..0cb01d9c275e1886d0702960245246259a3ccde7 100644 (file)
@@ -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;
index 12d91d799aa5eec9dfcb4b141abc2a116ff4cfd6..4f7225c9b613b85fa4832ccf7272a6dc91a8cc37 100644 (file)
@@ -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)) {
diff --git a/lib/soap/README_MOODLE.txt b/lib/soap/README_MOODLE.txt
new file mode 100644 (file)
index 0000000..4262c14
--- /dev/null
@@ -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';
index d7ad5d71425fd6e4add98f8bd8d073e64d3595d4..f35014ceac8264d1cf1399b39bf1a3ff46533d3d 100644 (file)
@@ -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';
index db014d592d03ad97e95971942bdf35e0ab218114..df4d09a2f101b8d08bcd368d0861c38637255ccc 100644 (file)
@@ -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)) {\r
+                               $dash_string = '';\r
+                               if ($dash) {\r
+-                                      if (ereg('^.+,', $dash)) {\r
++                                      if (preg_match('/^.+,/', $dash)) {\r
+                                               $tab = explode(',', $dash);\r
+                                       } else {\r
+                                               $tab = array($dash);\r
index d2785adacd20e24e4df4074ba88e16d9e1780d41..995ebdfd245a2e1bdd0f3e9c743da27314c78519 100755 (executable)
@@ -7595,7 +7595,7 @@ if (!class_exists('TCPDF', false)) {
                        if (isset($dash)) {\r
                                $dash_string = '';\r
                                if ($dash) {\r
-                                       if (ereg('^.+,', $dash)) {\r
+                                       if (preg_match('/^.+,/', $dash)) {\r
                                                $tab = explode(',', $dash);\r
                                        } else {\r
                                                $tab = array($dash);\r
index 5c998929564c48f000553dd7b5b334cb799381f5..6a407a543851a6a34949963276bdd973b6bc43db 100644 (file)
@@ -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
index 831bd90db888da4f70ef35f2384b885e445e3034..2057ee3e70dee0c36d731b7030a365d1c2eb6a58 100644 (file)
@@ -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;
                        }
                }
index d05ae676727a609e7fdb46c3acc317727e9871cf..77d1f2db8d1991115a6a2b92dde0706b6f43261e 100644 (file)
@@ -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;
+                       }
+               }
+
index 5c48e6ff4151009f22b9b9a506145259d80dda00..f39efdfc735701cddc024088d9939f885e3b7e2f 100755 (executable)
@@ -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);
     }
index 1cb82ccba20a72e09341a1843f27213389f70167..54a7e7a445dafdc1356a180c12f3ae21d7d7d139 100644 (file)
@@ -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
index 48f2891839862de6e301fa70491cfadf7e05b2ad..69dc1f0563613683eeaaf3ce3d460e23ffabffdb 100644 (file)
@@ -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));
 }
 
index d0484070aeffdd908b9fe5704921352567eeda56..90978d208357cc8a9d843b9693f733401fe644ec 100644 (file)
@@ -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";
index 0e93cee59df20e220ce3d91357e2318977c59999..5cb3e523216934ff26d74d17a891a3452b676b00 100644 (file)
@@ -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 {
index b2f2377a7f0f8337d8e3ed91282965e68525fe36..a5c7382b02891e1c7b3b167efd17bc6158f4d053 100644 (file)
@@ -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...");
 }