From a33a015eb4dc5294ec23f8a7b919038f267fb2af Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Fri, 23 Oct 2009 19:03:01 +0000 Subject: [PATCH] Fix: functions "ereg", "ereg_replace", "eregi", "eregi_replace" is deprecated since php 5.3.0 --- htdocs/about.php | 4 ++-- htdocs/actioncomm.class.php | 2 +- htdocs/companybankaccount.class.php | 2 +- htdocs/contact.class.php | 2 +- htdocs/lib/pdf.lib.php | 8 ++++---- htdocs/lib/security.lib.php | 2 +- htdocs/lib/treeview.lib.php | 18 ++++++++--------- htdocs/lib/usergroups.lib.php | 2 +- htdocs/lib/xcal.lib.php | 2 +- htdocs/livraison/fiche.php | 2 +- .../ws_server/lib/class.soap_server.php | 8 ++++---- .../ws_server/lib/class.soapclient.php | 2 +- htdocs/oscommerce_ws/ws_server/lib/nusoap.php | 10 +++++----- htdocs/paybox/paybox.lib.php | 20 +++++++++---------- htdocs/product/liste.php | 8 ++++---- htdocs/product/photos.php | 2 +- htdocs/product/price.php | 4 ++-- htdocs/product/reassort.php | 6 +++--- htdocs/societe.php | 2 +- htdocs/societe/checkvat/checkVatPopup.php | 10 +++++----- htdocs/support/inc.php | 2 +- htdocs/support/index.php | 6 +++--- htdocs/support/online.php | 4 ++-- htdocs/webcal/webcal.class.php | 6 +++--- scripts/emailings/mailing-send.php | 2 +- scripts/invoices/rebuild_merge_pdf.php | 4 ++-- 26 files changed, 70 insertions(+), 70 deletions(-) diff --git a/htdocs/about.php b/htdocs/about.php index dec0492111d..c1551632756 100644 --- a/htdocs/about.php +++ b/htdocs/about.php @@ -68,7 +68,7 @@ print '
  • '; print ''.$langs->trans("OfficialWebSite").''; print '
  • '; // Si langue francaise, on affiche site web francophone -if (eregi('^fr_',$langs->getDefaultLang())) +if (preg_match('/^fr_/i',$langs->getDefaultLang())) { print '
  • '; print ''.$langs->trans("OfficialWebSiteFr").''; @@ -81,7 +81,7 @@ print '
  • '; print ''.$langs->trans("OfficialDemo").''; print '
  • '; -if (eregi('^fr_',$langs->getDefaultLang())) +if (preg_match('/^fr_/i',$langs->getDefaultLang())) { print '
  • '; print 'Les tâches en cours de réalisation sur Dolibarr sont consultables dans le gestionnaire de projets sur Savannah.'; diff --git a/htdocs/actioncomm.class.php b/htdocs/actioncomm.class.php index ea1450651f3..71e41a70861 100644 --- a/htdocs/actioncomm.class.php +++ b/htdocs/actioncomm.class.php @@ -701,7 +701,7 @@ class ActionComm $event['transparency']='TRANSPARENT'; // TRANSPARENT or OPAQUE $event['category']=$langs->convToOutputCharset($obj->libelle); // libelle type action $url=$dolibarr_main_url_root; - if (! eregi('\/$',$url)) $url.='/'; + if (! preg_match('/\/$/',$url)) $url.='/'; $url.='comm/action/fiche.php?id='.$obj->id; $event['url']=$url; diff --git a/htdocs/companybankaccount.class.php b/htdocs/companybankaccount.class.php index c63d8cfb002..1d753d2ab31 100644 --- a/htdocs/companybankaccount.class.php +++ b/htdocs/companybankaccount.class.php @@ -217,7 +217,7 @@ class CompanyBankAccount if (! empty($this->iban)) { // If IBAN defined, we can know country of account from it - if (eregi("^([a-zA-Z][a-zA-Z])",$this->iban,$reg)) return $reg[1]; + if (preg_match("/^([a-z]{2}/i)",$this->iban,$reg)) return $reg[1]; } // We return country code diff --git a/htdocs/contact.class.php b/htdocs/contact.class.php index dc806d6257d..93658307983 100644 --- a/htdocs/contact.class.php +++ b/htdocs/contact.class.php @@ -318,7 +318,7 @@ class Contact extends CommonObject if ($this->birthday) // <0 si avant 1970, >0 si apres 1970 { - if (eregi('^[0-9]+\-',$this->birthday)) + if (preg_match('/^[0-9]+\-/',$this->birthday)) { // Si date = chaine (ne devrait pas arriver) $sql .= ", birthday='".$this->birthday."'"; diff --git a/htdocs/lib/pdf.lib.php b/htdocs/lib/pdf.lib.php index 1e877a75336..c3f5ac626ed 100644 --- a/htdocs/lib/pdf.lib.php +++ b/htdocs/lib/pdf.lib.php @@ -154,14 +154,14 @@ function pdf_pagefoot(&$pdf,$outputlangs,$paramfreetext,$fromcompany,$marge_bass if ($fromcompany->profid1 && ($fromcompany->pays_code != 'FR' || ! $fromcompany->profid2)) { $field=$outputlangs->transcountrynoentities("ProfId1",$fromcompany->pays_code); - if (eregi('\((.*)\)',$field,$reg)) $field=$reg[1]; + if (preg_match('/\((.*)\)/i',$field,$reg)) $field=$reg[1]; $ligne1.=($ligne1?" - ":"").$field.": ".$outputlangs->convToOutputCharset($fromcompany->profid1); } // Prof Id 2 if ($fromcompany->profid2) { $field=$outputlangs->transcountrynoentities("ProfId2",$fromcompany->pays_code); - if (eregi('\((.*)\)',$field,$reg)) $field=$reg[1]; + if (preg_match('/\((.*)\)/i',$field,$reg)) $field=$reg[1]; $ligne1.=($ligne1?" - ":"").$field.": ".$outputlangs->convToOutputCharset($fromcompany->profid2); } @@ -171,14 +171,14 @@ function pdf_pagefoot(&$pdf,$outputlangs,$paramfreetext,$fromcompany,$marge_bass if ($fromcompany->profid3) { $field=$outputlangs->transcountrynoentities("ProfId3",$fromcompany->pays_code); - if (eregi('\((.*)\)',$field,$reg)) $field=$reg[1]; + if (preg_match('/\((.*)\)/i',$field,$reg)) $field=$reg[1]; $ligne2.=($ligne2?" - ":"").$field.": ".$outputlangs->convToOutputCharset($fromcompany->profid3); } // Prof Id 4 if ($fromcompany->profid4) { $field=$outputlangs->transcountrynoentities("ProfId4",$fromcompany->pays_code); - if (eregi('\((.*)\)',$field,$reg)) $field=$reg[1]; + if (preg_match('/\((.*)\)/i',$field,$reg)) $field=$reg[1]; $ligne2.=($ligne2?" - ":"").$field.": ".$outputlangs->convToOutputCharset($fromcompany->profid4); } // IntraCommunautary VAT diff --git a/htdocs/lib/security.lib.php b/htdocs/lib/security.lib.php index d37feacfb0a..25f22f1b4de 100644 --- a/htdocs/lib/security.lib.php +++ b/htdocs/lib/security.lib.php @@ -387,7 +387,7 @@ function encodedecode_dbpassconf($level=0) $val = trim($reg[1]); // This also remove CR/LF $val=preg_replace('/^["\']/','',$val); $val=preg_replace('/["\'][\s;]*$/','',$val); - if (eregi('crypted:',$buffer)) + if (preg_match('/crypted:/i',$buffer)) { $val = preg_replace('/crypted:/i','',$val); $passwd_crypted = $val; diff --git a/htdocs/lib/treeview.lib.php b/htdocs/lib/treeview.lib.php index ab04efd7df9..ad75fdbabbf 100644 --- a/htdocs/lib/treeview.lib.php +++ b/htdocs/lib/treeview.lib.php @@ -61,7 +61,7 @@ function is_in_subtree($fulltree,$parentid,$childid) if ($record['id'] == $childid) { //print $record['fullpath'].'_'.' - '.$fullpathparent.'_'; - if (eregi($fullpathparent.'_',$record['fullpath'].'_')) + if (preg_match('/'.$fullpathparent.'_/i',$record['fullpath'].'_')) { //print 'DEL='.$childid; return 1; @@ -150,7 +150,7 @@ function tree_addjs() } -/* cette fonction gère le décallage des éléments +/* cette fonction g�re le d�callage des �l�ments suivant leur position dans l'arborescence */ function tree_showline($tab,$rang) @@ -219,10 +219,10 @@ function tree_showline($tab,$rang) } -/*fonction récursive d'affichage de l'arbre - $tab :tableau des éléments - $pere :index de l'élément courant - $rang :décallage de l'élément +/*fonction r�cursive d'affichage de l'arbre + $tab :tableau des �l�ments + $pere :index de l'�l�ment courant + $rang :d�callage de l'�l�ment */ function tree_recur($tab,$pere,$rang) { @@ -233,15 +233,15 @@ function tree_recur($tab,$pere,$rang) //ballayage du tableau for ($x=0;$x '.' - && substr($subdir, 0, 3) <> 'CVS' && ! eregi('common',$subdir)) + && substr($subdir, 0, 3) <> 'CVS' && ! preg_match('/common/i',$subdir)) { if ($i % $thumbsbyrow == 0) { diff --git a/htdocs/lib/xcal.lib.php b/htdocs/lib/xcal.lib.php index 4620127692e..ac009aba344 100644 --- a/htdocs/lib/xcal.lib.php +++ b/htdocs/lib/xcal.lib.php @@ -260,7 +260,7 @@ function build_rssfile($format='rss',$title,$desc,$events_array,$outputfile,$fil 'Dolibarr'."\n"; $url=$dolibarr_main_url_root; - if (! eregi('\/$',$url)) $url.='/'; + if (! preg_match('/\/$/',$url)) $url.='/'; $url.='comm/action/agendaexport.php?format=rss&exportkey='.urlencode($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY); $html.=''."\n"; // 'editor@example.com'."\n" diff --git a/htdocs/livraison/fiche.php b/htdocs/livraison/fiche.php index a2087b50301..57ba7160ca9 100644 --- a/htdocs/livraison/fiche.php +++ b/htdocs/livraison/fiche.php @@ -561,7 +561,7 @@ else { print '
    '; -// if (! eregi('^(valid|delete)',$_REQUEST["action"])) +// if (! preg_match('/^(valid|delete)/i',$_REQUEST["action"])) // { if ($livraison->statut == 0 && $user->rights->expedition->livraison->valider && $num_prod > 0) { diff --git a/htdocs/oscommerce_ws/ws_server/lib/class.soap_server.php b/htdocs/oscommerce_ws/ws_server/lib/class.soap_server.php index e9d1644ef97..88eca9f32b6 100644 --- a/htdocs/oscommerce_ws/ws_server/lib/class.soap_server.php +++ b/htdocs/oscommerce_ws/ws_server/lib/class.soap_server.php @@ -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'; @@ -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'; diff --git a/htdocs/oscommerce_ws/ws_server/lib/class.soapclient.php b/htdocs/oscommerce_ws/ws_server/lib/class.soapclient.php index f828aa78121..3fe15fad6e2 100644 --- a/htdocs/oscommerce_ws/ws_server/lib/class.soapclient.php +++ b/htdocs/oscommerce_ws/ws_server/lib/class.soapclient.php @@ -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/htdocs/oscommerce_ws/ws_server/lib/nusoap.php b/htdocs/oscommerce_ws/ws_server/lib/nusoap.php index 34af56b7ddb..6cb65e8f6dd 100644 --- a/htdocs/oscommerce_ws/ws_server/lib/nusoap.php +++ b/htdocs/oscommerce_ws/ws_server/lib/nusoap.php @@ -3725,7 +3725,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'; @@ -3754,7 +3754,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'; @@ -3788,7 +3788,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'; @@ -4214,7 +4214,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'; @@ -7506,7 +7506,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/htdocs/paybox/paybox.lib.php b/htdocs/paybox/paybox.lib.php index d0f1e297028..64f8e84e4d0 100644 --- a/htdocs/paybox/paybox.lib.php +++ b/htdocs/paybox/paybox.lib.php @@ -126,12 +126,12 @@ function print_paybox_redirect($PRICE,$CURRENCY,$EMAIL,$urlok,$urlko,$TAG) $IBS_BKGD="#FFFFFF"; $IBS_WAIT="2000"; $IBS_LANG="GBR"; // By default GBR=english (FRA, GBR, ESP, ITA et DEU...) - if (eregi('^FR',$langs->defaultlang)) $IBS_LANG="FRA"; - if (eregi('^ES',$langs->defaultlang)) $IBS_LANG="ESP"; - if (eregi('^IT',$langs->defaultlang)) $IBS_LANG="ITA"; - if (eregi('^DE',$langs->defaultlang)) $IBS_LANG="DEU"; - if (eregi('^NL',$langs->defaultlang)) $IBS_LANG="NLD"; - if (eregi('^SE',$langs->defaultlang)) $IBS_LANG="SWE"; + if (preg_match('/^FR/i',$langs->defaultlang)) $IBS_LANG="FRA"; + if (preg_match('/^ES/i',$langs->defaultlang)) $IBS_LANG="ESP"; + if (preg_match('/^IT/i',$langs->defaultlang)) $IBS_LANG="ITA"; + if (preg_match('/^DE/i',$langs->defaultlang)) $IBS_LANG="DEU"; + if (preg_match('/^NL/i',$langs->defaultlang)) $IBS_LANG="NLD"; + if (preg_match('/^SE/i',$langs->defaultlang)) $IBS_LANG="SWE"; $IBS_OUTPUT='E'; $PBX_SOURCE='HTML'; $PBX_TYPEPAIEMENT='CARTE'; @@ -253,14 +253,14 @@ function html_print_footer($fromcompany,$langs) if ($fromcompany->profid1 && ($fromcompany->pays_code != 'FR' || ! $fromcompany->profid2)) { $field=$langs->transcountrynoentities("ProfId1",$fromcompany->pays_code); - if (eregi('\((.*)\)',$field,$reg)) $field=$reg[1]; + if (preg_match('/\((.*)\)/i',$field,$reg)) $field=$reg[1]; $ligne1.=($ligne1?" - ":"").$field.": ".$langs->convToOutputCharset($fromcompany->profid1); } // Prof Id 2 if ($fromcompany->profid2) { $field=$langs->transcountrynoentities("ProfId2",$fromcompany->pays_code); - if (eregi('\((.*)\)',$field,$reg)) $field=$reg[1]; + if (preg_match('/\((.*)\)/i',$field,$reg)) $field=$reg[1]; $ligne1.=($ligne1?" - ":"").$field.": ".$langs->convToOutputCharset($fromcompany->profid2); } @@ -270,14 +270,14 @@ function html_print_footer($fromcompany,$langs) if ($fromcompany->profid3) { $field=$langs->transcountrynoentities("ProfId3",$fromcompany->pays_code); - if (eregi('\((.*)\)',$field,$reg)) $field=$reg[1]; + if (preg_match('/\((.*)\)/i',$field,$reg)) $field=$reg[1]; $ligne2.=($ligne2?" - ":"").$field.": ".$langs->convToOutputCharset($fromcompany->profid3); } // Prof Id 4 if ($fromcompany->profid4) { $field=$langs->transcountrynoentities("ProfId4",$fromcompany->pays_code); - if (eregi('\((.*)\)',$field,$reg)) $field=$reg[1]; + if (preg_match('/\((.*)\)/i',$field,$reg)) $field=$reg[1]; $ligne2.=($ligne2?" - ":"").$field.": ".$langs->convToOutputCharset($fromcompany->profid4); } // IntraCommunautary VAT diff --git a/htdocs/product/liste.php b/htdocs/product/liste.php index 0fac3a39e26..460a780a92f 100644 --- a/htdocs/product/liste.php +++ b/htdocs/product/liste.php @@ -346,10 +346,10 @@ if ($resql) if ($conf->service->enabled && $type != 0) { print ''; - if (eregi('([0-9]+)y',$objp->duration,$regs)) print $regs[1].' '.$langs->trans("DurationYear"); - elseif (eregi('([0-9]+)m',$objp->duration,$regs)) print $regs[1].' '.$langs->trans("DurationMonth"); - elseif (eregi('([0-9]+)w',$objp->duration,$regs)) print $regs[1].' '.$langs->trans("DurationWeek"); - elseif (eregi('([0-9]+)d',$objp->duration,$regs)) print $regs[1].' '.$langs->trans("DurationDay"); + if (preg_match('/([0-9]+)y/i',$objp->duration,$regs)) print $regs[1].' '.$langs->trans("DurationYear"); + elseif (preg_match('/([0-9]+)m/i',$objp->duration,$regs)) print $regs[1].' '.$langs->trans("DurationMonth"); + elseif (preg_match('/([0-9]+)w/i',$objp->duration,$regs)) print $regs[1].' '.$langs->trans("DurationWeek"); + elseif (preg_match('/([0-9]+)d/i',$objp->duration,$regs)) print $regs[1].' '.$langs->trans("DurationDay"); else print $objp->duration; print ''; } diff --git a/htdocs/product/photos.php b/htdocs/product/photos.php index f637886d052..7db67fbaa67 100644 --- a/htdocs/product/photos.php +++ b/htdocs/product/photos.php @@ -231,7 +231,7 @@ if ($_GET["id"] || $_GET["ref"]) print '
    '; // On propose la generation de la vignette si elle n'existe pas et si la taille est superieure aux limites - if (!$obj['photo_vignette'] && eregi('(\.bmp|\.gif|\.jpg|\.jpeg|\.png)$',$obj['photo']) && ($product->imgWidth > $maxWidth || $product->imgHeight > $maxHeight)) + if (!$obj['photo_vignette'] && preg_match('/(\.bmp|\.gif|\.jpg|\.jpeg|\.png)$/i',$obj['photo']) && ($product->imgWidth > $maxWidth || $product->imgHeight > $maxHeight)) { print ''.img_refresh($langs->trans('GenerateThumb')).'  '; } diff --git a/htdocs/product/price.php b/htdocs/product/price.php index c4a8237c842..be558c515d4 100644 --- a/htdocs/product/price.php +++ b/htdocs/product/price.php @@ -70,7 +70,7 @@ if ($_POST["action"] == 'update_price' && ! $_POST["cancel"] && ($user->rights-> $newprice=price2num($_POST["price_".$i],'MU'); $newprice_min=price2num($_POST["price_min_".$i],'MU'); $newpricebase=$_POST["multiprices_base_type_".$i]; - $newnpr=(eregi('\*',$_POST["tva_tx_".$i]) ? 1 : 0); + $newnpr=(preg_match('/\*/',$_POST["tva_tx_".$i]) ? 1 : 0); $newvat=str_replace('*','',$_POST["tva_tx_".$i]); break; // We found submited price } @@ -82,7 +82,7 @@ if ($_POST["action"] == 'update_price' && ! $_POST["cancel"] && ($user->rights-> $newprice=price2num($_POST["price"],'MU'); $newprice_min=price2num($_POST["price_min"],'MU'); $newpricebase=$_POST["price_base_type"]; - $newnpr=(eregi('\*',$_POST["tva_tx"]) ? 1 : 0); + $newnpr=(preg_match('/\*/',$_POST["tva_tx"]) ? 1 : 0); $newvat=str_replace('*','',$_POST["tva_tx"]); } diff --git a/htdocs/product/reassort.php b/htdocs/product/reassort.php index 9f4f6ec0855..b6e05e0bd60 100644 --- a/htdocs/product/reassort.php +++ b/htdocs/product/reassort.php @@ -258,9 +258,9 @@ if ($resql) if ($conf->service->enabled && $type == 1) { print ''; - if (eregi('([0-9]+)y',$objp->duration,$regs)) print $regs[1].' '.$langs->trans("DurationYear"); - elseif (eregi('([0-9]+)m',$objp->duration,$regs)) print $regs[1].' '.$langs->trans("DurationMonth"); - elseif (eregi('([0-9]+)d',$objp->duration,$regs)) print $regs[1].' '.$langs->trans("DurationDay"); + if (preg_match('/([0-9]+)y/i',$objp->duration,$regs)) print $regs[1].' '.$langs->trans("DurationYear"); + elseif (preg_match('/([0-9]+)m/i',$objp->duration,$regs)) print $regs[1].' '.$langs->trans("DurationMonth"); + elseif (preg_match('/([0-9]+)d/i',$objp->duration,$regs)) print $regs[1].' '.$langs->trans("DurationDay"); else print $objp->duration; print ''; } diff --git a/htdocs/societe.php b/htdocs/societe.php index 53a469cbcf2..606ea93db98 100644 --- a/htdocs/societe.php +++ b/htdocs/societe.php @@ -236,7 +236,7 @@ if ($resql) $textprofid[$key]=''; if ($label != "ProfId".$key.$mysoc->pays_code) { // Get only text between () - if (eregi('\((.*)\)',$label,$reg)) $label=$reg[1]; + if (preg_match('/\((.*)\)/i',$label,$reg)) $label=$reg[1]; $textprofid[$key]=$langs->trans("ProfIdShortDesc",$key,$mysoc->pays_code,$label); } } diff --git a/htdocs/societe/checkvat/checkVatPopup.php b/htdocs/societe/checkvat/checkVatPopup.php index 6216f06842e..403e4e899d0 100644 --- a/htdocs/societe/checkvat/checkVatPopup.php +++ b/htdocs/societe/checkvat/checkVatPopup.php @@ -78,23 +78,23 @@ else print ''.$langs->trans("Response").':
    '; // Service indisponible - if (! is_array($result) || eregi('SERVICE_UNAVAILABLE',$result['faultstring'])) + if (! is_array($result) || preg_match('/SERVICE_UNAVAILABLE/i',$result['faultstring'])) { print ''.$langs->trans("ErrorServiceUnavailableTryLater").'
    '; $messagetoshow=$soapclient->response; } - elseif (eregi('TIMEOUT',$result['faultstring'])) + elseif (preg_match('/TIMEOUT/i',$result['faultstring'])) { print ''.$langs->trans("ErrorServiceUnavailableTryLater").'
    '; $messagetoshow=$soapclient->response; } - elseif (eregi('SERVER_BUSY',$result['faultstring'])) + elseif (preg_match('/SERVER_BUSY/i',$result['faultstring'])) { print ''.$langs->trans("ErrorServiceUnavailableTryLater").'
    '; $messagetoshow=$soapclient->response; } // Syntaxe ko - elseif (eregi('INVALID_INPUT',$result['faultstring']) + elseif (preg_match('/INVALID_INPUT/i',$result['faultstring']) || ($result['requestDate'] && ! $result['valid'])) { if ($result['requestDate']) print $langs->trans("Date").': '.$result['requestDate'].'
    '; @@ -108,7 +108,7 @@ else if ($result['requestDate']) print $langs->trans("Date").': '.$result['requestDate'].'
    '; print $langs->trans("VATIntraSyntaxIsValid").': '.$langs->trans("Yes").'
    '; print $langs->trans("VATIntraValueIsValid").': '; - if (eregi('MS_UNAVAILABLE',$result['faultstring'])) + if (preg_match('/MS_UNAVAILABLE/i',$result['faultstring'])) { print ''.$langs->trans("ErrorVATCheckMS_UNAVAILABLE",$_REQUEST["countryCode"]).'
    '; } diff --git a/htdocs/support/inc.php b/htdocs/support/inc.php index 5f9f1c99089..b5a280b4a0b 100644 --- a/htdocs/support/inc.php +++ b/htdocs/support/inc.php @@ -131,7 +131,7 @@ function stripslashes_deep($value) { return (is_array($value) ? array_map('stripslashes_deep', $value) : stripslashes($value)); } -//if (! eregi('PHP/6', $_SERVER['SERVER_SOFTWARE'])) +//if (! preg_match('/PHP\/6/i', $_SERVER['SERVER_SOFTWARE'])) if (function_exists('get_magic_quotes_gpc')) // magic_quotes_* plus pris en compte dans PHP6 { if (get_magic_quotes_gpc()) diff --git a/htdocs/support/index.php b/htdocs/support/index.php index 682ea39bb22..32b434bb79b 100644 --- a/htdocs/support/index.php +++ b/htdocs/support/index.php @@ -85,12 +85,12 @@ print img_picto_common('','who.png','',1); print '';*/ print ''; $urlwiki='http://wiki.dolibarr.org'; -if (eregi('fr',$langs->defaultlang)) $urlwiki='http://wiki.dolibarr.org/index.php/Accueil'; -if (eregi('es',$langs->defaultlang)) $urlwiki='http://wiki.dolibarr.org/index.php/Portada'; +if (preg_match('/fr/i',$langs->defaultlang)) $urlwiki='http://wiki.dolibarr.org/index.php/Accueil'; +if (preg_match('/es/i',$langs->defaultlang)) $urlwiki='http://wiki.dolibarr.org/index.php/Portada'; print '
    '.$langs->trans("ForDocumentationSeeWiki",$urlwiki,$urlwiki); print '
    '; $urlforum='http://www.dolibarr.org/forum/'; -if (eregi('fr',$langs->defaultlang)) $urlforum='http://www.dolibarr.fr/forum/'; +if (preg_match('/fr/i',$langs->defaultlang)) $urlforum='http://www.dolibarr.fr/forum/'; print '
    '.$langs->trans("ForAnswersSeeForum",$urlforum,$urlforum).'
    '; print ''; print ''; diff --git a/htdocs/support/online.php b/htdocs/support/online.php index f63167a99ea..7b2773c1857 100644 --- a/htdocs/support/online.php +++ b/htdocs/support/online.php @@ -81,7 +81,7 @@ foreach ($arrayofwidgets as $arraywidget) // Loop on each user foreach($listoflangs as $langcode) // Loop on each lang of user { $pos++; - if (eregi($langcode,$langs->defaultlang) || $langcode == 'en') // If lang qualified + if (preg_match('/'.$langcode.'/i',$langs->defaultlang) || $langcode == 'en') // If lang qualified { print ''; print $arraywidget['name'].'
    '; @@ -90,7 +90,7 @@ foreach ($arrayofwidgets as $arraywidget) // Loop on each user foreach ($listoflangs as $langcode2) { if (empty($widgetid)) $widgetid=$listoflangs[$pos-1]; - if (! eregi($langcode,$langs->defaultlang) && $langcode2 != 'en') continue; // Show only english + if (! preg_match('/'.$langcode.'/i',$langs->defaultlang) && $langcode2 != 'en') continue; // Show only english print $langcode2.' '; } print '
    '; diff --git a/htdocs/webcal/webcal.class.php b/htdocs/webcal/webcal.class.php index 9c0883abc3b..3910e4dd88e 100644 --- a/htdocs/webcal/webcal.class.php +++ b/htdocs/webcal/webcal.class.php @@ -237,7 +237,7 @@ class Webcal { $event['type']=$type; $date=$obj->cal_date; $time=$obj->cal_time; - if (eregi('^([0-9][0-9][0-9][0-9])([0-9][0-9])([0-9][0-9])$',$date,$reg)) + if (preg_match('/^([0-9][0-9][0-9][0-9])([0-9][0-9])([0-9][0-9])$/',$date,$reg)) { $year=$reg[1]; $month=$reg[2]; @@ -246,7 +246,7 @@ class Webcal { if (! empty($filters['month']) && $year != $filters['month']) $qualified=false; if (! empty($filters['day']) && $year != $filters['day']) $qualified=false; } - if (eregi('^([0-9]?[0-9])([0-9][0-9])([0-9][0-9])$',$time,$reg)) + if (preg_match('/^([0-9]?[0-9])([0-9][0-9])([0-9][0-9])$/',$time,$reg)) { $hour=sprintf("%02d",$reg[1]); $min=sprintf("%02d",$reg[2]); @@ -261,7 +261,7 @@ class Webcal { $event['author']=$obj->cal_create_by; $event['transparency']='TRANSPARENT'; // TRANSPARENT or OPAQUE $url=$conf->global->PHPWEBCALENDAR_URL; - if (! eregi('\/$',$url)) $url.='/'; + if (! preg_match('/\/$/',$url)) $url.='/'; $url.='view_entry.php?id='.$obj->cal_id; $event['url']=$url; diff --git a/scripts/emailings/mailing-send.php b/scripts/emailings/mailing-send.php index 131416e0f6e..5273405a913 100644 --- a/scripts/emailings/mailing-send.php +++ b/scripts/emailings/mailing-send.php @@ -80,7 +80,7 @@ if ($resql) // Le message est-il en html $msgishtml=-1; // Inconnu par defaut - if (eregi('[ \t]*',$message)) $msgishtml=1; + if (preg_match('/[\s\t]*/i',$message)) $msgishtml=1; $i++; } diff --git a/scripts/invoices/rebuild_merge_pdf.php b/scripts/invoices/rebuild_merge_pdf.php index e88a4520853..f4c93a555a9 100644 --- a/scripts/invoices/rebuild_merge_pdf.php +++ b/scripts/invoices/rebuild_merge_pdf.php @@ -74,7 +74,7 @@ foreach ($argv as $key => $value) $found=false; // Define options - if (eregi('^lang=',$value)) + if (preg_match('/^lang=/i',$value)) { $found=true; $valarray=explode('=',$value); @@ -122,7 +122,7 @@ foreach ($argv as $key => $value) print 'Rebuild PDF for invoices with no payment done yet.'."\n"; } - if (! $found && eregi('filter=',$value)) + if (! $found && preg_match('/filter=/i',$value)) { usage(); exit;