Index: /sandbox/workflow/branches/609/lib/factory/BaseFactory.php
===================================================================
--- /sandbox/workflow/branches/609/lib/factory/BaseFactory.php	(revision 2222)
+++ /sandbox/workflow/branches/609/lib/factory/BaseFactory.php	(revision 2222)
@@ -0,0 +1,169 @@
+<?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.                                              *
+\**************************************************************************/
+
+/**
+ * Base Factory abstract class.
+ * This class implements all the common behaviour of
+ * it's specialized classes (ProcessFactory and WorkflowFactory).
+ *
+ * @package Factory
+ * @license http://www.gnu.org/copyleft/gpl.html GPL
+ * @author Pedro EugÃªnio Rocha - pedro.eugenio.rocha@gmail.com
+ */
+abstract class BaseFactory {
+
+	/**
+	 * @var array $_fileInfo Store what classes we can instantiate.
+	 * @access private
+	 */
+	private $_fileInfo;
+
+
+	/**
+	 * Registers classes into '$_fileInfo' private
+	 * atribute.
+	 *
+	 * @todo Maybe here we should receive more parameters...
+	 * @access protected
+	 * @return void
+	 */
+	protected final function registerFileInfo($className, $fileName, $relativePath, $basePath = WF_SERVER_ROOT) {
+
+		/* default is to override */
+		$this->_fileInfo[$className] = array(	'filename' => $fileName,
+												'path' => $relativePath,
+												'basePath' => $basePath,
+												'instance' => null);
+	}
+
+
+	/**
+	 * Here we should do all the factory stuff.
+	 * The classes instatiated here will be stored
+	 * into our private object cache. If there is no
+	 * object of the given type into the cache, 'newInstance'
+	 * will be called.
+	 *
+	 * @access public
+	 * @return object
+	 */
+	public function &getInstance(){
+
+		/* at least the class name */
+		if (func_num_args() <= 0)
+			return null;
+
+		$args = func_get_args();
+
+		/* recovering class data */
+		if ($entry = $this->_getEntry($args[0])) {
+
+			if (is_null($entry['instance'])) {
+
+				/* must instantiate it */
+                if (($obj = call_user_func_array(array($this, "newInstance"), $args)) == null)
+					throw new Exception("Unable to instantiate '".$args[0]."'");
+
+				/* saving the object reference */
+				$this->_setEntryInstance($args[0], $obj);
+				return $obj;
+			}
+			return $entry['instance'];
+
+		}
+		/* class not allowed */
+		else
+			throw new Exception("You are not allowed to instantiate class '".$args[0]."'.");
+	}
+
+	/**
+	 * Instantiate classes.
+	 *
+	 * @todo I think that we don't need to use the reflection
+	 *		 class here. Future work...
+	 * @access public
+	 * @return object
+	 */
+	public function &newInstance(){
+
+		/* at least the class name */
+		if (func_num_args() <= 0)
+			return null;
+
+		$args = func_get_args();
+
+		$className = array_shift($args);
+		if(!$this->_import($className))
+			return null;
+
+		/* I dont know.. maybe we could do better here.. */
+		$reflectionObj = new ReflectionClass($className);
+
+		if (count($args) == 0)
+			return $reflectionObj->newInstance();
+		return $reflectionObj->newInstanceArgs($args);
+	}
+
+
+	/**
+	 * Private stuff. Handles the cache and information
+	 * '$_fileInfo' array.
+	 *
+	 * @access private
+	 * @return array
+	 */
+	private function _getEntry($className){
+		return $this->_fileInfo[$className];
+	}
+
+
+	/**
+	 * Stores the given object into the internal cache
+	 * for upcoming requests.
+	 *
+	 * @access private
+	 * @return boolean
+	 */
+	private function _setEntryInstance($className, $obj){
+
+		if (is_array($this->_fileInfo[$className])) {
+			$this->_fileInfo[$className]['instance'] = $obj;
+			return true;
+		}
+		return false;
+	}
+
+
+	/**
+	 * Including (requiring_once ;P ) the file(s) itself. Ideally,
+	 * it could be the only place to include files.
+	 *
+	 * @access private
+	 * @return boolean
+	 */
+	private function _import($className){
+
+		/* not found */
+		if (!($entry = $this->_getEntry($className)))
+			throw new Exception('You are not allowed to instantiate '.$className.' class.');
+
+		$fullPath = $entry['basePath'] . SEP . $entry['path'] . SEP . $entry['filename'];
+
+		/* file not found */
+		if (!file_exists($fullPath))
+			throw new Exception("File '".$fullPath."' not found.");
+
+		/* including file */
+		require_once $fullPath;
+		return true;
+	}
+}
+?>
Index: /sandbox/workflow/branches/609/lib/factory/WorkflowFactory.php
===================================================================
--- /sandbox/workflow/branches/609/lib/factory/WorkflowFactory.php	(revision 2222)
+++ /sandbox/workflow/branches/609/lib/factory/WorkflowFactory.php	(revision 2222)
@@ -0,0 +1,59 @@
+<?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.                                              *
+\**************************************************************************/
+
+/**
+ * Specialization of the BaseFactory class.
+ * This class is used to instantiate classes by
+ * the workflow module (not by processes). You
+ * cannot access this class directly, but requests
+ * to the Factory frontend class in 'unsecured mode'
+ * will be forwarded to this class.
+ *
+ * @package Factory
+ * @license http://www.gnu.org/copyleft/gpl.html GPL
+ * @author Pedro EugÃªnio Rocha - pedro.eugenio.rocha@gmail.com
+ */
+final class WorkflowFactory extends BaseFactory {
+
+
+	/**
+	 * @var boolean $_instantiated Attribute that stores whether this
+	 *		class was instantiated or not. This is used to limit the
+	 * 		instantiation of this class.
+	 * @access private
+	 * @static
+	 */
+	private static $_instantiated = false;
+
+
+	/**
+	 * Construct the class. This function will inform which classes
+	 * you will be able to instantiate and where to find it.
+	 * This function implements a kind of singleton design pattern too.
+	 * @access public
+	 */
+	public function __construct() {
+
+		/* don't let the user to instantiate this class more than once. */
+		if (self::$_instantiated)
+			throw new Exception("You can't instantiate this class again.");
+
+		/* registering allowed classes */
+		$this->registerFileInfo('WorkflowObjects', 'class.WorkflowObjects.inc.php', 'inc');
+
+		$this->registerFileInfo('db', 'x', 'inc', PHPGW_API_INC);
+
+		/* 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 2222)
@@ -0,0 +1,57 @@
+<?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.                                              *
+\**************************************************************************/
+
+/**
+ * Specialization of the BaseFactory class.
+ * This class is used to instantiate classes for
+ * processes. You cannot access this class directly,
+ * but requests to the Factory frontend class in
+ * 'secured mode' will be forwarded to this class.
+ * It should be much more restrictive than its
+ * older brother (or sister), WorkflowFactory...
+ *
+ * @package Factory
+ * @license http://www.gnu.org/copyleft/gpl.html GPL
+ * @author Pedro EugÃªnio Rocha - pedro.eugenio.rocha@gmail.com
+ */
+final class ProcessFactory extends BaseFactory {
+
+
+	/**
+	 * @var boolean $_instantiated Attribute that stores whether this
+	 *		class was instantiated or not. This is used to limit the
+	 * 		instantiation of this class.
+	 * @access private
+	 * @static
+	 */
+	private static $_instantiated = false;
+
+	/**
+	 * Construct the class. This function will inform which classes
+	 * you will be able to instantiate and where to find it.
+	 * This function implements a kind of singleton design pattern too.
+	 * @access public
+	 */
+	public function __construct() {
+
+		/* don't let the user to instantiate this class more than once. */
+		if (self::$_instantiated)
+			throw new Exception("You can't instantiate this class again.");
+
+		/* registering allowed classes */
+		//$this->registerFileInfo('WorkflowObjects', 'class.WorkflowObjects.inc.php', 'inc');
+
+		/* ok. no more instances of this class.. */
+		self::$_instantiated = true;
+	}
+}
+
+?>
Index: /sandbox/workflow/branches/609/lib/factory/Factory.php
===================================================================
--- /sandbox/workflow/branches/609/lib/factory/Factory.php	(revision 2222)
+++ /sandbox/workflow/branches/609/lib/factory/Factory.php	(revision 2222)
@@ -0,0 +1,105 @@
+<?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.                                              *
+\**************************************************************************/
+
+/**
+ * The Factory frontend class.
+ * This class controls which concrete Factory
+ * will be used, depending on the current
+ * 'security mode'. It lazy instantiates both
+ * factories (process and module) when they are
+ * required, and stores these objects. All the
+ * accesses to factories are done through this class,
+ * implementing a kind of Proxy design pattern.
+ * This class depends on Security frontend class
+ * to decide which factory to call.
+ *
+ * @package Factory
+ * @license http://www.gnu.org/copyleft/gpl.html GPL
+ * @author Pedro EugÃªnio Rocha - pedro.eugenio.rocha@gmail.com
+ */
+class Factory {
+
+
+	/**
+	 * @var object $_unsecuredFactory Stores WorkflowFactory object.
+	 * @access private
+	 * @static
+	 */
+	private static $_unsecuredFactory = null;
+
+
+	/**
+	 * @var object $_securedFactory Stores ProcessFactory object.
+	 * @access private
+	 * @static
+	 */
+	private static $_securedFactory = null;
+
+
+	/**
+	 * Constructor. Just disable direct instantiation.
+	 *
+	 * @access public
+	 * @return void
+	 * @static
+	 */
+	public function __construct() {
+		throw new Exception("Oops! Static only class.");
+	}
+
+
+	/**
+	 * Just forward this call to the correct class.
+	 *
+	 * @access public
+	 * @retun 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();
+			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();
+			call_user_func_array(array(self::$_unsecuredFactory, "getInstance"), $args);
+		}
+
+	}
+
+
+	/**
+	 * Just forward this call to the correct class.
+	 *
+	 * @todo I must implement it!
+	 * @access public
+	 * @retun object
+	 * @static
+	 */
+	public static function newInstance() {
+	}
+}
+
+?>
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 2222)
@@ -0,0 +1,105 @@
+<?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.                                              *
+\**************************************************************************/
+
+/**
+ * Security class for Workflow module.
+ * You should never forget to call 'enable'
+ * public method to enable security before
+ * executing process code.
+ *
+ * @package Factory
+ * @license http://www.gnu.org/copyleft/gpl.html GPL
+ * @author Pedro EugÃªnio Rocha - pedro.eugenio.rocha@gmail.com
+ */
+class Security {
+
+	/**
+	 * @var boolean $_protection Stores the current security mode.
+	 * @access private
+	 * @static
+	 */
+	private static $_protection = false;
+
+
+	/**
+	 * Disallow the instantiation of this class.
+	 * @access public
+	 * @return void
+	 */
+	public function __construct() {
+		throw new Exception("Oops! Static only class.");
+	}
+
+
+	/**
+	 * Returns the current security mode.
+	 * @access public
+	 * @return boolean
+	 */
+	public static function isEnabled() {
+		return self::$_protection;
+	}
+
+
+	/**
+	 * Change to secured mode.
+	 * @access public
+	 * @return boolean
+	 * @static
+	 */
+	public static function enable() {
+
+		if (self::_isAllowed())
+			self::$_protection = true;
+		else
+			throw new Exception('You are not allowed to change security mode.');
+		return true;
+	}
+
+	/**
+	 * Change to unsecured mode.
+	 * @access public
+	 * @return boolean
+	 * @static
+	 */
+	public static function disable() {
+
+		if (self::_isAllowed())
+			self::$_protection = false;
+		else
+			throw new Exception('You are not allowed to change security mode.');
+		return true;
+	}
+
+
+	/**
+	 * This function do all the security stuff.
+	 * Here we must define in which files we are able
+	 * to change the security mode.
+	 *
+	 * @access private
+	 * @return boolean
+	 * @static
+	 */
+	private static function _isAllowed() {
+		$backtrace = debug_backtrace();
+
+		/* TODO - These are not definitive validations */
+		/* $backtrace[1] specifies the imediate antecessor function */
+		$basedir = dirname($backtrace[1]['file']);
+
+		if ($basedir == dirname(__FILE__))
+			return true;
+		return false;
+	}
+}
+
+?>
Index: ndbox/workflow/branches/609/lib/BaseFactory.php
===================================================================
--- /sandbox/workflow/branches/609/lib/BaseFactory.php	(revision 2206)
+++ 	(revision )
@@ -1,160 +1,0 @@
-<?php
-
-
-/**
- * Base Factory abstract class.
- * This class implements all the common behaviour of
- * it's specialized classes (ProcessFactory and WorkflowFactory).
- *
- * @author Pedro EugÃªnio Rocha
- * @package Factory
- * @abstract
- */
-abstract class BaseFactory {
-
-	/**
-	 * @var array Store what classes we can instantiate.
-	 * @access private
-	 */
-	private $_fileInfo;
-
-
-	/**
-	 * Registers classes into '$_fileInfo' private
-	 * atribute.
-	 *
-	 * @todo Maybe here we should receive more parameters...
-	 * @access protected
-	 * @return void
-	 */
-	protected final function registerFileInfo($className, $fileName, $relativePath) {
-
-		/* default is to override */
-		$this->_fileInfo[$className] = array(	'filename' => $fileName,
-												'path' => $relativePath,
-												'instance' => null);
-	}
-
-
-	/**
-	 * Here we should do all the factory stuff.
-	 * The classes instatiated here will be stored
-	 * into our private object cache. If there is no
-	 * object of the given type into the cache, 'newInstance'
-	 * will be called.
-	 *
-	 * @access public
-	 * @return object
-	 */
-	public function &getInstance(){
-
-		/* at least the class name */
-		if (func_num_args() <= 0)
-			return null;
-
-		$args = func_get_args();
-
-		/* recovering class data */
-		if ($entry = $this->_getEntry($args[0])) {
-
-			if (is_null($entry['instance'])) {
-
-				/* must instantiate it */
-                if (($obj = call_user_func_array(array($this, "newInstance"), $args)) == null)
-					throw new Exception("Unable to instantiate '".$args[0]."'");
-
-				/* saving the object reference */
-				$this->_setEntryInstance($args[0], $obj);
-				return $obj;
-			}
-			return $entry['instance'];
-
-		}
-		/* class not allowed */
-		else
-			throw new Exception("You are not allowed to instantiate class '".$args[0]."'.");
-	}
-
-	/**
-	 * Instantiate classes.
-	 *
-	 * @todo I think that we don't need to use the reflection
-	 *		 class here. Future work...
-	 * @access public
-	 * @return object
-	 */
-	public function &newInstance(){
-
-		/* at least the class name */
-		if (func_num_args() <= 0)
-			return null;
-
-		$args = func_get_args();
-
-		$className = array_shift($args);
-		if(!$this->_import($className))
-			return null;
-
-		/* I dont know.. maybe we could do better here.. */
-		$reflectionObj = new ReflectionClass($className);
-
-		if (count($args) == 0)
-			return $reflectionObj->newInstance();
-		return $reflectionObj->newInstanceArgs($args);
-	}
-
-
-	/**
-	 * Private stuff. Handles the cache and information
-	 * '$_fileInfo' array.
-	 *
-	 * @access private
-	 * @return array
-	 */
-	private function _getEntry($className){
-		return $this->_fileInfo[$className];
-	}
-
-
-	/**
-	 * Stores the given object into the internal cache
-	 * for upcoming requests.
-	 *
-	 * @access private
-	 * @return boolean
-	 */
-	private function _setEntryInstance($className, $obj){
-
-		if (is_array($this->_fileInfo[$className])) {
-			$this->_fileInfo[$className]['instance'] = $obj;
-			return true;
-		}
-		return false;
-	}
-
-
-	/**
-	 * Including (requiring_once ;P ) the file(s) itself. Ideally,
-	 * it could be the only place to include files.
-	 *
-	 * @access private
-	 * @return boolean
-	 */
-	private function _import($className){
-
-		/* not found */
-		if (!($entry = $this->_getEntry($className)))
-			throw new Exception('You are not allowed to instantiate '.$className.' class.');
-
-		$fullPath = WF_SERVER_ROOT . $entry['path'] . SEP . $entry['filename'];
-
-		/* file not found */
-		if (!file_exists($fullPath))
-			throw new Exception("File '".$fullPath."' not found.");
-
-		/* including file */
-		require_once $fullPath;
-		return true;
-	}
-}
-?>
Index: ndbox/workflow/branches/609/lib/WorkflowFactory.php
===================================================================
--- /sandbox/workflow/branches/609/lib/WorkflowFactory.php	(revision 2212)
+++ 	(revision )
@@ -1,47 +1,0 @@
-<?php
-
-/**
- * Specialization of the BaseFactory class.
- * This class is used to instantiate classes by
- * the workflow module (not by processes). You
- * cannot access this class directly, but requests
- * to the Factory frontend class in 'unsecured mode'
- * will be forwarded to this class.
- *
- * @author Pedro EugÃªnio Rocha
- * @package Factory
- */
-final class WorkflowFactory extends BaseFactory {
-
-
-	/**
-	 * @var boolean $_instantiated Attribute that stores whether this
-	 *		class was instantiated or not. This is used to limit the
-	 * 		instantiation of this class.
-	 * @access private
-	 * @static
-	 */
-	private static $_instantiated = false;
-
-
-	/**
-	 * Construct the class. This function will inform which classes
-	 * you will be able to instantiate and where to find it.
-	 * This function implements a kind of singleton design pattern too.
-	 * @access public
-	 */
-	public function __construct() {
-
-		/* don't let the user to instantiate this class more than once. */
-		if (self::$_instantiated)
-			throw new Exception("You can't instantiate this class again.");
-
-		/* registering allowed classes */
-		$this->registerFileInfo('WorkflowObjects', 'class.WorkflowObjects.inc.php', 'inc');
-
-		/* ok. no more instances of this class.. */
-		self::$_instantiated = true;
-	}
-}
-
-?>
Index: ndbox/workflow/branches/609/lib/ProcessFactory.php
===================================================================
--- /sandbox/workflow/branches/609/lib/ProcessFactory.php	(revision 2212)
+++ 	(revision )
@@ -1,47 +1,0 @@
-<?php
-
-/**
- * Specialization of the BaseFactory class.
- * This class is used to instantiate classes for
- * processes. You cannot access this class directly,
- * but requests to the Factory frontend class in
- * 'secured mode' will be forwarded to this class.
- * It should be much more restrictive than its
- * older brother (or sister), WorkflowFactory...
- *
- * @author Pedro EugÃªnio Rocha
- * @package Factory
- */
-final class ProcessFactory extends BaseFactory {
-
-
-	/**
-	 * @var boolean $_instantiated Attribute that stores whether this
-	 *		class was instantiated or not. This is used to limit the
-	 * 		instantiation of this class.
-	 * @access private
-	 * @static
-	 */
-	private static $_instantiated = false;
-
-	/**
-	 * Construct the class. This function will inform which classes
-	 * you will be able to instantiate and where to find it.
-	 * This function implements a kind of singleton design pattern too.
-	 * @access public
-	 */
-	public function __construct() {
-
-		/* don't let the user to instantiate this class more than once. */
-		if (self::$_instantiated)
-			throw new Exception("You can't instantiate this class again.");
-
-		/* registering allowed classes */
-		//$this->registerFileInfo('WorkflowObjects', 'class.WorkflowObjects.inc.php', 'inc');
-
-		/* ok. no more instances of this class.. */
-		self::$_instantiated = true;
-	}
-}
-
-?>
Index: ndbox/workflow/branches/609/lib/Factory.php
===================================================================
--- /sandbox/workflow/branches/609/lib/Factory.php	(revision 2212)
+++ 	(revision )
@@ -1,96 +1,0 @@
-<?php
-
-/**
- * The Factory frontend class.
- * This class controls which concrete Factory
- * will be used, depending on the current
- * 'security mode'. It lazy instantiates both
- * factories (process and module) when they are
- * required, and stores these objects. All the
- * accesses to factories are done through this class,
- * implementing a kind of Proxy design pattern.
- * This class depends on Security frontend class
- * to decide which factory to call.
- *
- * @author Pedro EugÃªnio Rocha
- * @package Factory
- * @static
- */
-class Factory {
-
-
-	/**
-	 * @var object $_unsecuredFactory Stores WorkflowFactory object.
-	 * @access private
-	 * @static
-	 */
-	private static $_unsecuredFactory = null;
-
-
-	/**
-	 * @var object $_securedFactory Stores ProcessFactory object.
-	 * @access private
-	 * @static
-	 */
-	private static $_securedFactory = null;
-
-
-	/**
-	 * Constructor. Just disable direct instantiation.
-	 *
-	 * @access public
-	 * @return void
-	 * @static
-	 */
-	public function __construct() {
-		throw new Exception("Oops! Static only class.");
-	}
-
-
-	/**
-	 * Just forward this call to the correct class.
-	 *
-	 * @access public
-	 * @retun 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();
-			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();
-			call_user_func_array(array(self::$_unsecuredFactory, "getInstance"), $args);
-		}
-
-	}
-
-
-	/**
-	 * Just forward this call to the correct class.
-	 *
-	 * @todo I must implement it!
-	 * @access public
-	 * @retun object
-	 * @static
-	 */
-	public static function newInstance() {
-	}
-}
-
-?>
Index: ndbox/workflow/branches/609/lib/Security.php
===================================================================
--- /sandbox/workflow/branches/609/lib/Security.php	(revision 2207)
+++ 	(revision )
@@ -1,96 +1,0 @@
-<?php
-
-/**
- * Security class for Workflow module.
- * You should never forget to call 'enable'
- * public method to enable security before
- * executing process code.
- *
- * @author Pedro EugÃªnio Rocha
- * @package Security
- * @static
- */
-class Security {
-
-	/**
-	 * @var boolean $_protection Stores the current security mode.
-	 * @access private
-	 * @static
-	 */
-	private static $_protection = false;
-
-
-	/**
-	 * Disallow the instantiation of this class.
-	 * @access public
-	 * @return void
-	 */
-	public function __construct() {
-		throw new Exception("Oops! Static only class.");
-	}
-
-
-	/**
-	 * Returns the current security mode.
-	 * @access public
-	 * @return boolean
-	 */
-	public static function isEnabled() {
-		return self::$_protection;
-	}
-
-
-	/**
-	 * Change to secured mode.
-	 * @access public
-	 * @return boolean
-	 * @static
-	 */
-	public static function enable() {
-
-		if (self::_isAllowed())
-			self::$_protection = true;
-		else
-			throw new Exception('You are not allowed to change security mode.');
-		return true;
-	}
-
-	/**
-	 * Change to unsecured mode.
-	 * @access public
-	 * @return boolean
-	 * @static
-	 */
-	public static function disable() {
-
-		if (self::_isAllowed())
-			self::$_protection = false;
-		else
-			throw new Exception('You are not allowed to change security mode.');
-		return true;
-	}
-
-
-	/**
-	 * This function do all the security stuff.
-	 * Here we must define in which files we are able
-	 * to change the security mode.
-	 *
-	 * @access private
-	 * @return boolean
-	 * @static
-	 */
-	private static function _isAllowed() {
-		$backtrace = debug_backtrace();
-
-		/* TODO - These are not definitive validations */
-		/* $backtrace[1] specifies the imediate antecessor function */
-		$basedir = dirname($backtrace[1]['file']);
-
-		if ($basedir == dirname(__FILE__))
-			return true;
-		return false;
-	}
-}
-
-?>
Index: /sandbox/workflow/branches/609/inc/common.inc.php
===================================================================
--- /sandbox/workflow/branches/609/inc/common.inc.php	(revision 2206)
+++ /sandbox/workflow/branches/609/inc/common.inc.php	(revision 2222)
@@ -1,10 +1,48 @@
 <?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.                                              *
+\**************************************************************************/
+
+
+/**
+ * Server base path. This constant must be defined by expresso itself.
+ * Anyway, there are cases that we access Workflow directly; therefore
+ * it must be defined somewhere...
+ * @name PHPGW_SERVER_ROOT
+ */
+if (!defined('PHPGW_SERVER_ROOT'))
+	define('PHPGW_SERVER_ROOT', $HTTP_SERVER_VARS['DOCUMENT_ROOT']);
+
+/**
+ * Workflow base path.
+ * @name WF_SERVER_ROOT
+ */
+define('WF_SERVER_ROOT', PHPGW_SERVER_ROOT.'/workflow/');
+
+/**
+ * Workflow include path.
+ * @name WF_INC_ROOT
+ */
+define('WF_INC_ROOT', WF_SERVER_ROOT.'/inc/');
+
+/**
+ * Workflow lib base dir.
+ * @name WF_LIB_ROOT
+ */
+define('WF_LIB_ROOT', WF_SERVER_ROOT.'/lib/');
+
+
 if (file_exists(PHPGW_SERVER_ROOT . '/header.session.inc.php')) {
 	require_once PHPGW_SERVER_ROOT . '/header.session.inc.php';
 }
 
-/* garante que durante a execução de funções que modificam strings, os
- * caracteres acentuados sejam tratados corretamente (e.g. strtoupper)
- */
+
+/* assure that the correct encondig will be used (e.g string functions) */
 setlocale(LC_CTYPE, 'pt_BR', 'pt_BR.iso-8859-1', 'pt_BR.utf-8');
 
@@ -14,19 +52,18 @@
 
 
-/* defining constants */
-define('WF_SERVER_ROOT', PHPGW_SERVER_ROOT.'/workflow/');
-define('WF_INC_ROOT', WF_SERVER_ROOT.'/inc/');
-define('WF_LIB_ROOT', WF_SERVER_ROOT.'/lib/');
+/* including common classes */
+require_once WF_LIB_ROOT . 'security/Security.php';
+//require_once WF_LIB_ROOT . 'factory/Factory.php';
+require_once WF_LIB_ROOT . 'factory/BaseFactory.php';
+require_once WF_LIB_ROOT . 'factory/WorkflowFactory.php';
+require_once WF_LIB_ROOT . 'factory/ProcessFactory.php';
 
 
-/* including common classes */
-require_once WF_LIB_ROOT . 'Security.php';
-require_once WF_LIB_ROOT . 'Factory.php';
-require_once WF_LIB_ROOT . 'BaseFactory.php';
-require_once WF_LIB_ROOT . 'WorkflowFactory.php';
-require_once WF_LIB_ROOT . 'ProcessFactory.php';
+/* TODO - here we will still using that old and ugly factory */
+/* in a near future we should do things right.. */
+require_once WF_INC_ROOT . 'class.factory.inc.php';
+$GLOBALS['workflow']['factory'] = new Factory();
+$GLOBALS['workflow']['workflowObjects'] = $GLOBALS['workflow']['factory']->newInstance('WorkflowObjects');
 
-
-/* FIXME!! */
-$GLOBALS['workflow']['workflowObjects'] = Factory::getInstance('WorkflowObjects', 'asd', 123);
+//$GLOBALS['workflow']['workflowObjects'] = Factory::getInstance('WorkflowObjects', 'asd', 123);
 ?>
