Merge branch 'master' of ssh://git.labs.libre-entreprise.org/gitroot/ldapsaisie

This commit is contained in:
Benjamin Renard 2011-05-01 16:44:58 +02:00
commit dcd555bead
5 changed files with 50 additions and 15 deletions

View file

@ -2,6 +2,28 @@
<title>LSattr_html_mailQuota</title>
<para>Ce type est utilisé pour la gestion des attributs dont la valeur est
le quota d'une boite mail. Le format de la valeur générée correspondant au format
attendu par le serveur de mail &courier;. Exemple : <emphasis>50000000S</emphasis>
attendu par le serveur de mail &courier; par défaut. Exemple : <emphasis>50000000S</emphasis>
correspond à un quota de 50Mio.</para>
<programlisting linenumbering="unnumbered">
<citetitle>Structure</citetitle>...
<![CDATA['html_options' => array(
'suffix' => '[suffix]',
)
),]]>
...
</programlisting>
<variablelist>
<title>Paramètres de configuration</title>
<varlistentry>
<term>suffix</term>
<listitem>
<simpara>Chaine de caractères suffixant la valeur du quota (Par défaut : <literal>S</literal>).</simpara>
</listitem>
</varlistentry>
</variablelist>
</sect4>

View file

@ -64,6 +64,7 @@ class LSerror {
*/
public static function addErrorCode($code=-1,$msg='') {
$_SESSION['LSerror'][] = array($code,$msg);
LSlog('[ERROR] '.self::getError(array($code,$msg)));
}
/**
@ -114,7 +115,7 @@ class LSerror {
public static function getErrors() {
if(!empty($_SESSION['LSerror'])) {
foreach ($_SESSION['LSerror'] as $error) {
$txt.=self::getError($error);
$txt.=self::getError($error)."<br />\n";
}
self::resetError();
return $txt;
@ -130,7 +131,7 @@ class LSerror {
* @retvat string Le texte des erreurs
*/
private static function getError($error) {
return "(Code ".$error[0].") ".getFData(self :: $_errorCodes[$error[0]]['msg'],$error[1])."<br />\n";
return "(Code ".$error[0].") ".getFData(self :: $_errorCodes[$error[0]]['msg'],$error[1]);
}
/**

View file

@ -54,7 +54,7 @@ class LSformElement_mailQuota extends LSformElement {
$quotas=array();
foreach ($this -> values as $value) {
if (ereg('([0-9]*)S',$value,$regs)) {
if (ereg('([0-9]*)'.$this -> getSuffix(),$value,$regs)) {
$infos = array(
'size' => $regs[1]
);
@ -107,7 +107,21 @@ class LSformElement_mailQuota extends LSformElement {
)
);
}
/**
* Return suffix value
*
* @retval string Suffix value
**/
function getSuffix() {
if(isset($this -> params['html_options']['suffix'])){
return strval($this -> params['html_options']['suffix']);
}
else {
return "S";
}
}
/**
* Recupère la valeur de l'élement passée en POST
*
@ -136,7 +150,7 @@ class LSformElement_mailQuota extends LSformElement {
if (isset($_POST[$this -> name.'_sizeFact'][$key]) && ($_POST[$this -> name.'_sizeFact'][$key]!=1)) {
$f = $_POST[$this -> name.'_sizeFact'][$key];
}
$return[$this -> name][$key] = ($val*$f).'S';
$return[$this -> name][$key] = ($val*$f).$this->getSuffix();
}
}
return true;

View file

@ -318,7 +318,8 @@ class LSldap {
else {
if (!empty($dropAttr)) {
foreach($dropAttr as $attr) {
if(Net_LDAP2::isError($entry -> getValue($attr))) {
$value = $entry -> getValue($attr);
if(Net_LDAP2::isError($value) || empty($value)) {
// Attribut n'existe pas dans l'annuaire
continue;
}

View file

@ -219,16 +219,13 @@ function varDump($data) {
$GLOBALS['LSdebug_fields']=array();
function LSdebug($data,$dump=false) {
if ($dump) {
$GLOBALS['LSdebug_fields'][]=varDump($data);
$data=varDump($data);
}
else {
if (is_array($data)||is_object($data)) {
$GLOBALS['LSdebug_fields'][]=$data;
}
else {
$GLOBALS['LSdebug_fields'][]="[$data]";
}
else if (!is_array($data) && !is_object($data)) {
$data="[$data]";
}
$GLOBALS['LSdebug_fields'][]=$data;
LSlog('[DEBUG] '.$data);
return true;
}