Index: /sandbox/workflow/branches/993/lib/settings/Settings.php
===================================================================
--- /sandbox/workflow/branches/993/lib/settings/Settings.php	(revision 2429)
+++ /sandbox/workflow/branches/993/lib/settings/Settings.php	(revision 2492)
@@ -29,6 +29,5 @@
 	private static $_configs = array(
 		'workflow' => array(
-			'intranet_subnetworks' => '',
-			'db' => array(
+			'db_processes' => array(
 				'name' => '',
 				'host' => '',
@@ -38,20 +37,27 @@
 				'type' => ''
 			),
-			'galaxia' => array(
-				'db' => array(
-					'name' => '',
-					'host' => '',
-					'port' => '',
-					'user' => '',
-					'password' => '',
-					'type' => ''
-				)
-			),
-			'ldap' => array(
-				'host' => '',
+			'db_module' => array(
+				'name' => '',
+				'host' => '',
+				'port' => '',
 				'user' => '',
 				'password' => '',
-				'follow_referrals' => ''
-			),
+				'type' => ''
+			),
+			'ldap' => array(
+				'host' => '',
+				'user' => '',
+				'password' => '',
+				'follow_referrals' => '',
+				'user_context' => '',
+				'group_context' => ''
+			),
+			'preferences' => array(
+				'startpage' => '',
+				'ui_items_per_page' => '',
+				'show_activity_complete_page' => ''
+			),
+			'intranet_subnetworks' => '',
+			'user_can_clean_instances' => ''
 		),
 		'expresso' => array(
@@ -65,8 +71,20 @@
 			),
 			'ldap' => array(
-				'host' => ''
-			),
-		),
-		'process' => array(
+				'host' => '',
+				'user_context' => '',
+				'group_context' => ''
+			),
+			'user' => array(
+				'account_id' => '',
+				'account_lid' => '',
+				'account_dn' => '',
+				'userid' => '',
+				'passwd' => '',
+				'email' => ''
+			),
+			'preferences' => array(
+				'lang' => ''
+			),
+			'webserver_url' => ''
 		)
 	);
@@ -92,5 +110,6 @@
 
 	/**
-	 * Returns settings.
+	 * Returns settings. If the hole path has not be setted, return the hole
+	 * hierarchy under it.
 	 *
 	 * @param string $args 	A variable number of parameters which specify the scope
@@ -105,13 +124,6 @@
 		$args = func_get_args();
 
-		/**
-		 * Here we check if the configuration was defined into $_configs array.
-		 * If it does not, an exception will be thrown.
-		 * p.s. Do not try to understand this piece of code. Just fave faith! It works...
-		 */
-		for ($i=0, $sub_array=&self::$_configs; $i<count($args); $sub_array=&$sub_array[$args[$i++]]) {
-			if (!array_key_exists($args[$i], $sub_array))
-				throw new Exception("Sorry! Setting '".implode("->", $args)."' do not exists.");
-		}
+		/* checking if the key exists */
+		self::_keyExists($args);
 
 		/* check if we already load the settings */
@@ -123,4 +135,50 @@
 
 		return $value;
+	}
+
+
+	public static function set() {
+
+		/* getting the variable number of parameters */
+		$args = func_get_args();
+
+		/* the last position is always the value that we are trying to set, so pop it */
+		$value = array_pop($args);
+
+		/* checking if the key exists */
+		self::_keyExists($args);
+
+		/* check if we already load the settings */
+		if (!self::$_isLoaded)
+			self::_load();
+
+		/* retrieving the setting. More 'for' programming. */
+		for ($i=0, $key=&self::$_configs; $i<count($args); $key=&$key[$args[$i++]]);
+
+		/* updating the value. p.s: $key is a pointer to a $_config node */
+		$key = $value;
+		return true;
+	}
+
+	/**
+	 * Here we check if the configuration was defined into $_configs array.
+	 * If it does not, an exception will be thrown.
+	 *
+	 * @param string $args 	A variable number of parameters which specify the scope
+	 *						and the configuration to be retrieved.
+	 * @access private
+	 * @return boolean
+	 * @static
+	 */
+	private static function _keyExists($path) {
+
+		/**
+		 * p.s: Do not try to understand this piece of code. Just fave faith! It works...
+		 */
+		for ($i=0, $sub_array=&self::$_configs; $i<count($path); $sub_array=&$sub_array[$path[$i++]]) {
+			if (!array_key_exists($path[$i], $sub_array))
+				throw new Exception("Sorry! Setting '".implode("->", $path)."' do not exists.");
+		}
+		return true;
 	}
 
@@ -143,5 +201,25 @@
 		self::$_configs['expresso']['db']['type'] = $GLOBALS['phpgw_info']['server']['db_type'];
 
+		/* current user information */
+		self::$_configs['expresso']['user']['account_id'] = $GLOBALS['phpgw_info']['user']['account_id'];
+		self::$_configs['expresso']['user']['account_lid'] = $GLOBALS['phpgw_info']['user']['account_lid'];
+		self::$_configs['expresso']['user']['account_dn'] = $GLOBALS['phpgw_info']['user']['account_dn'];
+		self::$_configs['expresso']['user']['userid'] = $GLOBALS['phpgw_info']['user']['userid'];
+		self::$_configs['expresso']['user']['passwd'] = $GLOBALS['phpgw_info']['user']['passwd'];
+		self::$_configs['expresso']['user']['email'] = $GLOBALS['phpgw_info']['user']['email'];
+
 		self::$_configs['expresso']['ldap']['host'] = $GLOBALS['phpgw_info']['server']['ldap_host'];
+		self::$_configs['expresso']['ldap']['user_context'] = $GLOBALS['phpgw_info']['server']['ldap_user_context'];
+		self::$_configs['expresso']['ldap']['group_context'] = $GLOBALS['phpgw_info']['server']['ldap_group_context'];
+
+		/* workflow specific preferences */
+		self::$_configs['workflow']['preferences']['startpage'] = $GLOBALS['phpgw_info']['user']['preferences']['workflow']['startpage'];
+		self::$_configs['workflow']['preferences']['ui_items_per_page'] = $GLOBALS['phpgw_info']['user']['preferences']['workflow']['ui_items_per_page'];
+		self::$_configs['workflow']['preferences']['show_activity_complete_page'] = $GLOBALS['phpgw_info']['user']['preferences']['workflow']['show_activity_complete_page'];
+
+		/*expresso preferences */
+		self::$_configs['expresso']['preferences']['lang'] = $GLOBALS['phpgw_info']['user']['preferences']['common']['lang'];
+
+		self::$_configs['expresso']['webserver_url'] = $GLOBALS['phpgw_info']['server']['webserver_url'];
 
 		/* loading database settings */
@@ -151,17 +229,17 @@
 		self::$_configs['workflow']['intranet_subnetworks'] = $values['intranet_subnetworks'];
 
-		self::$_configs['workflow']['db']['name'] = $values['database_name'];
-		self::$_configs['workflow']['db']['host'] = $values['database_host'];
-		self::$_configs['workflow']['db']['port'] = $values['database_port'];
-		self::$_configs['workflow']['db']['admin_user'] = $values['database_admin_user'];
-		self::$_configs['workflow']['db']['admin_password'] = $values['database_admin_password'];
-		self::$_configs['workflow']['db']['type'] = $values['database_type'];
-
-		self::$_configs['workflow']['galaxia']['db']['name'] = $values['workflow_database_name'];
-		self::$_configs['workflow']['galaxia']['db']['host'] = $values['workflow_database_host'];
-		self::$_configs['workflow']['galaxia']['db']['port'] = $values['workflow_database_port'];
-		self::$_configs['workflow']['galaxia']['db']['user'] = $values['workflow_database_user'];
-		self::$_configs['workflow']['galaxia']['db']['password'] = $values['workflow_database_password'];
-		self::$_configs['workflow']['galaxia']['db']['type'] = $values['workflow_database_type'];
+		self::$_configs['workflow']['db_processes']['name'] = $values['database_name'];
+		self::$_configs['workflow']['db_processes']['host'] = $values['database_host'];
+		self::$_configs['workflow']['db_processes']['port'] = $values['database_port'];
+		self::$_configs['workflow']['db_processes']['admin_user'] = $values['database_admin_user'];
+		self::$_configs['workflow']['db_processes']['admin_password'] = $values['database_admin_password'];
+		self::$_configs['workflow']['db_processes']['type'] = $values['database_type'];
+
+		self::$_configs['workflow']['db_module']['name'] = $values['workflow_database_name'];
+		self::$_configs['workflow']['db_module']['host'] = $values['workflow_database_host'];
+		self::$_configs['workflow']['db_module']['port'] = $values['workflow_database_port'];
+		self::$_configs['workflow']['db_module']['user'] = $values['workflow_database_user'];
+		self::$_configs['workflow']['db_module']['password'] = $values['workflow_database_password'];
+		self::$_configs['workflow']['db_module']['type'] = $values['workflow_database_type'];
 
 		self::$_configs['workflow']['ldap']['host'] = $values['ldap_host'];
@@ -169,4 +247,6 @@
 		self::$_configs['workflow']['ldap']['password'] = $values['ldap_password'];
 		self::$_configs['workflow']['ldap']['follow_referrals'] = $values['ldap_follow_referrals'];
+		self::$_configs['workflow']['ldap']['user_context'] = $values['ldap_user_context'];
+		self::$_configs['workflow']['ldap']['group_context'] = $values['ldap_group_context'];
 
 		/* the settings are already loaded. No need to call this method again. */
Index: /sandbox/workflow/branches/993/inc/class.run_activity.inc.php
===================================================================
--- /sandbox/workflow/branches/993/inc/class.run_activity.inc.php	(revision 2372)
+++ /sandbox/workflow/branches/993/inc/class.run_activity.inc.php	(revision 2492)
@@ -293,5 +293,5 @@
 			//set some global variables needed
 			$GLOBALS['workflow']['__leave_activity']=false;
-			$GLOBALS['user'] = $GLOBALS['phpgw_info']['user']['account_id'];
+			$GLOBALS['user'] = Settings::get('expresso', 'user', 'account_id');
 
 			//load role names, just an information
@@ -319,16 +319,16 @@
 			$GLOBALS['workflow']['wf_user_id']					=& $GLOBALS['user'];
 			$GLOBALS['workflow']['wf_view_activity']			=& $this->view_activity;
-			$GLOBALS['workflow']['wf_webserver_url'] 			= $GLOBALS['phpgw_info']['server']['webserver_url'];
-			$GLOBALS['workflow']['wf_workflow_path']			= $GLOBALS['phpgw_info']['server']['webserver_url'].SEP.'workflow';
-			$GLOBALS['workflow']['wf_resources_path']			= $GLOBALS['phpgw_info']['server']['webserver_url'] . SEP . 'workflow/redirect.php?pid=' . $this->process_id . '&file=';
+			$GLOBALS['workflow']['wf_webserver_url'] 			= EGW_BASE_URL;
+			$GLOBALS['workflow']['wf_workflow_path']			= WF_BASE_URL;
+			$GLOBALS['workflow']['wf_resources_path']			= WF_BASE_URL . SEP . 'redirect.php?pid=' . $this->process_id . '&file=';
 			$GLOBALS['workflow']['wf_default_resources_path']	= Factory::getInstance('TemplateServer')->generateLink('processes');
 			$GLOBALS['workflow']['wf_workflow_resources_path']	= Factory::getInstance('TemplateServer')->generateLink('');
-			$GLOBALS['workflow']['wf_activity_url']				= $GLOBALS['phpgw_info']['server']['webserver_url'].SEP.'index.php?menuaction=workflow.'.get_class($this).'.go&activity_id='.$activity_id;
+			$GLOBALS['workflow']['wf_activity_url']				= EGW_BASE_URL . SEP . 'index.php?menuaction=workflow.'.get_class($this).'.go&activity_id='.$activity_id;
 			$GLOBALS['workflow']['wf_user_cnname']				= Factory::getInstance('WorkflowLDAP')->getName($GLOBALS['user']);
-			$GLOBALS['workflow']['wf_back_link']				= $GLOBALS['phpgw_info']['server']['webserver_url'].SEP.'workflow'.SEP.'index.php?start_tab=1';
-			$GLOBALS['workflow']['wf_js_path']					= $GLOBALS['phpgw_info']['server']['webserver_url'].SEP.'workflow'.SEP.'js'.SEP.'jscode';
+			$GLOBALS['workflow']['wf_back_link']				= WF_BASE_URL . SEP . 'index.php?start_tab=1';
+			$GLOBALS['workflow']['wf_js_path']					= WF_BASE_URL . SEP . 'js' . SEP . 'jscode';
 			$GLOBALS['workflow']['wf_user_activities']			= $this->GUI->gui_list_user_activities($GLOBALS['user'], '0', '-1', 'ga.wf_name__ASC', '', '', false, true, true, true, '');
 			if ($iid)
-				$GLOBALS['workflow']['wf_instance_url']	= $GLOBALS['phpgw_info']['server']['webserver_url'].SEP.'index.php?menuaction=workflow.'.get_class($this).'.go&activity_id='.$activity_id."&iid=".$iid;
+				$GLOBALS['workflow']['wf_instance_url']	= EGW_BASE_URL . SEP . 'index.php?menuaction=workflow.'.get_class($this).'.go&activity_id='.$activity_id."&iid=".$iid;
 			else
 				unset($GLOBALS['workflow']['wf_instance_url']);
@@ -375,5 +375,7 @@
 				$_SESSION['phpgw_info']['workflow']['user_groups'] = galaxia_retrieve_user_groups($newUser);
 				$_SESSION['phpgw_info']['workflow']['account_id'] = $newUser;
-				$GLOBALS['phpgw_info']['user']['account_id'] = $newUser;
+
+				Settings::set('expresso', 'user', 'account_id', $newUser);
+
 				$GLOBALS['workflow']['wf_user_id'] = $newUser;
 				$GLOBALS['user'] = $newUser;
@@ -384,5 +386,7 @@
 					$_SESSION['phpgw_info']['workflow']['user_groups'] = $actualUserGroups;
 					$_SESSION['phpgw_info']['workflow']['account_id'] = $actualUser;
-					$GLOBALS['phpgw_info']['user']['account_id'] = $actualUser;
+
+					Settings::set('expresso', 'user', 'account_id', $actualUser);
+
 					$GLOBALS['workflow']['wf_user_id'] = $actualUser;
 					$GLOBALS['user'] = $actualUser;
@@ -503,5 +507,5 @@
 				$_SESSION['phpgw_info']['workflow']['user_groups'] = $actualUserGroups;
 				$_SESSION['phpgw_info']['workflow']['account_id'] = $actualUser;
-				$GLOBALS['phpgw_info']['user']['account_id'] = $actualUser;
+				Settings::set('expresso', 'user', 'account_id', $actualUser);
 				$GLOBALS['workflow']['wf_user_id'] = $actualUser;
 				$GLOBALS['user'] = $actualUser;
@@ -549,5 +553,5 @@
 						$this->assignCommonVariables();
 						// and display completed template
-						if ($GLOBALS['phpgw_info']['user']['preferences']['workflow']['show_activity_complete_page'] === '0')
+						if (Settings::get('workflow', 'preferences', 'show_activity_complete_page') === '0')
 							header('Location: workflow/index.php');
 						else
@@ -648,5 +652,5 @@
 
 			//set some global variables needed
-			$GLOBALS['user'] = $GLOBALS['phpgw_info']['user']['account_id'];
+			$GLOBALS['user'] = Settings::get('expresso', 'user', 'account_id');
 
 			//load role names, just an information
@@ -674,15 +678,15 @@
 			$GLOBALS['workflow']['wf_user_id']					=& $GLOBALS['user'];
 			$GLOBALS['workflow']['wf_view_activity']			=& $this->view_activity;
-			$GLOBALS['workflow']['wf_workflow_path']			= $GLOBALS['phpgw_info']['server']['webserver_url'].SEP.'workflow';
-			$GLOBALS['workflow']['wf_resources_path']			= $GLOBALS['phpgw_info']['server']['webserver_url'] . SEP . 'workflow/redirect.php?pid=' . $this->process_id . '&file=';
+			$GLOBALS['workflow']['wf_workflow_path']			= WF_BASE_URL;
+			$GLOBALS['workflow']['wf_resources_path']			= WF_BASE_URL . SEP . 'redirect.php?pid=' . $this->process_id . '&file=';
 			$GLOBALS['workflow']['wf_default_resources_path']	= Factory::getInstance('TemplateServer')->generateLink('processes');
 			$GLOBALS['workflow']['wf_workflow_resources_path']	= Factory::getInstance('TemplateServer')->generateLink('');
-			$GLOBALS['workflow']['wf_activity_url']				= $GLOBALS['phpgw_info']['server']['webserver_url'].SEP.'index.php?menuaction=workflow.'.get_class($this).'.go&activity_id='.$activity_id;
+			$GLOBALS['workflow']['wf_activity_url']				= EGW_BASE_URL . SEP . 'index.php?menuaction=workflow.'.get_class($this).'.go&activity_id='.$activity_id;
 			$GLOBALS['workflow']['wf_user_cnname']				= Factory::getInstance('WorkflowLDAP')->getName($GLOBALS['user']);
-			$GLOBALS['workflow']['wf_back_link']				= $GLOBALS['phpgw_info']['server']['webserver_url'].SEP.'workflow'.SEP.'index.php?start_tab=1';
-			$GLOBALS['workflow']['wf_js_path']					= $GLOBALS['phpgw_info']['server']['webserver_url'].SEP.'workflow'.SEP.'js'.SEP.'jscode';
+			$GLOBALS['workflow']['wf_back_link']				= WF_BASE_URL . SEP . 'index.php?start_tab=1';
+			$GLOBALS['workflow']['wf_js_path']					= WF_BASE_URL . SEP . 'js' . SEP . 'jscode';
 			$GLOBALS['workflow']['wf_user_activities']			= $this->GUI->gui_list_user_activities($GLOBALS['user'], '0', '-1', 'ga.wf_name__ASC', '', '', false, true, true, true, '');
 			if ($iid)
-				$GLOBALS['workflow']['wf_instance_url']	= $GLOBALS['phpgw_info']['server']['webserver_url'].SEP.'index.php?menuaction=workflow.'.get_class($this).'.go&activity_id='.$activity_id."&iid=".$iid;
+				$GLOBALS['workflow']['wf_instance_url']	= EGW_BASE_URL . SEP . 'index.php?menuaction=workflow.'.get_class($this).'.go&activity_id='.$activity_id."&iid=".$iid;
 			else
 				unset($GLOBALS['workflow']['wf_instance_url']);
@@ -824,5 +828,5 @@
 			$this->workflowSmarty->assign('activityName', $this->activity_name);
 			$this->workflowSmarty->assign('activityCompleteMessage', $this->activityCompleteMessage);
-			$this->workflowSmarty->assign('activityBaseURL', $GLOBALS['phpgw_info']['server']['webserver_url']);
+			$this->workflowSmarty->assign('activityBaseURL', EGW_BASE_URL);
 			$this->workflowSmarty->assign('activityList', $activityList);
 
Index: /sandbox/workflow/branches/993/inc/class.bo_agent_mail_smtp.inc.php
===================================================================
--- /sandbox/workflow/branches/993/inc/class.bo_agent_mail_smtp.inc.php	(revision 2372)
+++ /sandbox/workflow/branches/993/inc/class.bo_agent_mail_smtp.inc.php	(revision 2492)
@@ -300,5 +300,5 @@
 		$data['smtpAuth']		= $profileData['smtpAuth'];
 		$data['smtpType']               = $profileData['smtpType'];
-		$useremail = $this->bo_emailadmin->getAccountEmailAddress($GLOBALS['phpgw_info']['user']['userid'], $this->profileID);
+		$useremail = $this->bo_emailadmin->getAccountEmailAddress(Settings::get('expresso', 'user', 'userid'), $this->profileID);
 		$data['emailAddress']           = $useremail[0]['address'];
 		return $data;
@@ -422,5 +422,5 @@
 	function prepare_mail()
 	{
-		$userLang = $GLOBALS['phpgw_info']['user']['preferences']['common']['lang'];
+		$userLang = Settings::get('expresso', 'preferences', 'lang');
 		$langFile = PHPGW_SERVER_ROOT."/phpgwapi/setup/phpmailer.lang-$userLang.php";
 		if(file_exists($langFile))
@@ -448,6 +448,6 @@
 		{
 			$this->mail->SMTPAuth	= true;
-			$this->mail->Username	= $GLOBALS['phpgw_info']['user']['userid'];
-			$this->mail->Password	= $GLOBALS['phpgw_info']['user']['passwd'];
+			$this->mail->Username	= Settings::get('expresso', 'user', 'userid');
+			$this->mail->Password	= Settings::get('expresso', 'user', 'passwd');
 		}
 		
@@ -668,5 +668,5 @@
 					//the current instance/activity user which is in fact running
 					//this class actually
-					$matches[1][$key] = $GLOBALS['phpgw_info']['user']['email'];
+					$matches[1][$key] = Settings::get('expresso', 'user', 'email');
 					break;
 				case 'owner' :
Index: /sandbox/workflow/branches/993/inc/local/classes/class.JobBase.php
===================================================================
--- /sandbox/workflow/branches/993/inc/local/classes/class.JobBase.php	(revision 2372)
+++ /sandbox/workflow/branches/993/inc/local/classes/class.JobBase.php	(revision 2492)
@@ -223,5 +223,5 @@
 		if (empty($uidNumber)) return false;
 
-		$GLOBALS['phpgw_info']['user']['account_id'] = $uidNumber;
+		Settings::set('expresso', 'user', 'account_id', $uidNumber);
 		$_SESSION['phpgw_info']['workflow']['account_id'] = $uidNumber;
 		$GLOBALS['user'] = $uidNumber;
Index: /sandbox/workflow/branches/993/inc/local/classes/class.wf_mail.php
===================================================================
--- /sandbox/workflow/branches/993/inc/local/classes/class.wf_mail.php	(revision 2372)
+++ /sandbox/workflow/branches/993/inc/local/classes/class.wf_mail.php	(revision 2492)
@@ -51,5 +51,5 @@
 
 		/* configura os parâmetros para envio de e-mail */
-		$userLang = $GLOBALS['phpgw_info']['user']['preferences']['common']['lang'];
+		$userLang = Settings('expresso', 'preferences', 'lang');
 		/* FIXME: hardcoded 'br' because phpmailer don't use pt-br */
 		if ($userLang == 'pt-br')
@@ -70,6 +70,6 @@
 		{
 			$this->SMTPAuth = true;
-			$this->Username = $GLOBALS['phpgw_info']['user']['userid'];
-			$this->Password = $GLOBALS['phpgw_info']['user']['passwd'];
+			$this->Username = Settings::get('expresso', 'user', 'userid');
+			$this->Password = Settings::get('expresso', 'user', 'passwd');
 		}
 		$this->Encoding = '8bit';
Index: /sandbox/workflow/branches/993/inc/class.TemplateServer.inc.php
===================================================================
--- /sandbox/workflow/branches/993/inc/class.TemplateServer.inc.php	(revision 2372)
+++ /sandbox/workflow/branches/993/inc/class.TemplateServer.inc.php	(revision 2492)
@@ -112,29 +112,6 @@
 
 		/* tenta carregar o endereço Web do Workflow */
-		if (isset($_SESSION['workflow']['TemplateServer']['workflowBase']))
-		{
-			$this->WEB_WORKFLOW_BASE = $_SESSION['workflow']['TemplateServer']['workflowBase'];
-		}
-		else
-		{
-			if (isset($GLOBALS['phpgw_info']['server']) && is_array($GLOBALS['phpgw_info']['server']) && array_key_exists('webserver_url', $GLOBALS['phpgw_info']['server']))
-			{
-				$this->WEB_WORKFLOW_BASE = ((string) $GLOBALS['phpgw_info']['server']['webserver_url']) . '/workflow';
-			}
-			else
-			{
-				if (isset($_SESSION['phpgw_info']['workflow']['server']) && is_array($_SESSION['phpgw_info']['workflow']['server']) && array_key_exists('webserver_url', $_SESSION['phpgw_info']['workflow']['server']))
-				{
-					$this->WEB_WORKFLOW_BASE = ((string) $_SESSION['phpgw_info']['workflow']['server']['webserver_url']) . '/workflow';
-				}
-				else
-				{
-					/* se não for encontrado em nenhuma variável de ambiente, tenta carregar do banco de dados */
-					$webServerURL = (string) Factory::getInstance('WorkflowObjects')->getDBExpresso()->Link_ID->GetOne('SELECT config_value FROM phpgw_config WHERE config_app = ? AND config_name = ?', array('phpgwapi', 'webserver_url'));
-					$this->WEB_WORKFLOW_BASE = str_replace('//', '/', "{$webServerURL}/workflow");
-				}
-			}
-			$_SESSION['workflow']['TemplateServer']['workflowBase'] = $this->WEB_WORKFLOW_BASE;
-		}
+		$this->WEB_WORKFLOW_BASE = WF_BASE_URL;
+
 		$this->WEB_PATH = $this->WEB_WORKFLOW_BASE . '/templates';
 	}
Index: /sandbox/workflow/branches/993/inc/class.workflow_processmanager.inc.php
===================================================================
--- /sandbox/workflow/branches/993/inc/class.workflow_processmanager.inc.php	(revision 2372)
+++ /sandbox/workflow/branches/993/inc/class.workflow_processmanager.inc.php	(revision 2492)
@@ -41,5 +41,5 @@
 			if (isset($_GET['p_id']))
 			{
-				if (!($this->workflow_acl->checkWorkflowAdmin($GLOBALS['phpgw_info']['user']['account_id']) || $this->workflow_acl->check_process_access($GLOBALS['phpgw_info']['user']['account_id'], (int) $_GET['p_id'])))
+				if (!($this->workflow_acl->checkWorkflowAdmin(Settings::get('expresso', 'user', 'account_id')) || $this->workflow_acl->check_process_access(Settings::get('expresso', 'user', 'account_id'), (int) $_GET['p_id'])))
                 {
                     $GLOBALS['phpgw']->common->phpgw_header();
@@ -633,5 +633,5 @@
  			 	$this->_rec_copy($old_name,$new_name);
 
-			 $this->workflow_acl->add_process_admins($new_id, array( $GLOBALS['phpgw_info']['user']['account_id'] ));
+			 $this->workflow_acl->add_process_admins($new_id, array( Settings::get('expresso', 'user', 'account_id') ));
 
 			 return $new_id;
@@ -665,5 +665,5 @@
             if (!$pId)
             {
-				$this->workflow_acl->add_process_admins($id, array( $GLOBALS['phpgw_info']['user']['account_id'] ) );
+				$this->workflow_acl->add_process_admins($id, array( Settings::get('expresso', 'user', 'account_id') ) );
             }
 
Index: /sandbox/workflow/branches/993/inc/class.ui_generic_select.inc.php
===================================================================
--- /sandbox/workflow/branches/993/inc/class.ui_generic_select.inc.php	(revision 2372)
+++ /sandbox/workflow/branches/993/inc/class.ui_generic_select.inc.php	(revision 2492)
@@ -82,5 +82,5 @@
 		$smarty->setHeader(workflow_smarty::SHOW_HEADER | workflow_smarty::SHOW_FOOTER);
 
-		$javaScripts = '<script src="' . $GLOBALS['phpgw_info']['server']['webserver_url'] . SEP . 'workflow' . SEP . 'js' . SEP . 'jscode' . SEP . 'generic_select.js' . '" type="text/javascript"></script>';
+		$javaScripts = '<script src="' . Settings::get('expresso', 'webserver_url') . SEP . 'workflow' . SEP . 'js' . SEP . 'jscode' . SEP . 'generic_select.js' . '" type="text/javascript"></script>';
 
 		/* pass the variables to Smarty */
Index: /sandbox/workflow/branches/993/inc/class.ui_adminprocesses.inc.php
===================================================================
--- /sandbox/workflow/branches/993/inc/class.ui_adminprocesses.inc.php	(revision 2372)
+++ /sandbox/workflow/branches/993/inc/class.ui_adminprocesses.inc.php	(revision 2492)
@@ -57,5 +57,5 @@
 		$this->workflow_acl = Factory::getInstance('workflow_acl');
 		$denyAccess = true;
-		if ($this->workflow_acl->checkWorkflowAdmin($GLOBALS['phpgw_info']['user']['account_id']))
+		if ($this->workflow_acl->checkWorkflowAdmin( Settings::get('expresso', 'user', 'account_id')))
 		{
 			/* the user is an Expresso/Workflow admin */
@@ -68,5 +68,5 @@
 				/* check if the user can admin the informed process */
 				if ($this->wf_p_id != 0)
-					$denyAccess = !$this->workflow_acl->check_process_access($GLOBALS['phpgw_info']['user']['account_id'], $this->wf_p_id);
+					$denyAccess = !$this->workflow_acl->check_process_access( Settings::get('expresso', 'user', 'account_id'), $this->wf_p_id);
 				else
 					$denyAccess = false;
@@ -128,7 +128,7 @@
 		}
 
-		if (!Factory::getInstance('workflow_acl')->checkWorkflowAdmin($GLOBALS['phpgw_info']['user']['account_id']))
-		{
-			$proc_ids = $this->workflow_acl->get_granted_processes($GLOBALS['phpgw_info']['user']['account_id']);
+		if (!Factory::getInstance('workflow_acl')->checkWorkflowAdmin( Settings::get('expresso', 'user', 'account_id' )))
+		{
+			$proc_ids = $this->workflow_acl->get_granted_processes( Settings::get('expresso', 'user', 'account_id') );
 			if (count($proc_ids))
 			{
Index: /sandbox/workflow/branches/993/inc/class.WorkflowObjects.inc.php
===================================================================
--- /sandbox/workflow/branches/993/inc/class.WorkflowObjects.inc.php	(revision 2429)
+++ /sandbox/workflow/branches/993/inc/class.WorkflowObjects.inc.php	(revision 2492)
@@ -40,9 +40,9 @@
 
 			/* if any parameter is not set, then we will return expresso database */
-			if ((Settings::get('workflow', 'galaxia', 'db', 'name') == '') or
-				(Settings::get('workflow', 'galaxia', 'db', 'host') == '') or
-				(Settings::get('workflow', 'galaxia', 'db', 'port') == '') or
-				(Settings::get('workflow', 'galaxia', 'db', 'user') == '') or
-				(Settings::get('workflow', 'galaxia', 'db', 'type') == ''))
+			if ((Settings::get('workflow', 'db_module', 'name') == '') or
+				(Settings::get('workflow', 'db_module', 'host') == '') or
+				(Settings::get('workflow', 'db_module', 'port') == '') or
+				(Settings::get('workflow', 'db_module', 'user') == '') or
+				(Settings::get('workflow', 'db_module', 'type') == ''))
 				$dedicatedDB = false;
 
@@ -55,10 +55,10 @@
 				$this->cache['DBGalaxia']->Halt_On_Error = 'no';
 				$this->cache['DBGalaxia']->connect(
-					Settings::get('workflow', 'galaxia', 'db', 'name'),
-					Settings::get('workflow', 'galaxia', 'db', 'host'),
-					Settings::get('workflow', 'galaxia', 'db', 'port'),
-					Settings::get('workflow', 'galaxia', 'db', 'user'),
-					Settings::get('workflow', 'galaxia', 'db', 'password'),
-					Settings::get('workflow', 'galaxia', 'db', 'type')
+					Settings::get('workflow', 'db_module', 'name'),
+					Settings::get('workflow', 'db_module', 'host'),
+					Settings::get('workflow', 'db_module', 'port'),
+					Settings::get('workflow', 'db_module', 'user'),
+					Settings::get('workflow', 'db_module', 'password'),
+					Settings::get('workflow', 'db_module', 'type')
 				);
 				Factory::getInstance('WorkflowSecurity')->removeSensitiveInformationFromDatabaseObject($this->cache['DBGalaxia']);
@@ -114,10 +114,10 @@
 			$this->cache['DBWorkflow']->Halt_On_Error = 'no';
 			$this->cache['DBWorkflow']->connect(
-				Settings::get('workflow', 'db', 'name'),
-				Settings::get('workflow', 'db', 'host'),
-				Settings::get('workflow', 'db', 'port'),
-				Settings::get('workflow', 'db', 'admin_user'),
-				Settings::get('workflow', 'db', 'admin_password'),
-				Settings::get('workflow', 'db', 'type')
+				Settings::get('workflow', 'db_processes', 'name'),
+				Settings::get('workflow', 'db_processes', 'host'),
+				Settings::get('workflow', 'db_processes', 'port'),
+				Settings::get('workflow', 'db_processes', 'admin_user'),
+				Settings::get('workflow', 'db_processes', 'admin_password'),
+				Settings::get('workflow', 'db_processes', 'type')
 			);
 			Factory::getInstance('WorkflowSecurity')->removeSensitiveInformationFromDatabaseObject($this->cache['DBWorkflow']);
Index: /sandbox/workflow/branches/993/inc/class.ui_external_applications.inc.php
===================================================================
--- /sandbox/workflow/branches/993/inc/class.ui_external_applications.inc.php	(revision 2372)
+++ /sandbox/workflow/branches/993/inc/class.ui_external_applications.inc.php	(revision 2492)
@@ -49,5 +49,5 @@
 	function draw()
 	{
-		if (!Factory::getInstance('workflow_acl')->checkWorkflowAdmin($GLOBALS['phpgw_info']['user']['account_id']))
+		if (!Factory::getInstance('workflow_acl')->checkWorkflowAdmin(Settings::get('expresso', 'user', 'account_id')))
 		{
 			$GLOBALS['phpgw']->common->phpgw_header();
Index: /sandbox/workflow/branches/993/inc/class.bo_workflow_forms.inc.php
===================================================================
--- /sandbox/workflow/branches/993/inc/class.bo_workflow_forms.inc.php	(revision 2372)
+++ /sandbox/workflow/branches/993/inc/class.bo_workflow_forms.inc.php	(revision 2492)
@@ -93,7 +93,7 @@
 			
 			// number of rows allowed
-			if ($GLOBALS['phpgw_info']['user']['preferences']['workflow']['ui_items_per_page'] > 0)
-			{
-				$this->offset = $GLOBALS['phpgw_info']['user']['preferences']['workflow']['ui_items_per_page'];
+			if (Settings::get('workflow', 'preferences', 'ui_items_per_page') > 0)
+			{
+				$this->offset = Settings::get('workflow', 'preferences', 'ui_items_per_page');
 			}
 			else
Index: /sandbox/workflow/branches/993/inc/engine/config.egw.inc.php
===================================================================
--- /sandbox/workflow/branches/993/inc/engine/config.egw.inc.php	(revision 2372)
+++ /sandbox/workflow/branches/993/inc/engine/config.egw.inc.php	(revision 2492)
@@ -151,5 +151,5 @@
 	function galaxia_user_can_admin_process()
 	{
-		return (Factory::getInstance('workflow_acl')->checkWorkflowAdmin($GLOBALS['phpgw_info']['user']['account_id']) || $GLOBALS['phpgw']->acl->check('admin_workflow', 1, 'workflow'));
+		return (Factory::getInstance('workflow_acl')->checkWorkflowAdmin(Settings::get('expresso', 'user', 'account_id')) || $GLOBALS['phpgw']->acl->check('admin_workflow', 1, 'workflow'));
 	}
 }
@@ -165,5 +165,5 @@
 	function galaxia_user_can_admin_instance()
 	{
-		return (Factory::getInstance('workflow_acl')->checkWorkflowAdmin($GLOBALS['phpgw_info']['user']['account_id']) || $GLOBALS['phpgw']->acl->check('admin_instance_workflow', 1, 'workflow'));
+		return (Factory::getInstance('workflow_acl')->checkWorkflowAdmin(Settings::get('expresso', 'user', 'account_id')) || $GLOBALS['phpgw']->acl->check('admin_instance_workflow', 1, 'workflow'));
 	}
 }
@@ -179,5 +179,5 @@
 	function galaxia_user_can_clean_instances()
 	{
-		return (Factory::getInstance('workflow_acl')->checkWorkflowAdmin($GLOBALS['phpgw_info']['user']['account_id']) || $GLOBALS['phpgw']->acl->check('cleanup_workflow', 1, 'workflow'));
+		return (Factory::getInstance('workflow_acl')->checkWorkflowAdmin(Settings::get('expresso', 'user', 'account_id')) || $GLOBALS['phpgw']->acl->check('cleanup_workflow', 1, 'workflow'));
 	}
 }
@@ -191,5 +191,5 @@
 	function galaxia_user_can_clean_aborted_instances()
 	{
-		return (Factory::getInstance('workflow_acl')->checkWorkflowAdmin($GLOBALS['phpgw_info']['user']['account_id']) || $GLOBALS['phpgw']->acl->check('cleanup_aborted_workflow', 1, 'workflow'));
+		return (Factory::getInstance('workflow_acl')->checkWorkflowAdmin(Settings::get('expresso', 'user', 'account_id')) || $GLOBALS['phpgw']->acl->check('cleanup_aborted_workflow', 1, 'workflow'));
 	}
 }
@@ -203,5 +203,5 @@
 	function galaxia_user_can_monitor()
 	{
-		return (Factory::getInstance('workflow_acl')->checkWorkflowAdmin($GLOBALS['phpgw_info']['user']['account_id']) || $GLOBALS['phpgw']->acl->check('monitor_workflow', 1, 'workflow'));
+		return (Factory::getInstance('workflow_acl')->checkWorkflowAdmin(Settings::get('expresso', 'user', 'account_id')) || $GLOBALS['phpgw']->acl->check('monitor_workflow', 1, 'workflow'));
 	}
 }
@@ -219,5 +219,5 @@
 		{
 			if ($user == '')
-				$user = $GLOBALS['phpgw_info']['user']['account_id'];
+				$user = Settings::get('expresso', 'user', 'account_id');
 
 			$memberships = Factory::getInstance('WorkflowLDAP')->getUserGroups($user);
@@ -271,5 +271,5 @@
 	function galaxia_retrieve_running_user()
 	{
-			return ($GLOBALS['phpgw_info']['user']['account_id']);
+			return Settings::get('expresso', 'user', 'account_id');
 	}
 }
Index: /sandbox/workflow/branches/993/inc/engine/src/API/BaseActivity.php
===================================================================
--- /sandbox/workflow/branches/993/inc/engine/src/API/BaseActivity.php	(revision 2372)
+++ /sandbox/workflow/branches/993/inc/engine/src/API/BaseActivity.php	(revision 2492)
@@ -242,5 +242,5 @@
     
     // retrieve user_groups information in an array containing all groups for this user
-    $user_groups = galaxia_retrieve_user_groups($GLOBALS['phpgw_info']['user']['account_id'] );
+    $user_groups = galaxia_retrieve_user_groups(Settings::get('expresso', 'user', 'account_id') );
     // and append it to query                      
     $query = 'select `wf_role_id` from `'.GALAXIA_TABLE_PREFIX."user_roles` 
Index: /sandbox/workflow/branches/993/inc/hook_home.inc.php
===================================================================
--- /sandbox/workflow/branches/993/inc/hook_home.inc.php	(revision 2372)
+++ /sandbox/workflow/branches/993/inc/hook_home.inc.php	(revision 2492)
@@ -12,5 +12,5 @@
 		$_SESSION['phpgw_info']['workflow']['user_groups'][] = $group['account_id'];
 
-	$_SESSION['phpgw_info']['workflow']['account_id'] = $GLOBALS['phpgw_info']['user']['account_id'];
+	$_SESSION['phpgw_info']['workflow']['account_id'] = Settings::get('expresso', 'user', 'account_id');
 	$_SESSION['phpgw_info']['workflow']['phpgw_api_inc'] = dirname(__FILE__) . '/../../phpgwapi/inc';
 	$_SESSION['phpgw_info']['workflow']['server']['db_name'] = $GLOBALS['phpgw_info']['server']['db_name'];
Index: /sandbox/workflow/branches/993/inc/common.inc.php
===================================================================
--- /sandbox/workflow/branches/993/inc/common.inc.php	(revision 2429)
+++ /sandbox/workflow/branches/993/inc/common.inc.php	(revision 2492)
@@ -11,5 +11,5 @@
 
 /**
- * This is other big workaround. In ajax calls, we use controller.php
+ * This is an other big workaround. In ajax calls, we use controller.php
  * directly, which do not includes header.inc for performance issues.
  * However, for phpgwAPI to work properly we need to set several
@@ -24,8 +24,24 @@
         'currentapp' => 'workflow'
 );
-/* TODO TODO TODO TODO */
+
+/**
+ * the base dir must be relative to this file location because
+ * the root directory is not the some in every call.
+ */
 $base = dirname(dirname(dirname(__FILE__)));
+
+/* including expresso's header.inc.php */
 require_once ($base . '/header.inc.php');
+
+/* restoring old flags */
 $GLOBALS['phpgw_info']['flags'] = $old;
+
+
+/* assure that the correct encoding will be used (e.g string functions) */
+setlocale(LC_CTYPE, 'pt_BR', 'pt_BR.iso-8859-1', 'pt_BR.utf-8');
+
+
+/* define o umask para a criação de arquivos por parte do Workflow */
+umask(007);
 
 
@@ -66,13 +82,4 @@
 
 
-
-/* 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');
-
-
-/* define o umask para a criação de arquivos por parte do Workflow */
-umask(007);
-
-
 /* including common classes */
 require_once WF_LIB_ROOT . 'security/Security.php';
@@ -83,4 +90,17 @@
 require_once WF_LIB_ROOT . 'settings/Settings.php';
 
+/**
+ * Expresso base url.
+ * @name EGW_BASE_URL
+ */
+define('EGW_BASE_URL', Settings::get('expresso', 'webserver_url'));
+
+/**
+ * Workflow base url.
+ * @name WF_BASE_URL
+ */
+define('WF_BASE_URL', EGW_BASE_URL . "/workflow/");
+
+
 $GLOBALS['workflow']['workflowObjects'] = Factory::getInstance('WorkflowObjects');
 ?>
Index: /sandbox/workflow/branches/993/inc/class.ui_adminroles.inc.php
===================================================================
--- /sandbox/workflow/branches/993/inc/class.ui_adminroles.inc.php	(revision 2372)
+++ /sandbox/workflow/branches/993/inc/class.ui_adminroles.inc.php	(revision 2492)
@@ -44,5 +44,5 @@
 		$this->workflow_acl = Factory::getInstance('workflow_acl');
 		$denyAccess = true;
-		if ($this->workflow_acl->checkWorkflowAdmin($GLOBALS['phpgw_info']['user']['account_id']))
+		if ($this->workflow_acl->checkWorkflowAdmin(Settings::get('expresso', 'user', 'account_id')))
 		{
 			/* the user is an Expresso/Workflow admin */
@@ -55,5 +55,5 @@
 				/* check if the user can admin the informed process */
 				if ($this->wf_p_id != 0)
-					$denyAccess = !$this->workflow_acl->check_process_access($GLOBALS['phpgw_info']['user']['account_id'], $this->wf_p_id);
+					$denyAccess = !$this->workflow_acl->check_process_access(Settings::get('expresso', 'user', 'account_id'), $this->wf_p_id);
 				else
 					$denyAccess = false;
Index: /sandbox/workflow/branches/993/inc/class.WorkflowMacro.inc.php
===================================================================
--- /sandbox/workflow/branches/993/inc/class.WorkflowMacro.inc.php	(revision 2372)
+++ /sandbox/workflow/branches/993/inc/class.WorkflowMacro.inc.php	(revision 2492)
@@ -43,5 +43,5 @@
 		$_SESSION['phpgw_info']['workflow']['vfs_basedir'] = ($row !== false) ? $row['config_value'] : '/home/expressolivre';
 		$_SESSION['phpgw_info']['workflow']['phpgw_api_inc'] = PHPGW_API_INC;
-		$_SESSION['phpgw_info']['workflow']['account_id'] = $GLOBALS['phpgw_info']['user']['account_id'];
+		$_SESSION['phpgw_info']['workflow']['account_id'] = Settings::get('expresso', 'user', 'account_id');
 		$_SESSION['phpgw_info']['workflow']['server']['webserver_url'] = $GLOBALS['phpgw_info']['server']['webserver_url'];
 
Index: /sandbox/workflow/branches/993/inc/class.external_bridge.inc.php
===================================================================
--- /sandbox/workflow/branches/993/inc/class.external_bridge.inc.php	(revision 2372)
+++ /sandbox/workflow/branches/993/inc/class.external_bridge.inc.php	(revision 2492)
@@ -65,6 +65,6 @@
 		$tmpOrg = "";
 
-		$tmpUser = $GLOBALS['phpgw_info']['user']['account_lid'];
-		$tmpOrg = explode(",ou=", $GLOBALS['phpgw_info']['user']['account_dn']);
+		$tmpUser = Settings::get('expresso', 'user', 'account_lid');
+		$tmpOrg = explode(",ou=", Settings::get('expresso', 'user', 'account_dn'));
 		$tmpOrg = explode(",", $tmpOrg[1]);
 		$tmpOrg = $tmpOrg[0];
@@ -73,5 +73,5 @@
 					'%user%' => $tmpUser,
 					'%organization%' => $tmpOrg,
-					'%password%' => $GLOBALS['phpgw_info']['user']['passwd']);
+					'%password%' => Settings::get('expresso', 'user', 'passwd'));
 
 		/* select the required form values for submission */
@@ -130,5 +130,5 @@
 			/* check if the user has the permission to access the requested site */
 			$site = (int) $site;
-			if (!$this->acl->checkUserGroupAccessToResource('APX', $GLOBALS['phpgw_info']['user']['account_id'], $site))
+			if (!$this->acl->checkUserGroupAccessToResource('APX', Settings('expresso', 'user', 'account_id'), $site))
 				$redirect = true;
 		}
Index: /sandbox/workflow/branches/993/inc/class.ui_participants.inc.php
===================================================================
--- /sandbox/workflow/branches/993/inc/class.ui_participants.inc.php	(revision 2372)
+++ /sandbox/workflow/branches/993/inc/class.ui_participants.inc.php	(revision 2492)
@@ -54,5 +54,5 @@
 		$smarty->setHeader(workflow_smarty::SHOW_HEADER | workflow_smarty::SHOW_FOOTER);
 		$ldap = Factory::getInstance('WorkflowLDAP');
-		$userDN = $GLOBALS['phpgw_info']['user']['account_dn'];
+		$userDN = Settings::get('expresso', 'user', 'account_dn');
 		$account = Factory::getInstance('accounts', $userDN);
 		$organizationList = $this->bo->getOrganizations();
Index: /sandbox/workflow/branches/993/inc/class.ui_ajaxinterface.inc.php
===================================================================
--- /sandbox/workflow/branches/993/inc/class.ui_ajaxinterface.inc.php	(revision 2372)
+++ /sandbox/workflow/branches/993/inc/class.ui_ajaxinterface.inc.php	(revision 2492)
@@ -57,16 +57,16 @@
 		$_SESSION['phpgw_info']['workflow']['server'] = $GLOBALS['phpgw_info']['server'];
 		$_SESSION['phpgw_info']['workflow']['lang'] = $GLOBALS['lang'];
-		$_SESSION['phpgw_info']['workflow']['account_id'] = $GLOBALS['phpgw_info']['user']['account_id'];
-		$_SESSION['phpgw_info']['workflow']['user_groups'] = Factory::getInstance('WorkflowLDAP')->getUserGroups($GLOBALS['phpgw_info']['user']['account_id']);
-		$user_is_admin = $acl->checkWorkflowAdmin($GLOBALS['phpgw_info']['user']['account_id']);
+		$_SESSION['phpgw_info']['workflow']['account_id'] = Settings::get('expresso', 'user', 'account_id');
+		$_SESSION['phpgw_info']['workflow']['user_groups'] = Factory::getInstance('WorkflowLDAP')->getUserGroups(Settings::get('expresso', 'user', 'account_id'));
+		$user_is_admin = $acl->checkWorkflowAdmin(Settings::get('expresso', 'user', 'account_id'));
 		$_SESSION['phpgw_info']['workflow']['user_is_admin'] = $user_is_admin;
 		$_SESSION['phpgw_info']['workflow']['user_can_admin_process'] = ($user_is_admin || ($GLOBALS['phpgw']->acl->check('admin_workflow',1,'workflow')));
 		$_SESSION['phpgw_info']['workflow']['user_can_admin_instance'] = ($user_is_admin || ($GLOBALS['phpgw']->acl->check('admin_instance_workflow',1,'workflow')));
 
-		$can_monitor = $acl->checkUserGroupAccessToType('MON', $GLOBALS['phpgw_info']['user']['account_id']);
+		$can_monitor = $acl->checkUserGroupAccessToType('MON', Settings::get('expresso', 'user', 'account_id'));
 		$_SESSION['phpgw_info']['workflow']['user_can_monitor'] = ($user_is_admin || $can_monitor);
 		$_SESSION['phpgw_info']['workflow']['user_can_clean_instances'] = $_SESSION['phpgw_info']['workflow']['user_can_monitor'];
 		$_SESSION['phpgw_info']['workflow']['user_can_clean_aborted_instances'] = $_SESSION['phpgw_info']['workflow']['user_can_monitor'];
-		$_SESSION['phpgw_info']['workflow']['user']['preferences'] = $GLOBALS['phpgw_info']['user']['preferences']['workflow'];
+		$_SESSION['phpgw_info']['workflow']['user']['preferences'] = Settings::get('workflow', 'preferences');
 		$_SESSION['phpgw_info']['workflow']['voip_groups'] = $GLOBALS['phpgw_info']['server']['voip_groups'];
 	}
@@ -80,5 +80,5 @@
 	function get_common_js()
 	{
-		$result = "<script language='javascript'>var _web_server_url = '" . $GLOBALS['phpgw_info']['server']['webserver_url'] . "';</script>";
+		$result = "<script language='javascript'>var _web_server_url = '" . EGW_BASE_URL . "';</script>";
 		$result = $result . $this->get_js_link('workflow','jscode', 'globals');			
 		$result = $result . $this->get_js_link('workflow','jscode', 'common_functions');
@@ -147,5 +147,5 @@
 		else
 			$params[] = $this->num_version;
-		$js_file = $GLOBALS['phpgw_info']['server']['webserver_url'].SEP.$module.SEP.'js'.SEP.$js_package.SEP.$js_name.'.js';
+		$js_file = EGW_BASE_URL . SEP . $module . SEP . 'js' . SEP . $js_package . SEP . $js_name . '.js';
 		return '<script src="'.$js_file.'?'.implode('&', $params).'" type="text/javascript"></script>';
 	}
Index: /sandbox/workflow/branches/993/inc/class.ui_adminactivities.inc.php
===================================================================
--- /sandbox/workflow/branches/993/inc/class.ui_adminactivities.inc.php	(revision 2372)
+++ /sandbox/workflow/branches/993/inc/class.ui_adminactivities.inc.php	(revision 2492)
@@ -74,5 +74,5 @@
 		$this->workflow_acl = Factory::getInstance('workflow_acl');
 		$denyAccess = true;
-		if ($this->workflow_acl->checkWorkflowAdmin($GLOBALS['phpgw_info']['user']['account_id']))
+		if ($this->workflow_acl->checkWorkflowAdmin(Settings::get('expresso', 'user', 'account_id')))
 		{
 			/* the user is an Expresso/Workflow admin */
@@ -85,5 +85,5 @@
 				/* check if the user can admin the informed process */
 				if ($this->wf_p_id != 0)
-					$denyAccess = !$this->workflow_acl->check_process_access($GLOBALS['phpgw_info']['user']['account_id'], $this->wf_p_id);
+					$denyAccess = !$this->workflow_acl->check_process_access(Settings::get('expresso', 'user', 'account_id'), $this->wf_p_id);
 				else
 					$denyAccess = false;
Index: /sandbox/workflow/branches/993/inc/class.WorkflowLDAP.inc.php
===================================================================
--- /sandbox/workflow/branches/993/inc/class.WorkflowLDAP.inc.php	(revision 2372)
+++ /sandbox/workflow/branches/993/inc/class.WorkflowLDAP.inc.php	(revision 2492)
@@ -53,15 +53,16 @@
 
 		/* get the required parameters */
-		$info = (isset($GLOBALS['phpgw_info']['server']['ldap_context'])) ?
-			$GLOBALS['phpgw_info']['server'] :
-			$_SESSION['phpgw_info']['workflow']['server'];
-		$ldapConfigValues = galaxia_get_config_values(array('ldap_user_context' => '', 'ldap_group_context' => ''));
-		if (empty($ldapConfigValues['ldap_user_context']))
-			$ldapConfigValues['ldap_user_context'] = $info['ldap_context'];
-		if (empty($ldapConfigValues['ldap_group_context']))
-			$ldapConfigValues['ldap_group_context'] = $info['ldap_group_context'];
-		$this->userContext = $ldapConfigValues['ldap_user_context'];
-		$this->groupContext = $ldapConfigValues['ldap_group_context'];
-		$this->ldapContext = $ldapConfigValues['ldap_user_context'];
+		$ldapUserContext = Settings::get('workflow', 'ldap', 'user_context');
+		$ldapGroupContext = Settings::get('workflow', 'ldap', 'group_context');
+
+		if (empty($ldapUserContext))
+			$ldapUserContext = Settings::get('expresso', 'ldap', 'user_context');
+
+		if (empty($ldapGroupContext))
+			$ldapGroupContext = Settings::get('expresso', 'ldap', 'group_context');
+
+		$this->userContext = $ldapUserContext;
+		$this->groupContext = $ldapGroupContext;
+		$this->ldapContext = $ldapUserContext;
 
 		$this->cache = array(
Index: /sandbox/workflow/branches/993/inc/smarty/wf_plugins/function.wf_redir_menu.php
===================================================================
--- /sandbox/workflow/branches/993/inc/smarty/wf_plugins/function.wf_redir_menu.php	(revision 2372)
+++ /sandbox/workflow/branches/993/inc/smarty/wf_plugins/function.wf_redir_menu.php	(revision 2492)
@@ -53,5 +53,5 @@
 	$select_tag .= "<option value=\"og\">Organograma</option>";
 
-	$user_is_admin = Factory::getInstance('workflow_acl')->checkWorkflowAdmin($GLOBALS['phpgw_info']['user']['account_id']);
+	$user_is_admin = Factory::getInstance('workflow_acl')->checkWorkflowAdmin(Settings::get('expresso', 'user', 'account_id'));
 	if ($user_is_admin || ($GLOBALS['phpgw']->acl->check('admin_workflow',1,'workflow'))) {
 		$select_tag .= "<option value=\"ad\">Administração</option>";
Index: /sandbox/workflow/branches/993/inc/hook_sidebox_menu.inc.php
===================================================================
--- /sandbox/workflow/branches/993/inc/hook_sidebox_menu.inc.php	(revision 2372)
+++ /sandbox/workflow/branches/993/inc/hook_sidebox_menu.inc.php	(revision 2492)
@@ -19,5 +19,5 @@
 {
 	$workflowACL = Factory::getInstance('workflow_acl');
-	$userID = $GLOBALS['phpgw_info']['user']['account_id'];
+	$userID = Settings::get('expresso', 'user', 'account_id');
 	$apptitle = $GLOBALS['phpgw_info']['apps'][$appname]['title'];
 	$isWorkflowAdmin = $workflowACL->checkWorkflowAdmin($userID);
Index: /sandbox/workflow/branches/993/inc/class.ui_orgchart.inc.php
===================================================================
--- /sandbox/workflow/branches/993/inc/class.ui_orgchart.inc.php	(revision 2418)
+++ /sandbox/workflow/branches/993/inc/class.ui_orgchart.inc.php	(revision 2492)
@@ -49,6 +49,6 @@
 		$this->workflow_acl = Factory::getInstance('workflow_acl');
 
-		$isAdmin = $this->workflow_acl->checkWorkflowAdmin($GLOBALS['phpgw_info']['user']['account_id']);
-		$isOrgchartManager = $this->workflow_acl->checkUserGroupAccessToType('ORG', $GLOBALS['phpgw_info']['user']['account_id']);
+		$isAdmin = $this->workflow_acl->checkWorkflowAdmin(Settings::get('expresso', 'user', 'account_id'));
+		$isOrgchartManager = $this->workflow_acl->checkUserGroupAccessToType('ORG', Settings::get('expresso', 'user', 'account_id'));
 
 		if (!($isAdmin || $isOrgchartManager))
Index: /sandbox/workflow/branches/993/inc/class.ui_adminaccess.inc.php
===================================================================
--- /sandbox/workflow/branches/993/inc/class.ui_adminaccess.inc.php	(revision 2372)
+++ /sandbox/workflow/branches/993/inc/class.ui_adminaccess.inc.php	(revision 2492)
@@ -41,5 +41,5 @@
 	function ui_adminaccess()
 	{
-		if (!Factory::getInstance('workflow_acl')->checkWorkflowAdmin($GLOBALS['phpgw_info']['user']['account_id']))
+		if (!Factory::getInstance('workflow_acl')->checkWorkflowAdmin(Settings::get('expresso', 'user', 'account_id')))
 		{
 			$GLOBALS['phpgw']->common->phpgw_header();
Index: /sandbox/workflow/branches/993/index.php
===================================================================
--- /sandbox/workflow/branches/993/index.php	(revision 2418)
+++ /sandbox/workflow/branches/993/index.php	(revision 2492)
@@ -46,5 +46,5 @@
 	else
 	{
-		$start_tab = $GLOBALS['phpgw_info']['user']['preferences']['workflow']['startpage'];
+		$start_tab = Settings::get('workflow', 'preferences', 'startpage');
 		if (is_null($start_tab))
 			$start_tab = 1;
