diff --git a/doc/conf/LSobject.docbook b/doc/conf/LSobject.docbook
index 0b906dc8..e0a9ff57 100644
--- a/doc/conf/LSobject.docbook
+++ b/doc/conf/LSobject.docbook
@@ -25,6 +25,8 @@
...
),
'rdn' => 'attr1',
+
+ 'LSaddons' => [LSaddon(s)],
'container_dn' => 'ou=people',
'container_auto_create' => array(
@@ -81,6 +83,15 @@
+
+ LSaddons
+
+ LSaddon(s) dont le type d'objet dépend. Ce peut être un tableau de chaînes de
+ caractères ou une simpe chaîne de caractères correspondant au(x) nom(s) du/des LSaddon(s)
+ en dépendance.
+
+
+
container_dn
diff --git a/public_html/includes/class/class.LSformElement.php b/public_html/includes/class/class.LSformElement.php
index 92802a70..ad17ff07 100644
--- a/public_html/includes/class/class.LSformElement.php
+++ b/public_html/includes/class/class.LSformElement.php
@@ -190,7 +190,7 @@ class LSformElement {
}
$return['label'] = $this -> getLabel();
if (isset($this -> params['help_info'])) {
- $return['help_info']=$this -> params['help_info'];
+ $return['help_info']=__($this -> params['help_info']);
}
return $return;
}
diff --git a/public_html/includes/class/class.LSsession.php b/public_html/includes/class/class.LSsession.php
index bc527d34..20793dd4 100644
--- a/public_html/includes/class/class.LSsession.php
+++ b/public_html/includes/class/class.LSsession.php
@@ -241,6 +241,20 @@ class LSsession {
if (!LSconfig :: set("LSobjects.$object",$GLOBALS['LSobjects'][$object])) {
$error = 1;
}
+ else if (isset($GLOBALS['LSobjects'][$object]['LSaddons'])){
+ if (is_array($GLOBALS['LSobjects'][$object]['LSaddons'])) {
+ foreach ($GLOBALS['LSobjects'][$object]['LSaddons'] as $addon) {
+ if (!self :: loadLSaddon($addon)) {
+ $error = 1;
+ }
+ }
+ }
+ else {
+ if (!self :: loadLSaddon($GLOBALS['LSobjects'][$object]['LSaddons'])) {
+ $error = 1;
+ }
+ }
+ }
}
if ($error) {
LSerror :: addErrorCode('LSsession_04',$object);
diff --git a/public_html/includes/functions.php b/public_html/includes/functions.php
index 035cb35f..634fee30 100644
--- a/public_html/includes/functions.php
+++ b/public_html/includes/functions.php
@@ -39,7 +39,7 @@
*/
function getFData($format,$data,$meth=NULL) {
$unique=false;
- $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;
@@ -54,17 +54,7 @@ function getFData($format,$data,$meth=NULL) {
else {
$val = $data[$ch[1]];
}
- if($ch[3]) {
- if ($ch[5]) {
- $s=$ch[3];
- $l=$ch[5];
- }
- else {
- $s=0;
- $l=$ch[3];
- }
- $val=substr((string)$val,$s,$l);
- }
+ $val=_getFData_extractAndModify($val,$ch);
$format[$i]=ereg_replace($ch[0],$val,$format[$i]);
}
}
@@ -75,17 +65,7 @@ function getFData($format,$data,$meth=NULL) {
if (is_array($value)) {
$value = $value[0];
}
- if($ch[3]) {
- if ($ch[5]) {
- $s=$ch[3];
- $l=$ch[5];
- }
- else {
- $s=0;
- $l=$ch[3];
- }
- $value=substr((string)$value,$s,$l);
- }
+ $value=_getFData_extractAndModify($value,$ch);
$format[$i]=ereg_replace($ch[0],$value,$format[$i]);
}
else {
@@ -102,17 +82,7 @@ function getFData($format,$data,$meth=NULL) {
if (is_array($value)) {
$value = $value[0];
}
- if($ch[3]) {
- if ($ch[5]) {
- $s=$ch[3];
- $l=$ch[5];
- }
- else {
- $s=0;
- $l=$ch[3];
- }
- $value=substr((string)$value,$s,$l);
- }
+ $value=_getFData_extractAndModify($value,$ch);
$format[$i]=ereg_replace($ch[0],$value,$format[$i]);
}
}
@@ -123,17 +93,7 @@ function getFData($format,$data,$meth=NULL) {
if (is_array($value)) {
$value = $value[0];
}
- if($ch[3]) {
- if ($ch[5]) {
- $s=$ch[3];
- $l=$ch[5];
- }
- else {
- $s=0;
- $l=$ch[3];
- }
- $value=substr((string)$value,$s,$l);
- }
+ $value=_getFData_extractAndModify($value,$ch);
$format[$i]=ereg_replace($ch[0],$value,$format[$i]);
}
else {
@@ -145,20 +105,7 @@ function getFData($format,$data,$meth=NULL) {
}
else {
while (ereg($expr,$format[$i],$ch)) {
- if($ch[3]) {
- if ($ch[5]) {
- $s=$ch[3];
- $l=$ch[5];
- }
- else {
- $s=0;
- $l=$ch[3];
- }
- $val=substr((string)$data,$s,$l);
- }
- else {
- $val=$data;
- }
+ $val=_getFData_extractAndModify($data,$ch);
$format[$i]=ereg_replace($ch[0],$val,$format[$i]);
}
}
@@ -169,6 +116,54 @@ function getFData($format,$data,$meth=NULL) {
return $format;
}
+function _getFData_extractAndModify($data,$ch) {
+ if($ch[3]) {
+ if ($ch[5]) {
+ if ($ch[6]) {
+ if ($ch[3]<0) {
+ $s=strlen($data)-(-1*$ch[3])-$ch[5];
+ $l=$ch[5];
+ }
+ else {
+ $s=$ch[3]-$ch[5];
+ $l=$ch[5];
+ if ($s<0) {
+ $l=$l-(-1*$s);
+ $s=0;
+ }
+ }
+ }
+ else {
+ $s=$ch[3];
+ $l=$ch[5];
+ }
+ }
+ else {
+ $s=0;
+ $l=$ch[3];
+ }
+ $val=substr((string)$data,$s,$l);
+ }
+ else {
+ $val=$data;
+ }
+
+ # Without Accent
+ if ($ch[8]) {
+ $val = withoutAccents($val);
+ }
+
+ # Upper / Lower case
+ if ($ch[7]=="!") {
+ $val=strtoupper($val);
+ }
+ elseif ($ch[7]=='_') {
+ $val=strtolower($val);
+ }
+
+ return $val;
+}
+
function getFieldInFormat($format) {
$fields=array();
$expr="%{([A-Za-z0-9]+)(\:(-?[0-9])+)?(\:(-?[0-9])+)?}";
@@ -470,4 +465,69 @@ function LSdebugDefined() {
}
}
}
+
+ /**
+ * Supprime les accents d'une chaine
+ *
+ * @param[in] $string La chaine originale
+ *
+ * @retval string La chaine sans les accents
+ */
+ function withoutAccents($string){
+ $replaceAccent = Array(
+ "à" => "a",
+ "á" => "a",
+ "â" => "a",
+ "ã" => "a",
+ "ä" => "a",
+ "ç" => "c",
+ "è" => "e",
+ "é" => "e",
+ "ê" => "e",
+ "ë" => "e",
+ "ì" => "i",
+ "í" => "i",
+ "î" => "i",
+ "ï" => "i",
+ "ñ" => "n",
+ "ò" => "o",
+ "ó" => "o",
+ "ô" => "o",
+ "õ" => "o",
+ "ö" => "o",
+ "ù" => "u",
+ "ú" => "u",
+ "û" => "u",
+ "ü" => "u",
+ "ý" => "y",
+ "ÿ" => "y",
+ "À" => "A",
+ "Á" => "A",
+ "Â" => "A",
+ "Ã" => "A",
+ "Ä" => "A",
+ "Ç" => "C",
+ "È" => "E",
+ "É" => "E",
+ "Ê" => "E",
+ "Ë" => "E",
+ "Ì" => "I",
+ "Í" => "I",
+ "Î" => "I",
+ "Ï" => "I",
+ "Ñ" => "N",
+ "Ò" => "O",
+ "Ó" => "O",
+ "Ô" => "O",
+ "Õ" => "O",
+ "Ö" => "O",
+ "Ù" => "U",
+ "Ú" => "U",
+ "Û" => "U",
+ "Ü" => "U",
+ "Ý" => "Y"
+ );
+ return strtr($string, $replaceAccent);
+ }
+
?>