diff --git a/workflow/public_html/pmGmail/sso.php b/workflow/public_html/pmGmail/sso.php index 2e5b7d278..b6958096f 100644 --- a/workflow/public_html/pmGmail/sso.php +++ b/workflow/public_html/pmGmail/sso.php @@ -23,21 +23,21 @@ $gCurl = curl_init( 'https://' . $server . '/api/1.0/' . $pmws . '/gmailIntegrat curl_setopt( $gCurl, CURLOPT_HTTPHEADER, array( 'Authorization: Bearer ' . $pmtoken ) ); curl_setopt( $gCurl, CURLOPT_RETURNTRANSFER, true); curl_setopt( $gCurl, CURLOPT_SSL_VERIFYPEER, false); -curl_setopt( $gCurl, CURLOPT_CONNECTTIMEOUT, 0); -curl_setopt($gCurl, CURLOPT_SSL_VERIFYHOST, false); - -if (curl_exec ( $gCurl ) === false) { +curl_setopt( $gCurl, CURLOPT_CONNECTTIMEOUT, 0); +curl_setopt($gCurl, CURLOPT_SSL_VERIFYHOST, false); + +if (curl_exec ( $gCurl ) === false) { echo 'Curl error: ' . curl_error ( $gCurl ); error_log(Bootstrap::LoadTranslation('ID_SERVER_COMMUNICATION_ERROR')); - die (); -} else { - $gCurl_response = curl_exec ( $gCurl ); - curl_close ( $gCurl ); - $gResp = G::json_decode ( $gCurl_response ); - if ($gResp === false) { - echo Bootstrap::LoadTranslation ( 'ID_NO_LICENSE_FEATURE_ENABLED' ); - die (); - } + die (); +} else { + $gCurl_response = curl_exec ( $gCurl ); + curl_close ( $gCurl ); + $gResp = G::json_decode ( $gCurl_response ); + if ($gResp === false) { + echo Bootstrap::LoadTranslation ( 'ID_NO_LICENSE_FEATURE_ENABLED' ); + die (); + } } set_time_limit(60); @@ -74,10 +74,10 @@ if( !isset($_SESSION['USER_LOGGED']) || $_SESSION['USER_LOGGED'] != $decodedResp // init curl object $ch = curl_init(); // define options - $optArray = array( - CURLOPT_URL => $url, - CURLOPT_RETURNTRANSFER => true, - CURLOPT_SSL_VERIFYPEER => false, + $optArray = array( + CURLOPT_URL => $url, + CURLOPT_RETURNTRANSFER => true, + CURLOPT_SSL_VERIFYPEER => false, CURLOPT_SSL_VERIFYHOST => false ); // apply those options @@ -124,28 +124,6 @@ if( !isset($_SESSION['USER_LOGGED']) || $_SESSION['USER_LOGGED'] != $decodedResp } } -if ($action == "draft"){ - //sending the email - $curlApp = curl_init( 'https://' . $server . '/api/1.0/' . $pmws . '/gmailIntegration/sendEmail/' . $appUid . '/to/' . $gmail . '/index/' . $delIndex ); - curl_setopt ( $curlApp, CURLOPT_HTTPHEADER, array ( - 'Authorization: Bearer ' . $pmtoken - ) ); - curl_setopt ( $curlApp, CURLOPT_CUSTOMREQUEST, "POST" ); - curl_setopt ( $curlApp, CURLOPT_RETURNTRANSFER, true ); - curl_setopt ( $curlApp, CURLOPT_SSL_VERIFYPEER, false ); - curl_setopt ( $curlApp, CURLOPT_SSL_VERIFYHOST, false ); - curl_setopt ( $curlApp, CURLOPT_CONNECTTIMEOUT, 0 ); - - $curl_response_app = curl_exec( $curlApp ); - curl_close( $curlApp ); - - $mainUrl = '/sys'. $pmws .'/en/'. $enviroment .'/cases/open?APP_UID='.$appUid.'&DEL_INDEX='.$delIndex.'&action='.$action.'&gmail=1'; - header( 'location:' . $mainUrl ); - $_SESSION['APPLICATION'] =$appUid ; - $_SESSION['INDEX'] = $delIndex; - die; -} - $_SESSION['server'] = 'https://' . $server . '/sys'. $pmws .'/en/'.$enviroment.'/'; $_SESSION['PMCase'] = 'cases/cases_Open?APP_UID='.$appUid.'&DEL_INDEX='.$delIndex.'&action='.$action.'&gmail=1'; $_SESSION['PMProcessmap'] = 'designer?prj_uid=' . $proUid . '&prj_readonly=true&app_uid=' . $appUid;