1){ echo Bootstrap::LoadTranslation( 'ID_EMAIL_MORE_THAN_ONE_USER' ); die; } //validationg if there is an actual PM session if( !isset($_SESSION['USER_LOGGED']) || $_SESSION['USER_LOGGED'] != $decodedResp['0']->USR_UID){ $url = 'https://www.googleapis.com/oauth2/v1/tokeninfo?access_token='.$gmailToken; // init curl object $ch = curl_init(); // define options $optArray = array( CURLOPT_URL => $url, CURLOPT_RETURNTRANSFER => true, CURLOPT_SSL_VERIFYPEER => false ); // apply those options curl_setopt_array($ch, $optArray); // execute request and get response $result = curl_exec($ch); $response = (json_decode($result)); curl_close($ch); //First validate if this user (mail) corresponds to a PM user if(isset($response->email) && ($gmail == $response->email)){ //If the email corresponds I get the username and with the gmail user_id the session is created. if($decodedResp['0']->USR_STATUS == "ACTIVE"){ //User Active! lets create the Session @session_destroy(); session_start(); session_regenerate_id(); if (PHP_VERSION < 5.2) { setcookie("workspaceSkin", "neoclasic", time() + (24 * 60 * 60), "/sys" . "neoclasic", "; HttpOnly"); } else { setcookie("workspaceSkin", "neoclasic", time() + (24 * 60 * 60), "/sys" . "neoclasic", null, false, true); } $_SESSION = array(); $_SESSION['__EE_INSTALLATION__'] = 2; $_SESSION['__EE_SW_PMLICENSEMANAGER__'] = 1; $_SESSION['phpLastFileFound'] = ''; $_SESSION['USERNAME_PREVIOUS1'] = 'admin'; $_SESSION['USERNAME_PREVIOUS2'] = 'admin'; $_SESSION['WORKSPACE'] = $pmws; $_SESSION['USER_LOGGED'] = $decodedResp['0']->USR_UID; $_SESSION['USR_USERNAME'] = $decodedResp['0']->USR_USERNAME; $_SESSION['USR_FULLNAME'] = $decodedResp['0']->USR_FIRSTNAME. ' ' .$decodedResp['0']->USR_LASTNAME; $_SESSION['__sw__'] = 1; //session created } else { echo Bootstrap::LoadTranslation( 'ID_USER_NOT_ACTIVE' ); die; } } else { echo Bootstrap::LoadTranslation( 'ID_USER_DOES_NOT_CORRESPOND' ); die; } } 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_CONNECTTIMEOUT, 0); $curl_response_app = curl_exec( $curlApp ); curl_close( $curlApp ); $mainUrl = '/sys'. $pmws .'/en/neoclassic/cases/open?APP_UID='.$appUid.'&DEL_INDEX='.$delIndex.'&action='.$action.'&gmail=1'; header( 'location:' . $mainUrl ); die; } $_SESSION['server'] = 'https://' . $server . '/sys'. $pmws .'/en/neoclassic/'; $_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; $_SESSION['PMUploadedDocuments'] = 'cases/ajaxListener?action=uploadedDocuments'; $_SESSION['PMGeneratedDocuments'] = 'cases/casesGenerateDocumentPage_Ajax.php?actionAjax=casesGenerateDocumentPage'; header( 'location:' . 'templateForm.php' );