@@ -1,5 +1,6 @@
|
||||
<?php
|
||||
|
||||
use ProcessMaker\Model\Application as ModelApplication;
|
||||
use ProcessMaker\Model\Process as ProcessModel;
|
||||
use ProcessMaker\Plugins\PluginRegistry;
|
||||
use ProcessMaker\Util\DateTime;
|
||||
@@ -233,18 +234,19 @@ if (isset($_GET['breakpoint'])) {
|
||||
}
|
||||
#end trigger debug session.......
|
||||
|
||||
//Save data - Start
|
||||
// Save data - Start
|
||||
unset($Fields['APP_STATUS']);
|
||||
unset($Fields['APP_PROC_STATUS']);
|
||||
unset($Fields['APP_PROC_CODE']);
|
||||
unset($Fields['APP_PIN']);
|
||||
unset($Fields['APP_FINISH_DATE']);
|
||||
|
||||
$Fields["USER_UID"] = $_SESSION["USER_LOGGED"];
|
||||
$Fields["CURRENT_DYNAFORM"] = $_GET["UID"];
|
||||
$Fields["OBJECT_TYPE"] = ($_GET["UID"] == "-1") ? "ASSIGN_TASK" : $_GET["TYPE"];
|
||||
|
||||
$oCase->updateCase($_SESSION['APPLICATION'], $Fields);
|
||||
//Save data - End
|
||||
// Save data - End
|
||||
|
||||
//Obtain previous and next step - Start
|
||||
try {
|
||||
|
||||
@@ -1,23 +1,22 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* ription:This is a additional configuration for load all connections; if exist in a particular proccess
|
||||
* @Date: 15-05-2008
|
||||
*
|
||||
* @author : Erik Amaru Ortiz <erik@colosa.com>
|
||||
* This is an additional configuration to load all connections if exist in a particular process
|
||||
*/
|
||||
|
||||
$dbHash = @explode( SYSTEM_HASH, G::decrypt( HASH_INSTALLATION, SYSTEM_HASH ) );
|
||||
$dbHash = @explode(SYSTEM_HASH, G::decrypt(HASH_INSTALLATION, SYSTEM_HASH));
|
||||
|
||||
$host = $dbHash[0];
|
||||
$user = $dbHash[1];
|
||||
$pass = $dbHash[2];
|
||||
$dbName = DB_NAME;
|
||||
|
||||
$pro = include (PATH_CORE . "config/databases.php");
|
||||
$pro = include(PATH_CORE . "config/databases.php");
|
||||
|
||||
$pro['datasources']['root'] = Array ();
|
||||
$pro['datasources']['root']['connection'] = "mysql://$user:$pass@$host/$dbName?encoding=utf8";
|
||||
$port = (!empty(config('database.connections.workflow.port'))) ? config('database.connections.workflow.port') : 3306;
|
||||
|
||||
$pro['datasources']['root'] = [];
|
||||
$pro['datasources']['root']['connection'] = "mysql://$user:$pass@$host:$port/$dbName?encoding=utf8";
|
||||
$pro['datasources']['root']['adapter'] = "mysql";
|
||||
|
||||
return $pro;
|
||||
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
|
||||
use ProcessMaker\Core\System;
|
||||
use ProcessMaker\GmailOAuth\GmailOAuth;
|
||||
use ProcessMaker\Office365OAuth\Office365OAuth;
|
||||
|
||||
$option = (isset($_POST["option"])) ? $_POST["option"] : "";
|
||||
$response = [];
|
||||
@@ -233,8 +232,6 @@ switch ($option) {
|
||||
case "createAuthUrl":
|
||||
try {
|
||||
$gmailOAuth = new GmailOAuth();
|
||||
$gmailOAuth->setServer($_POST['server']);
|
||||
$gmailOAuth->setPort($_POST['port']);
|
||||
$gmailOAuth->setClientID($_POST['clientID']);
|
||||
$gmailOAuth->setClientSecret($_POST['clientSecret']);
|
||||
$gmailOAuth->setRedirectURI(System::getServerMainPath() . "/emailServer/emailServerGmailOAuth");
|
||||
@@ -261,38 +258,6 @@ switch ($option) {
|
||||
];
|
||||
}
|
||||
break;
|
||||
case "createAuthUrlOffice365":
|
||||
try {
|
||||
$office365OAuth = new Office365OAuth();
|
||||
$office365OAuth->setServer($_POST['server']);
|
||||
$office365OAuth->setPort($_POST['port']);
|
||||
$office365OAuth->setClientID($_POST['clientID']);
|
||||
$office365OAuth->setClientSecret($_POST['clientSecret']);
|
||||
$office365OAuth->setRedirectURI(System::getServerMainPath() . "/emailServer/emailServerOffice365OAuth");
|
||||
$office365OAuth->setEmailEngine($_POST['emailEngine']);
|
||||
$office365OAuth->setFromAccount($_POST['fromAccount']);
|
||||
$office365OAuth->setSenderEmail($_POST['senderEmail']);
|
||||
$office365OAuth->setSenderName($_POST['senderName']);
|
||||
$office365OAuth->setSendTestMail((int) $_POST['sendTestMail']);
|
||||
$office365OAuth->setMailTo($_POST['mailTo']);
|
||||
$office365OAuth->setSetDefaultConfiguration((int) $_POST['setDefaultConfiguration']);
|
||||
|
||||
if (!empty($_POST['emailServerUid'])) {
|
||||
$office365OAuth->setEmailServerUid($_POST['emailServerUid']);
|
||||
}
|
||||
$client = $office365OAuth->getOffice365Client();
|
||||
$response = [
|
||||
"status" => 200,
|
||||
"data" => $client->getAuthorizationUrl($office365OAuth->getOptions())
|
||||
];
|
||||
$_SESSION['office365OAuth'] = $office365OAuth;
|
||||
} catch (Exception $e) {
|
||||
$response = [
|
||||
"status" => 500,
|
||||
"message" => $e->getMessage()
|
||||
];
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
echo G::json_encode($response);
|
||||
|
||||
@@ -1,42 +0,0 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Cache;
|
||||
use ProcessMaker\Core\System;
|
||||
use ProcessMaker\Office365OAuth\Office365OAuth;
|
||||
|
||||
Cache::forget('errorMessageIfNotAuthenticate');
|
||||
try {
|
||||
$header = "location:" . System::getServerMainPath() . "/setup/main?s=EMAIL_SERVER";
|
||||
|
||||
$validInput = empty($_GET['code']) || empty($_SESSION['office365OAuth']) || !is_object($_SESSION['office365OAuth']);
|
||||
if ($validInput) {
|
||||
G::header($header);
|
||||
return;
|
||||
}
|
||||
|
||||
$RBAC->allows(basename(__FILE__), "code");
|
||||
$office365OAuth = $_SESSION['office365OAuth'];
|
||||
|
||||
$office365Client = $office365OAuth->getOffice365Client();
|
||||
|
||||
$accessToken = $office365Client->getAccessToken('authorization_code', [
|
||||
'code' => $_GET['code']
|
||||
]);
|
||||
|
||||
$token = $accessToken->getToken();
|
||||
|
||||
$office365OAuth->setRefreshToken($accessToken->getRefreshToken());
|
||||
$office365OAuth->saveEmailServer();
|
||||
|
||||
$office365OAuth->sendTestMailWithPHPMailerOAuth('Stevenmaguire\OAuth2\Client\Provider\Microsoft');
|
||||
} catch (Exception $e) {
|
||||
/**
|
||||
* The laravel cache is volatile in each session, you can specify the duration
|
||||
* value in minutes for each session. We use 2 minutes, enough time to retrieve
|
||||
* the error message if there is one.
|
||||
*/
|
||||
Cache::put('errorMessageIfNotAuthenticate', $e->getMessage(), 2);
|
||||
}
|
||||
|
||||
G::header($header);
|
||||
return;
|
||||
Reference in New Issue
Block a user