Replace some deprecated fonctions in php 5.3. Patch by Jason Jackson
authorJehan-Guillaume (ioguix) de Rorthais <ioguix@digix.(none)>
Fri, 27 Nov 2009 08:40:14 +0000 (09:40 +0100)
committerJehan-Guillaume (ioguix) de Rorthais <ioguix@digix.(none)>
Fri, 27 Nov 2009 08:40:14 +0000 (09:40 +0100)
classes/Misc.php
classes/database/Connection.php
classes/database/Postgres.php
classes/database/Postgres73.php
colproperties.php
dataexport.php

index 62067bb7bfe8a5d670caa49373770c60530b0523..08d4f6e539854d1223d261a4ebb26497ade8ea63 100644 (file)
                                // Due to annoying PHP bugs, shell arguments cannot be escaped
                                // (command simply fails), so we cannot allow complex objects
                                // to be dumped.
-                               if (ereg('^[_.[:alnum:]]+$', $str))
+                               if (preg_match('/^[_.[:alnum:]]+$/', $str))
                                        return $str;
                                else {
                                        echo $lang['strcannotdumponwindows'];
index e90063206ec24dc14f647dc11753a7f4070fff99..8a61b9f9791aeabf4ba0c064a20c9ca16f1e08c1 100755 (executable)
@@ -67,7 +67,7 @@ class Connection {
                        $field = $adodb->selectField($sql, 'version');
        
                        // Check the platform, if it's mingw, set it
-                       if (eregi(' mingw ', $field))
+                       if (preg_match('/ mingw /i', $field))
                                $this->platform = 'MINGW';
        
                        $params = explode(' ', $field);
index a15a3b34b169870dac729dda539af35b49bab94b..1b68a8604863855390450d8f82a26202ea464798 100755 (executable)
@@ -7177,7 +7177,7 @@ class Postgres extends ADODB_base {
        private
        function valid_dolquote($dquote) {
                // XXX: support multibyte
-               return (ereg('^[$][$]', $dquote) || ereg('^[$][_[:alpha:]][_[:alnum:]]*[$]', $dquote));
+               return (preg_match('/^[$][$]/', $dquote) || preg_match('/^[$][_[:alpha:]][_[:alnum:]]*[$]/', $dquote));
        }
 
        /**
@@ -7370,9 +7370,9 @@ class Postgres extends ADODB_base {
                                 * of a dollar quote.
         */
                                // XXX: multibyte here
-                               else if (ereg('^[_[:alpha:]]$', substr($line, $i, 1))) {
+                               else if (preg_match('/^[_[:alpha:]]$/', substr($line, $i, 1))) {
                                        $sub = substr($line, $i, $thislen);
-                                       while (ereg('^[\$_A-Za-z0-9]$', $sub)) {
+                                       while (preg_match('/^[\$_A-Za-z0-9]$/', $sub)) {
                                                /* keep going while we still have identifier chars */
                                                $this->advance_1($i, $prevlen, $thislen);
                                                $sub = substr($line, $i, $thislen);
@@ -7510,7 +7510,7 @@ class Postgres extends ADODB_base {
                        foreach ($orderby as $k => $v) {
                                if ($first) $first = false;
                                else $sql .= ', ';
-                               if (ereg('^[0-9]+$', $k)) {
+                               if (preg_match('/^[0-9]+$/', $k)) {
                                        $sql .= $k;
                                }
                                else {
@@ -7549,7 +7549,7 @@ class Postgres extends ADODB_base {
                // If $type is TABLE, then generate the query
                switch ($type) {
                        case 'TABLE':
-                               if (ereg('^[0-9]+$', $sortkey) && $sortkey > 0) $orderby = array($sortkey => $sortdir);
+                               if (preg_match('/^[0-9]+$/', $sortkey) && $sortkey > 0) $orderby = array($sortkey => $sortdir);
                                else $orderby = array();
                                $query = $this->getSelectSQL($table, array(), array(), array(), $orderby);
                                break;
@@ -7606,7 +7606,7 @@ class Postgres extends ADODB_base {
 
                // Figure out ORDER BY.  Sort key is always the column number (based from one)
                // of the column to order by.  Only need to do this for non-TABLE queries
-               if ($type != 'TABLE' && ereg('^[0-9]+$', $sortkey) && $sortkey > 0) {
+               if ($type != 'TABLE' && preg_match('/^[0-9]+$/', $sortkey) && $sortkey > 0) {
                        $orderby = " ORDER BY {$sortkey}";
                        // Add sort order
                        if ($sortdir == 'desc')
index 996383f5a2e9fbfef45f672bf498333a893d3aed..a0565fe5e4a7ec334dc3e8153628ddbd08b8d891 100644 (file)
@@ -252,7 +252,7 @@ class Postgres73 extends Postgres74 {
                $grodata = $this->selectSet($sql);
                if ($grodata->fields['grolist'] !== null && $grodata->fields['grolist'] != '{}') {
                        $members = $grodata->fields['grolist'];
-                       $members = ereg_replace("\{|\}","",$members);
+                       $members = preg_replace("/\{|\}/","",$members);
                        $this->clean($members);
 
                        $sql = "SELECT usename FROM pg_user WHERE usesysid IN ({$members}) ORDER BY usename";
index 7cf0414494b634b67e925c48b2c0a69a7a05ac42..dc582a0d40e8333b6270189f13ccf411721bb787 100644 (file)
@@ -67,7 +67,7 @@
                                        }
                                        // To figure out the length, look in the brackets :(
                                        // XXX: HACKY
-                                       if ($column->fields['type'] != $column->fields['base_type'] && ereg('\\(([0-9, ]*)\\)', $column->fields['type'], $bits)) {
+                                       if ($column->fields['type'] != $column->fields['base_type'] && preg_match('/\\(([0-9, ]*)\\)/', $column->fields['type'], $bits)) {
                                                $_REQUEST['length'] = $bits[1];
                                        }
                                        else
index ca6f7d32957e9a092f77124d59b7e4eb4f795025..b10d48828394e4ce5200d43980a394b58598e3db 100644 (file)
                                                $v = $data->escapeBytea($v);
                                                
                                                // We add an extra escaping slash onto octal encoded characters
-                                               $v = ereg_replace('\\\\([0-7]{3})', '\\\\\1', $v);
+                                               $v = preg_replace('/\\\\([0-7]{3})/', '\\\\\1', $v);
                                                if ($first) {
                                                        echo ($v == null) ? '\\N' : $v;
                                                        $first = false;
                                                        // EXCEPT the 'special' ones like \r \n \t, etc.
                                                        $v = addCSlashes($v, "\0..\37\177..\377");
                                                        // We add an extra escaping slash onto octal encoded characters
-                                                       $v = ereg_replace('\\\\([0-7]{3})', '\\\1', $v);
+                                                       $v = preg_replace('/\\\\([0-7]{3})/', '\\\1', $v);
                                                        // Finally, escape all apostrophes
                                                        $v = str_replace("'", "''", $v);
                                                }