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
This commit is contained in:
Julio Cesar Laura
2012-09-19 14:48:38 -04:00
parent 7675e3ef82
commit c312bc95e5
14 changed files with 691 additions and 249 deletions

View File

@@ -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 = '<context xmlns="urn:zimbraAccount' . (($this->_admin) ? 'Admin' : '') . '"><session/></context>';
@@ -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']));

View File

@@ -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),

View File

@@ -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];

View File

@@ -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);