diff --git a/dev/fpdf/makefont/makefont.php b/dev/fpdf/makefont/makefont.php
index 3efca250893..07b530da5b0 100644
--- a/dev/fpdf/makefont/makefont.php
+++ b/dev/fpdf/makefont/makefont.php
@@ -171,7 +171,7 @@ function MakeFontDescriptor($fm,$symbolic)
//StemV
if(isset($fm['StdVW']))
$stemv=$fm['StdVW'];
- elseif(isset($fm['Weight']) and eregi('(bold|black)',$fm['Weight']))
+ elseif(isset($fm['Weight']) and preg_match('/(bold|black)/i',$fm['Weight']))
$stemv=120;
else
$stemv=70;
diff --git a/dev/skeletons/build_class_from_table.php b/dev/skeletons/build_class_from_table.php
index 28ba84e4545..a7036c29439 100644
--- a/dev/skeletons/build_class_from_table.php
+++ b/dev/skeletons/build_class_from_table.php
@@ -102,8 +102,8 @@ if ($resql)
{
$property[$i]['istime']=false;
}
- if (eregi('varchar',$property[$i]['type'])
- || eregi('text',$property[$i]['type']))
+ if (preg_match('/varchar/i',$property[$i]['type'])
+ || preg_match('/text/i',$property[$i]['type']))
{
$property[$i]['ischar']=true;
}
diff --git a/dev/translation/langAutoParser.class.php b/dev/translation/langAutoParser.class.php
index a33ea9fb30e..2f5e303bd93 100644
--- a/dev/translation/langAutoParser.class.php
+++ b/dev/translation/langAutoParser.class.php
@@ -154,7 +154,7 @@ FILE_SKIP_EMPTY_LINES);
private function getTranslationFilesArray($lang){
$dir = new DirectoryIterator($this->langDir.$lang);
while($dir->valid()) {
- if(!$dir->isDot() && $dir->isFile() && ! eregi('^\.',$dir->getFilename())) {
+ if(!$dir->isDot() && $dir->isFile() && ! preg_match('/^\./',$dir->getFilename())) {
$files[] = $dir->getFilename();
}
$dir->next();
diff --git a/htdocs/adherents/card_subscriptions.php b/htdocs/adherents/card_subscriptions.php
index 1609bd550ad..ace88e753c4 100644
--- a/htdocs/adherents/card_subscriptions.php
+++ b/htdocs/adherents/card_subscriptions.php
@@ -221,7 +221,7 @@ print "\n";
if ($errmsg)
{
- if (eregi('^Error',$errmsg))
+ if (preg_match('/^Error/i',$errmsg))
{
$langs->load("errors");
$errmsg=$langs->trans($errmsg);
diff --git a/htdocs/admin/barcode.php b/htdocs/admin/barcode.php
index 4b23fdce4a3..871add6cfb5 100644
--- a/htdocs/admin/barcode.php
+++ b/htdocs/admin/barcode.php
@@ -97,7 +97,7 @@ foreach ($conf->file->dol_document_root as $dirroot)
{
if (is_readable($dir.$file))
{
- if (eregi('(.*)\.modules\.php$',$file,$reg))
+ if (preg_match('/(.*)\.modules\.php$/i',$file,$reg))
{
$filebis=$reg[1];
diff --git a/htdocs/admin/boxes.php b/htdocs/admin/boxes.php
index dbb79c53b0f..850548e80c7 100644
--- a/htdocs/admin/boxes.php
+++ b/htdocs/admin/boxes.php
@@ -194,13 +194,13 @@ if ($resql)
{
if (strlen($record['box_order']) == 1)
{
- if (eregi("[13579]{1}",substr($record['box_order'],-1)))
+ if (preg_match("/[13579]{1}/",substr($record['box_order'],-1)))
{
$box_order = "A0".$record['box_order'];
$sql="update llx_boxes set box_order = '".$box_order."' where box_order = ".$record['box_order'];
$resql = $db->query($sql);
}
- else if (eregi("[02468]{1}",substr($record['box_order'],-1)))
+ else if (preg_match("/[02468]{1}/",substr($record['box_order'],-1)))
{
$box_order = "B0".$record['box_order'];
$sql="update llx_boxes set box_order = '".$box_order."' where box_order = ".$record['box_order'];
@@ -209,13 +209,13 @@ if ($resql)
}
else if (strlen($record['box_order']) == 2)
{
- if (eregi("[13579]{1}",substr($record['box_order'],-1)))
+ if (preg_match("/[13579]{1}/",substr($record['box_order'],-1)))
{
$box_order = "A".$record['box_order'];
$sql="update llx_boxes set box_order = '".$box_order."' where box_order = ".$record['box_order'];
$resql = $db->query($sql);
}
- else if (eregi("[02468]{1}",substr($record['box_order'],-1)))
+ else if (preg_match("/[02468]{1}/",substr($record['box_order'],-1)))
{
$box_order = "B".$record['box_order'];
$sql="update llx_boxes set box_order = '".$box_order."' where box_order = ".$record['box_order'];
diff --git a/htdocs/admin/commande.php b/htdocs/admin/commande.php
index 777f188e2e3..f09a7ad66f7 100644
--- a/htdocs/admin/commande.php
+++ b/htdocs/admin/commande.php
@@ -329,7 +329,7 @@ $handle=opendir($dir);
$var=true;
while (($file = readdir($handle))!==false)
{
- if (eregi('\.modules\.php$',$file) && substr($file,0,4) == 'pdf_')
+ if (preg_match('/\.modules\.php$/i',$file) && substr($file,0,4) == 'pdf_')
{
$name = substr($file, 4, strlen($file) -16);
$classname = substr($file, 0, strlen($file) -12);
diff --git a/htdocs/admin/company.php b/htdocs/admin/company.php
index 3dc3b096a0a..97d46a191f1 100644
--- a/htdocs/admin/company.php
+++ b/htdocs/admin/company.php
@@ -55,7 +55,7 @@ if ( (isset($_POST["action"]) && $_POST["action"] == 'update')
dolibarr_set_const($db, "MAIN_INFO_SOCIETE_GENCOD",$_POST["gencod"],'chaine',0,'',$conf->entity);
if ($_FILES["logo"]["tmp_name"])
{
- if (eregi('([^\\\/:]+)$',$_FILES["logo"]["name"],$reg))
+ if (preg_match('/([^\\/:]+)$/i',$_FILES["logo"]["name"],$reg))
{
$original_file=$reg[1];
@@ -77,7 +77,7 @@ if ( (isset($_POST["action"]) && $_POST["action"] == 'update')
$quality = 80;
$imgThumbSmall = vignette($conf->mycompany->dir_output.'/logos/'.$original_file, 200, 100, '_small', $quality);
- if (eregi('([^\\\/:]+)$',$imgThumbSmall,$reg))
+ if (preg_match('/([^\\/:]+)$/i',$imgThumbSmall,$reg))
{
$imgThumbSmall = $reg[1];
dolibarr_set_const($db, "MAIN_INFO_SOCIETE_LOGO_SMALL",$imgThumbSmall,'chaine',0,'',$conf->entity);
@@ -86,7 +86,7 @@ if ( (isset($_POST["action"]) && $_POST["action"] == 'update')
// Creation de la vignette de la page "Societe/Institution"
$imgThumbMini = vignette($conf->mycompany->dir_output.'/logos/'.$original_file, 100, 30, '_mini', $quality);
- if (eregi('([^\\\/:]+)$',$imgThumbMini,$reg))
+ if (preg_match('/([^\\/:]+)$/i',$imgThumbMini,$reg))
{
$imgThumbMini = $reg[1];
dolibarr_set_const($db, "MAIN_INFO_SOCIETE_LOGO_MINI",$imgThumbMini,'chaine',0,'',$conf->entity);
@@ -137,7 +137,7 @@ if ($_GET["action"] == 'addthumb')
{
// Creation de la vignette de la page login
$imgThumbSmall = vignette($conf->mycompany->dir_output.'/logos/'.$_GET["file"], 200, 100, '_small',80);
- if (image_format_supported($imgThumbSmall) >= 0 && eregi('([^\\\/:]+)$',$imgThumbSmall,$reg))
+ if (image_format_supported($imgThumbSmall) >= 0 && preg_match('/([^\\/:]+)$/i',$imgThumbSmall,$reg))
{
$imgThumbSmall = $reg[1];
dolibarr_set_const($db, "MAIN_INFO_SOCIETE_LOGO_SMALL",$imgThumbSmall,'chaine',0,'',$conf->entity);
@@ -146,7 +146,7 @@ if ($_GET["action"] == 'addthumb')
// Creation de la vignette de la page "Societe/Institution"
$imgThumbMini = vignette($conf->mycompany->dir_output.'/logos/'.$_GET["file"], 100, 30, '_mini',80);
- if (image_format_supported($imgThumbSmall) >= 0 && eregi('([^\\\/:]+)$',$imgThumbMini,$reg))
+ if (image_format_supported($imgThumbSmall) >= 0 && preg_match('/([^\\/:]+)$/i',$imgThumbMini,$reg))
{
$imgThumbMini = $reg[1];
dolibarr_set_const($db, "MAIN_INFO_SOCIETE_LOGO_MINI",$imgThumbMini,'chaine',0,'',$conf->entity);
@@ -551,7 +551,7 @@ else
print '
';
// On propose la generation de la vignette si elle n'existe pas
- if (!is_file($conf->mycompany->dir_output.'/logos/thumbs/'.$mysoc->logo_mini) && eregi('(\.jpg|\.jpeg|\.png)$',$mysoc->logo))
+ if (!is_file($conf->mycompany->dir_output.'/logos/thumbs/'.$mysoc->logo_mini) && preg_match('/(\.jpg|\.jpeg|\.png)$/i',$mysoc->logo))
{
print 'logo).'">'.img_refresh($langs->trans('GenerateThumb')).' ';
}
diff --git a/htdocs/admin/dict.php b/htdocs/admin/dict.php
index 7fc9d4bb74a..9338f36ea57 100644
--- a/htdocs/admin/dict.php
+++ b/htdocs/admin/dict.php
@@ -670,7 +670,7 @@ if ($_GET["id"])
print ' | ';
// Est-ce une entree du dictionnaire qui peut etre desactivee ?
$iserasable=1; // Oui par defaut
- if (isset($obj->code) && ($obj->code == '0' || $obj->code == '' || eregi('unknown',$obj->code))) $iserasable=0;
+ if (isset($obj->code) && ($obj->code == '0' || $obj->code == '' || preg_match('/unknown/i',$obj->code))) $iserasable=0;
if ($obj->type && $obj->type == 'system') $iserasable=0;
if ($iserasable) {
diff --git a/htdocs/admin/dons.php b/htdocs/admin/dons.php
index 185d98e679d..ea8d19efc9a 100644
--- a/htdocs/admin/dons.php
+++ b/htdocs/admin/dons.php
@@ -179,7 +179,7 @@ $handle=opendir($dir);
$var=True;
while (($file = readdir($handle))!==false)
{
- if (eregi('\.modules\.php$',$file))
+ if (preg_match('/\.modules\.php$/i',$file))
{
$var = !$var;
$name = substr($file, 0, strlen($file) -12);
diff --git a/htdocs/admin/external_rss.php b/htdocs/admin/external_rss.php
index 4130eaf074f..f978d34f418 100644
--- a/htdocs/admin/external_rss.php
+++ b/htdocs/admin/external_rss.php
@@ -46,7 +46,7 @@ $result=$db->query($sql);
if ($result)
{
$obj = $db->fetch_object($result);
- eregi('([0-9]+)$',$obj->name,$reg);
+ preg_match('/([0-9]+)$/i',$obj->name,$reg);
if ($reg[1]) $lastexternalrss = $reg[1];
}
else
@@ -238,7 +238,7 @@ if ($resql)
{
$obj = $db->fetch_object($resql);
- eregi('^([0-9]+)',$obj->note,$reg);
+ preg_match('/^([0-9]+)/i',$obj->note,$reg);
$idrss = $reg[1];
//print "x".$idrss;
diff --git a/htdocs/admin/facture.php b/htdocs/admin/facture.php
index dd49954c277..5a56b90c369 100644
--- a/htdocs/admin/facture.php
+++ b/htdocs/admin/facture.php
@@ -387,7 +387,7 @@ $handle=opendir($dir);
$var=True;
while (($file = readdir($handle))!==false)
{
- if (eregi('\.modules\.php$',$file) && substr($file,0,4) == 'pdf_')
+ if (preg_match('/\.modules\.php$/i',$file) && substr($file,0,4) == 'pdf_')
{
$var = !$var;
$name = substr($file, 4, strlen($file) -16);
diff --git a/htdocs/admin/fichinter.php b/htdocs/admin/fichinter.php
index 9332fc29ba9..0ba3004facd 100644
--- a/htdocs/admin/fichinter.php
+++ b/htdocs/admin/fichinter.php
@@ -198,7 +198,7 @@ if ($handle)
while (($file = readdir($handle))!==false)
{
- if (eregi('^(mod_.*)\.php$',$file,$reg))
+ if (preg_match('/^(mod_.*)\.php$/i',$file,$reg))
{
$file = $reg[1];
$className = substr($file,4);
diff --git a/htdocs/admin/fournisseur.php b/htdocs/admin/fournisseur.php
index 31e6738c176..224b8c9a199 100644
--- a/htdocs/admin/fournisseur.php
+++ b/htdocs/admin/fournisseur.php
@@ -308,7 +308,7 @@ $handle=opendir($dir);
$var=true;
while (($file = readdir($handle))!==false)
{
- if (eregi('\.modules\.php$',$file) && substr($file,0,4) == 'pdf_')
+ if (preg_match('/\.modules\.php$/i',$file) && substr($file,0,4) == 'pdf_')
{
$name = substr($file, 4, strlen($file) -16);
$classname = substr($file, 0, strlen($file) -12);
diff --git a/htdocs/admin/ftpclient.php b/htdocs/admin/ftpclient.php
index 3fd4c0bf27e..6680759dab6 100644
--- a/htdocs/admin/ftpclient.php
+++ b/htdocs/admin/ftpclient.php
@@ -41,7 +41,7 @@ $result=$db->query($sql);
if ($result)
{
$obj = $db->fetch_object($result);
- eregi('([0-9]+)$',$obj->name,$reg);
+ preg_match('/([0-9]+)$/i',$obj->name,$reg);
if ($reg[1]) $lastftpentry = $reg[1];
}
else
@@ -217,7 +217,7 @@ else
{
$obj = $db->fetch_object($resql);
- eregi('([0-9]+)$',$obj->name,$reg);
+ preg_match('/([0-9]+)$/i',$obj->name,$reg);
$idrss = $reg[0];
//print "x".join(',',$reg)."=".$obj->name."=".$idrss;
diff --git a/htdocs/admin/mails.php b/htdocs/admin/mails.php
index caea7e64f4c..2720549d79b 100644
--- a/htdocs/admin/mails.php
+++ b/htdocs/admin/mails.php
@@ -175,8 +175,8 @@ if (($_POST['action'] == 'send' || $_POST['action'] == 'sendhtml')
*/
$linuxlike=1;
-if (eregi('^win',PHP_OS)) $linuxlike=0;
-if (eregi('^mac',PHP_OS)) $linuxlike=0;
+if (preg_match('/^win/i',PHP_OS)) $linuxlike=0;
+if (preg_match('/^mac/i',PHP_OS)) $linuxlike=0;
if (empty($conf->global->MAIN_MAIL_SENDMODE)) $conf->global->MAIN_MAIL_SENDMODE='mail';
diff --git a/htdocs/admin/modules.php b/htdocs/admin/modules.php
index bf3ccfb4a39..abd6a3af5d1 100644
--- a/htdocs/admin/modules.php
+++ b/htdocs/admin/modules.php
@@ -409,7 +409,7 @@ foreach ($orders as $key => $value)
print ' | ';
if (! empty($objMod->picto))
{
- if (eregi('^/',$objMod->picto)) print img_picto('',$objMod->picto,'',1);
+ if (preg_match('/^\//i',$objMod->picto)) print img_picto('',$objMod->picto,'',1);
else print img_object('',$objMod->picto);
}
else
diff --git a/htdocs/admin/security.php b/htdocs/admin/security.php
index 9ebd0d98ad2..245d458eac2 100644
--- a/htdocs/admin/security.php
+++ b/htdocs/admin/security.php
@@ -190,9 +190,9 @@ $handle=opendir($dir);
$i=1;
while (($file = readdir($handle))!==false)
{
- if (eregi('(modGeneratePass[a-z]+).class.php',$file,$reg))
+ if (preg_match('/(modGeneratePass[a-z]+)\.class\.php/i',$file,$reg))
{
- // Chargement de la classe de num�rotation
+ // Chargement de la classe de numerotation
$classname = $reg[1];
require_once($dir.'/'.$file);
@@ -299,7 +299,7 @@ $var=!$var;
print " | ";
print '| '.$langs->trans("MainDbPasswordFileConfEncrypted").' | ';
print '';
-if (eregi('crypted:',$dolibarr_main_db_pass) || ! empty($dolibarr_main_db_encrypted_pass))
+if (preg_match('/crypted:/i',$dolibarr_main_db_pass) || ! empty($dolibarr_main_db_encrypted_pass))
{
print img_tick();
}
diff --git a/htdocs/admin/system/database-tables-contraintes.php b/htdocs/admin/system/database-tables-contraintes.php
index f059bc52058..4d4b1d55a0e 100644
--- a/htdocs/admin/system/database-tables-contraintes.php
+++ b/htdocs/admin/system/database-tables-contraintes.php
@@ -46,7 +46,7 @@ print_fiche_titre($langs->trans("Constraints"),'','setup');
// Define request to get table description
$base=0;
-if (eregi('mysql',$conf->db->type))
+if (preg_match('/mysql/i',$conf->db->type))
{
$sql = "SHOW TABLE STATUS";
$base=1;
diff --git a/htdocs/admin/system/database-tables.php b/htdocs/admin/system/database-tables.php
index 40c90907219..dfa5f8df46f 100644
--- a/htdocs/admin/system/database-tables.php
+++ b/htdocs/admin/system/database-tables.php
@@ -51,7 +51,7 @@ print_fiche_titre($langs->trans("Tables")." ".ucfirst($conf->db->type),'','setup
// Define request to get table description
$base=0;
-if (eregi('mysql',$conf->db->type))
+if (preg_match('/mysql/i',$conf->db->type))
{
$sql = "SHOW TABLE STATUS";
$base=1;
diff --git a/htdocs/admin/system/database.php b/htdocs/admin/system/database.php
index dd05b6736c2..dbd68c399bb 100644
--- a/htdocs/admin/system/database.php
+++ b/htdocs/admin/system/database.php
@@ -96,7 +96,7 @@ else
// arraytest is an array of test to do
$arraytest=array();
- if (eregi('mysql',$db->type))
+ if (preg_match('/mysql/i',$db->type))
{
$arraytest=array(
// "character_set_connection"=>'UTF-8',
diff --git a/htdocs/admin/system/dbtable.php b/htdocs/admin/system/dbtable.php
index 45a0c984f97..ef0b89091f5 100644
--- a/htdocs/admin/system/dbtable.php
+++ b/htdocs/admin/system/dbtable.php
@@ -46,7 +46,7 @@ print_fiche_titre($langs->trans("Table") . " ".$_GET["table"],'','setup');
// Define request to get table description
$base=0;
-if (eregi('mysql',$conf->db->type))
+if (preg_match('/mysql/i',$conf->db->type))
{
$sql = "SHOW TABLE STATUS LIKE '".$_GET["table"]."'";
$base=1;
diff --git a/htdocs/admin/system/modules.php b/htdocs/admin/system/modules.php
index d90dd5b80d9..56e50b83905 100644
--- a/htdocs/admin/system/modules.php
+++ b/htdocs/admin/system/modules.php
@@ -92,7 +92,7 @@ foreach($sortorder as $numero=>$name)
$alt=$name.' - '.$modules_files[$numero];
if (! empty($picto[$numero]))
{
- if (eregi('^/',$picto[$numero])) print img_picto($alt,$picto[$numero],'',1);
+ if (preg_match('/^\//',$picto[$numero])) print img_picto($alt,$picto[$numero],'',1);
else print img_object($alt,$picto[$numero]);
}
else
diff --git a/htdocs/admin/system/os.php b/htdocs/admin/system/os.php
index 16fd81eb694..01e2d814670 100644
--- a/htdocs/admin/system/os.php
+++ b/htdocs/admin/system/os.php
@@ -42,15 +42,15 @@ print '';
print '| '.$langs->trans("Parameter").' | '.$langs->trans("Value").' | ';
print "\n";
-// R�cup�re l'OS au sens PHP
+// Recupere l'OS au sens PHP
print "| ".$langs->trans("PHP_OS")." | ".PHP_OS." | \n";
-// R�cup�re la version de l'OS
+// Recupere la version de l'OS
ob_start();
phpinfo();
$chaine = ob_get_contents();
ob_end_clean();
-eregi('System ([^\/]*) | ',$chaine,$reg);
+preg_match('/System <\/td>([^\\/]*)<\/td>/i',$chaine,$reg);
print " | | ".$langs->trans("Version")." | ".$reg[1]." | \n";
print ' ';
diff --git a/htdocs/admin/tools/dolibarr_import.php b/htdocs/admin/tools/dolibarr_import.php
index 6ff920e3b2c..3e588248af6 100644
--- a/htdocs/admin/tools/dolibarr_import.php
+++ b/htdocs/admin/tools/dolibarr_import.php
@@ -100,7 +100,7 @@ print ' ';
';
$text=$langs->trans($obj->description);
- if (eregi('\((.*)\)',$obj->description,$reg))
+ if (preg_match('/\((.*)\)/i',$obj->description,$reg))
{
$val=explode(',',$reg[1]);
$text=$langs->trans($val[0], isset($val[1])?$val[1]:'', isset($val[2])?$val[2]:'', isset($val[3])?$val[3]:'', isset($val[4])?$val[4]:'');
diff --git a/htdocs/admin/tools/purge.php b/htdocs/admin/tools/purge.php
index d1b92d14439..f73c2d00d11 100644
--- a/htdocs/admin/tools/purge.php
+++ b/htdocs/admin/tools/purge.php
@@ -45,7 +45,7 @@ if ($conf->syslog->enabled)
/*
* Actions
*/
-if ($_REQUEST["action"]=='purge' && ! eregi('^confirm',$_REQUEST["choice"]) && ($_REQUEST["choice"] != 'allfiles' || $_REQUEST["confirm"] == 'yes') )
+if ($_REQUEST["action"]=='purge' && ! preg_match('/^confirm/i',$_REQUEST["choice"]) && ($_REQUEST["choice"] != 'allfiles' || $_REQUEST["confirm"] == 'yes') )
{
$filesarray=array();
@@ -163,7 +163,7 @@ if ($message)
print "\n";
}
-if (eregi('^confirm',$_REQUEST["choice"]))
+if (preg_match('/^confirm/i',$_REQUEST["choice"]))
{
print ' ';
$formquestion=array();
diff --git a/htdocs/admin/triggers.php b/htdocs/admin/triggers.php
index 040b717766a..a422ff4b36b 100644
--- a/htdocs/admin/triggers.php
+++ b/htdocs/admin/triggers.php
@@ -185,8 +185,8 @@ foreach ($orders as $key => $value)
$disabledbyname=0;
$disabledbymodule=1;
$module='';
- if (eregi('NORUN$',$files[$key])) $disabledbyname=1;
- if (eregi('^interface_([^_]+)_(.+)\.class\.php',$files[$key],$reg))
+ if (preg_match('/NORUN$/i',$files[$key])) $disabledbyname=1;
+ if (preg_match('/^interface_([^_]+)_(.+)\.class\.php/i',$files[$key],$reg))
{
// Check if trigger file is for a particular module
$module=preg_replace('/^mod/i','',$reg[1]);
|