Code

Removed deprecated ereg functions
authorcajus <cajus@594d385d-05f5-0310-b6e9-bd551577e9d8>
Tue, 26 Jan 2010 09:40:08 +0000 (09:40 +0000)
committercajus <cajus@594d385d-05f5-0310-b6e9-bd551577e9d8>
Tue, 26 Jan 2010 09:40:08 +0000 (09:40 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@15301 594d385d-05f5-0310-b6e9-bd551577e9d8

gosa-core/html/index.php
gosa-core/include/class_ldap.inc
gosa-core/include/utils/excel/class.writeexcel_formula.inc.php
gosa-plugins/mail/personal/mail/sieve/class_semantics.inc
gosa-plugins/mail/personal/mail/sieve/class_sieve.inc

index 8b7852860eba9a77cccd7761a7b2d72eb56efce3..ebae5e52f7393fd19fcd7bf03632e85fdbd6fac5 100644 (file)
@@ -295,7 +295,7 @@ if (($_SERVER["REQUEST_METHOD"] == "POST" && isset($_POST['login'])) || $htacces
   $ok= true;
   if (!$htaccess_authenticated){
     $username= $_POST["username"];
-    if (!ereg("^[@A-Za-z0-9_.-]+$", $username)){
+    if (!preg_match("/^[@A-Za-z0-9_.-]+$/", $username)){
       $message= _("Please specify a valid username!");
       $ok= false;
     } elseif (mb_strlen($_POST["password"], 'UTF-8') == 0){
index 17acd751de48a23cee5c39ccfc25359b2f49db2b..1f2baab3e41cfef1fa6d308329bb6b7b27c4fcd6 100644 (file)
@@ -210,7 +210,7 @@ class LDAP{
     } else {
       $basedn = LDAP::convert($basedn);
     }
-    return(ereg_replace("[^,]*[,]*[ ]*(.*)", "\\1", $basedn));
+    return(preg_replace("/[^,]*[,]*[ ]*(.*)/", "$1", $basedn));
   }
 
   
@@ -1012,7 +1012,7 @@ class LDAP{
         /* Append lines ... */
         if(!empty($tmp2)) {
           /* check if we need base64_decode for this line */
-          if(ereg("::",$tmp2))
+          if(strstr($tmp2, "::") !== false)
           {
             $encoded = explode("::",$entry);
             $attr  = trim($encoded[0]);
index 79a1129acf6b77cea97912a4f7d5943c3207c1c2..f761b74e30a6298caab320ec4b1a6674372c30b4 100644 (file)
@@ -996,35 +996,35 @@ function _match($token)\r {
         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 != '!')) {
                 return $token;
             }
             // If it's an external reference (Sheet1!A1 or Sheet1:Sheet2!A1)
             elseif (preg_match("/^[A-Za-z0-9_]+(\:[A-Za-z0-9_]+)?\![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 != '.')) {
                 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:Sheet2!A1:B2
             elseif (preg_match("/^[A-Za-z0-9_]+(\:[A-Za-z0-9_]+)?\!([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:Sheet2'!A1:B2
             elseif (preg_match("/^'[A-Za-z0-9_ ]+(\:[A-Za-z0-9_ ]+)?'\!([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 number (check that it's not a sheet name or range)
@@ -1034,11 +1034,11 @@ function _match($token)\r {
                 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;
             }
             return '';
@@ -1129,7 +1129,7 @@ function _condition()\r {
 */
 function _expression()\r {
     // If it's a string return a string node
-    if (ereg("^\"[^\"]{0,255}\"$", $this->_current_token))\r {
+    if (preg_match("/^\"[^\"]{0,255}\"$/", $this->_current_token))\r {
         $result = $this->_createTree($this->_current_token, '', '');
         $this->_advance();
         return $result;
@@ -1255,7 +1255,7 @@ function _fact()\r {
         $result = $this->_createTree($this->_current_token, '', '');
         $this->_advance();
         return $result;
-    }\r elseif (eregi("^[A-Z0-9\xc0-\xdc\.]+$",$this->_current_token))\r {
+    }\r elseif (preg_match("/^[A-Z0-9\xc0-\xdc\.]+$/i",$this->_current_token))\r {
     // if it's a function call
         $result = $this->_func();
         return $result;
index 1c00051c052bb1f477b3eead6c19f9433e7ce445..8c6d05f026c17d26528b2bc09533dee75848e571 100644 (file)
@@ -454,7 +454,7 @@ class Semantics
                }
 
                // Check if command may appear here
-               if (!ereg($this->s_['valid_after'], $prev))
+               if (strstr($prev, $this->s_['valid_after'] === false))
                {
 #                      $this->message = 'line '. $line .': "'. $this->command_ .'" may not appear after "'. $prev .'"';
 #                      return false;
index 22b02e48aa231a0dd0e09e8905f69ca3d4f581a1..cab0fdd34673edd85c877098d44a160b1f0089d5 100644 (file)
@@ -301,7 +301,7 @@ class sieve
     //response.  They repsond as follows: "Cyrus timsieved v1.0.0" "SASL={PLAIN,........}"
     //So, if we see IMLEMENTATION in the first line, then we are done.
 
-    if(ereg("IMPLEMENTATION",$this->line))
+    if(strstr($this->line, "IMPLEMENTATION"))
     {
       //we're on the Cyrus V2 sieve server
       while(sieve::status($this->line) == F_DATA){