From 992dc08cc9b988e9f284770e1747ca248e68a4e4 Mon Sep 17 00:00:00 2001 From: Benjamin Renard Date: Wed, 26 Apr 2017 10:40:37 +0200 Subject: [PATCH] General use of the function call_user_func() instead of deprecated syntax --- public_html/custom_action.php | 2 +- public_html/custom_search_action.php | 2 +- .../class/class.LSattr_ldap_password.php | 2 +- .../includes/class/class.LSattribute.php | 12 ++++++------ .../includes/class/class.LSldapObject.php | 18 +++++++++--------- .../includes/class/class.LSrelation.php | 18 +++++++++--------- 6 files changed, 27 insertions(+), 27 deletions(-) diff --git a/public_html/custom_action.php b/public_html/custom_action.php index 87084c7f..c886bb5f 100644 --- a/public_html/custom_action.php +++ b/public_html/custom_action.php @@ -44,7 +44,7 @@ if(LSsession :: startLSsession()) { if (isset($_GET['valid']) || $config['noConfirmation']) { $objectname=$object -> getDisplayName(); LStemplate :: assign('pagetitle',$title.' : '.$objectname); - if ($config['function']($object)) { + if (call_user_func($config['function'],$object)) { if ($config['disableOnSuccessMsg']!=true) { if ($config['onSuccessMsgFormat']) { LSsession :: addInfo(getFData(__($config['onSuccessMsgFormat']),$objectname)); diff --git a/public_html/custom_search_action.php b/public_html/custom_search_action.php index 41bef9bc..81b1584b 100644 --- a/public_html/custom_search_action.php +++ b/public_html/custom_search_action.php @@ -44,7 +44,7 @@ if(LSsession :: startLSsession()) { } if (isset($_GET['valid']) || $config['noConfirmation']) { LStemplate :: assign('pagetitle',$title); - if ($config['function']($LSsearch)) { + if (call_user_func($config['function'],$LSsearch)) { if ($config['disableOnSuccessMsg']!=true) { if ($config['onSuccessMsgFormat']) { LSsession :: addInfo(getFData(__($config['onSuccessMsgFormat']),$objectname)); diff --git a/public_html/includes/class/class.LSattr_ldap_password.php b/public_html/includes/class/class.LSattr_ldap_password.php index 2eebbf11..9d721186 100644 --- a/public_html/includes/class/class.LSattr_ldap_password.php +++ b/public_html/includes/class/class.LSattr_ldap_password.php @@ -190,7 +190,7 @@ class LSattr_ldap_password extends LSattr_ldap { return $clearPassword; break; case 'function': - return $this -> config['ldap_options']['encode_function']($this -> attribute -> ldapObject, $clearPassword); + return call_user_func($this -> config['ldap_options']['encode_function'], $this -> attribute -> ldapObject, $clearPassword); break; } LSerror :: addErrorCode('LSattr_ldap_password_01',$this -> config['ldap_options']['encode']); diff --git a/public_html/includes/class/class.LSattribute.php b/public_html/includes/class/class.LSattribute.php index add60a06..7ce4dfe7 100644 --- a/public_html/includes/class/class.LSattribute.php +++ b/public_html/includes/class/class.LSattribute.php @@ -184,7 +184,7 @@ class LSattribute { $result=$data; foreach($this -> config['onDisplay'] as $func) { if (function_exists($func)) { - $result=$func($result); + $result=call_user_func($func, $result); } else { LSerror :: addErrorCode('LSattribute_02',array('attr' => $this->name,'func' => $func)); @@ -539,7 +539,7 @@ class LSattribute { $result=$data; foreach($this -> config['onSave'] as $func) { if (function_exists($func)) { - $result=$func($result); + $result=call_user_func($func, $result); } else { LSerror :: addErrorCode('LSattribute_05',array('attr' => $this->name,'func' => $func)); @@ -649,7 +649,7 @@ class LSattribute { } foreach($funcs as $func) { if(function_exists($func)) { - if(!$func($this -> ldapObject)) { + if(!call_user_func($func, $this -> ldapObject)) { $return = false; } } @@ -666,7 +666,7 @@ class LSattribute { $obj = new $e['class'](); if (method_exists($obj,$e['fct'])) { try { - $obj -> $e['fct']($e['params']); + call_user_func(array($obj, $e['fct']), $e['params']); } catch(Exception $er) { $return = false; @@ -686,7 +686,7 @@ class LSattribute { else { if (function_exists($e['fct'])) { try { - $e['fct']($e['params']); + call_user_func($e['fct'], $e['params']); } catch(Exception $er) { LSdebug("Event ".$event." : Erreur durant l'execution de la function ".$e['fct']); @@ -705,7 +705,7 @@ class LSattribute { foreach ($this -> _objectEvents[$event] as $e) { if (method_exists($e['obj'],$e['meth'])) { try { - $e['obj'] -> $e['meth']($e['params']); + call_user_func(array($e['obj'], $e['meth']),$e['params']); } catch(Exception $er) { $return = false; diff --git a/public_html/includes/class/class.LSldapObject.php b/public_html/includes/class/class.LSldapObject.php index cda58f17..951ec33d 100644 --- a/public_html/includes/class/class.LSldapObject.php +++ b/public_html/includes/class/class.LSldapObject.php @@ -524,7 +524,7 @@ class LSldapObject { // Validation par fonction externe else if(isset($test['function'])) { if (function_exists($test['function'])) { - if(!$test['function']($this)) { + if(!call_user_func($test['function'],$this)) { if ($LSform) $LSform -> setElementError($attr,$msg_error); $retval = false; } @@ -1115,10 +1115,10 @@ class LSldapObject { if (LSsession :: loadLSobject($relation_conf['LSobject'])) { $obj = new $relation_conf['LSobject'](); if ((method_exists($obj,$relation_conf['list_function']))&&(method_exists($obj,$relation_conf['getkeyvalue_function']))) { - $list = $obj -> $relation_conf['list_function']($me); + $list = call_user_func(array($obj, $relation_conf['list_function']), $me); if (is_array($list)) { // Key Value - $key = $obj -> $relation_conf['getkeyvalue_function']($me); + $key = call_user_func(array($obj, $relation_conf['getkeyvalue_function']), $me); $this -> _LSrelationsCache[$relation_name] = array( 'list' => $list, @@ -1181,7 +1181,7 @@ class LSldapObject { foreach($objInfos['list'] as $obj) { $meth = $this->config['LSrelation'][$relation_name]['rename_function']; if (method_exists($obj,$meth)) { - if (!($obj -> $meth($this,$objInfos['keyvalue']))) { + if (!(call_user_func(array($obj, $meth), $this, $objInfos['keyvalue']))) { $error=1; } } @@ -1233,7 +1233,7 @@ class LSldapObject { foreach($objInfos['list'] as $obj) { $meth = $this->config['LSrelation'][$relation_name]['remove_function']; if (method_exists($obj,$meth)) { - if (!($obj -> $meth($this))) { + if (!(call_user_func(array($obj, $meth), $this))) { $error=1; } } @@ -1710,7 +1710,7 @@ class LSldapObject { } foreach($funcs as $func) { if(function_exists($func)) { - if(!$func($this)) { + if(!call_user_func($func,$this)) { $return = false; LSerror :: addErrorCode('LSldapObject_07',array('func' => $func,'event' => $event)); } @@ -1730,7 +1730,7 @@ class LSldapObject { $obj = new $e['class'](); if (method_exists($obj,$e['fct'])) { try { - $obj -> $e['fct']($e['param']); + call_user_func(array($obj,$e['fct']),$e['param']); } catch(Exception $er) { LSerror :: addErrorCode('LSldapObject_10',array('class' => $e['class'],'meth' => $e['fct'],'event' => $event)); @@ -1750,7 +1750,7 @@ class LSldapObject { else { if (function_exists($e['fct'])) { try { - $e['fct']($e['param']); + call_user_func($e['fct'],$e['param']); } catch(Exception $er) { LSerror :: addErrorCode('LSldapObject_27',array('func' => $e['fct'],'event' => $event)); @@ -1770,7 +1770,7 @@ class LSldapObject { foreach ($this -> _objectEvents[$event] as $e) { if (method_exists($e['obj'],$e['meth'])) { try { - $e['obj'] -> $e['meth']($e['param']); + call_user_func(array($e['obj'], $e['meth']),$e['param']); } catch(Exception $er) { LSerror :: addErrorCode('LSldapObject_29',array('meth' => $e['meth'],'event' => $event)); diff --git a/public_html/includes/class/class.LSrelation.php b/public_html/includes/class/class.LSrelation.php index 8ea449b7..29979511 100644 --- a/public_html/includes/class/class.LSrelation.php +++ b/public_html/includes/class/class.LSrelation.php @@ -92,7 +92,7 @@ class LSrelation { if(LSsession :: loadLSobject($relationConf['LSobject'])) { if (method_exists($relationConf['LSobject'],$relationConf['list_function'])) { $objRel = new $relationConf['LSobject'](); - $list = $objRel -> $relationConf['list_function']($object); + $list = call_user_func(array($objRel, $relationConf['list_function']), $object); if (is_array($list)) { foreach($list as $o) { $o_infos = array( @@ -100,7 +100,7 @@ class LSrelation { 'dn' => $o -> getDn() ); if (isset($relationConf['canEdit_function'])) { - $o_infos['canEdit']= $o -> $relationConf['canEdit_function'](); + $o_infos['canEdit']= call_user_func(array($o, $relationConf['canEdit_function'])); } else { $o_infos['canEdit']=true; @@ -140,7 +140,7 @@ class LSrelation { if (LSsession :: relationCanEdit($object -> getValue('dn'),$object -> getType(),$conf['relationName'])) { if (method_exists($relationConf['LSobject'],$relationConf['list_function'])) { $objRel = new $relationConf['LSobject'](); - $list = $objRel -> $relationConf['list_function']($object); + $list = call_user_func(array($objRel, $relationConf['list_function']), $object); $_SESSION['LSselect'][$relationConf['LSobject']]=array(); if (is_array($list)) { foreach($list as $o) { @@ -188,14 +188,14 @@ class LSrelation { if (is_array($_SESSION['LSselect'][$relationConf['LSobject']])) { if (method_exists($relationConf['LSobject'],$relationConf['update_function'])) { $objRel = new $relationConf['LSobject'](); - if($objRel -> $relationConf['update_function']($object,$_SESSION['LSselect'][$relationConf['LSobject']])) { + if(call_user_func(array($objRel, $relationConf['update_function']), $object,$_SESSION['LSselect'][$relationConf['LSobject']])) { if (method_exists($relationConf['LSobject'],$relationConf['list_function'])) { - $list = $objRel -> $relationConf['list_function']($object); + $list = call_user_func(array($objRel, $relationConf['list_function']), $object); if (is_array($list)&&(!empty($list))) { $data['html']=""; foreach($list as $o) { if (isset($relationConf['canEdit_function'])) { - if ($o -> $relationConf['canEdit_function']()) { + if (call_user_func(array($o, $relationConf['canEdit_function']))) { $class=' LSrelation_editable'; } else { @@ -262,18 +262,18 @@ class LSrelation { if (LSsession :: relationCanEdit($object -> getValue('dn'),$object -> getType(),$conf['relationName'])) { if (method_exists($relationConf['LSobject'],$relationConf['list_function'])) { $objRel = new $relationConf['LSobject'](); - $list = $objRel -> $relationConf['list_function']($object); + $list = call_user_func(array($objRel, $relationConf['list_function']), $object); if (is_array($list)) { $ok=false; foreach($list as $o) { if($o -> getDn() == $_REQUEST['dn']) { if (isset($relationConf['canEdit_function'])) { - if (!$o -> $relationConf['canEdit_function']()) { + if (!call_user_func(array($o, $relationConf['canEdit_function']))) { LSerror :: addErrorCode('LSsession_11'); break; } } - if (!$o -> $relationConf['remove_function']($object)) { + if (!call_user_func(array($o, $relationConf['remove_function']), $object)) { LSerror :: addErrorCode('LSrelations_03',$conf['relationName']); } else {