From 944ef20370804d9f33771fd112c6401ba17faaa9 Mon Sep 17 00:00:00 2001 From: Roland Gruber Date: Wed, 27 Jul 2011 18:52:53 +0000 Subject: [PATCH] removed eval() --- lam/templates/3rdParty/pla/lib/Tree.php | 2 +- lam/templates/3rdParty/pla/lib/Visitor.php | 15 +-------------- lam/templates/3rdParty/pla/lib/xmlTemplates.php | 12 ++++++++---- 3 files changed, 10 insertions(+), 19 deletions(-) diff --git a/lam/templates/3rdParty/pla/lib/Tree.php b/lam/templates/3rdParty/pla/lib/Tree.php index 7d2e7e60..a9c53afc 100644 --- a/lam/templates/3rdParty/pla/lib/Tree.php +++ b/lam/templates/3rdParty/pla/lib/Tree.php @@ -51,7 +51,7 @@ abstract class Tree { return null; $treeclass = $_SESSION[APPCONFIG]->getValue('appearance','tree'); - eval('$tree = new '.$treeclass.'($server_id);'); + $tree = new $treeclass($server_id); # If we are not logged in, just return the empty tree. if (is_null($server->getLogin(null))) diff --git a/lam/templates/3rdParty/pla/lib/Visitor.php b/lam/templates/3rdParty/pla/lib/Visitor.php index b9affdbf..5f50e423 100644 --- a/lam/templates/3rdParty/pla/lib/Visitor.php +++ b/lam/templates/3rdParty/pla/lib/Visitor.php @@ -55,20 +55,7 @@ abstract class Visitor { printf('Method Exists: %s::%s (%s)
',get_class($this),$call,$args); if (method_exists($this,$call)) { - $call .= '('; - - for ($i = 0; $i < count($args); $i++) - if ($i == 0) - $call .= sprintf('$args[%s]',$i); - else - $call .= sprintf(',$args[%s]',$i); - - $call .= ');'; - - if (defined('DEBUGTMP') && DEBUGTMP) - printf('Invoking Method: $this->%s
',$call); - - eval('$r = $this->'.$call); + $r = call_user_func_array(array($this, $call), $args); if (isset($r)) return $r; diff --git a/lam/templates/3rdParty/pla/lib/xmlTemplates.php b/lam/templates/3rdParty/pla/lib/xmlTemplates.php index 76dff2c7..9b14557d 100644 --- a/lam/templates/3rdParty/pla/lib/xmlTemplates.php +++ b/lam/templates/3rdParty/pla/lib/xmlTemplates.php @@ -57,7 +57,8 @@ abstract class xmlTemplates { 'type'=>'info','special'=>true)); $changed = true; - eval(sprintf('$this->templates[$index] = new %s($this->server_id,$template->getName(false),$template->getFileName(),$template->getType(),$index);',$class['name'])); + $className = $class['name']; + $this->templates[$index] = new $className($this->server_id,$template->getName(false),$template->getFileName(),$template->getType(),$index); } } @@ -87,7 +88,8 @@ abstract class xmlTemplates { if (! in_array($filename,$this->getTemplateFiles())) { $templatename = preg_replace('/.xml$/','',$file); - eval(sprintf('$this->templates[$index] = new %s($this->server_id,$templatename,$filename,$type,$index);',$class['name'])); + $className = $class['name']; + $this->templates[$index] = new $className($this->server_id,$templatename,$filename,$type,$index); $index++; $changed = true; @@ -129,7 +131,8 @@ abstract class xmlTemplates { # Store the template $templatename = preg_replace('/.xml$/','',$file); - eval(sprintf('$this->templates[$counter] = new %s($this->server_id,$templatename,$filename,$type,$counter);',$class['name'])); + $className = $class['name']; + $this->templates[$counter] = new $className($this->server_id,$templatename,$filename,$type,$counter); $counter++; } } @@ -230,7 +233,8 @@ abstract class xmlTemplates { return clone $template; # If we get here, the template ID didnt exist, so return a blank template, which be interpreted as the default template - eval(sprintf('$object = new %s($this->server_id,null,null,"default");',$class['name'])); + $className = $class['name']; + $object = new $className($this->server_id,null,null,"default"); return $object; }