tony-landis / agilebill

Open source billing and invoicing
http://www.agileco.com
Other
307 stars 177 forks source link

php 5.3 support #9

Closed davidbuzz closed 10 years ago

davidbuzz commented 10 years ago

ereg, eregi, ereg_replace are all deprecated in php 5.3. here's a patch that fixes the most visible errors. ( many other remain unfixed, but you can see the pattern used ).

diff --git a/htaccess_index.php b/htaccess_index.php
index dee70ba..556199e 100644
--- a/htaccess_index.php
+++ b/htaccess_index.php
@@ -111,7 +111,7 @@
     if  (file_exists($DOCUMENT_ROOT.$REQUEST_URI) &&
         ($SCRIPT_FILENAME            != $DOCUMENT_ROOT.$REQUEST_URI) &&
         ($REQUEST_URI                != "/") &&
-        (!ereg( '[////]{2,}$', $REQUEST_URI ) ) )
+        (!preg_match( '/[////]{2,}$/', $REQUEST_URI ) ) )
         {

         $url = $REQUEST_URI;
@@ -263,4 +263,4 @@
         }

        ob_end_flush();
-?>
\ No newline at end of file
+?>
diff --git a/includes/adodb/drivers/adodb-postgres7.inc.php b/includes/adodb/drivers/adodb-postgres7.inc.php
index ef5ce88..e5c16ca 100644
--- a/includes/adodb/drivers/adodb-postgres7.inc.php
+++ b/includes/adodb/drivers/adodb-postgres7.inc.php
@@ -95,9 +95,9 @@ class ADODB_postgres7 extends ADODB_postgres64 {
          $a = array();
          while (!$rs->EOF) {
            if ($upper) {
-             $a[strtoupper($rs->Fields('lookup_table'))][] = strtoupper(ereg_replace('"','',$rs->Fields('dep_field').'='.$rs->Fields('lookup_field')));
+             $a[strtoupper($rs->Fields('lookup_table'))][] = strtoupper(preg_replace('/"/','',$rs->Fields('dep_field').'='.$rs->Fields('lookup_field')));
            } else {
-             $a[$rs->Fields('lookup_table')][] = ereg_replace('"','',$rs->Fields('dep_field').'='.$rs->Fields('lookup_field'));
+             $a[$rs->Fields('lookup_table')][] = preg_replace('/"/','',$rs->Fields('dep_field').'='.$rs->Fields('lookup_field'));
            }
            adodb_movenext($rs);
          }
@@ -310,4 +310,4 @@ class ADORecordSet_assoc_postgres7 extends ADORecordSet_postgres64{
                return false;
        }
 }
-?>
\ No newline at end of file
+?>
diff --git a/includes/adodb/drivers/adodb-sybase.inc.php b/includes/adodb/drivers/adodb-sybase.inc.php
index 9c00d02..cb3c23d 100644
--- a/includes/adodb/drivers/adodb-sybase.inc.php
+++ b/includes/adodb/drivers/adodb-sybase.inc.php
@@ -376,7 +376,7 @@ class ADORecordSet_array_sybase extends ADORecordSet_array {
        global $ADODB_sybase_mths;

                //Dec 30 2000 12:00AM
-               if (!ereg( "([A-Za-z]{3})[-/\. ]+([0-9]{1,2})[-/\. ]+([0-9]{4})"
+               if (!preg_match( "/([A-Za-z]{3})[-/\. ]+([0-9]{1,2})[-/\. ]+([0-9]{4})/"
                        ,$v, $rr)) return parent::UnixDate($v);

                if ($rr[3] <= TIMESTAMP_FIRST_YEAR) return 0;
@@ -393,7 +393,7 @@ class ADORecordSet_array_sybase extends ADORecordSet_array {
        global $ADODB_sybase_mths;
                //11.02.2001 Toni Tunkkari toni.tunkkari@finebyte.com
                //Changed [0-9] to [0-9 ] in day conversion
-               if (!ereg( "([A-Za-z]{3})[-/\. ]([0-9 ]{1,2})[-/\. ]([0-9]{4}) +([0-9]{1,2}):([0-9]{1,2}) *([apAP]{0,1})"
+               if (!preg_match( "/([A-Za-z]{3})[-/\. ]([0-9 ]{1,2})[-/\. ]([0-9]{4}) +([0-9]{1,2}):([0-9]{1,2}) *([apAP]{0,1})/"
                        ,$v, $rr)) return parent::UnixTimeStamp($v);
                if ($rr[3] <= TIMESTAMP_FIRST_YEAR) return 0;

diff --git a/includes/nusoap/lib/class.nusoap_base.php b/includes/nusoap/lib/class.nusoap_base.php
index 87746b7..a73b3d4 100644
--- a/includes/nusoap/lib/class.nusoap_base.php
+++ b/includes/nusoap/lib/class.nusoap_base.php
@@ -562,7 +562,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)){
                                        $this->debug("serialize_val: serialize array");
                                        $i = 0;
                                        if(is_array($val) && count($val)> 0){
@@ -765,7 +765,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
@@ -914,7 +914,7 @@ function timestamp_to_iso8601($timestamp,$utc=true){
                '([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)){
+               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;
@@ -939,7 +939,7 @@ function iso8601_to_timestamp($datestr){
        '([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)){
+       if(preg_match('/'.$eregStr.'/',$datestr,$regs)){
                // not utc
                if($regs[8] != 'Z'){
                        $op = substr($regs[8],0,1);
@@ -981,4 +981,4 @@ function usleepWindows($usec)
 }

-?>
\ No newline at end of file
+?>
diff --git a/includes/nusoap/lib/class.soap_parser.php b/includes/nusoap/lib/class.soap_parser.php
index d451dae..921c0d5 100644
--- a/includes/nusoap/lib/class.soap_parser.php
+++ b/includes/nusoap/lib/class.soap_parser.php
@@ -207,7 +207,7 @@ class nusoap_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';
@@ -244,7 +244,7 @@ class nusoap_parser extends nusoap_base {
                                [6]    nextDimension    ::=    Digit+ ','
                                */
                                $expr = '([A-Za-z0-9_]+):([A-Za-z]+[A-Za-z0-9_]+)\[([0-9]+),?([0-9]*)\]';
-                               if(ereg($expr,$value,$regs)){
+                               if(preg_match('/'.$expr.'/',$value,$regs)){
                                        $this->message[$pos]['typePrefix'] = $regs[1];
                                        $this->message[$pos]['arrayTypePrefix'] = $regs[1];
                        if (isset($this->namespaces[$regs[1]])) {
@@ -636,4 +636,4 @@ class soap_parser extends nusoap_parser {
 }

-?>
\ No newline at end of file
+?>
diff --git a/includes/nusoap/lib/class.soap_server.php b/includes/nusoap/lib/class.soap_server.php
index a6f1cb4..abcb4e5 100644
--- a/includes/nusoap/lib/class.soap_server.php
+++ b/includes/nusoap/lib/class.soap_server.php
@@ -245,7 +245,7 @@ class nusoap_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
@@ -316,7 +316,7 @@ class nusoap_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';
@@ -345,7 +345,7 @@ class nusoap_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';
@@ -379,7 +379,7 @@ class nusoap_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';
@@ -717,7 +717,7 @@ class nusoap_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";
@@ -805,7 +805,7 @@ class nusoap_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';
@@ -1070,4 +1070,4 @@ class soap_server extends nusoap_server {
 }

-?>
\ No newline at end of file
+?>
diff --git a/includes/nusoap/lib/class.soap_transport_http.php b/includes/nusoap/lib/class.soap_transport_http.php
index ecfab92..6cc4de9 100644
--- a/includes/nusoap/lib/class.soap_transport_http.php
+++ b/includes/nusoap/lib/class.soap_transport_http.php
@@ -66,7 +66,7 @@ class soap_transport_http extends nusoap_base {
                        $this->ch_options = $curl_options;
                }
                $this->use_curl = $use_curl;
-               ereg('\$Revisio' . 'n: ([^ ]+)', $this->revision, $rev);
+               preg_match('/\$Revisio' . 'n: ([^ ]+)/', $this->revision, $rev);
                $this->setHeader('User-Agent', $this->title.'/'.$this->version.' ('.$rev[1].')');
        }

@@ -829,7 +829,7 @@ class soap_transport_http extends nusoap_base {
                                }
                        }
                        // remove 100 headers
-                       if (isset($lb) && ereg('^HTTP/1.1 100',$data)) {
+                       if (isset($lb) && preg_match('/^HTTP/1.1 100/',$data)) {
                                unset($lb);
                                $data = '';
                        }//
@@ -995,7 +995,7 @@ class soap_transport_http extends nusoap_base {
                if ($data == '') {
                        // have nothing left; just remove 100 header(s)
                        $data = $savedata;
-                       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") ) {
@@ -1302,4 +1302,4 @@ class soap_transport_http extends nusoap_base {
 }

-?>
\ No newline at end of file
+?>
diff --git a/includes/nusoap/lib/class.soapclient.php b/includes/nusoap/lib/class.soapclient.php
index 0916eea..303b7a6 100644
--- a/includes/nusoap/lib/class.soapclient.php
+++ b/includes/nusoap/lib/class.soapclient.php
@@ -406,7 +406,7 @@ class nusoap_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;
@@ -428,10 +428,10 @@ class nusoap_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);
@@ -490,7 +490,7 @@ class nusoap_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';
diff --git a/includes/nusoap/lib/class.wsdl.php b/includes/nusoap/lib/class.wsdl.php
index f435e54..1382bc0 100644
--- a/includes/nusoap/lib/class.wsdl.php
+++ b/includes/nusoap/lib/class.wsdl.php
@@ -1901,4 +1901,4 @@ class wsdl extends nusoap_base {
        } 
 }

-?>
\ No newline at end of file
+?>
diff --git a/includes/smarty/plugins/function.html_menu_files.php b/includes/smarty/plugins/function.html_menu_files.php
index eaf4ffc..d60aa09 100644
--- a/includes/smarty/plugins/function.html_menu_files.php
+++ b/includes/smarty/plugins/function.html_menu_files.php
@@ -38,13 +38,13 @@ function smarty_function_html_menu_files($params, &$smarty)
                {
                        if(!empty($ext))
                        {
-                               $cute = eregi_replace($ext.'$', "", $file_name);
-                               if(!eregi($ext.'$', $file_name)) $display = false;
+                               $cute = preg_replace('/'.$ext.'$/i', "", $file_name);
+                               if(!preg_match('/'.$ext.'$/i', $file_name)) $display = false;
                        }
                        if(!empty($pre))
                        {
-                               $cute = eregi_replace('^'.$pre, "", $cute);
-                               if(!eregi('^'.$pre, $file_name))  $display = false;
+                               $cute = preg_replace('/^'.$pre.'/i', "", $cute);
+                               if(!preg_match('/^'.$pre.'/i', $file_name))  $display = false;
                        }
                        if($display)
                        {
@@ -77,4 +77,4 @@ function smarty_function_html_menu_files($params, &$smarty)

        echo $return;
 } 
-?>
\ No newline at end of file
+?>
diff --git a/index.php b/index.php
index 966d293..996982b 100644
--- a/index.php
+++ b/index.php
@@ -1,4 +1,6 @@
 generate_form('account', 'add', 'search');
                else
                $arr = $static_var->generate_form('account', 'add', 'update');
@@ -1332,4 +1332,4 @@ class account
                }
        }
 }
-?>
\ No newline at end of file
+?>
diff --git a/modules/account_admin/account_admin.inc.php b/modules/account_admin/account_admin.inc.php
index 2548fea..183d0d9 100644
--- a/modules/account_admin/account_admin.inc.php
+++ b/modules/account_admin/account_admin.inc.php
@@ -1915,7 +1915,7 @@ class account_admin
                                if($value != '')
                                {
                                        $pat = "^" . $this->module . "_";
-                                       if(eregi($pat, $key))
+                                       if(preg_match('/'.$pat.'/', $key))
                                        {                                       
                                                $field = eregi_replace($pat,"",$key);
                                                if(eregi('%',$value))
@@ -2649,4 +2649,4 @@ class account_admin
                }                                                                
        }                               
 }
-?>
\ No newline at end of file
+?>
diff --git a/modules/charge/charge.inc.php b/modules/charge/charge.inc.php
index 3f25c27..4066d36 100644
--- a/modules/charge/charge.inc.php
+++ b/modules/charge/charge.inc.php
@@ -613,7 +613,7 @@ class charge
                                if($value != '')
                                {
                                        $pat = "^" . $this->module . "_";
-                                       if(eregi($pat, $key))
+                                       if(preg_match('/'.$pat.'/i', $key))
                                        {                                       
                                                $field = eregi_replace($pat,"",$key);
                                                if(eregi('%',$value))
@@ -1112,4 +1112,4 @@ class charge
                } 
        }        
 }
-?>
\ No newline at end of file
+?>
diff --git a/modules/invoice/invoice.inc.php b/modules/invoice/invoice.inc.php
index c326fac..0d1ceea 100644
--- a/modules/invoice/invoice.inc.php
+++ b/modules/invoice/invoice.inc.php
@@ -3755,7 +3755,7 @@ class invoice
                                if($value != '')
                                {
                                        $pat = "^" . $this->module . "_";
-                                       if(eregi($pat, $key))
+                                       if(preg_match('/'.$pat.'/i', $key))
                                        {
                                                $field = eregi_replace($pat,"",$key);
                                                if(eregi('%',$value))
@@ -4143,7 +4143,7 @@ class invoice
                        $order_by .= ' ASC';
                        $smarty_sort = 'asc=';
                } else {
-                       if (!eregi('date',$smarty_order)) {
+                       if (!preg_match('/date/i',$smarty_order)) {
                                $order_by .= ' ASC';
                                $smarty_sort = 'asc=';
                        } else {
@@ -4162,9 +4162,9 @@ class invoice

                # generate the full query
                $db = &DB();
-               $q = eregi_replace("%%fieldList%%", $field_list, $search->sql);
-               $q = eregi_replace("%%tableList%%", AGILE_DB_PREFIX.$construct->table, $q);
-               $q = eregi_replace("%%whereList%%", "", $q);
+               $q = preg_replace("/%%fieldList%%/i", $field_list, $search->sql);
+               $q = preg_replace("/%%tableList%%/i", AGILE_DB_PREFIX.$construct->table, $q);
+               $q = preg_replace("/%%whereList%%/i", "", $q);
                $q .= " ".AGILE_DB_PREFIX . "invoice.site_id = '" . DEFAULT_SITE . "'";
                $q .= $order_by;

diff --git a/modules/product_cat/product_cat.inc.php b/modules/product_cat/product_cat.inc.php
index 1a7db9a..a7741d3 100644
--- a/modules/product_cat/product_cat.inc.php
+++ b/modules/product_cat/product_cat.inc.php
@@ -268,7 +268,7 @@ class product_cat

                # Get current id
                if(!empty($VAR['id'])) {
-                       $cid = ereg_replace(",","", $VAR['id']);
+                       $cid = preg_replace("/,/","", $VAR['id']);
                } else {
                        $current = '';
                }
@@ -369,7 +369,7 @@ class product_cat

                # Get current category id
                if(!empty($VAR['id'])) {
-                       $product_id = ereg_replace(",","", $VAR['id']);
+                       $product_id = preg_replace("/,/","", $VAR['id']);
                        $sql = $dbc->sql_select("product", "avail_category_id", "id = $product_id","", $db);
                        $product = $db->Execute($sql);
                        $current = unserialize($product->fields['avail_category_id']);
@@ -609,4 +609,4 @@ class product_cat
                $db->search_show($VAR, $this, $type);
        }                       
 }
-?>
\ No newline at end of file
+?>
diff --git a/modules/service/service.inc.php b/modules/service/service.inc.php
index d9074df..d2d7f4d 100644
--- a/modules/service/service.inc.php
+++ b/modules/service/service.inc.php
@@ -1364,7 +1364,7 @@ class service
                if(empty($VAR['clearall']) && empty($VAR['changeproduct'])) {
                        foreach($VAR as $key => $val) {
                                if(!empty($val)) {
-                                       $key = ereg_replace('^product_','', $key);
+                                       $key = preg_replace('/^product_/','', $key);
                                        if(is_array($val))
                                        $fields["$key"] = serialize($val);
                                        else
@@ -1888,4 +1888,4 @@ class service
                $this->limit    = $construct["construct"]["limit"];
        }
 }
-?>
\ No newline at end of file
+?>
diff --git a/modules/setup/setup.inc.php b/modules/setup/setup.inc.php
index 6f1592e..4272502 100644
--- a/modules/setup/setup.inc.php
+++ b/modules/setup/setup.inc.php
@@ -93,15 +93,15 @@ class setup

                # make sure the index.php file is not included at the end:
                if(!empty($VAR['setup_ssl_url']))
-                       $VAR['setup_ssl_url'] = eregi_replace('index.php', '', $VAR['setup_ssl_url']);
+                       $VAR['setup_ssl_url'] = preg_replace('/index.php/', '', $VAR['setup_ssl_url']);
                if(!empty($VAR['setup_nonssl_url']))
-                       $VAR['setup_nonssl_url'] = eregi_replace('index.php', '', $VAR['setup_nonssl_url']);                    
+                       $VAR['setup_nonssl_url'] = preg_replace('/index.php/', '', $VAR['setup_nonssl_url']);                   

                # Validate trailing slash is on the end of the URL:
-               if(!empty($VAR['setup_ssl_url']) && !ereg('/$', $VAR['setup_ssl_url']))
+               if(!empty($VAR['setup_ssl_url']) && !preg_match('/\/$/', $VAR['setup_ssl_url']))
                        $VAR['setup_ssl_url'] .= '/';           
                # Validate trailing slash is on the end of the URL:
-               if(!empty($VAR['setup_nonssl_url']) && !ereg('/$', $VAR['setup_nonssl_url']))
+               if(!empty($VAR['setup_nonssl_url']) && !preg_match('/\/$/', $VAR['setup_nonssl_url']))
                        $VAR['setup_nonssl_url'] .= '/';                                        

                $type = "update";
@@ -149,4 +149,4 @@ class setup
                phpinfo();
        }
 }
-?>
\ No newline at end of file
+?>
diff --git a/modules/ticket/ticket.inc.php b/modules/ticket/ticket.inc.php
index 05051b1..6392a4f 100644
--- a/modules/ticket/ticket.inc.php
+++ b/modules/ticket/ticket.inc.php
@@ -201,7 +201,7 @@ class ticket
        ##############################
        function merge_list($VAR)
        {
-               $id = ereg_replace(',','', $VAR['id']);
+               $id = preg_replace('/,/','', $VAR['id']);

                global $C_translate;

@@ -244,7 +244,7 @@ class ticket
                                $subject .= '..';

                                $return .= ' ';
+                               $return .= '>' . preg_replace('/%/','', date(DEFAULT_DATE_FORMAT, $result->fields["date_orig"])) . ' | ' . $subject . ' ';
                                $i++;
                                $result->MoveNext();
                        }
@@ -1278,10 +1278,10 @@ class ticket
                                if($value != '')
                                {
                                        $pat = "^" . $this->module . "_";
-                                       if(eregi($pat, $key))
+                                       if(preg_match('/'.$pat.'/i', $key))
                                        {
-                                               $field = eregi_replace($pat,"",$key);
-                                               if(eregi('%',$value))
+                                               $field = preg_replace('/'.$pat.'/i',"",$key);
+                                               if(preg_match('/%/',$value))
                                                {
                                                        # do any data conversion for this field (date, encrypt, etc...)
                                                        if(isset($this->field["$field"]["convert"]))
@@ -1347,10 +1347,10 @@ class ticket
                                if($value != '')
                                {
                                        $pat = "^" . $this->module . "_";
-                                       if(eregi($pat, $key))
+                                       if(preg_match('/'.$pat.'/', $key))
                                        {
-                                               $field = eregi_replace($pat,"",$key);
-                                               if(eregi('%',$value))
+                                               $field = preg_replace('/'.$pat.'/i',"",$key);
+                                               if(preg_match('/%/i',$value))
                                                {
                                                        # do any data conversion for this field (date, encrypt, etc...)
                                                        if(isset($this->field["$field"]["convert"]))
@@ -1472,7 +1472,7 @@ class ticket
                                                        AND
                                                        s{$idx}.site_id = ".$db->qstr(DEFAULT_SITE)."                                                   
                                                        AND";
-                                       if(ereg("%", $value))
+                                       if(preg_match("/%/i", $value))
                                        $join_list .= " s{$idx}.value LIKE ".$db->qstr($VAR["static_relation"]["$idx"]);
                                        else
                                        $join_list .= " s{$idx}.value = ".$db->qstr($VAR["static_relation"]["$idx"]);
@@ -1652,7 +1652,7 @@ class ticket
                        $order_by .= ' ASC';
                        $smarty_sort = 'asc=';
                } else {
-                       if (!eregi('date',$smarty_order)) {
+                       if (!preg_match('/date/i',$smarty_order)) {
                                $order_by .= ' ASC';
                                $smarty_sort = 'asc=';
                        } else {
@@ -1665,9 +1665,9 @@ class ticket
                # generate the full query

                $db = &DB();
-               $q = eregi_replace("%%fieldList%%", $field_list, $search->sql);
-               $q = eregi_replace("%%tableList%%", AGILE_DB_PREFIX.$construct->table, $q);
-               $q = eregi_replace("%%whereList%%", "", $q);
+               $q = preg_replace("/%%fieldList%%/i", $field_list, $search->sql);
+               $q = preg_replace("/%%tableList%%/i", AGILE_DB_PREFIX.$construct->table, $q);
+               $q = preg_replace("/%%whereList%%/i", "", $q);
                $q .= " ".AGILE_DB_PREFIX . "ticket."."site_id = " . $db->qstr(DEFAULT_SITE);
                $q .= $order_by;

@@ -1780,7 +1780,7 @@ class ticket
                require_once(PATH_CORE   . 'static_var.inc.php');
                $static_var = new CORE_static_var;

-               if(ereg('search', $VAR['_page']))
+               if(preg_match('/search/', $VAR['_page']))
                $arr = $static_var->generate_form($this->module, 'user_add', 'search');
                else
                $arr = $static_var->generate_form($this->module, 'user_add', 'update');
tony-landis commented 10 years ago

David, would it be possible for you to submit this patch as a pull request?

davidbuzz commented 10 years ago

no. I don't have a fork at present. ... and have no plans to make one

007au commented 10 years ago

@tony-landis I will package these changes into my fork tonight and push a PR through.

jbenden commented 10 years ago

Note: A couple of the files have already been patched.

jbenden commented 10 years ago

All of the files referenced in the above patch have been manually patched.

tony-landis commented 10 years ago

Thanks @jbenden!