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 17:21:19 +00:00
parent 0a48416c7d
commit 53737028b9
10 changed files with 39 additions and 33 deletions

View File

@ -182,7 +182,7 @@ print "<tr ".$bc[$var].">";
print "<td>".$langs->trans("Password")."</td>";
print "<td><input type=\"password\" class=\"flat\" name=\"oscommerce_dbpass\" value=\"" . ($_POST["oscommerce_dbpass"]?$_POST["oscommerce_dbpass"]:$conf->global->OSC_DB_PASS) . "\" size=\"30\"></td>";
print '<td>';
//if ($dolibarr_main_db_pass) print '__dolibarr_main_db_pass__ <i>('.eregi_replace('.','*',$dolibarr_main_db_pass).')</i>';
//if ($dolibarr_main_db_pass) print '__dolibarr_main_db_pass__ <i>('.preg_replace('/./i','*',$dolibarr_main_db_pass).')</i>';
print '&nbsp;</td>';
print "</tr>";
$var=!$var;
@ -190,7 +190,7 @@ print "<tr ".$bc[$var].">";
print "<td>".$langs->trans("PasswordRetype")."</td>";
print "<td><input type=\"password\" class=\"flat\" name=\"oscommerce_dbpass2\" value=\"" . ($_POST["oscommerce_dbpass2"]?$_POST["oscommerce_dbpass2"]:$conf->global->OSC_DB_PASS) ."\" size=\"30\"></td>";
print '<td>';
//if ($dolibarr_main_db_pass) print '__dolibarr_main_db_pass__ <i>('.eregi_replace('.','*',$dolibarr_main_db_pass).')</i>';
//if ($dolibarr_main_db_pass) print '__dolibarr_main_db_pass__ <i>('.preg_replace('/./i','*',$dolibarr_main_db_pass).')</i>';
print '&nbsp;</td>';
print "</tr>";
print "</table>";

View File

@ -32,7 +32,7 @@ $langs->load("admin");
if (!$user->admin)
accessforbidden();
// Définition des positions possibles pour les boites
// D<EFBFBD>finition des positions possibles pour les boites
$pos_array = array(0); // Positions possibles pour une boite (0,1,2,...)
$pos_name = array(0=>$langs->trans("Home")); // Nom des positions 0=Homepage, 1=...
$boxes = array();
@ -170,7 +170,7 @@ if ($resql)
array_push($actives,$obj->box_id);
if ($obj->box_order == '' || $obj->box_order == '0' || $decalage) $decalage++;
// On renumérote l'ordre des boites si l'une d'elle est à ''
// On renum<EFBFBD>rote l'ordre des boites si l'une d'elle est <20> ''
// This occurs just after an insert.
if ($decalage)
{
@ -261,7 +261,7 @@ if ($resql)
{
$obj = $db->fetch_object($resql);
$module=eregi_replace('.php$','',$obj->file);
$module=preg_replace('/.php$/i','',$obj->file);
include_once(DOL_DOCUMENT_ROOT."/includes/boxes/".$module.".php");
$box=new $module($db,$obj->note);
@ -269,7 +269,7 @@ if ($resql)
// if (in_array($obj->rowid, $actives) && $box->box_multiple <> 1)
if (in_array($obj->rowid, $actives))
{
// La boite est déjà activée
// La boite est deja activee
}
else
{
@ -277,7 +277,7 @@ if ($resql)
print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
$logo=eregi_replace("^object_","",$box->boximg);
$logo=preg_replace("/^object_/i","",$box->boximg);
print '<tr '.$bc[$var].'>';
print '<td>'.img_object("",$logo).' '.$box->boxlabel.'</td>';
print '<td>' . ($obj->note?$obj->note:'&nbsp;') . '</td>';
@ -303,7 +303,7 @@ if ($resql)
print '</table>';
/*
* Boites activées
* Boites activ<EFBFBD>es
*
*/
@ -346,11 +346,11 @@ if ($resql)
$var = ! $var;
$objnext = $db->fetch_object($resql);
$module=eregi_replace('.php$','',$obj->file);
$module=preg_replace('/.php$/i','',$obj->file);
include_once(DOL_DOCUMENT_ROOT."/includes/boxes/".$module.".php");
$box=new $module($db,$obj->note);
$logo=eregi_replace("^object_","",$box->boximg);
$logo=preg_replace("/^object_/i","",$box->boximg);
print '<tr '.$bc[$var].'>';
print '<td>'.img_object("",$logo).' '.$box->boxlabel.'</td>';
print '<td>' . ($obj->note?$obj->note:'&nbsp;') . '</td>';

View File

@ -484,8 +484,8 @@ if ($_GET["id"])
}
$sql.=", ";
// Remove from default sort order the choosed order
$tabsqlsort[$_GET["id"]]=eregi_replace($_GET["sortfield"].' '.$_GET["sortorder"].',','',$tabsqlsort[$_GET["id"]]);
$tabsqlsort[$_GET["id"]]=eregi_replace($_GET["sortfield"].',','',$tabsqlsort[$_GET["id"]]);
$tabsqlsort[$_GET["id"]]=preg_replace('/'.$_GET["sortfield"].' '.$_GET["sortorder"].',/i','',$tabsqlsort[$_GET["id"]]);
$tabsqlsort[$_GET["id"]]=preg_replace('/'.$_GET["sortfield"].',/i','',$tabsqlsort[$_GET["id"]]);
}
else {
$sql.=" ORDER BY ";

View File

@ -270,13 +270,13 @@ if (function_exists("ldap_connect"))
if ($result == 2)
{
print img_picto('','info').' ';
print '<font class="ok">'.$langs->trans("LDAPBindOK",$conf->global->LDAP_SERVER_HOST,$conf->global->LDAP_SERVER_PORT,$conf->global->LDAP_ADMIN_DN,eregi_replace('.','*',$conf->global->LDAP_ADMIN_PASS)).'</font>';
print '<font class="ok">'.$langs->trans("LDAPBindOK",$conf->global->LDAP_SERVER_HOST,$conf->global->LDAP_SERVER_PORT,$conf->global->LDAP_ADMIN_DN,preg_replace('/./i','*',$conf->global->LDAP_ADMIN_PASS)).'</font>';
print '<br>';
}
else
{
print img_picto('','error').' ';
print '<font class="error">'.$langs->trans("LDAPBindKO",$conf->global->LDAP_SERVER_HOST,$conf->global->LDAP_SERVER_PORT,$conf->global->LDAP_ADMIN_DN,eregi_replace('.','*',$conf->global->LDAP_ADMIN_PASS)).'</font>';
print '<font class="error">'.$langs->trans("LDAPBindKO",$conf->global->LDAP_SERVER_HOST,$conf->global->LDAP_SERVER_PORT,$conf->global->LDAP_ADMIN_DN,preg_replace('/./i','*',$conf->global->LDAP_ADMIN_PASS)).'</font>';
print '<br>';
print $langs->trans("Error").' '.$ldap->error;
print '<br>';

View File

@ -182,7 +182,7 @@ print "<tr class=\"impair\">";
print "<td>".$langs->trans("Password")."</td>";
print "<td><input type=\"password\" class=\"flat\" name=\"phpmantis_pass\" value=\"" . ($_POST["phpmantis_pass"]?$_POST["phpmantis_pass"]:$conf->global->PHPMANTIS_PASS) . "\" size=\"30\"></td>";
print '<td>';
//if ($dolibarr_main_db_pass) print '__dolibarr_main_db_pass__ <i>('.eregi_replace('.','*',$dolibarr_main_db_pass).')</i>';
//if ($dolibarr_main_db_pass) print '__dolibarr_main_db_pass__ <i>('.preg_replace('/./i','*',$dolibarr_main_db_pass).')</i>';
print '&nbsp;</td>';
print "</tr>";

View File

@ -58,10 +58,10 @@ if (isset($_POST["action"]) && $_POST["action"] == 'update')
// Define list of menu handlers to initialize
$listofmenuhandler=array();
$listofmenuhandler[eregi_replace('((_back|_front)office)?\.php','',$_POST["main_menu_barretop"])]=1;
$listofmenuhandler[eregi_replace('((_back|_front)office)?\.php','',$_POST["main_menufront_barretop"])]=1;
$listofmenuhandler[eregi_replace('((_back|_front)office)?\.php','',$_POST["main_menu_barreleft"])]=1;
$listofmenuhandler[eregi_replace('((_back|_front)office)?\.php','',$_POST["main_menufront_barreleft"])]=1;
$listofmenuhandler[preg_replace('/((_back|_front)office)?\.php/i','',$_POST["main_menu_barretop"])]=1;
$listofmenuhandler[preg_replace('/((_back|_front)office)?\.php/i','',$_POST["main_menufront_barretop"])]=1;
$listofmenuhandler[preg_replace('/((_back|_front)office)?\.php/i','',$_POST["main_menu_barreleft"])]=1;
$listofmenuhandler[preg_replace('/((_back|_front)office)?\.php/i','',$_POST["main_menufront_barreleft"])]=1;
foreach ($listofmenuhandler as $key => $val)
{
//print "x".$key;
@ -181,11 +181,11 @@ else
$var=!$var;
print '<tr '.$bc[$var].'><td>'.$langs->trans("DefaultMenuTopManager").'</td>';
print '<td>';
$filelib=eregi_replace('\.php$','',$conf->global->MAIN_MENU_BARRETOP);
$filelib=preg_replace('/.php$/i','',$conf->global->MAIN_MENU_BARRETOP);
print $filelib;
print '</td>';
print '<td>';
$filelib=eregi_replace('\.php$','',$conf->global->MAIN_MENUFRONT_BARRETOP);
$filelib=preg_replace('/.php$/i','',$conf->global->MAIN_MENUFRONT_BARRETOP);
print $filelib;
print '</td>';
print '</tr>';
@ -194,11 +194,11 @@ else
print '<tr '.$bc[$var].'>';
print '<td>'.$langs->trans("DefaultMenuLeftManager").'</td>';
print '<td>';
$filelib=eregi_replace('\.php$','',$conf->global->MAIN_MENU_BARRELEFT);
$filelib=preg_replace('/.php$/i','',$conf->global->MAIN_MENU_BARRELEFT);
print $filelib;
print '</td>';
print '<td>';
$filelib=eregi_replace('\.php$','',$conf->global->MAIN_MENUFRONT_BARRELEFT);
$filelib=preg_replace('/.php$/i','',$conf->global->MAIN_MENUFRONT_BARRELEFT);
print $filelib;
print '</td>';
print '</tr>';

View File

@ -166,10 +166,10 @@ function UnActivate($value,$requiredby=1)
else
{
$genericMod = new DolibarrModules($db);
$genericMod->name=eregi_replace('^mod','',$modName);
$genericMod->name=preg_replace('/^mod/i','',$modName);
$genericMod->style_sheet=1;
$genericMod->rights_class=strtolower(eregi_replace('^mod','',$modName));
$genericMod->const_name='MAIN_MODULE_'.strtoupper(eregi_replace('^mod','',$modName));
$genericMod->rights_class=strtolower(preg_replace('/^mod/i','',$modName));
$genericMod->const_name='MAIN_MODULE_'.strtoupper(preg_replace('/^mod/i','',$modName));
dol_syslog("modules::UnActivate Failed to find module file, we use generic function with name ".$genericMod->name);
$genericMod->_remove();
}
@ -244,7 +244,7 @@ foreach ($conf->file->dol_document_root as $dirroot)
if (! empty($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;
@ -364,7 +364,7 @@ foreach ($orders as $key => $value)
$modName = $filename[$key];
$objMod = $modules[$key];
$const_name = 'MAIN_MODULE_'.strtoupper(eregi_replace('^mod','',get_class($objMod)));
$const_name = 'MAIN_MODULE_'.strtoupper(preg_replace('/^mod/i','',get_class($objMod)));
// Load all lang files of module
if (isset($objMod->langfiles) && is_array($objMod->langfiles))

View File

@ -160,8 +160,10 @@ 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;
$regex=DOL_URL_ROOT.'$';
$firstpart=eregi_replace($regex,'',$firstpart);
$slash = '/';
$backslash = strtr($slash, '/', '\\');
$regex='/'.$backslash.DOL_URL_ROOT.'$/i';
$firstpart=preg_replace($regex,'',$firstpart);
print '<br>';
print img_picto('','puce.png').' '.$langs->trans("ToOfferALinkForOnlinePaymentOnFreeAmount",$servicename).':<br>';
print '<b>'.$firstpart.DOL_URL_ROOT.'/public/paybox/newpayment.php?amount=<i>9.99</i>&tag=<i>your_free_tag</i></b>'."<br>\n";

View File

@ -202,7 +202,7 @@ print "<tr class=\"impair\">";
print "<td>".$langs->trans("Password")."</td>";
print "<td><input type=\"password\" class=\"flat\" name=\"phpwebcalendar_pass\" value=\"" . ($_POST["phpwebcalendar_pass"]?$_POST["phpwebcalendar_pass"]:$conf->global->PHPWEBCALENDAR_PASS) . "\" size=\"30\"></td>";
print '<td>';
//if ($dolibarr_main_db_pass) print '__dolibarr_main_db_pass__ <i>('.eregi_replace('.','*',$dolibarr_main_db_pass).')</i>';
//if ($dolibarr_main_db_pass) print '__dolibarr_main_db_pass__ <i>('.preg_replace('/./i','*',$dolibarr_main_db_pass).')</i>';
print '&nbsp;</td>';
print "</tr>";
@ -313,7 +313,9 @@ print "<br>";
// Show message
$message='';
$urlwithouturlroot=eregi_replace(DOL_URL_ROOT.'$','',$dolibarr_main_url_root);
$slash = '/';
$backslash = strtr($slash, '/', '\\');
$urlwithouturlroot=eregi_replace('/'.$backslash.DOL_URL_ROOT.'$/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,7 +92,9 @@ print '<br><br>';
// Should work with DOL_URL_ROOT='' or DOL_URL_ROOT='/dolibarr'
$firstpart=$dolibarr_main_url_root;
$regex=DOL_URL_ROOT.'$';
$slash = '/';
$backslash = strtr($slash, '/', '\\');
$regex='/'.$backslash.DOL_URL_ROOT.'$/i';
$firstpart=eregi_replace($regex,'',$firstpart);
print '<u>'.$langs->trans("WSDLCanBeDownloadedHere").':</u><br>';