Solving conflict in workflow/engine/content/languages/translation.en

This commit is contained in:
Julio Cesar Laura Avendaño
2020-04-24 22:45:18 +00:00
30 changed files with 1184 additions and 224 deletions

View File

@@ -1741,7 +1741,8 @@ class PmDynaform
return false;
}
foreach ($result as $row) {
$json = G::json_decode($row->DYN_CONTENT);
$dynaform = new PmDynaform(["CURRENT_DYNAFORM" => $row->DYN_UID]);
$json = G::json_decode($dynaform->record["DYN_CONTENT"]);
if ($this->jsoni($json, $variable)) {
return $row->DYN_UID;
}

File diff suppressed because one or more lines are too long

View File

@@ -7100,8 +7100,8 @@ msgstr "Delete data..."
# TRANSLATION
# LABEL/ID_EMAIL_SERVER_DELETE_WARNING_MESSAGE
#: LABEL/ID_EMAIL_SERVER_DELETE_WARNING_MESSAGE
msgid "[LABEL/ID_EMAIL_SERVER_DELETE_WARNING_MESSAGE] Do you want to delete the Email Server?"
msgstr "Do you want to delete the Email Server?"
msgid "[LABEL/ID_EMAIL_SERVER_DELETE_WARNING_MESSAGE] Are you sure you want to delete this Email Server? the components that were using it will now use the default email server."
msgstr "Are you sure you want to delete this Email Server? the components that were using it will now use the default email server."
# TRANSLATION
# LABEL/ID_EMAIL_SERVER_DOES_NOT_EXIST

View File

@@ -12,6 +12,7 @@ include PATH_LANGUAGECONT . "translation." . SYS_LANG;
class InstallerModule extends Controller
{
const MYSQL_VERSION_MAXIMUM_SUPPORTED = "5.7";
const PHP_VERSION_MINIMUM_SUPPORTED = "7.1";
const PHP_VERSION_NOT_SUPPORTED = "7.4";
public $path_config;

View File

@@ -58003,7 +58003,7 @@ INSERT INTO TRANSLATION (TRN_CATEGORY,TRN_ID,TRN_LANG,TRN_VALUE,TRN_UPDATE_DATE
( 'LABEL','ID_EMAIL_SERVER_CONFIRM_DELETE','en','Do you want to delete the Email Server?','2014-12-24') ,
( 'LABEL','ID_EMAIL_SERVER_DEFAULT','en','Default','2014-12-24') ,
( 'LABEL','ID_EMAIL_SERVER_DELETE_DATA','en','Delete data...','2014-12-24') ,
( 'LABEL','ID_EMAIL_SERVER_DELETE_WARNING_MESSAGE','en','Do you want to delete the Email Server?','2015-01-15') ,
( 'LABEL','ID_EMAIL_SERVER_DELETE_WARNING_MESSAGE','en','Are you sure you want to delete this Email Server? the components that were using it will now use the default email server.','2015-01-15') ,
( 'LABEL','ID_EMAIL_SERVER_DOES_NOT_EXIST','en','The email server with {0}: {1} does not exist.','2014-12-24') ,
( 'LABEL','ID_EMAIL_SERVER_EDIT','en','Edit Email Server','2014-12-24') ,
( 'LABEL','ID_EMAIL_SERVER_FROM_MAIL_EMPTY','en','The email has not been sent because configuration email in the Email Server Settings (admin/settings/email) is empty. Please fill this information.','2016-03-13') ,

View File

@@ -1,25 +1,9 @@
<?php
/**
* cases_CatchExecute.php
*
* ProcessMaker Open Source Edition
* Copyright (C) 2004 - 2008 Colosa Inc.23
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
* This page is executed when we claim the case
*
* @link https://wiki.processmaker.com/3.2/Cases/Cases#Unassigned
*/
if (!isset($_SESSION['USER_LOGGED'])) {
$responseObject = new stdclass();
@@ -50,23 +34,23 @@ if (isset($_POST['form']['BTN_CANCEL'])) {
/* Includes */
$oCase = new Cases();
$sAppUid = $_SESSION['APPLICATION'];
$iDelIndex = $_SESSION['INDEX'];
$case = new Cases();
$appUid = $_SESSION['APPLICATION'];
$delIndex = $_SESSION['INDEX'];
$oAppDelegation = new AppDelegation();
$aDelegation = $oAppDelegation->load($sAppUid, $iDelIndex);
$appDelegation = new AppDelegation();
$delegation = $appDelegation->load($appUid, $delIndex);
//if there are no user in the delegation row, this case is still in selfservice
if ($aDelegation['USR_UID'] == "") {
$oCase->setCatchUser($_SESSION['APPLICATION'], $_SESSION['INDEX'], $_SESSION['USER_LOGGED']);
// if there are no user in the delegation row, this case is still in selfservice
if (empty($delegation['USR_UID'])) {
$case->setCatchUser($_SESSION['APPLICATION'], $_SESSION['INDEX'], $_SESSION['USER_LOGGED']);
/*----------------------------------********---------------------------------*/
$licensedFeatures = PMLicensedFeatures::getSingleton();
if ($licensedFeatures->verifyfeature('7qhYmF1eDJWcEdwcUZpT0k4S0xTRStvdz09')) {
$pmGoogle = new PmGoogleApi();
if ($pmGoogle->getServiceGmailStatus()) {
$labGmail = new labelsGmail();
$labGmail->addRelabelingToQueue($sAppUid, $iDelIndex, -1, true);
$labGmail->addRelabelingToQueue($appUid, $delIndex, -1, true);
}
}
@@ -76,7 +60,7 @@ if ($aDelegation['USR_UID'] == "") {
//add users email next task
$user = new Users();
$userInfo = $user->load($_SESSION['USER_LOGGED']);
$drive->addUsersDocumentDrive($sAppUid, array($userInfo['USR_EMAIL']));
$drive->addUsersDocumentDrive($appUid, [$userInfo['USR_EMAIL']]);
}
}
/*----------------------------------********---------------------------------*/
@@ -97,11 +81,11 @@ unset($_SESSION['TASK']);
die('<script type="text/javascript">
if (' . $validation . ') {
if (window.parent.frames.length != 0) {
parent.location = "open?APP_UID=' . $_SESSION['APPLICATION'] . '&DEL_INDEX=' . $_SESSION['INDEX'] . '&action=unassigned";
parent.location = "open?APP_UID=' . $_SESSION['APPLICATION'] . '&DEL_INDEX=' . $_SESSION['INDEX'] . '&action=jump";
} else {
window.location = "../cases/cases_Open?APP_UID=' . $_SESSION['APPLICATION'] . '&DEL_INDEX=' . $_SESSION['INDEX'] . '&action=unassigned";
window.location = "../cases/cases_Open?APP_UID=' . $_SESSION['APPLICATION'] . '&DEL_INDEX=' . $_SESSION['INDEX'] . '&action=jump";
}
} else {
window.location = "../cases/cases_Open?APP_UID=' . $_SESSION['APPLICATION'] . '&DEL_INDEX=' . $_SESSION['INDEX'] . '&action=unassigned";
window.location = "../cases/cases_Open?APP_UID=' . $_SESSION['APPLICATION'] . '&DEL_INDEX=' . $_SESSION['INDEX'] . '&action=jump";
}
</script>');

View File

@@ -46,7 +46,7 @@ if (empty($_GET['v'])) {
//Send the parameter a = Case UID
if ($RBAC->userCanAccess('PM_FOLDERS_ALL') != 1 && defined('DISABLE_DOWNLOAD_DOCUMENTS_SESSION_VALIDATION') && DISABLE_DOWNLOAD_DOCUMENTS_SESSION_VALIDATION == 0) {
if (!$oAppDocument->canDownloadInput($_SESSION['USER_LOGGED'], $_GET['a'], $docVersion)) {
G::header('Location: /errors/error403.php');
G::header('Location: /errors/error403.php?url=' . urlencode($_SERVER['REQUEST_URI']));
die();
}
}

View File

@@ -53,20 +53,21 @@ if ($RBAC->userCanAccess('PM_FOLDERS_ALL') != 1 && defined('DISABLE_DOWNLOAD_DOC
$sAppDocUid
)
) {
G::header('Location: /errors/error403.php');
G::header('Location: /errors/error403.php?url=' . urlencode($_SERVER['REQUEST_URI']));
die();
}
}
$docFileName = fixContentDispositionFilename($oAppDocument->getAppDocFilename());
$info = pathinfo($docFileName);
if (!isset($_GET['ext'])) {
$ext = $info['extension'];
$ext = (!empty($info['extension'])) ? $info['extension']: 'pdf';
} else {
if ($_GET['ext'] != '') {
$ext = $_GET['ext'];
} else {
$ext = $info['extension'];
$ext = (!empty($info['extension'])) ? $info['extension']: 'pdf';
}
}
$ver = (isset($_GET['v']) && $_GET['v'] != '') ? '_' . $_GET['v'] : '';

View File

@@ -39,20 +39,40 @@ $aFields = array();
//Validated redirect url
$aFields['URL'] = '';
if (!empty($_GET['u'])) {
if (!empty($_GET['u']) || !empty($_GET['url'])) {
//clean url with protocols
$flagUrl = true;
//Most used protocols
$protocols = ['https://', 'http://', 'ftp://', 'sftp://','smb://', 'file:', 'mailto:'];
foreach ($protocols as $protocol) {
if (strpos($_GET['u'], $protocol) !== false) {
$_GET['u'] = '';
$flagUrl = false;
break;
if (!empty($_GET['u'])) {
if (strpos($_GET['u'], $protocol) !== false) {
$_GET['u'] = '';
$flagUrl = false;
break;
}
}
if (!empty($_GET['url'])) {
if (strpos($_GET['url'], $protocol) !== false) {
$_GET['url'] = '';
$flagUrl = false;
break;
}
}
}
if ($flagUrl) {
$aFields['URL'] = htmlspecialchars(addslashes(stripslashes(strip_tags(trim(urldecode($_GET['u']))))));
if (!empty($_GET['u'])) {
$aFields['URL'] = htmlspecialchars(addslashes(stripslashes(strip_tags(trim(urldecode($_GET['u']))))));
} elseif (!empty($_GET['url'])) {
$aFields['URL'] = htmlspecialchars(addslashes(stripslashes(strip_tags(trim(urldecode($_GET['url']))))));
}
//The following validations are only for the links to an output document
if(!empty($_GET['v']) && (strpos($aFields['URL'], '/cases/cases_ShowOutputDocument') != false)) {
$aFields['URL'] .= "&v=" . $_GET['v'];
}
if(!empty($_GET['ext']) && (strpos($aFields['URL'], '/cases/cases_ShowOutputDocument') != false)) {
$aFields['URL'] .= "&ext=" . $_GET['ext'];
}
}
}

View File

@@ -1,107 +1,12 @@
<?php
use Processmaker\Core\System;
$filter = new InputFilter();
$_POST = $filter->xssFilterHard($_POST);
$_GET = $filter->xssFilterHard($_GET);
$request = isset($_POST['request']) ? $_POST['request'] : (isset($_GET['request']) ? $_GET['request'] : null);
function testConnection($type, $server, $user, $passwd, $port = 'none', $dbName = "")
{
if (($port == 'none') || ($port == '') || ($port == 0)) {
//setting defaults ports
switch ($type) {
case 'mysql':
$port = 3306;
break;
case 'pgsql':
$port = 5432;
break;
case 'mssql':
$port = 1433;
break;
case 'oracle':
$port = 1521;
break;
}
}
$Server = new Net($server);
$filter = new InputFilter();
if ($Server->getErrno() == 0) {
$Server->scannPort($port);
if ($Server->getErrno() == 0) {
$Server->loginDbServer($user, $passwd);
$Server->setDataBase($dbName, $port);
if ($Server->errno == 0) {
$response = $Server->tryConnectServer($type);
if ($response->status == 'SUCCESS') {
if ($Server->errno == 0) {
$message = "";
$response = $Server->tryConnectServer($type);
$server = $filter->validateInput($server);
$user = $filter->validateInput($user);
$passwd = $filter->validateInput($passwd);
$connDatabase = mysqli_connect($server, $user, $passwd);
$dbNameTest = "PROCESSMAKERTESTDC";
$dbNameTest = $filter->validateInput($dbNameTest, 'nosql');
$query = "CREATE DATABASE %s";
$query = $filter->preventSqlInjection($query, array($dbNameTest), $connDatabase);
$db = mysqli_query($connDatabase, $query);
$success = false;
if (!$db) {
$message = mysqli_error($connDatabase);
} else {
$usrTest = "wfrbtest";
$chkG = "GRANT ALL PRIVILEGES ON `%s`.* TO %s@'%%' IDENTIFIED BY 'sample' WITH GRANT OPTION";
$chkG = $filter->preventSqlInjection($chkG, array($dbNameTest, $usrTest), $connDatabase);
$ch = mysqli_query($connDatabase, $chkG);
if (!$ch) {
$message = mysqli_error($connDatabase);
} else {
$sqlCreateUser = "CREATE USER '%s'@'%%' IDENTIFIED BY '%s'";
$user = $filter->validateInput($user, 'nosql');
$sqlCreateUser = $filter->preventSqlInjection($sqlCreateUser, array($user . "_usertest", "sample"), $connDatabase);
$result = mysqli_query($connDatabase, $sqlCreateUser);
if (!$result) {
$message = mysqli_error($connDatabase);
} else {
$success = true;
$message = G::LoadTranslation('ID_SUCCESSFUL_CONNECTION');
}
$sqlDropUser = "DROP USER '%s'@'%%'";
$user = $filter->validateInput($user, 'nosql');
$sqlDropUser = $filter->preventSqlInjection($sqlDropUser, array($user . "_usertest"), $connDatabase);
mysqli_query($connDatabase, $sqlDropUser);
$sqlDropUser = "DROP USER %s@'%%'";
$usrTest = $filter->validateInput($usrTest, 'nosql');
$sqlDropUser = $filter->preventSqlInjection($sqlDropUser, array($usrTest), $connDatabase);
mysqli_query($connDatabase, $sqlDropUser);
}
$sqlDropDb = "DROP DATABASE %s";
$dbNameTest = $filter->validateInput($dbNameTest, 'nosql');
$sqlDropDb = $filter->preventSqlInjection($sqlDropDb, array($dbNameTest), $connDatabase);
mysqli_query($connDatabase, $sqlDropDb);
}
return array($success, ($message != "") ? $message : $Server->error);
} else {
return array(false, $Server->error);
}
} else {
return array(false, $Server->error);
}
} else {
return array(false, $Server->error);
}
} else {
return array(false, $Server->error);
}
} else {
return array(false, $Server->error);
}
}
switch ($request) {
//check if the APP_CACHE VIEW table and their triggers are installed
case 'info':
@@ -271,46 +176,25 @@ switch ($request) {
break;
case 'recreate-root':
$user = $_POST['user'];
$passwd = $_POST['password'];
$pass = $_POST['password'];
$server = $_POST['host'];
$code = $_POST['codeCaptcha'];
$aServer = explode(':', $server);
$serverName = $aServer[0];
$port = (count($aServer) > 1) ? $aServer[1] : "none";
$server = explode(':', $server);
$serverName = $server[0];
$port = (count($server) > 1) ? $server[1] : '';
if ($code !== $_SESSION['securimage_code_disp']['default']) {
echo G::loadTranslation('ID_CAPTCHA_CODE_INCORRECT');
break;
}
list($sucess, $msgErr) = testConnection(DB_ADAPTER, $serverName, $user, $passwd, $port);
if ($sucess) {
$sh = G::encryptOld(filemtime(PATH_GULLIVER . "/class.g.php"));
$h = G::encrypt($_POST['host'] . $sh . $_POST['user'] . $sh . $_POST['password'] . $sh . (1), $sh);
$insertStatements = "define ( 'HASH_INSTALLATION','{$h}' ); \ndefine ( 'SYSTEM_HASH', '{$sh}' ); \n";
$lines = [];
$content = '';
$filename = PATH_HOME . 'engine' . PATH_SEP . 'config' . PATH_SEP . 'paths_installed.php';
$lines = file($filename);
$count = 1;
foreach ($lines as $line_num => $line) {
$pos = strpos($line, "define");
if ($pos !== false && $count < 3) {
$content = $content . $line;
$count++;
}
list($success, $message) = System::checkPermissionsDbUser(DB_ADAPTER, $serverName, $port, $user, $pass);
if ($success) {
$id = 'ID_MESSAGE_ROOT_CHANGE_FAILURE';
if (System::regenerateCredentiaslPathInstalled($server, $user, $pass)) {
$id = 'ID_MESSAGE_ROOT_CHANGE_SUCESS';
}
$content = "<?php \n" . $content . "\n" . $insertStatements . "\n";
if (file_put_contents($filename, $content) != false) {
echo G::loadTranslation('ID_MESSAGE_ROOT_CHANGE_SUCESS');
} else {
echo G::loadTranslation('ID_MESSAGE_ROOT_CHANGE_FAILURE');
}
} else {
echo $msgErr;
$message = G::loadTranslation($id);
}
echo $message;
break;
case 'captcha':
require_once PATH_TRUNK . 'vendor/dapphp/securimage/securimage.php';

View File

@@ -1,37 +1,37 @@
<?php
/**
* Rebuilding the cases list cache and changing the MySQL credentials
*
* @see processWorkspace()
*
* @link https://wiki.processmaker.com/3.2/Clearing_the_Case_List_Cache
*/
use ProcessMaker\Core\Installer;
global $RBAC;
$RBAC->requirePermissions('PM_SETUP');
// header('Pragma: no-cache');
// header('Cache-Control: no-store, no-cache, must-revalidate');
// Define the content of the case list cache builder
$headPublisher = headPublisher::getSingleton();
$headPublisher->addExtJsScript('setup/appCacheViewConf', false); //adding a javascript file .js
$headPublisher->addContent('setup/appCacheViewConf'); //adding a html file .html.
// Get some configurations
$conf = new Configurations();
$conf->loadConfig($x, 'APP_CACHE_VIEW_ENGINE', '', '', '', '');
$lang = isset($conf->aConfig['LANG']) ? $conf->aConfig['LANG'] : 'en';
$oHeadPublisher = headPublisher::getSingleton();
//$oHeadPublisher->setExtSkin( 'xtheme-blue');
// Assign the language configured
$headPublisher->assign('currentLang', $lang);
$oHeadPublisher->addExtJsScript('setup/appCacheViewConf', false); //adding a javascript file .js
$oHeadPublisher->addContent('setup/appCacheViewConf'); //adding a html file .html.
$oConf = new Configurations();
$oConf->loadConfig($x, 'APP_CACHE_VIEW_ENGINE', '', '', '', '');
//first check about APP_CACHE_VIEW is enabled or not,
if (isset($oConf->aConfig['LANG']) && isset($oConf->aConfig['STATUS']) && $oConf->aConfig['STATUS'] == 'active') {
$appCacheViewEnabled = true;
// Get the mysql version
$mysqlVersion = getMysqlVersion();
$maxMysqlVersion = InstallerModule::MYSQL_VERSION_MAXIMUM_SUPPORTED;
if (version_compare($mysqlVersion, $maxMysqlVersion, '<')) {
$userNameMaxLength = 16;
} else {
$appCacheViewEnabled = false;
$userNameMaxLength = 32;
}
$lang = isset($oConf->aConfig['LANG']) ? $oConf->aConfig['LANG'] : 'en';
$headPublisher->assign('userNameMaxLength', $userNameMaxLength);
//$oHeadPublisher->assign('appCacheViewEnabled', $appCacheViewEnabled);
$labels = G::getTranslations(array('ID_PROCESSING','ID_CACHE_LANGUAGE','ID_CACHE_HOST','ID_CACHE_USER','ID_CACHE_PASSWORD','ID_CACHE_TITLE_INFO','ID_CACHE_SUBTITLE_REBUILD','ID_CACHE_BTN_BUILD','ID_CACHE_BUILDING','ID_CACHE_SUBTITLE_SETUP_DB','ID_CACHE_BTN_SETUP_PASSWRD','ID_CACHE_SUBTITLE_SETUP_SESSION','ID_CACHE_BTN_SETUP_SESSION'
));
// $oHeadPublisher->assign('TRANSLATIONS', $labels);
// $TRANSLATIONS->ID_PROCESSING = G::LoadTranslation('ID_PROCESSING');
// $oHeadPublisher->assign( 'TRANSLATIONS', $TRANSLATIONS); //translations
$oHeadPublisher->assign('currentLang', $lang); //current language
G::RenderPage('publish', 'extJs');
G::RenderPage('publish', 'extJs');

View File

@@ -7,6 +7,9 @@ use Exception;
use G;
use Illuminate\Support\Facades\Crypt;
use ProcessMaker\Core\System;
use ProcessMaker\Model\AbeConfiguration;
use ProcessMaker\Model\EmailEvent;
use ProcessMaker\Model\EmailServerModel;
use SpoolRun;
use TemplatePower;
use WsBase;
@@ -1071,6 +1074,11 @@ class EmailServer
public function delete($emailServerUid)
{
try {
$emailServerModel = new EmailServerModel();
//Verify if the email server is IMAP
$isImap = $emailServerModel->isImap($emailServerUid);
$abeConfiguration = new AbeConfiguration();
//Verify data
$this->throwExceptionIfNotExistsEmailServer($emailServerUid, $this->arrayFieldNameForException["emailServerUid"]);
$this->throwExceptionIfIsDefault($emailServerUid, $this->arrayFieldNameForException["emailServerUid"]);
@@ -1078,6 +1086,18 @@ class EmailServer
$criteria->add(\EmailServerPeer::MESS_UID, $emailServerUid, \Criteria::EQUAL);
\EmailServerPeer::doDelete($criteria);
//If the email server protocol is IMAP, then the field Receiver account of the Email Response option in Actions by Email will be empty.
if ($isImap) {
$abeConfiguration->updateReceiverUidToEmpty($emailServerUid);
}
//Update the ABE_CONFIGURATION email server
$abeConfiguration->updateEmailServerUidToDefaultOrEmpty($emailServerUid);
//Update the events that use this server
$emailEvent = new EmailEvent();
$emailEvent->updateServerAndFromToDefaultOrEmpty($emailServerUid);
//Logging the delete action
$this->getDefaultContextLog();
$info = array(

View File

@@ -97,4 +97,41 @@ class AbeConfiguration extends model
return $res;
}
/**
* Update the Receiver Uid when the email server is deleted
*
* @param string $emailServerUid
* @return void
*/
public function updateReceiverUidToEmpty($emailServerUid)
{
$query = AbeConfiguration::query();
$query->where('ABE_EMAIL_SERVER_RECEIVER_UID', '=', $emailServerUid);
$query->update(['ABE_EMAIL_SERVER_RECEIVER_UID' => '']);
}
/**
* Update the Email Server Uid when the email server is deleted
*
* @param string $emailServerUid
* @return void
*/
public function updateEmailServerUidToDefaultOrEmpty($emailServerUid)
{
$emailServerModel = new EmailServerModel();
$emailServerDefault = $emailServerModel->getEmailServerDefault();
$query = AbeConfiguration::query();
$query->where('ABE_EMAIL_SERVER_UID', '=', $emailServerUid);
if (!empty($emailServerDefault)) {
$query->update(['ABE_EMAIL_SERVER_UID' => $emailServerDefault['MESS_UID']]);
} else {
$query->update(['ABE_EMAIL_SERVER_UID' => '']);
}
}
}

View File

@@ -3,11 +3,31 @@
namespace ProcessMaker\Model;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Facades\DB;
use ProcessMaker\Model\EmailServerModel;
class EmailEvent extends Model
{
protected $table = 'EMAIL_EVENT';
public $timestamps = false;
/**
* Update the email event when the email server is deleted
*
* @param $emailServerUid
* @return void
*/
public function updateServerAndFromToDefaultOrEmpty($emailServerUid)
{
$emailServerModel = new EmailServerModel();
$emailServerDefault = $emailServerModel->getEmailServerDefault();
$query = EmailEvent::query();
$query->where('EMAIL_SERVER_UID', '=', $emailServerUid);
if (!empty($emailServerDefault)) {
$query->update(['EMAIL_SERVER_UID' => $emailServerDefault['MESS_UID'], 'EMAIL_EVENT_FROM' => $emailServerDefault['MESS_ACCOUNT']]);
} else {
$query->update(['EMAIL_SERVER_UID' => '', 'EMAIL_EVENT_FROM' => '']);
}
}
}

View File

@@ -103,4 +103,22 @@ class EmailServerModel extends Model
return $firstElement;
}
/**
* Check if the email server is IMAP
*
* @param string $emailServerUid
* @return boolean
*/
public function isImap($emailServerUid)
{
$query = EmailServerModel::query()->select(['EMAIL_SERVER.MESS_UID']);
$query->where('EMAIL_SERVER.MESS_UID', '=', $emailServerUid);
$query->where('MESS_ENGINE', '=', 'IMAP');
$res = $query->get()->values()->toArray();
if (!empty($res)) {
return true;
}
return false;
}
}

View File

@@ -0,0 +1,14 @@
<?php
namespace ProcessMaker\Model;
use Illuminate\Database\Eloquent\Model;
class LicenseManager extends Model
{
protected $table = "LICENSE_MANAGER";
protected $primaryKey = "LICENSE_UID";
public $incrementing = false;
public $timestamps = false;
}

View File

@@ -0,0 +1,14 @@
<?php
namespace ProcessMaker\Model;
use Illuminate\Database\Eloquent\Model;
class OauthClients extends Model
{
protected $table = "OAUTH_CLIENTS";
protected $primaryKey = "CLIENT_ID";
public $incrementing = false;
public $timestamps = false;
}

View File

@@ -4,10 +4,13 @@ namespace ProcessMaker\Services\OAuth2;
use Luracast\Restler\iAuthenticate;
use Luracast\Restler\RestException;
use OAuth2\Request;
use OAuth2\Response;
use PmoauthUserAccessTokens;
/*----------------------------------********---------------------------------*/
use ProcessMaker\ChangeLog\ChangeLog;
/*----------------------------------********---------------------------------*/
use ProcessMaker\Core\System;
use ProcessMaker\Policies\ControlUnderUpdating;
class Server implements iAuthenticate
{
@@ -271,30 +274,41 @@ class Server implements iAuthenticate
}
}
/**
* Stage 3: Client directly calls this api to exchange access token
*
* It can then use this access token to make calls to protected api
*
* It can then use this access token to make calls to protected api.
* @format JsonFormat,UploadFormat
* @param object $request
* @param boolean $returnResponse
* @return mixed
*/
public function postToken($request = null, $returnResponse = false)
{
\ProcessMaker\Policies\ControlUnderUpdating::verifyUnderUpgrading();
ControlUnderUpdating::verifyUnderUpgrading();
// Handle a request for an OAuth2.0 Access Token and send the response to the client
if ($request == null) {
$request = \OAuth2\Request::createFromGlobals();
$request = Request::createFromGlobals();
}
$grantTypeIdentifier = $request->request('grant_type');
if ($grantTypeIdentifier === 'password') {
$clientId = $request->request('client_id');
$clientSecret = $request->request('client_secret');
if (empty($clientId) || empty($clientSecret)) {
$message = "Invalid REST API credentials, please send a valid client_id and client_secret.";
$res = new Response();
$res->setError(400, 'invalid_client', $message);
$res->send();
return;
}
}
$response = $this->server->handleTokenRequest($request); //Set/Get token //PmPdo->setAccessToken()
$token = $response->getParameters();
if (array_key_exists('access_token', $token)
&& array_key_exists('refresh_token', $token)
) {
if (array_key_exists('access_token', $token) && array_key_exists('refresh_token', $token)) {
if ($request == null) {
session_start();
}
@@ -302,16 +316,12 @@ class Server implements iAuthenticate
// verify if the client is our local PM Designer client
if ($data['client_id'] == self::getPmClientId()) {
//error_log('do stuff - is a request from local pm client');
//require_once "classes/model/PmoauthUserAccessTokens.php";
$userToken = new \PmoauthUserAccessTokens();
$userToken = new PmoauthUserAccessTokens();
$userToken->setAccessToken($token['access_token']);
$userToken->setRefreshToken($token['refresh_token']);
$userToken->setUserId($data['user_id']);
$userToken->setSessionId(session_id());
$userToken->setSessionName(session_name());
$userToken->save();
}
}
@@ -320,8 +330,7 @@ class Server implements iAuthenticate
return $response;
} else {
$response->send();
exit(0);
return;
}
}

View File

@@ -1,6 +1,8 @@
<?php
use Illuminate\Database\Eloquent\Model;
use Illuminate\Session\TokenMismatchException;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Str;
use ProcessMaker\Model\User;
@@ -586,3 +588,16 @@ function toSqlWithBindings(Illuminate\Database\Eloquent\Builder $queryObject) {
// Return query
return $query;
}
/**
* Get the version of the mysql
*
* @return string
*/
function getMysqlVersion()
{
$results = DB::select(DB::raw("select version()"));
$mysqlVersion = $results[0]->{'version()'};
return $mysqlVersion;
}

View File

@@ -88,6 +88,7 @@ Ext.onReady(function() {
fieldLabel: _('ID_CACHE_USER'), // 'User',
disabled: false,
name: 'user',
autoCreate: {tag: 'input', type: 'text', size: userNameMaxLength, autocomplete: 'off', maxlength: userNameMaxLength},
allowBlank: false
};