diff --git a/htdocs/boxes.php b/htdocs/boxes.php index 6c2f99c735c..bcada970a8f 100644 --- a/htdocs/boxes.php +++ b/htdocs/boxes.php @@ -81,7 +81,7 @@ class InfoBox while ($j < $num) { $obj = $this->db->fetch_object($result); - $boxname=eregi_replace('\.php$','',$obj->file); + $boxname=preg_replace('/\.php$/i','',$obj->file); include_once(DOL_DOCUMENT_ROOT."/includes/boxes/".$boxname.".php"); $box=new $boxname($this->db,$obj->note); $box->rowid=$obj->rowid; @@ -129,7 +129,7 @@ class InfoBox while ($j < $num) { $obj = $this->db->fetch_object($result); - $boxname=eregi_replace('\.php$','',$obj->file); + $boxname=preg_replace('/\.php$/i','',$obj->file); include_once(DOL_DOCUMENT_ROOT."/includes/boxes/".$boxname.".php"); $box=new $boxname($this->db,$obj->note); $box->rowid=$obj->rowid; diff --git a/htdocs/html.form.class.php b/htdocs/html.form.class.php index 9a4b0301464..1d632101f0b 100644 --- a/htdocs/html.form.class.php +++ b/htdocs/html.form.class.php @@ -119,7 +119,7 @@ class Form { if ($conf->use_javascript_ajax) { - $htmltext=eregi_replace('"',""",$htmltext); + $htmltext=str_replace('"',""",$htmltext); if ($tooltipon==1 || $tooltipon==3) { $paramfortooltiptext.=' onmouseover="showtip(\''.$htmltext.'\')"'; @@ -2130,8 +2130,8 @@ class Form // Define defaultnpr and defaultttx $defaultnpr=($info_bits & 0x01); - $defaultnpr=(eregi('\*',$selectedrate) ? 1 : $defaultnpr); - $defaulttx=eregi_replace('\*','',$selectedrate); + $defaultnpr=(preg_match('/\*/',$selectedrate) ? 1 : $defaultnpr); + $defaulttx=str_replace('*','',$selectedrate); //print $societe_vendeuse."-".$societe_acheteuse; if (is_object($societe_vendeuse) && ! $societe_vendeuse->pays_code) diff --git a/htdocs/html.formadmin.class.php b/htdocs/html.formadmin.class.php index 982285f3508..ea4446ae352 100644 --- a/htdocs/html.formadmin.class.php +++ b/htdocs/html.formadmin.class.php @@ -36,7 +36,7 @@ class FormAdmin /** \brief Constructeur - \param DB handler d'acc�s base de donn�e + \param DB handler d'acces base de donnee */ function FormAdmin($DB) { @@ -47,8 +47,8 @@ class FormAdmin /** - * \brief Retourne la liste d�roulante des langues disponibles - * \param selected Langue pr�-s�lectionn�e + * \brief Retourne la liste deroulante des langues disponibles + * \param selected Langue pre-selectionnee * \param htmlname Nom de la zone select * \param showauto Affiche choix auto */ @@ -97,7 +97,7 @@ class FormAdmin { global $langs,$conf; - if ($selected == 'eldy.php') $selected='eldy_backoffice.php'; // Pour compatibilit� + if ($selected == 'eldy.php') $selected='eldy_backoffice.php'; // Pour compatibilite $menuarray=array(); $handle=opendir($dirmenu); @@ -105,13 +105,13 @@ class FormAdmin { if (is_file($dirmenu."/".$file) && substr($file, 0, 1) <> '.' && substr($file, 0, 3) <> 'CVS') { - $filelib=eregi_replace('\.php$','',$file); + $filelib=preg_replace('/\.php$/i','',$file); $prefix=''; - if (eregi('^eldy',$file)) $prefix='0'; // Recommanded - else if (eregi('^auguria',$file)) $prefix='2'; // Other - else if (eregi('^default',$file)) $prefix='2'; // Other - else if (eregi('^rodolphe',$file)) $prefix='2'; // Other - else if (eregi('^empty',$file)) $prefix='2'; // Other + if (preg_match('/^eldy/i',$file)) $prefix='0'; // Recommanded + else if (preg_match('/^auguria/i',$file)) $prefix='2'; // Other + else if (preg_match('/^default/i',$file)) $prefix='2'; // Other + else if (preg_match('/^rodolphe/i',$file)) $prefix='2'; // Other + else if (preg_match('/^empty/i',$file)) $prefix='2'; // Other else $prefix='1'; // Experimental if ($file == $selected) @@ -149,10 +149,10 @@ class FormAdmin } /** - * \brief Retourne la liste d�roulante des menus disponibles (eldy) - * \param selected Menu pr�-s�lectionn�e + * \brief Retourne la liste deroulante des menus disponibles (eldy) + * \param selected Menu pre-selectionnee * \param htmlname Nom de la zone select - * \param dirmenu Repertoire � scanner + * \param dirmenu Repertoire a scanner */ function select_menu_families($selected='',$htmlname,$dirmenu) { @@ -164,9 +164,9 @@ class FormAdmin { if (is_file($dirmenu."/".$file) && substr($file, 0, 1) <> '.' && substr($file, 0, 3) <> 'CVS') { - $filelib=eregi_replace('(_backoffice|_frontoffice)?\.php$','',$file); - if (eregi('^default',$filelib)) continue; - if (eregi('^empty',$filelib)) continue; + $filelib=preg_replace('/(_backoffice|_frontoffice)?\.php$/i','',$file); + if (preg_match('/^default/i',$filelib)) continue; + if (preg_match('/^empty/i',$filelib)) continue; $menuarray[$filelib]=1; } @@ -198,8 +198,8 @@ class FormAdmin /** - * \brief Retourne la liste d�roulante des menus disponibles (eldy) - * \param selected Menu pr�-s�lectionn�e + * \brief Retourne la liste deroulante des menus disponibles (eldy) + * \param selected Menu pre-selectionnee * \param htmlname Nom de la zone select */ function select_timezone($selected='',$htmlname) diff --git a/htdocs/index.php b/htdocs/index.php index d0b00f71baf..3ddeeb983ab 100644 --- a/htdocs/index.php +++ b/htdocs/index.php @@ -52,7 +52,7 @@ print_fiche_titre($langs->trans("HomeArea")); if (! empty($conf->global->MAIN_MOTD)) { - $conf->global->MAIN_MOTD=eregi_replace('$','',$conf->global->MAIN_MOTD); + $conf->global->MAIN_MOTD=preg_replace('/$/i','',$conf->global->MAIN_MOTD); if (! empty($conf->global->MAIN_MOTD)) { print "\n\n"; diff --git a/htdocs/install/check.php b/htdocs/install/check.php index eac72f9e48f..31a6774366f 100644 --- a/htdocs/install/check.php +++ b/htdocs/install/check.php @@ -349,8 +349,8 @@ else $count++; $versionfrom=$migarray['from']; $versionto=$migarray['to']; - $newversionfrom=eregi_replace('\.[0-9]+$','.*',$versionfrom); - $newversionto=eregi_replace('\.[0-9]+$','.*',$versionto); + $newversionfrom=preg_replace('/(\.[0-9]+)$/i','.*',$versionfrom); + $newversionto=preg_replace('/(\.[0-9]+)$/i','.*',$versionto); print ''.$langs->trans("Upgrade").'
'.$newversionfrom.' -> '.$newversionto.'
'; print ''; print $langs->trans("UpgradeDesc"); diff --git a/htdocs/install/etape2.php b/htdocs/install/etape2.php index 2b2c3c83233..4e26d8f5011 100644 --- a/htdocs/install/etape2.php +++ b/htdocs/install/etape2.php @@ -247,7 +247,7 @@ if ($_POST["action"] == "set") && versioncompare($versioncommande,$versionarray) <= 0) { // Version qualified, delete SQL comments - $buf=eregi_replace('^-- V([0-9\.]+)','',$buf); + $buf=preg_replace('/^-- V([0-9\.]+)/i','',$buf); //print "Ligne $i qualifiee par version: ".$buf.'
'; } } diff --git a/htdocs/install/etape5.php b/htdocs/install/etape5.php index d25d5cd728c..f606b8999b4 100644 --- a/htdocs/install/etape5.php +++ b/htdocs/install/etape5.php @@ -108,12 +108,12 @@ if ($_POST["action"] == "set" || eregi('upgrade',$_POST["action"])) $error=0; // If password is encoded, we decode it - 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)) { require_once($dolibarr_main_document_root."/lib/security.lib.php"); - if (eregi('crypted:',$dolibarr_main_db_pass)) + if (preg_match('/crypted:/i',$dolibarr_main_db_pass)) { - $dolibarr_main_db_pass = eregi_replace('crypted:', '', $dolibarr_main_db_pass); + $dolibarr_main_db_pass = preg_replace('/crypted:/i', '', $dolibarr_main_db_pass); $dolibarr_main_db_pass = dol_decode($dolibarr_main_db_pass); $dolibarr_main_db_encrypted_pass = $dolibarr_main_db_pass; // We need to set this as it is used to know the password was initially crypted } diff --git a/htdocs/install/repair.php b/htdocs/install/repair.php index cd4b2f1286d..5a3d3e38c58 100644 --- a/htdocs/install/repair.php +++ b/htdocs/install/repair.php @@ -77,12 +77,12 @@ print ''; $error=0; // If password is encoded, we decode it -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)) { require_once($dolibarr_main_document_root."/lib/security.lib.php"); - if (eregi('crypted:',$dolibarr_main_db_pass)) + if (preg_match('/crypted:/i',$dolibarr_main_db_pass)) { - $dolibarr_main_db_pass = eregi_replace('crypted:', '', $dolibarr_main_db_pass); + $dolibarr_main_db_pass = preg_replace('/crypted:/i', '', $dolibarr_main_db_pass); $dolibarr_main_db_pass = dol_decode($dolibarr_main_db_pass); $dolibarr_main_db_encrypted_pass = $dolibarr_main_db_pass; // We need to set this as it is used to know the password was initially crypted } diff --git a/htdocs/install/upgrade.php b/htdocs/install/upgrade.php index c13b3415ea4..ba26e7887bd 100644 --- a/htdocs/install/upgrade.php +++ b/htdocs/install/upgrade.php @@ -88,12 +88,12 @@ if (! isset($_GET["action"]) || eregi('upgrade',$_GET["action"])) $error=0; // If password is encoded, we decode it - 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)) { require_once($dolibarr_main_document_root."/lib/security.lib.php"); - if (eregi('crypted:',$dolibarr_main_db_pass)) + if (preg_match('/crypted:/i',$dolibarr_main_db_pass)) { - $dolibarr_main_db_pass = eregi_replace('crypted:', '', $dolibarr_main_db_pass); + $dolibarr_main_db_pass = preg_replace('/crypted:/i', '', $dolibarr_main_db_pass); $dolibarr_main_db_pass = dol_decode($dolibarr_main_db_pass); $dolibarr_main_db_encrypted_pass = $dolibarr_main_db_pass; // We need to set this as it is used to know the password was initially crypted } @@ -256,7 +256,7 @@ if (! isset($_GET["action"]) || eregi('upgrade',$_GET["action"])) $values=$db->fetch_array($resql); $i=0; $createsql=$values[1]; - while (eregi('CONSTRAINT `(0_[0-9a-zA-Z]+|[_0-9a-zA-Z]+_ibfk_[0-9]+)`',$createsql,$reg) && $i < 100) + while (preg_match('/CONSTRAINT `(0_[0-9a-zA-Z]+|[_0-9a-zA-Z]+_ibfk_[0-9]+)`/i',$createsql,$reg) && $i < 100) { $sqldrop="ALTER TABLE ".$val." DROP FOREIGN KEY ".$reg[1]; $resqldrop = $db->query($sqldrop); @@ -264,7 +264,7 @@ if (! isset($_GET["action"]) || eregi('upgrade',$_GET["action"])) { print '\n"; } - $createsql=eregi_replace('CONSTRAINT `'.$reg[1].'`','XXX',$createsql); + $createsql=preg_replace('/CONSTRAINT `'.$reg[1].'`/i','XXX',$createsql); $i++; } $db->free($resql); diff --git a/htdocs/install/upgrade2.php b/htdocs/install/upgrade2.php index f3b3b319ba9..4433883499f 100644 --- a/htdocs/install/upgrade2.php +++ b/htdocs/install/upgrade2.php @@ -84,12 +84,12 @@ if (isset($_POST['action']) && eregi('upgrade',$_POST["action"])) print '
'.$sqldrop.";
'; // If password is encoded, we decode it - 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)) { require_once($dolibarr_main_document_root."/lib/security.lib.php"); - if (eregi('crypted:',$dolibarr_main_db_pass)) + if (preg_match('/crypted:/i',$dolibarr_main_db_pass)) { - $dolibarr_main_db_pass = eregi_replace('crypted:', '', $dolibarr_main_db_pass); + $dolibarr_main_db_pass = preg_replace('/crypted:/i', '', $dolibarr_main_db_pass); $dolibarr_main_db_pass = dol_decode($dolibarr_main_db_pass); $dolibarr_main_db_encrypted_pass = $dolibarr_main_db_pass; // We need to set this as it is used to know the password was initially crypted } diff --git a/htdocs/interfaces.class.php b/htdocs/interfaces.class.php index 6e6a1378b2d..3cd0f475e55 100644 --- a/htdocs/interfaces.class.php +++ b/htdocs/interfaces.class.php @@ -83,7 +83,7 @@ class Interfaces } // Check if trigger file is disabled by name - if (eregi('NORUN$',$file)) + if (preg_match('/NORUN$/i',$file)) { continue; } @@ -91,7 +91,7 @@ class Interfaces $qualified=true; if (strtolower($reg[1]) != 'all') { - $module=eregi_replace('^mod','',$reg[1]); + $module=preg_replace('/^mod/i','',$reg[1]); $constparam='MAIN_MODULE_'.strtoupper($module); if (empty($conf->global->$constparam)) $qualified=false; } diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index 1a4a212bdcc..f8f08ad2939 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -138,9 +138,9 @@ if ($conf->file->main_force_https) { if (! empty($_SERVER["SCRIPT_URI"])) // If SCRIPT_URI supported by server { - if (eregi('^http:',$_SERVER["SCRIPT_URI"]) && ! eregi('^https:',$_SERVER["SCRIPT_URI"])) // If link is http + if (preg_match('/^http:/i',$_SERVER["SCRIPT_URI"]) && ! preg_match('/^https:/i',$_SERVER["SCRIPT_URI"])) // If link is http { - $newurl=eregi_replace('^http:','https:',$_SERVER["SCRIPT_URI"]); + $newurl=preg_replace('/^http:/i','https:',$_SERVER["SCRIPT_URI"]); dol_syslog("main.inc: dolibarr_main_force_https is on, we make a redirect to ".$newurl); header("Location: ".$newurl); @@ -152,7 +152,7 @@ if ($conf->file->main_force_https) // $_SERVER["HTTPS"] is 'on' when link is https, otherwise $_SERVER["HTTPS"] is empty or 'off' if (empty($_SERVER["HTTPS"]) || $_SERVER["HTTPS"] != 'on') // If link is http { - $uri=eregi_replace('^http(s?)://','',$dolibarr_main_url_root); + $uri=preg_replace('/^http(s?):\/\//i','',$dolibarr_main_url_root); $val=explode('/',$uri); $domaineport=$val[0]; // $domaineport contient nom domaine et port diff --git a/htdocs/mantis/mantis.class.php b/htdocs/mantis/mantis.class.php index ab59913a81c..179ce7fd421 100644 --- a/htdocs/mantis/mantis.class.php +++ b/htdocs/mantis/mantis.class.php @@ -46,7 +46,7 @@ class Mantis { /** - \brief Constructeur de la classe d'interface à mantisendar + \brief Constructeur de la classe d'interface a mantisendar */ function Mantis() { @@ -54,20 +54,18 @@ class Mantis { global $dolibarr_main_db_type,$dolibarr_main_db_host,$dolibarr_main_db_user; global $dolibarr_main_db_pass,$dolibarr_main_db_name; - // Défini parametres mantis (avec substitution eventuelle) - $mantistype=eregi_replace('__dolibarr_main_db_type__',$dolibarr_main_db_type,$conf->mantis->db->type); - $mantishost=eregi_replace('__dolibarr_main_db_host__',$dolibarr_main_db_host,$conf->mantis->db->host); - $mantisport=eregi_replace('__dolibarr_main_db_port__',$dolibarr_main_db_port,$conf->mantis->db->port); - $mantisuser=eregi_replace('__dolibarr_main_db_user__',$dolibarr_main_db_user,$conf->mantis->db->user); - $mantispass=eregi_replace('__dolibarr_main_db_pass__',$dolibarr_main_db_pass,$conf->mantis->db->pass); - $mantisname=eregi_replace('__dolibarr_main_db_name__',$dolibarr_main_db_name,$conf->mantis->db->name); + // Defini parametres mantis (avec substitution eventuelle) + $mantistype=preg_replace('/__dolibarr_main_db_type__/i',$dolibarr_main_db_type,$conf->mantis->db->type); + $mantishost=preg_replace('/__dolibarr_main_db_host__/i',$dolibarr_main_db_host,$conf->mantis->db->host); + $mantisport=preg_replace('/__dolibarr_main_db_port__/i',$dolibarr_main_db_port,$conf->mantis->db->port); + $mantisuser=preg_replace('/__dolibarr_main_db_user__/i',$dolibarr_main_db_user,$conf->mantis->db->user); + $mantispass=preg_replace('/__dolibarr_main_db_pass__/i',$dolibarr_main_db_pass,$conf->mantis->db->pass); + $mantisname=preg_replace('/__dolibarr_main_db_name__/i',$dolibarr_main_db_name,$conf->mantis->db->name); - // On initie la connexion à la base mantisendar + // On initie la connexion a la base mantisendar require_once (DOL_DOCUMENT_ROOT ."/lib/databases/".$mantistype.".lib.php"); $this->localdb = new DoliDb($mantistype,$mantishost,$mantisuser,$mantispass,$mantisname,$mantisport); } - - - + } ?> diff --git a/htdocs/master.inc.php b/htdocs/master.inc.php index 239fb7eb338..a3c35f9b76a 100644 --- a/htdocs/master.inc.php +++ b/htdocs/master.inc.php @@ -85,10 +85,10 @@ define('DOL_DOCUMENT_ROOT', $dolibarr_main_document_root); // Filesystem pages define('DOL_DATA_ROOT', $dolibarr_main_data_root); // Filesystem donnes (documents) if ($dolibarr_main_url_root == 'auto' && ! empty($_SERVER["SCRIPT_URL"]) && ! empty($_SERVER["SCRIPT_URI"])) { - $dolibarr_main_url_root=eregi_replace($_SERVER["SCRIPT_URL"].'$','',$_SERVER["SCRIPT_URI"]); + $dolibarr_main_url_root=preg_replace('/'.$_SERVER["SCRIPT_URL"].'$/i','',$_SERVER["SCRIPT_URI"]); } define('DOL_MAIN_URL_ROOT', $dolibarr_main_url_root); // URL relative root -$uri=eregi_replace('^http(s?)://','',$dolibarr_main_url_root); // $suburi contains url without http* +$uri=preg_replace('/^http(s?):\/\//i','',$dolibarr_main_url_root); // $suburi contains url without http* $suburi = strstr ($uri, '/'); // $suburi contains url without domain if ($suburi == '/') $suburi = ''; // If $suburi is /, it is now '' define('DOL_URL_ROOT', $suburi); // URL relative root ('/', '/dolibarr', ...) @@ -113,12 +113,12 @@ if (! file_exists(DOL_DOCUMENT_ROOT ."/lib/functions.lib.php")) require_once(DOL_DOCUMENT_ROOT ."/lib/functions.lib.php"); // Need 970ko memory (1.1 in 2.2) // If password is encoded, we decode it -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)) { require_once(DOL_DOCUMENT_ROOT ."/lib/security.lib.php"); - if (eregi('crypted:',$dolibarr_main_db_pass)) + if (preg_match('/crypted:/i',$dolibarr_main_db_pass)) { - $dolibarr_main_db_pass = eregi_replace('crypted:', '', $dolibarr_main_db_pass); + $dolibarr_main_db_pass = preg_replace('/crypted:/i', '', $dolibarr_main_db_pass); $dolibarr_main_db_pass = dol_decode($dolibarr_main_db_pass); $dolibarr_main_db_encrypted_pass = $dolibarr_main_db_pass; // We need to set this as it is used to know the password was initially crypted } diff --git a/htdocs/phenix/phenix.class.php b/htdocs/phenix/phenix.class.php index 84b6f52fe28..0970152c4f3 100644 --- a/htdocs/phenix/phenix.class.php +++ b/htdocs/phenix/phenix.class.php @@ -46,36 +46,36 @@ class Phenix { /** - \brief Constructeur de la classe d'interface à Phenix + \brief Constructeur de la classe d'interface a Phenix */ function Phenix() { global $conf; - global $dolibarr_main_db_type,$dolibarr_main_db_host,$dolibarr_main_db_user; - global $dolibarr_main_db_pass,$dolibarr_main_db_name; - - // Défini parametres phenix (avec substitution eventuelle) - $phenixtype=eregi_replace('__dolibarr_main_db_type__',$dolibarr_main_db_type,$conf->phenix->db->type); - $phenixhost=eregi_replace('__dolibarr_main_db_host__',$dolibarr_main_db_host,$conf->phenix->db->host); - $phenixport=eregi_replace('__dolibarr_main_db_port__',$dolibarr_main_db_port,$conf->phenix->db->port); - $phenixuser=eregi_replace('__dolibarr_main_db_user__',$dolibarr_main_db_user,$conf->phenix->db->user); - $phenixpass=eregi_replace('__dolibarr_main_db_pass__',$dolibarr_main_db_pass,$conf->phenix->db->pass); - $phenixname=eregi_replace('__dolibarr_main_db_name__',$dolibarr_main_db_name,$conf->phenix->db->name); - - // On initie la connexion à la base Phenix - require_once (DOL_DOCUMENT_ROOT ."/lib/databases/".$phenixtype.".lib.php"); - $this->localdb = new DoliDb($phenixtype,$phenixhost,$phenixuser,$phenixpass,$phenixname,$phenixport); + global $dolibarr_main_db_type,$dolibarr_main_db_host,$dolibarr_main_db_user; + global $dolibarr_main_db_pass,$dolibarr_main_db_name; + + // Defini parametres phenix (avec substitution eventuelle) + $phenixtype=preg_replace('/__dolibarr_main_db_type__/i',$dolibarr_main_db_type,$conf->phenix->db->type); + $phenixhost=preg_replace('/__dolibarr_main_db_host__/i',$dolibarr_main_db_host,$conf->phenix->db->host); + $phenixport=preg_replace('/__dolibarr_main_db_port__/i',$dolibarr_main_db_port,$conf->phenix->db->port); + $phenixuser=preg_replace('/__dolibarr_main_db_user__/i',$dolibarr_main_db_user,$conf->phenix->db->user); + $phenixpass=preg_replace('/__dolibarr_main_db_pass__/i',$dolibarr_main_db_pass,$conf->phenix->db->pass); + $phenixname=preg_replace('/__dolibarr_main_db_name__/i',$dolibarr_main_db_name,$conf->phenix->db->name); + + // On initie la connexion a la base Phenix + require_once (DOL_DOCUMENT_ROOT ."/lib/databases/".$phenixtype.".lib.php"); + $this->localdb = new DoliDb($phenixtype,$phenixhost,$phenixuser,$phenixpass,$phenixname,$phenixport); } // TODO : Modifier la suite.... // Ajouter variable pour l'extension du nom des tables "px_" qui peut etre different -// récupérer id du user à partir de son login +// recuperer id du user a partir de son login /** \brief Ajoute objet en tant qu'entree dans le calendrier de l'utilisateur \param[in] user Le login de l'utilisateur - \return int 1 en cas de succès, -1,-2,-3 en cas d'erreur, -4 si login phenix non défini + \return int 1 en cas de succes, -1,-2,-3 en cas d'erreur, -4 si login phenix non defini */ function add($user) { @@ -83,7 +83,7 @@ class Phenix { dol_syslog("Phenix::add user=".$user->id); - // Test si login phenix défini pour le user + // Test si login phenix defini pour le user if (! $user->phenix_login) { $langs->load("other"); @@ -94,7 +94,7 @@ class Phenix { $this->localdb->begin(); - // Recupère l'id max+1 dans la base webcalendar + // Recupere l'id max+1 dans la base webcalendar $id = $this->get_next_id(); if ($id > 0) diff --git a/htdocs/product.class.php b/htdocs/product.class.php index af48ee90878..5c42c755401 100644 --- a/htdocs/product.class.php +++ b/htdocs/product.class.php @@ -2376,8 +2376,8 @@ class Product extends CommonObject } /** - * \brief Affiche la premi�re photo du produit - * \param sdir R�pertoire � scanner + * \brief Affiche la premiere photo du produit + * \param sdir Repertoire a scanner * \return boolean true si photo dispo, false sinon */ function is_photo_available($sdir) @@ -2401,11 +2401,11 @@ class Product extends CommonObject /** * \brief Affiche toutes les photos du produit (nbmax maximum) - * \param sdir R�pertoire � scanner + * \param sdir Repertoire a scanner * \param size 0=taille origine, 1 taille vignette * \param nbmax Nombre maximum de photos (0=pas de max) * \param nbbyrow Nombre vignettes par ligne (si mode vignette) - * \return int Nombre de photos affich�es + * \return int Nombre de photos affichees */ function show_photos($sdir,$size=0,$nbmax=0,$nbbyrow=5) { @@ -2431,8 +2431,8 @@ class Product extends CommonObject if ($size == 1) { // Format vignette // On determine nom du fichier vignette $photo_vignette=''; - if (eregi('(\.jpg|\.bmp|\.gif|\.png|\.tiff)$',$photo,$regs)) { - $photo_vignette=eregi_replace($regs[0],'',$photo)."_small".$regs[0]; + if (preg_match('/(\.jpg|\.bmp|\.gif|\.png|\.tiff)$/i',$photo,$regs)) { + $photo_vignette=preg_replace('/'.$regs[0].'/i','',$photo)."_small".$regs[0]; } @@ -2485,7 +2485,7 @@ class Product extends CommonObject /** * \brief Retourne tableau de toutes les photos du produit - * \param dir R�pertoire � scanner + * \param dir Repertoire a scanner * \param nbmax Nombre maximum de photos (0=pas de max) * \return array Tableau de photos */ @@ -2512,9 +2512,9 @@ class Product extends CommonObject // On determine nom du fichier vignette $photo=$file; $photo_vignette=''; - if (eregi('(\.jpg|\.bmp|\.gif|\.png|\.tiff)$',$photo,$regs)) + if (preg_match('/(\.jpg|\.bmp|\.gif|\.png|\.tiff)$/i',$photo,$regs)) { - $photo_vignette=eregi_replace($regs[0],'',$photo).'_small'.$regs[0]; + $photo_vignette=preg_replace('/'.$regs[0].'/i','',$photo).'_small'.$regs[0]; } $dirthumb = $dir.'thumbs/'; @@ -2546,15 +2546,16 @@ class Product extends CommonObject { $dir = dirname($file).'/'; // Chemin du dossier contenant l'image d'origine $dirthumb = $dir.'/thumbs/'; // Chemin du dossier contenant la vignette - $filename = eregi_replace($dir,'',$file); // Nom du fichier + $pattern = str_replace('/','\/',$dir); // Add backslashes for regular expression + $filename = preg_replace('/'.$pattern.'/i','',$file); // Nom du fichier // On efface l'image d'origine dol_delete_file($file); // Si elle existe, on efface la vignette - if (eregi('(\.jpg|\.bmp|\.gif|\.png|\.tiff)$',$filename,$regs)) + if (preg_match('/(\.jpg|\.bmp|\.gif|\.png|\.tiff)$/i',$filename,$regs)) { - $photo_vignette=eregi_replace($regs[0],'',$filename).'_small'.$regs[0]; + $photo_vignette=preg_replace('/'.$regs[0].'/i','',$filename).'_small'.$regs[0]; if (file_exists($dirthumb.$photo_vignette)) { dol_delete_file($dirthumb.$photo_vignette); diff --git a/htdocs/product/price.php b/htdocs/product/price.php index a5991b41a8b..c4a8237c842 100644 --- a/htdocs/product/price.php +++ b/htdocs/product/price.php @@ -71,7 +71,7 @@ if ($_POST["action"] == 'update_price' && ! $_POST["cancel"] && ($user->rights-> $newprice_min=price2num($_POST["price_min_".$i],'MU'); $newpricebase=$_POST["multiprices_base_type_".$i]; $newnpr=(eregi('\*',$_POST["tva_tx_".$i]) ? 1 : 0); - $newvat=eregi_replace('\*','',$_POST["tva_tx_".$i]); + $newvat=str_replace('*','',$_POST["tva_tx_".$i]); break; // We found submited price } } @@ -83,7 +83,7 @@ if ($_POST["action"] == 'update_price' && ! $_POST["cancel"] && ($user->rights-> $newprice_min=price2num($_POST["price_min"],'MU'); $newpricebase=$_POST["price_base_type"]; $newnpr=(eregi('\*',$_POST["tva_tx"]) ? 1 : 0); - $newvat=eregi_replace('\*','',$_POST["tva_tx"]); + $newvat=str_replace('*','',$_POST["tva_tx"]); } if ($product->update_price($product->id, $newprice, $newpricebase, $user, $newvat,$newprice_min, $level) > 0) diff --git a/htdocs/public/demo/index.php b/htdocs/public/demo/index.php index 9c6ed7f2ec7..6705656a7db 100644 --- a/htdocs/public/demo/index.php +++ b/htdocs/public/demo/index.php @@ -171,7 +171,7 @@ foreach ($dirlist as $dirroot) if ($objMod->needtopmenu && sizeof($objMod->needtopmenu) && ! in_array($conf->top_menu,$objMod->needtopmenu)) $modulequalified=0; // We discard modules according to features level (PS: if module is activated we always show it) - $const_name = 'MAIN_MODULE_'.strtoupper(eregi_replace('^mod','',get_class($objMod))); + $const_name = 'MAIN_MODULE_'.strtoupper(preg_replace('/^mod/i','',get_class($objMod))); if ($objMod->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2 && ! $conf->global->$const_name) $modulequalified=0; if ($objMod->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1 && ! $conf->global->$const_name) $modulequalified=0; diff --git a/htdocs/searchpostalcode.php b/htdocs/searchpostalcode.php index 3e621559ed3..c56487cafa5 100644 --- a/htdocs/searchpostalcode.php +++ b/htdocs/searchpostalcode.php @@ -53,7 +53,7 @@ function run_request($table) $sql.= " WHERE"; if ($cp) { - $cp=eregi_replace('\*','%',$cp); + $cp=str_replace('*','%',$cp); $sql.= " cp LIKE '".addslashes($cp)."' AND"; $sql.= " (ville IS NOT NULL OR fk_departement IS NOT NULL OR fk_pays IS NOT NULL)"; } diff --git a/htdocs/societe.class.php b/htdocs/societe.class.php index 0ef080a08d0..8e9ec5b7cfc 100644 --- a/htdocs/societe.class.php +++ b/htdocs/societe.class.php @@ -1693,7 +1693,7 @@ class Societe extends CommonObject if ($idprof == 1 && $soc->pays_code == 'FR') { $chaine=trim($this->siren); - $chaine=eregi_replace(' ','',$chaine); + $chaine=preg_replace('/(\s)/','',$chaine); if (strlen($chaine) != 9) return -1; @@ -1722,7 +1722,7 @@ class Societe extends CommonObject if ($idprof == 2 && $soc->pays_code == 'FR') { $chaine=trim($this->siret); - $chaine=eregi_replace(' ','',$chaine); + $chaine=preg_replace('/(\s)/','',$chaine); if (strlen($chaine) != 14) return -1; } diff --git a/htdocs/support/index.php b/htdocs/support/index.php index 937d6913cf9..682ea39bb22 100644 --- a/htdocs/support/index.php +++ b/htdocs/support/index.php @@ -27,7 +27,7 @@ // This is a standalone feature with no information from Dolibarr to show // and no database access to do. include_once("./inc.php"); -$uri=eregi_replace('^http(s?)://','',$dolibarr_main_url_root); +$uri=preg_replace('/^http(s?):\/\//i','',$dolibarr_main_url_root); $pos = strstr ($uri, '/'); // $pos contient alors url sans nom domaine if ($pos == '/') $pos = ''; // si $pos vaut /, on le met a '' define('DOL_URL_ROOT', $pos); // URL racine relative diff --git a/htdocs/support/online.php b/htdocs/support/online.php index 7a18161d6dd..f63167a99ea 100644 --- a/htdocs/support/online.php +++ b/htdocs/support/online.php @@ -24,7 +24,7 @@ */ include_once("./inc.php"); -$uri=eregi_replace('^http(s?)://','',$dolibarr_main_url_root); +$uri=preg_replace('/^http(s?):\/\//i','',$dolibarr_main_url_root); $pos = strstr ($uri, '/'); // $pos contient alors url sans nom domaine if ($pos == '/') $pos = ''; // si $pos vaut /, on le met a '' define('DOL_URL_ROOT', $pos); // URL racine relative diff --git a/htdocs/translate.class.php b/htdocs/translate.class.php index 4e996ca5eb4..6a310a3b7b9 100644 --- a/htdocs/translate.class.php +++ b/htdocs/translate.class.php @@ -106,8 +106,8 @@ class Translate { if (empty($srclang) || $srclang == 'auto') { $langpref=$_SERVER['HTTP_ACCEPT_LANGUAGE']; - $langpref=eregi_replace(";[^,]*","",$langpref); - $langpref=eregi_replace("-","_",$langpref); + $langpref=preg_replace("/;([^,]*)/i","",$langpref); + $langpref=str_replace("-","_",$langpref); $langlist=preg_split("/[;,]/",$langpref); $codetouse=$langlist[0]; } @@ -187,7 +187,7 @@ class Translate { //dol_syslog("Translate::Load Start domain=".$domain." alt=".$alt." forcelangdir=".$forcelangdir." this->defaultlang=".$this->defaultlang); - $newdomain=eregi_replace('@','',$domain); // Remove the @ if present + $newdomain=str_replace('@','',$domain); // Remove the @ if present // Check cache if (! empty($this->tab_loaded[$newdomain])) // File already loaded for this domain @@ -405,13 +405,13 @@ class Translate { { if ($this->getTransFromTab($key)) // Translation is available { - $str=eregi_replace('\\\"','"',$this->tab_translate[$key]); // To solve some translation keys containing key=abc\"def\"ghi instead of abc"def"ghi + $str=preg_replace('/\\\"/','"',$this->tab_translate[$key]); // To solve some translation keys containing key=abc\"def\"ghi instead of abc"def"ghi $str=sprintf($str,$param1,$param2,$param3,$param4); if ($maxsize) $str=dol_trunc($str,$maxsize); // On remplace les tags HTML par __xx__ pour eviter traduction par htmlentities - $newstr=ereg_replace('<','__lt__',$str); - $newstr=ereg_replace('>','__gt__',$newstr); - $newstr=ereg_replace('"','__quot__',$newstr); + $newstr=str_replace('<','__lt__',$str); + $newstr=str_replace('>','__gt__',$newstr); + $newstr=str_replace('"','__quot__',$newstr); $newstr=$this->convToOutputCharset($newstr); // Convert string to $this->charset_output @@ -420,9 +420,9 @@ class Translate { $newstr=htmlentities($newstr,ENT_QUOTES,$this->charset_output); // On restaure les tags HTML - $newstr=ereg_replace('__lt__','<',$newstr); - $newstr=ereg_replace('__gt__','>',$newstr); - $newstr=ereg_replace('__quot__','"',$newstr); + $newstr=str_replace('__lt__','<',$newstr); + $newstr=str_replace('__gt__','>',$newstr); + $newstr=str_replace('__quot__','"',$newstr); return $newstr; } else // Translation is not available diff --git a/htdocs/user.class.php b/htdocs/user.class.php index 03402e9367e..4369182d6a0 100644 --- a/htdocs/user.class.php +++ b/htdocs/user.class.php @@ -1165,7 +1165,7 @@ class User extends CommonObject $error=0; - dol_syslog("User::setPassword user=".$user->id." password=".eregi_replace('.','*',$password)." changelater=".$changelater." notrigger=".$notrigger." nosyncmember=".$nosyncmember, LOG_DEBUG); + dol_syslog("User::setPassword user=".$user->id." password=".preg_replace('/./i','*',$password)." changelater=".$changelater." notrigger=".$notrigger." nosyncmember=".$nosyncmember, LOG_DEBUG); // Si nouveau mot de passe non communique, on genere par module if (! $password) diff --git a/htdocs/user/fiche.php b/htdocs/user/fiche.php index a87ff8b954f..2f7e2c81a08 100644 --- a/htdocs/user/fiche.php +++ b/htdocs/user/fiche.php @@ -585,7 +585,7 @@ if (($action == 'create') || ($action == 'adduserldap')) if ($ldap_pass) { print ''; - print eregi_replace('.','*',$ldap_pass); + print preg_replace('/./i','*',$ldap_pass); } else { @@ -887,7 +887,7 @@ else else { print ''; print "\n"; print ''; - print ''; + print ''; print "\n"; } @@ -1360,7 +1360,7 @@ else } else { - $text=eregi_replace('.','*',$fuser->pass); + $text=preg_replace('/./i','*',$fuser->pass); } print $text; print "\n"; @@ -1500,7 +1500,7 @@ else print "".''; print ''; } diff --git a/htdocs/webcal/webcal.class.php b/htdocs/webcal/webcal.class.php index 427e308fa3a..9c0883abc3b 100644 --- a/htdocs/webcal/webcal.class.php +++ b/htdocs/webcal/webcal.class.php @@ -45,7 +45,7 @@ class Webcal { /** - \brief Constructeur de la classe d'interface à Webcalendar + \brief Constructeur de la classe d'interface a Webcalendar */ function Webcal() { @@ -53,15 +53,15 @@ class Webcal { global $dolibarr_main_db_type,$dolibarr_main_db_host,$dolibarr_main_db_user; global $dolibarr_main_db_pass,$dolibarr_main_db_name; - // Défini parametres webcal (avec substitution eventuelle) - $webcaltype=eregi_replace('__dolibarr_main_db_type__',$dolibarr_main_db_type,$conf->webcal->db->type); - $webcalhost=eregi_replace('__dolibarr_main_db_host__',$dolibarr_main_db_host,$conf->webcal->db->host); - $webcalport=eregi_replace('__dolibarr_main_db_port__',$dolibarr_main_db_port,$conf->webcal->db->port); - $webcaluser=eregi_replace('__dolibarr_main_db_user__',$dolibarr_main_db_user,$conf->webcal->db->user); - $webcalpass=eregi_replace('__dolibarr_main_db_pass__',$dolibarr_main_db_pass,$conf->webcal->db->pass); - $webcalname=eregi_replace('__dolibarr_main_db_name__',$dolibarr_main_db_name,$conf->webcal->db->name); + // Defini parametres webcal (avec substitution eventuelle) + $webcaltype=preg_replace('/__dolibarr_main_db_type__/i',$dolibarr_main_db_type,$conf->webcal->db->type); + $webcalhost=preg_replace('/__dolibarr_main_db_host__/i',$dolibarr_main_db_host,$conf->webcal->db->host); + $webcalport=preg_replace('/__dolibarr_main_db_port__/i',$dolibarr_main_db_port,$conf->webcal->db->port); + $webcaluser=preg_replace('/__dolibarr_main_db_user__/i',$dolibarr_main_db_user,$conf->webcal->db->user); + $webcalpass=preg_replace('/__dolibarr_main_db_pass__/i',$dolibarr_main_db_pass,$conf->webcal->db->pass); + $webcalname=preg_replace('/__dolibarr_main_db_name__/i',$dolibarr_main_db_name,$conf->webcal->db->name); - // On initie la connexion à la base Webcalendar + // On initie la connexion a la base Webcalendar require_once (DOL_DOCUMENT_ROOT ."/lib/databases/".$webcaltype.".lib.php"); $this->localdb = new DoliDb($webcaltype,$webcalhost,$webcaluser,$webcalpass,$webcalname,$webcalport); } @@ -70,7 +70,7 @@ class Webcal { /** \brief Ajoute objet en tant qu'entree dans le calendrier de l'utilisateur \param[in] user Le login de l'utilisateur - \return int 1 en cas de succès, -1,-2,-3 en cas d'erreur, -4 si login webcal non défini + \return int 1 en cas de succes, -1,-2,-3 en cas d'erreur, -4 si login webcal non defini */ function add($user) { @@ -78,7 +78,7 @@ class Webcal { dol_syslog("Webcal::add user=".$user->id); - // Test si login webcal défini pour le user + // Test si login webcal defini pour le user if (! $user->webcal_login) { $langs->load("other"); @@ -89,7 +89,7 @@ class Webcal { $this->localdb->begin(); - // Recupère l'id max+1 dans la base webcalendar + // Recupere l'id max+1 dans la base webcalendar $id = $this->get_next_id(); if ($id > 0)
'; - if ($fuser->pass) print eregi_replace('.','*',$fuser->pass); + if ($fuser->pass) print preg_replace('/./i','*',$fuser->pass); else { if ($user->admin) print $langs->trans("Crypted").': '.$fuser->pass_indatabase_crypted; @@ -982,7 +982,7 @@ else print ''.$fuser->phenix_login.' 
'.$langs->trans("PassPhenix").''.eregi_replace('.','*',$fuser->phenix_pass_crypted).' '.preg_replace('/./i','*',$fuser->phenix_pass_crypted).' 
'.$langs->trans("PassPhenix").''; if ($caneditfield) print ''; - else print eregi_replace('.','*',$fuser->phenix_pass_crypted); + else print preg_replace('/./i','*',$fuser->phenix_pass_crypted); print '