| Insertion ligne : $buffer | ";
- if (strlen(trim(ereg_replace("--","",$buffer))))
+ if (strlen(trim(str_replace("--","",$buffer))))
{
if ($db->query($buffer))
{
diff --git a/htdocs/install/fileconf.php b/htdocs/install/fileconf.php
index c1e8c29f237..c5478a1de6e 100644
--- a/htdocs/install/fileconf.php
+++ b/htdocs/install/fileconf.php
@@ -98,7 +98,7 @@ if(! isset($dolibarr_main_url_root) || strlen($dolibarr_main_url_root) == 0)
$dolibarr_main_document_root = str_replace('\\\\','/',$dolibarr_main_document_root);
// Supprime les slash ou antislash de fins
- $dolibarr_main_document_root = ereg_replace('[\\\/]+$','',$dolibarr_main_document_root);
+ $dolibarr_main_document_root = preg_replace('/[\\/]+$/','',$dolibarr_main_document_root);
}
}
//echo $PMA_MYSQL_INT_VERSION;
@@ -124,7 +124,7 @@ if (empty($dolibarr_main_data_root))
// Si le repertoire documents non defini, on en propose un par defaut
if (empty($force_install_main_data_root))
{
- $dolibarr_main_data_root=ereg_replace("/htdocs$","",$dolibarr_main_document_root);
+ $dolibarr_main_data_root=preg_replace("/\/htdocs$/","",$dolibarr_main_document_root);
$dolibarr_main_data_root.="/documents";
}
else
@@ -170,10 +170,10 @@ if (empty($dolibarr_main_url_root))
$dolibarr_main_url_root=$proto."://".$serverport.$_SERVER["SCRIPT_NAME"];
}
# Clean proposed URL
- $dolibarr_main_url_root = ereg_replace('\/fileconf\.php$','',$dolibarr_main_url_root); # Supprime le /fileconf.php
- $dolibarr_main_url_root = ereg_replace('\/$','',$dolibarr_main_url_root); # Supprime le /
- $dolibarr_main_url_root = ereg_replace('\/index\.php$','',$dolibarr_main_url_root); # Supprime le /index.php
- $dolibarr_main_url_root = ereg_replace('\/install$','',$dolibarr_main_url_root); # Supprime le /install
+ $dolibarr_main_url_root = preg_replace('/\/fileconf\.php$/','',$dolibarr_main_url_root); # Supprime le /fileconf.php
+ $dolibarr_main_url_root = preg_replace('/\/$/','',$dolibarr_main_url_root); # Supprime le /
+ $dolibarr_main_url_root = preg_replace('/\/index\.php$/','',$dolibarr_main_url_root); # Supprime le /index.php
+ $dolibarr_main_url_root = preg_replace('/\/install$/','',$dolibarr_main_url_root); # Supprime le /install
}
print $dolibarr_main_url_root;
diff --git a/htdocs/install/inc.php b/htdocs/install/inc.php
index d39b58452d6..0b61bc61d5f 100644
--- a/htdocs/install/inc.php
+++ b/htdocs/install/inc.php
@@ -76,9 +76,9 @@ if (! defined('DONOTLOADCONF') && file_exists($conffile))
if (empty($dolibarr_main_db_type)) $dolibarr_main_db_type='mysql'; // For backward compatibility
// Remove last / or \ on directories or url value
- if (! empty($dolibarr_main_document_root) && ! ereg('^[\\\/]+$',$dolibarr_main_document_root)) $dolibarr_main_document_root=ereg_replace('[\\\/]+$','',$dolibarr_main_document_root);
- if (! empty($dolibarr_main_url_root) && ! ereg('^[\\\/]+$',$dolibarr_main_url_root)) $dolibarr_main_url_root=ereg_replace('[\\\/]+$','',$dolibarr_main_url_root);
- if (! empty($dolibarr_main_data_root) && ! ereg('^[\\\/]+$',$dolibarr_main_data_root)) $dolibarr_main_data_root=ereg_replace('[\\\/]+$','',$dolibarr_main_data_root);
+ if (! empty($dolibarr_main_document_root) && ! preg_match('/^[\\/]+$/',$dolibarr_main_document_root)) $dolibarr_main_document_root=preg_replace('/[\\/]+$/','',$dolibarr_main_document_root);
+ if (! empty($dolibarr_main_url_root) && ! preg_match('/^[\\/]+$/',$dolibarr_main_url_root)) $dolibarr_main_url_root=preg_replace('/[\\/]+$/','',$dolibarr_main_url_root);
+ if (! empty($dolibarr_main_data_root) && ! preg_match('/^[\\/]+$/',$dolibarr_main_data_root)) $dolibarr_main_data_root=preg_replace('/[\\/]+$/','',$dolibarr_main_data_root);
// Create conf object
if (! empty($dolibarr_main_document_root))
@@ -128,7 +128,7 @@ if (empty($conf->db->user)) $conf->db->user='';
// Security check
-if (eregi('install.lock',$_SERVER["SCRIPT_FILENAME"]))
+if (preg_match('/install.lock/i',$_SERVER["SCRIPT_FILENAME"]))
{
print 'Install pages have been disabled for security reason (directory renamed with .lock).';
print '';
diff --git a/htdocs/master.inc.php b/htdocs/master.inc.php
index a3c35f9b76a..dcf941d7e65 100644
--- a/htdocs/master.inc.php
+++ b/htdocs/master.inc.php
@@ -77,7 +77,7 @@ if (empty($dolibarr_main_db_type)) $dolibarr_main_db_type='mysql'; // Pour com
if (empty($dolibarr_main_data_root))
{
// Si repertoire documents non defini, on utilise celui par defaut
- $dolibarr_main_data_root=ereg_replace("/htdocs","",$dolibarr_main_document_root);
+ $dolibarr_main_data_root=str_replace("/htdocs","",$dolibarr_main_document_root);
$dolibarr_main_data_root.="/documents";
}
// Define some constants
diff --git a/htdocs/product/templates/product.livrecontrat.class.php b/htdocs/product/templates/product.livrecontrat.class.php
index 79939683d85..1853435b011 100644
--- a/htdocs/product/templates/product.livrecontrat.class.php
+++ b/htdocs/product/templates/product.livrecontrat.class.php
@@ -152,7 +152,7 @@ class ProductLivreContrat extends Product
{
dol_syslog("ProductLivreContrat::UpdateCanvas");
- $taux = ereg_replace(',','.',trim($datas["contrat_taux"]));
+ $taux = str_replace(',','.',trim($datas["contrat_taux"]));
$quant = trim($datas["contrat_quant"]);
$duree = trim($datas["contrat_duree"]);
diff --git a/htdocs/projet/activity/list.php b/htdocs/projet/activity/list.php
index 0cdd2e51b5a..95cf731d0f2 100644
--- a/htdocs/projet/activity/list.php
+++ b/htdocs/projet/activity/list.php
@@ -69,7 +69,7 @@ if ($_POST["action"] == 'addtime' && $user->rights->projet->creer)
$post=intval($post)+(($post-intval($post))*(1+2/3));
$post=price2num($post);
- $id = ereg_replace("task","",$key);
+ $id = str_replace("task","",$key);
$task=new Task($db);
$task->fetch($id);
diff --git a/htdocs/projet/tasks/fiche.php b/htdocs/projet/tasks/fiche.php
index 24ef4124d08..2ccd0641241 100644
--- a/htdocs/projet/tasks/fiche.php
+++ b/htdocs/projet/tasks/fiche.php
@@ -101,7 +101,7 @@ if ($_POST["action"] == 'addtime' && $user->rights->projet->creer)
$post=intval($post)+(($post-intval($post))*(1+2/3));
$post=price2num($post);
- $id = ereg_replace("task","",$key);
+ $id = str_replace("task","",$key);
$date = dol_mktime(12,0,0,$_POST["$id"."month"],$_POST["$id"."day"],$_POST["$id"."year"]);
$project->TaskAddTime($user, $id , $post, $date);
diff --git a/htdocs/societe.class.php b/htdocs/societe.class.php
index 8e9ec5b7cfc..67ae5e8672e 100644
--- a/htdocs/societe.class.php
+++ b/htdocs/societe.class.php
@@ -334,10 +334,10 @@ class Societe extends CommonObject
$this->pays_id=trim($this->pays_id);
$this->tel=trim($this->tel);
$this->fax=trim($this->fax);
- $this->tel = ereg_replace(" ","",$this->tel);
- $this->tel = ereg_replace("\.","",$this->tel);
- $this->fax = ereg_replace(" ","",$this->fax);
- $this->fax = ereg_replace("\.","",$this->fax);
+ $this->tel = preg_replace("/\s/","",$this->tel);
+ $this->tel = preg_replace("/\./","",$this->tel);
+ $this->fax = preg_replace("/\s/","",$this->fax);
+ $this->fax = preg_replace("/\./","",$this->fax);
$this->email=trim($this->email);
$this->url=$this->url?clean_url($this->url,0):'';
$this->siren=trim($this->siren);
diff --git a/htdocs/support/inc.php b/htdocs/support/inc.php
index d2f48c0c87b..5f9f1c99089 100644
--- a/htdocs/support/inc.php
+++ b/htdocs/support/inc.php
@@ -74,9 +74,9 @@ if (! defined('DONOTLOADCONF') && file_exists($conffile))
if (empty($dolibarr_main_db_type)) $dolibarr_main_db_type='mysql'; // For backward compatibility
// Remove last / or \ on directories or url value
- if (! empty($dolibarr_main_document_root) && ! ereg('^[\\\/]+$',$dolibarr_main_document_root)) $dolibarr_main_document_root=ereg_replace('[\\\/]+$','',$dolibarr_main_document_root);
- if (! empty($dolibarr_main_url_root) && ! ereg('^[\\\/]+$',$dolibarr_main_url_root)) $dolibarr_main_url_root=ereg_replace('[\\\/]+$','',$dolibarr_main_url_root);
- if (! empty($dolibarr_main_data_root) && ! ereg('^[\\\/]+$',$dolibarr_main_data_root)) $dolibarr_main_data_root=ereg_replace('[\\\/]+$','',$dolibarr_main_data_root);
+ if (! empty($dolibarr_main_document_root) && ! preg_match('/^[\\/]+$/',$dolibarr_main_document_root)) $dolibarr_main_document_root=preg_replace('/[\\/]+$/','',$dolibarr_main_document_root);
+ if (! empty($dolibarr_main_url_root) && ! preg_match('/^[\\/]+$/',$dolibarr_main_url_root)) $dolibarr_main_url_root=preg_replace('/[\\/]+$/','',$dolibarr_main_url_root);
+ if (! empty($dolibarr_main_data_root) && ! preg_match('/^[\\/]+$/',$dolibarr_main_data_root)) $dolibarr_main_data_root=preg_replace('/[\\/]+$/','',$dolibarr_main_data_root);
// Create conf object
if (! empty($dolibarr_main_document_root))
diff --git a/htdocs/translate.class.php b/htdocs/translate.class.php
index 6a310a3b7b9..5b4cfdbdd65 100644
--- a/htdocs/translate.class.php
+++ b/htdocs/translate.class.php
@@ -248,14 +248,14 @@ class Translate {
//print "Domain=$domain, found a string for $tab[0] with value $tab[1] ";
if (empty($this->tab_translate[$key]) && isset($tab[1]))
{
- $value=trim(ereg_replace('\\\n',"\n",$tab[1]));
+ $value=trim(preg_replace('/\\n/',"\n",$tab[1]));
- if (eregi('^CHARSET$',$key)) // This is to declare in which charset files are encoded
+ if (preg_match('/^CHARSET$/',$key)) // This is to declare in which charset files are encoded
{
$this->charset_inputfile[$newdomain]=strtoupper($value);
//print 'File '.$file_lang.' is declared to have format '.$this->charset_inputfile[$newdomain].' ';
}
- elseif (eregi('^DIRECTION$',$key)) // This is to declare direction of language
+ elseif (preg_match('/^DIRECTION$/',$key)) // This is to declare direction of language
{
if ($alt < 2) // We do not load direction for alternate files 2
{
|