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 18:14:00 +00:00
parent a62ef03fa9
commit 3e4414becd
20 changed files with 61 additions and 61 deletions

View File

@ -351,10 +351,10 @@ if (is_dir($aliasDir))
$aliasContents.='<tr><td><ul class="aliases">';
$aliasContents .= '<li><a href="'.ereg_replace('.conf','',$file).'/">';
$file = ereg_replace('.conf','',$file);
if (eregi('dolibarr',$file)) $aliasContents .= $file.'</a></li></ul></td><td>http://localhost'.($apachePort != 80?':'.$apachePort:'').'/'.$file.'/</td><td>http://<i>ipofyourserver</i>'.($apachePort != 80?':'.$apachePort:'').'/'.$file.'/</td></tr>';
elseif (eregi('phpmyadmin',$file)) $aliasContents .= $file.'</a></li></ul></td><td>http://localhost'.($apachePort != 80?':'.$apachePort:'').'/'.$file.'/</td><td>'.$langues[$langue]['NotAvailable'].'</td></tr>';
$aliasContents .= '<li><a href="'.preg_replace('/\.conf/','',$file).'/">';
$file = preg_replace('/\.conf/','',$file);
if (preg_match('/dolibarr/i',$file)) $aliasContents .= $file.'</a></li></ul></td><td>http://localhost'.($apachePort != 80?':'.$apachePort:'').'/'.$file.'/</td><td>http://<i>ipofyourserver</i>'.($apachePort != 80?':'.$apachePort:'').'/'.$file.'/</td></tr>';
elseif (preg_match('/phpmyadmin/i',$file)) $aliasContents .= $file.'</a></li></ul></td><td>http://localhost'.($apachePort != 80?':'.$apachePort:'').'/'.$file.'/</td><td>'.$langues[$langue]['NotAvailable'].'</td></tr>';
else $aliasContents .= $file.'</a></li></ul></td> <td> </td><td>'.$langues[$langue]['NotAvailable'].'</td></tr>';
$aliasarray[]=$file;

View File

@ -86,10 +86,10 @@ else
foreach ($cons as $cc)
{
$cx = ereg_replace("\) REFER", "", $cc);
$cx = ereg_replace("\(`", "", $cx);
$cx = ereg_replace("`\)", "", $cx);
$cx = ereg_replace("` ", "", $cx);
$cx = preg_replace("/\)\sREFER/", "", $cc);
$cx = preg_replace("/\(`/", "", $cx);
$cx = preg_replace("/`\)/", "", $cx);
$cx = preg_replace("/`\s/", "", $cx);
$val = explode("`",$cx);

View File

@ -176,11 +176,11 @@ class AdresseLivraison
$this->ville = trim($this->ville);
$this->pays_id = trim($this->pays_id);
$this->tel = trim($this->tel);
$this->tel = ereg_replace(" ","",$this->tel);
$this->tel = ereg_replace("\.","",$this->tel);
$this->tel = preg_replace("/\s/","",$this->tel);
$this->tel = preg_replace("/\./","",$this->tel);
$this->fax = trim($this->fax);
$this->fax = ereg_replace(" ","",$this->fax);
$this->fax = ereg_replace("\.","",$this->fax);
$this->fax = preg_replace("/\s/","",$this->fax);
$this->fax = preg_replace("/\./","",$this->fax);
$this->note = trim($this->note);
$result = $this->verify(); // Verifie que nom et label obligatoire

View File

@ -93,7 +93,7 @@ if ($year > 0)
$sql .= ")";
}
if ($filtre) {
$filtre=ereg_replace(":","=",$filtre);
$filtre=str_replace(":","=",$filtre);
$sql .= " AND ".$filtre;
}
if ($typeid) {

View File

@ -190,7 +190,7 @@ class awGraph extends awImage {
$type = awGraph::cleanGraphCache($file);
if($type === NULL) {
$name = ereg_replace(".*/(.*)\-time", "\\1", $file);
$name = preg_replace("/.*\/(.*)\-time/", "\\1", $file);
awGraph::deleteFromCache($name);
}

View File

@ -344,8 +344,8 @@ function barcode_encode_genbarcode($code,$encoding){
/* delete EAN-13 checksum */
if (eregi("^ean$", $encoding) && strlen($code)==13) $code=substr($code,0,12);
if (!$encoding) $encoding="ANY";
$encoding=ereg_replace("[|\\]", "_", $encoding);
$code=ereg_replace("[|\\]", "_", $code);
$encoding=preg_replace("/[|\\]/", "_", $encoding);
$code=preg_replace("/[|\\]/", "_", $code);
$cmd=$genbarcode_loc." \""
.str_replace("\"", "\\\"",$code)."\" \""
.str_replace("\"", "\\\"",strtoupper($encoding))."\"";

View File

@ -1,6 +1,6 @@
<?php
/* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2003 Éric Seigne <erics@rycks.com>
* Copyright (C) 2003 <EFBFBD>ric Seigne <erics@rycks.com>
* Copyright (C) 2004-2008 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2006 Regis Houssin <regis@dolibarr.fr>
*
@ -58,8 +58,8 @@ class box_external_rss extends ModeleBoxes {
}
/**
* \brief Charge les données en mémoire pour affichage ultérieur
* \param $max Nombre maximum d'enregistrements à charger
* \brief Charge les donn<EFBFBD>es en m<EFBFBD>moire pour affichage ult<EFBFBD>rieur
* \param $max Nombre maximum d'enregistrements <EFBFBD> charger
*/
function loadBox($max=5)
{
@ -105,7 +105,7 @@ class box_external_rss extends ModeleBoxes {
'sublink' => $link, 'subtext'=>$langs->trans("LastRefreshDate").': '.(isset($rss->date)?dol_print_date($rss->date,"dayhourtext"):$langs->trans("Unknown")), 'subpicto'=>'object_bookmark');
}
// INFO sur le élements
// INFO sur le <EFBFBD>lements
for($i = 0; $i < $max && $i < sizeof($rss->items); $i++)
{
$item = $rss->items[$i];
@ -135,8 +135,8 @@ class box_external_rss extends ModeleBoxes {
if (! $isutf8 && $conf->file->character_set_client == 'UTF-8') $title=utf8_encode($title);
elseif ($isutf8 && $conf->file->character_set_client == 'ISO-8859-1') $title=utf8_decode($title);
$title=ereg_replace("([[:alnum:]])\?([[:alnum:]])","\\1'\\2",$title); // Gère problème des apostrophes mal codée/décodée par utf8
$title=ereg_replace("^\s+","",$title); // Supprime espaces de début
$title=preg_replace("/([[:alnum:]])\?([[:alnum:]])/","\\1'\\2",$title); // Gere probleme des apostrophes mal codee/decodee par utf8
$title=preg_replace("/^\s+/","",$title); // Supprime espaces de debut
$this->info_box_contents["$href"]="$title";
$this->info_box_contents[$i][0] = array('td' => 'align="left" width="16"',

View File

@ -1960,11 +1960,11 @@ function _enddoc()
}
foreach($a as $key=>$element) {
$element = ereg_replace('&ndash;','-',$element); //remplace les &ndash; par un tiret
$element = ereg_replace('&rsquo;','\'',$element); //remplace les &rsquo; par un apostrophe
$element = ereg_replace('&quot;','"',$element); //remplace les &quot; par une guillemet
$element = ereg_replace('&euro;',chr(128),$element); //remplace les &euro; par le signe euro
$element = ereg_replace('&oelig;',chr(156),$element); //remplace les &oelig; par le signe e dans l'o
$element = str_replace('&ndash;','-',$element); //remplace les &ndash; par un tiret
$element = str_replace('&rsquo;','\'',$element); //remplace les &rsquo; par un apostrophe
$element = str_replace('&quot;','"',$element); //remplace les &quot; par une guillemet
$element = str_replace('&euro;',chr(128),$element); //remplace les &euro; par le signe euro
$element = str_replace('&oelig;',chr(156),$element); //remplace les &oelig; par le signe e dans l'o
if (!preg_match($pattern, $element)) {
//Text
if($this->HREF) {

View File

@ -245,18 +245,18 @@ class ExportCsv extends ModeleExports
$newvalue=dol_string_nohtmltag($newvalue);
// Rule 1 CSV: No CR, LF in cells
$newvalue=ereg_replace("\r",'',$newvalue);
$newvalue=ereg_replace("\n",'\n',$newvalue);
$newvalue=str_replace("\r",'',$newvalue);
$newvalue=str_replace("\n",'\n',$newvalue);
// Rule 2 CSV: If value contains ", we must escape with ", and add "
if (ereg('"',$newvalue))
if (preg_match('/"/',$newvalue))
{
$addquote=1;
$newvalue=ereg_replace('"','""',$newvalue);
$newvalue=str_replace('"','""',$newvalue);
}
// Rule 3 CSV: If value contains separator, we must add "
if (ereg($this->separator,$newvalue))
if (preg_match('/'.$this->separator.'/',$newvalue))
{
$addquote=1;
}

View File

@ -214,13 +214,13 @@ class ExportTsv extends ModeleExports
$newvalue=dol_string_nohtmltag($newvalue);
// Rule 1 TSV: No CR, LF in cells
$newvalue=ereg_replace("\r",'',$newvalue);
$newvalue=ereg_replace("\n",'\n',$newvalue);
$newvalue=str_replace("\r",'',$newvalue);
$newvalue=str_replace("\n",'\n',$newvalue);
// Rule 2 TSV: If value contains tab, we must replace by space
if (ereg($this->separator,$newvalue))
if (preg_match('/'.$this->separator.'/',$newvalue))
{
$newvalue=ereg_replace("\t"," ",$newvalue);
$newvalue=str_replace("\t"," ",$newvalue);
}
return $newvalue;

View File

@ -407,7 +407,7 @@ if ($_POST["action"] == "set")
{
$buffer = fgets($fp, 4096);
//print "<tr><td>Insertion ligne : $buffer</td><td>";
if (strlen(trim(ereg_replace("--","",$buffer))))
if (strlen(trim(str_replace("--","",$buffer))))
{
if ($db->query($buffer))
{

View File

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

View File

@ -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 '<a href="'.$dolibarr_main_url_root .'/admin/index.php?mainmenu=home&leftmenu=setup'.(isset($_POST["login"])?'&username='.urlencode($_POST["login"]):'').'">';

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -248,14 +248,14 @@ class Translate {
//print "Domain=$domain, found a string for $tab[0] with value $tab[1]<br>";
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].'<br>';
}
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
{