From c312bc95e57549f6d4a0c9cc325e10006c08a015 Mon Sep 17 00:00:00 2001 From: Julio Cesar Laura Date: Wed, 19 Sep 2012 14:48:38 -0400 Subject: [PATCH] BUG 9688 Plugin Updates dont work when proxy is required SOLVED - There are not way to set the proxy to use - Added settings for the proxy in ProcessMaker --- gulliver/system/class.soapNtlm.php | 32 ++ .../engine/classes/class.dashletRssReader.php | 32 +- workflow/engine/classes/class.processes.php | 70 +++- .../classes/class.serverConfiguration.php | 4 +- workflow/engine/classes/class.solr.php | 254 ++++++++++---- workflow/engine/classes/class.system.php | 11 +- .../classes/triggers/api/class.zimbraApi.php | 15 +- .../triggers/class.pmSugarFunctions.php | 35 +- .../triggers/class.pmTalendFunctions.php | 14 + .../classes/triggers/class.pmTrZimbra.php | 24 +- workflow/engine/controllers/adminProxy.php | 15 + .../services/processHeartBeat_Ajax.php | 30 +- .../engine/methods/setup/webServicesAjax.php | 323 +++++++++--------- workflow/engine/templates/admin/system.js | 81 ++++- 14 files changed, 691 insertions(+), 249 deletions(-) diff --git a/gulliver/system/class.soapNtlm.php b/gulliver/system/class.soapNtlm.php index 28df9f37a..db8cce921 100755 --- a/gulliver/system/class.soapNtlm.php +++ b/gulliver/system/class.soapNtlm.php @@ -197,6 +197,22 @@ class soapNtlm { curl_setopt($this->ch, CURLOPT_HTTPAUTH, CURLAUTH_NTLM); //curl_setopt($this->ch, CURLOPT_USERPWD, $this->options['auth']); // Hugo's code curl_setopt($this->ch, CURLOPT_USERPWD, $this->getuser().':'.$this->getpassword());// Ankit's code + + //Apply proxy settings + if (class_exists('System')) { + $sysConf = System::getSystemConfiguration(); + if ($sysConf['proxy_host'] != '') { + curl_setopt($this->ch, CURLOPT_PROXY, $sysConf['proxy_host'] . ($sysConf['proxy_port'] != '' ? ':' . $sysConf['proxy_port'] : '')); + if ($sysConf['proxy_port'] != '') { + curl_setopt($this->ch, CURLOPT_PROXYPORT, $sysConf['proxy_port']); + } + if ($sysConf['proxy_user'] != '') { + curl_setopt($this->ch, CURLOPT_PROXYUSERPWD, $sysConf['proxy_user'] . ($sysConf['proxy_pass'] != '' ? ':' . $sysConf['proxy_pass'] : '')); + } + curl_setopt($this->ch, CURLOPT_HTTPHEADER, array('Expect:')); + } + } + echo $this->buffer = curl_exec($this->ch); //echo "[NTLMStream::createBuffer] buffer size : " . strlen($this->buffer) . "bytes
"; @@ -229,6 +245,22 @@ class NTLMSoapClient extends SoapClient { curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_NTLM); //curl_setopt($ch, CURLOPT_USERPWD, $this->options['auth']); //Hugo's Code curl_setopt($ch, CURLOPT_USERPWD, $this->user.':'.$this->password); //Ankit's Code + + //Apply proxy settings + if (class_exists('System')) { + $sysConf = System::getSystemConfiguration(); + if ($sysConf['proxy_host'] != '') { + curl_setopt($ch, CURLOPT_PROXY, $sysConf['proxy_host'] . ($sysConf['proxy_port'] != '' ? ':' . $sysConf['proxy_port'] : '')); + if ($sysConf['proxy_port'] != '') { + curl_setopt($ch, CURLOPT_PROXYPORT, $sysConf['proxy_port']); + } + if ($sysConf['proxy_user'] != '') { + curl_setopt($ch, CURLOPT_PROXYUSERPWD, $sysConf['proxy_user'] . ($sysConf['proxy_pass'] != '' ? ':' . $sysConf['proxy_pass'] : '')); + } + curl_setopt($ch, CURLOPT_HTTPHEADER, array('Expect:')); + } + } + $response = curl_exec($ch); return $response; diff --git a/workflow/engine/classes/class.dashletRssReader.php b/workflow/engine/classes/class.dashletRssReader.php index 4d29783ac..28d5fea61 100644 --- a/workflow/engine/classes/class.dashletRssReader.php +++ b/workflow/engine/classes/class.dashletRssReader.php @@ -32,8 +32,36 @@ class dashletRssReader implements DashletInterface { } public function render ($width = 300) { - $self->url = $this->urlFrom; - $self->rss = @simplexml_load_file($self->url); + $pCurl = curl_init(); + curl_setopt($pCurl, CURLOPT_URL, $this->urlFrom); + curl_setopt($pCurl, CURLOPT_RETURNTRANSFER, true); + curl_setopt($pCurl, CURLOPT_FOLLOWLOCATION, false); + curl_setopt($pCurl, CURLOPT_AUTOREFERER, true); + //To avoid SSL error + curl_setopt($pCurl, CURLOPT_SSL_VERIFYHOST, 0); + curl_setopt($pCurl, CURLOPT_SSL_VERIFYPEER, 0); + + //To avoid timeouts + curl_setopt($pCurl, CURLOPT_CONNECTTIMEOUT, 10); + curl_setopt($pCurl, CURLOPT_TIMEOUT, 20); + + curl_setopt($pCurl, CURLOPT_NOPROGRESS, false); + curl_setopt($pCurl, CURLOPT_VERBOSE, true); + + //Apply proxy settings + $sysConf = System::getSystemConfiguration(); + if ($sysConf['proxy_host'] != '') { + curl_setopt($pCurl, CURLOPT_PROXY, $sysConf['proxy_host'] . ($sysConf['proxy_port'] != '' ? ':' . $sysConf['proxy_port'] : '')); + if ($sysConf['proxy_port'] != '') { + curl_setopt($pCurl, CURLOPT_PROXYPORT, $sysConf['proxy_port']); + } + if ($sysConf['proxy_user'] != '') { + curl_setopt($pCurl, CURLOPT_PROXYUSERPWD, $sysConf['proxy_user'] . ($sysConf['proxy_pass'] != '' ? ':' . $sysConf['proxy_pass'] : '')); + } + curl_setopt($pCurl, CURLOPT_HTTPHEADER, array('Expect:')); + } + + $self->rss = @simplexml_load_string(curl_exec($pCurl)); if($self->rss) { $index= 0; diff --git a/workflow/engine/classes/class.processes.php b/workflow/engine/classes/class.processes.php index cf06b486f..0736c23c9 100755 --- a/workflow/engine/classes/class.processes.php +++ b/workflow/engine/classes/class.processes.php @@ -3334,7 +3334,21 @@ class Processes { global $client; $endpoint = PML_WSDL_URL; $sessionId = ''; - $client = new SoapClient( $endpoint ); + $proxy = array(); + $sysConf = System::getSystemConfiguration(); + if ($sysConf['proxy_host'] != '') { + $proxy['proxy_host'] = $sysConf['proxy_host']; + if ($sysConf['proxy_port'] != '') { + $proxy['proxy_port'] = $sysConf['proxy_port']; + } + if ($sysConf['proxy_user'] != '') { + $proxy['proxy_login'] = $sysConf['proxy_user']; + } + if ($sysConf['proxy_pass'] != '') { + $proxy['proxy_password'] = $sysConf['proxy_pass']; + } + } + $client = new SoapClient($endpoint, $proxy); $params = array('userid'=>$user, 'password'=>$pass ); $result = $client->__SoapCall('login', array($params)); @@ -3359,10 +3373,24 @@ class Processes { $endpoint = PML_WSDL_URL; $sessionId = ''; ini_set("soap.wsdl_cache_enabled", "0"); // enabling WSDL cache - try{ - $client = @new SoapClient( $endpoint ); - }catch (Exception $e){ - throw ( new Exception ( $e->message ) ); + try { + $proxy = array(); + $sysConf = System::getSystemConfiguration(); + if ($sysConf['proxy_host'] != '') { + $proxy['proxy_host'] = $sysConf['proxy_host']; + if ($sysConf['proxy_port'] != '') { + $proxy['proxy_port'] = $sysConf['proxy_port']; + } + if ($sysConf['proxy_user'] != '') { + $proxy['proxy_login'] = $sysConf['proxy_user']; + } + if ($sysConf['proxy_pass'] != '') { + $proxy['proxy_password'] = $sysConf['proxy_pass']; + } + } + $client = @new SoapClient($endpoint, $proxy); + } catch (Exception $e) { + throw ( new Exception ( $e->message ) ); } @@ -3378,7 +3406,21 @@ class Processes { global $client; $endpoint = PML_WSDL_URL; - $client = new SoapClient( $endpoint ); + $proxy = array(); + $sysConf = System::getSystemConfiguration(); + if ($sysConf['proxy_host'] != '') { + $proxy['proxy_host'] = $sysConf['proxy_host']; + if ($sysConf['proxy_port'] != '') { + $proxy['proxy_port'] = $sysConf['proxy_port']; + } + if ($sysConf['proxy_user'] != '') { + $proxy['proxy_login'] = $sysConf['proxy_user']; + } + if ($sysConf['proxy_pass'] != '') { + $proxy['proxy_password'] = $sysConf['proxy_pass']; + } + } + $client = new SoapClient($endpoint, $proxy); $sessionId = ''; $params = array('sessionId'=>$sessionId ); @@ -3433,7 +3475,21 @@ class Processes { global $client; $endpoint = PML_WSDL_URL; - $client = new SoapClient( $endpoint ); + $proxy = array(); + $sysConf = System::getSystemConfiguration(); + if ($sysConf['proxy_host'] != '') { + $proxy['proxy_host'] = $sysConf['proxy_host']; + if ($sysConf['proxy_port'] != '') { + $proxy['proxy_port'] = $sysConf['proxy_port']; + } + if ($sysConf['proxy_user'] != '') { + $proxy['proxy_login'] = $sysConf['proxy_user']; + } + if ($sysConf['proxy_pass'] != '') { + $proxy['proxy_password'] = $sysConf['proxy_pass']; + } + } + $client = new SoapClient($endpoint, $proxy); $sessionId = ''; $params = array('sessionId'=>$sessionId , 'processId'=> $proId); diff --git a/workflow/engine/classes/class.serverConfiguration.php b/workflow/engine/classes/class.serverConfiguration.php index 1e0856c40..85dfef7ac 100755 --- a/workflow/engine/classes/class.serverConfiguration.php +++ b/workflow/engine/classes/class.serverConfiguration.php @@ -50,7 +50,7 @@ class serverConf { private $pmVersion; private $pmProduct = 'PMCE'; private $nextBeatDate; - var $logins; + public $logins; private $lanDirection; private $lanLanguage; public $workspaces = array(); @@ -402,7 +402,7 @@ class serverConf { return null; } } - + function isRtl ($lang = SYS_LANG) { $lang = substr($lang, 0, 2); return in_array($lang, $this->rtlLang); diff --git a/workflow/engine/classes/class.solr.php b/workflow/engine/classes/class.solr.php index db4ae1f97..52061bad4 100644 --- a/workflow/engine/classes/class.solr.php +++ b/workflow/engine/classes/class.solr.php @@ -24,7 +24,7 @@ /** - * Interface to the Solr Search server + * Interface to the Solr Search server * @author Herbert Saal Gutierrez * */ @@ -33,14 +33,14 @@ class BpmnEngine_SearchIndexAccess_Solr const SOLR_VERSION = '&version=2.2'; private $_solrIsEnabled = false; private $_solrHost = ""; - + public function __construct($solrIsEnabled = false, $solrHost = "") { // use the parameters to initialize class $this->_solrIsEnabled = $solrIsEnabled; $this->_solrHost = $solrHost; } - + /** * Verify if the Solr service is available * @gearman = false @@ -52,10 +52,10 @@ class BpmnEngine_SearchIndexAccess_Solr public function isEnabled() { // verify solr server response - + return $this->_solrIsEnabled; } - + /** * Returns the total number of indexed documents * @gearman = false @@ -71,19 +71,33 @@ class BpmnEngine_SearchIndexAccess_Solr if (! $this->_solrIsEnabled) return; // get configuration information in base to workspace parameter - + // get total number of documents in registry $solrIntruct = (substr ($this->_solrHost, - 1) == "/") ? $this->_solrHost : $this->_solrHost . "/"; $solrIntruct .= $workspace; $solrIntruct .= "/select/?q=*:*"; $solrIntruct .= self::SOLR_VERSION; $solrIntruct .= "&start=0&rows=0&echoParams=none&wt=json"; - + $handlerTotal = curl_init ($solrIntruct); curl_setopt ($handlerTotal, CURLOPT_RETURNTRANSFER, true); + + //Apply proxy settings + $sysConf = System::getSystemConfiguration(); + if ($sysConf['proxy_host'] != '') { + curl_setopt($handlerTotal, CURLOPT_PROXY, $sysConf['proxy_host'] . ($sysConf['proxy_port'] != '' ? ':' . $sysConf['proxy_port'] : '')); + if ($sysConf['proxy_port'] != '') { + curl_setopt($handlerTotal, CURLOPT_PROXYPORT, $sysConf['proxy_port']); + } + if ($sysConf['proxy_user'] != '') { + curl_setopt($handlerTotal, CURLOPT_PROXYUSERPWD, $sysConf['proxy_user'] . ($sysConf['proxy_pass'] != '' ? ':' . $sysConf['proxy_pass'] : '')); + } + curl_setopt($handlerTotal, CURLOPT_HTTPHEADER, array('Expect:')); + } + $responseTotal = curl_exec ($handlerTotal); curl_close ($handlerTotal); - + // verify the result of solr $responseSolrTotal = G::json_decode ($responseTotal); if ($responseSolrTotal->responseHeader->status != 0) { @@ -92,7 +106,7 @@ class BpmnEngine_SearchIndexAccess_Solr $numTotalDocs = $responseSolrTotal->response->numFound; return $numTotalDocs; } - + /** * Execute a query in base to Requested data * @gearman = false @@ -108,7 +122,7 @@ class BpmnEngine_SearchIndexAccess_Solr $solrIntruct = ''; // get configuration information in base to workspace parameter $workspace = $solrRequestData->workspace; - + // format request $query = empty ($solrRequestData->searchText) ? '*:*' : $solrRequestData->searchText; $query = rawurlencode ($query); @@ -125,7 +139,7 @@ class BpmnEngine_SearchIndexAccess_Solr for ($i = 0; $i < $solrRequestData->numSortingCols; $i ++) { $sort .= $solrRequestData->sortCols [$i] . "%20" . $solrRequestData->sortDir [$i] . ","; } - + $sort = substr_replace ($sort, "", - 1); } $resultFormat = empty ($solrRequestData->resultFormat) ? '' : '&wt=' . $solrRequestData->resultFormat; @@ -134,7 +148,7 @@ class BpmnEngine_SearchIndexAccess_Solr foreach ($aFilters as $value) { $filters .= '&fq=' . urlencode ($value); } - + $solrIntruct = (substr ($this->_solrHost, - 1) == "/") ? $this->_solrHost : $this->_solrHost . "/"; $solrIntruct .= $workspace; $solrIntruct .= "/select/?q=$query"; @@ -150,18 +164,32 @@ class BpmnEngine_SearchIndexAccess_Solr // search the cases in base to datatable parameters $handler = curl_init ($solrIntruct); curl_setopt ($handler, CURLOPT_RETURNTRANSFER, true); + + //Apply proxy settings + $sysConf = System::getSystemConfiguration(); + if ($sysConf['proxy_host'] != '') { + curl_setopt($handler, CURLOPT_PROXY, $sysConf['proxy_host'] . ($sysConf['proxy_port'] != '' ? ':' . $sysConf['proxy_port'] : '')); + if ($sysConf['proxy_port'] != '') { + curl_setopt($handler, CURLOPT_PROXYPORT, $sysConf['proxy_port']); + } + if ($sysConf['proxy_user'] != '') { + curl_setopt($handler, CURLOPT_PROXYUSERPWD, $sysConf['proxy_user'] . ($sysConf['proxy_pass'] != '' ? ':' . $sysConf['proxy_pass'] : '')); + } + curl_setopt($handler, CURLOPT_HTTPHEADER, array('Expect:')); + } + $response = curl_exec ($handler); curl_close ($handler); - + // decode $responseSolr = G::json_decode ($response); if ($responseSolr->responseHeader->status != 0) { throw new Exception ("Error executing query to Solr." . $solrIntruct . " response error: " . $response . "\n"); } - + return $responseSolr; } - + /** * Insert or Update document index * @gearman = false @@ -179,23 +207,37 @@ class BpmnEngine_SearchIndexAccess_Solr $solrIntruct = (substr ($this->_solrHost, - 1) == "/") ? $this->_solrHost : $this->_solrHost . "/"; $solrIntruct .= $solrUpdateDocument->workspace; $solrIntruct .= "/update"; - + $handler = curl_init ($solrIntruct); curl_setopt ($handler, CURLOPT_RETURNTRANSFER, true); curl_setopt ($handler, CURLOPT_HTTPHEADER, array ( - 'Content-type:application/xml' + 'Content-type:application/xml' )); // -H curl_setopt ($handler, CURLOPT_BINARYTRANSFER, TRUE); // --data-binary curl_setopt ($handler, CURLOPT_POSTFIELDS, $solrUpdateDocument->document); // data + + //Apply proxy settings + $sysConf = System::getSystemConfiguration(); + if ($sysConf['proxy_host'] != '') { + curl_setopt($handler, CURLOPT_PROXY, $sysConf['proxy_host'] . ($sysConf['proxy_port'] != '' ? ':' . $sysConf['proxy_port'] : '')); + if ($sysConf['proxy_port'] != '') { + curl_setopt($handler, CURLOPT_PROXYPORT, $sysConf['proxy_port']); + } + if ($sysConf['proxy_user'] != '') { + curl_setopt($handler, CURLOPT_PROXYUSERPWD, $sysConf['proxy_user'] . ($sysConf['proxy_pass'] != '' ? ':' . $sysConf['proxy_pass'] : '')); + } + curl_setopt($handler, CURLOPT_HTTPHEADER, array('Expect:')); + } + $response = curl_exec ($handler); curl_close ($handler); - + $swOk = strpos ($response, '0'); if (! $swOk) { throw new Exception ("Error updating document in Solr." . $solrIntruct . " response error: " . $response . "\n"); } } - + /** * Commit the changes since the last commit * @gearman = false @@ -213,23 +255,37 @@ class BpmnEngine_SearchIndexAccess_Solr $solrIntruct = (substr ($this->_solrHost, - 1) == "/") ? $this->_solrHost : $this->_solrHost . "/"; $solrIntruct .= $workspace; $solrIntruct .= "/update"; - + $handler = curl_init ($solrIntruct); curl_setopt ($handler, CURLOPT_RETURNTRANSFER, true); curl_setopt ($handler, CURLOPT_HTTPHEADER, array ( - 'Content-type:application/xml' + 'Content-type:application/xml' )); // -H curl_setopt ($handler, CURLOPT_BINARYTRANSFER, TRUE); // --data-binary curl_setopt ($handler, CURLOPT_POSTFIELDS, ""); // data + + //Apply proxy settings + $sysConf = System::getSystemConfiguration(); + if ($sysConf['proxy_host'] != '') { + curl_setopt($handler, CURLOPT_PROXY, $sysConf['proxy_host'] . ($sysConf['proxy_port'] != '' ? ':' . $sysConf['proxy_port'] : '')); + if ($sysConf['proxy_port'] != '') { + curl_setopt($handler, CURLOPT_PROXYPORT, $sysConf['proxy_port']); + } + if ($sysConf['proxy_user'] != '') { + curl_setopt($handler, CURLOPT_PROXYUSERPWD, $sysConf['proxy_user'] . ($sysConf['proxy_pass'] != '' ? ':' . $sysConf['proxy_pass'] : '')); + } + curl_setopt($handler, CURLOPT_HTTPHEADER, array('Expect:')); + } + $response = curl_exec ($handler); curl_close ($handler); - + $swOk = strpos ($response, '0'); if (! $swOk) { throw new Exception ("Error commiting changes in Solr." . $solrIntruct . " response error: " . $response . "\n"); } } - + /** * Rollback the changes since the last commit * @gearman = false @@ -242,29 +298,43 @@ class BpmnEngine_SearchIndexAccess_Solr { if (! $this->_solrIsEnabled) return; - + $solrIntruct = ''; // get configuration information in base to workspace parameter $solrIntruct = (substr ($this->_solrHost, - 1) == "/") ? $this->_solrHost : $this->_solrHost . "/"; $solrIntruct .= $workspace; $solrIntruct .= "/update"; - + $handler = curl_init ($solrIntruct); curl_setopt ($handler, CURLOPT_RETURNTRANSFER, true); curl_setopt ($handler, CURLOPT_HTTPHEADER, array ( - 'Content-type:application/xml' + 'Content-type:application/xml' )); // -H curl_setopt ($handler, CURLOPT_BINARYTRANSFER, TRUE); // --data-binary curl_setopt ($handler, CURLOPT_POSTFIELDS, ""); // data + + //Apply proxy settings + $sysConf = System::getSystemConfiguration(); + if ($sysConf['proxy_host'] != '') { + curl_setopt($handler, CURLOPT_PROXY, $sysConf['proxy_host'] . ($sysConf['proxy_port'] != '' ? ':' . $sysConf['proxy_port'] : '')); + if ($sysConf['proxy_port'] != '') { + curl_setopt($handler, CURLOPT_PROXYPORT, $sysConf['proxy_port']); + } + if ($sysConf['proxy_user'] != '') { + curl_setopt($handler, CURLOPT_PROXYUSERPWD, $sysConf['proxy_user'] . ($sysConf['proxy_pass'] != '' ? ':' . $sysConf['proxy_pass'] : '')); + } + curl_setopt($handler, CURLOPT_HTTPHEADER, array('Expect:')); + } + $response = curl_exec ($handler); curl_close ($handler); - + $swOk = strpos ($response, '0'); if (! $swOk) { throw new Exception ("Error rolling back changes in Solr." . $solrIntruct . " response error: " . $response . "\n"); } } - + /** * Optimize Solr index * @gearman = false @@ -277,32 +347,46 @@ class BpmnEngine_SearchIndexAccess_Solr { if (! $this->_solrIsEnabled) return; - + $solrIntruct = ''; // get configuration information in base to workspace parameter $solrIntruct = (substr ($this->_solrHost, - 1) == "/") ? $this->_solrHost : $this->_solrHost . "/"; $solrIntruct .= $workspace; $solrIntruct .= "/update"; - + $handler = curl_init ($solrIntruct); curl_setopt ($handler, CURLOPT_RETURNTRANSFER, true); curl_setopt ($handler, CURLOPT_HTTPHEADER, array ( - 'Content-type:application/xml' + 'Content-type:application/xml' )); // -H curl_setopt ($handler, CURLOPT_BINARYTRANSFER, TRUE); // --data-binary curl_setopt ($handler, CURLOPT_POSTFIELDS, ""); // data + + //Apply proxy settings + $sysConf = System::getSystemConfiguration(); + if ($sysConf['proxy_host'] != '') { + curl_setopt($handler, CURLOPT_PROXY, $sysConf['proxy_host'] . ($sysConf['proxy_port'] != '' ? ':' . $sysConf['proxy_port'] : '')); + if ($sysConf['proxy_port'] != '') { + curl_setopt($handler, CURLOPT_PROXYPORT, $sysConf['proxy_port']); + } + if ($sysConf['proxy_user'] != '') { + curl_setopt($handler, CURLOPT_PROXYUSERPWD, $sysConf['proxy_user'] . ($sysConf['proxy_pass'] != '' ? ':' . $sysConf['proxy_pass'] : '')); + } + curl_setopt($handler, CURLOPT_HTTPHEADER, array('Expect:')); + } + $response = curl_exec ($handler); curl_close ($handler); - + $swOk = strpos ($response, '0'); if (! $swOk) { throw new Exception ("Error optimizing changes in Solr." . $solrIntruct . " response error: " . $response . "\n"); } } - + /** * Return the list of the stored fields in Solr - * + * * @param string $workspace * Solr instance name * @throws Exception @@ -312,15 +396,29 @@ class BpmnEngine_SearchIndexAccess_Solr { if (! $this->_solrIsEnabled) return; - + $solrIntruct = ''; // get configuration information in base to workspace parameter $solrIntruct = (substr ($this->_solrHost, - 1) == "/") ? $this->_solrHost : $this->_solrHost . "/"; $solrIntruct .= $workspace; $solrIntruct .= "/admin/luke?numTerms=0&wt=json"; - + $handler = curl_init ($solrIntruct); curl_setopt ($handler, CURLOPT_RETURNTRANSFER, true); + + //Apply proxy settings + $sysConf = System::getSystemConfiguration(); + if ($sysConf['proxy_host'] != '') { + curl_setopt($handler, CURLOPT_PROXY, $sysConf['proxy_host'] . ($sysConf['proxy_port'] != '' ? ':' . $sysConf['proxy_port'] : '')); + if ($sysConf['proxy_port'] != '') { + curl_setopt($handler, CURLOPT_PROXYPORT, $sysConf['proxy_port']); + } + if ($sysConf['proxy_user'] != '') { + curl_setopt($handler, CURLOPT_PROXYUSERPWD, $sysConf['proxy_user'] . ($sysConf['proxy_pass'] != '' ? ':' . $sysConf['proxy_pass'] : '')); + } + curl_setopt($handler, CURLOPT_HTTPHEADER, array('Expect:')); + } + $response = curl_exec ($handler); curl_close ($handler); // decode @@ -330,7 +428,7 @@ class BpmnEngine_SearchIndexAccess_Solr } return $responseSolr; } - + /** * Delete all documents from index * @gearman = false @@ -344,30 +442,44 @@ class BpmnEngine_SearchIndexAccess_Solr if (! $this->_solrIsEnabled) return; // $registry = Zend_Registry::getInstance(); - + $solrIntruct = ''; // get configuration information in base to workspace parameter $solrIntruct = (substr ($this->_solrHost, - 1) == "/") ? $this->_solrHost : $this->_solrHost . "/"; $solrIntruct .= $workspace; $solrIntruct .= "/update"; - + $handler = curl_init ($solrIntruct); curl_setopt ($handler, CURLOPT_RETURNTRANSFER, true); curl_setopt ($handler, CURLOPT_HTTPHEADER, array ( - 'Content-type:application/xml' + 'Content-type:application/xml' )); // -H curl_setopt ($handler, CURLOPT_BINARYTRANSFER, TRUE); // --data-binary curl_setopt ($handler, CURLOPT_POSTFIELDS, "*:*"); // data + + //Apply proxy settings + $sysConf = System::getSystemConfiguration(); + if ($sysConf['proxy_host'] != '') { + curl_setopt($handler, CURLOPT_PROXY, $sysConf['proxy_host'] . ($sysConf['proxy_port'] != '' ? ':' . $sysConf['proxy_port'] : '')); + if ($sysConf['proxy_port'] != '') { + curl_setopt($handler, CURLOPT_PROXYPORT, $sysConf['proxy_port']); + } + if ($sysConf['proxy_user'] != '') { + curl_setopt($handler, CURLOPT_PROXYUSERPWD, $sysConf['proxy_user'] . ($sysConf['proxy_pass'] != '' ? ':' . $sysConf['proxy_pass'] : '')); + } + curl_setopt($handler, CURLOPT_HTTPHEADER, array('Expect:')); + } + $response = curl_exec ($handler); - + curl_close ($handler); - + $swOk = strpos ($response, '0'); if (! $swOk) { throw new Exception ("Error deleting all documents in Solr." . $solrIntruct . " response error: " . $response . "\n"); } } - + /** * Delete specified documents from index * @gearman = false @@ -381,45 +493,59 @@ class BpmnEngine_SearchIndexAccess_Solr if (! $this->_solrIsEnabled) return; // $registry = Zend_Registry::getInstance(); - + $solrIntruct = ''; // get configuration information in base to workspace parameter $solrIntruct = (substr ($this->_solrHost, - 1) == "/") ? $this->_solrHost : $this->_solrHost . "/"; $solrIntruct .= $workspace; $solrIntruct .= "/update"; - + $handler = curl_init ($solrIntruct); curl_setopt ($handler, CURLOPT_RETURNTRANSFER, true); curl_setopt ($handler, CURLOPT_HTTPHEADER, array ( - 'Content-type:application/xml' + 'Content-type:application/xml' )); // -H curl_setopt ($handler, CURLOPT_BINARYTRANSFER, TRUE); // --data-binary curl_setopt ($handler, CURLOPT_POSTFIELDS, "" . $idQuery . ""); // data + + //Apply proxy settings + $sysConf = System::getSystemConfiguration(); + if ($sysConf['proxy_host'] != '') { + curl_setopt($handler, CURLOPT_PROXY, $sysConf['proxy_host'] . ($sysConf['proxy_port'] != '' ? ':' . $sysConf['proxy_port'] : '')); + if ($sysConf['proxy_port'] != '') { + curl_setopt($handler, CURLOPT_PROXYPORT, $sysConf['proxy_port']); + } + if ($sysConf['proxy_user'] != '') { + curl_setopt($handler, CURLOPT_PROXYUSERPWD, $sysConf['proxy_user'] . ($sysConf['proxy_pass'] != '' ? ':' . $sysConf['proxy_pass'] : '')); + } + curl_setopt($handler, CURLOPT_HTTPHEADER, array('Expect:')); + } + $response = curl_exec ($handler); - + curl_close ($handler); - + $swOk = strpos ($response, '0'); if (! $swOk) { throw new Exception ("Error deleting document in Solr." . $solrIntruct . " response error: " . $response . "\n"); } } - + /** * Execute a query in base to Request data * - * @param Entity_FacetRequest $facetRequestEntity + * @param Entity_FacetRequest $facetRequestEntity * @return solr response: list of facets array */ public function getFacetsList($facetRequest) { if (! $this->_solrIsEnabled) return; - + $solrIntruct = ''; // get configuration information in base to workspace parameter $workspace = $facetRequest->workspace; - + // format request $query = empty ($facetRequest->searchText) ? '*:*' : $facetRequest->searchText; $query = rawurlencode ($query); @@ -448,9 +574,9 @@ class BpmnEngine_SearchIndexAccess_Solr $filters .= '&fq=' . $value; } // echo "
";
-    
+
     $resultFormat = '&wt=json';
-    
+
     $solrIntruct = (substr ($this->_solrHost, - 1) == "/") ? $this->_solrHost : $this->_solrHost . "/";
     $solrIntruct .= $workspace;
     $solrIntruct .= "/select/?q=$query";
@@ -461,20 +587,34 @@ class BpmnEngine_SearchIndexAccess_Solr
     $solrIntruct .= $facets;
     $solrIntruct .= $filters;
     $solrIntruct .= $resultFormat;
-    
+
     // send query
     // search the cases in base to datatable parameters
     $handler = curl_init ($solrIntruct);
     curl_setopt ($handler, CURLOPT_RETURNTRANSFER, true);
+
+    //Apply proxy settings
+    $sysConf = System::getSystemConfiguration();
+    if ($sysConf['proxy_host'] != '') {
+      curl_setopt($handler, CURLOPT_PROXY, $sysConf['proxy_host'] . ($sysConf['proxy_port'] != '' ? ':' . $sysConf['proxy_port'] : ''));
+      if ($sysConf['proxy_port'] != '') {
+        curl_setopt($handler, CURLOPT_PROXYPORT, $sysConf['proxy_port']);
+      }
+      if ($sysConf['proxy_user'] != '') {
+        curl_setopt($handler, CURLOPT_PROXYUSERPWD, $sysConf['proxy_user'] . ($sysConf['proxy_pass'] != '' ? ':' . $sysConf['proxy_pass'] : ''));
+      }
+      curl_setopt($handler, CURLOPT_HTTPHEADER, array('Expect:'));
+    }
+
     $response = curl_exec ($handler);
     curl_close ($handler);
-    
+
     // decode
     $responseSolr = G::json_decode ($response);
     if ($responseSolr->responseHeader->status != 0) {
       throw new Exception ("Error getting faceted list from Solr." . $solrIntruct . " response error: " . $response . "\n");
     }
-    
+
     return $responseSolr;
   }
 }
diff --git a/workflow/engine/classes/class.system.php b/workflow/engine/classes/class.system.php
index 1a44a9b3e..c3c016237 100755
--- a/workflow/engine/classes/class.system.php
+++ b/workflow/engine/classes/class.system.php
@@ -1010,6 +1010,7 @@ class System {
 
       if ($_SESSION['PROCESSMAKER_ENV_HASH'] === $hash) {
         $_SESSION['PROCESSMAKER_ENV']['from_cache'] = 1;
+        $_SESSION['PROCESSMAKER_ENV_HASH']['proxy_pass'] = G::decrypt($_SESSION['PROCESSMAKER_ENV_HASH']['proxy_pass'], 'proxy_pass');
         return $_SESSION['PROCESSMAKER_ENV'];
       }
     }
@@ -1026,7 +1027,11 @@ class System {
       'memcached'        => 0,
       'memcached_server' => '',
       'default_skin'     => 'classic',
-      'default_lang'     => 'en'
+      'default_lang'     => 'en',
+      'proxy_host'       => '',
+      'proxy_port'       => '',
+      'proxy_user'       => '',
+      'proxy_pass'       => ''
     );
 
     // read the global env.ini configuration file
@@ -1042,6 +1047,10 @@ class System {
     // validation debug config, only binary value is valid; debug = 1, to enable
     $config['debug'] = $config['debug'] == 1 ? 1 : 0;
 
+    if ($config['proxy_pass'] != '') {
+      $config['proxy_pass'] = G::decrypt($config['proxy_pass'], 'proxy_pass');
+    }
+
     $md5 = array();
     if ($readGlobalIniFile)
       $md5[] = md5_file($globalIniFile);
diff --git a/workflow/engine/classes/triggers/api/class.zimbraApi.php b/workflow/engine/classes/triggers/api/class.zimbraApi.php
index 3178f4d92..9c80cb328 100644
--- a/workflow/engine/classes/triggers/api/class.zimbraApi.php
+++ b/workflow/engine/classes/triggers/api/class.zimbraApi.php
@@ -191,6 +191,19 @@ class Zimbra {
         curl_setopt($this->_curl, CURLOPT_SSL_VERIFYPEER, false);
         curl_setopt($this->_curl, CURLOPT_SSL_VERIFYHOST, false);
 
+        //Apply proxy settings
+        $sysConf = System::getSystemConfiguration();
+        if ($sysConf['proxy_host'] != '') {
+          curl_setopt($this->_curl, CURLOPT_PROXY, $sysConf['proxy_host'] . ($sysConf['proxy_port'] != '' ? ':' . $sysConf['proxy_port'] : ''));
+          if ($sysConf['proxy_port'] != '') {
+            curl_setopt($this->_curl, CURLOPT_PROXYPORT, $sysConf['proxy_port']);
+          }
+          if ($sysConf['proxy_user'] != '') {
+            curl_setopt($this->_curl, CURLOPT_PROXYUSERPWD, $sysConf['proxy_user'] . ($sysConf['proxy_pass'] != '' ? ':' . $sysConf['proxy_pass'] : ''));
+          }
+          curl_setopt($this->_curl, CURLOPT_HTTPHEADER, array('Expect:'));
+        }
+
         $preauth = $this->getPreAuth($this->_username);
         $header = '';
 
@@ -970,7 +983,7 @@ class Zimbra {
         $role = $unserializeOp1['role'];
         $location = $unserializeOp1['location'];
         $ptst = $unserializeOp1['ptst'];
-        
+
         $dateFormat=$allDay=="1"?"Ymd":"Ymd\THis";
         $startDate = date($dateFormat,strtotime($unserializeOp1['startDate']));
         $endDate = date($dateFormat,strtotime($unserializeOp1['endDate']));
diff --git a/workflow/engine/classes/triggers/class.pmSugarFunctions.php b/workflow/engine/classes/triggers/class.pmSugarFunctions.php
index cfb750c5c..94d0ea1ea 100755
--- a/workflow/engine/classes/triggers/class.pmSugarFunctions.php
+++ b/workflow/engine/classes/triggers/class.pmSugarFunctions.php
@@ -16,6 +16,27 @@
 ////////////////////////////////////////////////////
 
 
+function getSoapClientOptions() {
+  $options = array('trace' => 1);
+
+  //Apply proxy settings
+  $sysConf = System::getSystemConfiguration();
+  if ($sysConf['proxy_host'] != '') {
+    $options['proxy_host'] = $sysConf['proxy_host'];
+    if ($sysConf['proxy_port'] != '') {
+      $options['proxy_port'] = $sysConf['proxy_port'];
+    }
+    if ($sysConf['proxy_user'] != '') {
+      $options['proxy_login'] = $sysConf['proxy_user'];
+    }
+    if ($sysConf['proxy_pass'] != '') {
+      $options['proxy_password'] = $sysConf['proxy_pass'];
+    }
+  }
+
+  return $options;
+}
+
 /**
  * This collection of triggers allows to interact by getting and sending information to SugarCRM
  * @class pmSugar
@@ -25,7 +46,7 @@
  */
 
 function sugarLogin($sugarSoap, $user, $password) {
-  $client = new SoapClient ( $sugarSoap, array ('trace' => 1 ) );
+  $client = new SoapClient ( $sugarSoap, getSoapClientOptions() );
   $auth_array = array ('user_auth' => array ('user_name' => $user, 'password' => md5 ( $password ), 'version' => '1.0' ) );
   $login_results = $client->__SoapCall ( 'login', $auth_array );
 
@@ -67,7 +88,7 @@ function objectToArray($object) {
 
 function GetSugarEntry($sugarSoap, $user, $password, $module, $id, $selectFields, $linkNameToFieldsArray, $resultType = 'array') {
     $sessionId = sugarLogin ( $sugarSoap, $user, $password );
-    $client = new SoapClient ( $sugarSoap, array ('trace' => 1 ) );
+    $client = new SoapClient ( $sugarSoap, getSoapClientOptions() );
     $request_array = array ('session' => $sessionId, 'module_name' => $module, 'id' => $id,
             'select_fields' => $select_fields, 'link_name_to_fields_array' => $linkNameToFieldsArray);
     $sugarEntry = $client->__SoapCall ( 'get_entry', $request_array );
@@ -103,7 +124,7 @@ function GetSugarEntry($sugarSoap, $user, $password, $module, $id, $selectFields
 
 function GetSugarEntries($sugarSoap, $user, $password, $module, $query, $orderBy, $selectedFields, $maxResults, $resultType="array") {
   $sessionId = sugarLogin ( $sugarSoap, $user, $password );
-  $client = new SoapClient ( $sugarSoap, array ('trace' => 1 ) );
+  $client = new SoapClient ( $sugarSoap, getSoapClientOptions() );
   $request_array = array ('session' => $sessionId, 'module_name' => $module, 'query' => $query, 'order_by' => $orderBy, 'offset'=>"", 'select_fields'=>"", 'max_result'=>$maxResults );
   $sugarEntriesO = $client->__SoapCall ( 'get_entry_list', $request_array );
 
@@ -266,7 +287,7 @@ function CreateSugarAccount($sugarSoap, $user, $password, $name,  $resultType="a
 
   $module = "Accounts";
   $sessionId = sugarLogin ( $sugarSoap, $user, $password );
-  $client = new SoapClient ( $sugarSoap, array ('trace' => 1 ) );
+  $client = new SoapClient ( $sugarSoap, getSoapClientOptions() );
   $request_array = array ('session' => $sessionId, 'module_name' => $module, 'name_value_list' => array(
             array("name" => 'name', "value" => $name )
             ) );
@@ -315,7 +336,7 @@ function CreateSugarContact($sugarSoap, $user, $password, $first_name, $last_nam
     );
 */
   $sessionId = sugarLogin ( $sugarSoap, $user, $password );
-  $client = new SoapClient ( $sugarSoap, array ('trace' => 1 ) );
+  $client = new SoapClient ( $sugarSoap, getSoapClientOptions() );
 
   $request_array = array ('session' => $sessionId, 'module_name' => $module, array(
             array("name" => 'first_name',"value" => $first_name),
@@ -374,7 +395,7 @@ function CreateSugarOpportunity($sugarSoap, $user, $password, $name,$account_id,
         );*/
 
   $sessionId = sugarLogin ( $sugarSoap, $user, $password );
-  $client = new SoapClient ( $sugarSoap, array ('trace' => 1 ) );
+  $client = new SoapClient ( $sugarSoap, getSoapClientOptions() );
 
   $request_array = array ('session' => $sessionId, 'module_name' => $module, 'name_value_list' =>array(
                       array('name' => 'name','value' => $name),
@@ -423,7 +444,7 @@ function CreateSugarLeads($sugarSoap, $user, $password, $first_name, $last_name,
 
   $module = "Leads";
   $sessionId = sugarLogin ( $sugarSoap, $user, $password );
-  $client = new SoapClient ( $sugarSoap, array ('trace' => 1 ) );
+  $client = new SoapClient ( $sugarSoap, getSoapClientOptions() );
 
   $request_array = array ('session' => $sessionId, 'module_name' => $module, array(
             array("name" => 'first_name',"value" => $first_name),
diff --git a/workflow/engine/classes/triggers/class.pmTalendFunctions.php b/workflow/engine/classes/triggers/class.pmTalendFunctions.php
index 3b9c70abf..87c2d4f2c 100755
--- a/workflow/engine/classes/triggers/class.pmTalendFunctions.php
+++ b/workflow/engine/classes/triggers/class.pmTalendFunctions.php
@@ -42,6 +42,20 @@
  */
 function executeTalendWebservice($wsdl,$params=array(),  $message){
   $client = new SoapClient($wsdl,array('trace' => 1));
+
+  //Apply proxy settings
+  $sysConf = System::getSystemConfiguration();
+  if ($sysConf['proxy_host'] != '') {
+    curl_setopt($client, CURLOPT_PROXY, $sysConf['proxy_host'] . ($sysConf['proxy_port'] != '' ? ':' . $sysConf['proxy_port'] : ''));
+    if ($sysConf['proxy_port'] != '') {
+      curl_setopt($client, CURLOPT_PROXYPORT, $sysConf['proxy_port']);
+    }
+    if ($sysConf['proxy_user'] != '') {
+      curl_setopt($client, CURLOPT_PROXYUSERPWD, $sysConf['proxy_user'] . ($sysConf['proxy_pass'] != '' ? ':' . $sysConf['proxy_pass'] : ''));
+    }
+    curl_setopt($client, CURLOPT_HTTPHEADER, array('Expect:'));
+  }
+
   $params[0]="";
   foreach($params as $paramO){
     $params[]="--context_param".$paramO[0]."=".$paramO[1];
diff --git a/workflow/engine/classes/triggers/class.pmTrZimbra.php b/workflow/engine/classes/triggers/class.pmTrZimbra.php
index f78812b40..f1c894d7d 100644
--- a/workflow/engine/classes/triggers/class.pmTrZimbra.php
+++ b/workflow/engine/classes/triggers/class.pmTrZimbra.php
@@ -383,25 +383,39 @@ function uploadZimbraFile($ServerUrl, $username, $preAuthKey, $folderName, $file
     curl_setopt ($ch, CURLOPT_NOPROGRESS, false);
     curl_setopt ($ch, CURLOPT_VERBOSE, true);
     curl_setopt ($ch, CURLOPT_HTTPHEADER,$header_array);
+
+    //Apply proxy settings
+    $sysConf = System::getSystemConfiguration();
+    if ($sysConf['proxy_host'] != '') {
+      curl_setopt($ch, CURLOPT_PROXY, $sysConf['proxy_host'] . ($sysConf['proxy_port'] != '' ? ':' . $sysConf['proxy_port'] : ''));
+      if ($sysConf['proxy_port'] != '') {
+        curl_setopt($ch, CURLOPT_PROXYPORT, $sysConf['proxy_port']);
+      }
+      if ($sysConf['proxy_user'] != '') {
+        curl_setopt($ch, CURLOPT_PROXYUSERPWD, $sysConf['proxy_user'] . ($sysConf['proxy_pass'] != '' ? ':' . $sysConf['proxy_pass'] : ''));
+      }
+      curl_setopt($ch, CURLOPT_HTTPHEADER, array('Expect:'));
+    }
+
     if( ! $response = curl_exec($ch))
     {
        return "Upload error. Connection Error";
     }
-    
+
     //G::pr($response);
-    
+
     $header_size = curl_getinfo($ch,CURLINFO_HEADER_SIZE);
     $result['header'] = substr($response, 0, $header_size);
     $result['body'] = substr( $response, $header_size );
     $result['http_code'] = curl_getinfo($ch,CURLINFO_HTTP_CODE);
     $result['last_url'] = curl_getinfo($ch,CURLINFO_EFFECTIVE_URL);
-    
+
     $aString = array();
     $aExplode = explode(",", $result['body']);
     $uploadID = substr($aExplode[2], 1, -2);
-    
+
     curl_close($ch);
-    
+
        // gettin FOlder ID
 
     $FolderResult = $oZimbraObj->getFolder($folderName);
diff --git a/workflow/engine/controllers/adminProxy.php b/workflow/engine/controllers/adminProxy.php
index 62c412e48..3cdc11b81 100644
--- a/workflow/engine/controllers/adminProxy.php
+++ b/workflow/engine/controllers/adminProxy.php
@@ -71,6 +71,21 @@ class adminProxy extends HttpProxyController
       $updatedConf['memory_limit'] = $httpData->memory_limit;
     }
 
+    if ($sysConf['proxy_host'] != $httpData->proxy_host) {
+      $updatedConf['proxy_host'] = $httpData->proxy_host;
+    }
+
+    if ($sysConf['proxy_port'] != $httpData->proxy_port) {
+      $updatedConf['proxy_port'] = $httpData->proxy_port;
+    }
+
+    if ($sysConf['proxy_user'] != $httpData->proxy_user) {
+      $updatedConf['proxy_user'] = $httpData->proxy_user;
+    }
+
+    if ($sysConf['proxy_pass'] != $httpData->proxy_pass) {
+      $updatedConf['proxy_pass'] = G::encrypt($httpData->proxy_pass, 'proxy_pass');
+    }
 
     if ($updateRedirector) {
       if (!file_exists(PATH_HTML . 'index.html')) {
diff --git a/workflow/engine/methods/services/processHeartBeat_Ajax.php b/workflow/engine/methods/services/processHeartBeat_Ajax.php
index 65050af07..fc700512b 100755
--- a/workflow/engine/methods/services/processHeartBeat_Ajax.php
+++ b/workflow/engine/methods/services/processHeartBeat_Ajax.php
@@ -51,10 +51,21 @@ function file_get_conditional_contents($szURL){
     curl_setopt ( $pCurl, CURLOPT_CONNECTTIMEOUT, 10 );
     curl_setopt ( $pCurl, CURLOPT_TIMEOUT, 20 );
 
-    curl_setopt ( $pCurl, CURLOPT_NOPROGRESS, FALSE);
-    curl_setopt ( $pCurl, CURLOPT_VERBOSE, TRUE);
-
+    curl_setopt ( $pCurl, CURLOPT_NOPROGRESS, false);
+    curl_setopt ( $pCurl, CURLOPT_VERBOSE, true);
 
+    //Apply proxy settings
+    $sysConf = System::getSystemConfiguration();
+    if ($sysConf['proxy_host'] != '') {
+      curl_setopt($pCurl, CURLOPT_PROXY, $sysConf['proxy_host'] . ($sysConf['proxy_port'] != '' ? ':' . $sysConf['proxy_port'] : ''));
+      if ($sysConf['proxy_port'] != '') {
+        curl_setopt($pCurl, CURLOPT_PROXYPORT, $sysConf['proxy_port']);
+      }
+      if ($sysConf['proxy_user'] != '') {
+        curl_setopt($pCurl, CURLOPT_PROXYUSERPWD, $sysConf['proxy_user'] . ($sysConf['proxy_pass'] != '' ? ':' . $sysConf['proxy_pass'] : ''));
+      }
+      curl_setopt($pCurl, CURLOPT_HTTPHEADER, array('Expect:'));
+    }
 
     $szContents = curl_exec($pCurl);
     $aInfo = curl_getinfo($pCurl);
@@ -245,6 +256,19 @@ function buildData(){
     curl_setopt ( $ch, CURLOPT_CONNECTTIMEOUT, 10 );
     curl_setopt ( $ch, CURLOPT_TIMEOUT, 20 );
 
+    //Apply proxy settings
+    $sysConf = System::getSystemConfiguration();
+    if ($sysConf['proxy_host'] != '') {
+      curl_setopt($ch, CURLOPT_PROXY, $sysConf['proxy_host'] . ($sysConf['proxy_port'] != '' ? ':' . $sysConf['proxy_port'] : ''));
+      if ($sysConf['proxy_port'] != '') {
+        curl_setopt($ch, CURLOPT_PROXYPORT, $sysConf['proxy_port']);
+      }
+      if ($sysConf['proxy_user'] != '') {
+        curl_setopt($ch, CURLOPT_PROXYUSERPWD, $sysConf['proxy_user'] . ($sysConf['proxy_pass'] != '' ? ':' . $sysConf['proxy_pass'] : ''));
+      }
+      curl_setopt($ch, CURLOPT_HTTPHEADER, array('Expect:'));
+    }
+
     $response = curl_exec ( $ch );
     $curl_session = curl_getinfo($ch, CURLINFO_HTTP_CODE);
     $headers = curl_getinfo ( $ch );
diff --git a/workflow/engine/methods/setup/webServicesAjax.php b/workflow/engine/methods/setup/webServicesAjax.php
index c1b10fdba..40af50272 100755
--- a/workflow/engine/methods/setup/webServicesAjax.php
+++ b/workflow/engine/methods/setup/webServicesAjax.php
@@ -25,7 +25,7 @@
 ini_set ( "soap.wsdl_cache_enabled", "0" ); // enabling WSDL cache
 
 G::LoadClass ( 'ArrayPeer' );
-if($RBAC->userCanAccess('PM_SETUP') != 1 && $RBAC->userCanAccess('PM_FACTORY') != 1){	
+if($RBAC->userCanAccess('PM_SETUP') != 1 && $RBAC->userCanAccess('PM_FACTORY') != 1){
   G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels');
   //G::header('location: ../login/login');
   die;
@@ -53,13 +53,13 @@ switch ($_POST ['action']) {
 			G::RenderPage ( 'publish', 'raw' );
 		}
 		break;
-	
+
 	case 'showDetails' :
 		G::LoadClass ( 'groups' );
-		
+
 		$dbc = new DBConnection ( );
 		$ses = new DBSession ( $dbc );
-		
+
 		if (! isset ( $_SESSION ['END_POINT'] )) {
 			$aFields ['WS_HOST'] = $_SERVER ['HTTP_HOST'];
 			$aFields ['WS_WORKSPACE'] = SYS_SYS;
@@ -76,16 +76,16 @@ switch ($_POST ['action']) {
 			$aAux = explode ( '/', $aAux [1] );
 			$aFields ['WS_WORKSPACE'] = substr ( $aAux [1], 3 );
 		}
-		
+
 		$rows [] = array ('uid' => 'char', 'name' => 'char', 'age' => 'integer', 'balance' => 'float' );
 		$rows [] = array ('uid' => 'http', 'name' => 'http' );
 		$rows [] = array ('uid' => 'https', 'name' => 'https' );
-		
+
 		global $_DBArray;
   	    $_DBArray = (isset ( $_SESSION ['_DBArray'] ) ? $_SESSION ['_DBArray'] : '');
 		$_DBArray ['protocol'] = $rows;
 		$_SESSION ['_DBArray'] = $_DBArray;
-		
+
 		if (! isset ( $_SESSION ['END_POINT'] )) {
 			//$wsdl = 'http://'.$_SERVER['HTTP_HOST'].'/sys'.SYS_SYS. '/'. SYS_LANG .'/classic/services/wsdl';
 			$wsdl = 'http://' . $_SERVER ['HTTP_HOST'];
@@ -94,25 +94,25 @@ switch ($_POST ['action']) {
 			$wsdl = $_SESSION ['END_POINT'];
 			$workspace = $_SESSION ['WS_WORKSPACE'];
 		}
-		
+
 		$defaultEndpoint = 'http://' . $_SERVER ['SERVER_NAME'] . ':' . $_SERVER ['SERVER_PORT'] . '/sys' . SYS_SYS . '/'. SYS_LANG .'/classic/services/wsdl2';
-		
+
 		$wsdl = isset ( $_SESSION ['END_POINT'] ) ? $_SESSION ['END_POINT'] : $defaultEndpoint;
-		
+
 		$wsSessionId = '';
 		if (isset ( $_SESSION ['WS_SESSION_ID'] )) {
 			$wsSessionId = $_SESSION ['WS_SESSION_ID'];
 		}
-		
+
 		$aFields ['WSDL'] = $wsdl;
 		$aFields ['OS'] = $workspace;
 		$aFields ['WSID'] = $wsSessionId;
-		
+
 		$G_PUBLISH = new Publisher ( );
 		$G_PUBLISH->AddContent ( 'xmlform', 'xmlform', 'setup/webServicesDetails', '', $aFields, 'webServicesSetupSave' );
-		
+
 		G::RenderPage ( "publish", "raw" );
-		
+
 		break;
         case 'showUploadFilesForm':
             global $G_PUBLISH;
@@ -124,7 +124,7 @@ switch ($_POST ['action']) {
 
 			$G_PUBLISH = new Publisher ( );
 			$fields ['SESSION_ID'] = isset ( $_SESSION ['WS_SESSION_ID'] ) ? $_SESSION ['WS_SESSION_ID'] : '';
-			$fields ['ACTION'] = 'wsSendFiles';                       
+			$fields ['ACTION'] = 'wsSendFiles';
 			$G_PUBLISH->AddContent ( 'xmlform', 'xmlform', $xmlform, '', $fields, '../setup/webServicesAjax');
 			G::RenderPage ( 'publish', 'blank' );
 		}
@@ -138,12 +138,29 @@ switch ($_POST ['action']) {
 			$_SESSION ['END_POINT'] = $_POST ["epr"];
 		}
 		$defaultEndpoint = 'http://' . $_SERVER ['SERVER_NAME'] . ':' . $_SERVER ['SERVER_PORT'] . '/sys' . SYS_SYS . '/'. SYS_LANG .'/classic/services/wsdl2';
-		
+
 		$endpoint = isset ( $_SESSION ['END_POINT'] ) ? $_SESSION ['END_POINT'] : $defaultEndpoint;
-		
+
 		$sessionId = isset ( $_SESSION ['SESSION_ID'] ) ? $_SESSION ['SESSION_ID'] : '';
-		@$client = new SoapClient ( $endpoint );
-		
+
+		//Apply proxy settings
+        $proxy = array();
+        $sysConf = System::getSystemConfiguration();
+        if ($sysConf['proxy_host'] != '') {
+          $proxy['proxy_host'] = $sysConf['proxy_host'];
+          if ($sysConf['proxy_port'] != '') {
+            $proxy['proxy_port'] = $sysConf['proxy_port'];
+          }
+          if ($sysConf['proxy_user'] != '') {
+            $proxy['proxy_login'] = $sysConf['proxy_user'];
+          }
+          if ($sysConf['proxy_pass'] != '') {
+            $proxy['proxy_password'] = $sysConf['proxy_pass'];
+          }
+        }
+
+		@$client = new SoapClient($endpoint, $proxy);
+
 		switch ($action) {
 			case "Login" :
 				$user = $frm ["USER_ID"];
@@ -165,13 +182,13 @@ switch ($_POST ['action']) {
 			case "ProcessList" :
 				$sessionId = $frm ["SESSION_ID"];
 				$params = array ('sessionId' => $sessionId );
-				
+
 				$wsResponse = $client->__SoapCall ( 'ProcessList', array ($params ) );
 				$result = G::PMWSCompositeResponse($wsResponse, 'processes');
-				
+
 				$G_PUBLISH = new Publisher();
 				$rows [] = array ('guid' => 'char', 'name' => 'char' );
-				
+
 				if( is_array($result) ){
 					foreach ( $result as $key => $item ) {
 						if (isset ( $item->item ))
@@ -194,14 +211,14 @@ switch ($_POST ['action']) {
 							if (isset ( $item->name ))
 								$name = $item->name;
 						}
-						
+
 						$rows [] = array ('guid' => $guid, 'name' => $name );
 					}
-					global $_DBArray; 
+					global $_DBArray;
         	   		$_DBArray = (isset ( $_SESSION ['_DBArray'] ) ? $_SESSION ['_DBArray'] : '');
     				$_DBArray ['process'] = $rows;
     				$_SESSION ['_DBArray'] = $_DBArray;
-    				
+
     				$c = new Criteria ( 'dbarray' );
     				$c->setDBArrayTable ( 'process' );
     				$c->addAscendingOrderByColumn ( 'name' );
@@ -213,7 +230,7 @@ switch ($_POST ['action']) {
     				$fields ['time_stamp']  = date("Y-m-d H:i:s");
     				$G_PUBLISH->AddContent ( 'xmlform', 'xmlform', 'setup/wsShowResult', null, $fields );
 				}
-      			
+
 				G::RenderPage ( 'publish', 'raw' );
 				break;
 			case "RoleList" :
@@ -221,12 +238,12 @@ switch ($_POST ['action']) {
 				$params = array ('sessionId' => $sessionId );
 				$wsResponse = $client->__SoapCall ( 'RoleList', array ($params ) );
 				$result = G::PMWSCompositeResponse($wsResponse, 'roles');
-				
+
 				$G_PUBLISH = new Publisher ();
-				
+
 				$rows [] = array ('guid' => 'char', 'name' => 'char');
 				if ( is_array ( $result )){
-					
+
 					foreach ( $result as $key => $item ) {
 						if (isset ( $item->item ))
 							foreach ( $item->item as $index => $val ) {
@@ -248,14 +265,14 @@ switch ($_POST ['action']) {
 							if (isset ( $item->name ))
 								$name = $item->name;
 						}
-						
+
 						$rows [] = array ('guid' => $guid, 'name' => $name );
 					}
 					global $_DBArray;
         	  		$_DBArray = (isset ( $_SESSION ['_DBArray'] ) ? $_SESSION ['_DBArray'] : '');
     				$_DBArray ['role'] = $rows;
     				$_SESSION ['_DBArray'] = $_DBArray;
-    				
+
     				G::LoadClass ( 'ArrayPeer' );
     				$c = new Criteria ( 'dbarray' );
     				$c->setDBArrayTable ( 'role' );
@@ -268,16 +285,16 @@ switch ($_POST ['action']) {
     				$fields ['time_stamp']  = date("Y-m-d H:i:s");
     				$G_PUBLISH->AddContent ( 'xmlform', 'xmlform', 'setup/wsShowResult', null, $fields );
 				}
-      			
+
 				G::RenderPage ( 'publish', 'raw' );
 				break;
-				
+
 			case "GroupList" :
 				$sessionId = $frm ["SESSION_ID"];
 				$params = array ('sessionId' => $sessionId );
 				$wsResponse = $client->__SoapCall ( 'GroupList', array ($params ) );
 				$result = G::PMWSCompositeResponse($wsResponse, 'groups');
-				
+
 				$G_PUBLISH = new Publisher ( );
 				$rows [] = array ('guid' => 'char', 'name' => 'char' );
 				if (is_array ( $result )){
@@ -302,14 +319,14 @@ switch ($_POST ['action']) {
 							if (isset ( $item->name ))
 								$name = $item->name;
 						}
-						
+
 						$rows [] = array ('guid' => $guid, 'name' => $name );
 					}
 					global $_DBArray;
         	  		$_DBArray = (isset ( $_SESSION ['_DBArray'] ) ? $_SESSION ['_DBArray'] : '');
     				$_DBArray ['group'] = $rows;
     				$_SESSION ['_DBArray'] = $_DBArray;
-    				
+
     				G::LoadClass ( 'ArrayPeer' );
     				$c = new Criteria ( 'dbarray' );
     				$c->setDBArrayTable ( 'group' );
@@ -322,20 +339,20 @@ switch ($_POST ['action']) {
     				$fields ['time_stamp']  = date("Y-m-d H:i:s");
     				$G_PUBLISH->AddContent ( 'xmlform', 'xmlform', 'setup/wsShowResult', null, $fields );
 				}
-      			
+
 				G::RenderPage ( 'publish', 'raw' );
 				break;
-				
+
 			case "CaseList" :
 				$sessionId = $frm ["SESSION_ID"];
 				$params = array ('sessionId' => $sessionId );
 				$wsResponse = $client->__SoapCall ( 'CaseList', array ($params ) );
-				
+
 				$G_PUBLISH = new Publisher ( );
 				$rows [] = array ('guid' => 'char', 'name' => 'char', 'status' => 'char', 'delIndex' => 'char' );
-				
+
 				$result = G::PMWSCompositeResponse($wsResponse, 'cases');
-				
+
 				if ( is_array( $result )) {
 					foreach ( $result as $key => $item ) {
 						if (isset ( $item->item ))
@@ -359,7 +376,7 @@ switch ($_POST ['action']) {
 									$status = $val->value;
 								if ($val->key == 'delIndex')
 									$delIndex = $val->value;
-							} 
+							}
 					    else {
 							if (isset ( $item->guid ))
 								$guid = $item->guid;
@@ -369,23 +386,23 @@ switch ($_POST ['action']) {
 								$status = $item->status;
 							if (isset ( $item->delIndex ))
 								$delIndex = $item->delIndex;
-						
-					    }	
+
+					    }
 					    $rows [] = array ('guid' => $guid, 'name' => $name, 'status' => $status, 'delIndex' => $delIndex );
-					
+
 		            }
-		            
+
 		            global $_DBArray;
           		    $_DBArray = (isset ( $_SESSION ['_DBArray'] ) ? $_SESSION ['_DBArray'] : '');
         			$_DBArray ['case'] = $rows;
         			$_SESSION ['_DBArray'] = $_DBArray;
-        			
+
         			G::LoadClass ( 'ArrayPeer' );
         			$c = new Criteria ( 'dbarray' );
         			$c->setDBArrayTable ( 'case' );
-        			//$c->addAscendingOrderByColumn ( 'name' ); 
+        			//$c->addAscendingOrderByColumn ( 'name' );
         			$G_PUBLISH->AddContent ( 'propeltable', 'paged-table', 'setup/wsrCaseList', $c );
-				
+
 		        } else if( is_object($result) ){
 		            $_SESSION ['WS_SESSION_ID'] = '';
 		            $fields ['status_code'] = $result->status_code;
@@ -393,18 +410,18 @@ switch ($_POST ['action']) {
     				$fields ['time_stamp']  = date("Y-m-d H:i:s");
     				$G_PUBLISH->AddContent ( 'xmlform', 'xmlform', 'setup/wsShowResult', null, $fields );
 		        }
-			        
+
 				G::RenderPage ( 'publish', 'raw' );
 			break;
-  			
 
-      case "UnassignedCaseList" :                 
+
+      case "UnassignedCaseList" :
 
       $sessionId = $frm ["SESSION_ID"];
-      $params = array ('sessionId' => $sessionId );                                               
+      $params = array ('sessionId' => $sessionId );
 
       $wsResponse = $client->__SoapCall ( 'UnassignedCaseList', array ($params ));
-      
+
       $G_PUBLISH = new Publisher ( );
       $rows [] = array ('guid' => 'char', 'name' => 'char', 'delIndex' => 'char' );
       $result = G::PMWSCompositeResponse($wsResponse, 'cases');
@@ -416,7 +433,7 @@ switch ($_POST ['action']) {
             if ($val->key == 'guid')
              $guid = $val->value;
             if ($val->key == 'name')
-              $name = $val->value;                                                                                           
+              $name = $val->value;
             if ($val->key == 'delIndex')
               $delIndex = $val->value;
           }
@@ -425,18 +442,18 @@ switch ($_POST ['action']) {
             if ($val->key == 'guid')
              $guid = $val->value;
             if ($val->key == 'name')
-             $name = $val->value;                                                                                                 
+             $name = $val->value;
             if ($val->key == 'delIndex')
              $delIndex = $val->value;
-          } 
+          }
           else {
             if (isset ( $item->guid ))
             $guid = $item->guid;
             if (isset ( $item->name ))
-            $name = $item->name;                                                                                                
+            $name = $item->name;
             if (isset ( $item->delIndex ))
             $delIndex = $item->delIndex;
-          }	
+          }
           $rows [] = array ('guid' => $guid, 'name' => $name,  'delIndex' => $delIndex );
         }
 
@@ -447,10 +464,10 @@ switch ($_POST ['action']) {
 
         G::LoadClass ( 'ArrayPeer' );
         $c = new Criteria ( 'dbarray' );
-        $c->setDBArrayTable ( 'case' );         
+        $c->setDBArrayTable ( 'case' );
         $G_PUBLISH->AddContent ( 'propeltable', 'paged-table', 'setup/wsrUnassignedCaseList', $c );
 
-      } 
+      }
         else if( is_object($result) ){
           $_SESSION ['WS_SESSION_ID'] = '';
           $fields ['status_code'] = $result->status_code;
@@ -461,17 +478,17 @@ switch ($_POST ['action']) {
 
       G::RenderPage ( 'publish', 'raw' );
       break;
-	
+
 			case "UserList" :
 				$sessionId = $frm ["SESSION_ID"];
 				$params = array ('sessionId' => $sessionId );
 				$wsResponse = $client->__SoapCall ( 'UserList', array ($params ) );
 				$result = G::PMWSCompositeResponse($wsResponse, 'users');
-				
+
 				$G_PUBLISH = new Publisher();
 				$rows [] = array ('guid' => 'char', 'name' => 'char' );
 				if (is_array ( $result )){
-					
+
 					foreach ( $result as $key => $item ) {
 						if (isset ( $item->item ))
 							foreach ( $item->item as $index => $val ) {
@@ -493,22 +510,22 @@ switch ($_POST ['action']) {
 							if (isset ( $item->name ))
 								$name = $item->name;
 						}
-						
+
 						$rows [] = array ('guid' => $guid, 'name' => $name );
 					}
-					
-			    
+
+
           			global $_DBArray;
         	  		$_DBArray = (isset ( $_SESSION ['_DBArray'] ) ? $_SESSION ['_DBArray'] : '');
     				$_DBArray ['user'] = $rows;
     				$_SESSION ['_DBArray'] = $_DBArray;
-    				
+
     				G::LoadClass ( 'ArrayPeer' );
     				$c = new Criteria ( 'dbarray' );
     				$c->setDBArrayTable ( 'user' );
     				$c->addAscendingOrderByColumn ( 'name' );
     				$G_PUBLISH->AddContent ( 'propeltable', 'paged-table', 'setup/wsrUserList', $c );
-    				
+
 				} else if( is_object($result) ){
 				    $_SESSION ['WS_SESSION_ID'] = '';
 		            $fields ['status_code'] = $result->status_code;
@@ -518,7 +535,7 @@ switch ($_POST ['action']) {
 		        }
     			G::RenderPage ( 'publish', 'raw' );
 				break;
-			
+
 			case "SendMessage" :
         require_once('classes/model/Application.php');
 				$sessionId = $frm ["SESSION_ID"];
@@ -545,7 +562,7 @@ switch ($_POST ['action']) {
                           'caseId' => $caseId,
                           'from' => $from,
                           'to' => $to,
-                          'cc' => $cc, 
+                          'cc' => $cc,
                           'bcc' => $bcc,
                           'subject' => $subject,
                           'template' => 'tempTemplate.hml' );
@@ -554,20 +571,20 @@ switch ($_POST ['action']) {
 				$fields ['status_code'] = $result->status_code;
 				$fields ['message'] = $result->message;
 				$fields ['time_stamp'] = $result->timestamp;
-				
+
 		        if( $result->status_code == 9 ){
 				    $_SESSION ['WS_SESSION_ID'] = '';
 				}
-				
+
 				$G_PUBLISH->AddContent ( 'xmlform', 'xmlform', 'setup/wsShowResult', null, $fields );
 				G::RenderPage ( 'publish', 'raw' );
 				break;
-			
+
 			case "SendVariables" :
 				$sessionId = $frm ["SESSION_ID"];
 				$caseId = $frm ["CASE_ID"];
 				$variables = Array();
-				
+
 				$o = new stdClass();
 				$o->name = $frm ["NAME1"];
 				$o->value = $frm ["VALUE1"];
@@ -576,66 +593,66 @@ switch ($_POST ['action']) {
 				$o->name = $frm ["NAME2"];
 				$o->value = $frm ["VALUE2"];
 				array_push($variables, $o);
-				
+
 				$params = array ('sessionId' => $sessionId, 'caseId' => $caseId, 'variables' => $variables );
 				$result = $client->__SoapCall ( 'SendVariables', array ($params ) );
 				$G_PUBLISH = new Publisher();
 				$fields ['status_code'] = $result->status_code;
 				$fields ['message'] = $result->message;
 				$fields ['time_stamp'] = $result->timestamp;
-				
+
 				if( $result->status_code == 9 ){
 				    $_SESSION ['WS_SESSION_ID'] = '';
 				}
-				
+
 				$G_PUBLISH->AddContent ( 'xmlform', 'xmlform', 'setup/wsShowResult', null, $fields );
 				G::RenderPage ( 'publish', 'raw' );
 				break;
-			
+
 			case "DerivateCase" :
 				$sessionId = $frm ["SESSION_ID"];
 				$caseId = $frm ["CASE_ID"];
 				$delIndex = $frm ["DEL_INDEX"];
-				
+
 				$params = array ('sessionId' => $sessionId, 'caseId' => $caseId, 'delIndex' => $delIndex );
 				$result = $client->__SoapCall ( 'RouteCase', array ($params ) );
 				$G_PUBLISH = new Publisher ( );
 				$fields ['status_code'] = $result->status_code;
 				$fields ['message'] = $result->message;
 				$fields ['time_stamp'] = $result->timestamp;
-				
+
 		        if( $result->status_code == 9 ){
 				    $_SESSION ['WS_SESSION_ID'] = '';
 				}
-				
+
 				$G_PUBLISH->AddContent ( 'xmlform', 'xmlform', 'setup/wsShowResult', null, $fields );
 				G::RenderPage ( 'publish', 'raw' );
 				break;
-			
+
 			case "ReassignCase" :
 				$sessionId = $frm ["SESSION_ID"];
 				$caseId = $frm ["CASE_ID"];
 				$delIndex = $frm ["DEL_INDEX"];
 				$userIdSource = $frm ['USERIDSOURCE'];
 				$userIdTarget = $frm ['USERIDTARGET'];
-				
+
 				$params = array ('sessionId' => $sessionId, 'caseId' => $caseId, 'delIndex' => $delIndex, 'userIdSource' => $userIdSource, 'userIdTarget' => $userIdTarget );
 				$result = $client->__SoapCall ( 'reassignCase', array ($params ) );
-				
+
 				$G_PUBLISH = new Publisher ( );
 				$fields ['status_code'] = $result->status_code;
 				$fields ['message'] = $result->message;
 				$fields ['time_stamp'] = $result->timestamp;
-				
+
 		        if( $result->status_code == 9 ){
 				    $_SESSION ['WS_SESSION_ID'] = '';
 				}
-				
+
 				$G_PUBLISH->AddContent ( 'xmlform', 'xmlform', 'setup/wsShowResult', null, $fields );
 				G::RenderPage ( 'publish', 'raw' );
-				
+
 				break;
-			
+
 			case "NewCaseImpersonate" :
 				$sessionId = $frm ["SESSION_ID"];
 				$processId = $frm ["PROCESS_ID"];
@@ -653,15 +670,15 @@ switch ($_POST ['action']) {
 				$fields ['status_code'] = $result->status_code;
 				$fields ['message'] = $result->message;
 				$fields ['time_stamp'] = $result->timestamp;
-				
+
 		        if( $result->status_code == 9 ){
 				    $_SESSION ['WS_SESSION_ID'] = '';
 				}
-				
+
 				$G_PUBLISH->AddContent ( 'xmlform', 'xmlform', 'setup/wsShowResult', null, $fields );
 				G::RenderPage ( 'publish', 'raw' );
 				break;
-			
+
 			case "NewCase" :
 				$sessionId = $frm ["SESSION_ID"];
 				$processId = $frm ["PROCESS_ID"];
@@ -693,7 +710,7 @@ switch ($_POST ['action']) {
 				$G_PUBLISH->AddContent ( 'xmlform', 'xmlform', 'setup/wsShowResult', null, $fields );
 				G::RenderPage ( 'publish', 'raw' );
 				break;
-			
+
 			case "AssignUserToGroup" :
 				$sessionId = $frm ["SESSION_ID"];
 				$userId = $frm ["USER_ID"];
@@ -704,15 +721,15 @@ switch ($_POST ['action']) {
 				$fields ['status_code'] = $result->status_code;
 				$fields ['message'] = $result->message;
 				$fields ['time_stamp'] = $result->timestamp;
-				
+
 		        if( $result->status_code == 9 ){
 				    $_SESSION ['WS_SESSION_ID'] = '';
 				}
-				
+
 				$G_PUBLISH->AddContent ( 'xmlform', 'xmlform', 'setup/wsShowResult', null, $fields );
 				G::RenderPage ( 'publish', 'raw' );
 				break;
-			
+
 			case "CreateUser" :
 				$sessionId = $frm ["SESSION_ID"];
 				$userId = $frm ["USER_ID"];
@@ -721,33 +738,33 @@ switch ($_POST ['action']) {
 				$email = $frm ["EMAIL"];
 				$role = $frm ["ROLE"];
 				$password = $frm ["PASSWORD"];
-				
+
 				$params = array ('sessionId' => $sessionId, 'userId' => $userId, 'firstname' => $firstname, 'lastname' => $lastname, 'email' => $email, 'role' => $role, 'password' => $password );
 				$result = $client->__SoapCall ( 'CreateUser', array ($params ) );
 				$G_PUBLISH = new Publisher ( );
 				$fields ['status_code'] = $result->status_code;
 				$fields ['message'] = $result->message;
 				$fields ['time_stamp'] = $result->timestamp;
-				
+
 		        if( $result->status_code == 9 ){
 				    $_SESSION ['WS_SESSION_ID'] = '';
 				}
-				
+
 				$G_PUBLISH->AddContent ( 'xmlform', 'xmlform', 'setup/wsShowResult', null, $fields );
 				G::RenderPage ( 'publish', 'raw' );
 				break;
-			
+
 			case "TaskList" :
 				$sessionId = $frm ["SESSION_ID"];
 				$params = array ('sessionId' => $sessionId );
 				$wsResponse = $client->__SoapCall ( 'TaskList', array ($params ) );
 				$result = G::PMWSCompositeResponse($wsResponse, 'tasks');
-				
+
 				$G_PUBLISH = new Publisher ( );
 				$rows [] = array ('guid' => 'char', 'name' => 'char' );
-				
+
 				if (is_array ( $result )){
-					
+
 					foreach ( $result as $key => $item ) {
 						if (isset ( $item->item ))
 							foreach ( $item->item as $index => $val ) {
@@ -769,14 +786,14 @@ switch ($_POST ['action']) {
 							if (isset ( $item->name ))
 								$name = $item->name;
 						}
-						
+
 						$rows [] = array ('guid' => $guid, 'name' => $name );
 					}
           			global $_DBArray;
         	  		$_DBArray = (isset ( $_SESSION ['_DBArray'] ) ? $_SESSION ['_DBArray'] : '');
     				$_DBArray ['task'] = $rows;
     				$_SESSION ['_DBArray'] = $_DBArray;
-    				
+
     				G::LoadClass ( 'ArrayPeer' );
     				$c = new Criteria ( 'dbarray' );
     				$c->setDBArrayTable ( 'task' );
@@ -791,17 +808,17 @@ switch ($_POST ['action']) {
 		        }
 				G::RenderPage ( 'publish', 'raw' );
 				break;
-			
+
 			case "TriggerList" :
 				$sessionId = $frm ["SESSION_ID"];
 				$params = array ('sessionId' => $sessionId );
-				
+
 				$wsResponse = $client->__SoapCall ( 'triggerList', array ($params ) );
 				$result = G::PMWSCompositeResponse($wsResponse, 'triggers');
-				
+
 				$G_PUBLISH = new Publisher ();
 				$rows [] = array ('guid' => 'char', 'name' => 'char', 'processId' => 'char' );
-				
+
 				if (is_array ( $result )){
 					foreach ( $result as $key => $item ) {
 						if (isset ( $item->item ))
@@ -832,29 +849,29 @@ switch ($_POST ['action']) {
 						}
 						$rows [] = array ('guid' => $guid, 'name' => $name, 'processId' => $processId );
 					}
-				
+
           			global $_DBArray;
         	  		$_DBArray = (isset ( $_SESSION ['_DBArray'] ) ? $_SESSION ['_DBArray'] : '');
-    
+
                     foreach ( $rows as $key => $row ) {
                     	$proId = $row['processId'];
-                    	if ( isset ($_DBArray ['process']) && is_array ($_DBArray ['process']) ) 
+                    	if ( isset ($_DBArray ['process']) && is_array ($_DBArray ['process']) )
                         foreach ( $_DBArray ['process'] as $pkey => $prow ) {
                       	  if ( $proId == $prow['guid'] ) {
                       	    $rows[ $key ]['processId'] = $prow['name'];
-                          }        	  
+                          }
                         }
                     }
-                    
+
     				$_DBArray ['triggers'] = $rows;
     				$_SESSION ['_DBArray'] = $_DBArray;
-    				
+
     				G::LoadClass ( 'ArrayPeer' );
     				$c = new Criteria ( 'dbarray' );
     				$c->setDBArrayTable ( 'triggers' );
     				$c->addAscendingOrderByColumn ( 'name' );
     				$G_PUBLISH->AddContent ( 'propeltable', 'paged-table', 'setup/wsrTriggerList', $c );
-    				
+
 				} else if ( is_object($result) ){
 				    $_SESSION ['WS_SESSION_ID'] = '';
 		            $fields ['status_code'] = $result->status_code;
@@ -862,20 +879,20 @@ switch ($_POST ['action']) {
     				$fields ['time_stamp']  = date("Y-m-d H:i:s");
     				$G_PUBLISH->AddContent ( 'xmlform', 'xmlform', 'setup/wsShowResult', null, $fields );
 		        }
-				
+
 				G::RenderPage ( 'publish', 'raw' );
 				break;
-			
+
 			case "InputDocumentList" :
 				$caseId = $frm ["CASE_ID"];
 				$sessionId = $frm ["SESSION_ID"];
 				$params = array ('sessionId' => $sessionId, 'caseId' => $caseId );
-				
+
 				$wsResponse = $client->__SoapCall ( 'InputDocumentList', array ($params ) );
-				
+
 				//g::pr($wsResponse);
 				$result = G::PMWSCompositeResponse($wsResponse, 'documents');
-				
+
 				$G_PUBLISH = new Publisher ( );
 				$rows [] = array ('guid' => 'char', 'name' => 'char', 'processId' => 'char' );
 
@@ -937,33 +954,33 @@ switch ($_POST ['action']) {
 							if (isset ( $item->link ))
 								$link = $item->link;
 						}
-						$rows [] = array ('guid' => $guid, 'filename' => $filename, 'docId' => $docId, 'version' => $version, 
+						$rows [] = array ('guid' => $guid, 'filename' => $filename, 'docId' => $docId, 'version' => $version,
 					                  'createDate' => $createDate, 'createBy' => $createBy, 'type' => $type, 'link' => $link );
 					}
-					
+
           			global $_DBArray;
         	  		$_DBArray = (isset ( $_SESSION ['_DBArray'] ) ? $_SESSION ['_DBArray'] : '');
     				$_DBArray ['inputDocument'] = $rows;
     				$documentArray = array();
     				$documentArray[] = array ('guid' => 'char', 'filename' => 'char' );
-    				if ( isset($_DBArray ['inputDocument']) ) 
+    				if ( isset($_DBArray ['inputDocument']) )
     					foreach ( $_DBArray ['inputDocument'] as $key => $val )
     					  if ( $key != 0 && isset ($val['filename']) )
         				  $documentArray[] = array ('guid' => $val['guid'], 'filename' => $val['filename'] );
-    				if ( isset($_DBArray ['outputDocument']) ) 
+    				if ( isset($_DBArray ['outputDocument']) )
     					foreach ( $_DBArray ['outputDocument'] as $key => $val )
     					  if ( $key != 0 && isset ($val['filename']) )
                     $documentArray[] = array ('guid' => $val['guid'], 'filename' => $val['filename'] );
     				$_DBArray ['documents'] = $documentArray;
     				$_DBArray ['WS_TMP_CASE_UID'] = $frm ["CASE_ID"];
     				$_SESSION ['_DBArray'] = $_DBArray;
-    				
+
     				G::LoadClass ( 'ArrayPeer' );
     				$c = new Criteria ( 'dbarray' );
     				$c->setDBArrayTable ( 'inputDocument' );
     				$c->addAscendingOrderByColumn ( 'name' );
     				$G_PUBLISH->AddContent ( 'propeltable', 'paged-table', 'setup/wsrInputDocumentList', $c );
-    				
+
 				} else if ( is_object($result) ){
 				    $_SESSION ['WS_SESSION_ID'] = '';
 		            $fields ['status_code'] = $result->status_code;
@@ -972,17 +989,17 @@ switch ($_POST ['action']) {
     				$G_PUBLISH->AddContent ( 'xmlform', 'xmlform', 'setup/wsShowResult', null, $fields );
 		        }
     			G::RenderPage ( 'publish', 'raw' );
-    			
+
 				break;
 
 			case "InputDocumentProcessList" :
 				$processId = $frm ["PROCESS_ID"];
 				$sessionId = $frm ["SESSION_ID"];
 				$params = array ('sessionId' => $sessionId, 'processId' => $processId );
-				
+
 				$wsResponse = $client->__SoapCall ( 'InputDocumentProcessList', array ($params ) );
 				$result = G::PMWSCompositeResponse($wsResponse, 'documents');
-				
+
 				$G_PUBLISH = new Publisher();
 				$rows [] = array ('guid' => 'char', 'name' => 'char', 'description' => 'char' );
 				if (is_array ( $result )){
@@ -1019,7 +1036,7 @@ switch ($_POST ['action']) {
         	  		$_DBArray = (isset ( $_SESSION ['_DBArray'] ) ? $_SESSION ['_DBArray'] : '');
     				$_DBArray ['inputDocuments'] = $rows;
     				$_SESSION ['_DBArray'] = $_DBArray;
-    				
+
     				G::LoadClass ( 'ArrayPeer' );
     				$c = new Criteria ( 'dbarray' );
     				$c->setDBArrayTable ( 'inputDocuments' );
@@ -1031,24 +1048,24 @@ switch ($_POST ['action']) {
     				$fields ['message']     =  $result->message;
     				$fields ['time_stamp']  = date("Y-m-d H:i:s");
     				$G_PUBLISH->AddContent ( 'xmlform', 'xmlform', 'setup/wsShowResult', null, $fields );
-		        }	
+		        }
     			G::RenderPage ( 'publish', 'raw' );
 				break;
-			
-			
+
+
 			case "OutputDocumentList" :
 				$caseId = $frm ["CASE_ID"];
 				$sessionId = $frm ["SESSION_ID"];
 				$params = array ('sessionId' => $sessionId, 'caseId' => $caseId );
-				
+
 				$wsResponse = $client->__SoapCall ( 'outputDocumentList', array ($params ) );
 				$result = G::PMWSCompositeResponse($wsResponse, 'documents');
-				
+
 				$G_PUBLISH = new Publisher ( );
 				$rows = array();
 				$rows [] = array ('guid' => 'char', 'name' => 'char' );
 				if (is_array ( $result )){
-				
+
 					foreach ( $result as $key => $item ) {
 						if (isset ( $item->item ))
 							foreach ( $item->item as $index => $val ) {
@@ -1106,7 +1123,7 @@ switch ($_POST ['action']) {
 							if (isset ( $item->link ))
 								$link = $item->link;
 						}
-						$rows [] = array ('guid' => $guid, 'filename' => $filename, 'docId' => $docId, 'version' => $version, 
+						$rows [] = array ('guid' => $guid, 'filename' => $filename, 'docId' => $docId, 'version' => $version,
 					                  'createDate' => $createDate, 'createBy' => $createBy, 'type' => $type, 'link' => $link );
 					}
           			global $_DBArray;
@@ -1114,17 +1131,17 @@ switch ($_POST ['action']) {
     				$_DBArray ['outputDocument'] = $rows;
     				$documentArray = array();
     				$documentArray[] = array ('guid' => 'char', 'filename' => 'char' );
-    				if ( isset($_DBArray ['inputDocument']) ) 
+    				if ( isset($_DBArray ['inputDocument']) )
     					foreach ( $_DBArray ['inputDocument'] as $key => $val )
     					  if ( $key != 0 && isset ($val['filename']) )
         				  $documentArray[] = array ('guid' => $val['guid'], 'filename' => $val['filename'] );
-    				if ( isset($_DBArray ['outputDocument']) ) 
+    				if ( isset($_DBArray ['outputDocument']) )
     					foreach ( $_DBArray ['outputDocument'] as $key => $val )
     					  if ( $key != 0 && isset ($val['filename']) )
                     $documentArray[] = array ('guid' => $val['guid'], 'filename' => $val['filename'] );
     				$_DBArray ['documents'] = $documentArray;
     				$_SESSION ['_DBArray'] = $_DBArray;
-    				
+
     				G::LoadClass ( 'ArrayPeer' );
     				$c = new Criteria ( 'dbarray' );
     				$c->setDBArrayTable ( 'outputDocument' );
@@ -1137,7 +1154,7 @@ switch ($_POST ['action']) {
     				$fields ['time_stamp']  = date("Y-m-d H:i:s");
     				$G_PUBLISH->AddContent ( 'xmlform', 'xmlform', 'setup/wsShowResult', null, $fields );
 		        }
-		        
+
 				G::RenderPage ( 'publish', 'raw' );
 				break;
 //add removeUserFromGroup
@@ -1167,11 +1184,11 @@ case "removeUserFromGroup" :
 				$fields ['status_code'] = $result->status_code;
 				$fields ['message'] = $result->message;
 				$fields ['time_stamp'] = $result->timestamp;
-		        
+
 				if( $result->status_code == 9 ){
 				    $_SESSION ['WS_SESSION_ID'] = '';
 				}
-				
+
 				$G_PUBLISH = new Publisher ( );
 				$G_PUBLISH->AddContent ( 'xmlform', 'xmlform', 'setup/wsShowResult', null, $fields );
 				G::RenderPage ( 'publish', 'raw' );
@@ -1180,16 +1197,16 @@ case "removeUserFromGroup" :
 			case "TaskCase" :
 				$sessionId = $frm ["SESSION_ID"];
 				$caseId = $frm ["CASE_ID"];
-				
+
 				$params = array ('sessionId' => $sessionId, 'caseId' => $caseId );
 				$wsResponse = $client->__SoapCall ( 'TaskCase', array ($params ) );
 				$result = G::PMWSCompositeResponse($wsResponse, 'taskCases');
-				
+
 				$G_PUBLISH = new Publisher ( );
 				$rows [] = array ('guid' => 'char', 'name' => 'char' );
-				
+
 				if (is_array ( $result )){
-			
+
 					foreach ( $result as $key => $item ) {
 						if (isset ( $item->item ))
 							foreach ( $item->item as $index => $val ) {
@@ -1211,15 +1228,15 @@ case "removeUserFromGroup" :
 							if (isset ( $item->name ))
 								$name = $item->name;
 						}
-						
+
 						$rows [] = array ('guid' => $guid, 'name' => $name );
 					}
-				
+
           			global $_DBArray;
         	  		$_DBArray = (isset ( $_SESSION ['_DBArray'] ) ? $_SESSION ['_DBArray'] : '');
     				$_DBArray ['taskCases'] = $rows;
     				$_SESSION ['_DBArray'] = $_DBArray;
-    				
+
                                 G::LoadClass ( 'ArrayPeer' );
     				$c = new Criteria ( 'dbarray' );
     				$c->setDBArrayTable ( 'taskCases' );
@@ -1232,10 +1249,10 @@ case "removeUserFromGroup" :
     				$fields ['time_stamp']  = date("Y-m-d H:i:s");
     				$G_PUBLISH->AddContent ( 'xmlform', 'xmlform', 'setup/wsShowResult', null, $fields );
 		        }
-		        
+
     			G::RenderPage ( 'publish', 'raw' );
 				break;
-			
+
 			case "wsSendFiles" :
                                 if ( isset($_FILES['form']) ) {
                                     foreach ($_FILES['form']['name'] as $sFieldName => $vValue) {
diff --git a/workflow/engine/templates/admin/system.js b/workflow/engine/templates/admin/system.js
index e764a956d..bc94e88cd 100644
--- a/workflow/engine/templates/admin/system.js
+++ b/workflow/engine/templates/admin/system.js
@@ -1,5 +1,5 @@
 Ext.onReady(function(){
-  
+
   var cmbSkins = new Ext.form.ComboBox({
     fieldLabel : _('ID_DEFAULT_SKIN'),
     id         : 'default_skin',
@@ -11,7 +11,7 @@ Ext.onReady(function(){
     mode        : 'local',
     emptyText   : _('ID_SELECT'),
     valueField     : 'ID',
-    displayField   : 'NAME', 
+    displayField   : 'NAME',
     selectOnFocus  : true,
     editable       : true,
     triggerAction: 'all',
@@ -41,7 +41,7 @@ Ext.onReady(function(){
     mode        : 'local',
     emptyText   : _('ID_SELECT'),
     valueField     : 'ID',
-    displayField   : 'NAME', 
+    displayField   : 'NAME',
     selectOnFocus  : true,
     editable       : true,
     triggerAction: 'all',
@@ -70,7 +70,7 @@ Ext.onReady(function(){
     mode        : 'local',
     emptyText   : _('ID_SELECT'),
     valueField     : 'ID',
-    displayField   : 'NAME', 
+    displayField   : 'NAME',
     selectOnFocus  : true,
     editable       : true,
     triggerAction: 'all',
@@ -112,7 +112,7 @@ Ext.onReady(function(){
   });
 
   xfieldsBelow = new Ext.form.FieldSet({
-    title: '',
+    title: _('ID_PREFERENCES'),
     items : [
       cmbSkins,
       cmbLang,
@@ -127,6 +127,65 @@ Ext.onReady(function(){
     ]
   });
 
+  var proxyConfigurationFields = new Ext.form.FieldSet({
+    title: _('ID_PROXY_SETTINGS'),
+    items: [
+      {
+        xtype: 'textfield',
+        id: 'proxy_host',
+        name: 'proxy_host',
+        fieldLabel: _('ID_PROXY_HOST'),
+        width: 200,
+        value: sysConf.proxy_host,
+        listeners:{
+          change: function(){
+            changeSettings();
+          }
+        }
+      },
+      {
+        xtype: 'numberfield',
+        id: 'proxy_port',
+        name: 'proxy_port',
+        fieldLabel: _('ID_PROXY_PORT'),
+        width: 100,
+        value: sysConf.proxy_port,
+        listeners:{
+          change: function(){
+            changeSettings();
+          }
+        }
+      },
+      {
+        xtype: 'textfield',
+        id: 'proxy_user',
+        name: 'proxy_user',
+        fieldLabel: _('ID_PROXY_USER'),
+        width: 200,
+        value: sysConf.proxy_user,
+        listeners:{
+          change: function(){
+            changeSettings();
+          }
+        }
+      },
+      {
+        xtype: 'textfield',
+        inputType: 'password',
+        id: 'proxy_pass',
+        name: 'proxy_pass',
+        fieldLabel: _('ID_PROXY_PASSWORD'),
+        width: 200,
+        value: sysConf.proxy_pass,
+        listeners:{
+          change: function(){
+            changeSettings();
+          }
+        }
+      }
+    ]
+  });
+
   var frm = new Ext.FormPanel({
     title: ' ',
     id:'frm',
@@ -137,24 +196,24 @@ Ext.onReady(function(){
     bodyStyle:'padding:5px',
     waitMsgTarget : true,
     frame: true,
-    
+
     defaults: {
       allowBlank: false,
       msgTarget: 'side',
       align:'center'
     },
-    items:[ xfieldsUp, xfieldsBelow ],
+    items:[ xfieldsUp, xfieldsBelow, proxyConfigurationFields ],
     buttons : [saveButton]
-   
+
   });
   //render to process-panel
   frm.render(document.body);
 
 }); //end onready()
 
-function saveSettings() 
+function saveSettings()
 {
-  Ext.getCmp('frm').getForm().submit( {  
+  Ext.getCmp('frm').getForm().submit( {
     url : '../adminProxy/saveSystemConf',
     waitMsg : _('ID_SAVING_PROCESS'),
     timeout : 36000,
@@ -178,7 +237,7 @@ function saveSettings()
     },
     failure: function(obj, resp) {
       PMExt.error( _('ID_ERROR'), resp.result.message);
-    }    
+    }
   });
 }