Fix: functions "ereg", "ereg_replace", "eregi", "eregi_replace" is deprecated since php 5.3.0

This commit is contained in:
Regis Houssin 2009-10-21 14:02:14 +00:00
parent d9dadd9671
commit c226de4f00
26 changed files with 129 additions and 130 deletions

View File

@ -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;

View File

@ -119,7 +119,7 @@ class Form
{
if ($conf->use_javascript_ajax)
{
$htmltext=eregi_replace('"',"&quot;",$htmltext);
$htmltext=str_replace('"',"&quot;",$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)

View File

@ -36,7 +36,7 @@ class FormAdmin
/**
\brief Constructeur
\param DB handler d'acc<EFBFBD>s base de donn<EFBFBD>e
\param DB handler d'acces base de donnee
*/
function FormAdmin($DB)
{
@ -47,8 +47,8 @@ class FormAdmin
/**
* \brief Retourne la liste d<EFBFBD>roulante des langues disponibles
* \param selected Langue pr<EFBFBD>-s<EFBFBD>lectionn<EFBFBD>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<EFBFBD>
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<EFBFBD>roulante des menus disponibles (eldy)
* \param selected Menu pr<EFBFBD>-s<EFBFBD>lectionn<EFBFBD>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 <EFBFBD> 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<EFBFBD>roulante des menus disponibles (eldy)
* \param selected Menu pr<EFBFBD>-s<EFBFBD>lectionn<EFBFBD>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)

View File

@ -52,7 +52,7 @@ print_fiche_titre($langs->trans("HomeArea"));
if (! empty($conf->global->MAIN_MOTD))
{
$conf->global->MAIN_MOTD=eregi_replace('<br[ /]*>$','',$conf->global->MAIN_MOTD);
$conf->global->MAIN_MOTD=preg_replace('/<br([\s/]*)>$/i','',$conf->global->MAIN_MOTD);
if (! empty($conf->global->MAIN_MOTD))
{
print "\n<!-- Start of welcome text -->\n";

View File

@ -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 '<tr><td nowrap="nowrap" align="center"><b>'.$langs->trans("Upgrade").'<br>'.$newversionfrom.' -> '.$newversionto.'</b></td>';
print '<td>';
print $langs->trans("UpgradeDesc");

View File

@ -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.'<br>';
}
}

View File

@ -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
}

View File

@ -77,12 +77,12 @@ print '<table cellspacing="0" cellpadding="1" border="0" width="100%">';
$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
}

View File

@ -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 '<tr><td colspan="2">'.$sqldrop.";</td></tr>\n";
}
$createsql=eregi_replace('CONSTRAINT `'.$reg[1].'`','XXX',$createsql);
$createsql=preg_replace('/CONSTRAINT `'.$reg[1].'`/i','XXX',$createsql);
$i++;
}
$db->free($resql);

View File

@ -84,12 +84,12 @@ if (isset($_POST['action']) && eregi('upgrade',$_POST["action"]))
print '<table cellspacing="0" cellpadding="1" border="0" width="100%">';
// 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
}

View File

@ -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;
}

View File

@ -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

View File

@ -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);
}
}
?>

View File

@ -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
}

View File

@ -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)

View File

@ -2376,8 +2376,8 @@ class Product extends CommonObject
}
/**
* \brief Affiche la premi<EFBFBD>re photo du produit
* \param sdir R<EFBFBD>pertoire <EFBFBD> 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<EFBFBD>pertoire <EFBFBD> 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<EFBFBD>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<EFBFBD>pertoire <EFBFBD> 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);

View File

@ -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)

View File

@ -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;

View File

@ -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)";
}

View File

@ -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;
}

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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)

View File

@ -585,7 +585,7 @@ if (($action == 'create') || ($action == 'adduserldap'))
if ($ldap_pass)
{
print '<input type="hidden" name="password" value="'.$ldap_pass.'">';
print eregi_replace('.','*',$ldap_pass);
print preg_replace('/./i','*',$ldap_pass);
}
else
{
@ -887,7 +887,7 @@ else
else
{
print '<td>';
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 '<td>'.$fuser->phenix_login.'&nbsp;</td>';
print "</tr>\n";
print '<tr><td width="25%" valign="top">'.$langs->trans("PassPhenix").'</td>';
print '<td>'.eregi_replace('.','*',$fuser->phenix_pass_crypted).'&nbsp;</td>';
print '<td>'.preg_replace('/./i','*',$fuser->phenix_pass_crypted).'&nbsp;</td>';
print "</tr>\n";
}
@ -1360,7 +1360,7 @@ else
}
else
{
$text=eregi_replace('.','*',$fuser->pass);
$text=preg_replace('/./i','*',$fuser->pass);
}
print $text;
print "</td></tr>\n";
@ -1500,7 +1500,7 @@ else
print "<tr>".'<td valign="top">'.$langs->trans("PassPhenix").'</td>';
print '<td>';
if ($caneditfield) print '<input size="30" type="password" class="flat" name="phenix_pass" value="'.$fuser->phenix_pass_crypted.'">';
else print eregi_replace('.','*',$fuser->phenix_pass_crypted);
else print preg_replace('/./i','*',$fuser->phenix_pass_crypted);
print '</td></tr>';
}

View File

@ -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)