Index: sandbox/workflow/branches/609/lib/factory/WorkflowFactory.php
===================================================================
--- sandbox/workflow/branches/609/lib/factory/WorkflowFactory.php	(revision 2233)
+++ sandbox/workflow/branches/609/lib/factory/WorkflowFactory.php	(revision 2249)
@@ -68,4 +68,14 @@
 		$this->registerFileInfo('accounts', 'class.accounts.inc.php', '', EGW_INC_ROOT);
 
+
+		/**
+		 * TODO - This is a veeery big workaround to maintain compatibility with
+		 * processes that uses the old not-static factory. So, we made this wrapper
+		 * (adapter) that just calls the new and cute static factory class in the
+		 * right way. It should be removed as soon as possible.
+		*/
+		$this->registerFileInfo('ProcessWrapperFactory', 'ProcessWrapperFactory.php', 'lib/factory/');
+
+
 		/* ok. no more instances of this class.. */
 		self::$_instantiated = true;
Index: sandbox/workflow/branches/609/lib/factory/ProcessFactory.php
===================================================================
--- sandbox/workflow/branches/609/lib/factory/ProcessFactory.php	(revision 2222)
+++ sandbox/workflow/branches/609/lib/factory/ProcessFactory.php	(revision 2249)
@@ -48,5 +48,13 @@
 
 		/* registering allowed classes */
-		//$this->registerFileInfo('WorkflowObjects', 'class.WorkflowObjects.inc.php', 'inc');
+		$this->registerFileInfo('wf_orgchart', 'class.wf_orgchart.php', 'inc/local/classes');
+		$this->registerFileInfo('wf_ldap', 'class.wf_ldap.php', 'inc/local/classes');
+		$this->registerFileInfo('wf_engine', 'class.wf_engine.php', 'inc/local/classes');
+		$this->registerFileInfo('wf_role', 'class.wf_role.php', 'inc/local/classes');
+		$this->registerFileInfo('wf_instance', 'class.wf_instance.php', 'inc/local/classes');
+		$this->registerFileInfo('wf_location', 'class.wf_location.php', 'inc/local/classes');
+		$this->registerFileInfo('wf_db', 'class.wf_db.php', 'inc/local/classes');
+		$this->registerFileInfo('wf_fpdf', 'class.wf_fpdf.php', 'inc/local/classes');
+		$this->registerFileInfo('wf_paging', 'class.wf_paging.php', 'inc/local/classes');
 
 		/* ok. no more instances of this class.. */
Index: sandbox/workflow/branches/609/lib/factory/Factory.php
===================================================================
--- sandbox/workflow/branches/609/lib/factory/Factory.php	(revision 2233)
+++ sandbox/workflow/branches/609/lib/factory/Factory.php	(revision 2249)
@@ -58,65 +58,88 @@
 
 	/**
-	 * Just forward this call to the correct class.
+	 * Just forward this call.
 	 *
 	 * @access public
-	 * @retun object
+	 * @return object
 	 * @static
 	 */
 	public static function &getInstance() {
 
-		/* oops. we are in the process space. */
-		if (Security::isEnabled()) {
-
-			/* must instatiate it */
-			if (is_null(self::$_securedFactory))
-				self::$_securedFactory = new ProcessFactory();
-
-			$args = func_get_args();
-			return call_user_func_array(array(self::$_securedFactory, "getInstance"), $args);
-
-		}
-		/* regular module space */
-		else {
-
-			/* must instatiate it */
-			if (is_null(self::$_unsecuredFactory))
-				self::$_unsecuredFactory = new WorkflowFactory();
-
-			$args = func_get_args();
-			return call_user_func_array(array(self::$_unsecuredFactory, "getInstance"), $args);
-		}
+		$args = func_get_args();
+		return self::_callMethod(__FUNCTION__, $args);
 	}
 
 
 	/**
-	 * Just forward this call to the correct class.
+	 * Just forward this call.
 	 *
 	 * @access public
-	 * @retun object
+	 * @return object
 	 * @static
 	 */
 	public static function &newInstance() {
 
-		/* oops. we are in the process space. */
-		if (Security::isEnabled()) {
+		$args = func_get_args();
+		return self::_callMethod(__FUNCTION__, $args);
+	}
 
-			/* must instatiate it */
+
+	/**
+	 * Selecting the proper factory to call. This function
+	 * should never be called with a random $methodName. Allowed
+	 * values are 'getInstance' and 'newInstance'.
+	 *
+	 * @access private
+	 * @return object
+	 * @static
+	 */
+	private static function &_callMethod($methodName, $args) {
+
+		/* security off (module space) */
+		if (!Security::isEnabled()) {
+
+			/* it must be instatiated */
+			if (is_null(self::$_unsecuredFactory))
+				self::$_unsecuredFactory = new WorkflowFactory();
+
+			return call_user_func_array(array(self::$_unsecuredFactory, $methodName), $args);
+		}
+		/* oops. we are in the process space (restricted). */
+		else {
+
+			/* it must be instatiated */
 			if (is_null(self::$_securedFactory))
 				self::$_securedFactory = new ProcessFactory();
 
-			$args = func_get_args();
-			return call_user_func_array(array(self::$_securedFactory, "newInstance"), $args);
+			/**
+			 * If the class is not allowed, we must check who is trying
+			 * to instantiate it. If it's a module guy, let's allow him.
+			 * Throw up the exception otherwise.
+			 */
+			try {
+				$obj = call_user_func_array(array(self::$_securedFactory, $methodName), $args);
+			}
 
-		}
-		/* regular module space */
-		else {
+			/**
+			 * We are erroneously catching any exceptions. We should catch only the 'class not allowed'
+			 * types of exceptions. To do so, a custom exception class must be defined.
+		 	 */
+			catch(Exception $e) {
 
-			/* must instatiate it */
-			if (is_null(self::$_unsecuredFactory))
-				self::$_unsecuredFactory = new WorkflowFactory();
+				/**
+				 * Here we are using depth 2 in isSafeDir method, because we are on a private
+				 * method. Thus, we need to know if the "caller's caller's" function is on a
+				 * safe dir, instead of the direct caller's method.
+				 */
+				if (Security::isSafeDir(2))
+					$obj = call_user_func_array(array(self::$_unsecuredFactory, $methodName), $args);
 
-			$args = func_get_args();
-			return call_user_func_array(array(self::$_unsecuredFactory, "newInstance"), $args);
+				/* nasty one. take this... */
+				else
+					throw($e);
+			}
+
+			// finally
+			return $obj;
 		}
 	}
Index: sandbox/workflow/branches/609/lib/factory/ProcessWrapperFactory.php
===================================================================
--- sandbox/workflow/branches/609/lib/factory/ProcessWrapperFactory.php	(revision 2249)
+++ sandbox/workflow/branches/609/lib/factory/ProcessWrapperFactory.php	(revision 2249)
@@ -0,0 +1,39 @@
+<?php
+/**************************************************************************\
+* eGroupWare                                                               *
+* http://www.egroupware.org                                                *
+* --------------------------------------------                             *
+*  This program is free software; you can redistribute it and/or modify it *
+*  under the terms of the GNU General Public License as published by the   *
+*  Free Software Foundation; either version 2 of the License, or (at your  *
+*  option) any later version.                                              *
+\**************************************************************************/
+
+/**
+ * This class is temporary. We just need to use it until all the
+ * processes are updated and using our new static factory. The
+ * only purpose of this class is to forward the calls to our
+ * frontend factory class.
+ *
+ * `<tag>`
+ * `<tag>`
+ * `<tag>`
+ */
+class ProcessWrapperFactory
+{
+
+	public function &getInstance() {
+
+		$args = func_get_args();
+		return call_user_func_array(array(Factory, "getInstance"), $args);
+
+	}
+
+	public function &newInstance() {
+
+		$args = func_get_args();
+		return call_user_func_array(array(Factory, "newInstance"), $args);
+
+	}
+}
+?>
Index: sandbox/workflow/branches/609/lib/security/Security.php
===================================================================
--- sandbox/workflow/branches/609/lib/security/Security.php	(revision 2222)
+++ sandbox/workflow/branches/609/lib/security/Security.php	(revision 2249)
@@ -16,5 +16,5 @@
  * executing process code.
  *
- * @package Factory
+ * @package Security
  * @license http://www.gnu.org/copyleft/gpl.html GPL
  * @author Pedro EugÃªnio Rocha - pedro.eugenio.rocha@gmail.com
@@ -43,5 +43,6 @@
 	 * Returns the current security mode.
 	 * @access public
-	 * @return boolean
+	 * @return boolea
+	 * @static
 	 */
 	public static function isEnabled() {
@@ -58,8 +59,8 @@
 	public static function enable() {
 
-		if (self::_isAllowed())
+		if (self::isSafeDir())
 			self::$_protection = true;
 		else
-			throw new Exception('You are not allowed to change security mode.');
+			throw new Exception('You are not allowed to change the security mode.');
 		return true;
 	}
@@ -73,9 +74,37 @@
 	public static function disable() {
 
-		if (self::_isAllowed())
+		if (self::isSafeDir())
 			self::$_protection = false;
 		else
-			throw new Exception('You are not allowed to change security mode.');
+			throw new Exception('You are not allowed to change the security mode.');
 		return true;
+	}
+
+
+	/**
+	 * Implements the security validation.
+	 * This function tell us if a fileName is on a safe directory.
+	 * For safe dir we mean that no process code exists under it.
+	 * The 'depth' parameter specifies the deepness of the file that
+	 * we are validate. Default value is to validate the imediate
+	 * previous function.
+	 *
+	 * @access public
+	 * @return boolean
+	 * @static
+	 */
+	public static function isSafeDir($depth = 1) {
+
+		/* our backtrace based policy */
+		$backtrace = debug_backtrace();
+		$originFile = $backtrace[$depth]['file'];
+
+		if (empty($originFile))
+			return false;
+
+		/* if $fileName is a file under our server root, then it's safe. */
+		if (substr_compare($originFile, EGW_SERVER_ROOT, 0, strlen(EGW_SERVER_ROOT)) == 0)
+			return true;
+		return false;
 	}
 
@@ -93,13 +122,24 @@
 		$backtrace = debug_backtrace();
 
-		/* TODO - These are not definitive validations */
+
 		/* $backtrace[1] specifies the imediate antecessor function */
-		$basedir = dirname($backtrace[1]['file']);
+		$originFile = basename($backtrace[1]['file']);
 
-		if ($basedir == dirname(__FILE__))
+
+		/**
+		 * TODO - TODO - TODO - TODO
+		 * We all know that compare file names is a awful thing..
+		 * what makes it even worse is the fact that the file name
+		 * could contain double slashes (e.g. //) caused by wrong
+		 * concatenations. So we cannot compare the whole file path.
+		 * Moreover, if the process has a file named $allowedFile,
+		 * our security will eventually fail..
+		 *
+		 * Anyway, we should think in a better way to validate this...
+		 */
+		if (basename($originFile) == basename($allowedFile))
 			return true;
 		return false;
 	}
 }
-
 ?>
Index: sandbox/workflow/branches/609/inc/class.run_activity.inc.php
===================================================================
--- sandbox/workflow/branches/609/inc/class.run_activity.inc.php	(revision 2235)
+++ sandbox/workflow/branches/609/inc/class.run_activity.inc.php	(revision 2249)
@@ -13,5 +13,5 @@
 	require_once(dirname(__FILE__) . SEP . 'class.basecontroller.inc.php' ); /* module controller            */
 	require_once(dirname(__FILE__) . SEP . 'class.basemodel.inc.php'      ); /* module logic                 */
-	require_once(dirname(__FILE__) . SEP . 'class.process_factory.inc.php'); /* module process factory class */
+	//require_once(dirname(__FILE__) . SEP . 'class.process_factory.inc.php'); /* module process factory class */
 	require_once(dirname(__FILE__) . SEP . 'class.utils.security.php'     ); /* sanitizes input data         */
 
@@ -301,5 +301,5 @@
 			$this->process_version	= $this->process->getVersion();
 			$this->activity_name	= $activity->getName();
-			$this->user_name	= Factory::getForeignInstance('phpgwapi', 'phpgw')->accounts->id2name($GLOBALS['user']);
+			$this->user_name   		= $GLOBALS['phpgw']->accounts->id2name($GLOBALS['user']);
 			$this->view_activity	= $this->GUI->gui_get_process_view_activity($this->process_id);
 
@@ -440,5 +440,6 @@
 			$security             =& new SecurityUtils();              //input sanitizer class
 			$env['request']       =& $security->process($_REQUEST);    //sanitizes input data from client
-			$env['factory']       =& new ProcessFactory();             //instantiation controller class
+			//$env['factory']       =& new ProcessFactory();             //instantiation controller class
+			$env['factory']       =& Factory::getInstance('ProcessWrapperFactory');  //instantiation controller class
 			$env['natural']		  =& wf_create_object('wf_natural');   //data access object instance for mainframe
 			/* END WORKFLOW MVC SETTINGS */
@@ -473,4 +474,14 @@
 			/* activate the security policy */
 			Factory::getInstance('WorkflowSecurity')->enableSecurityPolicy();
+
+			/**
+			 * XXX
+			 * here we are going to use our new Security static class.
+			 * From now, the factory frontend (static) will forward
+			 * the messages for the process factory instead of Workflow
+			 * factory.
+			 * XXX
+			*/
+			Security::enable();
 
 			/* include the files */
@@ -701,5 +712,6 @@
 			$security             =& new SecurityUtils();              //input sanitizer class
 			$env['request']       =& $security->process($_REQUEST); //sanitizes input data from client
-			$env['factory']       =& new ProcessFactory();			   //instantiation controller class
+			//$env['factory']       =& new ProcessFactory();			   //instantiation controller class
+			$env['factory']       =& Factory::newInstance('ProcessWrapperFactory');  //instantiation controller class
 			$env['natural']		  =& wf_create_object('wf_natural');   //data access object instance for mainframe
 			/* END WORKFLOW MVC SETTINGS */
@@ -713,4 +725,15 @@
 			/* activate the security policy */
 			Factory::getInstance('WorkflowSecurity')->enableSecurityPolicy();
+
+			/**
+			 * XXX
+			 * here we are going to use our new Security static class.
+			 * From now, the factory frontend (static) will forward
+			 * the messages for the process factory instead of Workflow
+			 * factory. Note that this is the same comment as the previous
+			 * function... boooring.. =}
+			 * XXX
+			*/
+			Security::enable();
 
 			$GLOBALS['workflow_env'] = &$env;
Index: sandbox/workflow/branches/609/inc/local/classes/class.wf_role.php
===================================================================
--- sandbox/workflow/branches/609/inc/local/classes/class.wf_role.php	(revision 1048)
+++ sandbox/workflow/branches/609/inc/local/classes/class.wf_role.php	(revision 2249)
@@ -186,5 +186,5 @@
 			$users = array((int) $users);
 		$roleID = $this->roleManager->get_role_id($this->processID, $roleName);
-		$ldap = &$GLOBALS['workflow']['factory']->getInstance('WorkflowLDAP');
+		$ldap = Factory::getInstance('WorkflowLDAP');
 		foreach ($users as $user)
 		{
@@ -212,5 +212,5 @@
 		$users = $this->roleManager->list_mapped_users($this->processID, false, array('wf_role_name' => $roleName));
 
-		$ldap = &$GLOBALS['workflow']['factory']->getInstance('WorkflowLDAP');
+		$ldap = Factory::getInstance('WorkflowLDAP');
 		$output = array();
 		foreach ($users as $id => $login)
@@ -367,5 +367,5 @@
 
 		/* get the roles */
-		$userGroups = $GLOBALS['workflow']['factory']->getInstance('WorkflowLDAP')->getUserGroups($userID);
+		$userGroups = Factory::getInstance('WorkflowLDAP')->getUserGroups($userID);
 		$query = 'SELECT DISTINCT role.wf_role_id, role.wf_name, role.wf_description FROM egw_wf_roles role, egw_wf_user_roles user_role WHERE (user_role.wf_role_id = role.wf_role_id) AND (role.wf_p_id = ?) AND (role.wf_role_id = ANY (?))';
 		$query .= ' AND (((user_role.wf_user = ?) AND (user_role.wf_account_type = ?))';
Index: sandbox/workflow/branches/609/inc/local/classes/class.JobBase.php
===================================================================
--- sandbox/workflow/branches/609/inc/local/classes/class.JobBase.php	(revision 1437)
+++ sandbox/workflow/branches/609/inc/local/classes/class.JobBase.php	(revision 2249)
@@ -89,9 +89,9 @@
 	{
 		require_once 'common.inc.php';
-		$GLOBALS['workflow']['factory']->getInstance('WorkflowMacro')->prepareEnvironment();
+		Factory::getInstance('WorkflowMacro')->prepareEnvironment();
 		$this->jobID = $jobID;
 		$this->processID = $processID;
 		$this->currentDate = $currentDate;
-		$this->jobManager = &$GLOBALS['workflow']['factory']->getInstance('WorkflowJobManager');
+		$this->jobManager = Factory::getInstance('WorkflowJobManager');
 		$this->testMode = $testMode;
 		$this->maximumExecutionTime = $maximumExecutionTime;
@@ -148,10 +148,8 @@
 	final private function prepareEnvironment()
 	{
-		$GLOBALS['workflow']['factory']->getInstance('WorkflowMacro')->prepareProcessEnvironment($this->processID);
-
-		require_once PHPGW_SERVER_ROOT . '/workflow/inc/class.process_factory.inc.php';
+		Factory::getInstance('WorkflowMacro')->prepareProcessEnvironment($this->processID);
 
 		$this->environment = array();
-		$this->environment['factory']  = &new ProcessFactory();
+		$this->environment['factory']  = &Factory::newInstance('ProcessWrapperFactory');
 	}
 
Index: sandbox/workflow/branches/609/inc/local/classes/class.wf_ldap.php
===================================================================
--- sandbox/workflow/branches/609/inc/local/classes/class.wf_ldap.php	(revision 1067)
+++ sandbox/workflow/branches/609/inc/local/classes/class.wf_ldap.php	(revision 2249)
@@ -41,5 +41,5 @@
 	function wf_ldap()
 	{
-		$tmpLDAP = &$GLOBALS['workflow']['factory']->getInstance('WorkflowLDAP');
+		$tmpLDAP = Factory::getInstance('WorkflowLDAP');
 		$this->user_context  = $tmpLDAP->getUserContext();
 		$this->group_context = $tmpLDAP->getGroupContext();
Index: sandbox/workflow/branches/609/inc/smarty/wf_plugins/function.wf_redir_menu.php
===================================================================
--- sandbox/workflow/branches/609/inc/smarty/wf_plugins/function.wf_redir_menu.php	(revision 2233)
+++ sandbox/workflow/branches/609/inc/smarty/wf_plugins/function.wf_redir_menu.php	(revision 2249)
@@ -54,9 +54,8 @@
 
 	$user_is_admin = Factory::getInstance('workflow_acl')->checkWorkflowAdmin($GLOBALS['phpgw_info']['user']['account_id']);
-	$phpgw =& Factory::getForeignInstance('phpgwapi','phpgw');
-	if ($user_is_admin || ($phpgw->acl->check('admin_workflow',1,'workflow'))) {
+	if ($user_is_admin || ($GLOBALS['phpgw']->acl->check('admin_workflow',1,'workflow'))) {
 		$select_tag .= "<option value=\"ad\">Administração</option>";
 	}
-	if ($user_is_admin ||  ($phpgw->acl->check('monitor_workflow',1,'workflow'))) {
+	if ($user_is_admin ||  ($GLOBALS['phpgw']->acl->check('monitor_workflow',1,'workflow'))) {
 		$select_tag .= "<option value=\"mo\">Monitoramento</option>";
 	}
Index: sandbox/workflow/branches/609/inc/class.process_factory.inc.php
===================================================================
--- sandbox/workflow/branches/609/inc/class.process_factory.inc.php	(revision 2235)
+++ 	(revision )
@@ -1,42 +1,0 @@
-<?php
-/**************************************************************************\
-* eGroupWare                                                               *
-* http://www.egroupware.org                                                *
-* --------------------------------------------                             *
-*  This program is free software; you can redistribute it and/or modify it *
-*  under the terms of the GNU General Public License as published by the   *
-*  Free Software Foundation; either version 2 of the License, or (at your  *
-*  option) any later version.                                              *
-\**************************************************************************/
-
-require_once dirname(__FILE__) . SEP . 'class.factory.inc.php';
-
-/**
- * Implementa o design pattern factory para os processos Workflow
- * @author Sidnei Augusto Drovetto Jr. - drovetto@gmail.com
- * @author Carlos Eduardo Nogueira Gonçalves
- * @version 1.0
- * @package Workflow
- * @license http://www.gnu.org/copyleft/gpl.html GPL
- */
-class ProcessFactory extends Factory
-{
-	/**
-	 * Construtor da classe
-	 * @return object
-	 * @access public
-	 */
-	function ProcessFactory()
-	{
-		parent::Factory();
-
-		/* configuration for the workflow processes */
-		$this->classPath = PHPGW_SERVER_ROOT . SEP . 'workflow' . SEP . 'inc' . SEP . 'local' . SEP . 'classes';
-		$this->preffix = 'class.';
-		$this->suffix = '.php';
-	}
-
-	function &getForeignInstance(){}
-	function &newForeignInstance(){}
-}
-?>
Index: sandbox/workflow/branches/609/inc/class.factory.inc.php
===================================================================
--- sandbox/workflow/branches/609/inc/class.factory.inc.php	(revision 2235)
+++ 	(revision )
@@ -1,198 +1,0 @@
-<?php
-/**************************************************************************\
-* eGroupWare                                                               *
-* http://www.egroupware.org                                                *
-* --------------------------------------------                             *
-*  This program is free software; you can redistribute it and/or modify it *
-*  under the terms of the GNU General Public License as published by the   *
-*  Free Software Foundation; either version 2 of the License, or (at your  *
-*  option) any later version.                                              *
-\**************************************************************************/
-
-/**
- * Implementa o design pattern factory para o módulo Workflow
- * @author Carlos Eduardo Nogueira Gonçalves
- * @author Sidnei Augusto Drovetto Jr. - drovetto@gmail.com
- * @version 1.1
- * @package Workflow
- * @license http://www.gnu.org/copyleft/gpl.html GPL
- */
-class Factory
-{
-	/**
-	 * @var array $_cache Cache dos objetos
-	 * @access private
-	 */
-	private $_cache;
-
-	/**
-	 * @var array $classPath Caminho de busca das classes
-	 * @access protected
-	 */
-	protected $classPath;
-
-	/**
-	 * @var array $preffix Prefixo para o nome das classes
-	 * @access protected
-	 */
-	protected $preffix;
-
-	/**
-	 * @var array $suffix Sufixo para o nome das classes
-	 * @access protected
-	 */
-	protected $suffix;
-
-	/**
-	 * Construtor da classe
-	 * @return object
-	 * @access public
-	 */
-	function Factory()
-	{
-		$this->_cache = array();
-		$this->classPath = dirname(__FILE__);
-		$this->preffix = 'class.';
-		$this->suffix = '.inc.php';
-	}
-
-	/**
-	 * Importa os arquivos da classe
-	 * @param string $input Nome da classe
-	 * @access private
-	 * @return void
-	 */
-	private function _import($input)
-	{
-		$file = $this->classPath . '/' . $this->preffix . $input . $this->suffix;
-		if (@file_exists($file))
-			require_once $file;
-		else
-			trigger_error("O arquivo " . $file . " não existe.", E_USER_ERROR);
-	}
-
-	/**
-	 * Armazena referências aos objetos recém criados
-	 * @param string $key O nome da classe
-	 * @param object &$item A instância da classe
-	 * @return void
-	 * @access private
-	 */
-	private function _setEntry($key, &$item)
-	{
-		$this->_cache[$key] = &$item;
-	}
-
-	/**
-	 * Retorna a referência ao objeto armazenado
-	 * @param string $key Nome da classe
-	 * @return object
-	 * @access private
-	 */
-	private function &_getEntry($key)
-	{
-		return $this->_cache[$key];
-	}
-
-	/**
-	 * Verifica se uma determinada classe possui objeto armazenado no cache da Factory
-	 * @param string $key Nome da classe
-	 * @return boolean
-	 * @access public
-	 */
-	function isEntry($key)
-	{
-		return ($this->_getEntry($key) !== null);
-	}
-
-	/**
-	 * Retorna objetos armazenados ou cria novos objetos utilizando o pattern singleton
-	 * @param string $className Nome da classe
-	 * @return object
-	 * @access public
-	 */
-	function &getInstance()
-	{
-		if (func_num_args() > 0)
-		{
-			$args = func_get_args();
-			if ($this->isEntry($args[0]))
-			{
-				return($this->_getEntry($args[0]));
-			}
-			else
-			{
-				$instance = call_user_func_array(array(&$this, 'newInstance'), $args);
-				$this->_setEntry($args[0], &$instance);
-				return $instance;
-			}
-		}
-	}
-
-	/**
-	 * Cria novos objetos
-	 * @param string $className Nome da classe
-	 * @return object
-	 * @access public
-	 */
-	function &newInstance()
-	{
-		if (func_num_args() > 0)
-		{
-			$args = func_get_args();
-			$className = $args[0];
-			array_splice($args, 0, 1);
-			$this->_import($className);
-
-			$reflectionObj = new ReflectionClass($className);
-			return $reflectionObj->newInstanceArgs($args);
-		}
-	}
-
-	/**
-	 * Retorna objetos armazenados ou cria novos objetos utilizando o pattern singleton (somente para módulos externos)
-	 * @param string $moduleName O nome do módulo
-	 * @param string $className Nome da classe
-	 * @return object
-	 * @access public
-	 */
-	function &getForeignInstance()
-	{
-		if (func_num_args() > 1)
-		{
-			$args = func_get_args();
-
-			$oldClassPath = $this->classPath;
-			$this->classPath .= '/../../' . $args[0] . '/inc';
-
-			array_splice($args, 0, 1);
-			$instance = call_user_func_array(array(&$this, 'getInstance'), $args);
-			$this->classPath = $oldClassPath;
-			return $instance;
-		}
-	}
-
-	/**
-	 * Cria novos objetos (somente para módulos externos)
-	 * @param string $moduleName O nome do módulo
-	 * @param string $className Nome da classe
-	 * @return object
-	 * @access public
-	 */
-	function &newForeignInstance()
-	{
-		if (func_num_args() > 1)
-		{
-			$args = func_get_args();
-
-			$oldClassPath = $this->classPath;
-			$this->classPath .= '/../../' . $args[0] . '/inc';
-
-			array_splice($args, 0, 1);
-			$instance = call_user_func_array(array(&$this, 'newInstance'), $args);
-			$this->classPath = $oldClassPath;
-			return $instance;
-		}
-	}
-}
-?>
