mergeconflich resolved
This commit is contained in:
10
workflow/public_html/gmail.php
Normal file
10
workflow/public_html/gmail.php
Normal file
@@ -0,0 +1,10 @@
|
||||
<?php
|
||||
session_start();
|
||||
if (isset($_GET['code'])) {
|
||||
$_SESSION['CODE_GMAIL'] = $_GET['code'];
|
||||
|
||||
echo "<SCRIPT language='Javascript' type='text/javascript'>";
|
||||
echo "window.close()";
|
||||
echo "</script>";
|
||||
exit;
|
||||
}
|
||||
33
workflow/public_html/pmGmail/lostSession.php
Normal file
33
workflow/public_html/pmGmail/lostSession.php
Normal file
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
session_start();
|
||||
if (!isset($_SESSION['USER_LOGGED'])) {
|
||||
die( '<script type="text/javascript">
|
||||
try
|
||||
{
|
||||
alert("lostSession");
|
||||
var dataToSend = {
|
||||
"action": "credentials",
|
||||
"operation": "refreshPmSession",
|
||||
"type": "processCall",
|
||||
"funParams": [
|
||||
"",
|
||||
""
|
||||
],
|
||||
"expectReturn": false
|
||||
};
|
||||
var x = parent.postMessage(JSON.stringify(dataToSend), "*");
|
||||
}catch (err)
|
||||
{
|
||||
parent.location = parent.location;
|
||||
}
|
||||
</script>');
|
||||
}
|
||||
if($_GET['form']){
|
||||
header( 'location:' . $_SESSION['server'] . $_SESSION['PMCase'] );
|
||||
}else if($_GET['processmap']){
|
||||
header( 'location:' . $_SESSION['server'] . $_SESSION['PMProcessmap'] );
|
||||
}else if($_GET['uploaded']){
|
||||
header( 'location:' . $_SESSION['server'] . $_SESSION['PMUploadedDocuments'] );
|
||||
} else if($_GET['generated']){
|
||||
header( 'location:' . $_SESSION['server'] . $_SESSION['PMGeneratedDocuments'] );
|
||||
}
|
||||
138
workflow/public_html/pmGmail/sso.php
Normal file
138
workflow/public_html/pmGmail/sso.php
Normal file
@@ -0,0 +1,138 @@
|
||||
<?php
|
||||
require_once (dirname(__FILE__) . '/../../../gulliver/system/class.bootstrap.php');
|
||||
|
||||
$gmailToken = $_GET['gmailToken'];
|
||||
$gmail = $_GET['gmail'];
|
||||
$pmtoken = $_GET['pmtoken'];
|
||||
$pmws = $_GET['pmws'];
|
||||
$appUid = $_GET['appUid'];
|
||||
$delIndex = $_GET['delIndex'];
|
||||
$action = $_GET['action'];
|
||||
$proUid = $_GET['proUid'];
|
||||
$server = isset($_GET['server']) ? $_GET['server'] : '';
|
||||
|
||||
//We do need the server to continue.
|
||||
if( !isset($_GET['server']) || $server == "" ){
|
||||
throw new \Exception(Bootstrap::LoadTranslation( 'ID_GMAIL_NEED_SERVER' ));
|
||||
}
|
||||
|
||||
//First check if the feature is enabled in the license.
|
||||
$gCurl = curl_init( 'https://' . $server . '/api/1.0/' . $pmws . '/gmailIntegration/verifyGmailfeature/' );
|
||||
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);
|
||||
|
||||
$gCurl_response = curl_exec( $gCurl );
|
||||
curl_close($gCurl);
|
||||
$gResp = json_decode($gCurl_response);
|
||||
|
||||
if($gResp == false){
|
||||
echo Bootstrap::LoadTranslation( 'ID_NO_LICENSE_FEATURE_ENABLED' );
|
||||
die;
|
||||
}
|
||||
|
||||
set_time_limit(60);
|
||||
|
||||
$curl = curl_init( 'https://' . $server . '/api/1.0/' . $pmws . '/gmailIntegration/userexist/' . $gmail );
|
||||
curl_setopt( $curl, CURLOPT_HTTPHEADER, array( 'Authorization: Bearer ' . $pmtoken ) );
|
||||
curl_setopt( $curl, CURLOPT_RETURNTRANSFER, true);
|
||||
curl_setopt( $curl, CURLOPT_SSL_VERIFYPEER,false);
|
||||
curl_setopt( $curl, CURLOPT_CONNECTTIMEOUT, 0);
|
||||
|
||||
$curl_response = curl_exec( $curl );
|
||||
curl_close($curl);
|
||||
$decodedResp = json_decode($curl_response);
|
||||
|
||||
//getting the enviroment
|
||||
$enviroment = $decodedResp->enviroment;
|
||||
|
||||
if(count($decodedResp->user) > 1){
|
||||
echo Bootstrap::LoadTranslation( 'ID_EMAIL_MORE_THAN_ONE_USER' );
|
||||
die;
|
||||
} else if(count($decodedResp->user) < 1){
|
||||
echo Bootstrap::LoadTranslation( 'ID_USER_NOT_FOUND' );
|
||||
die;
|
||||
}
|
||||
|
||||
//validationg if there is an actual PM session
|
||||
if( !isset($_SESSION['USER_LOGGED']) || $_SESSION['USER_LOGGED'] != $decodedResp->user['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->user['0']->USR_STATUS == "ACTIVE"){
|
||||
//User Active! lets create the Session
|
||||
@session_destroy();
|
||||
session_start();
|
||||
session_regenerate_id();
|
||||
|
||||
if (PHP_VERSION < 5.2) {
|
||||
setcookie("workspaceSkin", $enviroment, time() + (24 * 60 * 60), "/sys" . $enviroment, "; HttpOnly");
|
||||
} else {
|
||||
setcookie("workspaceSkin", $enviroment, time() + (24 * 60 * 60), "/sys" . $enviroment, null, false, true);
|
||||
}
|
||||
|
||||
$_SESSION = array();
|
||||
$_SESSION['__EE_INSTALLATION__'] = 2;
|
||||
$_SESSION['__EE_SW_PMLICENSEMANAGER__'] = 1;
|
||||
$_SESSION['phpLastFileFound'] = '';
|
||||
$_SESSION['USERNAME_PREVIOUS1'] = $decodedResp->user['0']->USR_USERNAME;
|
||||
$_SESSION['USERNAME_PREVIOUS2'] = $decodedResp->user['0']->USR_USERNAME;
|
||||
$_SESSION['WORKSPACE'] = $pmws;
|
||||
$_SESSION['USER_LOGGED'] = $decodedResp->user['0']->USR_UID;
|
||||
$_SESSION['USR_USERNAME'] = $decodedResp->user['0']->USR_USERNAME;
|
||||
$_SESSION['USR_FULLNAME'] = $decodedResp->user['0']->USR_FIRSTNAME. ' ' .$decodedResp->user['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/'. $enviroment .'/cases/open?APP_UID='.$appUid.'&DEL_INDEX='.$delIndex.'&action='.$action.'&gmail=1';
|
||||
header( 'location:' . $mainUrl );
|
||||
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;
|
||||
$_SESSION['PMUploadedDocuments'] = 'cases/ajaxListener?action=uploadedDocuments';
|
||||
$_SESSION['PMGeneratedDocuments'] = 'cases/casesGenerateDocumentPage_Ajax.php?actionAjax=casesGenerateDocumentPage';
|
||||
|
||||
header( 'location:' . 'templateForm.php' );
|
||||
|
||||
114
workflow/public_html/pmGmail/templateForm.php
Normal file
114
workflow/public_html/pmGmail/templateForm.php
Normal file
@@ -0,0 +1,114 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
||||
<title>Interface Processmaker</title>
|
||||
<script type="text/javascript" src="/lib/js/jquery-1.10.2.min.js"></script>
|
||||
<link rel="stylesheet" href="/lib/pmUI/pmui.min.css">
|
||||
|
||||
<script type="text/javascript" >
|
||||
jQuery(document).ready(function() {
|
||||
|
||||
var tid;
|
||||
|
||||
var addLoading = function (host, panel, message) {
|
||||
panel = panel || 'PMContent';
|
||||
message = message || 'Loading...';
|
||||
|
||||
var divLoading = document.createElement('div');
|
||||
var span = document.createElement('span');
|
||||
var text = document.createTextNode(message);
|
||||
|
||||
divLoading.setAttribute('id', 'PMGmailLoad');
|
||||
divLoading.setAttribute('style', 'position:absolute; left: 0px;top: 0px;width: 100%;height: 100%;z-index: 9999;background: url('+host+'../../../lib/img/loading.gif) 50% 50% no-repeat #f9f9f9;');
|
||||
|
||||
span.setAttribute('style', ' margin-top: 50%; margin-left: 44%; position: absolute; font-weight: bold; font-size: 12px; margin-right: auto;');
|
||||
span.appendChild(text);
|
||||
divLoading.appendChild(span);
|
||||
document.getElementById(panel).appendChild(divLoading);
|
||||
};
|
||||
|
||||
var removeLoading = function () {
|
||||
document.getElementById('PMGmailLoad').remove();
|
||||
};
|
||||
|
||||
var resizePMDynadorm = function () {
|
||||
var iframe = document.getElementById('iframePM');
|
||||
var content = iframe.contentDocument;
|
||||
if (content != null){
|
||||
clearInterval(tid);
|
||||
}
|
||||
};
|
||||
|
||||
jQuery('.pmui-tab-ref').on('click', function(e) {
|
||||
var currentAttrValue = jQuery(this).attr('href');
|
||||
|
||||
jQuery(this).parent('li').addClass('pmui-active').siblings().removeClass('pmui-active');
|
||||
|
||||
//url iframe
|
||||
currentAttrValue = jQuery(this).attr('linkPM');
|
||||
addLoading(jQuery(this).attr('PMServer'));
|
||||
$('#iframePM').attr('src', currentAttrValue);
|
||||
e.preventDefault();
|
||||
});
|
||||
$('#iframePM').load( function () {
|
||||
tid = setInterval(function(){ resizePMDynadorm() }, 500);
|
||||
removeLoading();
|
||||
});
|
||||
|
||||
var currentAttrValue = jQuery('.pmui-tab-ref');
|
||||
addLoading(currentAttrValue[0].attributes[3].value);
|
||||
$('#iframePM').attr('src',currentAttrValue[0].attributes[2].value);
|
||||
});
|
||||
|
||||
var eventMethod = window.addEventListener ? "addEventListener" : "attachEvent";
|
||||
var eventer = window[eventMethod];
|
||||
var messageEvent = eventMethod == "attachEvent" ? "onmessage" : "message";
|
||||
eventer(messageEvent,function(e) {
|
||||
parent.parent.postMessage(e.data, 'https://mail.google.com');
|
||||
},false);
|
||||
</script>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<?php
|
||||
session_start();
|
||||
?>
|
||||
<div class="pmui-tabpanel-tabs_container" style="display: block; height: 40px;">
|
||||
<ul class="pmui-tabpanel-tabs" style="display:block; float:left;">
|
||||
<li class="pmui pmui-tabitem pmui-active" style="left: 0px; top: 0px; width: auto; height: auto; position: relative; z-index: auto; display: inline-block;">
|
||||
<i class="pmui-tab-icon"> </i>
|
||||
<a class="pmui-tab-ref" href="#PMCases" linkPM="<?php echo $_SESSION['server'] . '../../../pmGmail/lostSession.php?form=1' ?>" PMServer="<?php echo $_SESSION['server'] ?>">
|
||||
Form
|
||||
</a>
|
||||
</li>
|
||||
<li class="pmui pmui-tabitem" style="left: 0px; top: 0px; width: auto; height: auto; position: relative; z-index: auto; display: inline-block;">
|
||||
<i class="pmui-tab-icon"> </i>
|
||||
<a class="pmui-tab-ref" href="#PMProcessmap" linkPM="<?php echo $_SESSION['server'] . '../../../pmGmail/lostSession.php?processmap=1' ?>" PMServer="<?php echo $_SESSION['server'] ?>">
|
||||
Processmap
|
||||
</a>
|
||||
</li>
|
||||
<li class="pmui pmui-tabitem" style="left: 0px; top: 0px; width: auto; height: auto; position: relative; z-index: auto; display: inline-block;">
|
||||
<i class="pmui-tab-icon"> </i>
|
||||
<a class="pmui-tab-ref" href="#PMUploadedDocuments" linkPM="<?php echo $_SESSION['server'] . '../../../pmGmail/lostSession.php?uploaded=1' ?>" PMServer="<?php echo $_SESSION['server'] ?>">
|
||||
Uploaded
|
||||
</a>
|
||||
</li>
|
||||
<li class="pmui pmui-tabitem" style="left: 0px; top: 0px; width: auto; height: auto; position: relative; z-index: auto; display: inline-block;">
|
||||
<i class="pmui-tab-icon"> </i>
|
||||
<a class="pmui-tab-ref" href="#PMGeneratedDocuments" linkPM="<?php echo $_SESSION['server'] . '../../../pmGmail/lostSession.php?generated=1' ?>" PMServer="<?php echo $_SESSION['server'] ?>">
|
||||
Generated
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<div class="tab-content">
|
||||
<div class="tab active" id="PMContent">
|
||||
<iframe id="iframePM" src="" width="100%" height="530" style="overflow:hidden;"></iframe>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
98
workflow/public_html/pmGmail/uninstall.php
Normal file
98
workflow/public_html/pmGmail/uninstall.php
Normal file
@@ -0,0 +1,98 @@
|
||||
<!DOCTYPE html>
|
||||
<html class="js js csstransitions" lang="en"><head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||
<title>Open Source Workflow Software & Business Process Management BPM</title>
|
||||
<meta http-equiv="Content-Language" content="en"><meta name="description" content="Open source web based workflow software and Business Process Management software">
|
||||
<meta name="keywords" content="workflow software"><meta name="googlebot" content="index, follow">
|
||||
<meta name="robots" content="index, follow">
|
||||
<meta name="Revisit-After" content="7 days">
|
||||
<meta name="city" content="Brooklyn">
|
||||
<meta name="country" content="United States of America (USA)">
|
||||
<meta name="state" content="NY">
|
||||
<meta name="zip code" content="11238">
|
||||
<meta name="geo.region" content="US-NY">
|
||||
<meta name="geo.placename" content="Brooklyn">
|
||||
<meta name="DC.title" content="ProcessMaker Inc.">
|
||||
<meta name="subject" content="Open Source Workflow, Business Process Management (BPM) Soft-ware.">
|
||||
<meta name="author" content="ProcessMaker Inc.">
|
||||
<meta name="copyright" content="ProcessMaker Inc."> <link type="text/css" rel="stylesheet" href="index_files/css_xE-rWrJf-fncB6ztZfd2huxqgxu4WO-qwma6Xer30m4.css" media="all">
|
||||
<link type="text/css" rel="stylesheet" href="../css/general.css" media="all">
|
||||
<link type="text/css" rel="stylesheet" href="../css/sb-admin-2.css" media="all">
|
||||
<link rel="shortcut icon" href="http://www.processmaker.com/favicon.ico" type="image/vnd.microsoft.icon">
|
||||
<link rel="alternate" type="application/rss+xml" title="ProcessMaker RSS" href="http://www.processmaker.com/rss.xml">
|
||||
<script src="index_files/jsbox.js" class="lazyload" charset="utf-8"></script><script src="index_files/jsglobal.js" class="lazyload" charset="utf-8"></script><script src="index_files/jstrack.js" class="lazyload" charset="utf-8"></script><link type="text/css" rel="stylesheet" href="index_files/style_002.css" class="lazyload" charset="utf-8"><style type="text/css">.lz_chat_mail { color: #000000 !important; }.lz_chat_link { color: #000000 !important; }.lz_chat_file { color: #000000 !important; }.lz_chat_human { color: #000000 !important; }</style><link type="text/css" rel="stylesheet" href="index_files/style.css" class="lazyload" charset="utf-8"><script src="index_files/jsextern.js" class="lazyload" charset="utf-8"></script><style type="text/css">.fancybox-margin{margin-right:16px;}</style></head>
|
||||
<script>
|
||||
document.onreadystatechange = function () {
|
||||
var state = document.readyState
|
||||
if (state == 'interactive') {
|
||||
document.getElementById('main-content').style.visibility="hidden";
|
||||
} else if (state == 'complete') {
|
||||
document.getElementById('loading').style.visibility="hidden";
|
||||
document.getElementById('loading').style.display="none";
|
||||
document.getElementById('main-content').style.visibility="visible";
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<body class="html front not-logged-in no-sidebars page-node" id="page-top" data-spy="scroll" data-target=".navbar-custom" style="background-color:white;">
|
||||
<div id="main-content" class="container" style="display:none;">
|
||||
<div class="row">
|
||||
<div class="col-lg-12" style="margin: 0 auto;">
|
||||
<div style="margin: 0 auto; width:600px;padding:25px;">
|
||||
<div style="margin: 0 auto; text-align:center;margin-top:40px;">
|
||||
<img src = "../images/logo-processmake-google.png">
|
||||
</div>
|
||||
<h2 style="margin: 0 auto; text-align:center; margin-top:40px;">ProcessMaker Google Integration</h2>
|
||||
<p style="margin: 0 auto; text-align:center; margin-top:10px;">
|
||||
The ProcessMaker Google Integration extension and components have been uninstalled from your Gmail Acccount.
|
||||
</p>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="loading" style="width:120px;margin:0 auto;margin-top:200px;text-align:center;">
|
||||
<img id="loading-image" src="../images/ext/default/shared/large-loading.gif" alt="Uninstalling..." />
|
||||
<div>Uninstalling ...</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
|
||||
<?php
|
||||
/*
|
||||
* Uninstall file to help in the uninstaling process of the PMGmail Extension.
|
||||
* This deletes the labels created by the Extension in the user email.
|
||||
*
|
||||
*/
|
||||
/**
|
||||
* Call the end point to delete labels
|
||||
*
|
||||
* @param string $server
|
||||
* @param string $pmws
|
||||
* @param string $mail
|
||||
* @param string $pmtoken
|
||||
*/
|
||||
function callEndPointDeleteLabels($server, $pmws, $mail, $pmtoken){
|
||||
set_time_limit(60);
|
||||
|
||||
$curl = curl_init( 'https://' . $server . '/api/1.0/' . $pmws . '/gmailIntegration/deleteLabels/'. $mail );
|
||||
curl_setopt( $curl, CURLOPT_HTTPHEADER, array( 'Authorization: Bearer ' . $pmtoken ) );
|
||||
curl_setopt( $curl, CURLOPT_CUSTOMREQUEST, "POST");
|
||||
curl_setopt( $curl, CURLOPT_RETURNTRANSFER, true);
|
||||
curl_setopt( $curl, CURLOPT_SSL_VERIFYPEER, false);
|
||||
curl_setopt( $curl, CURLOPT_CONNECTTIMEOUT, 0);
|
||||
|
||||
$curl_response = curl_exec( $curl );
|
||||
curl_close($curl);
|
||||
}
|
||||
|
||||
$server = $_GET['server'];
|
||||
$pmws = $_GET['pmws'];
|
||||
$mail = $_GET['mail'];
|
||||
$pmtoken = $_GET['pmtoken'];
|
||||
|
||||
callEndPointDeleteLabels($server, $pmws, $mail, $pmtoken);
|
||||
?>
|
||||
Reference in New Issue
Block a user