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

This commit is contained in:
Regis Houssin 2009-10-20 19:31:06 +00:00
parent 8f51502826
commit 8090f62623
5 changed files with 15 additions and 18 deletions

View File

@ -120,9 +120,8 @@ print "<br>";
// Show message
$message='';
$slash = '/';
$backslash = strtr($slash, '/', '\\');
$urlwithouturlroot=preg_replace('/'.$backslash.DOL_URL_ROOT.'$/i','',$dolibarr_main_url_root);
$pattern = str_replace('/','\/',DOL_URL_ROOT); // Add backslashes for regular expression
$urlwithouturlroot=preg_replace('/'.$pattern.'$/i','',$dolibarr_main_url_root);
$urlvcal='<a href="'.DOL_URL_ROOT.'/comm/action/agendaexport.php?format=vcal&exportkey='.($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY?urlencode($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY):'...').'" target="_blank">'.$urlwithouturlroot.DOL_URL_ROOT.'/comm/action/agendaexport.php?format=vcal&exportkey='.($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY?urlencode($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY):'KEYNOTDEFINED').'</a>';
$message.=$langs->trans("WebCalUrlForVCalExport",'vcal',$urlvcal);
$message.='<br>';

View File

@ -160,9 +160,8 @@ print '<br><br>';
print '<u>'.$langs->trans("FollowingUrlAreAvailableToMakePayments").':</u><br>';
// Should work with DOL_URL_ROOT='' or DOL_URL_ROOT='/dolibarr'
$firstpart=$dolibarr_main_url_root;
$slash = '/';
$backslash = strtr($slash, '/', '\\');
$regex='/'.$backslash.DOL_URL_ROOT.'$/i';
$pattern = str_replace('/','\/',DOL_URL_ROOT); // Add backslashes for regular expression
$regex='/'.$pattern.'$/i';
$firstpart=preg_replace($regex,'',$firstpart);
print '<br>';
print img_picto('','puce.png').' '.$langs->trans("ToOfferALinkForOnlinePaymentOnFreeAmount",$servicename).':<br>';

View File

@ -313,9 +313,8 @@ print "<br>";
// Show message
$message='';
$slash = '/';
$backslash = strtr($slash, '/', '\\');
$urlwithouturlroot=preg_replace('/'.$backslash.DOL_URL_ROOT.'$/i','',$dolibarr_main_url_root);
$pattern = str_replace('/','\/',DOL_URL_ROOT); // Add backslashes for regular expression
$urlwithouturlroot=preg_replace('/'.$pattern.'$/i','',$dolibarr_main_url_root);
$urlvcal='<a href="'.DOL_URL_ROOT.'/webcal/webcalexport.php?format=vcal&exportkey='.$conf->global->PHPWEBCALENDAR_PASSWORD_VCALEXPORT.'" target="_blank">'.$urlwithouturlroot.DOL_URL_ROOT.'/webcal/webcalexport.php?format=vcal&exportkey='.$conf->global->PHPWEBCALENDAR_PASSWORD_VCALEXPORT.'</a>';
$message.=$langs->trans("WebCalUrlForVCalExport",'vcal',$urlvcal);
$message.='<br>';

View File

@ -92,9 +92,8 @@ print '<br><br>';
// Should work with DOL_URL_ROOT='' or DOL_URL_ROOT='/dolibarr'
$firstpart=$dolibarr_main_url_root;
$slash = '/';
$backslash = strtr($slash, '/', '\\');
$regex='/'.$backslash.DOL_URL_ROOT.'$/i';
$pattern = str_replace('/','\/',DOL_URL_ROOT); // Add backslashes for regular expression
$regex='/'.$pattern.'$/i';
$firstpart=preg_replace($regex,'',$firstpart);
print '<u>'.$langs->trans("WSDLCanBeDownloadedHere").':</u><br>';

View File

@ -612,7 +612,7 @@ class Categorie
$this->cats[$id_categ]['fulllabel']=$this->cats[$id_categ]['label'];
}
// We count number of _ to have level
$this->cats[$id_categ]['level']=strlen(eregi_replace('[^_]','',$this->cats[$id_categ]['fullpath']));
$this->cats[$id_categ]['level']=strlen(preg_replace('/[^_]/i','',$this->cats[$id_categ]['fullpath']));
// Process all childs on several levels of this category
$protection++;
@ -1059,9 +1059,9 @@ class Categorie
// On determine nom du fichier vignette
$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];
}
// Objet
@ -1091,15 +1091,16 @@ class Categorie
{
$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
$dir = str_replace('/','\/',$dir); // Add backslashes for regular expression
$filename = preg_replace('/'.$dir.'/i','',$file); // Nom du fichier
// On efface l'image d'origine
dol_delete_file($file,1);
// 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,1);