[prev in list] [next in list] [prev in thread] [next in thread] 

List:       squirrelmail-cvs
Subject:    [SM-CVS] SF.net SVN: squirrelmail:[13799] trunk/squirrelmail
From:       pdontthink () users ! sourceforge ! net
Date:       2009-07-29 1:55:21
Message-ID: E1MVyO1-00023t-Su () 3kljzd1 ! ch3 ! sourceforge ! com
[Download RAW message or body]

Revision: 13799
          http://squirrelmail.svn.sourceforge.net/squirrelmail/?rev=13799&view=rev
Author:   pdontthink
Date:     2009-07-29 01:55:21 +0000 (Wed, 29 Jul 2009)

Log Message:
-----------
Stop using deprecated ereg() functions (#2820952)

Modified Paths:
--------------
    trunk/squirrelmail/class/l10n/gettext.class.php
    trunk/squirrelmail/doc/ChangeLog
    trunk/squirrelmail/functions/abook_local_file.php
    trunk/squirrelmail/functions/addressbook.php
    trunk/squirrelmail/functions/attachment_common.php
    trunk/squirrelmail/functions/folder_manip.php
    trunk/squirrelmail/functions/imap_asearch.php
    trunk/squirrelmail/functions/imap_general.php
    trunk/squirrelmail/functions/mime.php
    trunk/squirrelmail/functions/strings.php
    trunk/squirrelmail/functions/url_parser.php
    trunk/squirrelmail/plugins/squirrelspell/sqspell_config.php
    trunk/squirrelmail/src/addressbook.php
    trunk/squirrelmail/src/view_header.php

Modified: trunk/squirrelmail/class/l10n/gettext.class.php
===================================================================
--- trunk/squirrelmail/class/l10n/gettext.class.php	2009-07-29 01:35:45 UTC (rev \
                13798)
+++ trunk/squirrelmail/class/l10n/gettext.class.php	2009-07-29 01:55:21 UTC (rev \
13799) @@ -229,7 +229,7 @@
         else {
             $header = $this->get_translation_number(0);
 
-            if (eregi("plural-forms: (.*)\n",$header,$regs)) {
+            if (preg_match('/plural-forms: (.*)\n/i',$header,$regs)) {
                 $expr = $regs[1];
             } else {
                 $expr = "nplurals=2; plural=n == 1 ? 0 : 1;";

Modified: trunk/squirrelmail/doc/ChangeLog
===================================================================
--- trunk/squirrelmail/doc/ChangeLog	2009-07-29 01:35:45 UTC (rev 13798)
+++ trunk/squirrelmail/doc/ChangeLog	2009-07-29 01:55:21 UTC (rev 13799)
@@ -320,6 +320,7 @@
     (#2796007).
   - Removed the shut down DSBL blocklists (#2796734).
   - Fixed broken RFC1918 reference in contrib/.htaccess and doc/.htaccess \
(#2798839). +  - Stop using deprecated ereg functions. (#2820952)
 
 Version 1.5.1 (branched on 2006-02-12)
 --------------------------------------

Modified: trunk/squirrelmail/functions/abook_local_file.php
===================================================================
--- trunk/squirrelmail/functions/abook_local_file.php	2009-07-29 01:35:45 UTC (rev \
                13798)
+++ trunk/squirrelmail/functions/abook_local_file.php	2009-07-29 01:55:21 UTC (rev \
13799) @@ -300,8 +300,8 @@
                  * TODO: regexp search is supported only in local_file backend.
                  * Do we check format of regexp or ignore errors?
                  */
-                // errors on eregi call are suppressed in order to prevent display \
                of regexp compilation errors
-                if(@eregi($expr, $line)) {
+                // errors on preg_match call are suppressed in order to prevent \
display of regexp compilation errors +                if(@preg_match('/' . $expr . \
'/i', $line)) {  array_push($res, array('nickname'  => $row[0],
                         'name'      => $this->fullname($row[1], $row[2]),
                         'firstname' => $row[1],
@@ -433,7 +433,8 @@
                 $this->quotevalue((!empty($userdata['label'])?$userdata['label']:''));
  
         /* Strip linefeeds */
-        $data = ereg_replace("[\r\n]", ' ', $data);
+        $nl_str = array("\r","\n");
+        $data = str_replace($nl_str, ' ', $data);
 
         /**
          * Make sure that entry fits into allocated record space.
@@ -588,7 +589,7 @@
     function quotevalue($value) {
         /* Quote the field if it contains | or ". Double quotes need to
          * be replaced with "" */
-        if(ereg("[|\"]", $value)) {
+        if(stristr('"', $value) || stristr('|', $value)) {
             $value = '"' . str_replace('"', '""', $value) . '"';
         }
         return $value;

Modified: trunk/squirrelmail/functions/addressbook.php
===================================================================
--- trunk/squirrelmail/functions/addressbook.php	2009-07-29 01:35:45 UTC (rev 13798)
+++ trunk/squirrelmail/functions/addressbook.php	2009-07-29 01:55:21 UTC (rev 13799)
@@ -731,7 +731,7 @@
         }
 
         /* Blocks use of space, :, |, #, " and ! in nickname */
-        if (eregi('[ \\:\\|\\#\\"\\!]', $userdata['nickname'])) {
+        if (preg_match('/[ :|#"!]/', $userdata['nickname'])) {
             $this->error = _("Nickname contains illegal characters");
             return false;
         }
@@ -831,7 +831,7 @@
             return false;
         }
 
-        if (eregi('[\\: \\|\\#"\\!]', $userdata['nickname'])) {
+        if (preg_match('/[: |#"!]/', $userdata['nickname'])) {
             $this->error = _("Nickname contains illegal characters");
             return false;
         }

Modified: trunk/squirrelmail/functions/attachment_common.php
===================================================================
--- trunk/squirrelmail/functions/attachment_common.php	2009-07-29 01:35:45 UTC (rev \
                13798)
+++ trunk/squirrelmail/functions/attachment_common.php	2009-07-29 01:55:21 UTC (rev \
13799) @@ -265,8 +265,13 @@
 //FIXME: or at least we can move this hook up to the top of this file where \
$FileExtensionToMimeType is defined.  What else is this hook here for?  What plugins \
use it?  do_hook('attachment_common-load_mime_types', $null);
 
-    ereg('\\.([^\\.]+)$', $Args[6], $Regs);
+    preg_match('/\.([^.]+)$/', $Args[7], $Regs);
 
+    $Ext = '';
+    if (is_array($Regs) && isset($Regs[1])) {
+       $Ext = $Regs[1];
+    }
+
     $Ext = strtolower($Regs[1]);
 
     if ($Ext == '' || ! isset($FileExtensionToMimeType[$Ext]))

Modified: trunk/squirrelmail/functions/folder_manip.php
===================================================================
--- trunk/squirrelmail/functions/folder_manip.php	2009-07-29 01:35:45 UTC (rev 13798)
+++ trunk/squirrelmail/functions/folder_manip.php	2009-07-29 01:55:21 UTC (rev 13799)
@@ -226,7 +226,7 @@
 
     /** lets see if we CAN move folders to the trash.. otherwise,
         ** just delete them **/
-    if ($delete_folder || eregi('^'.$trash_folder.'.+', $folder_name) ) {
+    if ($delete_folder || preg_match('/^' . $trash_folder . '.+/i', $folder_name) ) \
{  $can_move_to_trash = FALSE;
     } else {
     /* Otherwise, check if trash folder exits and support sub-folders */

Modified: trunk/squirrelmail/functions/imap_asearch.php
===================================================================
--- trunk/squirrelmail/functions/imap_asearch.php	2009-07-29 01:35:45 UTC (rev 13798)
+++ trunk/squirrelmail/functions/imap_asearch.php	2009-07-29 01:55:21 UTC (rev 13799)
@@ -190,7 +190,7 @@
     global $imap_asearch_months;
 
     $what = trim($what);
-    $what = ereg_replace('[ /\\.,]+', '-', $what);
+    $what = preg_replace('/[ \/\\.,]+/', '-', $what);
     if ($what) {
         preg_match('/^([0-9]+)-+([^\-]+)-+([0-9]+)$/', $what, $what_parts);
         if (count($what_parts) == 4) {
@@ -232,7 +232,7 @@
         default:
         case 'anum':
             $what = str_replace(' ', '', $what);
-            $what = ereg_replace('[^0-9]+[^KMG]$', '', strtoupper($what));
+            $what = preg_replace('/[^0-9]+[^KMG]$/', '', strtoupper($what));
             if ($what != '') {
                 switch (substr($what, -1)) {
                     case 'G':
@@ -268,7 +268,7 @@
             $criteria = $opcode . ' ' . sqimap_asearch_encode_string($what, \
$charset) . ' ';  break;
         case 'asequence':
-            $what = ereg_replace('[^0-9:\(\)]+', '', $what);
+            $what = preg_replace('/[^0-9:()]+/', '', $what);
             if ($what != '')
                 $criteria = $opcode . ' ' . $what . ' ';
         break;

Modified: trunk/squirrelmail/functions/imap_general.php
===================================================================
--- trunk/squirrelmail/functions/imap_general.php	2009-07-29 01:35:45 UTC (rev 13798)
+++ trunk/squirrelmail/functions/imap_general.php	2009-07-29 01:55:21 UTC (rev 13799)
@@ -1075,8 +1075,8 @@
              * TODO: remove this in favour of the information from \
                sqimap_get_namespace()
              */
             $read = sqimap_run_command($imap_stream, 'NAMESPACE', true, $a, $b);
-            if (eregi('\\* NAMESPACE +(\\( *\\(.+\\) *\\)|NIL) +(\\( *\\(.+\\) \
                *\\)|NIL) +(\\( *\\(.+\\) *\\)|NIL)', $read[0], $data)) {
-                if (eregi('^\\( *\\((.*)\\) *\\)', $data[1], $data2)) {
+            if (preg_match('/\* NAMESPACE +(\( *\(.+\) *\)|NIL) +(\( *\(.+\) \
*\)|NIL) +(\( *\(.+\) *\)|NIL)/i', $read[0], $data)) { +                if \
(preg_match('/^\( *\((.*)\) *\)/', $data[1], $data2)) {  $pn = $data2[1];
                 }
                 $pna = explode(')(', $pn);
@@ -1138,7 +1138,7 @@
     $ns_strings = array(1=>'personal', 2=>'users', 3=>'shared');
     $namespace = array();
 
-    if(ereg('NAMESPACE (\(\(.*\)\)|NIL) (\(\(.*\)\)|NIL) (\(\(.*\)\)|NIL)', $input, \
$regs) !== false) { +    if (preg_match('/NAMESPACE (\(\(.*\)\)|NIL) (\(\(.*\)\)|NIL) \
(\(\(.*\)\)|NIL)/', $input, $regs)) {  for($i=1; $i<=3; $i++) {
             if($regs[$i] == 'NIL') {
                 $namespace[$ns_strings[$i]] = array();
@@ -1174,7 +1174,7 @@
  */
 function sqimap_encode_mailbox_name($what)
 {
-    if (ereg("[\"\\\r\n]", $what))
+    if (preg_match('/["\\\r\n]/', $what))
         return '{' . strlen($what) . "}\r\n" . $what;        /* 4.3 literal form */
     return '"' . $what . '"';        /* 4.3 quoted string form */
 }

Modified: trunk/squirrelmail/functions/mime.php
===================================================================
--- trunk/squirrelmail/functions/mime.php	2009-07-29 01:35:45 UTC (rev 13798)
+++ trunk/squirrelmail/functions/mime.php	2009-07-29 01:55:21 UTC (rev 13799)
@@ -140,7 +140,7 @@
     } while($topline && ($topline[0] == '*') && !preg_match('/\* [0-9]+ FETCH.*/i', \
$topline)) ;  
     $wholemessage = implode('', $data);
-    if (ereg('\\{([^\\}]*)\\}', $topline, $regs)) {
+    if (preg_match('/\{([^\}]*)\}/', $topline, $regs)) {
         $ret = substr($wholemessage, 0, $regs[1]);
         /* There is some information in the content info header that could be \
                important
          * in order to parse html messages. Let's get them here.
@@ -148,7 +148,7 @@
 //        if ($ret{0} == '<') {
 //            $data = sqimap_run_command ($imap_stream, "FETCH $id \
BODY[$ent_id.MIME]", true, $response, $message, TRUE);  //        }
-    } else if (ereg('"([^"]*)"', $topline, $regs)) {
+    } else if (preg_match('/"([^"]*)"/', $topline, $regs)) {
         $ret = $regs[1];
     } else if ((stristr($topline, 'nil') !== false) && (empty($wholemessage))) {
         $ret = $wholemessage;
@@ -2734,7 +2734,7 @@
         $filename =
             call_user_func($languages[$squirrelmail_language]['XTRA_CODE'] . \
'_downloadfilename', $filename, $HTTP_USER_AGENT);  } else {
-        $filename = ereg_replace('[\\/:\*\?"<>\|;]', '_', str_replace('&nbsp;', ' ', \
$filename)); +        $filename = preg_replace('/[\\\/:*?"<>|;]/', '_', \
str_replace('&nbsp;', ' ', $filename));  }
 
     // A Pox on Microsoft and it's Internet Explorer!

Modified: trunk/squirrelmail/functions/strings.php
===================================================================
--- trunk/squirrelmail/functions/strings.php	2009-07-29 01:35:45 UTC (rev 13798)
+++ trunk/squirrelmail/functions/strings.php	2009-07-29 01:55:21 UTC (rev 13799)
@@ -349,7 +349,7 @@
         }
     }
 
-    ereg("^([\t >]*)([^\t >].*)?$", $line, $regs);
+    preg_match('/^([\t >]*)([^\t >].*)?$/', $line, $regs);
     $beginning_spaces = $regs[1];
     if (isset($regs[2])) {
         $words = explode(' ', $regs[2]);

Modified: trunk/squirrelmail/functions/url_parser.php
===================================================================
--- trunk/squirrelmail/functions/url_parser.php	2009-07-29 01:35:45 UTC (rev 13798)
+++ trunk/squirrelmail/functions/url_parser.php	2009-07-29 01:55:21 UTC (rev 13799)
@@ -55,7 +55,7 @@
     $addresses = array();
 
     /* Find all the email addresses in the body */
-    while(eregi($Email_RegExp_Match, $sbody, $regs)) {
+    while (preg_match('/' . $Email_RegExp_Match . '/i', $sbody, $regs)) {
         $addresses[$regs[0]] = strtr($regs[0], array('&amp;' => '&'));
         $start = strpos($sbody, $regs[0]) + strlen($regs[0]);
         $sbody = substr($sbody, $start);
@@ -183,7 +183,7 @@
             $url = substr($body, $target_pos, $end-$target_pos);
 
             /* Needed since lines are not passed with \n or \r */
-            while ( ereg("[,\.]$", $url) ) {
+            while ( preg_match('/[,.]$/', $url) ) {
                 $url = substr( $url, 0, -1 );
                 $end--;
             }
@@ -217,7 +217,7 @@
     $addresses = array();
 
     /* Find all the email addresses in the body */
-    while (eregi($Email_RegExp_Match, $string, $regs)) {
+    while (preg_match('/' . $Email_RegExp_Match . '/i', $string, $regs)) {
         $addresses[$regs[0]] = strtr($regs[0], array('&amp;' => '&'));
         $start = strpos($string, $regs[0]) + strlen($regs[0]);
         $string = substr($string, $start);

Modified: trunk/squirrelmail/plugins/squirrelspell/sqspell_config.php
===================================================================
--- trunk/squirrelmail/plugins/squirrelspell/sqspell_config.php	2009-07-29 01:35:45 \
                UTC (rev 13798)
+++ trunk/squirrelmail/plugins/squirrelspell/sqspell_config.php	2009-07-29 01:55:21 \
UTC (rev 13799) @@ -105,9 +105,3 @@
 $SQSPELL_WORDS_FILE =
    getHashedFile($username, $data_dir, "$username.words");
 
-/**
- * Function used for checking words in user's dictionary
- * @global string $SQSPELL_EREG
- * @deprecated It is not used since 1.5.1 (sqspell 0.5)
- */
-$SQSPELL_EREG = 'ereg';

Modified: trunk/squirrelmail/src/addressbook.php
===================================================================
--- trunk/squirrelmail/src/addressbook.php	2009-07-29 01:35:45 UTC (rev 13798)
+++ trunk/squirrelmail/src/addressbook.php	2009-07-29 01:55:21 UTC (rev 13799)
@@ -111,7 +111,7 @@
         if (!$r) {
             /* Remove backend name from error string */
             $errstr = $abook->error;
-            $errstr = ereg_replace('^\[.*\] *', '', $errstr);
+            $errstr = preg_replace('/^\[.*\] */', '', $errstr);
 
             $formerror = $errstr;
             $showaddrlist = false;

Modified: trunk/squirrelmail/src/view_header.php
===================================================================
--- trunk/squirrelmail/src/view_header.php	2009-07-29 01:35:45 UTC (rev 13798)
+++ trunk/squirrelmail/src/view_header.php	2009-07-29 01:55:21 UTC (rev 13799)
@@ -41,16 +41,17 @@
     for ($i=1; $i < count($read); $i++) {
         $line = htmlspecialchars($read[$i]);
         switch (true) {
-            case (eregi("^&gt;", $line)):
+            case (preg_match('/^&gt;/i', $line)):
                 $second[$i] = $line;
                 $first[$i] = '&nbsp;';
                 $cnum++;
                 break;
-            case (eregi("^[ |\t]", $line)):
+// FIXME: is the pipe character below a mistake?  I think the original author might \
have thought it carried special meaning in the character class, which it does not... \
but then again, I am not currently trying to understand what this code actually does \
+            case (preg_match('/^[ |\t]/', $line)):  $second[$i] = $line;
                 $first[$i] = '';
                 break;
-            case (eregi("^([^:]+):(.+)", $line, $regs)):
+            case (preg_match('/^([^:]+):(.+)/', $line, $regs)):
                 $first[$i] = $regs[1] . ':';
                 $second[$i] = $regs[2];
                 $cnum++;


This was sent by the SourceForge.net collaborative development platform, the world's \
largest Open Source development site.

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
-----
squirrelmail-cvs mailing list
List address: squirrelmail-cvs@lists.sourceforge.net
List info (subscribe/unsubscribe/change options): \
                https://lists.sourceforge.net/lists/listinfo/squirrelmail-cvs
Repository: http://squirrelmail.org/svn


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic