mirror of
https://gitlab.easter-eggs.com/ee/ldapsaisie.git
synced 2024-11-26 19:54:46 +01:00
Explicitly defined class methods visibility and upgrade PHP class constructor syntax
This commit is contained in:
parent
13bf3b6507
commit
c357c70596
82 changed files with 363 additions and 372 deletions
|
@ -45,7 +45,7 @@ class LSattr_html {
|
||||||
*
|
*
|
||||||
* @retval boolean Retourne true.
|
* @retval boolean Retourne true.
|
||||||
*/
|
*/
|
||||||
function LSattr_html ($name,$config,&$attribute) {
|
public function __construct($name, $config, &$attribute) {
|
||||||
$this -> name = $name;
|
$this -> name = $name;
|
||||||
$this -> config = $config;
|
$this -> config = $config;
|
||||||
$this -> attribute =& $attribute;
|
$this -> attribute =& $attribute;
|
||||||
|
@ -60,7 +60,7 @@ class LSattr_html {
|
||||||
*
|
*
|
||||||
* @retval string Le label de l'attribut.
|
* @retval string Le label de l'attribut.
|
||||||
*/
|
*/
|
||||||
function getLabel() {
|
public function getLabel() {
|
||||||
return __($this -> getConfig('label', $this -> name));
|
return __($this -> getConfig('label', $this -> name));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -73,7 +73,7 @@ class LSattr_html {
|
||||||
*
|
*
|
||||||
* @retval LSformElement L'element du formulaire ajouté
|
* @retval LSformElement L'element du formulaire ajouté
|
||||||
*/
|
*/
|
||||||
function addToForm (&$form,$idForm,$data=NULL) {
|
public function addToForm (&$form,$idForm,$data=NULL) {
|
||||||
if (!$this -> LSformElement_type) {
|
if (!$this -> LSformElement_type) {
|
||||||
LSerror :: addErrorCode('LSattr_html_01',$this -> name);
|
LSerror :: addErrorCode('LSattr_html_01',$this -> name);
|
||||||
return;
|
return;
|
||||||
|
@ -96,7 +96,7 @@ class LSattr_html {
|
||||||
*
|
*
|
||||||
* @retval mixed La valeur formatée de l'attribut
|
* @retval mixed La valeur formatée de l'attribut
|
||||||
**/
|
**/
|
||||||
function refreshForm($data) {
|
public function refreshForm($data) {
|
||||||
return $data;
|
return $data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -107,7 +107,7 @@ class LSattr_html {
|
||||||
*
|
*
|
||||||
* @retval array The values to be displayed in the LSform
|
* @retval array The values to be displayed in the LSform
|
||||||
**/
|
**/
|
||||||
function getFormVal($data) {
|
public function getFormVal($data) {
|
||||||
return $this -> attribute -> getDisplayValue();
|
return $this -> attribute -> getDisplayValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -32,7 +32,7 @@ class LSattr_html_maildir extends LSattr_html {
|
||||||
var $LSformElement_type = 'maildir';
|
var $LSformElement_type = 'maildir';
|
||||||
var $_toDo = array();
|
var $_toDo = array();
|
||||||
|
|
||||||
function LSattr_html_maildir ($name,$config,&$attribute) {
|
public function __construct($name, $config, &$attribute) {
|
||||||
$attribute -> addObjectEvent('before_delete',$this,'beforeDelete');
|
$attribute -> addObjectEvent('before_delete',$this,'beforeDelete');
|
||||||
$attribute -> addObjectEvent('after_delete',$this,'deleteMaildirByFTP');
|
$attribute -> addObjectEvent('after_delete',$this,'deleteMaildirByFTP');
|
||||||
return parent :: LSattr_html($name, $config, $attribute);
|
return parent :: LSattr_html($name, $config, $attribute);
|
||||||
|
@ -47,7 +47,7 @@ class LSattr_html_maildir extends LSattr_html {
|
||||||
$this -> attribute -> addObjectEvent('after_modify',$this,'toDo');
|
$this -> attribute -> addObjectEvent('after_modify',$this,'toDo');
|
||||||
}
|
}
|
||||||
|
|
||||||
function toDo() {
|
public function toDo() {
|
||||||
if (is_array($this -> _toDo)) {
|
if (is_array($this -> _toDo)) {
|
||||||
switch($this -> _toDo['action']) {
|
switch($this -> _toDo['action']) {
|
||||||
case 'delete':
|
case 'delete':
|
||||||
|
|
|
@ -36,7 +36,7 @@ class LSattr_html_password extends LSattr_html {
|
||||||
*
|
*
|
||||||
* @retval LSformElement L'element du formulaire ajouté
|
* @retval LSformElement L'element du formulaire ajouté
|
||||||
*/
|
*/
|
||||||
function addToForm (&$form,$idForm,$data=NULL) {
|
public function addToForm (&$form,$idForm,$data=NULL) {
|
||||||
$element=$form -> addElement('password', $this -> name, $this -> getLabel(), $this -> config, $this);
|
$element=$form -> addElement('password', $this -> name, $this -> getLabel(), $this -> config, $this);
|
||||||
if(!$element) {
|
if(!$element) {
|
||||||
LSerror :: addErrorCode('LSform_06',$this -> name);
|
LSerror :: addErrorCode('LSform_06',$this -> name);
|
||||||
|
|
|
@ -53,7 +53,7 @@ class LSattr_html_select_list extends LSattr_html{
|
||||||
*
|
*
|
||||||
* @retval LSformElement L'element du formulaire ajouté
|
* @retval LSformElement L'element du formulaire ajouté
|
||||||
*/
|
*/
|
||||||
function addToForm (&$form,$idForm,$data=NULL) {
|
public function addToForm (&$form,$idForm,$data=NULL) {
|
||||||
$possible_values=$this -> getPossibleValues();
|
$possible_values=$this -> getPossibleValues();
|
||||||
$this -> config['text_possible_values'] = $possible_values;
|
$this -> config['text_possible_values'] = $possible_values;
|
||||||
$element=parent::addToForm($form,$idForm,$data);
|
$element=parent::addToForm($form,$idForm,$data);
|
||||||
|
@ -77,7 +77,7 @@ class LSattr_html_select_list extends LSattr_html{
|
||||||
* @retval array Tableau associatif des valeurs possible de la liste avec en clé
|
* @retval array Tableau associatif des valeurs possible de la liste avec en clé
|
||||||
* la valeur des balises option et en valeur ce qui sera affiché.
|
* la valeur des balises option et en valeur ce qui sera affiché.
|
||||||
*/
|
*/
|
||||||
function getPossibleValues($options=false,$name=false,&$ldapObject=false) {
|
public static function getPossibleValues($options=false,$name=false,&$ldapObject=false) {
|
||||||
if (!$options) $options=$this -> config['html_options'];
|
if (!$options) $options=$this -> config['html_options'];
|
||||||
if (!$name) $name=$this -> name;
|
if (!$name) $name=$this -> name;
|
||||||
if (!$ldapObject) $ldapObject=$this->attribute->ldapObject;
|
if (!$ldapObject) $ldapObject=$this->attribute->ldapObject;
|
||||||
|
@ -188,7 +188,7 @@ class LSattr_html_select_list extends LSattr_html{
|
||||||
*
|
*
|
||||||
* @retval int Value for uasort
|
* @retval int Value for uasort
|
||||||
**/
|
**/
|
||||||
protected function _sortTwoValuesAsc(&$va,&$vb) {
|
protected static function _sortTwoValuesAsc(&$va,&$vb) {
|
||||||
if (is_array($va)) {
|
if (is_array($va)) {
|
||||||
$nva=$va['label'];
|
$nva=$va['label'];
|
||||||
}
|
}
|
||||||
|
@ -216,7 +216,7 @@ class LSattr_html_select_list extends LSattr_html{
|
||||||
*
|
*
|
||||||
* @retval int Value for uasort
|
* @retval int Value for uasort
|
||||||
**/
|
**/
|
||||||
function _sortTwoValuesDesc(&$va,&$vb) {
|
protected static function _sortTwoValuesDesc(&$va,&$vb) {
|
||||||
return (-1 * self :: _sortTwoValuesAsc($va,$vb));
|
return (-1 * self :: _sortTwoValuesAsc($va,$vb));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -233,7 +233,7 @@ class LSattr_html_select_list extends LSattr_html{
|
||||||
* @retval array Tableau associatif des valeurs possible de la liste avec en clé
|
* @retval array Tableau associatif des valeurs possible de la liste avec en clé
|
||||||
* la valeur des balises option et en valeur ce qui sera affiché.
|
* la valeur des balises option et en valeur ce qui sera affiché.
|
||||||
*/
|
*/
|
||||||
protected function getLSobjectPossibleValues($conf,$options=false,$name=false) {
|
protected static function getLSobjectPossibleValues($conf,$options=false,$name=false) {
|
||||||
if (!$options) $options=$this -> config['html_options'];
|
if (!$options) $options=$this -> config['html_options'];
|
||||||
if (!$name) $name=$this -> name;
|
if (!$name) $name=$this -> name;
|
||||||
$retInfos = array();
|
$retInfos = array();
|
||||||
|
|
|
@ -38,7 +38,7 @@ class LSattr_html_select_object extends LSattr_html{
|
||||||
*
|
*
|
||||||
* @retval LSformElement L'element du formulaire ajouté
|
* @retval LSformElement L'element du formulaire ajouté
|
||||||
*/
|
*/
|
||||||
function addToForm (&$form,$idForm,$data=NULL) {
|
public function addToForm (&$form,$idForm,$data=NULL) {
|
||||||
$this -> config['attrObject'] = $this;
|
$this -> config['attrObject'] = $this;
|
||||||
$element=$form -> addElement('select_object', $this -> name, $this -> getLabel(), $this -> config, $this);
|
$element=$form -> addElement('select_object', $this -> name, $this -> getLabel(), $this -> config, $this);
|
||||||
if(!$element) {
|
if(!$element) {
|
||||||
|
@ -68,7 +68,7 @@ class LSattr_html_select_object extends LSattr_html{
|
||||||
*
|
*
|
||||||
* @retval mixed La valeur formatée de l'attribut (array('DNs' => 'displayName'))
|
* @retval mixed La valeur formatée de l'attribut (array('DNs' => 'displayName'))
|
||||||
**/
|
**/
|
||||||
function refreshForm($data,$fromDNs=false) {
|
public function refreshForm($data,$fromDNs=false) {
|
||||||
return $this -> getFormValues($data,$fromDNs);
|
return $this -> getFormValues($data,$fromDNs);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -81,7 +81,7 @@ class LSattr_html_select_object extends LSattr_html{
|
||||||
*
|
*
|
||||||
* @retval array Tableau des valeurs de l'attribut
|
* @retval array Tableau des valeurs de l'attribut
|
||||||
*/
|
*/
|
||||||
function getValuesFromFormValues($values=NULL) {
|
public function getValuesFromFormValues($values=NULL) {
|
||||||
$conf = $this -> getConfig('html_options.selectable_object');
|
$conf = $this -> getConfig('html_options.selectable_object');
|
||||||
if (is_array($conf) && is_array($values)) {
|
if (is_array($conf) && is_array($values)) {
|
||||||
$retValues = array();
|
$retValues = array();
|
||||||
|
@ -136,7 +136,7 @@ class LSattr_html_select_object extends LSattr_html{
|
||||||
* @retval array Tableau associatif des objects selectionés avec en clé
|
* @retval array Tableau associatif des objects selectionés avec en clé
|
||||||
* le DN et en valeur ce qui sera affiché.
|
* le DN et en valeur ce qui sera affiché.
|
||||||
*/
|
*/
|
||||||
function getFormValues($values=NULL, $fromDNs=false) {
|
public function getFormValues($values=NULL, $fromDNs=false) {
|
||||||
$conf = $this -> getConfig('html_options.selectable_object');
|
$conf = $this -> getConfig('html_options.selectable_object');
|
||||||
if (is_array($conf) && is_array($values)) {
|
if (is_array($conf) && is_array($values)) {
|
||||||
if (!isset($conf['object_type'])) {
|
if (!isset($conf['object_type'])) {
|
||||||
|
@ -209,7 +209,7 @@ class LSattr_html_select_object extends LSattr_html{
|
||||||
* @retval array Tableau associatif des objects selectionnés avec en clé
|
* @retval array Tableau associatif des objects selectionnés avec en clé
|
||||||
* le DN et en valeur ce qui sera affiché.
|
* le DN et en valeur ce qui sera affiché.
|
||||||
*/
|
*/
|
||||||
function getValuesFromSession() {
|
public function getValuesFromSession() {
|
||||||
$obj_type = $this -> getConfig('html_options.selectable_object.object_type');
|
$obj_type = $this -> getConfig('html_options.selectable_object.object_type');
|
||||||
if ( $obj_type && is_array($_SESSION['LSselect'][$obj_type]) ) {
|
if ( $obj_type && is_array($_SESSION['LSselect'][$obj_type]) ) {
|
||||||
return $this -> getFormValues($_SESSION['LSselect'][$obj_type], true);
|
return $this -> getFormValues($_SESSION['LSselect'][$obj_type], true);
|
||||||
|
@ -224,7 +224,7 @@ class LSattr_html_select_object extends LSattr_html{
|
||||||
*
|
*
|
||||||
* @retval array The values to be displayed in the LSform
|
* @retval array The values to be displayed in the LSform
|
||||||
**/
|
**/
|
||||||
function getFormVal($data) {
|
public function getFormVal($data) {
|
||||||
return $data;
|
return $data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -44,7 +44,7 @@ class LSattr_ldap {
|
||||||
*
|
*
|
||||||
* @retval boolean Retourne true.
|
* @retval boolean Retourne true.
|
||||||
*/
|
*/
|
||||||
function LSattr_ldap ($name,$config,&$attribute) {
|
public function __construct($name, $config, &$attribute) {
|
||||||
$this -> name = $name;
|
$this -> name = $name;
|
||||||
$this -> config = $config;
|
$this -> config = $config;
|
||||||
$this -> attribute =& $attribute;
|
$this -> attribute =& $attribute;
|
||||||
|
@ -58,7 +58,7 @@ class LSattr_ldap {
|
||||||
*
|
*
|
||||||
* @retval mixed La valeur traitée de l'attribut
|
* @retval mixed La valeur traitée de l'attribut
|
||||||
*/
|
*/
|
||||||
function getUpdateData($data) {
|
public function getUpdateData($data) {
|
||||||
return $data;
|
return $data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -69,7 +69,7 @@ class LSattr_ldap {
|
||||||
*
|
*
|
||||||
* @retval mixed La valeur d'affichage de l'attribut
|
* @retval mixed La valeur d'affichage de l'attribut
|
||||||
*/
|
*/
|
||||||
function getDisplayValue($data) {
|
public function getDisplayValue($data) {
|
||||||
return $data;
|
return $data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -81,7 +81,7 @@ class LSattr_ldap {
|
||||||
*
|
*
|
||||||
* @retval boolean True uniquement si la valeur passer en paramètre différe de l'actuelle
|
* @retval boolean True uniquement si la valeur passer en paramètre différe de l'actuelle
|
||||||
*/
|
*/
|
||||||
function isUpdated($data) {
|
public function isUpdated($data) {
|
||||||
$data=$this -> getUpdateData($data);
|
$data=$this -> getUpdateData($data);
|
||||||
if ($this -> attribute -> data != $data) {
|
if ($this -> attribute -> data != $data) {
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -32,7 +32,7 @@ class LSattr_ldap_boolean extends LSattr_ldap {
|
||||||
*
|
*
|
||||||
* @retval mixed Attribute display value
|
* @retval mixed Attribute display value
|
||||||
**/
|
**/
|
||||||
function getDisplayValue($data) {
|
public function getDisplayValue($data) {
|
||||||
if ($this -> isTrue($data))
|
if ($this -> isTrue($data))
|
||||||
return 'yes';
|
return 'yes';
|
||||||
if ($this -> isFalse($data))
|
if ($this -> isFalse($data))
|
||||||
|
@ -47,7 +47,7 @@ class LSattr_ldap_boolean extends LSattr_ldap {
|
||||||
*
|
*
|
||||||
* @retval mixed Attribute data
|
* @retval mixed Attribute data
|
||||||
**/
|
**/
|
||||||
function getUpdateData($data) {
|
public function getUpdateData($data) {
|
||||||
if ($data[0]=='yes') {
|
if ($data[0]=='yes') {
|
||||||
return array($this -> getTrue());
|
return array($this -> getTrue());
|
||||||
}
|
}
|
||||||
|
@ -64,7 +64,7 @@ class LSattr_ldap_boolean extends LSattr_ldap {
|
||||||
*
|
*
|
||||||
* @retval boolean True or False
|
* @retval boolean True or False
|
||||||
**/
|
**/
|
||||||
function isTrue($data) {
|
public function isTrue($data) {
|
||||||
if (!is_array($data)) {
|
if (!is_array($data)) {
|
||||||
$data=array($data);
|
$data=array($data);
|
||||||
}
|
}
|
||||||
|
@ -81,7 +81,7 @@ class LSattr_ldap_boolean extends LSattr_ldap {
|
||||||
*
|
*
|
||||||
* @retval boolean True or False
|
* @retval boolean True or False
|
||||||
**/
|
**/
|
||||||
function isFalse($data) {
|
public function isFalse($data) {
|
||||||
if (!is_array($data)) {
|
if (!is_array($data)) {
|
||||||
$data=array($data);
|
$data=array($data);
|
||||||
}
|
}
|
||||||
|
@ -96,7 +96,7 @@ class LSattr_ldap_boolean extends LSattr_ldap {
|
||||||
*
|
*
|
||||||
* @retval string The True value
|
* @retval string The True value
|
||||||
**/
|
**/
|
||||||
function getTrue() {
|
public function getTrue() {
|
||||||
return $this -> getConfig('ldap_options.true_value', 'TRUE', 'string');
|
return $this -> getConfig('ldap_options.true_value', 'TRUE', 'string');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -105,7 +105,7 @@ class LSattr_ldap_boolean extends LSattr_ldap {
|
||||||
*
|
*
|
||||||
* @retval string The False value
|
* @retval string The False value
|
||||||
**/
|
**/
|
||||||
function getFalse() {
|
public function getFalse() {
|
||||||
return $this -> getConfig('ldap_options.false_value', 'FALSE', 'string');
|
return $this -> getConfig('ldap_options.false_value', 'FALSE', 'string');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -36,7 +36,7 @@ class LSattr_ldap_compositeValueToJSON extends LSattr_ldap {
|
||||||
*
|
*
|
||||||
* @retval mixed La valeur d'affichage de l'attribut
|
* @retval mixed La valeur d'affichage de l'attribut
|
||||||
*/
|
*/
|
||||||
function getDisplayValue($data) {
|
public static function getDisplayValue($data) {
|
||||||
if ($data) {
|
if ($data) {
|
||||||
if (!is_array($data))
|
if (!is_array($data))
|
||||||
$data = array($data);
|
$data = array($data);
|
||||||
|
@ -55,7 +55,7 @@ class LSattr_ldap_compositeValueToJSON extends LSattr_ldap {
|
||||||
*
|
*
|
||||||
* @retval mixed La valeur traitée de l'attribut
|
* @retval mixed La valeur traitée de l'attribut
|
||||||
*/
|
*/
|
||||||
function getUpdateData($data) {
|
public static function getUpdateData($data) {
|
||||||
if ($data) {
|
if ($data) {
|
||||||
if (!is_array($data))
|
if (!is_array($data))
|
||||||
$data = array($data);
|
$data = array($data);
|
||||||
|
@ -67,7 +67,7 @@ class LSattr_ldap_compositeValueToJSON extends LSattr_ldap {
|
||||||
return $data;
|
return $data;
|
||||||
}
|
}
|
||||||
|
|
||||||
function parseValue($value) {
|
public static function parseValue($value) {
|
||||||
if (preg_match_all('/\[([^=]*)=([^\]]*)\]/',$value,$matches)) {
|
if (preg_match_all('/\[([^=]*)=([^\]]*)\]/',$value,$matches)) {
|
||||||
$parseValue=array();
|
$parseValue=array();
|
||||||
for($i=0;$i<count($matches[0]);$i++) {
|
for($i=0;$i<count($matches[0]);$i++) {
|
||||||
|
@ -78,7 +78,7 @@ class LSattr_ldap_compositeValueToJSON extends LSattr_ldap {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
function encodeValue($value) {
|
public static function encodeValue($value) {
|
||||||
if (is_array($value)) {
|
if (is_array($value)) {
|
||||||
$ret="";
|
$ret="";
|
||||||
foreach($value as $key => $val)
|
foreach($value as $key => $val)
|
||||||
|
|
|
@ -33,7 +33,7 @@ class LSattr_ldap_date extends LSattr_ldap {
|
||||||
*
|
*
|
||||||
* @retval mixed La valeur d'affichage de l'attribut
|
* @retval mixed La valeur d'affichage de l'attribut
|
||||||
*/
|
*/
|
||||||
function getDisplayValue($data) {
|
public function getDisplayValue($data) {
|
||||||
if(!is_array($data)) {
|
if(!is_array($data)) {
|
||||||
$data=array($data);
|
$data=array($data);
|
||||||
}
|
}
|
||||||
|
@ -57,7 +57,7 @@ class LSattr_ldap_date extends LSattr_ldap {
|
||||||
*
|
*
|
||||||
* @retval mixed La valeur traitée de l'attribut
|
* @retval mixed La valeur traitée de l'attribut
|
||||||
*/
|
*/
|
||||||
function getUpdateData($data) {
|
public function getUpdateData($data) {
|
||||||
if ($this -> getConfig('ldap_options.timestamp', false, 'bool')) {
|
if ($this -> getConfig('ldap_options.timestamp', false, 'bool')) {
|
||||||
return $data;
|
return $data;
|
||||||
}
|
}
|
||||||
|
@ -75,7 +75,7 @@ class LSattr_ldap_date extends LSattr_ldap {
|
||||||
*
|
*
|
||||||
* @retval string Le format de la date
|
* @retval string Le format de la date
|
||||||
**/
|
**/
|
||||||
function getFormat() {
|
public function getFormat() {
|
||||||
return $this -> getConfig('ldap_options.format', '%Y%m%d%H%M%SZ');
|
return $this -> getConfig('ldap_options.format', '%Y%m%d%H%M%SZ');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -35,7 +35,7 @@ class LSattr_ldap_password extends LSattr_ldap {
|
||||||
*
|
*
|
||||||
* @retval mixed The display value of this attribute
|
* @retval mixed The display value of this attribute
|
||||||
*/
|
*/
|
||||||
function getDisplayValue($data) {
|
public function getDisplayValue($data) {
|
||||||
if ($this -> getConfig('ldap_options.displayClearValue', false, 'bool')) {
|
if ($this -> getConfig('ldap_options.displayClearValue', false, 'bool')) {
|
||||||
if (is_array($data)) {
|
if (is_array($data)) {
|
||||||
$ret=array();
|
$ret=array();
|
||||||
|
@ -68,7 +68,7 @@ class LSattr_ldap_password extends LSattr_ldap {
|
||||||
*
|
*
|
||||||
* @retval mixed The value of this attribute to be stocked
|
* @retval mixed The value of this attribute to be stocked
|
||||||
*/
|
*/
|
||||||
function getUpdateData($data) {
|
public function getUpdateData($data) {
|
||||||
$this -> clearPassword = $data[0];
|
$this -> clearPassword = $data[0];
|
||||||
$data=array();
|
$data=array();
|
||||||
|
|
||||||
|
@ -111,7 +111,7 @@ class LSattr_ldap_password extends LSattr_ldap {
|
||||||
*
|
*
|
||||||
* @retval strinf The encode password
|
* @retval strinf The encode password
|
||||||
*/
|
*/
|
||||||
function encodePassword($clearPassword) {
|
public function encodePassword($clearPassword) {
|
||||||
$encode = $this -> getConfig('ldap_options.encode', 'md5crypt', 'string');
|
$encode = $this -> getConfig('ldap_options.encode', 'md5crypt', 'string');
|
||||||
$encode_function = $this -> getConfig('ldap_options.encode_function');
|
$encode_function = $this -> getConfig('ldap_options.encode_function');
|
||||||
if ($encode_function || $encode == 'function') {
|
if ($encode_function || $encode == 'function') {
|
||||||
|
@ -237,7 +237,7 @@ class LSattr_ldap_password extends LSattr_ldap {
|
||||||
*
|
*
|
||||||
* @retval string A salt
|
* @retval string A salt
|
||||||
*/
|
*/
|
||||||
function getSalt($length=8) {
|
public static function getSalt($length=8) {
|
||||||
$pattern = "1234567890abcdefghijklmnopqrstuvwxyz";
|
$pattern = "1234567890abcdefghijklmnopqrstuvwxyz";
|
||||||
$key = $pattern{rand(0,35)};
|
$key = $pattern{rand(0,35)};
|
||||||
for($i=1;$i<$length;$i++)
|
for($i=1;$i<$length;$i++)
|
||||||
|
@ -252,7 +252,7 @@ class LSattr_ldap_password extends LSattr_ldap {
|
||||||
*
|
*
|
||||||
* @retval string The password in clear text
|
* @retval string The password in clear text
|
||||||
*/
|
*/
|
||||||
function getClearPassword() {
|
public function getClearPassword() {
|
||||||
return $this -> clearPassword;
|
return $this -> clearPassword;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -33,7 +33,7 @@ class LSattr_ldap_postaladdress extends LSattr_ldap {
|
||||||
*
|
*
|
||||||
* @retval mixed La valeur d'affichage de l'attribut
|
* @retval mixed La valeur d'affichage de l'attribut
|
||||||
*/
|
*/
|
||||||
function getDisplayValue($data) {
|
public static function getDisplayValue($data) {
|
||||||
return str_replace("$","\n",$data);
|
return str_replace("$","\n",$data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -44,7 +44,7 @@ class LSattr_ldap_postaladdress extends LSattr_ldap {
|
||||||
*
|
*
|
||||||
* @retval mixed La valeur traitée de l'attribut
|
* @retval mixed La valeur traitée de l'attribut
|
||||||
*/
|
*/
|
||||||
function getUpdateData($data) {
|
public static function getUpdateData($data) {
|
||||||
return str_replace("\n","$",$data);
|
return str_replace("\n","$",$data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -35,7 +35,7 @@ class LSattr_ldap_shadowExpire extends LSattr_ldap {
|
||||||
*
|
*
|
||||||
* @retval mixed Array of timestamp
|
* @retval mixed Array of timestamp
|
||||||
*/
|
*/
|
||||||
function getDisplayValue($data) {
|
public static function getDisplayValue($data) {
|
||||||
$ret=array();
|
$ret=array();
|
||||||
foreach($data as $val) {
|
foreach($data as $val) {
|
||||||
$ret[]=((int)$val)*86400;
|
$ret[]=((int)$val)*86400;
|
||||||
|
@ -50,7 +50,7 @@ class LSattr_ldap_shadowExpire extends LSattr_ldap {
|
||||||
*
|
*
|
||||||
* @retval mixed LDAP attribute values
|
* @retval mixed LDAP attribute values
|
||||||
*/
|
*/
|
||||||
function getUpdateData($data) {
|
public static function getUpdateData($data) {
|
||||||
$ret=array();
|
$ret=array();
|
||||||
foreach($data as $val) {
|
foreach($data as $val) {
|
||||||
$ret[]=round(((int)$val)/86400);
|
$ret[]=round(((int)$val)/86400);
|
||||||
|
|
|
@ -60,7 +60,7 @@ class LSattribute {
|
||||||
*
|
*
|
||||||
* @retval boolean Retourne true si la création a réussi, false sinon.
|
* @retval boolean Retourne true si la création a réussi, false sinon.
|
||||||
*/
|
*/
|
||||||
function LSattribute ($name,$config,&$ldapObject) {
|
public function __construct($name, $config, &$ldapObject) {
|
||||||
$this -> name = $name;
|
$this -> name = $name;
|
||||||
$this -> config = $config;
|
$this -> config = $config;
|
||||||
$this -> ldapObject =& $ldapObject;
|
$this -> ldapObject =& $ldapObject;
|
||||||
|
@ -90,7 +90,7 @@ class LSattribute {
|
||||||
* @see LSattr_html::getLabel()
|
* @see LSattr_html::getLabel()
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function getLabel() {
|
public function getLabel() {
|
||||||
if (!$this -> html) {
|
if (!$this -> html) {
|
||||||
LSerror :: addErrorCode('LSattribute_09',array('type' => 'html','name' => $this -> name));
|
LSerror :: addErrorCode('LSattribute_09',array('type' => 'html','name' => $this -> name));
|
||||||
return;
|
return;
|
||||||
|
@ -105,7 +105,7 @@ class LSattribute {
|
||||||
*
|
*
|
||||||
* @retval boolean true
|
* @retval boolean true
|
||||||
*/
|
*/
|
||||||
function loadData($attr_data) {
|
public function loadData($attr_data) {
|
||||||
if ((!is_array($attr_data))&&(!empty($attr_data))) {
|
if ((!is_array($attr_data))&&(!empty($attr_data))) {
|
||||||
$attr_data = array($attr_data);
|
$attr_data = array($attr_data);
|
||||||
}
|
}
|
||||||
|
@ -120,7 +120,7 @@ class LSattribute {
|
||||||
*
|
*
|
||||||
* @retval boolean true
|
* @retval boolean true
|
||||||
*/
|
*/
|
||||||
function reloadData($attr_data) {
|
public function reloadData($attr_data) {
|
||||||
if ((!is_array($attr_data))&&(!empty($attr_data))) {
|
if ((!is_array($attr_data))&&(!empty($attr_data))) {
|
||||||
$attr_data = array($attr_data);
|
$attr_data = array($attr_data);
|
||||||
}
|
}
|
||||||
|
@ -139,7 +139,7 @@ class LSattribute {
|
||||||
*
|
*
|
||||||
* @retval mixed La valeur de l'attribut
|
* @retval mixed La valeur de l'attribut
|
||||||
*/
|
*/
|
||||||
function getValue() {
|
public function getValue() {
|
||||||
if ($this -> isUpdate()) {
|
if ($this -> isUpdate()) {
|
||||||
return $this -> getUpdateData();
|
return $this -> getUpdateData();
|
||||||
}
|
}
|
||||||
|
@ -155,7 +155,7 @@ class LSattribute {
|
||||||
*
|
*
|
||||||
* @retval mixed La valeur originale de l'attribut
|
* @retval mixed La valeur originale de l'attribut
|
||||||
*/
|
*/
|
||||||
function getOldValue() {
|
public function getOldValue() {
|
||||||
return $this -> data;
|
return $this -> data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -166,7 +166,7 @@ class LSattribute {
|
||||||
*
|
*
|
||||||
* @retval string La valeur d'affichage de l'attribut
|
* @retval string La valeur d'affichage de l'attribut
|
||||||
*/
|
*/
|
||||||
function getDisplayValue() {
|
public function getDisplayValue() {
|
||||||
if (!$this -> ldap) {
|
if (!$this -> ldap) {
|
||||||
LSerror :: addErrorCode('LSattribute_09',array('type' => 'ldap','name' => $this -> name));
|
LSerror :: addErrorCode('LSattribute_09',array('type' => 'ldap','name' => $this -> name));
|
||||||
return;
|
return;
|
||||||
|
@ -213,7 +213,7 @@ class LSattribute {
|
||||||
*
|
*
|
||||||
* @retval boolean true si l'ajout a fonctionner ou qu'il n'est pas nécessaire, false sinon
|
* @retval boolean true si l'ajout a fonctionner ou qu'il n'est pas nécessaire, false sinon
|
||||||
*/
|
*/
|
||||||
function addToForm(&$form,$idForm,&$obj=NULL,$value=NULL) {
|
public function addToForm(&$form,$idForm,&$obj=NULL,$value=NULL) {
|
||||||
if($this -> getConfig("form.$idForm")) {
|
if($this -> getConfig("form.$idForm")) {
|
||||||
if (!$this -> html) {
|
if (!$this -> html) {
|
||||||
LSerror :: addErrorCode('LSattribute_09',array('type' => 'html','name' => $this -> name));
|
LSerror :: addErrorCode('LSattribute_09',array('type' => 'html','name' => $this -> name));
|
||||||
|
@ -279,7 +279,7 @@ class LSattribute {
|
||||||
*
|
*
|
||||||
* @retval string 'r'/'w'/'n' pour 'read'/'write'/'none'
|
* @retval string 'r'/'w'/'n' pour 'read'/'write'/'none'
|
||||||
**/
|
**/
|
||||||
function myRights() {
|
private function myRights() {
|
||||||
// cache
|
// cache
|
||||||
if ($this -> _myRights != NULL) {
|
if ($this -> _myRights != NULL) {
|
||||||
return $this -> _myRights;
|
return $this -> _myRights;
|
||||||
|
@ -308,7 +308,7 @@ class LSattribute {
|
||||||
*
|
*
|
||||||
* @retval boolean true si l'ajout a fonctionner ou qu'il n'est pas nécessaire, false sinon
|
* @retval boolean true si l'ajout a fonctionner ou qu'il n'est pas nécessaire, false sinon
|
||||||
*/
|
*/
|
||||||
function addToView(&$form) {
|
public function addToView(&$form) {
|
||||||
if ($this -> getConfig('view', false, 'bool') && ($this -> myRights() != 'n') ) {
|
if ($this -> getConfig('view', false, 'bool') && ($this -> myRights() != 'n') ) {
|
||||||
if (!$this -> html) {
|
if (!$this -> html) {
|
||||||
LSerror :: addErrorCode('LSattribute_09',array('type' => 'html','name' => $this -> name));
|
LSerror :: addErrorCode('LSattribute_09',array('type' => 'html','name' => $this -> name));
|
||||||
|
@ -341,7 +341,7 @@ class LSattribute {
|
||||||
*
|
*
|
||||||
* @retval boolean true si la valeur a été rafraichie ou que ce n'est pas nécessaire, false sinon
|
* @retval boolean true si la valeur a été rafraichie ou que ce n'est pas nécessaire, false sinon
|
||||||
*/
|
*/
|
||||||
function refreshForm(&$form,$idForm) {
|
public function refreshForm(&$form,$idForm) {
|
||||||
if ($this -> getConfig("form.$idForm") && ($this -> myRights() != 'n')) {
|
if ($this -> getConfig("form.$idForm") && ($this -> myRights() != 'n')) {
|
||||||
if (!$this -> html) {
|
if (!$this -> html) {
|
||||||
LSerror :: addErrorCode('LSattribute_09',array('type' => 'html','name' => $this -> name));
|
LSerror :: addErrorCode('LSattribute_09',array('type' => 'html','name' => $this -> name));
|
||||||
|
@ -366,7 +366,7 @@ class LSattribute {
|
||||||
*
|
*
|
||||||
* @retval string La valeur a afficher dans le formulaire.
|
* @retval string La valeur a afficher dans le formulaire.
|
||||||
*/
|
*/
|
||||||
function getFormVal() {
|
public function getFormVal() {
|
||||||
$data=$this -> html -> getFormVal($this -> data);
|
$data=$this -> html -> getFormVal($this -> data);
|
||||||
if ($data==NULL) {
|
if ($data==NULL) {
|
||||||
$data=array();
|
$data=array();
|
||||||
|
@ -386,7 +386,7 @@ class LSattribute {
|
||||||
*
|
*
|
||||||
* @retval void
|
* @retval void
|
||||||
*/
|
*/
|
||||||
function setUpdateData($data) {
|
public function setUpdateData($data) {
|
||||||
if($this -> ldap -> isUpdated($data)) {
|
if($this -> ldap -> isUpdated($data)) {
|
||||||
$this -> updateData=$data;
|
$this -> updateData=$data;
|
||||||
}
|
}
|
||||||
|
@ -399,7 +399,7 @@ class LSattribute {
|
||||||
*
|
*
|
||||||
* @retval boolean true si l'attribut a été validé, false sinon
|
* @retval boolean true si l'attribut a été validé, false sinon
|
||||||
*/
|
*/
|
||||||
function isValidate() {
|
public function isValidate() {
|
||||||
return $this -> is_validate;
|
return $this -> is_validate;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -410,7 +410,7 @@ class LSattribute {
|
||||||
*
|
*
|
||||||
* @retval void
|
* @retval void
|
||||||
*/
|
*/
|
||||||
function validate() {
|
public function validate() {
|
||||||
$this -> is_validate=true;
|
$this -> is_validate=true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -421,7 +421,7 @@ class LSattribute {
|
||||||
*
|
*
|
||||||
* @retval boolean true si l'attribut a été mis à jour, false sinon
|
* @retval boolean true si l'attribut a été mis à jour, false sinon
|
||||||
*/
|
*/
|
||||||
function isUpdate() {
|
public function isUpdate() {
|
||||||
return ($this -> updateData===false)?false:true;
|
return ($this -> updateData===false)?false:true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -432,7 +432,7 @@ class LSattribute {
|
||||||
*
|
*
|
||||||
* @retval boolean true si l'attribut est obligatoire, false sinon
|
* @retval boolean true si l'attribut est obligatoire, false sinon
|
||||||
*/
|
*/
|
||||||
function isRequired() {
|
public function isRequired() {
|
||||||
return $this -> getConfig('required', false, 'bool');
|
return $this -> getConfig('required', false, 'bool');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -443,7 +443,7 @@ class LSattribute {
|
||||||
*
|
*
|
||||||
* @retval boolean true si la valeur de l'attribut peut être générée, false sinon
|
* @retval boolean true si la valeur de l'attribut peut être générée, false sinon
|
||||||
*/
|
*/
|
||||||
function canBeGenerated() {
|
public function canBeGenerated() {
|
||||||
$format = $this -> getConfig('generate_value_format', $this -> getConfig('default_value'));
|
$format = $this -> getConfig('generate_value_format', $this -> getConfig('default_value'));
|
||||||
return (
|
return (
|
||||||
(function_exists($this -> getConfig('generate_function')))
|
(function_exists($this -> getConfig('generate_function')))
|
||||||
|
@ -463,7 +463,7 @@ class LSattribute {
|
||||||
*
|
*
|
||||||
* @retval boolean true si la valeur à put être générée, false sinon
|
* @retval boolean true si la valeur à put être générée, false sinon
|
||||||
*/
|
*/
|
||||||
function generateValue() {
|
public function generateValue() {
|
||||||
$value = false;
|
$value = false;
|
||||||
$generate_function = $this -> getConfig('generate_function');
|
$generate_function = $this -> getConfig('generate_function');
|
||||||
$format = $this -> getConfig('generate_value_format', $this -> getConfig('default_value'));
|
$format = $this -> getConfig('generate_value_format', $this -> getConfig('default_value'));
|
||||||
|
@ -496,7 +496,7 @@ class LSattribute {
|
||||||
*
|
*
|
||||||
* @retval mixed La valeur de l'attribut pour son enregistrement dans l'annuaire
|
* @retval mixed La valeur de l'attribut pour son enregistrement dans l'annuaire
|
||||||
*/
|
*/
|
||||||
function getUpdateData() {
|
public function getUpdateData() {
|
||||||
if (!$this -> isUpdate()) {
|
if (!$this -> isUpdate()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -547,7 +547,7 @@ class LSattribute {
|
||||||
*
|
*
|
||||||
* @retval mixed La configuration de validation de l'attribut
|
* @retval mixed La configuration de validation de l'attribut
|
||||||
*/
|
*/
|
||||||
function getValidateConfig() {
|
public function getValidateConfig() {
|
||||||
if (isset($this -> config['validation'])) {
|
if (isset($this -> config['validation'])) {
|
||||||
return $this -> config['validation'];
|
return $this -> config['validation'];
|
||||||
}
|
}
|
||||||
|
@ -561,7 +561,7 @@ class LSattribute {
|
||||||
*
|
*
|
||||||
* @retval array les noms des attributs dépendants
|
* @retval array les noms des attributs dépendants
|
||||||
*/
|
*/
|
||||||
function getDependsAttrs() {
|
public function getDependsAttrs() {
|
||||||
return (isset($this -> config['dependAttrs'])?$this -> config['dependAttrs']:null);
|
return (isset($this -> config['dependAttrs'])?$this -> config['dependAttrs']:null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -575,7 +575,7 @@ class LSattribute {
|
||||||
*
|
*
|
||||||
* @retval void
|
* @retval void
|
||||||
*/
|
*/
|
||||||
function addEvent($event,$fct,$params,$class=NULL) {
|
public function addEvent($event,$fct,$params,$class=NULL) {
|
||||||
$this -> _events[$event][] = array(
|
$this -> _events[$event][] = array(
|
||||||
'function' => $fct,
|
'function' => $fct,
|
||||||
'params' => $params,
|
'params' => $params,
|
||||||
|
@ -593,7 +593,7 @@ class LSattribute {
|
||||||
*
|
*
|
||||||
* @retval void
|
* @retval void
|
||||||
*/
|
*/
|
||||||
function addObjectEvent($event,&$obj,$meth,$params=NULL) {
|
public function addObjectEvent($event,&$obj,$meth,$params=NULL) {
|
||||||
$this -> _objectEvents[$event][] = array(
|
$this -> _objectEvents[$event][] = array(
|
||||||
'obj' => &$obj,
|
'obj' => &$obj,
|
||||||
'meth' => $meth,
|
'meth' => $meth,
|
||||||
|
@ -608,7 +608,7 @@ class LSattribute {
|
||||||
*
|
*
|
||||||
* @retval boolean True si tout c'est bien passé, false sinon
|
* @retval boolean True si tout c'est bien passé, false sinon
|
||||||
*/
|
*/
|
||||||
function fireEvent($event) {
|
public function fireEvent($event) {
|
||||||
$return = true;
|
$return = true;
|
||||||
if(isset($this -> config[$event])) {
|
if(isset($this -> config[$event])) {
|
||||||
if (!is_array($this -> config[$event])) {
|
if (!is_array($this -> config[$event])) {
|
||||||
|
|
|
@ -40,16 +40,16 @@ class LSauth {
|
||||||
'displaySelfAccess' => true
|
'displaySelfAccess' => true
|
||||||
);
|
);
|
||||||
|
|
||||||
function start() {
|
public static function start() {
|
||||||
LSdebug('LSauth :: start()');
|
LSdebug('LSauth :: start()');
|
||||||
// Load Config
|
// Load Config
|
||||||
if (isset(LSsession :: $ldapServer['LSauth']) && is_array(LSsession :: $ldapServer['LSauth'])) {
|
if (isset(LSsession :: $ldapServer['LSauth']) && is_array(LSsession :: $ldapServer['LSauth'])) {
|
||||||
self :: $config = LSsession :: $ldapServer['LSauth'];
|
self :: $config = LSsession :: $ldapServer['LSauth'];
|
||||||
}
|
}
|
||||||
if (!LSsession :: loadLSclass('LSauthMethod')) {
|
if (!LSsession :: loadLSclass('LSauthMethod')) {
|
||||||
LSdebug('LSauth :: Failed to load LSauthMethod');
|
LSdebug('LSauth :: Failed to load LSauthMethod');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!isset(self :: $config['method'])) {
|
if (!isset(self :: $config['method'])) {
|
||||||
self :: $config['method']='basic';
|
self :: $config['method']='basic';
|
||||||
}
|
}
|
||||||
|
@ -69,21 +69,21 @@ class LSauth {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function forceAuthentication() {
|
public static function forceAuthentication() {
|
||||||
LSdebug('LSauth :: forceAuthentication()');
|
LSdebug('LSauth :: forceAuthentication()');
|
||||||
if (!is_null(self :: $provider)) {
|
if (!is_null(self :: $provider)) {
|
||||||
self :: $authData = self :: $provider -> getAuthData();
|
self :: $authData = self :: $provider -> getAuthData();
|
||||||
if (self :: $authData) {
|
if (self :: $authData) {
|
||||||
self :: $authObject = self :: $provider -> authenticate();
|
self :: $authObject = self :: $provider -> authenticate();
|
||||||
return self :: $authObject;
|
return self :: $authObject;
|
||||||
}
|
}
|
||||||
// No data : user has not filled the login form
|
// No data : user has not filled the login form
|
||||||
LSdebug('LSauth : No data -> user has not filled the login form');
|
LSdebug('LSauth : No data -> user has not filled the login form');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
LSerror :: addErrorCode('LSauth_06');
|
LSerror :: addErrorCode('LSauth_06');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get LDAP credentials
|
* Get LDAP credentials
|
||||||
|
@ -94,7 +94,7 @@ class LSauth {
|
||||||
*
|
*
|
||||||
* @retval Array|false Array of LDAP credentials array('dn','pwd') or False
|
* @retval Array|false Array of LDAP credentials array('dn','pwd') or False
|
||||||
**/
|
**/
|
||||||
public function getLDAPcredentials($user) {
|
public static function getLDAPcredentials($user) {
|
||||||
return self :: $provider -> getLDAPcredentials($user);
|
return self :: $provider -> getLDAPcredentials($user);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -103,12 +103,12 @@ class LSauth {
|
||||||
*
|
*
|
||||||
* @retval void
|
* @retval void
|
||||||
**/
|
**/
|
||||||
public function logout() {
|
public static function logout() {
|
||||||
if (!is_null(self :: $provider)) {
|
if (!is_null(self :: $provider)) {
|
||||||
return self :: $provider -> logout();
|
return self :: $provider -> logout();
|
||||||
}
|
}
|
||||||
LSerror :: addErrorCode('LSauth_06');
|
LSerror :: addErrorCode('LSauth_06');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -116,45 +116,45 @@ class LSauth {
|
||||||
*
|
*
|
||||||
* @retval void
|
* @retval void
|
||||||
**/
|
**/
|
||||||
public function disableLogoutBtn() {
|
public static function disableLogoutBtn() {
|
||||||
self :: $params['displayLogoutBtn'] = false;
|
self :: $params['displayLogoutBtn'] = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Can display or not logout button in LSauth parameters
|
* Can display or not logout button in LSauth parameters
|
||||||
*
|
*
|
||||||
* @retval boolean
|
* @retval boolean
|
||||||
**/
|
**/
|
||||||
public function displayLogoutBtn() {
|
public static function displayLogoutBtn() {
|
||||||
return self :: $params['displayLogoutBtn'];
|
return self :: $params['displayLogoutBtn'];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Disable self access
|
* Disable self access
|
||||||
*
|
*
|
||||||
* @retval void
|
* @retval void
|
||||||
**/
|
**/
|
||||||
public function disableSelfAccess() {
|
public static function disableSelfAccess() {
|
||||||
self :: $params['displaySelfAccess'] = false;
|
self :: $params['displaySelfAccess'] = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Can display or not self access
|
* Can display or not self access
|
||||||
*
|
*
|
||||||
* @retval boolean
|
* @retval boolean
|
||||||
**/
|
**/
|
||||||
public function displaySelfAccess() {
|
public static function displaySelfAccess() {
|
||||||
return self :: $params['displaySelfAccess'];
|
return self :: $params['displaySelfAccess'];
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* For compatibillity until loginForm is migrated in LSauth
|
* For compatibillity until loginForm is migrated in LSauth
|
||||||
*/
|
*/
|
||||||
public function disableLoginForm() {
|
public static function disableLoginForm() {
|
||||||
self :: $params['displayLoginForm'] = false;
|
self :: $params['displayLoginForm'] = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function displayLoginForm() {
|
public static function displayLoginForm() {
|
||||||
return self :: $params['displayLoginForm'];
|
return self :: $params['displayLoginForm'];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -29,12 +29,12 @@ class LSauthMethod {
|
||||||
|
|
||||||
var $authData = array();
|
var $authData = array();
|
||||||
|
|
||||||
function LSauthMethod() {
|
public function __construct() {
|
||||||
// Load config
|
// Load config
|
||||||
LSsession :: includeFile(LS_CONF_DIR."LSauth/config.".get_class($this).".php");
|
LSsession :: includeFile(LS_CONF_DIR."LSauth/config.".get_class($this).".php");
|
||||||
LSdebug(LS_CONF_DIR."LSauth/config.".get_class($this).".php");
|
LSdebug(LS_CONF_DIR."LSauth/config.".get_class($this).".php");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check Auth Data
|
* Check Auth Data
|
||||||
|
@ -57,26 +57,26 @@ class LSauthMethod {
|
||||||
public function authenticate() {
|
public function authenticate() {
|
||||||
if (LSsession :: loadLSobject(LSsession :: $ldapServer['authObjectType'])) {
|
if (LSsession :: loadLSobject(LSsession :: $ldapServer['authObjectType'])) {
|
||||||
$authobject = new LSsession :: $ldapServer['authObjectType']();
|
$authobject = new LSsession :: $ldapServer['authObjectType']();
|
||||||
$result = $authobject -> searchObject(
|
$result = $authobject -> searchObject(
|
||||||
$this -> authData['username'],
|
$this -> authData['username'],
|
||||||
LSsession :: getTopDn(),
|
LSsession :: getTopDn(),
|
||||||
(isset(LSsession :: $ldapServer['authObjectFilter'])?LSsession :: $ldapServer['authObjectFilter']:NULL),
|
(isset(LSsession :: $ldapServer['authObjectFilter'])?LSsession :: $ldapServer['authObjectFilter']:NULL),
|
||||||
array('withoutCache' => true, 'onlyAccessible' => false)
|
array('withoutCache' => true, 'onlyAccessible' => false)
|
||||||
);
|
);
|
||||||
$nbresult=count($result);
|
$nbresult=count($result);
|
||||||
|
|
||||||
if ($nbresult==0) {
|
if ($nbresult==0) {
|
||||||
// incorrect login
|
// incorrect login
|
||||||
LSdebug('identifiant incorrect');
|
LSdebug('identifiant incorrect');
|
||||||
LSerror :: addErrorCode('LSauth_01');
|
LSerror :: addErrorCode('LSauth_01');
|
||||||
}
|
}
|
||||||
else if ($nbresult>1) {
|
else if ($nbresult>1) {
|
||||||
// duplication of identity
|
// duplication of identity
|
||||||
LSerror :: addErrorCode('LSauth_02');
|
LSerror :: addErrorCode('LSauth_02');
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
return $result[0];
|
return $result[0];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
LSerror :: addErrorCode('LSauth_03');
|
LSerror :: addErrorCode('LSauth_03');
|
||||||
|
@ -104,12 +104,12 @@ class LSauthMethod {
|
||||||
* @retval Array|false Array of LDAP credentials array('dn','pwd') or False
|
* @retval Array|false Array of LDAP credentials array('dn','pwd') or False
|
||||||
**/
|
**/
|
||||||
public function getLDAPcredentials($user) {
|
public function getLDAPcredentials($user) {
|
||||||
if (isset($this -> authData['password'])) {
|
if (isset($this -> authData['password'])) {
|
||||||
return array(
|
return array(
|
||||||
'dn' => $user -> getDn(),
|
'dn' => $user -> getDn(),
|
||||||
'pwd' => $this -> authData['password']
|
'pwd' => $this -> authData['password']
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -27,7 +27,7 @@
|
||||||
*/
|
*/
|
||||||
class LSauthMethod_CAS extends LSauthMethod {
|
class LSauthMethod_CAS extends LSauthMethod {
|
||||||
|
|
||||||
function LSauthMethod_CAS() {
|
public function __construct() {
|
||||||
LSauth :: disableLoginForm();
|
LSauth :: disableLoginForm();
|
||||||
|
|
||||||
if (!parent :: LSauthMethod())
|
if (!parent :: LSauthMethod())
|
||||||
|
|
|
@ -29,11 +29,11 @@ LSsession :: loadLSclass('LSauthMethod_basic');
|
||||||
*/
|
*/
|
||||||
class LSauthMethod_HTTP extends LSauthMethod_basic {
|
class LSauthMethod_HTTP extends LSauthMethod_basic {
|
||||||
|
|
||||||
function LSauthMethod_HTTP() {
|
public function LSauthMethod_HTTP() {
|
||||||
LSauth :: disableLoginForm();
|
LSauth :: disableLoginForm();
|
||||||
LSauth :: disableLogoutBtn();
|
LSauth :: disableLogoutBtn();
|
||||||
return parent :: LSauthMethod_basic();
|
return parent :: LSauthMethod_basic();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check Auth Data
|
* Check Auth Data
|
||||||
|
|
|
@ -27,7 +27,7 @@
|
||||||
*/
|
*/
|
||||||
class LSauthMethod_anonymous extends LSauthMethod {
|
class LSauthMethod_anonymous extends LSauthMethod {
|
||||||
|
|
||||||
function LSauthMethod_anonymous() {
|
public function __construct() {
|
||||||
LSauth :: disableLoginForm();
|
LSauth :: disableLoginForm();
|
||||||
LSauth :: disableSelfAccess();
|
LSauth :: disableSelfAccess();
|
||||||
|
|
||||||
|
|
|
@ -62,7 +62,7 @@ class LSform {
|
||||||
*
|
*
|
||||||
* @retval void
|
* @retval void
|
||||||
*/
|
*/
|
||||||
function LSform (&$ldapObject,$idForm,$submit=NULL){
|
public function __construct(&$ldapObject, $idForm, $submit=NULL){
|
||||||
$this -> idForm = $idForm;
|
$this -> idForm = $idForm;
|
||||||
if (!$submit) {
|
if (!$submit) {
|
||||||
$this -> submit = _("Validate");
|
$this -> submit = _("Validate");
|
||||||
|
@ -81,7 +81,7 @@ class LSform {
|
||||||
*
|
*
|
||||||
* @retval void
|
* @retval void
|
||||||
*/
|
*/
|
||||||
function display(){
|
public function display(){
|
||||||
if ($this -> idForm == 'view') {
|
if ($this -> idForm == 'view') {
|
||||||
self :: loadDependenciesDisplayView($this -> $ldapObject);
|
self :: loadDependenciesDisplayView($this -> $ldapObject);
|
||||||
}
|
}
|
||||||
|
@ -227,7 +227,7 @@ class LSform {
|
||||||
*
|
*
|
||||||
* @retval void
|
* @retval void
|
||||||
*/
|
*/
|
||||||
function displayView(){
|
public function displayView(){
|
||||||
self :: loadDependenciesDisplayView($this -> ldapObject);
|
self :: loadDependenciesDisplayView($this -> ldapObject);
|
||||||
|
|
||||||
$LSform_object = array(
|
$LSform_object = array(
|
||||||
|
@ -261,7 +261,7 @@ class LSform {
|
||||||
*
|
*
|
||||||
* @retval void
|
* @retval void
|
||||||
*/
|
*/
|
||||||
function setElementError($attr,$msg=NULL) {
|
public function setElementError($attr,$msg=NULL) {
|
||||||
if($msg!='') {
|
if($msg!='') {
|
||||||
$msg_error=getFData($msg,$attr->getLabel());
|
$msg_error=getFData($msg,$attr->getLabel());
|
||||||
}
|
}
|
||||||
|
@ -281,7 +281,7 @@ class LSform {
|
||||||
*
|
*
|
||||||
* @retval boolean
|
* @retval boolean
|
||||||
*/
|
*/
|
||||||
function definedError($element=NULL) {
|
public function definedError($element=NULL) {
|
||||||
if ($element) {
|
if ($element) {
|
||||||
return isset($this -> _elementsErrors[$element]);
|
return isset($this -> _elementsErrors[$element]);
|
||||||
}
|
}
|
||||||
|
@ -295,7 +295,7 @@ class LSform {
|
||||||
*
|
*
|
||||||
* @retval Array array(element => array(errors))
|
* @retval Array array(element => array(errors))
|
||||||
*/
|
*/
|
||||||
function getErrors() {
|
public function getErrors() {
|
||||||
return $this -> _elementsErrors;
|
return $this -> _elementsErrors;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -306,7 +306,7 @@ class LSform {
|
||||||
*
|
*
|
||||||
* @retval boolean true si le formulaire a été validé et que les données ont été validées, false sinon
|
* @retval boolean true si le formulaire a été validé et que les données ont été validées, false sinon
|
||||||
*/
|
*/
|
||||||
function validate(){
|
public function validate(){
|
||||||
if(!$this -> can_validate)
|
if(!$this -> can_validate)
|
||||||
return;
|
return;
|
||||||
if ($this -> isSubmit()) {
|
if ($this -> isSubmit()) {
|
||||||
|
@ -333,7 +333,7 @@ class LSform {
|
||||||
*
|
*
|
||||||
* @retval boolean true si toutes la saisie est OK, false sinon
|
* @retval boolean true si toutes la saisie est OK, false sinon
|
||||||
*/
|
*/
|
||||||
function checkData() {
|
public function checkData() {
|
||||||
$retval=true;
|
$retval=true;
|
||||||
foreach ($this -> _postData as $element => $values) {
|
foreach ($this -> _postData as $element => $values) {
|
||||||
if ($this -> definedError($element)) {
|
if ($this -> definedError($element)) {
|
||||||
|
@ -378,7 +378,7 @@ class LSform {
|
||||||
*
|
*
|
||||||
* @retval boolean true si au moins une valeur est présente, false sinon
|
* @retval boolean true si au moins une valeur est présente, false sinon
|
||||||
*/
|
*/
|
||||||
function checkRequired($data) {
|
public function checkRequired($data) {
|
||||||
foreach($data as $val) {
|
foreach($data as $val) {
|
||||||
if (!empty($val)||(is_string($val)&&($val=="0")))
|
if (!empty($val)||(is_string($val)&&($val=="0")))
|
||||||
return true;
|
return true;
|
||||||
|
@ -393,7 +393,7 @@ class LSform {
|
||||||
*
|
*
|
||||||
* @retval boolean true si la saisie du formulaire est présente en POST, false sinon
|
* @retval boolean true si la saisie du formulaire est présente en POST, false sinon
|
||||||
*/
|
*/
|
||||||
function isSubmit() {
|
public function isSubmit() {
|
||||||
if( (isset($_POST['validate']) && ($_POST['validate']=='LSform')) && (isset($_POST['idForm']) && ($_POST['idForm'] == $this -> idForm)) )
|
if( (isset($_POST['validate']) && ($_POST['validate']=='LSform')) && (isset($_POST['idForm']) && ($_POST['idForm'] == $this -> idForm)) )
|
||||||
return true;
|
return true;
|
||||||
return;
|
return;
|
||||||
|
@ -409,7 +409,7 @@ class LSform {
|
||||||
*
|
*
|
||||||
* @retval boolean true si les données ont été définies, false sinon
|
* @retval boolean true si les données ont été définies, false sinon
|
||||||
*/
|
*/
|
||||||
function setPostData($data,$consideredAsSubmit=false) {
|
public function setPostData($data,$consideredAsSubmit=false) {
|
||||||
if (is_array($data)) {
|
if (is_array($data)) {
|
||||||
foreach($data as $key => $values) {
|
foreach($data as $key => $values) {
|
||||||
if (!is_array($values)) {
|
if (!is_array($values)) {
|
||||||
|
@ -435,7 +435,7 @@ class LSform {
|
||||||
*
|
*
|
||||||
* @retval boolean true si les valeurs ont bien été récupérées, false sinon.
|
* @retval boolean true si les valeurs ont bien été récupérées, false sinon.
|
||||||
*/
|
*/
|
||||||
function getPostData() {
|
public function getPostData() {
|
||||||
if (is_null($this -> dataEntryForm)) {
|
if (is_null($this -> dataEntryForm)) {
|
||||||
foreach($this -> elements as $element_name => $element) {
|
foreach($this -> elements as $element_name => $element) {
|
||||||
if( !($element -> getPostData($this -> _postData)) ) {
|
if( !($element -> getPostData($this -> _postData)) ) {
|
||||||
|
@ -481,7 +481,7 @@ class LSform {
|
||||||
*
|
*
|
||||||
* @retval LSformElement
|
* @retval LSformElement
|
||||||
*/
|
*/
|
||||||
function addElement($type,$name,$label,$params=array(),&$attr_html) {
|
public function addElement($type,$name,$label,$params=array(),&$attr_html) {
|
||||||
$elementType='LSformElement_'.$type;
|
$elementType='LSformElement_'.$type;
|
||||||
LSsession :: loadLSclass($elementType);
|
LSsession :: loadLSclass($elementType);
|
||||||
if (!class_exists($elementType)) {
|
if (!class_exists($elementType)) {
|
||||||
|
@ -532,7 +532,7 @@ class LSform {
|
||||||
*
|
*
|
||||||
* @retval boolean
|
* @retval boolean
|
||||||
*/
|
*/
|
||||||
function addRule($element, $rule, $options=array()) {
|
public function addRule($element, $rule, $options=array()) {
|
||||||
if ( isset($this ->elements[$element]) ) {
|
if ( isset($this ->elements[$element]) ) {
|
||||||
if ($this -> isRuleRegistered($rule)) {
|
if ($this -> isRuleRegistered($rule)) {
|
||||||
$this -> _rules[$element][]=array(
|
$this -> _rules[$element][]=array(
|
||||||
|
@ -564,7 +564,7 @@ class LSform {
|
||||||
*
|
*
|
||||||
* @retval boolean
|
* @retval boolean
|
||||||
*/
|
*/
|
||||||
function setRequired($element) {
|
public function setRequired($element) {
|
||||||
if (isset( $this -> elements[$element] ) )
|
if (isset( $this -> elements[$element] ) )
|
||||||
return $this -> elements[$element] -> setRequired();
|
return $this -> elements[$element] -> setRequired();
|
||||||
else
|
else
|
||||||
|
@ -580,7 +580,7 @@ class LSform {
|
||||||
*
|
*
|
||||||
* @param[in] $element string Le nom de l'élément conserné
|
* @param[in] $element string Le nom de l'élément conserné
|
||||||
*/
|
*/
|
||||||
function isRuleRegistered($rule) {
|
public function isRuleRegistered($rule) {
|
||||||
LSsession :: loadLSclass('LSformRule');
|
LSsession :: loadLSclass('LSformRule');
|
||||||
LSsession :: loadLSclass('LSformRule_'.$rule);
|
LSsession :: loadLSclass('LSformRule_'.$rule);
|
||||||
return class_exists('LSformRule_'.$rule);
|
return class_exists('LSformRule_'.$rule);
|
||||||
|
@ -591,7 +591,7 @@ class LSform {
|
||||||
*
|
*
|
||||||
* @retval mixed Les valeurs validés du formulaire, ou false si elles ne le sont pas
|
* @retval mixed Les valeurs validés du formulaire, ou false si elles ne le sont pas
|
||||||
*/
|
*/
|
||||||
function exportValues() {
|
public function exportValues() {
|
||||||
if ($this -> _isValidate) {
|
if ($this -> _isValidate) {
|
||||||
$retval=array();
|
$retval=array();
|
||||||
foreach($this -> _postData as $element => $values) {
|
foreach($this -> _postData as $element => $values) {
|
||||||
|
@ -611,7 +611,7 @@ class LSform {
|
||||||
*
|
*
|
||||||
* @retval LSformElement L'élement du formulaire voulu
|
* @retval LSformElement L'élement du formulaire voulu
|
||||||
*/
|
*/
|
||||||
function getElement($element) {
|
public function getElement($element) {
|
||||||
return $this -> elements[$element];
|
return $this -> elements[$element];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -620,7 +620,7 @@ class LSform {
|
||||||
*
|
*
|
||||||
* @retval boolean True si les valeurs ont été définies, false sinon.
|
* @retval boolean True si les valeurs ont été définies, false sinon.
|
||||||
*/
|
*/
|
||||||
function setValuesFromPostData() {
|
public function setValuesFromPostData() {
|
||||||
if (empty($this -> _postData)) {
|
if (empty($this -> _postData)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -637,7 +637,7 @@ class LSform {
|
||||||
*
|
*
|
||||||
* @retval string Le code HTML du champ vide.
|
* @retval string Le code HTML du champ vide.
|
||||||
*/
|
*/
|
||||||
function getEmptyField($element) {
|
public function getEmptyField($element) {
|
||||||
$element = $this -> getElement($element);
|
$element = $this -> getElement($element);
|
||||||
if ($element) {
|
if ($element) {
|
||||||
return $element -> getEmptyField();
|
return $element -> getEmptyField();
|
||||||
|
@ -654,7 +654,7 @@ class LSform {
|
||||||
*
|
*
|
||||||
* @retval void
|
* @retval void
|
||||||
**/
|
**/
|
||||||
function setMaxFileSize($size) {
|
public function setMaxFileSize($size) {
|
||||||
$this -> maxFileSize = $size;
|
$this -> maxFileSize = $size;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -665,7 +665,7 @@ class LSform {
|
||||||
*
|
*
|
||||||
* @retval boolean True si le masque de saisie a été appliqué, False sinon
|
* @retval boolean True si le masque de saisie a été appliqué, False sinon
|
||||||
**/
|
**/
|
||||||
function applyDataEntryForm($dataEntryForm) {
|
public function applyDataEntryForm($dataEntryForm) {
|
||||||
$dataEntryForm=(string)$dataEntryForm;
|
$dataEntryForm=(string)$dataEntryForm;
|
||||||
$objType = $this -> ldapObject -> getType();
|
$objType = $this -> ldapObject -> getType();
|
||||||
$config=LSconfig :: get("LSobjects.".$objType.".LSform.dataEntryForm.".$dataEntryForm);
|
$config=LSconfig :: get("LSobjects.".$objType.".LSform.dataEntryForm.".$dataEntryForm);
|
||||||
|
@ -724,7 +724,7 @@ class LSform {
|
||||||
*
|
*
|
||||||
* @retval void
|
* @retval void
|
||||||
**/
|
**/
|
||||||
function addWarning($txt) {
|
public function addWarning($txt) {
|
||||||
$this -> warnings[]=$txt;
|
$this -> warnings[]=$txt;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -56,7 +56,7 @@ class LSformElement {
|
||||||
*
|
*
|
||||||
* @retval true
|
* @retval true
|
||||||
*/
|
*/
|
||||||
function LSformElement (&$form, $name, $label, $params,&$attr_html){
|
public function __construct(&$form, $name, $label, $params, &$attr_html){
|
||||||
$this -> name = $name;
|
$this -> name = $name;
|
||||||
$this -> label = $label;
|
$this -> label = $label;
|
||||||
$this -> params = $params;
|
$this -> params = $params;
|
||||||
|
@ -76,7 +76,7 @@ class LSformElement {
|
||||||
*
|
*
|
||||||
* @retval boolean Retourne True
|
* @retval boolean Retourne True
|
||||||
*/
|
*/
|
||||||
function setValue($data) {
|
public function setValue($data) {
|
||||||
if (!is_array($data)) {
|
if (!is_array($data)) {
|
||||||
$data=array($data);
|
$data=array($data);
|
||||||
}
|
}
|
||||||
|
@ -98,7 +98,7 @@ class LSformElement {
|
||||||
*
|
*
|
||||||
* @retval boolean Retourne True
|
* @retval boolean Retourne True
|
||||||
*/
|
*/
|
||||||
function setValueFromPostData($data) {
|
public function setValueFromPostData($data) {
|
||||||
if (!is_array($data)) {
|
if (!is_array($data)) {
|
||||||
$data=array($data);
|
$data=array($data);
|
||||||
}
|
}
|
||||||
|
@ -111,7 +111,7 @@ class LSformElement {
|
||||||
*
|
*
|
||||||
* @retval Array Les valeurs de l'élement
|
* @retval Array Les valeurs de l'élement
|
||||||
*/
|
*/
|
||||||
function exportValues(){
|
public function exportValues(){
|
||||||
return $this -> values;
|
return $this -> values;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -126,7 +126,7 @@ class LSformElement {
|
||||||
*
|
*
|
||||||
* @retval void
|
* @retval void
|
||||||
*/
|
*/
|
||||||
function addValue($data) {
|
public function addValue($data) {
|
||||||
if (is_array($data)) {
|
if (is_array($data)) {
|
||||||
$this -> values = array_merge($this -> values, $data);
|
$this -> values = array_merge($this -> values, $data);
|
||||||
}
|
}
|
||||||
|
@ -142,7 +142,7 @@ class LSformElement {
|
||||||
*
|
*
|
||||||
* @retval boolean
|
* @retval boolean
|
||||||
*/
|
*/
|
||||||
function isFreeze(){
|
public function isFreeze(){
|
||||||
return $this -> _freeze;
|
return $this -> _freeze;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -153,7 +153,7 @@ class LSformElement {
|
||||||
*
|
*
|
||||||
* @retval void
|
* @retval void
|
||||||
*/
|
*/
|
||||||
function freeze() {
|
public function freeze() {
|
||||||
$this -> _freeze = true;
|
$this -> _freeze = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -164,7 +164,7 @@ class LSformElement {
|
||||||
*
|
*
|
||||||
* @retval void
|
* @retval void
|
||||||
*/
|
*/
|
||||||
function setRequired($isRequired=true) {
|
public function setRequired($isRequired=true) {
|
||||||
$this -> _required = $isRequired;
|
$this -> _required = $isRequired;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -175,7 +175,7 @@ class LSformElement {
|
||||||
*
|
*
|
||||||
* @retval boolean
|
* @retval boolean
|
||||||
*/
|
*/
|
||||||
function isRequired(){
|
public function isRequired(){
|
||||||
return $this -> _required;
|
return $this -> _required;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -184,7 +184,7 @@ class LSformElement {
|
||||||
*
|
*
|
||||||
* @retval void
|
* @retval void
|
||||||
*/
|
*/
|
||||||
function getLabelInfos() {
|
public function getLabelInfos() {
|
||||||
if ($this -> isRequired()) {
|
if ($this -> isRequired()) {
|
||||||
$return['required']=true;
|
$return['required']=true;
|
||||||
}
|
}
|
||||||
|
@ -212,7 +212,7 @@ class LSformElement {
|
||||||
*
|
*
|
||||||
* @retval boolean true si la valeur est présente en POST, false sinon
|
* @retval boolean true si la valeur est présente en POST, false sinon
|
||||||
*/
|
*/
|
||||||
function getPostData(&$return) {
|
public function getPostData(&$return) {
|
||||||
if($this -> isFreeze()) {
|
if($this -> isFreeze()) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -241,7 +241,7 @@ class LSformElement {
|
||||||
*
|
*
|
||||||
* @retval string Le label de l'élément
|
* @retval string Le label de l'élément
|
||||||
*/
|
*/
|
||||||
function getLabel() {
|
public function getLabel() {
|
||||||
if ($this -> label != "") {
|
if ($this -> label != "") {
|
||||||
return __($this -> label);
|
return __($this -> label);
|
||||||
}
|
}
|
||||||
|
@ -253,7 +253,7 @@ class LSformElement {
|
||||||
*
|
*
|
||||||
* @retval boolean True si le champ est à valeur multiple, False sinon
|
* @retval boolean True si le champ est à valeur multiple, False sinon
|
||||||
*/
|
*/
|
||||||
function isMultiple() {
|
public function isMultiple() {
|
||||||
return $this -> getParam('multiple', false, 'bool');
|
return $this -> getParam('multiple', false, 'bool');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -265,7 +265,7 @@ class LSformElement {
|
||||||
*
|
*
|
||||||
* @retval string Le HTML compilé du template
|
* @retval string Le HTML compilé du template
|
||||||
*/
|
*/
|
||||||
function fetchTemplate($template=NULL,$variables=array()) {
|
public function fetchTemplate($template=NULL,$variables=array()) {
|
||||||
if (!$template) {
|
if (!$template) {
|
||||||
$template = $this -> template;
|
$template = $this -> template;
|
||||||
}
|
}
|
||||||
|
@ -293,7 +293,7 @@ class LSformElement {
|
||||||
*
|
*
|
||||||
* @retval string Code HTML d'un champ vide.
|
* @retval string Code HTML d'un champ vide.
|
||||||
*/
|
*/
|
||||||
function getEmptyField() {
|
public function getEmptyField() {
|
||||||
return $this -> fetchTemplate($this -> fieldTemplate);
|
return $this -> fetchTemplate($this -> fieldTemplate);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -42,7 +42,7 @@ class LSformElement_boolean extends LSformElement {
|
||||||
*
|
*
|
||||||
* @retval array
|
* @retval array
|
||||||
*/
|
*/
|
||||||
function getDisplay(){
|
public function getDisplay(){
|
||||||
$return = $this -> getLabelInfos();
|
$return = $this -> getLabelInfos();
|
||||||
if (!$this -> isFreeze()) {
|
if (!$this -> isFreeze()) {
|
||||||
// Help Infos
|
// Help Infos
|
||||||
|
|
|
@ -73,7 +73,7 @@ class LSformElement_date extends LSformElement {
|
||||||
*
|
*
|
||||||
* @retval boolean Retourne True
|
* @retval boolean Retourne True
|
||||||
*/
|
*/
|
||||||
function setValue($data) {
|
public function setValue($data) {
|
||||||
if (!is_array($data)) {
|
if (!is_array($data)) {
|
||||||
$data=array($data);
|
$data=array($data);
|
||||||
}
|
}
|
||||||
|
@ -96,7 +96,7 @@ class LSformElement_date extends LSformElement {
|
||||||
*
|
*
|
||||||
* @retval Array Les valeurs de l'élement
|
* @retval Array Les valeurs de l'élement
|
||||||
*/
|
*/
|
||||||
function exportValues(){
|
public function exportValues(){
|
||||||
$retval=array();
|
$retval=array();
|
||||||
if (is_array($this -> values)) {
|
if (is_array($this -> values)) {
|
||||||
foreach($this -> values as $val) {
|
foreach($this -> values as $val) {
|
||||||
|
@ -114,7 +114,7 @@ class LSformElement_date extends LSformElement {
|
||||||
*
|
*
|
||||||
* @retval string Le format de la date
|
* @retval string Le format de la date
|
||||||
**/
|
**/
|
||||||
function getFormat() {
|
public function getFormat() {
|
||||||
return $this -> getParam('html_options.format', ($this -> getParam('html_options.time', true)?'%d/%m/%Y, %T':'%d/%m/%Y'));
|
return $this -> getParam('html_options.format', ($this -> getParam('html_options.time', true)?'%d/%m/%Y, %T':'%d/%m/%Y'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -123,7 +123,7 @@ class LSformElement_date extends LSformElement {
|
||||||
*
|
*
|
||||||
* @retval string The date picker style
|
* @retval string The date picker style
|
||||||
**/
|
**/
|
||||||
function getStyle() {
|
public function getStyle() {
|
||||||
$style = $this -> getParam('html_options.style', $this -> default_style, 'string');
|
$style = $this -> getParam('html_options.style', $this -> default_style, 'string');
|
||||||
if ($style) {
|
if ($style) {
|
||||||
if (is_dir(LS_LIB_DIR.'arian-mootools-datepicker/datepicker_'.$style)) {
|
if (is_dir(LS_LIB_DIR.'arian-mootools-datepicker/datepicker_'.$style)) {
|
||||||
|
@ -141,7 +141,7 @@ class LSformElement_date extends LSformElement {
|
||||||
*
|
*
|
||||||
* @retval array
|
* @retval array
|
||||||
*/
|
*/
|
||||||
function getDisplay(){
|
public function getDisplay(){
|
||||||
$return = $this -> getLabelInfos();
|
$return = $this -> getLabelInfos();
|
||||||
// value
|
// value
|
||||||
if (!$this -> isFreeze()) {
|
if (!$this -> isFreeze()) {
|
||||||
|
@ -185,7 +185,7 @@ class LSformElement_date extends LSformElement {
|
||||||
* @retval mixed Format de date jscalendar (string) ou False si la convertion
|
* @retval mixed Format de date jscalendar (string) ou False si la convertion
|
||||||
* n'a pas réussi.
|
* n'a pas réussi.
|
||||||
*/
|
*/
|
||||||
function php2js_format($format) {
|
public function php2js_format($format) {
|
||||||
if (isset($this -> _cache_php2js_format[$format])) {
|
if (isset($this -> _cache_php2js_format[$format])) {
|
||||||
return $this -> _cache_php2js_format[$format];
|
return $this -> _cache_php2js_format[$format];
|
||||||
}
|
}
|
||||||
|
|
|
@ -43,7 +43,7 @@ class LSformElement_image extends LSformElement {
|
||||||
*
|
*
|
||||||
* @retval array
|
* @retval array
|
||||||
*/
|
*/
|
||||||
function getDisplay(){
|
public function getDisplay(){
|
||||||
LSsession :: addCssFile('LSformElement_image.css');
|
LSsession :: addCssFile('LSformElement_image.css');
|
||||||
$return = true;
|
$return = true;
|
||||||
$id=$this -> name.'_'.rand();
|
$id=$this -> name.'_'.rand();
|
||||||
|
@ -91,7 +91,7 @@ class LSformElement_image extends LSformElement {
|
||||||
*
|
*
|
||||||
* @retval boolean true si la valeur est présente en POST, false sinon
|
* @retval boolean true si la valeur est présente en POST, false sinon
|
||||||
*/
|
*/
|
||||||
function getPostData(&$return) {
|
public function getPostData(&$return) {
|
||||||
if($this -> isFreeze()) {
|
if($this -> isFreeze()) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,7 +35,7 @@ class LSformElement_jsonCompositeAttribute extends LSformElement {
|
||||||
var $template = 'LSformElement_jsonCompositeAttribute.tpl';
|
var $template = 'LSformElement_jsonCompositeAttribute.tpl';
|
||||||
var $fieldTemplate = 'LSformElement_jsonCompositeAttribute_field.tpl';
|
var $fieldTemplate = 'LSformElement_jsonCompositeAttribute_field.tpl';
|
||||||
|
|
||||||
function LSformElement_jsonCompositeAttribute (&$form, $name, $label, $params,&$attr_html){
|
public function __construct(&$form, $name, $label, $params, &$attr_html){
|
||||||
parent :: LSformElement($form, $name, $label, $params,$attr_html);
|
parent :: LSformElement($form, $name, $label, $params,$attr_html);
|
||||||
$this -> components = $this -> getParam('html_options.components', array());
|
$this -> components = $this -> getParam('html_options.components', array());
|
||||||
}
|
}
|
||||||
|
@ -73,7 +73,7 @@ class LSformElement_jsonCompositeAttribute extends LSformElement {
|
||||||
*
|
*
|
||||||
* @retval array
|
* @retval array
|
||||||
*/
|
*/
|
||||||
function getDisplay(){
|
public function getDisplay(){
|
||||||
$return = $this -> getLabelInfos();
|
$return = $this -> getLabelInfos();
|
||||||
|
|
||||||
$parseValues=array();
|
$parseValues=array();
|
||||||
|
@ -123,7 +123,7 @@ class LSformElement_jsonCompositeAttribute extends LSformElement {
|
||||||
*
|
*
|
||||||
* @retval string Le HTML compilé du template
|
* @retval string Le HTML compilé du template
|
||||||
*/
|
*/
|
||||||
function fetchTemplate($template=NULL,$variables=array()) {
|
public function fetchTemplate($template=NULL,$variables=array()) {
|
||||||
$components = $this -> components;
|
$components = $this -> components;
|
||||||
foreach($components as $c => $cconf) {
|
foreach($components as $c => $cconf) {
|
||||||
if ($cconf['type']=='select_list') {
|
if ($cconf['type']=='select_list') {
|
||||||
|
@ -148,7 +148,7 @@ class LSformElement_jsonCompositeAttribute extends LSformElement {
|
||||||
*
|
*
|
||||||
* @retval array
|
* @retval array
|
||||||
**/
|
**/
|
||||||
function translateComponentValue($c,$value,$inLoop=false) {
|
protected function translateComponentValue($c,$value,$inLoop=false) {
|
||||||
if (!$inLoop && isset($this -> components[$c]['multiple']) && $this -> components[$c]['multiple']) {
|
if (!$inLoop && isset($this -> components[$c]['multiple']) && $this -> components[$c]['multiple']) {
|
||||||
$retval = array();
|
$retval = array();
|
||||||
if (!is_array($value))
|
if (!is_array($value))
|
||||||
|
@ -219,7 +219,7 @@ class LSformElement_jsonCompositeAttribute extends LSformElement {
|
||||||
*
|
*
|
||||||
* @retval boolean true if value is in POST data, false instead
|
* @retval boolean true if value is in POST data, false instead
|
||||||
*/
|
*/
|
||||||
function getPostData(&$return) {
|
public function getPostData(&$return) {
|
||||||
if($this -> isFreeze()) {
|
if($this -> isFreeze()) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -43,7 +43,7 @@ class LSformElement_labeledValue extends LSformElement {
|
||||||
*
|
*
|
||||||
* @retval array
|
* @retval array
|
||||||
*/
|
*/
|
||||||
function getDisplay(){
|
public function getDisplay(){
|
||||||
$return = $this -> getLabelInfos();
|
$return = $this -> getLabelInfos();
|
||||||
|
|
||||||
$parseValues=array();
|
$parseValues=array();
|
||||||
|
@ -64,7 +64,7 @@ class LSformElement_labeledValue extends LSformElement {
|
||||||
*
|
*
|
||||||
* @retval string Code HTML d'un champ vide.
|
* @retval string Code HTML d'un champ vide.
|
||||||
*/
|
*/
|
||||||
function getEmptyField() {
|
public function getEmptyField() {
|
||||||
return $this -> fetchTemplate($this -> fieldTemplate,array(
|
return $this -> fetchTemplate($this -> fieldTemplate,array(
|
||||||
'labels' => $this -> getParam('html_options.labels'),
|
'labels' => $this -> getParam('html_options.labels'),
|
||||||
));
|
));
|
||||||
|
@ -77,7 +77,7 @@ class LSformElement_labeledValue extends LSformElement {
|
||||||
*
|
*
|
||||||
* @retval array Un tableau cle->valeur contenant value et label
|
* @retval array Un tableau cle->valeur contenant value et label
|
||||||
**/
|
**/
|
||||||
function parseValue($value) {
|
public function parseValue($value) {
|
||||||
$ret=array('raw_value' => $value);
|
$ret=array('raw_value' => $value);
|
||||||
if (preg_match('/^\[([^\]]*)\](.*)$/',$value,$m)) {
|
if (preg_match('/^\[([^\]]*)\](.*)$/',$value,$m)) {
|
||||||
$ret['label'] = $m[1];
|
$ret['label'] = $m[1];
|
||||||
|
@ -99,7 +99,7 @@ class LSformElement_labeledValue extends LSformElement {
|
||||||
*
|
*
|
||||||
* @retval boolean true si la valeur est présente en POST, false sinon
|
* @retval boolean true si la valeur est présente en POST, false sinon
|
||||||
*/
|
*/
|
||||||
function getPostData(&$return) {
|
public function getPostData(&$return) {
|
||||||
if($this -> isFreeze()) {
|
if($this -> isFreeze()) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -44,7 +44,7 @@ class LSformElement_mail extends LSformElement_text {
|
||||||
|
|
||||||
var $fieldTemplate = 'LSformElement_uri_field.tpl';
|
var $fieldTemplate = 'LSformElement_uri_field.tpl';
|
||||||
|
|
||||||
function getDisplay() {
|
public function getDisplay() {
|
||||||
LSsession :: addHelpInfos (
|
LSsession :: addHelpInfos (
|
||||||
'LSformElement_mail',
|
'LSformElement_mail',
|
||||||
array(
|
array(
|
||||||
|
@ -57,7 +57,7 @@ class LSformElement_mail extends LSformElement_text {
|
||||||
return parent :: getDisplay();
|
return parent :: getDisplay();
|
||||||
}
|
}
|
||||||
|
|
||||||
function fetchTemplate($template=NULL,$variables=array()) {
|
public function fetchTemplate($template=NULL,$variables=array()) {
|
||||||
if ($this -> getParam('html_options.disableMailSending', false, 'bool')) {
|
if ($this -> getParam('html_options.disableMailSending', false, 'bool')) {
|
||||||
$this -> fetchVariables['uriClass'] .= " LSformElement_mail_disableMailSending";
|
$this -> fetchVariables['uriClass'] .= " LSformElement_mail_disableMailSending";
|
||||||
}
|
}
|
||||||
|
|
|
@ -48,7 +48,7 @@ class LSformElement_mailQuota extends LSformElement {
|
||||||
*
|
*
|
||||||
* @retval array
|
* @retval array
|
||||||
*/
|
*/
|
||||||
function getDisplay(){
|
public function getDisplay(){
|
||||||
$return = $this -> getLabelInfos();
|
$return = $this -> getLabelInfos();
|
||||||
|
|
||||||
$quotas=array();
|
$quotas=array();
|
||||||
|
@ -99,7 +99,7 @@ class LSformElement_mailQuota extends LSformElement {
|
||||||
*
|
*
|
||||||
* @retval string Code HTML d'un champ vide.
|
* @retval string Code HTML d'un champ vide.
|
||||||
*/
|
*/
|
||||||
function getEmptyField() {
|
public function getEmptyField() {
|
||||||
return $this -> fetchTemplate(
|
return $this -> fetchTemplate(
|
||||||
$this -> fieldTemplate,
|
$this -> fieldTemplate,
|
||||||
array(
|
array(
|
||||||
|
@ -113,7 +113,7 @@ class LSformElement_mailQuota extends LSformElement {
|
||||||
*
|
*
|
||||||
* @retval string Suffix value
|
* @retval string Suffix value
|
||||||
**/
|
**/
|
||||||
function getSuffix() {
|
public function getSuffix() {
|
||||||
return $this -> getParam('html_options.suffix', 'S', 'string');
|
return $this -> getParam('html_options.suffix', 'S', 'string');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -127,7 +127,7 @@ class LSformElement_mailQuota extends LSformElement {
|
||||||
*
|
*
|
||||||
* @retval boolean true si la valeur est présente en POST, false sinon
|
* @retval boolean true si la valeur est présente en POST, false sinon
|
||||||
*/
|
*/
|
||||||
function getPostData(&$return) {
|
public function getPostData(&$return) {
|
||||||
if($this -> isFreeze()) {
|
if($this -> isFreeze()) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -61,7 +61,7 @@ class LSformElement_maildir extends LSformElement_text {
|
||||||
|
|
||||||
var $fieldTemplate = 'LSformElement_maildir_field.tpl';
|
var $fieldTemplate = 'LSformElement_maildir_field.tpl';
|
||||||
|
|
||||||
function getDisplay() {
|
public function getDisplay() {
|
||||||
LSsession :: addHelpInfos (
|
LSsession :: addHelpInfos (
|
||||||
'LSformElement_maildir',
|
'LSformElement_maildir',
|
||||||
array(
|
array(
|
||||||
|
@ -82,7 +82,7 @@ class LSformElement_maildir extends LSformElement_text {
|
||||||
*
|
*
|
||||||
* @retval boolean true si la valeur est présente en POST, false sinon
|
* @retval boolean true si la valeur est présente en POST, false sinon
|
||||||
*/
|
*/
|
||||||
function getPostData(&$return) {
|
public function getPostData(&$return) {
|
||||||
// Récupère la valeur dans _POST, et les vérifie avec la fonction générale
|
// Récupère la valeur dans _POST, et les vérifie avec la fonction générale
|
||||||
$retval = parent :: getPostData($return);
|
$retval = parent :: getPostData($return);
|
||||||
|
|
||||||
|
|
|
@ -48,7 +48,7 @@ class LSformElement_password extends LSformElement {
|
||||||
*
|
*
|
||||||
* @retval boolean true si la valeur est présente en POST, false sinon
|
* @retval boolean true si la valeur est présente en POST, false sinon
|
||||||
*/
|
*/
|
||||||
function getPostData(&$return) {
|
public function getPostData(&$return) {
|
||||||
// Récupère la valeur dans _POST, et les vérifie avec la fonction générale
|
// Récupère la valeur dans _POST, et les vérifie avec la fonction générale
|
||||||
$retval = parent :: getPostData($return);
|
$retval = parent :: getPostData($return);
|
||||||
// Si une valeur est recupérée
|
// Si une valeur est recupérée
|
||||||
|
@ -118,7 +118,7 @@ class LSformElement_password extends LSformElement {
|
||||||
*
|
*
|
||||||
* @retval array
|
* @retval array
|
||||||
*/
|
*/
|
||||||
function getDisplay(){
|
public function getDisplay(){
|
||||||
LSsession :: addCssFile('LSformElement_password.css');
|
LSsession :: addCssFile('LSformElement_password.css');
|
||||||
$return = $this -> getLabelInfos();
|
$return = $this -> getLabelInfos();
|
||||||
$pwd = "";
|
$pwd = "";
|
||||||
|
@ -173,7 +173,7 @@ class LSformElement_password extends LSformElement {
|
||||||
return $return;
|
return $return;
|
||||||
}
|
}
|
||||||
|
|
||||||
function generatePassword($params=NULL) {
|
public static function generatePassword($params=NULL) {
|
||||||
if (LSconfig :: get('html_options.use_pwgen', false, null, $params)) {
|
if (LSconfig :: get('html_options.use_pwgen', false, null, $params)) {
|
||||||
$args = LSconfig :: get('html_options.pwgen_opts', '', 'string', $params);
|
$args = LSconfig :: get('html_options.pwgen_opts', '', 'string', $params);
|
||||||
$len = LSconfig :: get('html_options.lenght', 8, 'int', $params);
|
$len = LSconfig :: get('html_options.lenght', 8, 'int', $params);
|
||||||
|
@ -191,7 +191,7 @@ class LSformElement_password extends LSformElement {
|
||||||
return generatePassword(LSconfig :: get('html_options.chars', null, null, $params), LSconfig :: get('html_options.lenght', 8, 'int', $params));
|
return generatePassword(LSconfig :: get('html_options.chars', null, null, $params), LSconfig :: get('html_options.lenght', 8, 'int', $params));
|
||||||
}
|
}
|
||||||
|
|
||||||
function verifyPassword($pwd) {
|
public function verifyPassword($pwd) {
|
||||||
if ($this -> attr_html -> attribute -> ldapObject -> isNew()) {
|
if ($this -> attr_html -> attribute -> ldapObject -> isNew()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -218,7 +218,7 @@ class LSformElement_password extends LSformElement {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function getMailAttrs() {
|
public function getMailAttrs() {
|
||||||
if (!$this -> getParam('html_options.mail'))
|
if (!$this -> getParam('html_options.mail'))
|
||||||
return False;
|
return False;
|
||||||
if ($this -> getParam('html_options.mail.get_mail_attr_function')) {
|
if ($this -> getParam('html_options.mail.get_mail_attr_function')) {
|
||||||
|
@ -239,7 +239,7 @@ class LSformElement_password extends LSformElement {
|
||||||
return $this -> getParam('html_options.mail.mail_attr');
|
return $this -> getParam('html_options.mail.mail_attr');
|
||||||
}
|
}
|
||||||
|
|
||||||
function send($params) {
|
public function send($params) {
|
||||||
if (is_array($this -> sendMail)) {
|
if (is_array($this -> sendMail)) {
|
||||||
$mail = (String)$this -> sendMail['mail'];
|
$mail = (String)$this -> sendMail['mail'];
|
||||||
Lsdebug($mail);
|
Lsdebug($mail);
|
||||||
|
|
|
@ -39,7 +39,7 @@ class LSformElement_postaladdress extends LSformElement_textarea {
|
||||||
*
|
*
|
||||||
* @retval array
|
* @retval array
|
||||||
*/
|
*/
|
||||||
function getDisplay(){
|
public function getDisplay(){
|
||||||
$return = parent :: getDisplay();
|
$return = parent :: getDisplay();
|
||||||
if ($this -> isFreeze()) {
|
if ($this -> isFreeze()) {
|
||||||
if (!empty($this->values)) {
|
if (!empty($this->values)) {
|
||||||
|
|
|
@ -39,7 +39,7 @@ class LSformElement_pre extends LSformElement_textarea {
|
||||||
*
|
*
|
||||||
* @retval array
|
* @retval array
|
||||||
*/
|
*/
|
||||||
function getDisplay(){
|
public function getDisplay(){
|
||||||
$return = parent :: getDisplay();
|
$return = parent :: getDisplay();
|
||||||
LSsession :: addCssFile('LSformElement_pre.css');
|
LSsession :: addCssFile('LSformElement_pre.css');
|
||||||
return $return;
|
return $return;
|
||||||
|
|
|
@ -48,7 +48,7 @@ class LSformElement_quota extends LSformElement {
|
||||||
*
|
*
|
||||||
* @retval array
|
* @retval array
|
||||||
*/
|
*/
|
||||||
function getDisplay(){
|
public function getDisplay(){
|
||||||
$return = $this -> getLabelInfos();
|
$return = $this -> getLabelInfos();
|
||||||
|
|
||||||
$quotas=array();
|
$quotas=array();
|
||||||
|
@ -99,7 +99,7 @@ class LSformElement_quota extends LSformElement {
|
||||||
*
|
*
|
||||||
* @retval string Code HTML d'un champ vide.
|
* @retval string Code HTML d'un champ vide.
|
||||||
*/
|
*/
|
||||||
function getEmptyField() {
|
public function getEmptyField() {
|
||||||
return $this -> fetchTemplate(
|
return $this -> fetchTemplate(
|
||||||
$this -> fieldTemplate,
|
$this -> fieldTemplate,
|
||||||
array(
|
array(
|
||||||
|
@ -118,7 +118,7 @@ class LSformElement_quota extends LSformElement {
|
||||||
*
|
*
|
||||||
* @retval boolean true si la valeur est présente en POST, false sinon
|
* @retval boolean true si la valeur est présente en POST, false sinon
|
||||||
*/
|
*/
|
||||||
function getPostData(&$return) {
|
public function getPostData(&$return) {
|
||||||
if($this -> isFreeze()) {
|
if($this -> isFreeze()) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -43,7 +43,7 @@ class LSformElement_rss extends LSformElement_text {
|
||||||
|
|
||||||
var $fieldTemplate = 'LSformElement_uri_field.tpl';
|
var $fieldTemplate = 'LSformElement_uri_field.tpl';
|
||||||
|
|
||||||
function getDisplay() {
|
public function getDisplay() {
|
||||||
LSsession :: addHelpInfos (
|
LSsession :: addHelpInfos (
|
||||||
'LSformElement_rss',
|
'LSformElement_rss',
|
||||||
array(
|
array(
|
||||||
|
|
|
@ -42,7 +42,7 @@ class LSformElement_select extends LSformElement {
|
||||||
*
|
*
|
||||||
* @retval array
|
* @retval array
|
||||||
*/
|
*/
|
||||||
function getDisplay(){
|
public function getDisplay(){
|
||||||
$return = $this -> getLabelInfos();
|
$return = $this -> getLabelInfos();
|
||||||
$params = array();
|
$params = array();
|
||||||
if (!$this -> isFreeze()) {
|
if (!$this -> isFreeze()) {
|
||||||
|
@ -71,7 +71,7 @@ class LSformElement_select extends LSformElement {
|
||||||
*
|
*
|
||||||
* @retval string or False The value's label or False if this value is incorrect
|
* @retval string or False The value's label or False if this value is incorrect
|
||||||
*/
|
*/
|
||||||
public function isValidValue($value,$possible_values=False) {
|
public static function isValidValue($value,$possible_values=False) {
|
||||||
if (!is_array($possible_values)) {
|
if (!is_array($possible_values)) {
|
||||||
if (isset($this) && is_a($this, __CLASS__) && $this -> getParam('text_possible_values')) {
|
if (isset($this) && is_a($this, __CLASS__) && $this -> getParam('text_possible_values')) {
|
||||||
$possible_values = $this -> getParam('text_possible_values');
|
$possible_values = $this -> getParam('text_possible_values');
|
||||||
|
|
|
@ -43,7 +43,7 @@ class LSformElement_select_box extends LSformElement_select {
|
||||||
*
|
*
|
||||||
* @retval array
|
* @retval array
|
||||||
*/
|
*/
|
||||||
function getDisplay(){
|
public function getDisplay(){
|
||||||
if (!$this -> isFreeze()) {
|
if (!$this -> isFreeze()) {
|
||||||
LSsession :: addCssFile('LSformElement_select_box.css');
|
LSsession :: addCssFile('LSformElement_select_box.css');
|
||||||
}
|
}
|
||||||
|
|
|
@ -53,7 +53,7 @@ class LSformElement_select_object extends LSformElement {
|
||||||
*
|
*
|
||||||
* @retval array
|
* @retval array
|
||||||
*/
|
*/
|
||||||
function getDisplay($refresh=NULL){
|
public function getDisplay($refresh=NULL){
|
||||||
LSsession :: addCssFile('LSformElement_select_object.css');
|
LSsession :: addCssFile('LSformElement_select_object.css');
|
||||||
if ($refresh) {
|
if ($refresh) {
|
||||||
$this -> values = $this -> getValuesFromSession();
|
$this -> values = $this -> getValuesFromSession();
|
||||||
|
@ -128,7 +128,7 @@ class LSformElement_select_object extends LSformElement {
|
||||||
/*
|
/*
|
||||||
* Return the values of the object form the session variable
|
* Return the values of the object form the session variable
|
||||||
*/
|
*/
|
||||||
function getValuesFromSession() {
|
public function getValuesFromSession() {
|
||||||
return $this -> attr_html -> getValuesFromSession();
|
return $this -> attr_html -> getValuesFromSession();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -139,7 +139,7 @@ class LSformElement_select_object extends LSformElement {
|
||||||
*
|
*
|
||||||
* @retval void
|
* @retval void
|
||||||
**/
|
**/
|
||||||
function setSelectableObject($object) {
|
public function setSelectableObject($object) {
|
||||||
$this -> selectableObject = $object;
|
$this -> selectableObject = $object;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -148,7 +148,7 @@ class LSformElement_select_object extends LSformElement {
|
||||||
*
|
*
|
||||||
* @retval Array The values of the element
|
* @retval Array The values of the element
|
||||||
*/
|
*/
|
||||||
function exportValues(){
|
public function exportValues(){
|
||||||
$values = $this -> attr_html -> getValuesFromFormValues($this -> values);
|
$values = $this -> attr_html -> getValuesFromFormValues($this -> values);
|
||||||
return $values;
|
return $values;
|
||||||
}
|
}
|
||||||
|
@ -162,7 +162,7 @@ class LSformElement_select_object extends LSformElement {
|
||||||
*
|
*
|
||||||
* @retval boolean Return True
|
* @retval boolean Return True
|
||||||
*/
|
*/
|
||||||
function setValueFromPostData($data) {
|
public function setValueFromPostData($data) {
|
||||||
LSformElement::setValueFromPostData($data);
|
LSformElement::setValueFromPostData($data);
|
||||||
$this -> values = $this -> attr_html -> refreshForm($this -> values,true);
|
$this -> values = $this -> attr_html -> refreshForm($this -> values,true);
|
||||||
return true;
|
return true;
|
||||||
|
@ -175,7 +175,7 @@ class LSformElement_select_object extends LSformElement {
|
||||||
*
|
*
|
||||||
* @retval array(dn -> displayName) Found objects
|
* @retval array(dn -> displayName) Found objects
|
||||||
*/
|
*/
|
||||||
function searchAdd ($pattern) {
|
public function searchAdd ($pattern) {
|
||||||
if ($this -> getParam('html_options.selectable_object')) {
|
if ($this -> getParam('html_options.selectable_object')) {
|
||||||
$obj_type = $this -> getParam('html_options.selectable_object.object_type');
|
$obj_type = $this -> getParam('html_options.selectable_object.object_type');
|
||||||
if (LSsession :: loadLSobject($obj_type)) {
|
if (LSsession :: loadLSobject($obj_type)) {
|
||||||
|
|
|
@ -42,7 +42,7 @@ class LSformElement_ssh_key extends LSformElement {
|
||||||
*
|
*
|
||||||
* @retval array
|
* @retval array
|
||||||
*/
|
*/
|
||||||
function getDisplay(){
|
public function getDisplay(){
|
||||||
LSsession :: addCssFile('LSformElement_ssh_key.css');
|
LSsession :: addCssFile('LSformElement_ssh_key.css');
|
||||||
$return = $this -> getLabelInfos();
|
$return = $this -> getLabelInfos();
|
||||||
$params = array();
|
$params = array();
|
||||||
|
|
|
@ -73,7 +73,7 @@ class LSformElement_supannCompositeAttribute extends LSformElement {
|
||||||
*
|
*
|
||||||
* @retval array
|
* @retval array
|
||||||
*/
|
*/
|
||||||
function getDisplay(){
|
public function getDisplay(){
|
||||||
$return = $this -> getLabelInfos();
|
$return = $this -> getLabelInfos();
|
||||||
|
|
||||||
$parseValues=array();
|
$parseValues=array();
|
||||||
|
@ -123,7 +123,7 @@ class LSformElement_supannCompositeAttribute extends LSformElement {
|
||||||
*
|
*
|
||||||
* @retval string Code HTML d'un champ vide.
|
* @retval string Code HTML d'un champ vide.
|
||||||
*/
|
*/
|
||||||
function getEmptyField() {
|
public function getEmptyField() {
|
||||||
return $this -> fetchTemplate($this -> fieldTemplate,array('components' => $this -> components));
|
return $this -> fetchTemplate($this -> fieldTemplate,array('components' => $this -> components));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -172,7 +172,7 @@ class LSformElement_supannCompositeAttribute extends LSformElement {
|
||||||
*
|
*
|
||||||
* @retval boolean true si la valeur est présente en POST, false sinon
|
* @retval boolean true si la valeur est présente en POST, false sinon
|
||||||
*/
|
*/
|
||||||
function getPostData(&$return) {
|
public function getPostData(&$return) {
|
||||||
if($this -> isFreeze()) {
|
if($this -> isFreeze()) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,7 +35,7 @@ LSsession :: loadLSaddon('supann');
|
||||||
|
|
||||||
class LSformElement_supannEtuInscription extends LSformElement_supannCompositeAttribute {
|
class LSformElement_supannEtuInscription extends LSformElement_supannCompositeAttribute {
|
||||||
|
|
||||||
function LSformElement_supannEtuInscription (&$form, $name, $label, $params,&$attr_html){
|
public function __construct(&$form, $name, $label, $params, &$attr_html){
|
||||||
$this -> components = array (
|
$this -> components = array (
|
||||||
'etab' => array (
|
'etab' => array (
|
||||||
'label' => _('Organism'),
|
'label' => _('Organism'),
|
||||||
|
|
|
@ -46,7 +46,7 @@ class LSformElement_supannLabeledValue extends LSformElement {
|
||||||
*
|
*
|
||||||
* @retval array
|
* @retval array
|
||||||
*/
|
*/
|
||||||
function getDisplay(){
|
public function getDisplay(){
|
||||||
$return = $this -> getLabelInfos();
|
$return = $this -> getLabelInfos();
|
||||||
|
|
||||||
$parseValues=array();
|
$parseValues=array();
|
||||||
|
@ -79,7 +79,7 @@ class LSformElement_supannLabeledValue extends LSformElement {
|
||||||
*
|
*
|
||||||
* @retval array Un tableau cle->valeur contenant value, translated et label
|
* @retval array Un tableau cle->valeur contenant value, translated et label
|
||||||
**/
|
**/
|
||||||
function parseValue($value) {
|
public function parseValue($value) {
|
||||||
$retval=array(
|
$retval=array(
|
||||||
'value' => $value,
|
'value' => $value,
|
||||||
);
|
);
|
||||||
|
|
|
@ -34,7 +34,7 @@ LSsession :: loadLSaddon('supann');
|
||||||
|
|
||||||
class LSformElement_supannRoleEntite extends LSformElement_supannCompositeAttribute {
|
class LSformElement_supannRoleEntite extends LSformElement_supannCompositeAttribute {
|
||||||
|
|
||||||
function LSformElement_supannRoleEntite (&$form, $name, $label, $params,&$attr_html){
|
public function __construct(&$form, $name, $label, $params, &$attr_html){
|
||||||
$this -> components = array (
|
$this -> components = array (
|
||||||
'role' => array (
|
'role' => array (
|
||||||
'label' => _('Role'),
|
'label' => _('Role'),
|
||||||
|
|
|
@ -40,7 +40,7 @@ class LSformElement_tel extends LSformElement_text {
|
||||||
|
|
||||||
var $fieldTemplate = 'LSformElement_uri_field.tpl';
|
var $fieldTemplate = 'LSformElement_uri_field.tpl';
|
||||||
|
|
||||||
function getDisplay() {
|
public function getDisplay() {
|
||||||
$this -> fetchVariables['uriLinkTitle'] = $this -> attr_html -> attribute -> ldapObject ->getDisplayName();
|
$this -> fetchVariables['uriLinkTitle'] = $this -> attr_html -> attribute -> ldapObject ->getDisplayName();
|
||||||
return parent :: getDisplay();
|
return parent :: getDisplay();
|
||||||
}
|
}
|
||||||
|
|
|
@ -44,7 +44,7 @@ class LSformElement_text extends LSformElement {
|
||||||
*
|
*
|
||||||
* @retval array
|
* @retval array
|
||||||
*/
|
*/
|
||||||
function getDisplay(){
|
public function getDisplay(){
|
||||||
$return = $this -> getLabelInfos();
|
$return = $this -> getLabelInfos();
|
||||||
// value
|
// value
|
||||||
if (!$this -> isFreeze()) {
|
if (!$this -> isFreeze()) {
|
||||||
|
|
|
@ -42,7 +42,7 @@ class LSformElement_textarea extends LSformElement {
|
||||||
*
|
*
|
||||||
* @retval array
|
* @retval array
|
||||||
*/
|
*/
|
||||||
function getDisplay(){
|
public function getDisplay(){
|
||||||
$return = $this -> getLabelInfos();
|
$return = $this -> getLabelInfos();
|
||||||
if (!$this -> isFreeze()) {
|
if (!$this -> isFreeze()) {
|
||||||
LSsession :: addHelpInfos(
|
LSsession :: addHelpInfos(
|
||||||
|
|
|
@ -44,7 +44,7 @@ class LSformElement_url extends LSformElement_text {
|
||||||
|
|
||||||
var $fieldTemplate = 'LSformElement_uri_field.tpl';
|
var $fieldTemplate = 'LSformElement_uri_field.tpl';
|
||||||
|
|
||||||
function getDisplay() {
|
public function getDisplay() {
|
||||||
LSsession :: addHelpInfos (
|
LSsession :: addHelpInfos (
|
||||||
'LSformElement_url',
|
'LSformElement_url',
|
||||||
array(
|
array(
|
||||||
|
|
|
@ -40,7 +40,7 @@ class LSformElement_valueWithUnit extends LSformElement {
|
||||||
* @retval array|False Le tableau contenant en cle les seuils et en valeur les labels des unites.
|
* @retval array|False Le tableau contenant en cle les seuils et en valeur les labels des unites.
|
||||||
* Si le parametre units n'est pas defini, cette fonction retournera False
|
* Si le parametre units n'est pas defini, cette fonction retournera False
|
||||||
**/
|
**/
|
||||||
function getUnits() {
|
public function getUnits() {
|
||||||
$units = $this -> getParam('html_options.units');
|
$units = $this -> getParam('html_options.units');
|
||||||
if (is_array($units)) {
|
if (is_array($units)) {
|
||||||
if ($this -> getParam('html_options.translate_labels', true)) {
|
if ($this -> getParam('html_options.translate_labels', true)) {
|
||||||
|
@ -65,7 +65,7 @@ class LSformElement_valueWithUnit extends LSformElement {
|
||||||
*
|
*
|
||||||
* @retbal string Formatted number
|
* @retbal string Formatted number
|
||||||
*/
|
*/
|
||||||
function formatNumber($number) {
|
public function formatNumber($number) {
|
||||||
if ((int)$number==$number) return $number;
|
if ((int)$number==$number) return $number;
|
||||||
return number_format($number,
|
return number_format($number,
|
||||||
$this -> getParam('html_options.nb_decimals', 2, 'int'),
|
$this -> getParam('html_options.nb_decimals', 2, 'int'),
|
||||||
|
@ -81,7 +81,7 @@ class LSformElement_valueWithUnit extends LSformElement {
|
||||||
*
|
*
|
||||||
* @retval array
|
* @retval array
|
||||||
*/
|
*/
|
||||||
function getDisplay(){
|
public function getDisplay(){
|
||||||
$return = $this -> getLabelInfos();
|
$return = $this -> getLabelInfos();
|
||||||
|
|
||||||
$values_and_units=array();
|
$values_and_units=array();
|
||||||
|
@ -128,7 +128,7 @@ class LSformElement_valueWithUnit extends LSformElement {
|
||||||
*
|
*
|
||||||
* @retval string Code HTML d'un champ vide.
|
* @retval string Code HTML d'un champ vide.
|
||||||
*/
|
*/
|
||||||
function getEmptyField() {
|
public function getEmptyField() {
|
||||||
return $this -> fetchTemplate(
|
return $this -> fetchTemplate(
|
||||||
$this -> fieldTemplate,
|
$this -> fieldTemplate,
|
||||||
array(
|
array(
|
||||||
|
@ -147,7 +147,7 @@ class LSformElement_valueWithUnit extends LSformElement {
|
||||||
*
|
*
|
||||||
* @retval boolean true si la valeur est présente en POST, false sinon
|
* @retval boolean true si la valeur est présente en POST, false sinon
|
||||||
*/
|
*/
|
||||||
function getPostData(&$return) {
|
public function getPostData(&$return) {
|
||||||
if($this -> isFreeze()) {
|
if($this -> isFreeze()) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,7 +40,7 @@ class LSformElement_wysiwyg extends LSformElement {
|
||||||
*
|
*
|
||||||
* @retval array
|
* @retval array
|
||||||
*/
|
*/
|
||||||
function getDisplay(){
|
public function getDisplay(){
|
||||||
$return = $this -> getLabelInfos();
|
$return = $this -> getLabelInfos();
|
||||||
if (!$this -> isFreeze()) {
|
if (!$this -> isFreeze()) {
|
||||||
LSsession :: addJSscript('tinymce.min.js', 'includes/libs/tinymce/js/tinymce');
|
LSsession :: addJSscript('tinymce.min.js', 'includes/libs/tinymce/js/tinymce');
|
||||||
|
|
|
@ -43,7 +43,7 @@ class LSformElement_xmpp extends LSformElement_text {
|
||||||
|
|
||||||
var $fieldTemplate = 'LSformElement_uri_field.tpl';
|
var $fieldTemplate = 'LSformElement_uri_field.tpl';
|
||||||
|
|
||||||
function getDisplay() {
|
public function getDisplay() {
|
||||||
LSsession :: addHelpInfos (
|
LSsession :: addHelpInfos (
|
||||||
'LSformElement_xmpp',
|
'LSformElement_xmpp',
|
||||||
array(
|
array(
|
||||||
|
|
|
@ -27,15 +27,6 @@
|
||||||
*/
|
*/
|
||||||
class LSformRule {
|
class LSformRule {
|
||||||
|
|
||||||
/**
|
|
||||||
* Constructeur
|
|
||||||
*
|
|
||||||
* @author Benjamin Renard <brenard@easter-eggs.com>*
|
|
||||||
*/
|
|
||||||
function LSformRule () {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Validation de données
|
* Validation de données
|
||||||
*
|
*
|
||||||
|
@ -45,7 +36,7 @@ class LSformRule {
|
||||||
*
|
*
|
||||||
* @return boolean True si les données sont valide, False sinon.
|
* @return boolean True si les données sont valide, False sinon.
|
||||||
*/
|
*/
|
||||||
function validate($value,$options=NULL,$formElement) {
|
public static function validate($value,$options=NULL,$formElement) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -36,7 +36,7 @@ class LSformRule_LSformElement_select_validValue extends LSformRule {
|
||||||
*
|
*
|
||||||
* @return boolean true if the value is valide, false if not
|
* @return boolean true if the value is valide, false if not
|
||||||
*/
|
*/
|
||||||
function validate($value,$option,$formElement) {
|
public static function validate($value,$option,$formElement) {
|
||||||
$ret = $formElement -> isValidValue($value);
|
$ret = $formElement -> isValidValue($value);
|
||||||
if ($ret===False) return False;
|
if ($ret===False) return False;
|
||||||
return True;
|
return True;
|
||||||
|
|
|
@ -37,7 +37,7 @@ class LSformRule_alphanumeric extends LSformRule {
|
||||||
*
|
*
|
||||||
* @return boolean true si la valeur est valide, false sinon
|
* @return boolean true si la valeur est valide, false sinon
|
||||||
*/
|
*/
|
||||||
function validate ($value,$options=array(),$formElement) {
|
public static function validate ($value,$options=array(),$formElement) {
|
||||||
|
|
||||||
|
|
||||||
if (isset($options['params']['withAccents']) && $options['params']['withAccents'] == true){
|
if (isset($options['params']['withAccents']) && $options['params']['withAccents'] == true){
|
||||||
|
|
|
@ -41,7 +41,7 @@ class LSformRule_callable extends LSformRule {
|
||||||
*
|
*
|
||||||
* @return boolean true if the value is valid, false otherwise
|
* @return boolean true if the value is valid, false otherwise
|
||||||
*/
|
*/
|
||||||
function validate($value,$options,$formElement) {
|
public static function validate($value,$options,$formElement) {
|
||||||
if (is_callable($options['params']['callable'])) {
|
if (is_callable($options['params']['callable'])) {
|
||||||
return call_user_func_array($options['params']['callable'],array($value,$options['params'],&$formElement));
|
return call_user_func_array($options['params']['callable'],array($value,$options['params'],&$formElement));
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,7 +35,7 @@ class LSformRule_compare extends LSformRule {
|
||||||
*
|
*
|
||||||
* @return string Operateur à utiliser
|
* @return string Operateur à utiliser
|
||||||
*/
|
*/
|
||||||
function _findOperator($operator_name) {
|
private static function _findOperator($operator_name) {
|
||||||
|
|
||||||
$_operators = array(
|
$_operators = array(
|
||||||
'eq' => '==',
|
'eq' => '==',
|
||||||
|
@ -67,12 +67,12 @@ class LSformRule_compare extends LSformRule {
|
||||||
*
|
*
|
||||||
* @return boolean true si la valeur est valide, false sinon
|
* @return boolean true si la valeur est valide, false sinon
|
||||||
*/
|
*/
|
||||||
function validate ($values,$options=array(),$formElement) {
|
public static function validate ($values,$options=array(),$formElement) {
|
||||||
if (!isset($options['params']['operator'])) {
|
if (!isset($options['params']['operator'])) {
|
||||||
LSerror :: addErrorCode('LSformRule_01',array('type' => 'compare', 'param' => 'operator');
|
LSerror :: addErrorCode('LSformRule_01',array('type' => 'compare', 'param' => 'operator');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
$operator = LSformRule_compare :: _findOperator($options['params']['operator']);
|
$operator = self :: _findOperator($options['params']['operator']);
|
||||||
if ('==' != $operator && '!=' != $operator) {
|
if ('==' != $operator && '!=' != $operator) {
|
||||||
$compareFn = create_function('$a, $b', 'return floatval($a) ' . $operator . ' floatval($b);');
|
$compareFn = create_function('$a, $b', 'return floatval($a) ' . $operator . ' floatval($b);');
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,7 +37,7 @@ class LSformRule_date extends LSformRule {
|
||||||
*
|
*
|
||||||
* @return boolean True si les données sont valide, False sinon.
|
* @return boolean True si les données sont valide, False sinon.
|
||||||
*/
|
*/
|
||||||
function validate($value,$options=NULL,$formElement) {
|
public static function validate($value,$options=NULL,$formElement) {
|
||||||
if (!isset($options['params']['format'])) {
|
if (!isset($options['params']['format'])) {
|
||||||
LSerror :: addErrorCode('LSformRule_date_01');
|
LSerror :: addErrorCode('LSformRule_date_01');
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -37,7 +37,7 @@ class LSformRule_email extends LSformRule {
|
||||||
*
|
*
|
||||||
* @return boolean true si la valeur est valide, false sinon
|
* @return boolean true si la valeur est valide, false sinon
|
||||||
*/
|
*/
|
||||||
function validate($value,$options=array(),$formElement) {
|
public static function validate($value,$options=array(),$formElement) {
|
||||||
return checkEmail($value,$options['params']['domain'],$options['params']['checkDomain']);
|
return checkEmail($value,$options['params']['domain'],$options['params']['checkDomain']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -38,7 +38,7 @@ class LSformRule_filesize extends LSformRule {
|
||||||
*
|
*
|
||||||
* @return boolean true si la valeur est valide, false sinon
|
* @return boolean true si la valeur est valide, false sinon
|
||||||
*/
|
*/
|
||||||
function validate ($value,$options,$formElement) {
|
public static function validate ($value,$options,$formElement) {
|
||||||
$file = LSsession :: getTmpFile($value);
|
$file = LSsession :: getTmpFile($value);
|
||||||
|
|
||||||
$size = filesize($file);
|
$size = filesize($file);
|
||||||
|
|
|
@ -40,7 +40,7 @@ class LSformRule_imagefile extends LSformRule {
|
||||||
*
|
*
|
||||||
* @return boolean true si la valeur est valide, false sinon
|
* @return boolean true si la valeur est valide, false sinon
|
||||||
*/
|
*/
|
||||||
function validate ($value,$options,$formElement) {
|
public static function validate ($value,$options,$formElement) {
|
||||||
$file = LSsession :: getTmpFile($value);
|
$file = LSsession :: getTmpFile($value);
|
||||||
|
|
||||||
$mimetype = mime_content_type($file);
|
$mimetype = mime_content_type($file);
|
||||||
|
|
|
@ -40,7 +40,7 @@ class LSformRule_imagesize extends LSformRule {
|
||||||
*
|
*
|
||||||
* @return boolean true si la valeur est valide, false sinon
|
* @return boolean true si la valeur est valide, false sinon
|
||||||
*/
|
*/
|
||||||
function validate ($value,$options,$formElement) {
|
public static function validate ($value,$options,$formElement) {
|
||||||
$file = LSsession :: getTmpFile($value);
|
$file = LSsession :: getTmpFile($value);
|
||||||
list($width, $height, $type, $attr) = getimagesize($file);
|
list($width, $height, $type, $attr) = getimagesize($file);
|
||||||
|
|
||||||
|
|
|
@ -37,7 +37,7 @@ class LSformRule_inarray extends LSformRule {
|
||||||
*
|
*
|
||||||
* @return boolean true si la valeur est valide, false sinon
|
* @return boolean true si la valeur est valide, false sinon
|
||||||
*/
|
*/
|
||||||
function validate($value,$option,$formElement) {
|
public static function validate($value,$option,$formElement) {
|
||||||
if (!isset($option['params']['possible_values']) || !is_array($option['params']['possible_values'])) {
|
if (!isset($option['params']['possible_values']) || !is_array($option['params']['possible_values'])) {
|
||||||
LSerror :: addErrorCode('LSformRule_inarray_01');
|
LSerror :: addErrorCode('LSformRule_inarray_01');
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -40,7 +40,7 @@ class LSformRule_integer extends LSformRule{
|
||||||
*
|
*
|
||||||
* @return boolean true if the value is valided, false otherwise
|
* @return boolean true if the value is valided, false otherwise
|
||||||
*/
|
*/
|
||||||
function validate ($value,$options=array(),$formElement) {
|
public static function validate ($value,$options=array(),$formElement) {
|
||||||
if($options['params']['max'] && $value > $options['params']['max']) {
|
if($options['params']['max'] && $value > $options['params']['max']) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,7 +36,7 @@ class LSformRule_lettersonly extends LSformRule {
|
||||||
*
|
*
|
||||||
* @return boolean true si la valeur est valide, false sinon
|
* @return boolean true si la valeur est valide, false sinon
|
||||||
*/
|
*/
|
||||||
function validate ($value,$options=array(),$formElement) {
|
public static function validate ($value,$options=array(),$formElement) {
|
||||||
$regex = '/^[a-zA-Z]+$/';
|
$regex = '/^[a-zA-Z]+$/';
|
||||||
LSsession :: loadLSclass('LSformRule_regex');
|
LSsession :: loadLSclass('LSformRule_regex');
|
||||||
return LSformRule_regex :: validate($value,$regex,$formElement);
|
return LSformRule_regex :: validate($value,$regex,$formElement);
|
||||||
|
|
|
@ -37,7 +37,7 @@ class LSformRule_maxlength extends LSformRule {
|
||||||
*
|
*
|
||||||
* @return boolean true si la valeur est valide, false sinon
|
* @return boolean true si la valeur est valide, false sinon
|
||||||
*/
|
*/
|
||||||
function validate ($value,$options,$formElement) {
|
public static function validate ($value,$options,$formElement) {
|
||||||
if(!isset($options['params']['limit'])) {
|
if(!isset($options['params']['limit'])) {
|
||||||
LSerror :: addErrorCode('LSformRule_01',array('type' => 'maxlength', 'param' => 'limit'));
|
LSerror :: addErrorCode('LSformRule_01',array('type' => 'maxlength', 'param' => 'limit'));
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -38,7 +38,7 @@ class LSformRule_mimetype extends LSformRule {
|
||||||
*
|
*
|
||||||
* @return boolean true si la valeur est valide, false sinon
|
* @return boolean true si la valeur est valide, false sinon
|
||||||
*/
|
*/
|
||||||
function validate ($value,$options,$formElement) {
|
public static function validate ($value,$options,$formElement) {
|
||||||
$file = LSsession :: getTmpFile($value);
|
$file = LSsession :: getTmpFile($value);
|
||||||
|
|
||||||
$mimetype = mime_content_type($file);
|
$mimetype = mime_content_type($file);
|
||||||
|
|
|
@ -37,7 +37,7 @@ class LSformRule_minlength extends LSformRule {
|
||||||
*
|
*
|
||||||
* @return boolean true si la valeur est valide, false sinon
|
* @return boolean true si la valeur est valide, false sinon
|
||||||
*/
|
*/
|
||||||
function validate ($value,$options,$formElement) {
|
public static function validate ($value,$options,$formElement) {
|
||||||
if(!isset($options['params']['limit'])) {
|
if(!isset($options['params']['limit'])) {
|
||||||
LSerror :: addErrorCode('LSformRule_01',array('type' => 'minlength', 'param' => 'limit'));
|
LSerror :: addErrorCode('LSformRule_01',array('type' => 'minlength', 'param' => 'limit'));
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -36,7 +36,7 @@ class LSformRule_nonzero extends LSformRule {
|
||||||
*
|
*
|
||||||
* @return boolean true si la valeur est valide, false sinon
|
* @return boolean true si la valeur est valide, false sinon
|
||||||
*/
|
*/
|
||||||
function validate ($value,$options,$formElement) {
|
public static function validate ($value,$options,$formElement) {
|
||||||
$regex = '/^-?[1-9][0-9]*/';
|
$regex = '/^-?[1-9][0-9]*/';
|
||||||
LSsession :: loadLSclass('LSformRule_regex');
|
LSsession :: loadLSclass('LSformRule_regex');
|
||||||
return LSformRule_regex :: validate($value,$regex,$formElement);
|
return LSformRule_regex :: validate($value,$regex,$formElement);
|
||||||
|
|
|
@ -36,7 +36,7 @@ class LSformRule_nopunctuation extends LSformRule {
|
||||||
*
|
*
|
||||||
* @return boolean true si la valeur est valide, false sinon
|
* @return boolean true si la valeur est valide, false sinon
|
||||||
*/
|
*/
|
||||||
function validate ($value,$options=array(),$formElement) {
|
public static function validate ($value,$options=array(),$formElement) {
|
||||||
$regex = '/^[^().\/\*\^\?#!@$%+=,\"\'><~\[\]{}]+$/';
|
$regex = '/^[^().\/\*\^\?#!@$%+=,\"\'><~\[\]{}]+$/';
|
||||||
LSsession :: loadLSclass('LSformRule_regex');
|
LSsession :: loadLSclass('LSformRule_regex');
|
||||||
return LSformRule_regex :: validate($value,$regex,$formElement);
|
return LSformRule_regex :: validate($value,$regex,$formElement);
|
||||||
|
|
|
@ -36,7 +36,7 @@ class LSformRule_numeric extends LSformRule{
|
||||||
*
|
*
|
||||||
* @return boolean true si la valeur est valide, false sinon
|
* @return boolean true si la valeur est valide, false sinon
|
||||||
*/
|
*/
|
||||||
function validate ($value,$options=array(),$formElement) {
|
public static function validate ($value,$options=array(),$formElement) {
|
||||||
$regex = '/(^-?\d\d*\.\d*$)|(^-?\d\d*$)|(^-?\.\d\d*$)/';
|
$regex = '/(^-?\d\d*\.\d*$)|(^-?\d\d*$)|(^-?\.\d\d*$)/';
|
||||||
LSsession :: loadLSclass('LSformRule_regex');
|
LSsession :: loadLSclass('LSformRule_regex');
|
||||||
return LSformRule_regex :: validate($value,$regex,$formElement);
|
return LSformRule_regex :: validate($value,$regex,$formElement);
|
||||||
|
|
|
@ -43,7 +43,7 @@ class LSformRule_password extends LSformRule {
|
||||||
*
|
*
|
||||||
* @return boolean true si la valeur est valide, false sinon
|
* @return boolean true si la valeur est valide, false sinon
|
||||||
*/
|
*/
|
||||||
function validate ($value,$options=array(),$formElement) {
|
public static function validate ($value,$options=array(),$formElement) {
|
||||||
if(isset($options['params']['maxLength'])) {
|
if(isset($options['params']['maxLength'])) {
|
||||||
if (strlen($value)>$options['params']['maxLength'])
|
if (strlen($value)>$options['params']['maxLength'])
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -38,7 +38,7 @@ class LSformRule_rangelength extends LSformRule {
|
||||||
*
|
*
|
||||||
* @return boolean true si la valeur est valide, false sinon
|
* @return boolean true si la valeur est valide, false sinon
|
||||||
*/
|
*/
|
||||||
function validate ($value,$options=array(),$formElement) {
|
public static function validate ($value,$options=array(),$formElement) {
|
||||||
if(!isset($options['params']['limits'])) {
|
if(!isset($options['params']['limits'])) {
|
||||||
LSerror :: addErrorCode('LSformRule_01',array('type' => 'rangelength', 'param' => 'limits'));
|
LSerror :: addErrorCode('LSformRule_01',array('type' => 'rangelength', 'param' => 'limits'));
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -37,7 +37,7 @@ class LSformRule_regex extends LSformRule {
|
||||||
*
|
*
|
||||||
* @return boolean true si la valeur est valide, false sinon
|
* @return boolean true si la valeur est valide, false sinon
|
||||||
*/
|
*/
|
||||||
function validate($value,$options,$formElement) {
|
public static function validate($value,$options,$formElement) {
|
||||||
if (is_array($options)) {
|
if (is_array($options)) {
|
||||||
if (isset($options['params']['regex'])) {
|
if (isset($options['params']['regex'])) {
|
||||||
$regex=$options['params']['regex'];
|
$regex=$options['params']['regex'];
|
||||||
|
|
|
@ -36,7 +36,7 @@ class LSformRule_required extends LSformRule {
|
||||||
*
|
*
|
||||||
* @return boolean true si la valeur est valide, false sinon
|
* @return boolean true si la valeur est valide, false sinon
|
||||||
*/
|
*/
|
||||||
function validate ($value,$options=NULL,$formElement) {
|
public static function validate ($value,$options=NULL,$formElement) {
|
||||||
return ((string)$value != '');
|
return ((string)$value != '');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -36,7 +36,7 @@ class LSformRule_ssh_pub_key extends LSformRule {
|
||||||
*
|
*
|
||||||
* @return boolean true if the value is valide, false if not
|
* @return boolean true if the value is valide, false if not
|
||||||
*/
|
*/
|
||||||
function validate($value,$options,$formElement) {
|
public static function validate($value,$options,$formElement) {
|
||||||
if (preg_match('/^(ssh-[a-z0-9]+) +([^ ]+) +(.*)$/', $value, $m)) {
|
if (preg_match('/^(ssh-[a-z0-9]+) +([^ ]+) +(.*)$/', $value, $m)) {
|
||||||
$data=@base64_decode($m[2]);
|
$data=@base64_decode($m[2]);
|
||||||
if (is_string($data))
|
if (is_string($data))
|
||||||
|
|
|
@ -36,7 +36,7 @@ class LSformRule_telephonenumber extends LSformRule {
|
||||||
*
|
*
|
||||||
* @return boolean true si la valeur est valide, false sinon
|
* @return boolean true si la valeur est valide, false sinon
|
||||||
*/
|
*/
|
||||||
function validate($value,$options=array(),$formElement) {
|
public static function validate($value,$options=array(),$formElement) {
|
||||||
$regex = '/^(01|02|03|04|05|06|08|09)[0-9]{8}$/';
|
$regex = '/^(01|02|03|04|05|06|08|09)[0-9]{8}$/';
|
||||||
LSsession :: loadLSclass('LSformRule_regex');
|
LSsession :: loadLSclass('LSformRule_regex');
|
||||||
return LSformRule_regex :: validate($value,$regex,$formElement);
|
return LSformRule_regex :: validate($value,$regex,$formElement);
|
||||||
|
|
|
@ -36,7 +36,7 @@ class LSimport {
|
||||||
*
|
*
|
||||||
* @retval boolean true if the form was posted, false otherwise
|
* @retval boolean true if the form was posted, false otherwise
|
||||||
*/
|
*/
|
||||||
function isSubmit() {
|
public static function isSubmit() {
|
||||||
if (isset($_POST['validate']) && ($_POST['validate']=='LSimport'))
|
if (isset($_POST['validate']) && ($_POST['validate']=='LSimport'))
|
||||||
return true;
|
return true;
|
||||||
return;
|
return;
|
||||||
|
@ -48,7 +48,7 @@ class LSimport {
|
||||||
*
|
*
|
||||||
* @retval mixed The path of the temporary file, false on error
|
* @retval mixed The path of the temporary file, false on error
|
||||||
*/
|
*/
|
||||||
function getPostFile() {
|
public static function getPostFile() {
|
||||||
if (is_uploaded_file($_FILES['importfile']['tmp_name'])) {
|
if (is_uploaded_file($_FILES['importfile']['tmp_name'])) {
|
||||||
$fp = fopen($_FILES['importfile']['tmp_name'], "r");
|
$fp = fopen($_FILES['importfile']['tmp_name'], "r");
|
||||||
$buf = fread($fp, filesize($_FILES['importfile']['tmp_name']));
|
$buf = fread($fp, filesize($_FILES['importfile']['tmp_name']));
|
||||||
|
@ -80,7 +80,7 @@ class LSimport {
|
||||||
*
|
*
|
||||||
* @retval mixed Array of POST data, false on error
|
* @retval mixed Array of POST data, false on error
|
||||||
*/
|
*/
|
||||||
function getPostData() {
|
public static function getPostData() {
|
||||||
if (isset($_REQUEST['LSobject']) && isset($_POST['ioFormat'])) {
|
if (isset($_REQUEST['LSobject']) && isset($_POST['ioFormat'])) {
|
||||||
$file=self::getPostFile();
|
$file=self::getPostFile();
|
||||||
if ($file) {
|
if ($file) {
|
||||||
|
@ -140,7 +140,7 @@ class LSimport {
|
||||||
*
|
*
|
||||||
* @retval boolean Array of the import result, false on error
|
* @retval boolean Array of the import result, false on error
|
||||||
*/
|
*/
|
||||||
function importFromPostData() {
|
public static function importFromPostData() {
|
||||||
// Get data from $_POST
|
// Get data from $_POST
|
||||||
$data=self::getPostData();
|
$data=self::getPostData();
|
||||||
if (is_array($data)) {
|
if (is_array($data)) {
|
||||||
|
|
|
@ -38,7 +38,7 @@ class LSioFormat {
|
||||||
*
|
*
|
||||||
* @retval void
|
* @retval void
|
||||||
**/
|
**/
|
||||||
function LSioFormat($LSobject,$ioFormat) {
|
public function __construct($LSobject, $ioFormat) {
|
||||||
$conf=LSconfig::get('LSobjects.'.$LSobject.".ioFormat.".$ioFormat);
|
$conf=LSconfig::get('LSobjects.'.$LSobject.".ioFormat.".$ioFormat);
|
||||||
if(is_array($conf)) {
|
if(is_array($conf)) {
|
||||||
$this -> config=$conf;
|
$this -> config=$conf;
|
||||||
|
@ -59,7 +59,7 @@ class LSioFormat {
|
||||||
*
|
*
|
||||||
* @retval boolean True if ioFormat driver is ready, false otherwise
|
* @retval boolean True if ioFormat driver is ready, false otherwise
|
||||||
**/
|
**/
|
||||||
function ready() {
|
public function ready() {
|
||||||
return (is_array($this -> config) && $this -> driver !== False);
|
return (is_array($this -> config) && $this -> driver !== False);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -70,7 +70,7 @@ class LSioFormat {
|
||||||
*
|
*
|
||||||
* @retval boolean True if file is loaded and valid, false otherwise
|
* @retval boolean True if file is loaded and valid, false otherwise
|
||||||
**/
|
**/
|
||||||
function loadFile($file) {
|
public function loadFile($file) {
|
||||||
if ($this -> driver -> loadFile($file)) {
|
if ($this -> driver -> loadFile($file)) {
|
||||||
return $this -> driver -> isValid();
|
return $this -> driver -> isValid();
|
||||||
}
|
}
|
||||||
|
@ -82,7 +82,7 @@ class LSioFormat {
|
||||||
*
|
*
|
||||||
* @retval array The objects contained by the loaded file
|
* @retval array The objects contained by the loaded file
|
||||||
**/
|
**/
|
||||||
function getAll() {
|
public function getAll() {
|
||||||
return $this -> driver -> getAllFormated($this -> config['fields'],$this -> config['generated_fields']);
|
return $this -> driver -> getAllFormated($this -> config['fields'],$this -> config['generated_fields']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -36,7 +36,7 @@ class LSioFormatDriver {
|
||||||
*
|
*
|
||||||
* @retval void
|
* @retval void
|
||||||
**/
|
**/
|
||||||
function __construct($options) {
|
public function __construct($options) {
|
||||||
$this -> options = $options;
|
$this -> options = $options;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -47,7 +47,7 @@ class LSioFormatDriver {
|
||||||
*
|
*
|
||||||
* @retval boolean True if file is loaded, false otherwise
|
* @retval boolean True if file is loaded, false otherwise
|
||||||
**/
|
**/
|
||||||
function loadFile($path) {
|
public function loadFile($path) {
|
||||||
return False;
|
return False;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -56,7 +56,7 @@ class LSioFormatDriver {
|
||||||
*
|
*
|
||||||
* @retval boolean True if loaded file data are valid, false otherwise
|
* @retval boolean True if loaded file data are valid, false otherwise
|
||||||
**/
|
**/
|
||||||
function isValid() {
|
public function isValid() {
|
||||||
return False;
|
return False;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -80,7 +80,7 @@ class LSioFormatDriver {
|
||||||
*
|
*
|
||||||
* @retval array The objects contained by the loaded file
|
* @retval array The objects contained by the loaded file
|
||||||
**/
|
**/
|
||||||
function getAll() {
|
public function getAll() {
|
||||||
return array();
|
return array();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -97,7 +97,7 @@ class LSioFormatDriver {
|
||||||
*
|
*
|
||||||
* @retval array The fields names of the loaded file
|
* @retval array The fields names of the loaded file
|
||||||
**/
|
**/
|
||||||
function getFieldNames() {
|
public function getFieldNames() {
|
||||||
return array();
|
return array();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -112,7 +112,7 @@ class LSioFormatDriver {
|
||||||
*
|
*
|
||||||
* @retval array All objects data of the loaded file formated
|
* @retval array All objects data of the loaded file formated
|
||||||
**/
|
**/
|
||||||
function getAllFormated($fields,$generated_fields) {
|
public function getAllFormated($fields,$generated_fields) {
|
||||||
if (!is_array($fields)) return False;
|
if (!is_array($fields)) return False;
|
||||||
if (!is_array($generated_fields)) $generated_fields=array();
|
if (!is_array($generated_fields)) $generated_fields=array();
|
||||||
$all=$this -> getAll();
|
$all=$this -> getAll();
|
||||||
|
|
|
@ -43,7 +43,7 @@ class LSldap {
|
||||||
*
|
*
|
||||||
* @retval void
|
* @retval void
|
||||||
*/
|
*/
|
||||||
function setConfig ($config) {
|
public static function setConfig ($config) {
|
||||||
self :: $config = $config;
|
self :: $config = $config;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -57,7 +57,7 @@ class LSldapObject {
|
||||||
*
|
*
|
||||||
* @retval boolean true si l'objet a été construit, false sinon.
|
* @retval boolean true si l'objet a été construit, false sinon.
|
||||||
*/
|
*/
|
||||||
function LSldapObject() {
|
public function __construct() {
|
||||||
$this -> type_name = get_class($this);
|
$this -> type_name = get_class($this);
|
||||||
$config = LSconfig :: get('LSobjects.'.$this -> type_name);
|
$config = LSconfig :: get('LSobjects.'.$this -> type_name);
|
||||||
if(is_array($config)) {
|
if(is_array($config)) {
|
||||||
|
@ -89,7 +89,7 @@ class LSldapObject {
|
||||||
*
|
*
|
||||||
* @retval boolean true si la chargement a réussi, false sinon.
|
* @retval boolean true si la chargement a réussi, false sinon.
|
||||||
*/
|
*/
|
||||||
function loadData($dn) {
|
public function loadData($dn) {
|
||||||
$this -> dn = $dn;
|
$this -> dn = $dn;
|
||||||
$data = LSldap :: getAttrs($dn);
|
$data = LSldap :: getAttrs($dn);
|
||||||
if(!empty($data)) {
|
if(!empty($data)) {
|
||||||
|
@ -110,7 +110,7 @@ class LSldapObject {
|
||||||
*
|
*
|
||||||
* @retval boolean true si la rechargement a réussi, false sinon.
|
* @retval boolean true si la rechargement a réussi, false sinon.
|
||||||
*/
|
*/
|
||||||
function reloadData() {
|
public function reloadData() {
|
||||||
$data = LSldap :: getAttrs($this -> dn);
|
$data = LSldap :: getAttrs($this -> dn);
|
||||||
foreach($this -> attrs as $attr_name => $attr) {
|
foreach($this -> attrs as $attr_name => $attr) {
|
||||||
if(!$this -> attrs[$attr_name] -> reloadData( (isset($data[$attr_name])?$data[$attr_name]:NULL) ))
|
if(!$this -> attrs[$attr_name] -> reloadData( (isset($data[$attr_name])?$data[$attr_name]:NULL) ))
|
||||||
|
@ -126,7 +126,7 @@ class LSldapObject {
|
||||||
*
|
*
|
||||||
* @retval string Format d'affichage de l'objet.
|
* @retval string Format d'affichage de l'objet.
|
||||||
*/
|
*/
|
||||||
function getDisplayNameFormat() {
|
public function getDisplayNameFormat() {
|
||||||
return $this -> getConfig('display_name_format');
|
return $this -> getConfig('display_name_format');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -144,7 +144,7 @@ class LSldapObject {
|
||||||
*
|
*
|
||||||
* @retval string Valeur descriptive d'affichage de l'objet
|
* @retval string Valeur descriptive d'affichage de l'objet
|
||||||
*/
|
*/
|
||||||
function getDisplayName($spe='',$full=false) {
|
public function getDisplayName($spe='',$full=false) {
|
||||||
if ($spe=='') {
|
if ($spe=='') {
|
||||||
$spe = $this -> getDisplayNameFormat();
|
$spe = $this -> getDisplayNameFormat();
|
||||||
}
|
}
|
||||||
|
@ -167,7 +167,7 @@ class LSldapObject {
|
||||||
*
|
*
|
||||||
* @retval string Valeur d'une chaine formatée
|
* @retval string Valeur d'une chaine formatée
|
||||||
*/
|
*/
|
||||||
function getFData($format) {
|
public function getFData($format) {
|
||||||
$format=getFData($format,$this,'getValue');
|
$format=getFData($format,$this,'getValue');
|
||||||
return $format;
|
return $format;
|
||||||
}
|
}
|
||||||
|
@ -184,7 +184,7 @@ class LSldapObject {
|
||||||
*
|
*
|
||||||
* @retval string Valeur d'une chaine formatee
|
* @retval string Valeur d'une chaine formatee
|
||||||
*/
|
*/
|
||||||
function getDisplayFData($format) {
|
public function getDisplayFData($format) {
|
||||||
return getFData($format,$this,'getDisplayValue');
|
return getFData($format,$this,'getDisplayValue');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -201,7 +201,7 @@ class LSldapObject {
|
||||||
*
|
*
|
||||||
* @retval LSform Le formulaire crée
|
* @retval LSform Le formulaire crée
|
||||||
*/
|
*/
|
||||||
function getForm($idForm,$load=NULL) {
|
public function getForm($idForm,$load=NULL) {
|
||||||
LSsession :: loadLSclass('LSform');
|
LSsession :: loadLSclass('LSform');
|
||||||
$LSform = new LSform($this,$idForm);
|
$LSform = new LSform($this,$idForm);
|
||||||
$this -> forms[$idForm] = array($LSform,$load);
|
$this -> forms[$idForm] = array($LSform,$load);
|
||||||
|
@ -244,7 +244,7 @@ class LSldapObject {
|
||||||
*
|
*
|
||||||
* @retval LSform Le formulaire crée
|
* @retval LSform Le formulaire crée
|
||||||
*/
|
*/
|
||||||
function getView() {
|
public function getView() {
|
||||||
LSsession :: loadLSclass('LSform');
|
LSsession :: loadLSclass('LSform');
|
||||||
$this -> view = new LSform($this,'view');
|
$this -> view = new LSform($this,'view');
|
||||||
foreach($this -> attrs as $attr_name => $attr) {
|
foreach($this -> attrs as $attr_name => $attr) {
|
||||||
|
@ -265,7 +265,7 @@ class LSldapObject {
|
||||||
*
|
*
|
||||||
* @retval boolean true sile formulaire a été rafraichis, false sinon
|
* @retval boolean true sile formulaire a été rafraichis, false sinon
|
||||||
*/
|
*/
|
||||||
function refreshForm($idForm) {
|
public function refreshForm($idForm) {
|
||||||
$LSform = $this -> forms[$idForm][0];
|
$LSform = $this -> forms[$idForm][0];
|
||||||
foreach($this -> attrs as $attr_name => $attr) {
|
foreach($this -> attrs as $attr_name => $attr) {
|
||||||
if(!$this -> attrs[$attr_name] -> refreshForm($LSform,$idForm)) {
|
if(!$this -> attrs[$attr_name] -> refreshForm($LSform,$idForm)) {
|
||||||
|
@ -395,7 +395,7 @@ class LSldapObject {
|
||||||
*
|
*
|
||||||
* @retval boolean true si les données sont valides, false sinon
|
* @retval boolean true si les données sont valides, false sinon
|
||||||
*/
|
*/
|
||||||
function validateAttrsData($idForm=null) {
|
public function validateAttrsData($idForm=null) {
|
||||||
$retval = true;
|
$retval = true;
|
||||||
if ($idForm) {
|
if ($idForm) {
|
||||||
$LSform=$this -> forms[$idForm][0];
|
$LSform=$this -> forms[$idForm][0];
|
||||||
|
@ -448,7 +448,7 @@ class LSldapObject {
|
||||||
*
|
*
|
||||||
* @retval boolean true si les données sont valides, false sinon
|
* @retval boolean true si les données sont valides, false sinon
|
||||||
*/
|
*/
|
||||||
function validateAttrData(&$LSform,&$attr) {
|
public function validateAttrData(&$LSform,&$attr) {
|
||||||
$retval = true;
|
$retval = true;
|
||||||
|
|
||||||
$vconfig=$attr -> getValidateConfig();
|
$vconfig=$attr -> getValidateConfig();
|
||||||
|
@ -584,7 +584,7 @@ class LSldapObject {
|
||||||
*
|
*
|
||||||
* @retval boolean true si la mise à jour a réussi, false sinon
|
* @retval boolean true si la mise à jour a réussi, false sinon
|
||||||
*/
|
*/
|
||||||
function submitChange($idForm) {
|
public function submitChange($idForm) {
|
||||||
$submitData=array();
|
$submitData=array();
|
||||||
$new = $this -> isNew();
|
$new = $this -> isNew();
|
||||||
foreach($this -> attrs as $attr) {
|
foreach($this -> attrs as $attr) {
|
||||||
|
@ -678,7 +678,7 @@ class LSldapObject {
|
||||||
* - [0] : le premier paramètre
|
* - [0] : le premier paramètre
|
||||||
* - [1] : les paramètres suivants
|
* - [1] : les paramètres suivants
|
||||||
*/
|
*/
|
||||||
function getDnInfos($dn) {
|
public static function getDnInfos($dn) {
|
||||||
$infos=ldap_explode_dn($dn,0);
|
$infos=ldap_explode_dn($dn,0);
|
||||||
if(!$infos)
|
if(!$infos)
|
||||||
return;
|
return;
|
||||||
|
@ -700,9 +700,9 @@ class LSldapObject {
|
||||||
*
|
*
|
||||||
* @retval Net_LDAP2_Filter le filtre ldap correspondant au type de l'objet
|
* @retval Net_LDAP2_Filter le filtre ldap correspondant au type de l'objet
|
||||||
*/
|
*/
|
||||||
function getObjectFilter($type=null) {
|
public static function getObjectFilter($type=null) {
|
||||||
if (is_null($type)) {
|
if (is_null($type)) {
|
||||||
$type = $this -> type_name;
|
$type = $this -> type_name;
|
||||||
}
|
}
|
||||||
$oc=LSconfig::get("LSobjects.$type.objectclass");
|
$oc=LSconfig::get("LSobjects.$type.objectclass");
|
||||||
if(!is_array($oc)) return;
|
if(!is_array($oc)) return;
|
||||||
|
@ -733,7 +733,7 @@ class LSldapObject {
|
||||||
*
|
*
|
||||||
* @retval string le filtre ldap correspondant
|
* @retval string le filtre ldap correspondant
|
||||||
*/
|
*/
|
||||||
function getPatternFilter($pattern=null,$approx=null) {
|
public function getPatternFilter($pattern=null,$approx=null) {
|
||||||
if ($pattern) {
|
if ($pattern) {
|
||||||
$search = new LSsearch($this -> type_name, 'LSldapObject', array('approx' => (bool)$approx));
|
$search = new LSsearch($this -> type_name, 'LSldapObject', array('approx' => (bool)$approx));
|
||||||
$filter = $search -> getFilterFromPattern($pattern);
|
$filter = $search -> getFilterFromPattern($pattern);
|
||||||
|
@ -758,7 +758,7 @@ class LSldapObject {
|
||||||
*
|
*
|
||||||
* @retval array Tableau d'objets correspondant au resultat de la recherche
|
* @retval array Tableau d'objets correspondant au resultat de la recherche
|
||||||
*/
|
*/
|
||||||
function listObjects($filter=NULL,$basedn=NULL,$params=array()) {
|
public function listObjects($filter=NULL,$basedn=NULL,$params=array()) {
|
||||||
if (!LSsession :: loadLSclass('LSsearch')) {
|
if (!LSsession :: loadLSclass('LSsearch')) {
|
||||||
LSerror::addErrorCode('LSsession_05','LSsearch');
|
LSerror::addErrorCode('LSsession_05','LSsearch');
|
||||||
return;
|
return;
|
||||||
|
@ -794,7 +794,7 @@ class LSldapObject {
|
||||||
*
|
*
|
||||||
* @retval array Tableau dn => name correspondant au resultat de la recherche
|
* @retval array Tableau dn => name correspondant au resultat de la recherche
|
||||||
*/
|
*/
|
||||||
function listObjectsName($filter=NULL,$sbasedn=NULL,$sparams=array(),$displayFormat=false,$cache=true) {
|
public function listObjectsName($filter=NULL,$sbasedn=NULL,$sparams=array(),$displayFormat=false,$cache=true) {
|
||||||
if (!LSsession :: loadLSclass('LSsearch')) {
|
if (!LSsession :: loadLSclass('LSsearch')) {
|
||||||
LSerror::addErrorCode('LSsession_05','LSsearch');
|
LSerror::addErrorCode('LSsession_05','LSsearch');
|
||||||
return;
|
return;
|
||||||
|
@ -836,7 +836,7 @@ class LSldapObject {
|
||||||
*
|
*
|
||||||
* @retval array Tableau d'objets correspondant au resultat de la recherche
|
* @retval array Tableau d'objets correspondant au resultat de la recherche
|
||||||
*/
|
*/
|
||||||
function searchObject($name,$basedn=NULL,$filter=NULL,$params=NULL) {
|
public function searchObject($name,$basedn=NULL,$filter=NULL,$params=NULL) {
|
||||||
if (!$filter) {
|
if (!$filter) {
|
||||||
$filter = '('.$this -> getConfig('rdn').'='.$name.')';
|
$filter = '('.$this -> getConfig('rdn').'='.$name.')';
|
||||||
}
|
}
|
||||||
|
@ -863,7 +863,7 @@ class LSldapObject {
|
||||||
*
|
*
|
||||||
* @retval mixed la valeur demandé ou ' ' si celle-ci est inconnue.
|
* @retval mixed la valeur demandé ou ' ' si celle-ci est inconnue.
|
||||||
*/
|
*/
|
||||||
function getValue($val) {
|
public function getValue($val) {
|
||||||
if(($val=='dn')||($val=='%{dn}')) {
|
if(($val=='dn')||($val=='%{dn}')) {
|
||||||
return $this -> dn;
|
return $this -> dn;
|
||||||
}
|
}
|
||||||
|
@ -899,7 +899,7 @@ class LSldapObject {
|
||||||
*
|
*
|
||||||
* @retval mixed la valeur demandee ou ' ' si celle-ci est inconnue.
|
* @retval mixed la valeur demandee ou ' ' si celle-ci est inconnue.
|
||||||
*/
|
*/
|
||||||
function getDisplayValue($val) {
|
public function getDisplayValue($val) {
|
||||||
if(isset($this -> attrs[$val])){
|
if(isset($this -> attrs[$val])){
|
||||||
if (method_exists($this -> attrs[$val],'getDisplayValue'))
|
if (method_exists($this -> attrs[$val],'getDisplayValue'))
|
||||||
return $this -> attrs[$val] -> getDisplayValue();
|
return $this -> attrs[$val] -> getDisplayValue();
|
||||||
|
@ -919,7 +919,7 @@ class LSldapObject {
|
||||||
*
|
*
|
||||||
* @retval void
|
* @retval void
|
||||||
**/
|
**/
|
||||||
function registerOtherValue($name,$value) {
|
public function registerOtherValue($name,$value) {
|
||||||
$this -> other_values[$name]=$value;
|
$this -> other_values[$name]=$value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -930,7 +930,7 @@ class LSldapObject {
|
||||||
*
|
*
|
||||||
* @retval array('dn' => 'display')
|
* @retval array('dn' => 'display')
|
||||||
*/
|
*/
|
||||||
function getSelectArray($pattern=NULL,$topDn=NULL,$displayFormat=NULL,$approx=false,$cache=true,$filter=NULL,$sparams=array()) {
|
public function getSelectArray($pattern=NULL,$topDn=NULL,$displayFormat=NULL,$approx=false,$cache=true,$filter=NULL,$sparams=array()) {
|
||||||
$sparams['pattern']=$pattern;
|
$sparams['pattern']=$pattern;
|
||||||
return $this -> listObjectsName($filter,$topDn,$sparams,$displayFormat,$cache);
|
return $this -> listObjectsName($filter,$topDn,$sparams,$displayFormat,$cache);
|
||||||
}
|
}
|
||||||
|
@ -945,7 +945,7 @@ class LSldapObject {
|
||||||
*
|
*
|
||||||
* @retval string Le DN de l'objet
|
* @retval string Le DN de l'objet
|
||||||
*/
|
*/
|
||||||
function getDn() {
|
public function getDn() {
|
||||||
if($this -> dn) {
|
if($this -> dn) {
|
||||||
return $this -> dn;
|
return $this -> dn;
|
||||||
}
|
}
|
||||||
|
@ -981,7 +981,7 @@ class LSldapObject {
|
||||||
*
|
*
|
||||||
* @retval string Le container DN de l'objet
|
* @retval string Le container DN de l'objet
|
||||||
*/
|
*/
|
||||||
function getContainerDn() {
|
public function getContainerDn() {
|
||||||
$topDn = LSsession :: getTopDn();
|
$topDn = LSsession :: getTopDn();
|
||||||
$generate_container_dn = $this -> getConfig('generate_container_dn');
|
$generate_container_dn = $this -> getConfig('generate_container_dn');
|
||||||
$container_dn = $this -> getConfig('container_dn');
|
$container_dn = $this -> getConfig('container_dn');
|
||||||
|
@ -1016,7 +1016,7 @@ class LSldapObject {
|
||||||
*
|
*
|
||||||
* @retval string Le type de l'objet ($this -> type_name)
|
* @retval string Le type de l'objet ($this -> type_name)
|
||||||
*/
|
*/
|
||||||
function getType() {
|
public function getType() {
|
||||||
return $this -> type_name;
|
return $this -> type_name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1027,7 +1027,7 @@ class LSldapObject {
|
||||||
*
|
*
|
||||||
* @retval string 'admin'/'self'/'user' pour Admin , l'utilisateur lui même ou un simple utilisateur
|
* @retval string 'admin'/'self'/'user' pour Admin , l'utilisateur lui même ou un simple utilisateur
|
||||||
*/
|
*/
|
||||||
function whoami() {
|
public function whoami() {
|
||||||
if (!$this -> _whoami)
|
if (!$this -> _whoami)
|
||||||
$this -> _whoami = LSsession :: whoami($this -> dn);
|
$this -> _whoami = LSsession :: whoami($this -> dn);
|
||||||
return $this -> _whoami;
|
return $this -> _whoami;
|
||||||
|
@ -1040,7 +1040,7 @@ class LSldapObject {
|
||||||
*
|
*
|
||||||
* @retval string Le label de l'objet ($this -> config['label'])
|
* @retval string Le label de l'objet ($this -> config['label'])
|
||||||
*/
|
*/
|
||||||
function getLabel($type=null) {
|
public function getLabel($type=null) {
|
||||||
if (is_null($type)) {
|
if (is_null($type)) {
|
||||||
$type = $this -> type_name;
|
$type = $this -> type_name;
|
||||||
}
|
}
|
||||||
|
@ -1055,7 +1055,7 @@ class LSldapObject {
|
||||||
*
|
*
|
||||||
* @retval boolean True si l'objet à été supprimé, false sinon
|
* @retval boolean True si l'objet à été supprimé, false sinon
|
||||||
*/
|
*/
|
||||||
function remove() {
|
public function remove() {
|
||||||
if ($this -> fireEvent('before_delete')) {
|
if ($this -> fireEvent('before_delete')) {
|
||||||
if (LSldap :: remove($this -> getDn())) {
|
if (LSldap :: remove($this -> getDn())) {
|
||||||
if ($this -> fireEvent('after_delete')) {
|
if ($this -> fireEvent('after_delete')) {
|
||||||
|
@ -1077,7 +1077,7 @@ class LSldapObject {
|
||||||
*
|
*
|
||||||
* @retval boolean True si l'objet est nouveau, false sinon
|
* @retval boolean True si l'objet est nouveau, false sinon
|
||||||
*/
|
*/
|
||||||
function isNew() {
|
public function isNew() {
|
||||||
return (!$this -> dn);
|
return (!$this -> dn);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1118,7 +1118,7 @@ class LSldapObject {
|
||||||
*
|
*
|
||||||
* @retval True en cas de cas ce succès, False sinon.
|
* @retval True en cas de cas ce succès, False sinon.
|
||||||
*/
|
*/
|
||||||
function updateLSrelationsCache() {
|
private function updateLSrelationsCache() {
|
||||||
$this -> _LSrelationsCache=array();
|
$this -> _LSrelationsCache=array();
|
||||||
$LSrelations = $this -> getConfig('LSrelation');
|
$LSrelations = $this -> getConfig('LSrelation');
|
||||||
if (is_array($LSrelations) && LSsession :: loadLSclass('LSrelation')) {
|
if (is_array($LSrelations) && LSsession :: loadLSclass('LSrelation')) {
|
||||||
|
@ -1152,7 +1152,7 @@ class LSldapObject {
|
||||||
*
|
*
|
||||||
* @retval True en cas de cas ce succès, False sinon.
|
* @retval True en cas de cas ce succès, False sinon.
|
||||||
*/
|
*/
|
||||||
function beforeRename() {
|
private function beforeRename() {
|
||||||
// LSrelations
|
// LSrelations
|
||||||
return $this -> updateLSrelationsCache();
|
return $this -> updateLSrelationsCache();
|
||||||
}
|
}
|
||||||
|
@ -1166,7 +1166,7 @@ class LSldapObject {
|
||||||
*
|
*
|
||||||
* @retval True en cas de cas ce succès, False sinon.
|
* @retval True en cas de cas ce succès, False sinon.
|
||||||
*/
|
*/
|
||||||
function afterRename() {
|
private function afterRename() {
|
||||||
$error = 0;
|
$error = 0;
|
||||||
|
|
||||||
// Change LSsession -> userObject Dn
|
// Change LSsession -> userObject Dn
|
||||||
|
@ -1197,7 +1197,7 @@ class LSldapObject {
|
||||||
*
|
*
|
||||||
* @retval True en cas de cas ce succès, False sinon.
|
* @retval True en cas de cas ce succès, False sinon.
|
||||||
*/
|
*/
|
||||||
function beforeDelete() {
|
private function beforeDelete() {
|
||||||
$return = $this -> updateLSrelationsCache();
|
$return = $this -> updateLSrelationsCache();
|
||||||
|
|
||||||
foreach(array_keys($this -> attrs) as $attr_name) {
|
foreach(array_keys($this -> attrs) as $attr_name) {
|
||||||
|
@ -1218,7 +1218,7 @@ class LSldapObject {
|
||||||
*
|
*
|
||||||
* @retval True en cas de cas ce succès, False sinon.
|
* @retval True en cas de cas ce succès, False sinon.
|
||||||
*/
|
*/
|
||||||
function afterDelete() {
|
private function afterDelete() {
|
||||||
$error = 0;
|
$error = 0;
|
||||||
|
|
||||||
// LSrelations
|
// LSrelations
|
||||||
|
@ -1258,7 +1258,7 @@ class LSldapObject {
|
||||||
*
|
*
|
||||||
* @retval True en cas de cas ce succès, False sinon.
|
* @retval True en cas de cas ce succès, False sinon.
|
||||||
*/
|
*/
|
||||||
function afterCreate() {
|
private function afterCreate() {
|
||||||
LSdebug('after');
|
LSdebug('after');
|
||||||
$error = 0;
|
$error = 0;
|
||||||
|
|
||||||
|
@ -1306,7 +1306,7 @@ class LSldapObject {
|
||||||
*
|
*
|
||||||
* @retval True en cas de cas ce succès, False sinon.
|
* @retval True en cas de cas ce succès, False sinon.
|
||||||
*/
|
*/
|
||||||
function afterModify() {
|
private function afterModify() {
|
||||||
$error = 0;
|
$error = 0;
|
||||||
|
|
||||||
// LSsearch : Purge LSobject cache
|
// LSsearch : Purge LSobject cache
|
||||||
|
@ -1328,7 +1328,7 @@ class LSldapObject {
|
||||||
*
|
*
|
||||||
* @retval Mixed La valeur clef d'un objet en relation
|
* @retval Mixed La valeur clef d'un objet en relation
|
||||||
**/
|
**/
|
||||||
function getObjectKeyValueInRelation($object,$objectType,$attrValues='dn') {
|
public static function getObjectKeyValueInRelation($object,$objectType,$attrValues='dn') {
|
||||||
if (!$objectType) {
|
if (!$objectType) {
|
||||||
LSerror :: addErrorCode('LSrelations_05','getObjectKeyValueInRelation');
|
LSerror :: addErrorCode('LSrelations_05','getObjectKeyValueInRelation');
|
||||||
return;
|
return;
|
||||||
|
@ -1370,7 +1370,7 @@ class LSldapObject {
|
||||||
*
|
*
|
||||||
* @retval Array of $objectType Les objets en relations
|
* @retval Array of $objectType Les objets en relations
|
||||||
**/
|
**/
|
||||||
function listObjectsInRelation($object,$attr,$objectType,$attrValues='dn') {
|
public function listObjectsInRelation($object,$attr,$objectType,$attrValues='dn') {
|
||||||
if ((!$attr)||(!$objectType)) {
|
if ((!$attr)||(!$objectType)) {
|
||||||
LSerror :: addErrorCode('LSrelations_05','listObjectsInRelation');
|
LSerror :: addErrorCode('LSrelations_05','listObjectsInRelation');
|
||||||
return;
|
return;
|
||||||
|
@ -1403,7 +1403,7 @@ class LSldapObject {
|
||||||
*
|
*
|
||||||
* @retval boolean true si l'objet à été ajouté, False sinon
|
* @retval boolean true si l'objet à été ajouté, False sinon
|
||||||
**/
|
**/
|
||||||
function addOneObjectInRelation($object,$attr,$objectType,$attrValue='dn',$canEditFunction=NULL) {
|
public function addOneObjectInRelation($object,$attr,$objectType,$attrValue='dn',$canEditFunction=NULL) {
|
||||||
if ((!$attr)||(!$objectType)) {
|
if ((!$attr)||(!$objectType)) {
|
||||||
LSerror :: addErrorCode('LSrelations_05','addOneObjectInRelation');
|
LSerror :: addErrorCode('LSrelations_05','addOneObjectInRelation');
|
||||||
return;
|
return;
|
||||||
|
@ -1468,7 +1468,7 @@ class LSldapObject {
|
||||||
*
|
*
|
||||||
* @retval boolean true si l'objet à été supprimé, False sinon
|
* @retval boolean true si l'objet à été supprimé, False sinon
|
||||||
**/
|
**/
|
||||||
function deleteOneObjectInRelation($object,$attr,$objectType,$attrValue='dn',$canEditFunction=NULL,$attrValues=null) {
|
public function deleteOneObjectInRelation($object,$attr,$objectType,$attrValue='dn',$canEditFunction=NULL,$attrValues=null) {
|
||||||
if ((!$attr)||(!$objectType)) {
|
if ((!$attr)||(!$objectType)) {
|
||||||
LSerror :: addErrorCode('LSrelations_05','deleteOneObjectInRelation');
|
LSerror :: addErrorCode('LSrelations_05','deleteOneObjectInRelation');
|
||||||
return;
|
return;
|
||||||
|
@ -1519,7 +1519,7 @@ class LSldapObject {
|
||||||
*
|
*
|
||||||
* @retval boolean True en cas de succès, False sinon
|
* @retval boolean True en cas de succès, False sinon
|
||||||
*/
|
*/
|
||||||
function renameOneObjectInRelation($object,$oldValues,$attr,$objectType,$attrValue='dn') {
|
public function renameOneObjectInRelation($object,$oldValues,$attr,$objectType,$attrValue='dn') {
|
||||||
if ((!$attr)||(!$objectType)) {
|
if ((!$attr)||(!$objectType)) {
|
||||||
LSerror :: addErrorCode('LSrelations_05','renameOneObjectInRelation');
|
LSerror :: addErrorCode('LSrelations_05','renameOneObjectInRelation');
|
||||||
return;
|
return;
|
||||||
|
@ -1575,7 +1575,7 @@ class LSldapObject {
|
||||||
*
|
*
|
||||||
* @retval boolean true si tout c'est bien passé, False sinon
|
* @retval boolean true si tout c'est bien passé, False sinon
|
||||||
**/
|
**/
|
||||||
function updateObjectsInRelation($object,$listDns,$attr,$objectType,$attrValue='dn',$canEditFunction=NULL,$attrValues=null) {
|
public function updateObjectsInRelation($object,$listDns,$attr,$objectType,$attrValue='dn',$canEditFunction=NULL,$attrValues=null) {
|
||||||
if ((!$attr)||(!$objectType)) {
|
if ((!$attr)||(!$objectType)) {
|
||||||
LSerror :: addErrorCode('LSrelations_05','updateObjectsInRelation');
|
LSerror :: addErrorCode('LSrelations_05','updateObjectsInRelation');
|
||||||
return;
|
return;
|
||||||
|
@ -1623,7 +1623,7 @@ class LSldapObject {
|
||||||
*
|
*
|
||||||
* @retval void
|
* @retval void
|
||||||
*/
|
*/
|
||||||
function addEvent($event,$fct,$param=NULL,$class=NULL) {
|
public function addEvent($event,$fct,$param=NULL,$class=NULL) {
|
||||||
$this -> _events[$event][] = array(
|
$this -> _events[$event][] = array(
|
||||||
'function' => $fct,
|
'function' => $fct,
|
||||||
'param' => $param,
|
'param' => $param,
|
||||||
|
@ -1641,7 +1641,7 @@ class LSldapObject {
|
||||||
*
|
*
|
||||||
* @retval void
|
* @retval void
|
||||||
*/
|
*/
|
||||||
function addObjectEvent($event,&$obj,$meth,$param=NULL) {
|
public function addObjectEvent($event,&$obj,$meth,$param=NULL) {
|
||||||
$this -> _objectEvents[$event][] = array(
|
$this -> _objectEvents[$event][] = array(
|
||||||
'obj' => &$obj,
|
'obj' => &$obj,
|
||||||
'meth' => $meth,
|
'meth' => $meth,
|
||||||
|
@ -1656,7 +1656,7 @@ class LSldapObject {
|
||||||
*
|
*
|
||||||
* @retval boolean True si tout c'est bien passé, false sinon
|
* @retval boolean True si tout c'est bien passé, false sinon
|
||||||
*/
|
*/
|
||||||
function fireEvent($event) {
|
public function fireEvent($event) {
|
||||||
|
|
||||||
// Object event
|
// Object event
|
||||||
$return = $this -> fireObjectEvent($event);
|
$return = $this -> fireObjectEvent($event);
|
||||||
|
@ -1752,7 +1752,7 @@ class LSldapObject {
|
||||||
*
|
*
|
||||||
* @retval boolean True si tout c'est bien passé, false sinon
|
* @retval boolean True si tout c'est bien passé, false sinon
|
||||||
**/
|
**/
|
||||||
function fireObjectEvent($event) {
|
public function fireObjectEvent($event) {
|
||||||
switch($event) {
|
switch($event) {
|
||||||
case 'after_create':
|
case 'after_create':
|
||||||
return $this -> afterCreate();
|
return $this -> afterCreate();
|
||||||
|
@ -1785,7 +1785,7 @@ class LSldapObject {
|
||||||
*
|
*
|
||||||
* @retval mixed The value
|
* @retval mixed The value
|
||||||
**/
|
**/
|
||||||
function __get($key) {
|
public function __get($key) {
|
||||||
if ($key=='subDnValue') {
|
if ($key=='subDnValue') {
|
||||||
if (isset($this -> cache['subDnValue'])) {
|
if (isset($this -> cache['subDnValue'])) {
|
||||||
return $this -> cache['subDnValue'];
|
return $this -> cache['subDnValue'];
|
||||||
|
@ -1814,7 +1814,7 @@ class LSldapObject {
|
||||||
*
|
*
|
||||||
* @retval mixed Array of valid IOformats of this object type
|
* @retval mixed Array of valid IOformats of this object type
|
||||||
**/
|
**/
|
||||||
function listValidIOformats() {
|
public function listValidIOformats() {
|
||||||
$ret=array();
|
$ret=array();
|
||||||
$ioFormats = $this -> getConfig('ioFormat');
|
$ioFormats = $this -> getConfig('ioFormat');
|
||||||
if (is_array($ioFormats)) {
|
if (is_array($ioFormats)) {
|
||||||
|
@ -1832,7 +1832,7 @@ class LSldapObject {
|
||||||
*
|
*
|
||||||
* @retval boolean True if it's a valid IOformat, false otherwise
|
* @retval boolean True if it's a valid IOformat, false otherwise
|
||||||
**/
|
**/
|
||||||
function isValidIOformat($f) {
|
public function isValidIOformat($f) {
|
||||||
return is_array($this -> getConfig("ioFormat.$f"));
|
return is_array($this -> getConfig("ioFormat.$f"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -39,7 +39,7 @@ class LSgroup extends LSldapObject {
|
||||||
*
|
*
|
||||||
* @retval Mixed La valeur clef d'un membre
|
* @retval Mixed La valeur clef d'un membre
|
||||||
**/
|
**/
|
||||||
function getMemberKeyValue($object) {
|
public function getMemberKeyValue($object) {
|
||||||
return $this -> getObjectKeyValueInRelation($object,$this -> userObjectType,$this -> memberAttrValue);
|
return $this -> getObjectKeyValueInRelation($object,$this -> userObjectType,$this -> memberAttrValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -53,7 +53,7 @@ class LSgroup extends LSldapObject {
|
||||||
*
|
*
|
||||||
* @retval Array of LSgroup Les groupes de l'utilisateur
|
* @retval Array of LSgroup Les groupes de l'utilisateur
|
||||||
**/
|
**/
|
||||||
function listUserGroups($userObject) {
|
public function listUserGroups($userObject) {
|
||||||
return $this -> listObjectsInRelation($userObject,$this -> memberAttr,$this -> userObjectType,$this -> memberAttrValue);
|
return $this -> listObjectsInRelation($userObject,$this -> memberAttr,$this -> userObjectType,$this -> memberAttrValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -64,7 +64,7 @@ class LSgroup extends LSldapObject {
|
||||||
*
|
*
|
||||||
* @retval boolean true si l'utilisateur à été ajouté, False sinon
|
* @retval boolean true si l'utilisateur à été ajouté, False sinon
|
||||||
**/
|
**/
|
||||||
function addOneMember($object) {
|
public function addOneMember($object) {
|
||||||
return $this -> addOneObjectInRelation($object,$this -> memberAttr, $this -> userObjectType,$this -> memberAttrValue,'canEditGroupRelation');
|
return $this -> addOneObjectInRelation($object,$this -> memberAttr, $this -> userObjectType,$this -> memberAttrValue,'canEditGroupRelation');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -75,7 +75,7 @@ class LSgroup extends LSldapObject {
|
||||||
*
|
*
|
||||||
* @retval boolean true si l'utilisateur à été supprimé, False sinon
|
* @retval boolean true si l'utilisateur à été supprimé, False sinon
|
||||||
**/
|
**/
|
||||||
function deleteOneMember($object) {
|
public function deleteOneMember($object) {
|
||||||
return $this -> deleteOneObjectInRelation($object,$this -> memberAttr,$this -> userObjectType,$this -> memberAttrValue,'canEditGroupRelation');
|
return $this -> deleteOneObjectInRelation($object,$this -> memberAttr,$this -> userObjectType,$this -> memberAttrValue,'canEditGroupRelation');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -87,7 +87,7 @@ class LSgroup extends LSldapObject {
|
||||||
*
|
*
|
||||||
* @retval boolean True en cas de succès, False sinon
|
* @retval boolean True en cas de succès, False sinon
|
||||||
*/
|
*/
|
||||||
function renameOneMember($object,$oldDn) {
|
public function renameOneMember($object,$oldDn) {
|
||||||
return $this -> renameOneObjectInRelation($object,$oldDn,$this -> memberAttr,$this -> userObjectType,$this -> memberAttrValue);
|
return $this -> renameOneObjectInRelation($object,$oldDn,$this -> memberAttr,$this -> userObjectType,$this -> memberAttrValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -99,7 +99,7 @@ class LSgroup extends LSldapObject {
|
||||||
*
|
*
|
||||||
* @retval boolean true si tout c'est bien passé, False sinon
|
* @retval boolean true si tout c'est bien passé, False sinon
|
||||||
**/
|
**/
|
||||||
function updateUserGroups($object,$listDns) {
|
public function updateUserGroups($object,$listDns) {
|
||||||
return $this -> updateObjectsInRelation($object,$listDns,$this -> memberAttr,$this -> userObjectType,$this -> memberAttrValue,'canEditGroupRelation');
|
return $this -> updateObjectsInRelation($object,$listDns,$this -> memberAttr,$this -> userObjectType,$this -> memberAttrValue,'canEditGroupRelation');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -108,7 +108,7 @@ class LSgroup extends LSldapObject {
|
||||||
*
|
*
|
||||||
* @retval boolean true si tout l'utilisateur peut éditer la relation, False sinon
|
* @retval boolean true si tout l'utilisateur peut éditer la relation, False sinon
|
||||||
**/
|
**/
|
||||||
function canEditGroupRelation($dn=NULL) {
|
public function canEditGroupRelation($dn=NULL) {
|
||||||
if (!$dn) {
|
if (!$dn) {
|
||||||
$dn=$this -> dn;
|
$dn=$this -> dn;
|
||||||
}
|
}
|
||||||
|
|
|
@ -85,7 +85,7 @@ class LSsearch {
|
||||||
* @param[in] $purgeParams boolean If params in session have to be purged
|
* @param[in] $purgeParams boolean If params in session have to be purged
|
||||||
*
|
*
|
||||||
**/
|
**/
|
||||||
function LSsearch($LSobject,$context,$params=null,$purgeParams=false) {
|
public function __construct($LSobject,$context,$params=null,$purgeParams=false) {
|
||||||
if (!LSsession :: loadLSobject($LSobject)) {
|
if (!LSsession :: loadLSobject($LSobject)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -575,7 +575,7 @@ class LSsearch {
|
||||||
*
|
*
|
||||||
* @retval mixed Net_LDAP2_Filter on success or False
|
* @retval mixed Net_LDAP2_Filter on success or False
|
||||||
*/
|
*/
|
||||||
function getFilterFromPattern($pattern=NULL) {
|
public function getFilterFromPattern($pattern=NULL) {
|
||||||
if ($pattern==NULL) {
|
if ($pattern==NULL) {
|
||||||
$pattern=$this -> params['pattern'];
|
$pattern=$this -> params['pattern'];
|
||||||
}
|
}
|
||||||
|
@ -1152,7 +1152,7 @@ class LSsearch {
|
||||||
*
|
*
|
||||||
* @retval void
|
* @retval void
|
||||||
**/
|
**/
|
||||||
function afterUsingResult() {
|
public function afterUsingResult() {
|
||||||
$this -> addResultToCache();
|
$this -> addResultToCache();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1161,7 +1161,7 @@ class LSsearch {
|
||||||
*
|
*
|
||||||
* @retval boolean True only if user have been redirected
|
* @retval boolean True only if user have been redirected
|
||||||
**/
|
**/
|
||||||
function redirectWhenOnlyOneResult() {
|
public function redirectWhenOnlyOneResult() {
|
||||||
if ($this -> total == 1 && $this -> result && self::formIsSubmited()) {
|
if ($this -> total == 1 && $this -> result && self::formIsSubmited()) {
|
||||||
LSsession :: redirect('view.php?LSobject='.$this -> LSobject.'&dn='.urlencode($this -> result['list'][0]['dn']));
|
LSsession :: redirect('view.php?LSobject='.$this -> LSobject.'&dn='.urlencode($this -> result['list'][0]['dn']));
|
||||||
}
|
}
|
||||||
|
@ -1173,7 +1173,7 @@ class LSsearch {
|
||||||
*
|
*
|
||||||
* @retval boolean True on success or false
|
* @retval boolean True on success or false
|
||||||
**/
|
**/
|
||||||
function doSort() {
|
private function doSort() {
|
||||||
if (!$this -> sort) {
|
if (!$this -> sort) {
|
||||||
LSdebug('doSort : sort is disabled');
|
LSdebug('doSort : sort is disabled');
|
||||||
return true;
|
return true;
|
||||||
|
@ -1220,7 +1220,7 @@ class LSsearch {
|
||||||
*
|
*
|
||||||
* @retval array The Table of id lines of results sorted
|
* @retval array The Table of id lines of results sorted
|
||||||
**/
|
**/
|
||||||
function getSortTable() {
|
public function getSortTable() {
|
||||||
if (isset($this -> result['sort'][$this -> params['sortBy']][$this -> params['sortDirection']])) {
|
if (isset($this -> result['sort'][$this -> params['sortBy']][$this -> params['sortDirection']])) {
|
||||||
return $this -> result['sort'][$this -> params['sortBy']][$this -> params['sortDirection']];
|
return $this -> result['sort'][$this -> params['sortBy']][$this -> params['sortDirection']];
|
||||||
}
|
}
|
||||||
|
|
|
@ -60,7 +60,7 @@ class LSsearchEntry {
|
||||||
* @param[in] $resultEntry array The data of the result entry
|
* @param[in] $resultEntry array The data of the result entry
|
||||||
*
|
*
|
||||||
**/
|
**/
|
||||||
function LSsearchEntry(&$LSsearch,$LSobject,$params,$hash,&$result,$id) {
|
public function __construct(&$LSsearch, $LSobject, $params, $hash, &$result, $id) {
|
||||||
if (!LSsession :: loadLSobject($LSobject)) {
|
if (!LSsession :: loadLSobject($LSobject)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -100,7 +100,7 @@ class LSsearchEntry {
|
||||||
*
|
*
|
||||||
* @retval void
|
* @retval void
|
||||||
**/
|
**/
|
||||||
function registerOtherValue($name,$value) {
|
private function registerOtherValue($name,$value) {
|
||||||
$this -> other_values[$name]=$value;
|
$this -> other_values[$name]=$value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -341,7 +341,7 @@ class LStemplate {
|
||||||
*
|
*
|
||||||
* @retval void
|
* @retval void
|
||||||
*/
|
*/
|
||||||
function addEvent($event,$callable,$param=NULL) {
|
public static function addEvent($event,$callable,$param=NULL) {
|
||||||
self :: $_events[$event][] = array(
|
self :: $_events[$event][] = array(
|
||||||
'callable' => $callable,
|
'callable' => $callable,
|
||||||
'param' => $param,
|
'param' => $param,
|
||||||
|
@ -355,7 +355,7 @@ class LStemplate {
|
||||||
*
|
*
|
||||||
* @retval boolean True if all triggered actions succefully runned, false otherwise
|
* @retval boolean True if all triggered actions succefully runned, false otherwise
|
||||||
*/
|
*/
|
||||||
function fireEvent($event) {
|
public static function fireEvent($event) {
|
||||||
$return = true;
|
$return = true;
|
||||||
|
|
||||||
// Binding via addEvent
|
// Binding via addEvent
|
||||||
|
|
Loading…
Reference in a new issue