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:31:03 +00:00
parent 330bcc041b
commit cfe0d20030
5 changed files with 9 additions and 9 deletions

View File

@ -345,7 +345,7 @@ if (is_dir($aliasDir))
foreach($listoffiles as $file) foreach($listoffiles as $file)
{ {
if (is_file($aliasDir.$file) && ereg('.conf',$file)) if (is_file($aliasDir.$file) && preg_match('/\.conf/',$file))
{ {
$msg = ''; $msg = '';

View File

@ -250,7 +250,7 @@ if ($_REQUEST["action"] == 'update' && ! $_POST["cancel"] && $user->rights->adhe
foreach($_POST as $key => $value) foreach($_POST as $key => $value)
{ {
if (ereg("^options_",$key)) if (preg_match("/^options_/",$key))
{ {
//escape values from POST, at least with addslashes, to avoid obvious SQL injections //escape values from POST, at least with addslashes, to avoid obvious SQL injections
//(array_options is directly input in the DB in adherent.class.php::update()) //(array_options is directly input in the DB in adherent.class.php::update())
@ -374,7 +374,7 @@ if ($_POST["action"] == 'add' && $user->rights->adherent->creer)
$adh->fk_soc = $socid; $adh->fk_soc = $socid;
foreach($_POST as $key => $value) foreach($_POST as $key => $value)
{ {
if (ereg("^options_",$key)) if (preg_match("/^options_/",$key))
{ {
//escape values from POST, at least with addslashes, to avoid obvious SQL injections //escape values from POST, at least with addslashes, to avoid obvious SQL injections
//(array_options is directly input in the DB in adherent.class.php::update()) //(array_options is directly input in the DB in adherent.class.php::update())

View File

@ -136,7 +136,7 @@ $orders = array();
$i = 0; $i = 0;
while (($file = readdir($handle))!==false) while (($file = readdir($handle))!==false)
{ {
if (is_readable($dir.'/'.$file) && ereg('^interface_([^_]+)_(.+)\.class\.php',$file,$reg)) if (is_readable($dir.'/'.$file) && preg_match('/^interface_([^_]+)_(.+)\.class\.php/',$file,$reg))
{ {
$modName = 'Interface'.ucfirst($reg[2]); $modName = 'Interface'.ucfirst($reg[2]);
//print "file=$file"; print "modName=$modName"; exit; //print "file=$file"; print "modName=$modName"; exit;

View File

@ -150,7 +150,7 @@ class Ldap
{ {
foreach ($this->server as $key => $host) foreach ($this->server as $key => $host)
{ {
if (ereg('^ldap',$host)) if (preg_match('/^ldap/',$host))
{ {
$this->connection = ldap_connect($host); $this->connection = ldap_connect($host);
} }
@ -198,7 +198,7 @@ class Ldap
{ {
if ($connected) break; if ($connected) break;
if (ereg('^ldap',$host)) if (preg_match('/^ldap/',$host))
{ {
$this->connection = ldap_connect($host); $this->connection = ldap_connect($host);
} }
@ -635,7 +635,7 @@ class Ldap
$content=''; $content='';
// Create file content // Create file content
if (ereg('^ldap',$this->server[0])) if (preg_match('/^ldap/',$this->server[0]))
{ {
$target="-H ".join(',',$this->server); $target="-H ".join(',',$this->server);
} }

View File

@ -96,7 +96,7 @@ if ($_POST["action"] == 'add')
$error+=1; $error+=1;
$errmsg .= $langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Name"))."<br>\n"; $errmsg .= $langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Name"))."<br>\n";
} }
if (!isset($_POST["email"]) || $_POST["email"] == '' || !ereg('@',$_POST["email"])) if (!isset($_POST["email"]) || $_POST["email"] == '' || !preg_match('/@/',$_POST["email"]))
{ {
$error+=1; $error+=1;
$errmsg .= $langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("EMail"))."<br>\n"; $errmsg .= $langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("EMail"))."<br>\n";
@ -151,7 +151,7 @@ if ($_POST["action"] == 'add')
$adh->morphy = $_POST["morphy"]; $adh->morphy = $_POST["morphy"];
foreach($_POST as $key => $value){ foreach($_POST as $key => $value){
if (ereg("^options_",$key)){ if (preg_match("/^options_/",$key)){
$adh->array_options[$key]=$_POST[$key]; $adh->array_options[$key]=$_POST[$key];
} }
} }