From af513b2a9d0607d77b13061651ca060820ec8b72 Mon Sep 17 00:00:00 2001 From: Miles Lott Date: Thu, 1 Mar 2001 16:44:52 +0000 Subject: [PATCH] (re)add CreateObject function --- setup/inc/functions.inc.php | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/setup/inc/functions.inc.php b/setup/inc/functions.inc.php index ae43f8d082..668ba1bccd 100644 --- a/setup/inc/functions.inc.php +++ b/setup/inc/functions.inc.php @@ -21,6 +21,24 @@ } unset($d1);unset($d2);unset($d3); /* ######## End security check ########## */ + function CreateObject($classname, $constructor_param = "") + { + global $phpgw, $phpgw_info, $phpgw_domain; + $classpart = explode (".", $classname); + $appname = $classpart[0]; + $classname = $classpart[1]; + if (!$phpgw_info["flags"]["included_classes"][$classname]){ + $phpgw_info["flags"]["included_classes"][$classname] = True; + include(PHPGW_INCLUDE_ROOT."/".$appname."/inc/class.".$classname.".inc.php"); + } + if ($constructor_param == ""){ + $obj = new $classname; + } else { + $obj = new $classname($constructor_param); + } + return $obj; + } + // This is needed is some parts of setup, until we include the API directly function filesystem_separator() {