From c357c70596acd80b8be1afd4c9f61ddcfe699e40 Mon Sep 17 00:00:00 2001 From: Benjamin Renard Date: Tue, 12 Mar 2019 11:42:53 +0100 Subject: [PATCH] Explicitly defined class methods visibility and upgrade PHP class constructor syntax --- .../includes/class/class.LSattr_html.php | 10 +- .../class/class.LSattr_html_maildir.php | 4 +- .../class/class.LSattr_html_password.php | 2 +- .../class/class.LSattr_html_select_list.php | 10 +- .../class/class.LSattr_html_select_object.php | 12 +-- .../includes/class/class.LSattr_ldap.php | 8 +- .../class/class.LSattr_ldap_boolean.php | 12 +-- ...class.LSattr_ldap_compositeValueToJSON.php | 8 +- .../includes/class/class.LSattr_ldap_date.php | 6 +- .../class/class.LSattr_ldap_password.php | 10 +- .../class/class.LSattr_ldap_postaladdress.php | 4 +- .../class/class.LSattr_ldap_shadowExpire.php | 4 +- .../includes/class/class.LSattribute.php | 50 ++++----- public_html/includes/class/class.LSauth.php | 80 +++++++------- .../includes/class/class.LSauthMethod.php | 64 +++++------ .../includes/class/class.LSauthMethod_CAS.php | 2 +- .../class/class.LSauthMethod_HTTP.php | 10 +- .../class/class.LSauthMethod_anonymous.php | 2 +- public_html/includes/class/class.LSform.php | 46 ++++---- .../includes/class/class.LSformElement.php | 30 +++--- .../class/class.LSformElement_boolean.php | 2 +- .../class/class.LSformElement_date.php | 12 +-- .../class/class.LSformElement_image.php | 4 +- ...s.LSformElement_jsonCompositeAttribute.php | 10 +- .../class.LSformElement_labeledValue.php | 8 +- .../class/class.LSformElement_mail.php | 4 +- .../class/class.LSformElement_mailQuota.php | 8 +- .../class/class.LSformElement_maildir.php | 4 +- .../class/class.LSformElement_password.php | 12 +-- .../class.LSformElement_postaladdress.php | 2 +- .../class/class.LSformElement_pre.php | 2 +- .../class/class.LSformElement_quota.php | 6 +- .../class/class.LSformElement_rss.php | 2 +- .../class/class.LSformElement_select.php | 4 +- .../class/class.LSformElement_select_box.php | 2 +- .../class.LSformElement_select_object.php | 12 +-- .../class/class.LSformElement_ssh_key.php | 2 +- ...LSformElement_supannCompositeAttribute.php | 6 +- ...ass.LSformElement_supannEtuInscription.php | 2 +- ...class.LSformElement_supannLabeledValue.php | 4 +- .../class.LSformElement_supannRoleEntite.php | 2 +- .../class/class.LSformElement_tel.php | 2 +- .../class/class.LSformElement_text.php | 2 +- .../class/class.LSformElement_textarea.php | 2 +- .../class/class.LSformElement_url.php | 2 +- .../class.LSformElement_valueWithUnit.php | 10 +- .../class/class.LSformElement_wysiwyg.php | 2 +- .../class/class.LSformElement_xmpp.php | 2 +- .../includes/class/class.LSformRule.php | 11 +- ...rmRule_LSformElement_select_validValue.php | 2 +- .../class/class.LSformRule_alphanumeric.php | 2 +- .../class/class.LSformRule_callable.php | 2 +- .../class/class.LSformRule_compare.php | 6 +- .../includes/class/class.LSformRule_date.php | 2 +- .../includes/class/class.LSformRule_email.php | 2 +- .../class/class.LSformRule_filesize.php | 2 +- .../class/class.LSformRule_imagefile.php | 2 +- .../class/class.LSformRule_imagesize.php | 2 +- .../class/class.LSformRule_inarray.php | 2 +- .../class/class.LSformRule_integer.php | 2 +- .../class/class.LSformRule_lettersonly.php | 2 +- .../class/class.LSformRule_maxlength.php | 2 +- .../class/class.LSformRule_mimetype.php | 2 +- .../class/class.LSformRule_minlength.php | 2 +- .../class/class.LSformRule_nonzero.php | 2 +- .../class/class.LSformRule_nopunctuation.php | 2 +- .../class/class.LSformRule_numeric.php | 2 +- .../class/class.LSformRule_password.php | 2 +- .../class/class.LSformRule_rangelength.php | 2 +- .../includes/class/class.LSformRule_regex.php | 2 +- .../class/class.LSformRule_required.php | 2 +- .../class/class.LSformRule_ssh_pub_key.php | 2 +- .../class.LSformRule_telephonenumber.php | 2 +- public_html/includes/class/class.LSimport.php | 8 +- .../includes/class/class.LSioFormat.php | 8 +- .../includes/class/class.LSioFormatDriver.php | 12 +-- public_html/includes/class/class.LSldap.php | 2 +- .../includes/class/class.LSldapObject.php | 102 +++++++++--------- .../class/class.LSobjects.LSgroup.php | 14 +-- public_html/includes/class/class.LSsearch.php | 12 +-- .../includes/class/class.LSsearchEntry.php | 4 +- .../includes/class/class.LStemplate.php | 4 +- 82 files changed, 363 insertions(+), 372 deletions(-) diff --git a/public_html/includes/class/class.LSattr_html.php b/public_html/includes/class/class.LSattr_html.php index bc273bf2..472bda10 100644 --- a/public_html/includes/class/class.LSattr_html.php +++ b/public_html/includes/class/class.LSattr_html.php @@ -45,7 +45,7 @@ class LSattr_html { * * @retval boolean Retourne true. */ - function LSattr_html ($name,$config,&$attribute) { + public function __construct($name, $config, &$attribute) { $this -> name = $name; $this -> config = $config; $this -> attribute =& $attribute; @@ -60,7 +60,7 @@ class LSattr_html { * * @retval string Le label de l'attribut. */ - function getLabel() { + public function getLabel() { return __($this -> getConfig('label', $this -> name)); } @@ -73,7 +73,7 @@ class LSattr_html { * * @retval LSformElement L'element du formulaire ajouté */ - function addToForm (&$form,$idForm,$data=NULL) { + public function addToForm (&$form,$idForm,$data=NULL) { if (!$this -> LSformElement_type) { LSerror :: addErrorCode('LSattr_html_01',$this -> name); return; @@ -96,7 +96,7 @@ class LSattr_html { * * @retval mixed La valeur formatée de l'attribut **/ - function refreshForm($data) { + public function refreshForm($data) { return $data; } @@ -107,7 +107,7 @@ class LSattr_html { * * @retval array The values to be displayed in the LSform **/ - function getFormVal($data) { + public function getFormVal($data) { return $this -> attribute -> getDisplayValue(); } diff --git a/public_html/includes/class/class.LSattr_html_maildir.php b/public_html/includes/class/class.LSattr_html_maildir.php index 33e424c3..be99416d 100644 --- a/public_html/includes/class/class.LSattr_html_maildir.php +++ b/public_html/includes/class/class.LSattr_html_maildir.php @@ -32,7 +32,7 @@ class LSattr_html_maildir extends LSattr_html { var $LSformElement_type = 'maildir'; var $_toDo = array(); - function LSattr_html_maildir ($name,$config,&$attribute) { + public function __construct($name, $config, &$attribute) { $attribute -> addObjectEvent('before_delete',$this,'beforeDelete'); $attribute -> addObjectEvent('after_delete',$this,'deleteMaildirByFTP'); 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'); } - function toDo() { + public function toDo() { if (is_array($this -> _toDo)) { switch($this -> _toDo['action']) { case 'delete': diff --git a/public_html/includes/class/class.LSattr_html_password.php b/public_html/includes/class/class.LSattr_html_password.php index c260efc5..9fd26c17 100644 --- a/public_html/includes/class/class.LSattr_html_password.php +++ b/public_html/includes/class/class.LSattr_html_password.php @@ -36,7 +36,7 @@ class LSattr_html_password extends LSattr_html { * * @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); if(!$element) { LSerror :: addErrorCode('LSform_06',$this -> name); diff --git a/public_html/includes/class/class.LSattr_html_select_list.php b/public_html/includes/class/class.LSattr_html_select_list.php index 4371c451..206d5887 100644 --- a/public_html/includes/class/class.LSattr_html_select_list.php +++ b/public_html/includes/class/class.LSattr_html_select_list.php @@ -53,7 +53,7 @@ class LSattr_html_select_list extends LSattr_html{ * * @retval LSformElement L'element du formulaire ajouté */ - function addToForm (&$form,$idForm,$data=NULL) { + public function addToForm (&$form,$idForm,$data=NULL) { $possible_values=$this -> getPossibleValues(); $this -> config['text_possible_values'] = $possible_values; $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é * 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 (!$name) $name=$this -> name; if (!$ldapObject) $ldapObject=$this->attribute->ldapObject; @@ -188,7 +188,7 @@ class LSattr_html_select_list extends LSattr_html{ * * @retval int Value for uasort **/ - protected function _sortTwoValuesAsc(&$va,&$vb) { + protected static function _sortTwoValuesAsc(&$va,&$vb) { if (is_array($va)) { $nva=$va['label']; } @@ -216,7 +216,7 @@ class LSattr_html_select_list extends LSattr_html{ * * @retval int Value for uasort **/ - function _sortTwoValuesDesc(&$va,&$vb) { + protected static function _sortTwoValuesDesc(&$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é * 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 (!$name) $name=$this -> name; $retInfos = array(); diff --git a/public_html/includes/class/class.LSattr_html_select_object.php b/public_html/includes/class/class.LSattr_html_select_object.php index b7eb2534..88ccd346 100644 --- a/public_html/includes/class/class.LSattr_html_select_object.php +++ b/public_html/includes/class/class.LSattr_html_select_object.php @@ -38,7 +38,7 @@ class LSattr_html_select_object extends LSattr_html{ * * @retval LSformElement L'element du formulaire ajouté */ - function addToForm (&$form,$idForm,$data=NULL) { + public function addToForm (&$form,$idForm,$data=NULL) { $this -> config['attrObject'] = $this; $element=$form -> addElement('select_object', $this -> name, $this -> getLabel(), $this -> config, $this); 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')) **/ - function refreshForm($data,$fromDNs=false) { + public function refreshForm($data,$fromDNs=false) { 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 */ - function getValuesFromFormValues($values=NULL) { + public function getValuesFromFormValues($values=NULL) { $conf = $this -> getConfig('html_options.selectable_object'); if (is_array($conf) && is_array($values)) { $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é * 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'); if (is_array($conf) && is_array($values)) { 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é * le DN et en valeur ce qui sera affiché. */ - function getValuesFromSession() { + public function getValuesFromSession() { $obj_type = $this -> getConfig('html_options.selectable_object.object_type'); if ( $obj_type && is_array($_SESSION['LSselect'][$obj_type]) ) { 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 **/ - function getFormVal($data) { + public function getFormVal($data) { return $data; } diff --git a/public_html/includes/class/class.LSattr_ldap.php b/public_html/includes/class/class.LSattr_ldap.php index 9e84b83c..b63696e1 100644 --- a/public_html/includes/class/class.LSattr_ldap.php +++ b/public_html/includes/class/class.LSattr_ldap.php @@ -44,7 +44,7 @@ class LSattr_ldap { * * @retval boolean Retourne true. */ - function LSattr_ldap ($name,$config,&$attribute) { + public function __construct($name, $config, &$attribute) { $this -> name = $name; $this -> config = $config; $this -> attribute =& $attribute; @@ -58,7 +58,7 @@ class LSattr_ldap { * * @retval mixed La valeur traitée de l'attribut */ - function getUpdateData($data) { + public function getUpdateData($data) { return $data; } @@ -69,7 +69,7 @@ class LSattr_ldap { * * @retval mixed La valeur d'affichage de l'attribut */ - function getDisplayValue($data) { + public function getDisplayValue($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 */ - function isUpdated($data) { + public function isUpdated($data) { $data=$this -> getUpdateData($data); if ($this -> attribute -> data != $data) { return true; diff --git a/public_html/includes/class/class.LSattr_ldap_boolean.php b/public_html/includes/class/class.LSattr_ldap_boolean.php index 581cec66..c83b0dfe 100644 --- a/public_html/includes/class/class.LSattr_ldap_boolean.php +++ b/public_html/includes/class/class.LSattr_ldap_boolean.php @@ -32,7 +32,7 @@ class LSattr_ldap_boolean extends LSattr_ldap { * * @retval mixed Attribute display value **/ - function getDisplayValue($data) { + public function getDisplayValue($data) { if ($this -> isTrue($data)) return 'yes'; if ($this -> isFalse($data)) @@ -47,7 +47,7 @@ class LSattr_ldap_boolean extends LSattr_ldap { * * @retval mixed Attribute data **/ - function getUpdateData($data) { + public function getUpdateData($data) { if ($data[0]=='yes') { return array($this -> getTrue()); } @@ -64,7 +64,7 @@ class LSattr_ldap_boolean extends LSattr_ldap { * * @retval boolean True or False **/ - function isTrue($data) { + public function isTrue($data) { if (!is_array($data)) { $data=array($data); } @@ -81,7 +81,7 @@ class LSattr_ldap_boolean extends LSattr_ldap { * * @retval boolean True or False **/ - function isFalse($data) { + public function isFalse($data) { if (!is_array($data)) { $data=array($data); } @@ -96,7 +96,7 @@ class LSattr_ldap_boolean extends LSattr_ldap { * * @retval string The True value **/ - function getTrue() { + public function getTrue() { 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 **/ - function getFalse() { + public function getFalse() { return $this -> getConfig('ldap_options.false_value', 'FALSE', 'string'); } diff --git a/public_html/includes/class/class.LSattr_ldap_compositeValueToJSON.php b/public_html/includes/class/class.LSattr_ldap_compositeValueToJSON.php index a9174925..2dd14589 100644 --- a/public_html/includes/class/class.LSattr_ldap_compositeValueToJSON.php +++ b/public_html/includes/class/class.LSattr_ldap_compositeValueToJSON.php @@ -36,7 +36,7 @@ class LSattr_ldap_compositeValueToJSON extends LSattr_ldap { * * @retval mixed La valeur d'affichage de l'attribut */ - function getDisplayValue($data) { + public static function getDisplayValue($data) { if ($data) { if (!is_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 */ - function getUpdateData($data) { + public static function getUpdateData($data) { if ($data) { if (!is_array($data)) $data = array($data); @@ -67,7 +67,7 @@ class LSattr_ldap_compositeValueToJSON extends LSattr_ldap { return $data; } - function parseValue($value) { + public static function parseValue($value) { if (preg_match_all('/\[([^=]*)=([^\]]*)\]/',$value,$matches)) { $parseValue=array(); for($i=0;$i $val) diff --git a/public_html/includes/class/class.LSattr_ldap_date.php b/public_html/includes/class/class.LSattr_ldap_date.php index ea9d8cc0..24708e84 100644 --- a/public_html/includes/class/class.LSattr_ldap_date.php +++ b/public_html/includes/class/class.LSattr_ldap_date.php @@ -33,7 +33,7 @@ class LSattr_ldap_date extends LSattr_ldap { * * @retval mixed La valeur d'affichage de l'attribut */ - function getDisplayValue($data) { + public function getDisplayValue($data) { if(!is_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 */ - function getUpdateData($data) { + public function getUpdateData($data) { if ($this -> getConfig('ldap_options.timestamp', false, 'bool')) { return $data; } @@ -75,7 +75,7 @@ class LSattr_ldap_date extends LSattr_ldap { * * @retval string Le format de la date **/ - function getFormat() { + public function getFormat() { return $this -> getConfig('ldap_options.format', '%Y%m%d%H%M%SZ'); } diff --git a/public_html/includes/class/class.LSattr_ldap_password.php b/public_html/includes/class/class.LSattr_ldap_password.php index 36aef585..4bd1aa7a 100644 --- a/public_html/includes/class/class.LSattr_ldap_password.php +++ b/public_html/includes/class/class.LSattr_ldap_password.php @@ -35,7 +35,7 @@ class LSattr_ldap_password extends LSattr_ldap { * * @retval mixed The display value of this attribute */ - function getDisplayValue($data) { + public function getDisplayValue($data) { if ($this -> getConfig('ldap_options.displayClearValue', false, 'bool')) { if (is_array($data)) { $ret=array(); @@ -68,7 +68,7 @@ class LSattr_ldap_password extends LSattr_ldap { * * @retval mixed The value of this attribute to be stocked */ - function getUpdateData($data) { + public function getUpdateData($data) { $this -> clearPassword = $data[0]; $data=array(); @@ -111,7 +111,7 @@ class LSattr_ldap_password extends LSattr_ldap { * * @retval strinf The encode password */ - function encodePassword($clearPassword) { + public function encodePassword($clearPassword) { $encode = $this -> getConfig('ldap_options.encode', 'md5crypt', 'string'); $encode_function = $this -> getConfig('ldap_options.encode_function'); if ($encode_function || $encode == 'function') { @@ -237,7 +237,7 @@ class LSattr_ldap_password extends LSattr_ldap { * * @retval string A salt */ - function getSalt($length=8) { + public static function getSalt($length=8) { $pattern = "1234567890abcdefghijklmnopqrstuvwxyz"; $key = $pattern{rand(0,35)}; for($i=1;$i<$length;$i++) @@ -252,7 +252,7 @@ class LSattr_ldap_password extends LSattr_ldap { * * @retval string The password in clear text */ - function getClearPassword() { + public function getClearPassword() { return $this -> clearPassword; } diff --git a/public_html/includes/class/class.LSattr_ldap_postaladdress.php b/public_html/includes/class/class.LSattr_ldap_postaladdress.php index ac8808a3..a8104e4f 100644 --- a/public_html/includes/class/class.LSattr_ldap_postaladdress.php +++ b/public_html/includes/class/class.LSattr_ldap_postaladdress.php @@ -33,7 +33,7 @@ class LSattr_ldap_postaladdress extends LSattr_ldap { * * @retval mixed La valeur d'affichage de l'attribut */ - function getDisplayValue($data) { + public static function getDisplayValue($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 */ - function getUpdateData($data) { + public static function getUpdateData($data) { return str_replace("\n","$",$data); } diff --git a/public_html/includes/class/class.LSattr_ldap_shadowExpire.php b/public_html/includes/class/class.LSattr_ldap_shadowExpire.php index 1e3b8bc3..dc80588f 100644 --- a/public_html/includes/class/class.LSattr_ldap_shadowExpire.php +++ b/public_html/includes/class/class.LSattr_ldap_shadowExpire.php @@ -35,7 +35,7 @@ class LSattr_ldap_shadowExpire extends LSattr_ldap { * * @retval mixed Array of timestamp */ - function getDisplayValue($data) { + public static function getDisplayValue($data) { $ret=array(); foreach($data as $val) { $ret[]=((int)$val)*86400; @@ -50,7 +50,7 @@ class LSattr_ldap_shadowExpire extends LSattr_ldap { * * @retval mixed LDAP attribute values */ - function getUpdateData($data) { + public static function getUpdateData($data) { $ret=array(); foreach($data as $val) { $ret[]=round(((int)$val)/86400); diff --git a/public_html/includes/class/class.LSattribute.php b/public_html/includes/class/class.LSattribute.php index f513cc50..ea47abd4 100644 --- a/public_html/includes/class/class.LSattribute.php +++ b/public_html/includes/class/class.LSattribute.php @@ -60,7 +60,7 @@ class LSattribute { * * @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 -> config = $config; $this -> ldapObject =& $ldapObject; @@ -90,7 +90,7 @@ class LSattribute { * @see LSattr_html::getLabel() */ - function getLabel() { + public function getLabel() { if (!$this -> html) { LSerror :: addErrorCode('LSattribute_09',array('type' => 'html','name' => $this -> name)); return; @@ -105,7 +105,7 @@ class LSattribute { * * @retval boolean true */ - function loadData($attr_data) { + public function loadData($attr_data) { if ((!is_array($attr_data))&&(!empty($attr_data))) { $attr_data = array($attr_data); } @@ -120,7 +120,7 @@ class LSattribute { * * @retval boolean true */ - function reloadData($attr_data) { + public function reloadData($attr_data) { if ((!is_array($attr_data))&&(!empty($attr_data))) { $attr_data = array($attr_data); } @@ -139,7 +139,7 @@ class LSattribute { * * @retval mixed La valeur de l'attribut */ - function getValue() { + public function getValue() { if ($this -> isUpdate()) { return $this -> getUpdateData(); } @@ -155,7 +155,7 @@ class LSattribute { * * @retval mixed La valeur originale de l'attribut */ - function getOldValue() { + public function getOldValue() { return $this -> data; } @@ -166,7 +166,7 @@ class LSattribute { * * @retval string La valeur d'affichage de l'attribut */ - function getDisplayValue() { + public function getDisplayValue() { if (!$this -> ldap) { LSerror :: addErrorCode('LSattribute_09',array('type' => 'ldap','name' => $this -> name)); 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 */ - function addToForm(&$form,$idForm,&$obj=NULL,$value=NULL) { + public function addToForm(&$form,$idForm,&$obj=NULL,$value=NULL) { if($this -> getConfig("form.$idForm")) { if (!$this -> html) { 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' **/ - function myRights() { + private function myRights() { // cache if ($this -> _myRights != NULL) { 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 */ - function addToView(&$form) { + public function addToView(&$form) { if ($this -> getConfig('view', false, 'bool') && ($this -> myRights() != 'n') ) { if (!$this -> html) { 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 */ - function refreshForm(&$form,$idForm) { + public function refreshForm(&$form,$idForm) { if ($this -> getConfig("form.$idForm") && ($this -> myRights() != 'n')) { if (!$this -> html) { 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. */ - function getFormVal() { + public function getFormVal() { $data=$this -> html -> getFormVal($this -> data); if ($data==NULL) { $data=array(); @@ -386,7 +386,7 @@ class LSattribute { * * @retval void */ - function setUpdateData($data) { + public function setUpdateData($data) { if($this -> ldap -> isUpdated($data)) { $this -> updateData=$data; } @@ -399,7 +399,7 @@ class LSattribute { * * @retval boolean true si l'attribut a été validé, false sinon */ - function isValidate() { + public function isValidate() { return $this -> is_validate; } @@ -410,7 +410,7 @@ class LSattribute { * * @retval void */ - function validate() { + public function validate() { $this -> is_validate=true; } @@ -421,7 +421,7 @@ class LSattribute { * * @retval boolean true si l'attribut a été mis à jour, false sinon */ - function isUpdate() { + public function isUpdate() { return ($this -> updateData===false)?false:true; } @@ -432,7 +432,7 @@ class LSattribute { * * @retval boolean true si l'attribut est obligatoire, false sinon */ - function isRequired() { + public function isRequired() { 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 */ - function canBeGenerated() { + public function canBeGenerated() { $format = $this -> getConfig('generate_value_format', $this -> getConfig('default_value')); return ( (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 */ - function generateValue() { + public function generateValue() { $value = false; $generate_function = $this -> getConfig('generate_function'); $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 */ - function getUpdateData() { + public function getUpdateData() { if (!$this -> isUpdate()) { return; } @@ -547,7 +547,7 @@ class LSattribute { * * @retval mixed La configuration de validation de l'attribut */ - function getValidateConfig() { + public function getValidateConfig() { if (isset($this -> config['validation'])) { return $this -> config['validation']; } @@ -561,7 +561,7 @@ class LSattribute { * * @retval array les noms des attributs dépendants */ - function getDependsAttrs() { + public function getDependsAttrs() { return (isset($this -> config['dependAttrs'])?$this -> config['dependAttrs']:null); } @@ -575,7 +575,7 @@ class LSattribute { * * @retval void */ - function addEvent($event,$fct,$params,$class=NULL) { + public function addEvent($event,$fct,$params,$class=NULL) { $this -> _events[$event][] = array( 'function' => $fct, 'params' => $params, @@ -593,7 +593,7 @@ class LSattribute { * * @retval void */ - function addObjectEvent($event,&$obj,$meth,$params=NULL) { + public function addObjectEvent($event,&$obj,$meth,$params=NULL) { $this -> _objectEvents[$event][] = array( 'obj' => &$obj, 'meth' => $meth, @@ -608,7 +608,7 @@ class LSattribute { * * @retval boolean True si tout c'est bien passé, false sinon */ - function fireEvent($event) { + public function fireEvent($event) { $return = true; if(isset($this -> config[$event])) { if (!is_array($this -> config[$event])) { diff --git a/public_html/includes/class/class.LSauth.php b/public_html/includes/class/class.LSauth.php index cf0c65fe..021246ee 100644 --- a/public_html/includes/class/class.LSauth.php +++ b/public_html/includes/class/class.LSauth.php @@ -40,16 +40,16 @@ class LSauth { 'displaySelfAccess' => true ); - function start() { - LSdebug('LSauth :: start()'); + public static function start() { + LSdebug('LSauth :: start()'); // Load Config if (isset(LSsession :: $ldapServer['LSauth']) && is_array(LSsession :: $ldapServer['LSauth'])) { self :: $config = LSsession :: $ldapServer['LSauth']; } if (!LSsession :: loadLSclass('LSauthMethod')) { - LSdebug('LSauth :: Failed to load LSauthMethod'); - return; - } + LSdebug('LSauth :: Failed to load LSauthMethod'); + return; + } if (!isset(self :: $config['method'])) { self :: $config['method']='basic'; } @@ -69,21 +69,21 @@ class LSauth { } } - function forceAuthentication() { - LSdebug('LSauth :: forceAuthentication()'); - if (!is_null(self :: $provider)) { - self :: $authData = self :: $provider -> getAuthData(); - if (self :: $authData) { - self :: $authObject = self :: $provider -> authenticate(); - return self :: $authObject; - } - // No data : user has not filled the login form - LSdebug('LSauth : No data -> user has not filled the login form'); - return; - } - LSerror :: addErrorCode('LSauth_06'); - return; - } + public static function forceAuthentication() { + LSdebug('LSauth :: forceAuthentication()'); + if (!is_null(self :: $provider)) { + self :: $authData = self :: $provider -> getAuthData(); + if (self :: $authData) { + self :: $authObject = self :: $provider -> authenticate(); + return self :: $authObject; + } + // No data : user has not filled the login form + LSdebug('LSauth : No data -> user has not filled the login form'); + return; + } + LSerror :: addErrorCode('LSauth_06'); + return; + } /** * Get LDAP credentials @@ -94,7 +94,7 @@ class LSauth { * * @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); } @@ -103,12 +103,12 @@ class LSauth { * * @retval void **/ - public function logout() { + public static function logout() { if (!is_null(self :: $provider)) { - return self :: $provider -> logout(); - } - LSerror :: addErrorCode('LSauth_06'); - return; + return self :: $provider -> logout(); + } + LSerror :: addErrorCode('LSauth_06'); + return; } /** @@ -116,45 +116,45 @@ class LSauth { * * @retval void **/ - public function disableLogoutBtn() { - self :: $params['displayLogoutBtn'] = false; - } + public static function disableLogoutBtn() { + self :: $params['displayLogoutBtn'] = false; + } /** * Can display or not logout button in LSauth parameters * * @retval boolean - **/ - public function displayLogoutBtn() { - return self :: $params['displayLogoutBtn']; - } + **/ + public static function displayLogoutBtn() { + return self :: $params['displayLogoutBtn']; + } /** * Disable self access * * @retval void **/ - public function disableSelfAccess() { - self :: $params['displaySelfAccess'] = false; - } + public static function disableSelfAccess() { + self :: $params['displaySelfAccess'] = false; + } /** * Can display or not self access * * @retval boolean **/ - public function displaySelfAccess() { + public static function displaySelfAccess() { return self :: $params['displaySelfAccess']; } /* * For compatibillity until loginForm is migrated in LSauth */ - public function disableLoginForm() { + public static function disableLoginForm() { self :: $params['displayLoginForm'] = false; } - - public function displayLoginForm() { + + public static function displayLoginForm() { return self :: $params['displayLoginForm']; } diff --git a/public_html/includes/class/class.LSauthMethod.php b/public_html/includes/class/class.LSauthMethod.php index 014c2630..a61365d5 100644 --- a/public_html/includes/class/class.LSauthMethod.php +++ b/public_html/includes/class/class.LSauthMethod.php @@ -29,12 +29,12 @@ class LSauthMethod { var $authData = array(); - function LSauthMethod() { - // Load config - LSsession :: includeFile(LS_CONF_DIR."LSauth/config.".get_class($this).".php"); - LSdebug(LS_CONF_DIR."LSauth/config.".get_class($this).".php"); - return true; - } + public function __construct() { + // Load config + LSsession :: includeFile(LS_CONF_DIR."LSauth/config.".get_class($this).".php"); + LSdebug(LS_CONF_DIR."LSauth/config.".get_class($this).".php"); + return true; + } /** * Check Auth Data @@ -57,26 +57,26 @@ class LSauthMethod { public function authenticate() { if (LSsession :: loadLSobject(LSsession :: $ldapServer['authObjectType'])) { $authobject = new LSsession :: $ldapServer['authObjectType'](); - $result = $authobject -> searchObject( - $this -> authData['username'], - LSsession :: getTopDn(), - (isset(LSsession :: $ldapServer['authObjectFilter'])?LSsession :: $ldapServer['authObjectFilter']:NULL), - array('withoutCache' => true, 'onlyAccessible' => false) - ); - $nbresult=count($result); - - if ($nbresult==0) { - // incorrect login - LSdebug('identifiant incorrect'); - LSerror :: addErrorCode('LSauth_01'); - } - else if ($nbresult>1) { - // duplication of identity - LSerror :: addErrorCode('LSauth_02'); - } - else { - return $result[0]; - } + $result = $authobject -> searchObject( + $this -> authData['username'], + LSsession :: getTopDn(), + (isset(LSsession :: $ldapServer['authObjectFilter'])?LSsession :: $ldapServer['authObjectFilter']:NULL), + array('withoutCache' => true, 'onlyAccessible' => false) + ); + $nbresult=count($result); + + if ($nbresult==0) { + // incorrect login + LSdebug('identifiant incorrect'); + LSerror :: addErrorCode('LSauth_01'); + } + else if ($nbresult>1) { + // duplication of identity + LSerror :: addErrorCode('LSauth_02'); + } + else { + return $result[0]; + } } else { LSerror :: addErrorCode('LSauth_03'); @@ -104,12 +104,12 @@ class LSauthMethod { * @retval Array|false Array of LDAP credentials array('dn','pwd') or False **/ public function getLDAPcredentials($user) { - if (isset($this -> authData['password'])) { - return array( - 'dn' => $user -> getDn(), - 'pwd' => $this -> authData['password'] - ); - } + if (isset($this -> authData['password'])) { + return array( + 'dn' => $user -> getDn(), + 'pwd' => $this -> authData['password'] + ); + } return false; } diff --git a/public_html/includes/class/class.LSauthMethod_CAS.php b/public_html/includes/class/class.LSauthMethod_CAS.php index 1b232120..c1d0de94 100644 --- a/public_html/includes/class/class.LSauthMethod_CAS.php +++ b/public_html/includes/class/class.LSauthMethod_CAS.php @@ -27,7 +27,7 @@ */ class LSauthMethod_CAS extends LSauthMethod { - function LSauthMethod_CAS() { + public function __construct() { LSauth :: disableLoginForm(); if (!parent :: LSauthMethod()) diff --git a/public_html/includes/class/class.LSauthMethod_HTTP.php b/public_html/includes/class/class.LSauthMethod_HTTP.php index 9f5fdad5..d6e49a10 100644 --- a/public_html/includes/class/class.LSauthMethod_HTTP.php +++ b/public_html/includes/class/class.LSauthMethod_HTTP.php @@ -29,11 +29,11 @@ LSsession :: loadLSclass('LSauthMethod_basic'); */ class LSauthMethod_HTTP extends LSauthMethod_basic { - function LSauthMethod_HTTP() { - LSauth :: disableLoginForm(); - LSauth :: disableLogoutBtn(); - return parent :: LSauthMethod_basic(); - } + public function LSauthMethod_HTTP() { + LSauth :: disableLoginForm(); + LSauth :: disableLogoutBtn(); + return parent :: LSauthMethod_basic(); + } /** * Check Auth Data diff --git a/public_html/includes/class/class.LSauthMethod_anonymous.php b/public_html/includes/class/class.LSauthMethod_anonymous.php index 29d301ae..5cff3109 100644 --- a/public_html/includes/class/class.LSauthMethod_anonymous.php +++ b/public_html/includes/class/class.LSauthMethod_anonymous.php @@ -27,7 +27,7 @@ */ class LSauthMethod_anonymous extends LSauthMethod { - function LSauthMethod_anonymous() { + public function __construct() { LSauth :: disableLoginForm(); LSauth :: disableSelfAccess(); diff --git a/public_html/includes/class/class.LSform.php b/public_html/includes/class/class.LSform.php index a51672aa..308d4399 100644 --- a/public_html/includes/class/class.LSform.php +++ b/public_html/includes/class/class.LSform.php @@ -62,7 +62,7 @@ class LSform { * * @retval void */ - function LSform (&$ldapObject,$idForm,$submit=NULL){ + public function __construct(&$ldapObject, $idForm, $submit=NULL){ $this -> idForm = $idForm; if (!$submit) { $this -> submit = _("Validate"); @@ -81,7 +81,7 @@ class LSform { * * @retval void */ - function display(){ + public function display(){ if ($this -> idForm == 'view') { self :: loadDependenciesDisplayView($this -> $ldapObject); } @@ -227,7 +227,7 @@ class LSform { * * @retval void */ - function displayView(){ + public function displayView(){ self :: loadDependenciesDisplayView($this -> ldapObject); $LSform_object = array( @@ -261,7 +261,7 @@ class LSform { * * @retval void */ - function setElementError($attr,$msg=NULL) { + public function setElementError($attr,$msg=NULL) { if($msg!='') { $msg_error=getFData($msg,$attr->getLabel()); } @@ -281,7 +281,7 @@ class LSform { * * @retval boolean */ - function definedError($element=NULL) { + public function definedError($element=NULL) { if ($element) { return isset($this -> _elementsErrors[$element]); } @@ -295,7 +295,7 @@ class LSform { * * @retval Array array(element => array(errors)) */ - function getErrors() { + public function getErrors() { 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 */ - function validate(){ + public function validate(){ if(!$this -> can_validate) return; if ($this -> isSubmit()) { @@ -333,7 +333,7 @@ class LSform { * * @retval boolean true si toutes la saisie est OK, false sinon */ - function checkData() { + public function checkData() { $retval=true; foreach ($this -> _postData as $element => $values) { if ($this -> definedError($element)) { @@ -378,7 +378,7 @@ class LSform { * * @retval boolean true si au moins une valeur est présente, false sinon */ - function checkRequired($data) { + public function checkRequired($data) { foreach($data as $val) { if (!empty($val)||(is_string($val)&&($val=="0"))) return true; @@ -393,7 +393,7 @@ class LSform { * * @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)) ) return true; return; @@ -409,7 +409,7 @@ class LSform { * * @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)) { foreach($data as $key => $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. */ - function getPostData() { + public function getPostData() { if (is_null($this -> dataEntryForm)) { foreach($this -> elements as $element_name => $element) { if( !($element -> getPostData($this -> _postData)) ) { @@ -481,7 +481,7 @@ class LSform { * * @retval LSformElement */ - function addElement($type,$name,$label,$params=array(),&$attr_html) { + public function addElement($type,$name,$label,$params=array(),&$attr_html) { $elementType='LSformElement_'.$type; LSsession :: loadLSclass($elementType); if (!class_exists($elementType)) { @@ -532,7 +532,7 @@ class LSform { * * @retval boolean */ - function addRule($element, $rule, $options=array()) { + public function addRule($element, $rule, $options=array()) { if ( isset($this ->elements[$element]) ) { if ($this -> isRuleRegistered($rule)) { $this -> _rules[$element][]=array( @@ -564,7 +564,7 @@ class LSform { * * @retval boolean */ - function setRequired($element) { + public function setRequired($element) { if (isset( $this -> elements[$element] ) ) return $this -> elements[$element] -> setRequired(); else @@ -580,7 +580,7 @@ class LSform { * * @param[in] $element string Le nom de l'élément conserné */ - function isRuleRegistered($rule) { + public function isRuleRegistered($rule) { LSsession :: loadLSclass('LSformRule'); LSsession :: loadLSclass('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 */ - function exportValues() { + public function exportValues() { if ($this -> _isValidate) { $retval=array(); foreach($this -> _postData as $element => $values) { @@ -611,7 +611,7 @@ class LSform { * * @retval LSformElement L'élement du formulaire voulu */ - function getElement($element) { + public function getElement($element) { return $this -> elements[$element]; } @@ -620,7 +620,7 @@ class LSform { * * @retval boolean True si les valeurs ont été définies, false sinon. */ - function setValuesFromPostData() { + public function setValuesFromPostData() { if (empty($this -> _postData)) { return; } @@ -637,7 +637,7 @@ class LSform { * * @retval string Le code HTML du champ vide. */ - function getEmptyField($element) { + public function getEmptyField($element) { $element = $this -> getElement($element); if ($element) { return $element -> getEmptyField(); @@ -654,7 +654,7 @@ class LSform { * * @retval void **/ - function setMaxFileSize($size) { + public function setMaxFileSize($size) { $this -> maxFileSize = $size; } @@ -665,7 +665,7 @@ class LSform { * * @retval boolean True si le masque de saisie a été appliqué, False sinon **/ - function applyDataEntryForm($dataEntryForm) { + public function applyDataEntryForm($dataEntryForm) { $dataEntryForm=(string)$dataEntryForm; $objType = $this -> ldapObject -> getType(); $config=LSconfig :: get("LSobjects.".$objType.".LSform.dataEntryForm.".$dataEntryForm); @@ -724,7 +724,7 @@ class LSform { * * @retval void **/ - function addWarning($txt) { + public function addWarning($txt) { $this -> warnings[]=$txt; } diff --git a/public_html/includes/class/class.LSformElement.php b/public_html/includes/class/class.LSformElement.php index a5046553..6156d428 100644 --- a/public_html/includes/class/class.LSformElement.php +++ b/public_html/includes/class/class.LSformElement.php @@ -56,7 +56,7 @@ class LSformElement { * * @retval true */ - function LSformElement (&$form, $name, $label, $params,&$attr_html){ + public function __construct(&$form, $name, $label, $params, &$attr_html){ $this -> name = $name; $this -> label = $label; $this -> params = $params; @@ -76,7 +76,7 @@ class LSformElement { * * @retval boolean Retourne True */ - function setValue($data) { + public function setValue($data) { if (!is_array($data)) { $data=array($data); } @@ -98,7 +98,7 @@ class LSformElement { * * @retval boolean Retourne True */ - function setValueFromPostData($data) { + public function setValueFromPostData($data) { if (!is_array($data)) { $data=array($data); } @@ -111,7 +111,7 @@ class LSformElement { * * @retval Array Les valeurs de l'élement */ - function exportValues(){ + public function exportValues(){ return $this -> values; } @@ -126,7 +126,7 @@ class LSformElement { * * @retval void */ - function addValue($data) { + public function addValue($data) { if (is_array($data)) { $this -> values = array_merge($this -> values, $data); } @@ -142,7 +142,7 @@ class LSformElement { * * @retval boolean */ - function isFreeze(){ + public function isFreeze(){ return $this -> _freeze; } @@ -153,7 +153,7 @@ class LSformElement { * * @retval void */ - function freeze() { + public function freeze() { $this -> _freeze = true; } @@ -164,7 +164,7 @@ class LSformElement { * * @retval void */ - function setRequired($isRequired=true) { + public function setRequired($isRequired=true) { $this -> _required = $isRequired; } @@ -175,7 +175,7 @@ class LSformElement { * * @retval boolean */ - function isRequired(){ + public function isRequired(){ return $this -> _required; } @@ -184,7 +184,7 @@ class LSformElement { * * @retval void */ - function getLabelInfos() { + public function getLabelInfos() { if ($this -> isRequired()) { $return['required']=true; } @@ -212,7 +212,7 @@ class LSformElement { * * @retval boolean true si la valeur est présente en POST, false sinon */ - function getPostData(&$return) { + public function getPostData(&$return) { if($this -> isFreeze()) { return true; } @@ -241,7 +241,7 @@ class LSformElement { * * @retval string Le label de l'élément */ - function getLabel() { + public function getLabel() { if ($this -> label != "") { return __($this -> label); } @@ -253,7 +253,7 @@ class LSformElement { * * @retval boolean True si le champ est à valeur multiple, False sinon */ - function isMultiple() { + public function isMultiple() { return $this -> getParam('multiple', false, 'bool'); } @@ -265,7 +265,7 @@ class LSformElement { * * @retval string Le HTML compilé du template */ - function fetchTemplate($template=NULL,$variables=array()) { + public function fetchTemplate($template=NULL,$variables=array()) { if (!$template) { $template = $this -> template; } @@ -293,7 +293,7 @@ class LSformElement { * * @retval string Code HTML d'un champ vide. */ - function getEmptyField() { + public function getEmptyField() { return $this -> fetchTemplate($this -> fieldTemplate); } diff --git a/public_html/includes/class/class.LSformElement_boolean.php b/public_html/includes/class/class.LSformElement_boolean.php index f70c910a..0914eb29 100644 --- a/public_html/includes/class/class.LSformElement_boolean.php +++ b/public_html/includes/class/class.LSformElement_boolean.php @@ -42,7 +42,7 @@ class LSformElement_boolean extends LSformElement { * * @retval array */ - function getDisplay(){ + public function getDisplay(){ $return = $this -> getLabelInfos(); if (!$this -> isFreeze()) { // Help Infos diff --git a/public_html/includes/class/class.LSformElement_date.php b/public_html/includes/class/class.LSformElement_date.php index f66fe9a7..cd0eeb6f 100644 --- a/public_html/includes/class/class.LSformElement_date.php +++ b/public_html/includes/class/class.LSformElement_date.php @@ -73,7 +73,7 @@ class LSformElement_date extends LSformElement { * * @retval boolean Retourne True */ - function setValue($data) { + public function setValue($data) { if (!is_array($data)) { $data=array($data); } @@ -96,7 +96,7 @@ class LSformElement_date extends LSformElement { * * @retval Array Les valeurs de l'élement */ - function exportValues(){ + public function exportValues(){ $retval=array(); if (is_array($this -> values)) { foreach($this -> values as $val) { @@ -114,7 +114,7 @@ class LSformElement_date extends LSformElement { * * @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')); } @@ -123,7 +123,7 @@ class LSformElement_date extends LSformElement { * * @retval string The date picker style **/ - function getStyle() { + public function getStyle() { $style = $this -> getParam('html_options.style', $this -> default_style, 'string'); if ($style) { if (is_dir(LS_LIB_DIR.'arian-mootools-datepicker/datepicker_'.$style)) { @@ -141,7 +141,7 @@ class LSformElement_date extends LSformElement { * * @retval array */ - function getDisplay(){ + public function getDisplay(){ $return = $this -> getLabelInfos(); // value if (!$this -> isFreeze()) { @@ -185,7 +185,7 @@ class LSformElement_date extends LSformElement { * @retval mixed Format de date jscalendar (string) ou False si la convertion * n'a pas réussi. */ - function php2js_format($format) { + public function php2js_format($format) { if (isset($this -> _cache_php2js_format[$format])) { return $this -> _cache_php2js_format[$format]; } diff --git a/public_html/includes/class/class.LSformElement_image.php b/public_html/includes/class/class.LSformElement_image.php index 1f56f905..4a62b1d2 100644 --- a/public_html/includes/class/class.LSformElement_image.php +++ b/public_html/includes/class/class.LSformElement_image.php @@ -43,7 +43,7 @@ class LSformElement_image extends LSformElement { * * @retval array */ - function getDisplay(){ + public function getDisplay(){ LSsession :: addCssFile('LSformElement_image.css'); $return = true; $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 */ - function getPostData(&$return) { + public function getPostData(&$return) { if($this -> isFreeze()) { return true; } diff --git a/public_html/includes/class/class.LSformElement_jsonCompositeAttribute.php b/public_html/includes/class/class.LSformElement_jsonCompositeAttribute.php index 9152a786..83cc3457 100644 --- a/public_html/includes/class/class.LSformElement_jsonCompositeAttribute.php +++ b/public_html/includes/class/class.LSformElement_jsonCompositeAttribute.php @@ -35,7 +35,7 @@ class LSformElement_jsonCompositeAttribute extends LSformElement { var $template = 'LSformElement_jsonCompositeAttribute.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); $this -> components = $this -> getParam('html_options.components', array()); } @@ -73,7 +73,7 @@ class LSformElement_jsonCompositeAttribute extends LSformElement { * * @retval array */ - function getDisplay(){ + public function getDisplay(){ $return = $this -> getLabelInfos(); $parseValues=array(); @@ -123,7 +123,7 @@ class LSformElement_jsonCompositeAttribute extends LSformElement { * * @retval string Le HTML compilé du template */ - function fetchTemplate($template=NULL,$variables=array()) { + public function fetchTemplate($template=NULL,$variables=array()) { $components = $this -> components; foreach($components as $c => $cconf) { if ($cconf['type']=='select_list') { @@ -148,7 +148,7 @@ class LSformElement_jsonCompositeAttribute extends LSformElement { * * @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']) { $retval = array(); if (!is_array($value)) @@ -219,7 +219,7 @@ class LSformElement_jsonCompositeAttribute extends LSformElement { * * @retval boolean true if value is in POST data, false instead */ - function getPostData(&$return) { + public function getPostData(&$return) { if($this -> isFreeze()) { return true; } diff --git a/public_html/includes/class/class.LSformElement_labeledValue.php b/public_html/includes/class/class.LSformElement_labeledValue.php index afc80d0c..b54a376a 100644 --- a/public_html/includes/class/class.LSformElement_labeledValue.php +++ b/public_html/includes/class/class.LSformElement_labeledValue.php @@ -43,7 +43,7 @@ class LSformElement_labeledValue extends LSformElement { * * @retval array */ - function getDisplay(){ + public function getDisplay(){ $return = $this -> getLabelInfos(); $parseValues=array(); @@ -64,7 +64,7 @@ class LSformElement_labeledValue extends LSformElement { * * @retval string Code HTML d'un champ vide. */ - function getEmptyField() { + public function getEmptyField() { return $this -> fetchTemplate($this -> fieldTemplate,array( '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 **/ - function parseValue($value) { + public function parseValue($value) { $ret=array('raw_value' => $value); if (preg_match('/^\[([^\]]*)\](.*)$/',$value,$m)) { $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 */ - function getPostData(&$return) { + public function getPostData(&$return) { if($this -> isFreeze()) { return true; } diff --git a/public_html/includes/class/class.LSformElement_mail.php b/public_html/includes/class/class.LSformElement_mail.php index e805a6f8..c5c14f6f 100644 --- a/public_html/includes/class/class.LSformElement_mail.php +++ b/public_html/includes/class/class.LSformElement_mail.php @@ -44,7 +44,7 @@ class LSformElement_mail extends LSformElement_text { var $fieldTemplate = 'LSformElement_uri_field.tpl'; - function getDisplay() { + public function getDisplay() { LSsession :: addHelpInfos ( 'LSformElement_mail', array( @@ -57,7 +57,7 @@ class LSformElement_mail extends LSformElement_text { return parent :: getDisplay(); } - function fetchTemplate($template=NULL,$variables=array()) { + public function fetchTemplate($template=NULL,$variables=array()) { if ($this -> getParam('html_options.disableMailSending', false, 'bool')) { $this -> fetchVariables['uriClass'] .= " LSformElement_mail_disableMailSending"; } diff --git a/public_html/includes/class/class.LSformElement_mailQuota.php b/public_html/includes/class/class.LSformElement_mailQuota.php index ecc7914f..ac029602 100644 --- a/public_html/includes/class/class.LSformElement_mailQuota.php +++ b/public_html/includes/class/class.LSformElement_mailQuota.php @@ -48,7 +48,7 @@ class LSformElement_mailQuota extends LSformElement { * * @retval array */ - function getDisplay(){ + public function getDisplay(){ $return = $this -> getLabelInfos(); $quotas=array(); @@ -99,7 +99,7 @@ class LSformElement_mailQuota extends LSformElement { * * @retval string Code HTML d'un champ vide. */ - function getEmptyField() { + public function getEmptyField() { return $this -> fetchTemplate( $this -> fieldTemplate, array( @@ -113,7 +113,7 @@ class LSformElement_mailQuota extends LSformElement { * * @retval string Suffix value **/ - function getSuffix() { + public function getSuffix() { 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 */ - function getPostData(&$return) { + public function getPostData(&$return) { if($this -> isFreeze()) { return true; } diff --git a/public_html/includes/class/class.LSformElement_maildir.php b/public_html/includes/class/class.LSformElement_maildir.php index 5958e387..67b83bdd 100644 --- a/public_html/includes/class/class.LSformElement_maildir.php +++ b/public_html/includes/class/class.LSformElement_maildir.php @@ -61,7 +61,7 @@ class LSformElement_maildir extends LSformElement_text { var $fieldTemplate = 'LSformElement_maildir_field.tpl'; - function getDisplay() { + public function getDisplay() { LSsession :: addHelpInfos ( 'LSformElement_maildir', array( @@ -82,7 +82,7 @@ class LSformElement_maildir extends LSformElement_text { * * @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 $retval = parent :: getPostData($return); diff --git a/public_html/includes/class/class.LSformElement_password.php b/public_html/includes/class/class.LSformElement_password.php index 8d448661..279a2f28 100644 --- a/public_html/includes/class/class.LSformElement_password.php +++ b/public_html/includes/class/class.LSformElement_password.php @@ -48,7 +48,7 @@ class LSformElement_password extends LSformElement { * * @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 $retval = parent :: getPostData($return); // Si une valeur est recupérée @@ -118,7 +118,7 @@ class LSformElement_password extends LSformElement { * * @retval array */ - function getDisplay(){ + public function getDisplay(){ LSsession :: addCssFile('LSformElement_password.css'); $return = $this -> getLabelInfos(); $pwd = ""; @@ -173,7 +173,7 @@ class LSformElement_password extends LSformElement { return $return; } - function generatePassword($params=NULL) { + public static function generatePassword($params=NULL) { if (LSconfig :: get('html_options.use_pwgen', false, null, $params)) { $args = LSconfig :: get('html_options.pwgen_opts', '', 'string', $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)); } - function verifyPassword($pwd) { + public function verifyPassword($pwd) { if ($this -> attr_html -> attribute -> ldapObject -> isNew()) { return false; } @@ -218,7 +218,7 @@ class LSformElement_password extends LSformElement { } } - function getMailAttrs() { + public function getMailAttrs() { if (!$this -> getParam('html_options.mail')) return False; 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'); } - function send($params) { + public function send($params) { if (is_array($this -> sendMail)) { $mail = (String)$this -> sendMail['mail']; Lsdebug($mail); diff --git a/public_html/includes/class/class.LSformElement_postaladdress.php b/public_html/includes/class/class.LSformElement_postaladdress.php index 3d2c1499..56641c9c 100644 --- a/public_html/includes/class/class.LSformElement_postaladdress.php +++ b/public_html/includes/class/class.LSformElement_postaladdress.php @@ -39,7 +39,7 @@ class LSformElement_postaladdress extends LSformElement_textarea { * * @retval array */ - function getDisplay(){ + public function getDisplay(){ $return = parent :: getDisplay(); if ($this -> isFreeze()) { if (!empty($this->values)) { diff --git a/public_html/includes/class/class.LSformElement_pre.php b/public_html/includes/class/class.LSformElement_pre.php index 53227c1a..7c799f27 100644 --- a/public_html/includes/class/class.LSformElement_pre.php +++ b/public_html/includes/class/class.LSformElement_pre.php @@ -39,7 +39,7 @@ class LSformElement_pre extends LSformElement_textarea { * * @retval array */ - function getDisplay(){ + public function getDisplay(){ $return = parent :: getDisplay(); LSsession :: addCssFile('LSformElement_pre.css'); return $return; diff --git a/public_html/includes/class/class.LSformElement_quota.php b/public_html/includes/class/class.LSformElement_quota.php index 34beba32..3bc462fa 100644 --- a/public_html/includes/class/class.LSformElement_quota.php +++ b/public_html/includes/class/class.LSformElement_quota.php @@ -48,7 +48,7 @@ class LSformElement_quota extends LSformElement { * * @retval array */ - function getDisplay(){ + public function getDisplay(){ $return = $this -> getLabelInfos(); $quotas=array(); @@ -99,7 +99,7 @@ class LSformElement_quota extends LSformElement { * * @retval string Code HTML d'un champ vide. */ - function getEmptyField() { + public function getEmptyField() { return $this -> fetchTemplate( $this -> fieldTemplate, array( @@ -118,7 +118,7 @@ class LSformElement_quota extends LSformElement { * * @retval boolean true si la valeur est présente en POST, false sinon */ - function getPostData(&$return) { + public function getPostData(&$return) { if($this -> isFreeze()) { return true; } diff --git a/public_html/includes/class/class.LSformElement_rss.php b/public_html/includes/class/class.LSformElement_rss.php index 7d13117f..d8e6e08f 100644 --- a/public_html/includes/class/class.LSformElement_rss.php +++ b/public_html/includes/class/class.LSformElement_rss.php @@ -43,7 +43,7 @@ class LSformElement_rss extends LSformElement_text { var $fieldTemplate = 'LSformElement_uri_field.tpl'; - function getDisplay() { + public function getDisplay() { LSsession :: addHelpInfos ( 'LSformElement_rss', array( diff --git a/public_html/includes/class/class.LSformElement_select.php b/public_html/includes/class/class.LSformElement_select.php index d8a3c22a..6744dedd 100644 --- a/public_html/includes/class/class.LSformElement_select.php +++ b/public_html/includes/class/class.LSformElement_select.php @@ -42,7 +42,7 @@ class LSformElement_select extends LSformElement { * * @retval array */ - function getDisplay(){ + public function getDisplay(){ $return = $this -> getLabelInfos(); $params = array(); 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 */ - public function isValidValue($value,$possible_values=False) { + public static function isValidValue($value,$possible_values=False) { if (!is_array($possible_values)) { if (isset($this) && is_a($this, __CLASS__) && $this -> getParam('text_possible_values')) { $possible_values = $this -> getParam('text_possible_values'); diff --git a/public_html/includes/class/class.LSformElement_select_box.php b/public_html/includes/class/class.LSformElement_select_box.php index 26f38e08..f8cc82b4 100644 --- a/public_html/includes/class/class.LSformElement_select_box.php +++ b/public_html/includes/class/class.LSformElement_select_box.php @@ -43,7 +43,7 @@ class LSformElement_select_box extends LSformElement_select { * * @retval array */ - function getDisplay(){ + public function getDisplay(){ if (!$this -> isFreeze()) { LSsession :: addCssFile('LSformElement_select_box.css'); } diff --git a/public_html/includes/class/class.LSformElement_select_object.php b/public_html/includes/class/class.LSformElement_select_object.php index 8fbe841b..4b672937 100644 --- a/public_html/includes/class/class.LSformElement_select_object.php +++ b/public_html/includes/class/class.LSformElement_select_object.php @@ -53,7 +53,7 @@ class LSformElement_select_object extends LSformElement { * * @retval array */ - function getDisplay($refresh=NULL){ + public function getDisplay($refresh=NULL){ LSsession :: addCssFile('LSformElement_select_object.css'); if ($refresh) { $this -> values = $this -> getValuesFromSession(); @@ -128,7 +128,7 @@ class LSformElement_select_object extends LSformElement { /* * Return the values of the object form the session variable */ - function getValuesFromSession() { + public function getValuesFromSession() { return $this -> attr_html -> getValuesFromSession(); } @@ -139,7 +139,7 @@ class LSformElement_select_object extends LSformElement { * * @retval void **/ - function setSelectableObject($object) { + public function setSelectableObject($object) { $this -> selectableObject = $object; } @@ -148,7 +148,7 @@ class LSformElement_select_object extends LSformElement { * * @retval Array The values of the element */ - function exportValues(){ + public function exportValues(){ $values = $this -> attr_html -> getValuesFromFormValues($this -> values); return $values; } @@ -162,7 +162,7 @@ class LSformElement_select_object extends LSformElement { * * @retval boolean Return True */ - function setValueFromPostData($data) { + public function setValueFromPostData($data) { LSformElement::setValueFromPostData($data); $this -> values = $this -> attr_html -> refreshForm($this -> values,true); return true; @@ -175,7 +175,7 @@ class LSformElement_select_object extends LSformElement { * * @retval array(dn -> displayName) Found objects */ - function searchAdd ($pattern) { + public function searchAdd ($pattern) { if ($this -> getParam('html_options.selectable_object')) { $obj_type = $this -> getParam('html_options.selectable_object.object_type'); if (LSsession :: loadLSobject($obj_type)) { diff --git a/public_html/includes/class/class.LSformElement_ssh_key.php b/public_html/includes/class/class.LSformElement_ssh_key.php index e7e6449a..3dbc4fce 100644 --- a/public_html/includes/class/class.LSformElement_ssh_key.php +++ b/public_html/includes/class/class.LSformElement_ssh_key.php @@ -42,7 +42,7 @@ class LSformElement_ssh_key extends LSformElement { * * @retval array */ - function getDisplay(){ + public function getDisplay(){ LSsession :: addCssFile('LSformElement_ssh_key.css'); $return = $this -> getLabelInfos(); $params = array(); diff --git a/public_html/includes/class/class.LSformElement_supannCompositeAttribute.php b/public_html/includes/class/class.LSformElement_supannCompositeAttribute.php index 27caad3a..30eb615c 100644 --- a/public_html/includes/class/class.LSformElement_supannCompositeAttribute.php +++ b/public_html/includes/class/class.LSformElement_supannCompositeAttribute.php @@ -73,7 +73,7 @@ class LSformElement_supannCompositeAttribute extends LSformElement { * * @retval array */ - function getDisplay(){ + public function getDisplay(){ $return = $this -> getLabelInfos(); $parseValues=array(); @@ -123,7 +123,7 @@ class LSformElement_supannCompositeAttribute extends LSformElement { * * @retval string Code HTML d'un champ vide. */ - function getEmptyField() { + public function getEmptyField() { 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 */ - function getPostData(&$return) { + public function getPostData(&$return) { if($this -> isFreeze()) { return true; } diff --git a/public_html/includes/class/class.LSformElement_supannEtuInscription.php b/public_html/includes/class/class.LSformElement_supannEtuInscription.php index c0cbbf36..29b470d9 100644 --- a/public_html/includes/class/class.LSformElement_supannEtuInscription.php +++ b/public_html/includes/class/class.LSformElement_supannEtuInscription.php @@ -35,7 +35,7 @@ LSsession :: loadLSaddon('supann'); 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 ( 'etab' => array ( 'label' => _('Organism'), diff --git a/public_html/includes/class/class.LSformElement_supannLabeledValue.php b/public_html/includes/class/class.LSformElement_supannLabeledValue.php index 142c073d..e2eec359 100644 --- a/public_html/includes/class/class.LSformElement_supannLabeledValue.php +++ b/public_html/includes/class/class.LSformElement_supannLabeledValue.php @@ -46,7 +46,7 @@ class LSformElement_supannLabeledValue extends LSformElement { * * @retval array */ - function getDisplay(){ + public function getDisplay(){ $return = $this -> getLabelInfos(); $parseValues=array(); @@ -79,7 +79,7 @@ class LSformElement_supannLabeledValue extends LSformElement { * * @retval array Un tableau cle->valeur contenant value, translated et label **/ - function parseValue($value) { + public function parseValue($value) { $retval=array( 'value' => $value, ); diff --git a/public_html/includes/class/class.LSformElement_supannRoleEntite.php b/public_html/includes/class/class.LSformElement_supannRoleEntite.php index 1fca9053..ec3736ee 100644 --- a/public_html/includes/class/class.LSformElement_supannRoleEntite.php +++ b/public_html/includes/class/class.LSformElement_supannRoleEntite.php @@ -34,7 +34,7 @@ LSsession :: loadLSaddon('supann'); 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 ( 'role' => array ( 'label' => _('Role'), diff --git a/public_html/includes/class/class.LSformElement_tel.php b/public_html/includes/class/class.LSformElement_tel.php index a85bcbbc..27eceb1a 100644 --- a/public_html/includes/class/class.LSformElement_tel.php +++ b/public_html/includes/class/class.LSformElement_tel.php @@ -40,7 +40,7 @@ class LSformElement_tel extends LSformElement_text { var $fieldTemplate = 'LSformElement_uri_field.tpl'; - function getDisplay() { + public function getDisplay() { $this -> fetchVariables['uriLinkTitle'] = $this -> attr_html -> attribute -> ldapObject ->getDisplayName(); return parent :: getDisplay(); } diff --git a/public_html/includes/class/class.LSformElement_text.php b/public_html/includes/class/class.LSformElement_text.php index 87e0a46b..ed922c1b 100644 --- a/public_html/includes/class/class.LSformElement_text.php +++ b/public_html/includes/class/class.LSformElement_text.php @@ -44,7 +44,7 @@ class LSformElement_text extends LSformElement { * * @retval array */ - function getDisplay(){ + public function getDisplay(){ $return = $this -> getLabelInfos(); // value if (!$this -> isFreeze()) { diff --git a/public_html/includes/class/class.LSformElement_textarea.php b/public_html/includes/class/class.LSformElement_textarea.php index 61f9ca18..27791903 100644 --- a/public_html/includes/class/class.LSformElement_textarea.php +++ b/public_html/includes/class/class.LSformElement_textarea.php @@ -42,7 +42,7 @@ class LSformElement_textarea extends LSformElement { * * @retval array */ - function getDisplay(){ + public function getDisplay(){ $return = $this -> getLabelInfos(); if (!$this -> isFreeze()) { LSsession :: addHelpInfos( diff --git a/public_html/includes/class/class.LSformElement_url.php b/public_html/includes/class/class.LSformElement_url.php index f993e156..58cacf37 100644 --- a/public_html/includes/class/class.LSformElement_url.php +++ b/public_html/includes/class/class.LSformElement_url.php @@ -44,7 +44,7 @@ class LSformElement_url extends LSformElement_text { var $fieldTemplate = 'LSformElement_uri_field.tpl'; - function getDisplay() { + public function getDisplay() { LSsession :: addHelpInfos ( 'LSformElement_url', array( diff --git a/public_html/includes/class/class.LSformElement_valueWithUnit.php b/public_html/includes/class/class.LSformElement_valueWithUnit.php index 44d1557a..83cfa03f 100644 --- a/public_html/includes/class/class.LSformElement_valueWithUnit.php +++ b/public_html/includes/class/class.LSformElement_valueWithUnit.php @@ -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. * Si le parametre units n'est pas defini, cette fonction retournera False **/ - function getUnits() { + public function getUnits() { $units = $this -> getParam('html_options.units'); if (is_array($units)) { if ($this -> getParam('html_options.translate_labels', true)) { @@ -65,7 +65,7 @@ class LSformElement_valueWithUnit extends LSformElement { * * @retbal string Formatted number */ - function formatNumber($number) { + public function formatNumber($number) { if ((int)$number==$number) return $number; return number_format($number, $this -> getParam('html_options.nb_decimals', 2, 'int'), @@ -81,7 +81,7 @@ class LSformElement_valueWithUnit extends LSformElement { * * @retval array */ - function getDisplay(){ + public function getDisplay(){ $return = $this -> getLabelInfos(); $values_and_units=array(); @@ -128,7 +128,7 @@ class LSformElement_valueWithUnit extends LSformElement { * * @retval string Code HTML d'un champ vide. */ - function getEmptyField() { + public function getEmptyField() { return $this -> fetchTemplate( $this -> fieldTemplate, array( @@ -147,7 +147,7 @@ class LSformElement_valueWithUnit extends LSformElement { * * @retval boolean true si la valeur est présente en POST, false sinon */ - function getPostData(&$return) { + public function getPostData(&$return) { if($this -> isFreeze()) { return true; } diff --git a/public_html/includes/class/class.LSformElement_wysiwyg.php b/public_html/includes/class/class.LSformElement_wysiwyg.php index 926dc352..edcb14ac 100644 --- a/public_html/includes/class/class.LSformElement_wysiwyg.php +++ b/public_html/includes/class/class.LSformElement_wysiwyg.php @@ -40,7 +40,7 @@ class LSformElement_wysiwyg extends LSformElement { * * @retval array */ - function getDisplay(){ + public function getDisplay(){ $return = $this -> getLabelInfos(); if (!$this -> isFreeze()) { LSsession :: addJSscript('tinymce.min.js', 'includes/libs/tinymce/js/tinymce'); diff --git a/public_html/includes/class/class.LSformElement_xmpp.php b/public_html/includes/class/class.LSformElement_xmpp.php index cdb820b9..4f4aa85c 100644 --- a/public_html/includes/class/class.LSformElement_xmpp.php +++ b/public_html/includes/class/class.LSformElement_xmpp.php @@ -43,7 +43,7 @@ class LSformElement_xmpp extends LSformElement_text { var $fieldTemplate = 'LSformElement_uri_field.tpl'; - function getDisplay() { + public function getDisplay() { LSsession :: addHelpInfos ( 'LSformElement_xmpp', array( diff --git a/public_html/includes/class/class.LSformRule.php b/public_html/includes/class/class.LSformRule.php index 1d635776..aa5a4257 100644 --- a/public_html/includes/class/class.LSformRule.php +++ b/public_html/includes/class/class.LSformRule.php @@ -27,15 +27,6 @@ */ class LSformRule { - /** - * Constructeur - * - * @author Benjamin Renard * - */ - function LSformRule () { - return true; - } - /** * Validation de données * @@ -45,7 +36,7 @@ class LSformRule { * * @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; } diff --git a/public_html/includes/class/class.LSformRule_LSformElement_select_validValue.php b/public_html/includes/class/class.LSformRule_LSformElement_select_validValue.php index e3f389c8..ec1cb119 100644 --- a/public_html/includes/class/class.LSformRule_LSformElement_select_validValue.php +++ b/public_html/includes/class/class.LSformRule_LSformElement_select_validValue.php @@ -36,7 +36,7 @@ class LSformRule_LSformElement_select_validValue extends LSformRule { * * @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); if ($ret===False) return False; return True; diff --git a/public_html/includes/class/class.LSformRule_alphanumeric.php b/public_html/includes/class/class.LSformRule_alphanumeric.php index e61c67d6..72a8147a 100644 --- a/public_html/includes/class/class.LSformRule_alphanumeric.php +++ b/public_html/includes/class/class.LSformRule_alphanumeric.php @@ -37,7 +37,7 @@ class LSformRule_alphanumeric extends LSformRule { * * @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){ diff --git a/public_html/includes/class/class.LSformRule_callable.php b/public_html/includes/class/class.LSformRule_callable.php index 20e7db15..041bde0b 100644 --- a/public_html/includes/class/class.LSformRule_callable.php +++ b/public_html/includes/class/class.LSformRule_callable.php @@ -41,7 +41,7 @@ class LSformRule_callable extends LSformRule { * * @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'])) { return call_user_func_array($options['params']['callable'],array($value,$options['params'],&$formElement)); } diff --git a/public_html/includes/class/class.LSformRule_compare.php b/public_html/includes/class/class.LSformRule_compare.php index 46a9c225..2d442669 100644 --- a/public_html/includes/class/class.LSformRule_compare.php +++ b/public_html/includes/class/class.LSformRule_compare.php @@ -35,7 +35,7 @@ class LSformRule_compare extends LSformRule { * * @return string Operateur à utiliser */ - function _findOperator($operator_name) { + private static function _findOperator($operator_name) { $_operators = array( 'eq' => '==', @@ -67,12 +67,12 @@ class LSformRule_compare extends LSformRule { * * @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'])) { LSerror :: addErrorCode('LSformRule_01',array('type' => 'compare', 'param' => 'operator'); return; } - $operator = LSformRule_compare :: _findOperator($options['params']['operator']); + $operator = self :: _findOperator($options['params']['operator']); if ('==' != $operator && '!=' != $operator) { $compareFn = create_function('$a, $b', 'return floatval($a) ' . $operator . ' floatval($b);'); } diff --git a/public_html/includes/class/class.LSformRule_date.php b/public_html/includes/class/class.LSformRule_date.php index 1a1ca615..8c1693ca 100644 --- a/public_html/includes/class/class.LSformRule_date.php +++ b/public_html/includes/class/class.LSformRule_date.php @@ -37,7 +37,7 @@ class LSformRule_date extends LSformRule { * * @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'])) { LSerror :: addErrorCode('LSformRule_date_01'); return; diff --git a/public_html/includes/class/class.LSformRule_email.php b/public_html/includes/class/class.LSformRule_email.php index 6b727448..9ca53311 100644 --- a/public_html/includes/class/class.LSformRule_email.php +++ b/public_html/includes/class/class.LSformRule_email.php @@ -37,7 +37,7 @@ class LSformRule_email extends LSformRule { * * @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']); } diff --git a/public_html/includes/class/class.LSformRule_filesize.php b/public_html/includes/class/class.LSformRule_filesize.php index dffd1b0f..8b91a5b7 100644 --- a/public_html/includes/class/class.LSformRule_filesize.php +++ b/public_html/includes/class/class.LSformRule_filesize.php @@ -38,7 +38,7 @@ class LSformRule_filesize extends LSformRule { * * @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); $size = filesize($file); diff --git a/public_html/includes/class/class.LSformRule_imagefile.php b/public_html/includes/class/class.LSformRule_imagefile.php index 58120861..7f8b6bba 100644 --- a/public_html/includes/class/class.LSformRule_imagefile.php +++ b/public_html/includes/class/class.LSformRule_imagefile.php @@ -40,7 +40,7 @@ class LSformRule_imagefile extends LSformRule { * * @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); $mimetype = mime_content_type($file); diff --git a/public_html/includes/class/class.LSformRule_imagesize.php b/public_html/includes/class/class.LSformRule_imagesize.php index 166a3cb4..9d367fea 100644 --- a/public_html/includes/class/class.LSformRule_imagesize.php +++ b/public_html/includes/class/class.LSformRule_imagesize.php @@ -40,7 +40,7 @@ class LSformRule_imagesize extends LSformRule { * * @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); list($width, $height, $type, $attr) = getimagesize($file); diff --git a/public_html/includes/class/class.LSformRule_inarray.php b/public_html/includes/class/class.LSformRule_inarray.php index 4eff4cb7..53928ea3 100644 --- a/public_html/includes/class/class.LSformRule_inarray.php +++ b/public_html/includes/class/class.LSformRule_inarray.php @@ -37,7 +37,7 @@ class LSformRule_inarray extends LSformRule { * * @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'])) { LSerror :: addErrorCode('LSformRule_inarray_01'); return; diff --git a/public_html/includes/class/class.LSformRule_integer.php b/public_html/includes/class/class.LSformRule_integer.php index 167f468a..94c48735 100644 --- a/public_html/includes/class/class.LSformRule_integer.php +++ b/public_html/includes/class/class.LSformRule_integer.php @@ -40,7 +40,7 @@ class LSformRule_integer extends LSformRule{ * * @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']) { return; } diff --git a/public_html/includes/class/class.LSformRule_lettersonly.php b/public_html/includes/class/class.LSformRule_lettersonly.php index e27145a2..544a0625 100644 --- a/public_html/includes/class/class.LSformRule_lettersonly.php +++ b/public_html/includes/class/class.LSformRule_lettersonly.php @@ -36,7 +36,7 @@ class LSformRule_lettersonly extends LSformRule { * * @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]+$/'; LSsession :: loadLSclass('LSformRule_regex'); return LSformRule_regex :: validate($value,$regex,$formElement); diff --git a/public_html/includes/class/class.LSformRule_maxlength.php b/public_html/includes/class/class.LSformRule_maxlength.php index 574bb6ee..ff18d026 100644 --- a/public_html/includes/class/class.LSformRule_maxlength.php +++ b/public_html/includes/class/class.LSformRule_maxlength.php @@ -37,7 +37,7 @@ class LSformRule_maxlength extends LSformRule { * * @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'])) { LSerror :: addErrorCode('LSformRule_01',array('type' => 'maxlength', 'param' => 'limit')); return; diff --git a/public_html/includes/class/class.LSformRule_mimetype.php b/public_html/includes/class/class.LSformRule_mimetype.php index 10b8183c..70c7b57e 100644 --- a/public_html/includes/class/class.LSformRule_mimetype.php +++ b/public_html/includes/class/class.LSformRule_mimetype.php @@ -38,7 +38,7 @@ class LSformRule_mimetype extends LSformRule { * * @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); $mimetype = mime_content_type($file); diff --git a/public_html/includes/class/class.LSformRule_minlength.php b/public_html/includes/class/class.LSformRule_minlength.php index e6b999c5..7da02f2c 100644 --- a/public_html/includes/class/class.LSformRule_minlength.php +++ b/public_html/includes/class/class.LSformRule_minlength.php @@ -37,7 +37,7 @@ class LSformRule_minlength extends LSformRule { * * @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'])) { LSerror :: addErrorCode('LSformRule_01',array('type' => 'minlength', 'param' => 'limit')); return; diff --git a/public_html/includes/class/class.LSformRule_nonzero.php b/public_html/includes/class/class.LSformRule_nonzero.php index 09ac40b9..c6f63c33 100644 --- a/public_html/includes/class/class.LSformRule_nonzero.php +++ b/public_html/includes/class/class.LSformRule_nonzero.php @@ -36,7 +36,7 @@ class LSformRule_nonzero extends LSformRule { * * @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]*/'; LSsession :: loadLSclass('LSformRule_regex'); return LSformRule_regex :: validate($value,$regex,$formElement); diff --git a/public_html/includes/class/class.LSformRule_nopunctuation.php b/public_html/includes/class/class.LSformRule_nopunctuation.php index 885159f3..729ee1a6 100644 --- a/public_html/includes/class/class.LSformRule_nopunctuation.php +++ b/public_html/includes/class/class.LSformRule_nopunctuation.php @@ -36,7 +36,7 @@ class LSformRule_nopunctuation extends LSformRule { * * @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 = '/^[^().\/\*\^\?#!@$%+=,\"\'><~\[\]{}]+$/'; LSsession :: loadLSclass('LSformRule_regex'); return LSformRule_regex :: validate($value,$regex,$formElement); diff --git a/public_html/includes/class/class.LSformRule_numeric.php b/public_html/includes/class/class.LSformRule_numeric.php index 477cc3e5..fe5310da 100644 --- a/public_html/includes/class/class.LSformRule_numeric.php +++ b/public_html/includes/class/class.LSformRule_numeric.php @@ -36,7 +36,7 @@ class LSformRule_numeric extends LSformRule{ * * @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*$)/'; LSsession :: loadLSclass('LSformRule_regex'); return LSformRule_regex :: validate($value,$regex,$formElement); diff --git a/public_html/includes/class/class.LSformRule_password.php b/public_html/includes/class/class.LSformRule_password.php index 4941aca3..44ffaa77 100644 --- a/public_html/includes/class/class.LSformRule_password.php +++ b/public_html/includes/class/class.LSformRule_password.php @@ -43,7 +43,7 @@ class LSformRule_password extends LSformRule { * * @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 (strlen($value)>$options['params']['maxLength']) return; diff --git a/public_html/includes/class/class.LSformRule_rangelength.php b/public_html/includes/class/class.LSformRule_rangelength.php index 605ac6d9..6af03383 100644 --- a/public_html/includes/class/class.LSformRule_rangelength.php +++ b/public_html/includes/class/class.LSformRule_rangelength.php @@ -38,7 +38,7 @@ class LSformRule_rangelength extends LSformRule { * * @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'])) { LSerror :: addErrorCode('LSformRule_01',array('type' => 'rangelength', 'param' => 'limits')); return; diff --git a/public_html/includes/class/class.LSformRule_regex.php b/public_html/includes/class/class.LSformRule_regex.php index 7a7570f4..3f4d54d5 100644 --- a/public_html/includes/class/class.LSformRule_regex.php +++ b/public_html/includes/class/class.LSformRule_regex.php @@ -37,7 +37,7 @@ class LSformRule_regex extends LSformRule { * * @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 (isset($options['params']['regex'])) { $regex=$options['params']['regex']; diff --git a/public_html/includes/class/class.LSformRule_required.php b/public_html/includes/class/class.LSformRule_required.php index 851bec7d..4a48d92d 100644 --- a/public_html/includes/class/class.LSformRule_required.php +++ b/public_html/includes/class/class.LSformRule_required.php @@ -36,7 +36,7 @@ class LSformRule_required extends LSformRule { * * @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 != ''); } diff --git a/public_html/includes/class/class.LSformRule_ssh_pub_key.php b/public_html/includes/class/class.LSformRule_ssh_pub_key.php index 1ba41aa5..ca0bdeb7 100644 --- a/public_html/includes/class/class.LSformRule_ssh_pub_key.php +++ b/public_html/includes/class/class.LSformRule_ssh_pub_key.php @@ -36,7 +36,7 @@ class LSformRule_ssh_pub_key extends LSformRule { * * @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)) { $data=@base64_decode($m[2]); if (is_string($data)) diff --git a/public_html/includes/class/class.LSformRule_telephonenumber.php b/public_html/includes/class/class.LSformRule_telephonenumber.php index dc477936..8fe433f8 100644 --- a/public_html/includes/class/class.LSformRule_telephonenumber.php +++ b/public_html/includes/class/class.LSformRule_telephonenumber.php @@ -36,7 +36,7 @@ class LSformRule_telephonenumber extends LSformRule { * * @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}$/'; LSsession :: loadLSclass('LSformRule_regex'); return LSformRule_regex :: validate($value,$regex,$formElement); diff --git a/public_html/includes/class/class.LSimport.php b/public_html/includes/class/class.LSimport.php index a3a823f7..7f47b7cb 100644 --- a/public_html/includes/class/class.LSimport.php +++ b/public_html/includes/class/class.LSimport.php @@ -36,7 +36,7 @@ class LSimport { * * @retval boolean true if the form was posted, false otherwise */ - function isSubmit() { + public static function isSubmit() { if (isset($_POST['validate']) && ($_POST['validate']=='LSimport')) return true; return; @@ -48,7 +48,7 @@ class LSimport { * * @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'])) { $fp = fopen($_FILES['importfile']['tmp_name'], "r"); $buf = fread($fp, filesize($_FILES['importfile']['tmp_name'])); @@ -80,7 +80,7 @@ class LSimport { * * @retval mixed Array of POST data, false on error */ - function getPostData() { + public static function getPostData() { if (isset($_REQUEST['LSobject']) && isset($_POST['ioFormat'])) { $file=self::getPostFile(); if ($file) { @@ -140,7 +140,7 @@ class LSimport { * * @retval boolean Array of the import result, false on error */ - function importFromPostData() { + public static function importFromPostData() { // Get data from $_POST $data=self::getPostData(); if (is_array($data)) { diff --git a/public_html/includes/class/class.LSioFormat.php b/public_html/includes/class/class.LSioFormat.php index 6dbf9f7b..b7214c36 100644 --- a/public_html/includes/class/class.LSioFormat.php +++ b/public_html/includes/class/class.LSioFormat.php @@ -38,7 +38,7 @@ class LSioFormat { * * @retval void **/ - function LSioFormat($LSobject,$ioFormat) { + public function __construct($LSobject, $ioFormat) { $conf=LSconfig::get('LSobjects.'.$LSobject.".ioFormat.".$ioFormat); if(is_array($conf)) { $this -> config=$conf; @@ -59,7 +59,7 @@ class LSioFormat { * * @retval boolean True if ioFormat driver is ready, false otherwise **/ - function ready() { + public function ready() { 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 **/ - function loadFile($file) { + public function loadFile($file) { if ($this -> driver -> loadFile($file)) { return $this -> driver -> isValid(); } @@ -82,7 +82,7 @@ class LSioFormat { * * @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']); } diff --git a/public_html/includes/class/class.LSioFormatDriver.php b/public_html/includes/class/class.LSioFormatDriver.php index 029c7608..4247144a 100644 --- a/public_html/includes/class/class.LSioFormatDriver.php +++ b/public_html/includes/class/class.LSioFormatDriver.php @@ -36,7 +36,7 @@ class LSioFormatDriver { * * @retval void **/ - function __construct($options) { + public function __construct($options) { $this -> options = $options; } @@ -47,7 +47,7 @@ class LSioFormatDriver { * * @retval boolean True if file is loaded, false otherwise **/ - function loadFile($path) { + public function loadFile($path) { return False; } @@ -56,7 +56,7 @@ class LSioFormatDriver { * * @retval boolean True if loaded file data are valid, false otherwise **/ - function isValid() { + public function isValid() { return False; } @@ -80,7 +80,7 @@ class LSioFormatDriver { * * @retval array The objects contained by the loaded file **/ - function getAll() { + public function getAll() { return array(); } @@ -97,7 +97,7 @@ class LSioFormatDriver { * * @retval array The fields names of the loaded file **/ - function getFieldNames() { + public function getFieldNames() { return array(); } @@ -112,7 +112,7 @@ class LSioFormatDriver { * * @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($generated_fields)) $generated_fields=array(); $all=$this -> getAll(); diff --git a/public_html/includes/class/class.LSldap.php b/public_html/includes/class/class.LSldap.php index 3f899f39..435bd826 100644 --- a/public_html/includes/class/class.LSldap.php +++ b/public_html/includes/class/class.LSldap.php @@ -43,7 +43,7 @@ class LSldap { * * @retval void */ - function setConfig ($config) { + public static function setConfig ($config) { self :: $config = $config; } diff --git a/public_html/includes/class/class.LSldapObject.php b/public_html/includes/class/class.LSldapObject.php index f826ea80..7020c1c9 100644 --- a/public_html/includes/class/class.LSldapObject.php +++ b/public_html/includes/class/class.LSldapObject.php @@ -57,7 +57,7 @@ class LSldapObject { * * @retval boolean true si l'objet a été construit, false sinon. */ - function LSldapObject() { + public function __construct() { $this -> type_name = get_class($this); $config = LSconfig :: get('LSobjects.'.$this -> type_name); if(is_array($config)) { @@ -89,7 +89,7 @@ class LSldapObject { * * @retval boolean true si la chargement a réussi, false sinon. */ - function loadData($dn) { + public function loadData($dn) { $this -> dn = $dn; $data = LSldap :: getAttrs($dn); if(!empty($data)) { @@ -110,7 +110,7 @@ class LSldapObject { * * @retval boolean true si la rechargement a réussi, false sinon. */ - function reloadData() { + public function reloadData() { $data = LSldap :: getAttrs($this -> dn); foreach($this -> attrs as $attr_name => $attr) { 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. */ - function getDisplayNameFormat() { + public function getDisplayNameFormat() { return $this -> getConfig('display_name_format'); } @@ -144,7 +144,7 @@ class LSldapObject { * * @retval string Valeur descriptive d'affichage de l'objet */ - function getDisplayName($spe='',$full=false) { + public function getDisplayName($spe='',$full=false) { if ($spe=='') { $spe = $this -> getDisplayNameFormat(); } @@ -167,7 +167,7 @@ class LSldapObject { * * @retval string Valeur d'une chaine formatée */ - function getFData($format) { + public function getFData($format) { $format=getFData($format,$this,'getValue'); return $format; } @@ -184,7 +184,7 @@ class LSldapObject { * * @retval string Valeur d'une chaine formatee */ - function getDisplayFData($format) { + public function getDisplayFData($format) { return getFData($format,$this,'getDisplayValue'); } @@ -201,7 +201,7 @@ class LSldapObject { * * @retval LSform Le formulaire crée */ - function getForm($idForm,$load=NULL) { + public function getForm($idForm,$load=NULL) { LSsession :: loadLSclass('LSform'); $LSform = new LSform($this,$idForm); $this -> forms[$idForm] = array($LSform,$load); @@ -244,7 +244,7 @@ class LSldapObject { * * @retval LSform Le formulaire crée */ - function getView() { + public function getView() { LSsession :: loadLSclass('LSform'); $this -> view = new LSform($this,'view'); foreach($this -> attrs as $attr_name => $attr) { @@ -265,7 +265,7 @@ class LSldapObject { * * @retval boolean true sile formulaire a été rafraichis, false sinon */ - function refreshForm($idForm) { + public function refreshForm($idForm) { $LSform = $this -> forms[$idForm][0]; foreach($this -> attrs as $attr_name => $attr) { 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 */ - function validateAttrsData($idForm=null) { + public function validateAttrsData($idForm=null) { $retval = true; if ($idForm) { $LSform=$this -> forms[$idForm][0]; @@ -448,7 +448,7 @@ class LSldapObject { * * @retval boolean true si les données sont valides, false sinon */ - function validateAttrData(&$LSform,&$attr) { + public function validateAttrData(&$LSform,&$attr) { $retval = true; $vconfig=$attr -> getValidateConfig(); @@ -584,7 +584,7 @@ class LSldapObject { * * @retval boolean true si la mise à jour a réussi, false sinon */ - function submitChange($idForm) { + public function submitChange($idForm) { $submitData=array(); $new = $this -> isNew(); foreach($this -> attrs as $attr) { @@ -678,7 +678,7 @@ class LSldapObject { * - [0] : le premier paramètre * - [1] : les paramètres suivants */ - function getDnInfos($dn) { + public static function getDnInfos($dn) { $infos=ldap_explode_dn($dn,0); if(!$infos) return; @@ -700,9 +700,9 @@ class LSldapObject { * * @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)) { - $type = $this -> type_name; + $type = $this -> type_name; } $oc=LSconfig::get("LSobjects.$type.objectclass"); if(!is_array($oc)) return; @@ -733,7 +733,7 @@ class LSldapObject { * * @retval string le filtre ldap correspondant */ - function getPatternFilter($pattern=null,$approx=null) { + public function getPatternFilter($pattern=null,$approx=null) { if ($pattern) { $search = new LSsearch($this -> type_name, 'LSldapObject', array('approx' => (bool)$approx)); $filter = $search -> getFilterFromPattern($pattern); @@ -758,7 +758,7 @@ class LSldapObject { * * @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')) { LSerror::addErrorCode('LSsession_05','LSsearch'); return; @@ -794,7 +794,7 @@ class LSldapObject { * * @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')) { LSerror::addErrorCode('LSsession_05','LSsearch'); return; @@ -836,7 +836,7 @@ class LSldapObject { * * @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) { $filter = '('.$this -> getConfig('rdn').'='.$name.')'; } @@ -863,7 +863,7 @@ class LSldapObject { * * @retval mixed la valeur demandé ou ' ' si celle-ci est inconnue. */ - function getValue($val) { + public function getValue($val) { if(($val=='dn')||($val=='%{dn}')) { return $this -> dn; } @@ -899,7 +899,7 @@ class LSldapObject { * * @retval mixed la valeur demandee ou ' ' si celle-ci est inconnue. */ - function getDisplayValue($val) { + public function getDisplayValue($val) { if(isset($this -> attrs[$val])){ if (method_exists($this -> attrs[$val],'getDisplayValue')) return $this -> attrs[$val] -> getDisplayValue(); @@ -919,7 +919,7 @@ class LSldapObject { * * @retval void **/ - function registerOtherValue($name,$value) { + public function registerOtherValue($name,$value) { $this -> other_values[$name]=$value; } @@ -930,7 +930,7 @@ class LSldapObject { * * @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; return $this -> listObjectsName($filter,$topDn,$sparams,$displayFormat,$cache); } @@ -945,7 +945,7 @@ class LSldapObject { * * @retval string Le DN de l'objet */ - function getDn() { + public function getDn() { if($this -> dn) { return $this -> dn; } @@ -981,7 +981,7 @@ class LSldapObject { * * @retval string Le container DN de l'objet */ - function getContainerDn() { + public function getContainerDn() { $topDn = LSsession :: getTopDn(); $generate_container_dn = $this -> getConfig('generate_container_dn'); $container_dn = $this -> getConfig('container_dn'); @@ -1016,7 +1016,7 @@ class LSldapObject { * * @retval string Le type de l'objet ($this -> type_name) */ - function getType() { + public function getType() { 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 */ - function whoami() { + public function whoami() { if (!$this -> _whoami) $this -> _whoami = LSsession :: whoami($this -> dn); return $this -> _whoami; @@ -1040,7 +1040,7 @@ class LSldapObject { * * @retval string Le label de l'objet ($this -> config['label']) */ - function getLabel($type=null) { + public function getLabel($type=null) { if (is_null($type)) { $type = $this -> type_name; } @@ -1055,7 +1055,7 @@ class LSldapObject { * * @retval boolean True si l'objet à été supprimé, false sinon */ - function remove() { + public function remove() { if ($this -> fireEvent('before_delete')) { if (LSldap :: remove($this -> getDn())) { if ($this -> fireEvent('after_delete')) { @@ -1077,7 +1077,7 @@ class LSldapObject { * * @retval boolean True si l'objet est nouveau, false sinon */ - function isNew() { + public function isNew() { return (!$this -> dn); } @@ -1118,7 +1118,7 @@ class LSldapObject { * * @retval True en cas de cas ce succès, False sinon. */ - function updateLSrelationsCache() { + private function updateLSrelationsCache() { $this -> _LSrelationsCache=array(); $LSrelations = $this -> getConfig('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. */ - function beforeRename() { + private function beforeRename() { // LSrelations return $this -> updateLSrelationsCache(); } @@ -1166,7 +1166,7 @@ class LSldapObject { * * @retval True en cas de cas ce succès, False sinon. */ - function afterRename() { + private function afterRename() { $error = 0; // Change LSsession -> userObject Dn @@ -1197,7 +1197,7 @@ class LSldapObject { * * @retval True en cas de cas ce succès, False sinon. */ - function beforeDelete() { + private function beforeDelete() { $return = $this -> updateLSrelationsCache(); 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. */ - function afterDelete() { + private function afterDelete() { $error = 0; // LSrelations @@ -1258,7 +1258,7 @@ class LSldapObject { * * @retval True en cas de cas ce succès, False sinon. */ - function afterCreate() { + private function afterCreate() { LSdebug('after'); $error = 0; @@ -1306,7 +1306,7 @@ class LSldapObject { * * @retval True en cas de cas ce succès, False sinon. */ - function afterModify() { + private function afterModify() { $error = 0; // LSsearch : Purge LSobject cache @@ -1328,7 +1328,7 @@ class LSldapObject { * * @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) { LSerror :: addErrorCode('LSrelations_05','getObjectKeyValueInRelation'); return; @@ -1370,7 +1370,7 @@ class LSldapObject { * * @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)) { LSerror :: addErrorCode('LSrelations_05','listObjectsInRelation'); return; @@ -1403,7 +1403,7 @@ class LSldapObject { * * @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)) { LSerror :: addErrorCode('LSrelations_05','addOneObjectInRelation'); return; @@ -1468,7 +1468,7 @@ class LSldapObject { * * @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)) { LSerror :: addErrorCode('LSrelations_05','deleteOneObjectInRelation'); return; @@ -1519,7 +1519,7 @@ class LSldapObject { * * @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)) { LSerror :: addErrorCode('LSrelations_05','renameOneObjectInRelation'); return; @@ -1575,7 +1575,7 @@ class LSldapObject { * * @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)) { LSerror :: addErrorCode('LSrelations_05','updateObjectsInRelation'); return; @@ -1623,7 +1623,7 @@ class LSldapObject { * * @retval void */ - function addEvent($event,$fct,$param=NULL,$class=NULL) { + public function addEvent($event,$fct,$param=NULL,$class=NULL) { $this -> _events[$event][] = array( 'function' => $fct, 'param' => $param, @@ -1641,7 +1641,7 @@ class LSldapObject { * * @retval void */ - function addObjectEvent($event,&$obj,$meth,$param=NULL) { + public function addObjectEvent($event,&$obj,$meth,$param=NULL) { $this -> _objectEvents[$event][] = array( 'obj' => &$obj, 'meth' => $meth, @@ -1656,7 +1656,7 @@ class LSldapObject { * * @retval boolean True si tout c'est bien passé, false sinon */ - function fireEvent($event) { + public function fireEvent($event) { // Object event $return = $this -> fireObjectEvent($event); @@ -1752,7 +1752,7 @@ class LSldapObject { * * @retval boolean True si tout c'est bien passé, false sinon **/ - function fireObjectEvent($event) { + public function fireObjectEvent($event) { switch($event) { case 'after_create': return $this -> afterCreate(); @@ -1785,7 +1785,7 @@ class LSldapObject { * * @retval mixed The value **/ - function __get($key) { + public function __get($key) { if ($key=='subDnValue') { if (isset($this -> cache['subDnValue'])) { return $this -> cache['subDnValue']; @@ -1814,7 +1814,7 @@ class LSldapObject { * * @retval mixed Array of valid IOformats of this object type **/ - function listValidIOformats() { + public function listValidIOformats() { $ret=array(); $ioFormats = $this -> getConfig('ioFormat'); if (is_array($ioFormats)) { @@ -1832,7 +1832,7 @@ class LSldapObject { * * @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")); } diff --git a/public_html/includes/class/class.LSobjects.LSgroup.php b/public_html/includes/class/class.LSobjects.LSgroup.php index 1ef88b52..23302fa6 100644 --- a/public_html/includes/class/class.LSobjects.LSgroup.php +++ b/public_html/includes/class/class.LSobjects.LSgroup.php @@ -39,7 +39,7 @@ class LSgroup extends LSldapObject { * * @retval Mixed La valeur clef d'un membre **/ - function getMemberKeyValue($object) { + public function getMemberKeyValue($object) { 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 **/ - function listUserGroups($userObject) { + public function listUserGroups($userObject) { 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 **/ - function addOneMember($object) { + public function addOneMember($object) { 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 **/ - function deleteOneMember($object) { + public function deleteOneMember($object) { 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 */ - function renameOneMember($object,$oldDn) { + public function renameOneMember($object,$oldDn) { 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 **/ - function updateUserGroups($object,$listDns) { + public function updateUserGroups($object,$listDns) { 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 **/ - function canEditGroupRelation($dn=NULL) { + public function canEditGroupRelation($dn=NULL) { if (!$dn) { $dn=$this -> dn; } diff --git a/public_html/includes/class/class.LSsearch.php b/public_html/includes/class/class.LSsearch.php index 90d4ca9c..c7505cfd 100644 --- a/public_html/includes/class/class.LSsearch.php +++ b/public_html/includes/class/class.LSsearch.php @@ -85,7 +85,7 @@ class LSsearch { * @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)) { return; } @@ -575,7 +575,7 @@ class LSsearch { * * @retval mixed Net_LDAP2_Filter on success or False */ - function getFilterFromPattern($pattern=NULL) { + public function getFilterFromPattern($pattern=NULL) { if ($pattern==NULL) { $pattern=$this -> params['pattern']; } @@ -1152,7 +1152,7 @@ class LSsearch { * * @retval void **/ - function afterUsingResult() { + public function afterUsingResult() { $this -> addResultToCache(); } @@ -1161,7 +1161,7 @@ class LSsearch { * * @retval boolean True only if user have been redirected **/ - function redirectWhenOnlyOneResult() { + public function redirectWhenOnlyOneResult() { if ($this -> total == 1 && $this -> result && self::formIsSubmited()) { 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 **/ - function doSort() { + private function doSort() { if (!$this -> sort) { LSdebug('doSort : sort is disabled'); return true; @@ -1220,7 +1220,7 @@ class LSsearch { * * @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']])) { return $this -> result['sort'][$this -> params['sortBy']][$this -> params['sortDirection']]; } diff --git a/public_html/includes/class/class.LSsearchEntry.php b/public_html/includes/class/class.LSsearchEntry.php index d8b6c6fe..fed80c6a 100644 --- a/public_html/includes/class/class.LSsearchEntry.php +++ b/public_html/includes/class/class.LSsearchEntry.php @@ -60,7 +60,7 @@ class LSsearchEntry { * @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)) { return; } @@ -100,7 +100,7 @@ class LSsearchEntry { * * @retval void **/ - function registerOtherValue($name,$value) { + private function registerOtherValue($name,$value) { $this -> other_values[$name]=$value; } diff --git a/public_html/includes/class/class.LStemplate.php b/public_html/includes/class/class.LStemplate.php index a8ae04e9..7f28cb41 100644 --- a/public_html/includes/class/class.LStemplate.php +++ b/public_html/includes/class/class.LStemplate.php @@ -341,7 +341,7 @@ class LStemplate { * * @retval void */ - function addEvent($event,$callable,$param=NULL) { + public static function addEvent($event,$callable,$param=NULL) { self :: $_events[$event][] = array( 'callable' => $callable, 'param' => $param, @@ -355,7 +355,7 @@ class LStemplate { * * @retval boolean True if all triggered actions succefully runned, false otherwise */ - function fireEvent($event) { + public static function fireEvent($event) { $return = true; // Binding via addEvent