General use of the function call_user_func() instead of deprecated syntax

This commit is contained in:
Benjamin Renard 2017-04-26 10:40:37 +02:00
parent 521f540a0c
commit 992dc08cc9
6 changed files with 27 additions and 27 deletions

View file

@ -44,7 +44,7 @@ if(LSsession :: startLSsession()) {
if (isset($_GET['valid']) || $config['noConfirmation']) { if (isset($_GET['valid']) || $config['noConfirmation']) {
$objectname=$object -> getDisplayName(); $objectname=$object -> getDisplayName();
LStemplate :: assign('pagetitle',$title.' : '.$objectname); LStemplate :: assign('pagetitle',$title.' : '.$objectname);
if ($config['function']($object)) { if (call_user_func($config['function'],$object)) {
if ($config['disableOnSuccessMsg']!=true) { if ($config['disableOnSuccessMsg']!=true) {
if ($config['onSuccessMsgFormat']) { if ($config['onSuccessMsgFormat']) {
LSsession :: addInfo(getFData(__($config['onSuccessMsgFormat']),$objectname)); LSsession :: addInfo(getFData(__($config['onSuccessMsgFormat']),$objectname));

View file

@ -44,7 +44,7 @@ if(LSsession :: startLSsession()) {
} }
if (isset($_GET['valid']) || $config['noConfirmation']) { if (isset($_GET['valid']) || $config['noConfirmation']) {
LStemplate :: assign('pagetitle',$title); LStemplate :: assign('pagetitle',$title);
if ($config['function']($LSsearch)) { if (call_user_func($config['function'],$LSsearch)) {
if ($config['disableOnSuccessMsg']!=true) { if ($config['disableOnSuccessMsg']!=true) {
if ($config['onSuccessMsgFormat']) { if ($config['onSuccessMsgFormat']) {
LSsession :: addInfo(getFData(__($config['onSuccessMsgFormat']),$objectname)); LSsession :: addInfo(getFData(__($config['onSuccessMsgFormat']),$objectname));

View file

@ -190,7 +190,7 @@ class LSattr_ldap_password extends LSattr_ldap {
return $clearPassword; return $clearPassword;
break; break;
case 'function': 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; break;
} }
LSerror :: addErrorCode('LSattr_ldap_password_01',$this -> config['ldap_options']['encode']); LSerror :: addErrorCode('LSattr_ldap_password_01',$this -> config['ldap_options']['encode']);

View file

@ -184,7 +184,7 @@ class LSattribute {
$result=$data; $result=$data;
foreach($this -> config['onDisplay'] as $func) { foreach($this -> config['onDisplay'] as $func) {
if (function_exists($func)) { if (function_exists($func)) {
$result=$func($result); $result=call_user_func($func, $result);
} }
else { else {
LSerror :: addErrorCode('LSattribute_02',array('attr' => $this->name,'func' => $func)); LSerror :: addErrorCode('LSattribute_02',array('attr' => $this->name,'func' => $func));
@ -539,7 +539,7 @@ class LSattribute {
$result=$data; $result=$data;
foreach($this -> config['onSave'] as $func) { foreach($this -> config['onSave'] as $func) {
if (function_exists($func)) { if (function_exists($func)) {
$result=$func($result); $result=call_user_func($func, $result);
} }
else { else {
LSerror :: addErrorCode('LSattribute_05',array('attr' => $this->name,'func' => $func)); LSerror :: addErrorCode('LSattribute_05',array('attr' => $this->name,'func' => $func));
@ -649,7 +649,7 @@ class LSattribute {
} }
foreach($funcs as $func) { foreach($funcs as $func) {
if(function_exists($func)) { if(function_exists($func)) {
if(!$func($this -> ldapObject)) { if(!call_user_func($func, $this -> ldapObject)) {
$return = false; $return = false;
} }
} }
@ -666,7 +666,7 @@ class LSattribute {
$obj = new $e['class'](); $obj = new $e['class']();
if (method_exists($obj,$e['fct'])) { if (method_exists($obj,$e['fct'])) {
try { try {
$obj -> $e['fct']($e['params']); call_user_func(array($obj, $e['fct']), $e['params']);
} }
catch(Exception $er) { catch(Exception $er) {
$return = false; $return = false;
@ -686,7 +686,7 @@ class LSattribute {
else { else {
if (function_exists($e['fct'])) { if (function_exists($e['fct'])) {
try { try {
$e['fct']($e['params']); call_user_func($e['fct'], $e['params']);
} }
catch(Exception $er) { catch(Exception $er) {
LSdebug("Event ".$event." : Erreur durant l'execution de la function ".$e['fct']); LSdebug("Event ".$event." : Erreur durant l'execution de la function ".$e['fct']);
@ -705,7 +705,7 @@ class LSattribute {
foreach ($this -> _objectEvents[$event] as $e) { foreach ($this -> _objectEvents[$event] as $e) {
if (method_exists($e['obj'],$e['meth'])) { if (method_exists($e['obj'],$e['meth'])) {
try { try {
$e['obj'] -> $e['meth']($e['params']); call_user_func(array($e['obj'], $e['meth']),$e['params']);
} }
catch(Exception $er) { catch(Exception $er) {
$return = false; $return = false;

View file

@ -524,7 +524,7 @@ class LSldapObject {
// Validation par fonction externe // Validation par fonction externe
else if(isset($test['function'])) { else if(isset($test['function'])) {
if (function_exists($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); if ($LSform) $LSform -> setElementError($attr,$msg_error);
$retval = false; $retval = false;
} }
@ -1115,10 +1115,10 @@ class LSldapObject {
if (LSsession :: loadLSobject($relation_conf['LSobject'])) { if (LSsession :: loadLSobject($relation_conf['LSobject'])) {
$obj = new $relation_conf['LSobject'](); $obj = new $relation_conf['LSobject']();
if ((method_exists($obj,$relation_conf['list_function']))&&(method_exists($obj,$relation_conf['getkeyvalue_function']))) { 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)) { if (is_array($list)) {
// Key Value // 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( $this -> _LSrelationsCache[$relation_name] = array(
'list' => $list, 'list' => $list,
@ -1181,7 +1181,7 @@ class LSldapObject {
foreach($objInfos['list'] as $obj) { foreach($objInfos['list'] as $obj) {
$meth = $this->config['LSrelation'][$relation_name]['rename_function']; $meth = $this->config['LSrelation'][$relation_name]['rename_function'];
if (method_exists($obj,$meth)) { if (method_exists($obj,$meth)) {
if (!($obj -> $meth($this,$objInfos['keyvalue']))) { if (!(call_user_func(array($obj, $meth), $this, $objInfos['keyvalue']))) {
$error=1; $error=1;
} }
} }
@ -1233,7 +1233,7 @@ class LSldapObject {
foreach($objInfos['list'] as $obj) { foreach($objInfos['list'] as $obj) {
$meth = $this->config['LSrelation'][$relation_name]['remove_function']; $meth = $this->config['LSrelation'][$relation_name]['remove_function'];
if (method_exists($obj,$meth)) { if (method_exists($obj,$meth)) {
if (!($obj -> $meth($this))) { if (!(call_user_func(array($obj, $meth), $this))) {
$error=1; $error=1;
} }
} }
@ -1710,7 +1710,7 @@ class LSldapObject {
} }
foreach($funcs as $func) { foreach($funcs as $func) {
if(function_exists($func)) { if(function_exists($func)) {
if(!$func($this)) { if(!call_user_func($func,$this)) {
$return = false; $return = false;
LSerror :: addErrorCode('LSldapObject_07',array('func' => $func,'event' => $event)); LSerror :: addErrorCode('LSldapObject_07',array('func' => $func,'event' => $event));
} }
@ -1730,7 +1730,7 @@ class LSldapObject {
$obj = new $e['class'](); $obj = new $e['class']();
if (method_exists($obj,$e['fct'])) { if (method_exists($obj,$e['fct'])) {
try { try {
$obj -> $e['fct']($e['param']); call_user_func(array($obj,$e['fct']),$e['param']);
} }
catch(Exception $er) { catch(Exception $er) {
LSerror :: addErrorCode('LSldapObject_10',array('class' => $e['class'],'meth' => $e['fct'],'event' => $event)); LSerror :: addErrorCode('LSldapObject_10',array('class' => $e['class'],'meth' => $e['fct'],'event' => $event));
@ -1750,7 +1750,7 @@ class LSldapObject {
else { else {
if (function_exists($e['fct'])) { if (function_exists($e['fct'])) {
try { try {
$e['fct']($e['param']); call_user_func($e['fct'],$e['param']);
} }
catch(Exception $er) { catch(Exception $er) {
LSerror :: addErrorCode('LSldapObject_27',array('func' => $e['fct'],'event' => $event)); LSerror :: addErrorCode('LSldapObject_27',array('func' => $e['fct'],'event' => $event));
@ -1770,7 +1770,7 @@ class LSldapObject {
foreach ($this -> _objectEvents[$event] as $e) { foreach ($this -> _objectEvents[$event] as $e) {
if (method_exists($e['obj'],$e['meth'])) { if (method_exists($e['obj'],$e['meth'])) {
try { try {
$e['obj'] -> $e['meth']($e['param']); call_user_func(array($e['obj'], $e['meth']),$e['param']);
} }
catch(Exception $er) { catch(Exception $er) {
LSerror :: addErrorCode('LSldapObject_29',array('meth' => $e['meth'],'event' => $event)); LSerror :: addErrorCode('LSldapObject_29',array('meth' => $e['meth'],'event' => $event));

View file

@ -92,7 +92,7 @@ class LSrelation {
if(LSsession :: loadLSobject($relationConf['LSobject'])) { if(LSsession :: loadLSobject($relationConf['LSobject'])) {
if (method_exists($relationConf['LSobject'],$relationConf['list_function'])) { if (method_exists($relationConf['LSobject'],$relationConf['list_function'])) {
$objRel = new $relationConf['LSobject'](); $objRel = new $relationConf['LSobject']();
$list = $objRel -> $relationConf['list_function']($object); $list = call_user_func(array($objRel, $relationConf['list_function']), $object);
if (is_array($list)) { if (is_array($list)) {
foreach($list as $o) { foreach($list as $o) {
$o_infos = array( $o_infos = array(
@ -100,7 +100,7 @@ class LSrelation {
'dn' => $o -> getDn() 'dn' => $o -> getDn()
); );
if (isset($relationConf['canEdit_function'])) { if (isset($relationConf['canEdit_function'])) {
$o_infos['canEdit']= $o -> $relationConf['canEdit_function'](); $o_infos['canEdit']= call_user_func(array($o, $relationConf['canEdit_function']));
} }
else { else {
$o_infos['canEdit']=true; $o_infos['canEdit']=true;
@ -140,7 +140,7 @@ class LSrelation {
if (LSsession :: relationCanEdit($object -> getValue('dn'),$object -> getType(),$conf['relationName'])) { if (LSsession :: relationCanEdit($object -> getValue('dn'),$object -> getType(),$conf['relationName'])) {
if (method_exists($relationConf['LSobject'],$relationConf['list_function'])) { if (method_exists($relationConf['LSobject'],$relationConf['list_function'])) {
$objRel = new $relationConf['LSobject'](); $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(); $_SESSION['LSselect'][$relationConf['LSobject']]=array();
if (is_array($list)) { if (is_array($list)) {
foreach($list as $o) { foreach($list as $o) {
@ -188,14 +188,14 @@ class LSrelation {
if (is_array($_SESSION['LSselect'][$relationConf['LSobject']])) { if (is_array($_SESSION['LSselect'][$relationConf['LSobject']])) {
if (method_exists($relationConf['LSobject'],$relationConf['update_function'])) { if (method_exists($relationConf['LSobject'],$relationConf['update_function'])) {
$objRel = new $relationConf['LSobject'](); $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'])) { 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))) { if (is_array($list)&&(!empty($list))) {
$data['html']=""; $data['html']="";
foreach($list as $o) { foreach($list as $o) {
if (isset($relationConf['canEdit_function'])) { if (isset($relationConf['canEdit_function'])) {
if ($o -> $relationConf['canEdit_function']()) { if (call_user_func(array($o, $relationConf['canEdit_function']))) {
$class=' LSrelation_editable'; $class=' LSrelation_editable';
} }
else { else {
@ -262,18 +262,18 @@ class LSrelation {
if (LSsession :: relationCanEdit($object -> getValue('dn'),$object -> getType(),$conf['relationName'])) { if (LSsession :: relationCanEdit($object -> getValue('dn'),$object -> getType(),$conf['relationName'])) {
if (method_exists($relationConf['LSobject'],$relationConf['list_function'])) { if (method_exists($relationConf['LSobject'],$relationConf['list_function'])) {
$objRel = new $relationConf['LSobject'](); $objRel = new $relationConf['LSobject']();
$list = $objRel -> $relationConf['list_function']($object); $list = call_user_func(array($objRel, $relationConf['list_function']), $object);
if (is_array($list)) { if (is_array($list)) {
$ok=false; $ok=false;
foreach($list as $o) { foreach($list as $o) {
if($o -> getDn() == $_REQUEST['dn']) { if($o -> getDn() == $_REQUEST['dn']) {
if (isset($relationConf['canEdit_function'])) { if (isset($relationConf['canEdit_function'])) {
if (!$o -> $relationConf['canEdit_function']()) { if (!call_user_func(array($o, $relationConf['canEdit_function']))) {
LSerror :: addErrorCode('LSsession_11'); LSerror :: addErrorCode('LSsession_11');
break; break;
} }
} }
if (!$o -> $relationConf['remove_function']($object)) { if (!call_user_func(array($o, $relationConf['remove_function']), $object)) {
LSerror :: addErrorCode('LSrelations_03',$conf['relationName']); LSerror :: addErrorCode('LSrelations_03',$conf['relationName']);
} }
else { else {