General use of the function call_user_func() instead of deprecated syntax
authorBenjamin Renard <brenard@easter-eggs.com>
Wed, 26 Apr 2017 08:40:37 +0000 (10:40 +0200)
committerBenjamin Renard <brenard@easter-eggs.com>
Wed, 26 Apr 2017 09:19:58 +0000 (11:19 +0200)
public_html/custom_action.php
public_html/custom_search_action.php
public_html/includes/class/class.LSattr_ldap_password.php
public_html/includes/class/class.LSattribute.php
public_html/includes/class/class.LSldapObject.php
public_html/includes/class/class.LSrelation.php

index 87084c7..c886bb5 100644 (file)
@@ -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));
index 41bef9b..81b1584 100644 (file)
@@ -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));
index 2eebbf1..9d72118 100644 (file)
@@ -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']);
index add60a0..7ce4dfe 100644 (file)
@@ -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;
index cda58f1..951ec33 100644 (file)
@@ -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));
index 8ea449b..2997951 100644 (file)
@@ -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 {