mirror of
https://gitlab.easter-eggs.com/ee/ldapsaisie.git
synced 2024-11-22 18:09:06 +01:00
Replace ereg() function call by preg_match()
This commit is contained in:
parent
593a4c5e96
commit
7c45bfe833
9 changed files with 22 additions and 24 deletions
|
@ -43,7 +43,7 @@
|
|||
<varlistentry>
|
||||
<term>remoteRootPathRegex</term>
|
||||
<listitem>
|
||||
<simpara>Expression régulière facultative dont le but est de
|
||||
<simpara>Expression régulière (compatible Perl) facultative dont le but est de
|
||||
<emphasis>matcher</emphasis> dans la valeur complète du chemin distant de la
|
||||
<emphasis>maildir</emphasis>, le chemin de la <emphasis>maildir</emphasis>
|
||||
à créer une fois connecté sur le serveur.</simpara>
|
||||
|
@ -52,7 +52,7 @@
|
|||
se connecte arrive directement dans <emphasis>/home/vmail</emphasis>, et faut
|
||||
définir le paramètre <parameter>remoteRootPathRegex</parameter> de la manière
|
||||
suivante :
|
||||
<programlisting linenumbering="unnumbered">^\/home\/vmail\/([^\/]*)\/+$</programlisting>
|
||||
<programlisting linenumbering="unnumbered">/^\/home\/vmail\/([^\/]*)\/+$/</programlisting>
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
|
|
@ -41,10 +41,8 @@ define('LS_MAILDIR_FTP_PWD','password');
|
|||
// Serveur FTP - Maildir Path
|
||||
define('LS_MAILDIR_FTP_MAILDIR_PATH','%{mailbox}');
|
||||
|
||||
// Serveur FTP - Maildir Path Regex
|
||||
define('LS_MAILDIR_FTP_MAILDIR_PATH_REGEX','^\/home\/vmail\/([^\/]+)\/$');
|
||||
// Serveur FTP - Maildir Path Regex (Perl compatible)
|
||||
define('LS_MAILDIR_FTP_MAILDIR_PATH_REGEX','/^\/home\/vmail\/([^\/]+)\/$/');
|
||||
|
||||
// Serveur FTP - Maildir CHMOD
|
||||
define('LS_MAILDIR_FTP_MAILDIR_CHMOD','700');
|
||||
|
||||
?>
|
||||
|
|
|
@ -146,7 +146,7 @@ $retval=true;
|
|||
$dir = getFData(LS_MAILDIR_FTP_MAILDIR_PATH,$ldapObject,'getValue');
|
||||
|
||||
if (LS_MAILDIR_FTP_MAILDIR_PATH_REGEX != "") {
|
||||
if (ereg(LS_MAILDIR_FTP_MAILDIR_PATH_REGEX,$dir,$regs)) {
|
||||
if (preg_match(LS_MAILDIR_FTP_MAILDIR_PATH_REGEX,$dir,$regs)) {
|
||||
$dir = $regs[1];
|
||||
}
|
||||
else {
|
||||
|
|
|
@ -114,7 +114,7 @@ class LSattr_html_maildir extends LSattr_html {
|
|||
}
|
||||
if ($this -> config['html_options']['remoteRootPathRegex']) {
|
||||
if (
|
||||
ereg($this -> config['html_options']['remoteRootPathRegex'],$val,$r)
|
||||
preg_match($this -> config['html_options']['remoteRootPathRegex'],$val,$r)
|
||||
||
|
||||
empty($val)
|
||||
)
|
||||
|
|
|
@ -54,7 +54,7 @@ class LSformElement_mailQuota extends LSformElement {
|
|||
$quotas=array();
|
||||
|
||||
foreach ($this -> values as $value) {
|
||||
if (ereg('([0-9]*)'.$this -> getSuffix(),$value,$regs)) {
|
||||
if (preg_match('/([0-9]*)/'.$this -> getSuffix(),$value,$regs)) {
|
||||
$infos = array(
|
||||
'size' => $regs[1]
|
||||
);
|
||||
|
|
|
@ -54,7 +54,7 @@ class LSformElement_quota extends LSformElement {
|
|||
$quotas=array();
|
||||
|
||||
foreach ($this -> values as $value) {
|
||||
if (ereg('^([0-9]*)$',$value,$regs)) {
|
||||
if (preg_match('/^([0-9]*)$/',$value,$regs)) {
|
||||
$infos = array(
|
||||
'size' => ceil($regs[1]/$this -> getFactor())
|
||||
);
|
||||
|
|
|
@ -87,7 +87,7 @@ class LSformElement_valueWithUnit extends LSformElement {
|
|||
|
||||
if ($units) {
|
||||
foreach ($this -> values as $value) {
|
||||
if (ereg('^([0-9]*)$',$value,$regs)) {
|
||||
if (preg_match('/^([0-9]*)$/',$value,$regs)) {
|
||||
$infos = array(
|
||||
'value' => $regs[1]
|
||||
);
|
||||
|
|
|
@ -394,15 +394,15 @@ class LSsession {
|
|||
public static function getLangList() {
|
||||
$list=array('en_US');
|
||||
if (self :: $encoding) {
|
||||
$regex = '^([a-zA-Z_]*)\.'.self :: $encoding.'$';
|
||||
$regex = '/^([a-zA-Z_]*)\.'.self :: $encoding.'$/';
|
||||
}
|
||||
else {
|
||||
$regex = '^([a-zA-Z_]*)$';
|
||||
$regex = '/^([a-zA-Z_]*)$/';
|
||||
}
|
||||
if ($handle = opendir(LS_I18N_DIR)) {
|
||||
while (false !== ($file = readdir($handle))) {
|
||||
if(is_dir(LS_I18N_DIR.'/'.$file)) {
|
||||
if (ereg($regex,$file,$regs)) {
|
||||
if (preg_match($regex,$file,$regs)) {
|
||||
if (!in_array($regs[1],$list)) {
|
||||
$list[]=$regs[1];
|
||||
}
|
||||
|
|
|
@ -52,7 +52,7 @@ function getFData($format,$data,$meth=NULL) {
|
|||
* - 7 : ! or _
|
||||
* - 8 : ~
|
||||
*/
|
||||
$expr="%[{(]([A-Za-z0-9]+)(\:(-?[0-9])+)?(\:(-?[0-9]+))?(-)?(\!|\_)?(~)?[})]";
|
||||
$expr="/%[{(]([A-Za-z0-9]+)(\:(-?[0-9])+)?(\:(-?[0-9]+))?(-)?(\!|\_)?(~)?[})]/";
|
||||
if(!is_array($format)) {
|
||||
$format=array($format);
|
||||
$unique=true;
|
||||
|
@ -60,7 +60,7 @@ function getFData($format,$data,$meth=NULL) {
|
|||
for($i=0;$i<count($format);$i++) {
|
||||
if(is_array($data)) {
|
||||
if ($meth==NULL) {
|
||||
while (ereg($expr,$format[$i],$ch)) {
|
||||
while (preg_match($expr,$format[$i],$ch)) {
|
||||
if (is_array($data[$ch[1]])) {
|
||||
$val = $data[$ch[1]][0];
|
||||
}
|
||||
|
@ -72,7 +72,7 @@ function getFData($format,$data,$meth=NULL) {
|
|||
}
|
||||
}
|
||||
else {
|
||||
while (ereg($expr,$format[$i],$ch)) {
|
||||
while (preg_match($expr,$format[$i],$ch)) {
|
||||
if (method_exists($data[$ch[1]],$meth)) {
|
||||
$value = $data[$ch[1]] -> $meth();
|
||||
if (is_array($value)) {
|
||||
|
@ -90,7 +90,7 @@ function getFData($format,$data,$meth=NULL) {
|
|||
}
|
||||
elseif (is_object($data)) {
|
||||
if ($meth==NULL) {
|
||||
while (ereg($expr,$format[$i],$ch)) {
|
||||
while (preg_match($expr,$format[$i],$ch)) {
|
||||
$value = $data -> $ch[1];
|
||||
if (is_array($value)) {
|
||||
$value = $value[0];
|
||||
|
@ -100,7 +100,7 @@ function getFData($format,$data,$meth=NULL) {
|
|||
}
|
||||
}
|
||||
else {
|
||||
while (ereg($expr,$format[$i],$ch)) {
|
||||
while (preg_match($expr,$format[$i],$ch)) {
|
||||
if (method_exists($data,$meth)) {
|
||||
$value = $data -> $meth($ch[1]);
|
||||
if (is_array($value)) {
|
||||
|
@ -117,7 +117,7 @@ function getFData($format,$data,$meth=NULL) {
|
|||
}
|
||||
}
|
||||
else {
|
||||
while (ereg($expr,$format[$i],$ch)) {
|
||||
while (preg_match($expr,$format[$i],$ch)) {
|
||||
$val=_getFData_extractAndModify($data,$ch);
|
||||
$format[$i]=str_replace($ch[0],$val,$format[$i]);
|
||||
}
|
||||
|
@ -194,18 +194,18 @@ function _getFData_extractAndModify($data,$ch) {
|
|||
|
||||
function getFieldInFormat($format) {
|
||||
$fields=array();
|
||||
$expr="%[{(]([A-Za-z0-9]+)(\:(-?[0-9])+)?(\:(-?[0-9]+))?(-)?(\!|\_)?(~)?[})]";
|
||||
while (ereg($expr,$format,$ch)) {
|
||||
$expr='/%[{(]([A-Za-z0-9]+)(\:(-?[0-9])+)?(\:(-?[0-9]+))?(-)?(\!|\_)?(~)?[})]/';
|
||||
while (preg_match($expr,$format,$ch)) {
|
||||
$fields[]=$ch[1];
|
||||
$format=str_replace($ch[0],'',$format);
|
||||
}
|
||||
return $fields;
|
||||
}
|
||||
|
||||
function loadDir($dir,$regexpr='^.*\.php$') {
|
||||
function loadDir($dir,$regexpr='/^.*\.php$/') {
|
||||
if ($handle = opendir($dir)) {
|
||||
while (false !== ($file = readdir($handle))) {
|
||||
if (ereg($regexpr,$file)) {
|
||||
if (preg_match($regexpr,$file)) {
|
||||
require_once($dir.'/'.$file);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue