diff --git a/build/exe/doliwamp/index.php.install b/build/exe/doliwamp/index.php.install index 44199db52d0..849fae18c23 100644 --- a/build/exe/doliwamp/index.php.install +++ b/build/exe/doliwamp/index.php.install @@ -351,10 +351,10 @@ if (is_dir($aliasDir)) $aliasContents.='http://localhost'.($apachePort != 80?':'.$apachePort:'').'/'.$file.'/http://ipofyourserver'.($apachePort != 80?':'.$apachePort:'').'/'.$file.'/'; - elseif (eregi('phpmyadmin',$file)) $aliasContents .= $file.'http://localhost'.($apachePort != 80?':'.$apachePort:'').'/'.$file.'/'.$langues[$langue]['NotAvailable'].''; + $aliasContents .= '
  • '; + $file = preg_replace('/\.conf/','',$file); + if (preg_match('/dolibarr/i',$file)) $aliasContents .= $file.'
  • http://localhost'.($apachePort != 80?':'.$apachePort:'').'/'.$file.'/http://ipofyourserver'.($apachePort != 80?':'.$apachePort:'').'/'.$file.'/'; + elseif (preg_match('/phpmyadmin/i',$file)) $aliasContents .= $file.'http://localhost'.($apachePort != 80?':'.$apachePort:'').'/'.$file.'/'.$langues[$langue]['NotAvailable'].''; else $aliasContents .= $file.' '.$langues[$langue]['NotAvailable'].''; $aliasarray[]=$file; diff --git a/htdocs/admin/system/dbtable.php b/htdocs/admin/system/dbtable.php index ab641b11113..45a0c984f97 100644 --- a/htdocs/admin/system/dbtable.php +++ b/htdocs/admin/system/dbtable.php @@ -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); diff --git a/htdocs/comm/adresse_livraison.class.php b/htdocs/comm/adresse_livraison.class.php index e42f639f913..a30c47aa00c 100644 --- a/htdocs/comm/adresse_livraison.class.php +++ b/htdocs/comm/adresse_livraison.class.php @@ -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 diff --git a/htdocs/compta/sociales/index.php b/htdocs/compta/sociales/index.php index 97fa57fabcc..9b6c4f4aaf4 100644 --- a/htdocs/compta/sociales/index.php +++ b/htdocs/compta/sociales/index.php @@ -93,7 +93,7 @@ if ($year > 0) $sql .= ")"; } if ($filtre) { - $filtre=ereg_replace(":","=",$filtre); + $filtre=str_replace(":","=",$filtre); $sql .= " AND ".$filtre; } if ($typeid) { diff --git a/htdocs/includes/artichow/php5/Graph.class.php b/htdocs/includes/artichow/php5/Graph.class.php index 439305cf370..3bfadcd3edb 100644 --- a/htdocs/includes/artichow/php5/Graph.class.php +++ b/htdocs/includes/artichow/php5/Graph.class.php @@ -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); } diff --git a/htdocs/includes/barcode/php-barcode/php-barcode.php b/htdocs/includes/barcode/php-barcode/php-barcode.php index 72976910954..1e27be11703 100644 --- a/htdocs/includes/barcode/php-barcode/php-barcode.php +++ b/htdocs/includes/barcode/php-barcode/php-barcode.php @@ -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))."\""; diff --git a/htdocs/includes/boxes/box_external_rss.php b/htdocs/includes/boxes/box_external_rss.php index b1e38ff9267..5081f7b4022 100644 --- a/htdocs/includes/boxes/box_external_rss.php +++ b/htdocs/includes/boxes/box_external_rss.php @@ -1,6 +1,6 @@ - * Copyright (C) 2003 Éric Seigne + * Copyright (C) 2003 �ric Seigne * Copyright (C) 2004-2008 Laurent Destailleur * Copyright (C) 2005-2006 Regis Houssin * @@ -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�es en m�moire pour affichage ult�rieur + * \param $max Nombre maximum d'enregistrements � 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 �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"', diff --git a/htdocs/includes/fpdf/fpdf/fpdf.php b/htdocs/includes/fpdf/fpdf/fpdf.php index 9e6e6e1cc38..3cfb11eef1f 100644 --- a/htdocs/includes/fpdf/fpdf/fpdf.php +++ b/htdocs/includes/fpdf/fpdf/fpdf.php @@ -1960,11 +1960,11 @@ function _enddoc() } foreach($a as $key=>$element) { - $element = ereg_replace('–','-',$element); //remplace les – par un tiret - $element = ereg_replace('’','\'',$element); //remplace les ’ par un apostrophe - $element = ereg_replace('"','"',$element); //remplace les " par une guillemet - $element = ereg_replace('€',chr(128),$element); //remplace les € par le signe euro - $element = ereg_replace('œ',chr(156),$element); //remplace les œ par le signe e dans l'o + $element = str_replace('–','-',$element); //remplace les – par un tiret + $element = str_replace('’','\'',$element); //remplace les ’ par un apostrophe + $element = str_replace('"','"',$element); //remplace les " par une guillemet + $element = str_replace('€',chr(128),$element); //remplace les € par le signe euro + $element = str_replace('œ',chr(156),$element); //remplace les œ par le signe e dans l'o if (!preg_match($pattern, $element)) { //Text if($this->HREF) { diff --git a/htdocs/includes/modules/export/export_csv.modules.php b/htdocs/includes/modules/export/export_csv.modules.php index 51f5add8505..ef2d359bc85 100644 --- a/htdocs/includes/modules/export/export_csv.modules.php +++ b/htdocs/includes/modules/export/export_csv.modules.php @@ -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; } diff --git a/htdocs/includes/modules/export/export_tsv.modules.php b/htdocs/includes/modules/export/export_tsv.modules.php index a645d834573..a9d7cd48ee4 100644 --- a/htdocs/includes/modules/export/export_tsv.modules.php +++ b/htdocs/includes/modules/export/export_tsv.modules.php @@ -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; diff --git a/htdocs/install/etape2.php b/htdocs/install/etape2.php index 4e26d8f5011..ebfce29c23a 100644 --- a/htdocs/install/etape2.php +++ b/htdocs/install/etape2.php @@ -407,7 +407,7 @@ if ($_POST["action"] == "set") { $buffer = fgets($fp, 4096); //print "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 {