2
0
forked from Wavyzz/dolibarr

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

This commit is contained in:
Regis Houssin
2009-10-22 10:12:45 +00:00
parent d9438463fe
commit c8db07011a
7 changed files with 23 additions and 17 deletions

View File

@@ -52,9 +52,9 @@ function barcode_encode_ean($ean, $encoding = "EAN-13"){
}
$encoding=strtoupper($encoding);
if ($encoding=="ISBN"){
if (!ereg("^978", $ean)) $ean="978".$ean;
if (!preg_match("/^978/", $ean)) $ean="978".$ean;
}
if (ereg("^978", $ean)) $encoding="ISBN";
if (preg_match("/^978/", $ean)) $encoding="ISBN";
if (strlen($ean)<12 || strlen($ean)>13){
return array("text"=>"Invalid $encoding Code (must have 12/13 numbers)");
}