Explicitly defined class methods visibility and upgrade PHP class constructor syntax

This commit is contained in:
Benjamin Renard 2019-03-12 11:42:53 +01:00
parent 13bf3b6507
commit c357c70596
82 changed files with 363 additions and 372 deletions

View file

@ -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();
}

View file

@ -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':

View file

@ -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);

View file

@ -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();

View file

@ -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;
}

View file

@ -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;

View file

@ -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');
}

View file

@ -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<count($matches[0]);$i++) {
@ -78,7 +78,7 @@ class LSattr_ldap_compositeValueToJSON extends LSattr_ldap {
return;
}
function encodeValue($value) {
public static function encodeValue($value) {
if (is_array($value)) {
$ret="";
foreach($value as $key => $val)

View file

@ -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');
}

View file

@ -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;
}

View file

@ -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);
}

View file

@ -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);

View file

@ -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])) {

View file

@ -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'];
}

View file

@ -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;
}

View file

@ -27,7 +27,7 @@
*/
class LSauthMethod_CAS extends LSauthMethod {
function LSauthMethod_CAS() {
public function __construct() {
LSauth :: disableLoginForm();
if (!parent :: LSauthMethod())

View file

@ -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

View file

@ -27,7 +27,7 @@
*/
class LSauthMethod_anonymous extends LSauthMethod {
function LSauthMethod_anonymous() {
public function __construct() {
LSauth :: disableLoginForm();
LSauth :: disableSelfAccess();

View file

@ -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;
}

View file

@ -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);
}

View file

@ -42,7 +42,7 @@ class LSformElement_boolean extends LSformElement {
*
* @retval array
*/
function getDisplay(){
public function getDisplay(){
$return = $this -> getLabelInfos();
if (!$this -> isFreeze()) {
// Help Infos

View file

@ -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];
}

View file

@ -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;
}

View file

@ -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;
}

View file

@ -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;
}

View file

@ -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";
}

View file

@ -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;
}

View file

@ -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);

View file

@ -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);

View file

@ -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)) {

View file

@ -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;

View file

@ -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;
}

View file

@ -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(

View file

@ -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');

View file

@ -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');
}

View file

@ -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)) {

View file

@ -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();

View file

@ -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;
}

View file

@ -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'),

View file

@ -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,
);

View file

@ -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'),

View file

@ -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();
}

View file

@ -44,7 +44,7 @@ class LSformElement_text extends LSformElement {
*
* @retval array
*/
function getDisplay(){
public function getDisplay(){
$return = $this -> getLabelInfos();
// value
if (!$this -> isFreeze()) {

View file

@ -42,7 +42,7 @@ class LSformElement_textarea extends LSformElement {
*
* @retval array
*/
function getDisplay(){
public function getDisplay(){
$return = $this -> getLabelInfos();
if (!$this -> isFreeze()) {
LSsession :: addHelpInfos(

View file

@ -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(

View file

@ -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;
}

View file

@ -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');

View file

@ -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(

View file

@ -27,15 +27,6 @@
*/
class LSformRule {
/**
* Constructeur
*
* @author Benjamin Renard <brenard@easter-eggs.com>*
*/
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;
}

View file

@ -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;

View file

@ -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){

View file

@ -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));
}

View file

@ -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);');
}

View file

@ -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;

View file

@ -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']);
}

View file

@ -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);

View file

@ -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);

View file

@ -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);

View file

@ -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;

View file

@ -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;
}

View file

@ -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);

View file

@ -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;

View file

@ -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);

View file

@ -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;

View file

@ -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);

View file

@ -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);

View file

@ -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);

View file

@ -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;

View file

@ -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;

View file

@ -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'];

View file

@ -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 != '');
}

View file

@ -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))

View file

@ -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);

View file

@ -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)) {

View file

@ -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']);
}

View file

@ -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();

View file

@ -43,7 +43,7 @@ class LSldap {
*
* @retval void
*/
function setConfig ($config) {
public static function setConfig ($config) {
self :: $config = $config;
}

View file

@ -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"));
}

View file

@ -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;
}

View file

@ -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']];
}

View file

@ -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;
}

View file

@ -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