Fix delimiteur for regex in preg_replace

This commit is contained in:
Victor LABORIE 2017-10-11 13:43:42 +02:00
parent 89dc9a9633
commit 5f1763b13e
5 changed files with 7 additions and 9 deletions

View file

@ -177,7 +177,7 @@ if (isset($_SESSION['login']))
if (!$conf['domaines']['onlyone']) {
$info[0]['mailacceptinggeneralid'][$i] =
preg_replace('@'.$_SESSION['domain'],'',$info[0]['mailacceptinggeneralid'][$i]);
preg_replace("/".@$_SESSION['domain']."/",'',$info[0]['mailacceptinggeneralid'][$i]);
}
print "<tr><td align='right'>Mail accept&eacute; en entr&eacute;e :</td>

View file

@ -426,7 +426,7 @@ if (isset($_SESSION['login']))
if (!$conf['domaines']['onlyone']) {
$info[0]['mailacceptinggeneralid'][$i] =
preg_replace('@'.$_SESSION['domain'],'',$info[0]['mailacceptinggeneralid'][$i]);
preg_replace("/@".$_SESSION['domain']."/",'',$info[0]['mailacceptinggeneralid'][$i]);
}
print "<tr><td align='right'>Mail accept&eacute; en entr&eacute;e :</td>

View file

@ -45,7 +45,7 @@ class Html
function clean2($texte)
{
$texte = htmlentities(strip_tags($texte),ENT_NOQUOTES);
$texte = preg_replace('\[([^"^=]+)=(http://[^"^[:space:]]+)\]',
$texte = preg_replace('/\[([^"^=]+)=(http:\/\/[^"^[:space:]]+)\]/',
'<a href="\\2">\\1</a>',$texte);
return addslashes($texte);
@ -82,7 +82,7 @@ class Html
while(list($car,$val) = each($couple))
{
$texte = preg_replace($car,$val,$texte);
$texte = preg_replace("/".$car."/",$val,$texte);
}
return $texte;

View file

@ -16,7 +16,7 @@ class Math
// Pour eviter -0.00
if ( number_format($param, 2, '.', ' ') == -0.00 ) $param = 0.00;
return preg_replace('x','&nbsp;',number_format($param, 2, '.', 'x'));
return preg_replace('/x/','&nbsp;',number_format($param, 2, '.', 'x'));
}
function LongCode($param)

View file

@ -139,12 +139,10 @@ if (isset($_SESSION['login'])) {
// we select domain in your DN
// thanks to http://www.physiol.ox.ac.uk/~trp/regexp.html
if ($conf['evoadmin']['version'] <= 2) {
$mydomain = preg_replace("/uid=" .$login. ",domain=((?:(?:[0-9a-zA-Z_\-]+)\.){1,}(?:[0-9a-zA-Z_\-]+)),"
. LDAP_BASE ."/","$1",$_SESSION['dn']);
$mydomain = preg_replace("/\/uid=".$login.",domain=((?:(?:[0-9a-zA-Z_\-]+)\.){1,}(?:[0-9a-zA-Z_\-]+)),".LDAP_BASE."\//","$1",$_SESSION['dn']);
}
else {
$mydomain = preg_replace("/uid=" .$login. ",cn=((?:(?:[0-9a-zA-Z_\-]+)\.){1,}(?:[0-9a-zA-Z_\-]+)),"
. LDAP_BASE ."/","$1",$_SESSION['dn']);
$mydomain = preg_replace("/\/uid=".$login.",cn=((?:(?:[0-9a-zA-Z_\-]+)\.){1,}(?:[0-9a-zA-Z_\-]+)),".LDAP_BASE."\//","$1",$_SESSION['dn']);
}
array_push($domaines,$mydomain);