Merged in feature/PMCORE-2860 (pull request #7882)

PMCORE-2860

Approved-by: Julio Cesar Laura Avendaño
This commit is contained in:
Paula Quispe
2021-05-07 21:19:28 +00:00
committed by Julio Cesar Laura Avendaño
49 changed files with 1521 additions and 927 deletions

View File

@@ -12,6 +12,7 @@ use ProcessMaker\Model\Groupwf;
*/
class LdapAdvanced
{
/**
* The authsource id
* @var String
@@ -783,10 +784,18 @@ class LdapAdvanced
$cookie = '';
do {
ldap_control_paged_result($ldapcnn, $limit, true, $cookie);
$this->stdLog($ldapcnn, "ldap_control_paged_result", ["limit" => $limit]);
$searchResult = @ldap_list($ldapcnn, $dn, $filter, $this->arrayAttributesForUser);
$searchResult = @ldap_list(
$ldapcnn,
$dn,
$filter,
$this->arrayAttributesForUser,
0,
-1,
-1,
LDAP_DEREF_NEVER,
[['oid' => LDAP_CONTROL_PAGEDRESULTS, 'value' => ['size' => $limit, 'cookie' => $cookie]]]
);
ldap_parse_result($ldapcnn, $searchResult, $errcode, $matcheddn, $errmsg, $referrals, $controls);
$this->stdLog($ldapcnn, "ldap_list", ["filter" => $filter, "attributes" => $this->arrayAttributesForUser]);
if ($error = ldap_errno($ldapcnn)) {
@@ -805,10 +814,15 @@ class LdapAdvanced
}
if (!$flagError) {
ldap_control_paged_result_response($ldapcnn, $searchResult, $cookie);
$this->stdLog($ldapcnn, "ldap_control_paged_result_response");
if (isset($controls[LDAP_CONTROL_PAGEDRESULTS]['value']['cookie'])) {
// You need to pass the cookie from the last call to the next one
$cookie = $controls[LDAP_CONTROL_PAGEDRESULTS]['value']['cookie'];
} else {
$cookie = '';
}
}
} while (($cookie !== null && $cookie != '') && !$flagError);
// Empty cookie means last page
} while (!empty($cookie) && !$flagError);
//Get Users //2
if ($flagError) {
@@ -1773,10 +1787,20 @@ class LdapAdvanced
$cookie = '';
do {
ldap_control_paged_result($ldapcnn, $limit, true, $cookie);
$this->stdLog($ldapcnn, "ldap_control_paged_result", ["pageSize" => $limit, "isCritical" => true]);
$searchResult = @ldap_search(
$ldapcnn,
$arrayAuthenticationSourceData['AUTH_SOURCE_BASE_DN'],
$filter,
['dn', 'ou'],
0,
-1,
-1,
LDAP_DEREF_NEVER,
[['oid' => LDAP_CONTROL_PAGEDRESULTS, 'value' => ['size' => $limit, 'cookie' => $cookie]]]
);
ldap_parse_result($ldapcnn, $searchResult, $errcode, $matcheddn, $errmsg, $referrals, $controls);
$this->stdLog($ldapcnn, "ldap_search", ["filter" => $filter, "attributes" => ['dn', 'ou']]);
$searchResult = @ldap_search($ldapcnn, $arrayAuthenticationSourceData['AUTH_SOURCE_BASE_DN'], $filter, ['dn', 'ou']);
$context = [
"baseDN" => $arrayAuthenticationSourceData['AUTH_SOURCE_BASE_DN'],
"filter" => $filter,
@@ -1832,10 +1856,15 @@ class LdapAdvanced
}
if (!$flagError) {
ldap_control_paged_result_response($ldapcnn, $searchResult, $cookie);
$this->stdLog($ldapcnn, "ldap_control_paged_result_response", $context);
if (isset($controls[LDAP_CONTROL_PAGEDRESULTS]['value']['cookie'])) {
// You need to pass the cookie from the last call to the next one
$cookie = $controls[LDAP_CONTROL_PAGEDRESULTS]['value']['cookie'];
} else {
$cookie = '';
}
}
} while (($cookie !== null && $cookie != '') && !$flagError);
// Empty cookie means last page
} while (!empty($cookie) && !$flagError);
$str = '';
@@ -1979,6 +2008,7 @@ class LdapAdvanced
return $terminated;
}
/* activate an user previously deactivated
if user is now in another department, we need the second parameter, the depUid
@@ -2418,10 +2448,20 @@ class LdapAdvanced
$cookie = '';
do {
ldap_control_paged_result($ldapcnn, $limit, true, $cookie);
$this->stdLog($ldapcnn, "ldap_control_paged_result", ["pageSize" => $limit, "isCritical" => true]);
$searchResult = @ldap_search(
$ldapcnn,
$arrayAuthenticationSourceData['AUTH_SOURCE_BASE_DN'],
$filter,
['dn', 'cn'],
0,
-1,
-1,
LDAP_DEREF_NEVER,
[['oid' => LDAP_CONTROL_PAGEDRESULTS, 'value' => ['size' => $limit, 'cookie' => $cookie]]]
);
ldap_parse_result($ldapcnn, $searchResult, $errcode, $matcheddn, $errmsg, $referrals, $controls);
$this->stdLog($ldapcnn, "ldap_search", ["filter" => $filter, "attributes" => ['dn', 'cn']]);
$searchResult = @ldap_search($ldapcnn, $arrayAuthenticationSourceData['AUTH_SOURCE_BASE_DN'], $filter, ['dn', 'cn']);
$context = [
"baseDN" => $arrayAuthenticationSourceData['AUTH_SOURCE_BASE_DN'],
"filter" => $filter,
@@ -2459,10 +2499,15 @@ class LdapAdvanced
}
if (!$flagError) {
ldap_control_paged_result_response($ldapcnn, $searchResult, $cookie);
$this->stdLog($ldapcnn, "ldap_control_paged_result_response");
if (isset($controls[LDAP_CONTROL_PAGEDRESULTS]['value']['cookie'])) {
// You need to pass the cookie from the last call to the next one
$cookie = $controls[LDAP_CONTROL_PAGEDRESULTS]['value']['cookie'];
} else {
$cookie = '';
}
}
} while (($cookie !== null && $cookie != '') && !$flagError);
// Empty cookie means last page
} while (!empty($cookie) && !$flagError);
$str = '';
@@ -3244,4 +3289,5 @@ class LdapAdvanced
Log::channel(':ldapAdvanced')->error($message, Bootstrap::context($context));
}
}
}

View File

@@ -168,19 +168,19 @@ class PMmemcached
echo "<tr><td>Cumulative number of retrieval requests </td><td>" . $status["cmd_get"] . "</td></tr>";
echo "<tr><td> Cumulative number of storage requests </td><td>" . $status["cmd_set"] . "</td></tr>";
$percCacheHit = ((real) $status["get_hits"] / (real) $status["cmd_get"] * 100);
$percCacheHit = ((float) $status["get_hits"] / (float) $status["cmd_get"] * 100);
$percCacheHit = round( $percCacheHit, 3 );
$percCacheMiss = 100 - $percCacheHit;
echo "<tr><td>Number of keys that have been requested and found present </td><td>" . $status["get_hits"] . " ($percCacheHit%)</td></tr>";
echo "<tr><td>Number of items that have been requested and not found </td><td>" . $status["get_misses"] . "($percCacheMiss%)</td></tr>";
$MBRead = (real) $status["bytes_read"] / (1024 * 1024);
$MBRead = (float) $status["bytes_read"] / (1024 * 1024);
echo "<tr><td>Total number of bytes read by this server from network </td><td>" . $MBRead . " Mega Bytes</td></tr>";
$MBWrite = (real) $status["bytes_written"] / (1024 * 1024);
$MBWrite = (float) $status["bytes_written"] / (1024 * 1024);
echo "<tr><td>Total number of bytes sent by this server to network </td><td>" . $MBWrite . " Mega Bytes</td></tr>";
$MBSize = (real) $status["limit_maxbytes"] / (1024 * 1024);
$MBSize = (float) $status["limit_maxbytes"] / (1024 * 1024);
echo "<tr><td>Number of bytes this server is allowed to use for storage.</td><td>" . $MBSize . " Mega Bytes</td></tr>";
echo "<tr><td>Number of valid items removed from cache to free memory for new items.</td><td>" . $status["evictions"] . "</td></tr>";
echo "</table>";

View File

@@ -504,7 +504,7 @@ class Padl
mt_srand($seed);
for ($i = 0; $length > $i; $i++) {
$str .= $seeds{mt_rand(0, $seeds_count - 1)};
$str .= $seeds[mt_rand(0, $seeds_count - 1)];
}
return $str;
}

View File

@@ -250,7 +250,7 @@ class ReportTables
}
$string = $appData[$field['sFieldName']];
if (is_array($string)) {
$string = implode($string, ",");
$string = implode(",", $string);
}
$query .= ",'" . (isset($appData[$field['sFieldName']]) ? mysqli_real_escape_string($connection->getResource(), $string) : '') . "'";
break;

View File

@@ -1,6 +1,8 @@
<?php
use Illuminate\Support\Facades\Log;
use PHPMailer\PHPMailer\OAuth;
use PHPMailer\PHPMailer\PHPMailer;
use ProcessMaker\Core\System;
/**
@@ -519,18 +521,18 @@ class SpoolRun
case 'PHPMAILER':
case 'IMAP':
case 'GMAILAPI':
case 'OFFICE365API':
$phpMailer = new PHPMailer();
switch ($this->config['MESS_ENGINE']) {
case 'MAIL':
$phpMailer = new PHPMailer();
$phpMailer->Mailer = 'mail';
break;
case 'IMAP':
case 'PHPMAILER':
$phpMailer = new PHPMailer(true);
$phpMailer->Mailer = 'smtp';
break;
case 'GMAILAPI':
$phpMailer = new PHPMailerOAuth();
case 'OFFICE365API':
$phpMailer->AuthType = 'XOAUTH2';
$phpMailer->isSMTP();
break;
@@ -544,6 +546,7 @@ class SpoolRun
case 'IMAP':
case 'PHPMAILER':
case 'GMAILAPI':
case 'OFFICE365API':
//Posible Options for SMTPSecure are: "", "ssl" or "tls"
if (isset($this->config['SMTPSecure']) && preg_match('/^(ssl|tls)$/', $this->config['SMTPSecure'])) {
$phpMailer->SMTPSecure = $this->config['SMTPSecure'];
@@ -558,14 +561,42 @@ class SpoolRun
$phpMailer->Encoding = "8bit";
$phpMailer->Host = $this->config['MESS_SERVER'];
$phpMailer->Port = $this->config['MESS_PORT'];
if ($this->config['MESS_ENGINE'] !== 'GMAILAPI') {
if (!in_array($this->config['MESS_ENGINE'], ['GMAILAPI', 'OFFICE365API'])) {
$phpMailer->Username = $this->config['MESS_ACCOUNT'];
$phpMailer->Password = $this->config['MESS_PASSWORD'];
} else {
$phpMailer->oauthUserEmail = $this->config['MESS_ACCOUNT'];
$phpMailer->oauthClientId = $this->config['OAUTH_CLIENT_ID'];
$phpMailer->oauthClientSecret = $this->config['OAUTH_CLIENT_SECRET'];
$phpMailer->oauthRefreshToken = $this->config['OAUTH_REFRESH_TOKEN'];
// Get provider
switch ($this->config['MESS_ENGINE']) {
case 'GMAILAPI':
$providerClass = '\League\OAuth2\Client\Provider\Google';
break;
case 'OFFICE365API':
$providerClass = '\Stevenmaguire\OAuth2\Client\Provider\Microsoft';
break;
default:
throw new Exception('Only Google and Microsoft OAuth2 providers are currently supported.');
break;
}
$provider = new $providerClass(
[
'clientId' => $this->config['OAUTH_CLIENT_ID'],
'clientSecret' => $this->config['OAUTH_CLIENT_SECRET'],
'accessType' => 'offline'
]
);
// Set OAuth to use
$phpMailer->setOAuth(
new OAuth(
[
'provider' => $provider,
'clientId' => $this->config['OAUTH_CLIENT_ID'],
'clientSecret' => $this->config['OAUTH_CLIENT_SECRET'],
'refreshToken' => $this->config['OAUTH_REFRESH_TOKEN'],
'userName' => $this->config['MESS_ACCOUNT']
]
)
);
}
//From

View File

@@ -3,6 +3,7 @@
use App\Jobs\EmailEvent;
use Illuminate\Support\Facades\Crypt;
use ProcessMaker\BusinessModel\Cases as BmCases;
use ProcessMaker\BusinessModel\Cases\Unassigned;
use ProcessMaker\BusinessModel\EmailServer;
/*----------------------------------********---------------------------------*/
use ProcessMaker\ChangeLog\ChangeLog;
@@ -541,41 +542,33 @@ class WsBase
/**
* Get unassigned case list
*
* @param string $userId
* @param string $userUid
*
* @return $result will return an object
*/
public function unassignedCaseList($userId)
public function unassignedCaseList($userUid)
{
try {
$result = [];
$oAppCache = new AppCacheView();
$Criteria = $oAppCache->getUnassignedListCriteria($userId);
$oDataset = AppCacheViewPeer::doSelectRS($Criteria);
$oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
$oDataset->next();
while ($aRow = $oDataset->getRow()) {
$result[] = array(
'guid' => $aRow['APP_UID'],
'name' => $aRow['APP_NUMBER'],
'delIndex' => $aRow['DEL_INDEX'],
'processId' => $aRow['PRO_UID']
);
$oDataset->next();
$unassigned = new Unassigned();
$unassigned->setUserUid($userUid);
$data = $unassigned->getData();
foreach ($data as $var) {
array_push($result, [
'guid' => $var['APP_UID'],
'name' => $var['APP_NUMBER'],
'delIndex' => $var['DEL_INDEX'],
'processId' => $var['PRO_UID']
]);
}
return $result;
} catch (Exception $e) {
$result[] = array(
$result[] = [
'guid' => $e->getMessage(),
'name' => $e->getMessage(),
'status' => $e->getMessage(),
'status' => $e->getMessage(),
'processId' => $e->getMessage()
);
];
return $result;
}
}

View File

@@ -270,19 +270,19 @@ class PMScript
{
switch ($stepType) {
case 'DYNAFORM':
$executedOn = $triggerType === 'BEFORE' ? self::BEFORE_DYNAFORM : $triggerType === 'AFTER' ?
$executedOn = ($triggerType === 'BEFORE' ? self::BEFORE_DYNAFORM : $triggerType === 'AFTER') ?
self::AFTER_DYNAFORM : self::UNDEFINED_ORIGIN;
break;
case 'INPUT_DOCUMENT':
$executedOn = $triggerType === 'BEFORE' ? self::BEFORE_INPUT_DOCUMENT : $triggerType === 'AFTER' ?
$executedOn = ($triggerType === 'BEFORE' ? self::BEFORE_INPUT_DOCUMENT : $triggerType === 'AFTER') ?
self::AFTER_INPUT_DOCUMENT : self::UNDEFINED_ORIGIN;
break;
case 'OUTPUT_DOCUMENT':
$executedOn = $triggerType === 'BEFORE' ? self::BEFORE_OUTPUT_DOCUMENT : $triggerType === 'AFTER' ?
$executedOn = ($triggerType === 'BEFORE' ? self::BEFORE_OUTPUT_DOCUMENT : $triggerType === 'AFTER') ?
self::AFTER_OUTPUT_DOCUMENT : self::UNDEFINED_ORIGIN;
break;
case 'EXTERNAL':
$executedOn = $triggerType === 'BEFORE' ? self::BEFORE_EXTERNAL_STEP : $triggerType === 'AFTER' ?
$executedOn = ($triggerType === 'BEFORE' ? self::BEFORE_EXTERNAL_STEP : $triggerType === 'AFTER') ?
self::AFTER_EXTERNAL_STEP : self::UNDEFINED_ORIGIN;
break;
case 'ASSIGN_TASK':

View File

@@ -817,7 +817,7 @@ class ProcessMakerWebDav extends HTTP_WebDAV_Server
if ($options["overwrite"]) {
$stat = $this->DELETE(array("path" => $options["dest"]
));
if (($stat{0} != "2") && (substr($stat, 0, 3) != "404")) {
if (($stat[0] != "2") && (substr($stat, 0, 3) != "404")) {
return $stat;
}
} else {

View File

@@ -99,7 +99,7 @@ class EmailServerMapBuilder
$tMap->addColumn('OAUTH_CLIENT_SECRET', 'OauthClientSecret', 'string', CreoleTypes::VARCHAR, true, 512);
$tMap->addColumn('OAUTH_REFRESH_TOKEN', 'OauthRefreshToken', 'string', CreoleTypes::VARCHAR, true, 512);
$tMap->addColumn('OAUTH_REFRESH_TOKEN', 'OauthRefreshToken', 'string', CreoleTypes::LONGVARCHAR, false, null);
} // doBuild()

View File

@@ -133,7 +133,7 @@ abstract class BaseEmailServer extends BaseObject implements Persistent
* The value for the oauth_refresh_token field.
* @var string
*/
protected $oauth_refresh_token = '';
protected $oauth_refresh_token;
/**
* Flag to prevent endless save loop, if this object is referenced
@@ -736,7 +736,7 @@ abstract class BaseEmailServer extends BaseObject implements Persistent
$v = (string) $v;
}
if ($this->oauth_refresh_token !== $v || $v === '') {
if ($this->oauth_refresh_token !== $v) {
$this->oauth_refresh_token = $v;
$this->modifiedColumns[] = EmailServerPeer::OAUTH_REFRESH_TOKEN;
}

View File

@@ -5070,7 +5070,7 @@
<column name="MESS_DEFAULT" type="INTEGER" required="true" default="0"/>
<column name="OAUTH_CLIENT_ID" type="VARCHAR" size="512" required="true" default=""/>
<column name="OAUTH_CLIENT_SECRET" type="VARCHAR" size="512" required="true" default=""/>
<column name="OAUTH_REFRESH_TOKEN" type="VARCHAR" size="512" required="true" default=""/>
<column name="OAUTH_REFRESH_TOKEN" type="LONGVARCHAR" required="false"/>
</table>
<table name="WEB_ENTRY_EVENT">

File diff suppressed because one or more lines are too long

View File

@@ -22352,8 +22352,8 @@ msgstr "Open SSL is optional"
# TRANSLATION
# LABEL/ID_PROCESSMAKER_REQUIREMENTS_PHP
#: LABEL/ID_PROCESSMAKER_REQUIREMENTS_PHP
msgid "PHP recommended version 7.3, we maintain compatibility starting with PHP 7.1"
msgstr "PHP recommended version 7.3, we maintain compatibility starting with PHP 7.1"
msgid "PHP recommended version 7.4, we maintain compatibility starting with PHP 7.3"
msgstr "PHP recommended version 7.4, we maintain compatibility starting with PHP 7.3"
# TRANSLATION
# LABEL/ID_PROCESSMAKER_REQUIREMENTS_SOAP
@@ -24599,6 +24599,12 @@ msgstr "Server"
msgid "Server Address"
msgstr "Server Address"
# TRANSLATION
# LABEL/ID_SERVER_API
#: LABEL/ID_SERVER_API
msgid "Server API"
msgstr "Server API"
# TRANSLATION
# LABEL/ID_SERVER_COMMUNICATION_ERROR
#: LABEL/ID_SERVER_COMMUNICATION_ERROR

View File

@@ -13,8 +13,8 @@ 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";
const PHP_VERSION_MINIMUM_SUPPORTED = "7.3";
const PHP_VERSION_NOT_SUPPORTED = "8";
public $path_config;
public $path_languages;
public $path_plugins;
@@ -618,10 +618,14 @@ class InstallerModule extends Controller
try {
$host = $host === 'localhost' || $host === '127.0.0.1' ? 'localhost' : '%';
$query = "GRANT ALL PRIVILEGES ON `$psDatabase`.* TO $psUser@'$host' IDENTIFIED BY '$psPassword' WITH GRANT OPTION";
$query = "CREATE USER '$psUser'@'$host' IDENTIFIED WITH mysql_native_password BY '$psPassword'";
DB::connection(self::CONNECTION_INSTALL)
->statement($query);
$query = "GRANT ALL PRIVILEGES ON `$psDatabase`.* TO '$psUser'@'$host' WITH GRANT OPTION";
DB::connection(self::CONNECTION_INSTALL)
->statement($query);
$this->installLog($query);
} catch (QueryException $e) {
@@ -725,9 +729,10 @@ class InstallerModule extends Controller
$dbText .= sprintf(" define ('DB_REPORT_USER', '%s' );\n", $wfGrantUser);
$dbText .= sprintf(" define ('DB_REPORT_PASS', '%s' );\n", $wfPass);
if (defined('PARTNER_FLAG') || isset($_REQUEST['PARTNER_FLAG'])) {
$requestFlag = $_REQUEST['PARTNER_FLAG'];
if (defined('PARTNER_FLAG') || isset($requestFlag])) {
$dbText .= "\n";
$dbText .= " define ('PARTNER_FLAG', " . (defined('PARTNER_FLAG') ? PARTNER_FLAG : isset($_REQUEST['PARTNER_FLAG']) ? $_REQUEST['PARTNER_FLAG'] : 'false') . ");\n";
$dbText .= " (define('PARTNER_FLAG', " . (defined('PARTNER_FLAG') ? PARTNER_FLAG : isset(requestFlag)) ? $requestFlag : 'false') . ");\n";
if (!empty($this->systemName)) {
$dbText .= " define ('SYSTEM_NAME', '" . $this->systemName . "');\n";
}

View File

@@ -61015,6 +61015,7 @@ INSERT INTO TRANSLATION (TRN_CATEGORY,TRN_ID,TRN_LANG,TRN_VALUE,TRN_UPDATE_DATE
( 'LABEL','ID_SENT_BY','en','Sent By','2014-01-15') ,
( 'LABEL','ID_SERVER','en','Server','2014-01-15') ,
( 'LABEL','ID_SERVER_ADDRESS','en','Server Address','2015-09-14') ,
( 'LABEL','ID_SERVER_API','en','Server API','2021-03-29') ,
( 'LABEL','ID_SERVER_COMMUNICATION_ERROR','en','Failed to connect to the server','2014-01-15') ,
( 'LABEL','ID_SERVER_ERROR','en','Server error','2014-09-18') ,
( 'LABEL','ID_SERVER_IP','en','Server IP Address','2014-01-15') ,

View File

@@ -2806,7 +2806,7 @@ CREATE TABLE `EMAIL_SERVER`
`MESS_DEFAULT` INTEGER default 0 NOT NULL,
`OAUTH_CLIENT_ID` VARCHAR(512) default '' NOT NULL,
`OAUTH_CLIENT_SECRET` VARCHAR(512) default '' NOT NULL,
`OAUTH_REFRESH_TOKEN` VARCHAR(512) default '' NOT NULL,
`OAUTH_REFRESH_TOKEN` MEDIUMTEXT,
PRIMARY KEY (`MESS_UID`)
)ENGINE=InnoDB DEFAULT CHARSET='utf8';
#-----------------------------------------------------------------------------

View File

@@ -26,7 +26,7 @@ class Xml_DOMDocumentExtended extends DOMDocument
}
}
$mValue = $this->toArray($oChildNode);
$sKey = ($oChildNode->nodeName{0} == '#') ? 0 : $oChildNode->nodeName;
$sKey = ($oChildNode->nodeName[0] == '#') ? 0 : $oChildNode->nodeName;
$mValue = is_array($mValue) ? $mValue[$oChildNode->nodeName] : $mValue;
// how many of thse child nodes do we have?
if ($iChildCount > 1) { // more than 1 child - make numeric array

View File

@@ -137,15 +137,29 @@ function deleteDocuments($aDocuments, $opt)
}
return true;
}
/////////////////////////////////////////////
function getExtJSParams()
/**
* Get the default menu
*/
function getExtJSParams ()
{
$validParams = array('callback' => '', 'dir' => 'DESC', 'sort' => '', 'start' => 0, 'limit' => 25, 'filter' => '',
'search' => '', 'action' => '', 'xaction' => '', 'data' => '', 'status' => '', 'query' => '', 'fields' => "");
$result = array();
foreach ($validParams as $paramName => $paramDefault) {
$result[$paramName] = isset($_REQUEST[$paramName]) ?
$_REQUEST[$paramName] : isset($_REQUEST[$paramName]) ? $_REQUEST[$paramName] : $paramDefault;
$validParams = [
'callback' => '',
'dir' => 'DESC',
'sort' => '',
'start' => 0,
'limit' => 25,
'filter' => '',
'search' => '',
'action' => '',
'xaction' => '',
'data' => '',
'status' => '',
'query' => '',
'fields' => ''
];
$result = [];
foreach ($validParams as $param => $default) {
$result[$param] = ($request[$param] ?? isset($request[$param])) ? $request[$param] : $default;
}
return $result;
}

View File

@@ -22,12 +22,29 @@ $functionParams = isset( $_REQUEST['params'] ) ? $_REQUEST['params'] : array ();
$functionName( $functionParams );
/**
* Get the default menu
*/
function getExtJSParams ()
{
$validParams = array ('callback' => '','dir' => 'DESC','sort' => '','start' => 0,'limit' => 25,'filter' => '','search' => '','action' => '','xaction' => '','data' => '','status' => '','query' => '','fields' => "");
$result = array ();
foreach ($validParams as $paramName => $paramDefault) {
$result[$paramName] = isset( $_REQUEST[$paramName] ) ? $_REQUEST[$paramName] : isset( $_REQUEST[$paramName] ) ? $_REQUEST[$paramName] : $paramDefault;
$validParams = [
'callback' => '',
'dir' => 'DESC',
'sort' => '',
'start' => 0,
'limit' => 25,
'filter' => '',
'search' => '',
'action' => '',
'xaction' => '',
'data' => '',
'status' => '',
'query' => '',
'fields' => ''
];
$result = [];
foreach ($validParams as $param => $default) {
$result[$param] = ($request[$param] ?? isset($request[$param])) ? $request[$param] : $default;
}
return $result;
}

View File

@@ -2,6 +2,7 @@
use ProcessMaker\Core\System;
use ProcessMaker\GmailOAuth\GmailOAuth;
use ProcessMaker\Office365OAuth\Office365OAuth;
$option = (isset($_POST["option"])) ? $_POST["option"] : "";
$response = [];
@@ -232,6 +233,8 @@ 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");
@@ -258,6 +261,38 @@ 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);

View File

@@ -0,0 +1,42 @@
<?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;

View File

@@ -346,7 +346,9 @@ function to_camel_case ($str, $capitalise_first_char = true)
if ($capitalise_first_char) {
$str[0] = strtoupper( $str[0] );
}
$func = create_function( '$c', 'return strtoupper($c[1]);' );
$func = function ($c) {
return strtoupper($c[1]);
};
return preg_replace_callback( '/_([a-z])/', $func, $str );
}

View File

@@ -264,7 +264,7 @@ try {
$oCriteria = new Criteria('workflow');
$oCriteria->add(AppDelegationPeer::APP_UID, $_SESSION['APPLICATION']);
$oCriteria->add(AppDelegationPeer::TAS_UID, $aTasks, Criteria::IN);
$oCriteria->add($oCriteria->getNewCriterion(AppDelegationPeer::DEL_FINISH_DATE, null, Criteria::ISNULL)->addOr($oCriteria->getNewCriterion(AppDelegationPeer::DEL_FINISH_DATE, '')));
$oCriteria->add($oCriteria->getNewCriterion(AppDelegationPeer::DEL_FINISH_DATE, null, Criteria::ISNULL)->addOr($oCriteria->getNewCriterion(AppDelegationPeer::DEL_FINISH_DATE, '0000-00-00 00:00:00')));
if (AppDelegationPeer::doCount($oCriteria) > 0) {
$oStage->color = '#FF0000';
} else {

View File

@@ -1,46 +1,26 @@
<?php
/**
* triggers_WizardSave.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.
*/
if (($RBAC_Response = $RBAC->userCanAccess("PM_FACTORY")) != 1) {
return $RBAC_Response;
}
require_once ('classes/model/Triggers.php');
$oTrigger = new Triggers();
if (!class_exists('Triggers')) {
require_once ('classes/model/Triggers.php');
}
$triggers = new Triggers();
$oProcessMap = new ProcessMap(new DBConnection());
$processMap = new ProcessMap(new DBConnection());
$aDataTriggers = $_POST;
$post = $_POST;
$aInfoFunction = explode(",", $aDataTriggers['ALLFUNCTION']);
$aInfoFunctionType = explode(",", $aDataTriggers['ALLFUNCTION_TYPE']);
$allFunction = explode(",", $post['ALLFUNCTION']);
$allFunctionType = explode(",", $post['ALLFUNCTION_TYPE']);
$sPMfunction = "
$template = "
/***************************************************
*
* Generated by ProcessMaker Trigger Wizard
* Library: " . $aDataTriggers['LIBRARY_NAME'] . "
* Method: " . $aDataTriggers['PMFUNTION_LABEL'] . "
* Library: " . $post['LIBRARY_NAME'] . "
* Method: " . $post['PMFUNTION_LABEL'] . "
* Date: " . date("Y-m-d H:i:s") . "
*
* ProcessMaker " . date("Y") . "
@@ -49,65 +29,69 @@ $sPMfunction = "
";
$methodParamsFinal = array();
$params = [];
//Generate params to send
$i = 0;
foreach ($aInfoFunction as $k => $v) {
foreach ($allFunction as $k => $v) {
if ($v != '') {
$sOptionTrigger = trim(str_replace("$", "", $v));
if (strstr($sOptionTrigger, "=")) {
$aOptionParameters = explode("=", $sOptionTrigger);
$sOptionTrigger = trim($aOptionParameters[0]);
$key = trim(str_replace("$", "", $v));
if (strstr($key, "=")) {
$parameter = explode("=", $key);
$key = trim($parameter[0]);
}
if ($aDataTriggers[$sOptionTrigger] != '') {
if ($post[$key] != '') {
if ((strstr($aDataTriggers[$sOptionTrigger], "@@")) || ($aDataTriggers['PMFUNTION_NAME'] == 'evaluateFunction' && $k == 0 && strstr($aDataTriggers[$sOptionTrigger], "@="))) {
$option = trim($aDataTriggers[$sOptionTrigger]);
if ((strstr($post[$key], "@@")) || ($post['PMFUNTION_NAME'] == 'evaluateFunction' && $k == 0 && strstr($post[$key], "@="))) {
$option = trim($post[$key]);
} else {
$aDataTriggers[$sOptionTrigger] = (strstr($aDataTriggers[$sOptionTrigger], 'array')) ? str_replace("'", '"', $aDataTriggers[$sOptionTrigger]) : str_replace("'", "\'", $aDataTriggers[$sOptionTrigger]);
switch (trim($aInfoFunctionType[$i])) {
$post[$key] = strstr($post[$key], 'array') !== false ? str_replace("'", '"', $post[$key]) : str_replace("'", "\'", $post[$key]);
switch (trim($allFunctionType[$i])) {
case 'boolean':
$option = $aDataTriggers[$sOptionTrigger];
$option = $post[$key];
break;
case 'int':
$option = intval($aDataTriggers[$sOptionTrigger]);
$option = intval($post[$key]);
break;
case 'float':
case 'real':
case 'double':
$option = floatval($aDataTriggers[$sOptionTrigger]);
$option = floatval($post[$key]);
break;
default:
$option = (is_numeric($aDataTriggers[$sOptionTrigger]) || is_bool($aDataTriggers[$sOptionTrigger]) ) ? trim($aDataTriggers[$sOptionTrigger]) : (strstr($aDataTriggers[$sOptionTrigger], "'.array.'")) ? trim($aDataTriggers[$sOptionTrigger]) : '"' . trim($aDataTriggers[$sOptionTrigger]) . '"';
if (is_numeric($post[$key]) || is_bool($post[$key]) || (strstr($post[$key], "'.array.'") !== false)) {
$option = trim($post[$key]);
} else {
$option = '"' . trim($post[$key]) . '"';
}
break;
}
}
} else {
$option = "''";
}
$methodParamsFinal[] = $option;
$params[] = $option;
}
$i++;
}
//G::pr($methodParamsFinal);die;
$sPMfunction .= (isset($aDataTriggers['TRI_ANSWER']) && $aDataTriggers['TRI_ANSWER'] != '') ? $aDataTriggers['TRI_ANSWER'] . " = " : "";
$sPMfunction .= $aDataTriggers['PMFUNTION_NAME'] . " (" . implode(",", $methodParamsFinal) . ");";
$template .= (isset($post['TRI_ANSWER']) && $post['TRI_ANSWER'] != '') ? $post['TRI_ANSWER'] . " = " : "";
$template .= $post['PMFUNTION_NAME'] . " (" . implode(",", $params) . ");";
//Create Trigger
$aDataTriggers['TRI_WEBBOT'] = $sPMfunction;
$aDataTriggersParams = array();
$aDataTriggersParams['hash'] = G::encryptOld($sPMfunction);
$aDataTriggersParams['params'] = $aDataTriggers;
$post['TRI_WEBBOT'] = $template;
$postParams = [];
$postParams['hash'] = G::encryptOld($template);
$postParams['params'] = $post;
$aDataTriggers['TRI_PARAM'] = serialize($aDataTriggersParams);
$oTrigger->create($aDataTriggers);
$post['TRI_PARAM'] = serialize($postParams);
$triggers->create($post);
//Update Info
$aDataTriggers['TRI_UID'] = $oTrigger->getTriUid();
$oTrigger->update($aDataTriggers);
$post['TRI_UID'] = $triggers->getTriUid();
$triggers->update($post);
//Update Trigger Array
$oProcessMap->triggersList($aDataTriggers['PRO_UID']);
$processMap->triggersList($post['PRO_UID']);

View File

@@ -1,48 +1,26 @@
<?php
/**
* triggers_WizardUpdate.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.
*/
if (($RBAC_Response = $RBAC->userCanAccess("PM_FACTORY")) != 1) {
return $RBAC_Response;
}
if (!class_exists('Triggers')) {
require_once ('classes/model/Triggers.php');
}
$oTrigger = new Triggers();
$triggers = new Triggers();
$oProcessMap = new ProcessMap(new DBConnection());
$processMap = new ProcessMap(new DBConnection());
$aDataTriggers = $_POST;
$triUid = $_POST['TRI_UID'];
$post = $_POST;
$aInfoFunction = explode(",", $aDataTriggers['ALLFUNCTION']);
$aInfoFunctionType = explode(",", $aDataTriggers['ALLFUNCTION_TYPE']);
$sPMfunction = "
$allFunction = explode(",", $post['ALLFUNCTION']);
$allFunctionType = explode(",", $post['ALLFUNCTION_TYPE']);
$template = "
/***************************************************
*
* Generated by ProcessMaker Trigger Wizard
* Library: " . $aDataTriggers['LIBRARY_NAME'] . "
* Method: " . $aDataTriggers['PMFUNTION_LABEL'] . "
* Library: " . $post['LIBRARY_NAME'] . "
* Method: " . $post['PMFUNTION_LABEL'] . "
* Date: " . date("Y-m-d H:i:s") . "
*
* ProcessMaker " . date("Y") . "
@@ -51,68 +29,69 @@ $sPMfunction = "
";
$methodParamsFinal = array();
$params = [];
//Generate params to send
$i = 0;
foreach ($aInfoFunction as $k => $v) {
foreach ($allFunction as $k => $v) {
if ($v != '') {
$sOptionTrigger = trim(str_replace("$", "", $v));
if (strstr($sOptionTrigger, "=")) {
$aOptionParameters = explode("=", $sOptionTrigger);
$sOptionTrigger = trim($aOptionParameters[0]);
$key = trim(str_replace("$", "", $v));
if (strstr($key, "=")) {
$parameter = explode("=", $key);
$key = trim($parameter[0]);
}
if ($aDataTriggers[$sOptionTrigger] != '') {
if ($post[$key] != '') {
if ((strstr($aDataTriggers[$sOptionTrigger], "@@")) || ($aDataTriggers['PMFUNTION_NAME'] == 'evaluateFunction' && $k == 0 && strstr($aDataTriggers[$sOptionTrigger], "@="))) {
$option = $aDataTriggers[$sOptionTrigger];
if ((strstr($post[$key], "@@")) || ($post['PMFUNTION_NAME'] == 'evaluateFunction' && $k == 0 && strstr($post[$key], "@="))) {
$option = trim($post[$key]);
} else {
$aDataTriggers[$sOptionTrigger] = (strstr($aDataTriggers[$sOptionTrigger], 'array')) ? str_replace("'", '"', $aDataTriggers[$sOptionTrigger]) : str_replace("'", "\'", $aDataTriggers[$sOptionTrigger]);
switch (trim($aInfoFunctionType[$i])) {
$post[$key] = strstr($post[$key], 'array') !== false ? str_replace("'", '"', $post[$key]) : str_replace("'", "\'", $post[$key]);
switch (trim($allFunctionType[$i])) {
case 'boolean':
$option = $aDataTriggers[$sOptionTrigger];
$option = $post[$key];
break;
case 'int':
$option = intval($aDataTriggers[$sOptionTrigger]);
$option = intval($post[$key]);
break;
case 'float':
case 'real':
case 'double':
$option = floatval($aDataTriggers[$sOptionTrigger]);
$option = floatval($post[$key]);
break;
default:
$option = (is_numeric($aDataTriggers[$sOptionTrigger]) || is_bool($aDataTriggers[$sOptionTrigger]) ) ? trim($aDataTriggers[$sOptionTrigger]) : (strstr($aDataTriggers[$sOptionTrigger], "array")) ? trim($aDataTriggers[$sOptionTrigger]) : '"' . trim($aDataTriggers[$sOptionTrigger]) . '"';
if (is_numeric($post[$key]) || is_bool($post[$key]) || (strstr($post[$key], "array") !== false)) {
$option = trim($post[$key]);
} else {
$option = '"' . trim($post[$key]) . '"';
}
break;
}
}
} else {
$option = "' '";
}
$methodParamsFinal[] = $option;
$params[] = $option;
}
$i++;
}
$sPMfunction .= (isset($aDataTriggers['TRI_ANSWER']) && $aDataTriggers['TRI_ANSWER'] != '') ? $aDataTriggers['TRI_ANSWER'] . " = " : "";
$sPMfunction .= $aDataTriggers['PMFUNTION_NAME'] . " (" . implode(",", $methodParamsFinal) . ");";
$template .= (isset($post['TRI_ANSWER']) && $post['TRI_ANSWER'] != '') ? $post['TRI_ANSWER'] . " = " : "";
$template .= $post['PMFUNTION_NAME'] . " (" . implode(",", $params) . ");";
//Create Trigger
$aDataTriggers['TRI_WEBBOT'] = $sPMfunction;
$aDataTriggersParams = array();
$aDataTriggersParams['hash'] = G::encryptOld($sPMfunction);
$aDataTriggersParams['params'] = $aDataTriggers;
$post['TRI_WEBBOT'] = $template;
$postParams = [];
$postParams['hash'] = G::encryptOld($template);
$postParams['params'] = $post;
$post['TRI_PARAM'] = serialize($postParams);
$triggers->load($_POST['TRI_UID']);
$aDataTriggers['TRI_PARAM'] = serialize($aDataTriggersParams);
//$oTrigger->create ( $aDataTriggers );
$aDataTriggerLoaded = $oTrigger->load($triUid);
//var_dump($aDataTriggerLoaded);
//die;
//Update Info
$aDataTriggers['TRI_UID'] = $oTrigger->getTriUid();
$oTrigger->update($aDataTriggers);
$post['TRI_UID'] = $triggers->getTriUid();
$triggers->update($post);
//Update Trigger Array
$oProcessMap->triggersList($aDataTriggers['PRO_UID']);
$processMap->triggersList($post['PRO_UID']);

View File

@@ -1,6 +1,12 @@
<?php
use ProcessMaker\BusinessModel\Cases\Draft;
use ProcessMaker\BusinessModel\Cases\Inbox;
use ProcessMaker\BusinessModel\Cases\Participated;
use ProcessMaker\BusinessModel\Cases\Paused;
use ProcessMaker\BusinessModel\Cases\Unassigned;
use ProcessMaker\Model\Process;
use ProcessMaker\Model\User;
try {
global $RBAC;
@@ -336,43 +342,81 @@ try {
echo '{success: true}';
break;
case 'summaryUserData':
//Get all information for the summary
$oUser = new Users();
$data = $oUser->loadDetailed($_REQUEST['USR_UID']);
$data['USR_STATUS'] = G::LoadTranslation('ID_' . $data['USR_STATUS']);
$oAppCache = new AppCacheView();
$aTypes = Array();
$aTypes['to_do'] = 'CASES_INBOX';
$aTypes['draft'] = 'CASES_DRAFT';
$aTypes['cancelled'] = 'CASES_CANCELLED';
$aTypes['sent'] = 'CASES_SENT';
$aTypes['paused'] = 'CASES_PAUSED';
$aTypes['completed'] = 'CASES_COMPLETED';
$aTypes['selfservice'] = 'CASES_SELFSERVICE';
$aCount = $oAppCache->getAllCounters(array_keys($aTypes), $_REQUEST['USR_UID']);
$dep = new Department();
if ($dep->existsDepartment($data['DEP_UID'])) {
$dep->Load($data['DEP_UID']);
$dep_name = $dep->getDepTitle();
} else {
$dep_name = '';
// Get all information for the summary
$result = [];
$usrUid = $_REQUEST['USR_UID'];
$usrId = User::getId($usrUid);
$data = User::getAllInformation($usrId);
$data = head($data);
$result['userdata'] = $data;
// Add additional user information
$isoCountry = IsoCountry::findById($data['USR_COUNTRY']);
$isoSubdivision = IsoSubdivision::findById($data['USR_COUNTRY'], $data['USR_CITY']);
$isoLocation = IsoLocation::findById($data['USR_COUNTRY'], $data['USR_CITY'], $data['USR_LOCATION']);
$result['userdata']['USR_COUNTRY_NAME'] = !empty($isoCountry["IC_NAME"]) ? $isoCountry["IC_NAME"] : '';
$result['userdata']['USR_CITY_NAME'] = !empty($isoSubdivision["IC_NAME"]) ? $isoSubdivision["IC_NAME"] : '';
$result['userdata']['USR_LOCATION_NAME'] = !empty($isoLocation["IC_NAME"]) ? $isoLocation["IC_NAME"] : '';
// Get the role name
$roles = new Roles();
$role = $roles->loadByCode($data['USR_ROLE']);
$result['userdata']['USR_ROLE_NAME'] = $role['ROL_NAME'];
// Get the language name
$translations = new Language();
$translation = $translations->loadByCode($data['USR_DEFAULT_LANG']);
$result['userdata']['USR_DEFAULT_LANG_NAME'] = $translation['LANGUAGE_NAME'];
// Get the full name
$conf = new Configurations();
$confSetting = $conf->getFormats();
$result['userdata']['USR_FULLNAME'] = G::getFormatUserList($confSetting['format'], $data);
// Get the cases counters
$types = [];
// For inbox
$inbox = new Inbox();
$inbox->setUserUid($usrUid);
$inbox->setUserId($usrId);
$types['to_do'] = $inbox->getCounter();
// For draft
$draft = new Draft();
$draft->setUserUid($usrUid);
$draft->setUserId($usrId);
$types['draft'] = $draft->getCounter();
// For Paused
$paused = new Paused();
$paused->setUserUid($usrUid);
$paused->setUserId($usrId);
$types['paused'] = $paused->getCounter();
// For Unassigned
$unassigned = new Unassigned();
$unassigned->setUserUid($usrUid);
$unassigned->setUserId($usrId);
$types['selfservice'] = $unassigned->getCounter();
// For started by me
$participated = new Participated();
$participated->setParticipatedStatus('STARTED');
$participated->setUserUid($usrUid);
$participated->setUserId($usrId);
$types['sent'] = $participated->getCounter();
$types['cancelled'] = 0;
$result['cases'] = $types;
// Get department name
$result['misc'] = [];
$dept = new Department();
$department = '';
if ($dept->existsDepartment($data['DEP_UID'])) {
$dept->Load($data['DEP_UID']);
$department = $dept->getDepTitle();
}
if ($data['USR_REPLACED_BY'] != '') {
$user = new Users();
$u = $user->load($data['USR_REPLACED_BY']);
$c = new Configurations();
$arrayConfFormat = $c->getFormats();
$replaced_by = G::getFormatUserList($arrayConfFormat['format'], $u);
} else {
$replaced_by = '';
$result['misc']['DEP_TITLE'] = $department;
// Get the user full name who will replace the current user
$replacedBy = '';
if (!empty($data['USR_REPLACED_BY'])) {
$usrId = User::getId($data['USR_REPLACED_BY']);
$dataUser = User::getAllInformation($usrId);
$replacedBy = G::getFormatUserList($confSetting['format'], head($dataUser));
}
$misc = Array();
$misc['DEP_TITLE'] = $dep_name;
$misc['REPLACED_NAME'] = $replaced_by;
echo '{success: true, userdata: ' . G::json_encode($data) . ', cases: ' . G::json_encode($aCount) . ', misc: ' . G::json_encode($misc) . '}';
$result['misc']['REPLACED_NAME'] = $replacedBy;
echo G::json_encode($result);
break;
case "verifyIfUserAssignedAsSupervisor":
//Before delete we check if is supervisor
$supervisor = new \ProcessMaker\BusinessModel\ProcessSupervisor();

View File

@@ -379,19 +379,19 @@ class CaseScheduler
throw new \Exception(\G::LoadTranslation("ID_CAN_NOT_BE_NULL", array('sch_start_day_opt_2')));
}
$caseSchedulerData['SCH_START_DAY'] = $nStartDay . '|' . $caseSchedulerData['SCH_START_DAY_OPT_2'];
$optionTwo = $caseSchedulerData['SCH_START_DAY_OPT_2']{0};
$optionTwo = $caseSchedulerData['SCH_START_DAY_OPT_2'][0];
if ($optionTwo == "1" || $optionTwo == "2" || $optionTwo == "3" || $optionTwo == "4" || $optionTwo == "5") {
$caseSchedulerData['SCH_START_DAY_OPT_2'] = $caseSchedulerData['SCH_START_DAY_OPT_2'];
} else {
throw new \Exception(\G::LoadTranslation("ID_INVALID_VALUE_FOR", array('sch_start_day_opt_2')));
}
$pipelineTwo = $caseSchedulerData['SCH_START_DAY_OPT_2']{1};
$pipelineTwo = $caseSchedulerData['SCH_START_DAY_OPT_2'][1];
if ($pipelineTwo == "|") {
$caseSchedulerData['SCH_START_DAY_OPT_2'] = $caseSchedulerData['SCH_START_DAY_OPT_2'];
} else {
throw new \Exception(\G::LoadTranslation("ID_INVALID_VALUE_FOR", array('sch_start_day_opt_2')));
}
$dayTwo = $caseSchedulerData['SCH_START_DAY_OPT_2']{2};
$dayTwo = $caseSchedulerData['SCH_START_DAY_OPT_2'][2];
if ($dayTwo == "1" || $dayTwo == "2" || $dayTwo == "3" || $dayTwo == "4" || $dayTwo == "5" || $dayTwo == "6" || $dayTwo == "7") {
$caseSchedulerData['SCH_START_DAY_OPT_2'] = $caseSchedulerData['SCH_START_DAY_OPT_2'];
} else {
@@ -669,19 +669,19 @@ class CaseScheduler
throw new \Exception(\G::LoadTranslation("ID_CAN_NOT_BE_NULL", array('sch_start_day_opt_2')));
}
$caseSchedulerData['SCH_START_DAY'] = $nStartDay . '|' . $caseSchedulerData['SCH_START_DAY_OPT_2'];
$optionTwo = $caseSchedulerData['SCH_START_DAY_OPT_2']{0};
$optionTwo = $caseSchedulerData['SCH_START_DAY_OPT_2'][0];
if ($optionTwo == "1" || $optionTwo == "2" || $optionTwo == "3" || $optionTwo == "4" || $optionTwo == "5") {
$caseSchedulerData['SCH_START_DAY_OPT_2'] = $caseSchedulerData['SCH_START_DAY_OPT_2'];
} else {
throw new \Exception(\G::LoadTranslation("ID_INVALID_VALUE_FOR", array('sch_start_day_opt_2')));
}
$pipelineTwo = $caseSchedulerData['SCH_START_DAY_OPT_2']{1};
$pipelineTwo = $caseSchedulerData['SCH_START_DAY_OPT_2'][1];
if ($pipelineTwo == "|") {
$caseSchedulerData['SCH_START_DAY_OPT_2'] = $caseSchedulerData['SCH_START_DAY_OPT_2'];
} else {
throw new \Exception(\G::LoadTranslation("ID_INVALID_VALUE_FOR", array('sch_start_day_opt_2')));
}
$dayTwo = $caseSchedulerData['SCH_START_DAY_OPT_2']{2};
$dayTwo = $caseSchedulerData['SCH_START_DAY_OPT_2'][2];
if ($dayTwo == "1" || $dayTwo == "2" || $dayTwo == "3" || $dayTwo == "4" || $dayTwo == "5" || $dayTwo == "6" || $dayTwo == "7") {
$caseSchedulerData['SCH_START_DAY_OPT_2'] = $caseSchedulerData['SCH_START_DAY_OPT_2'];
} else {

View File

@@ -8,6 +8,8 @@ use Exception;
use G;
use Illuminate\Support\Facades\Crypt;
use Illuminate\Support\Facades\Log;
use Net;
use PHPMailer\PHPMailer\SMTP;
use ProcessMaker\Core\System;
use ProcessMaker\Model\AbeConfiguration;
use ProcessMaker\Model\EmailEvent;
@@ -20,7 +22,7 @@ class EmailServer
{
private $arrayFieldDefinition = array(
"MESS_UID" => array("type" => "string", "required" => false, "empty" => false, "defaultValues" => array(), "fieldNameAux" => "emailServerUid"),
"MESS_ENGINE" => array("type" => "string", "required" => true, "empty" => false, "defaultValues" => array("PHPMAILER", "MAIL", "IMAP", "GMAILAPI"), "fieldNameAux" => "emailServerEngine"),
"MESS_ENGINE" => array("type" => "string", "required" => true, "empty" => false, "defaultValues" => array("PHPMAILER", "MAIL", "IMAP", "GMAILAPI", "OFFICE365API"), "fieldNameAux" => "emailServerEngine"),
"MESS_SERVER" => array("type" => "string", "required" => false, "empty" => true, "defaultValues" => array(), "fieldNameAux" => "emailServerServer"),
"MESS_PORT" => array("type" => "int", "required" => false, "empty" => true, "defaultValues" => array(), "fieldNameAux" => "emailServerPort"),
"MESS_INCOMING_SERVER" => array("type" => "string", "required" => false, "empty" => true, "defaultValues" => array(), "fieldNameAux" => "emailServerIncomingServer"),
@@ -247,12 +249,11 @@ class EmailServer
}
/**
* Test connection by step
* Test connection by step.
*
* @param array $arrayData Data
* @param int $step Step
*
* @return array, return array with result of test connection by step
* @param array $arrayData
* @param int $step
* @return string
* @throws Exception
*/
public function testConnectionByStep(array $arrayData, $step = 0)
@@ -262,40 +263,38 @@ class EmailServer
//MAIL
if ($arrayData["MESS_ENGINE"] == "MAIL") {
$arrayDataMail = array();
$arrayDataMail = [];
$eregMail = "/^[0-9a-zA-Z]+(?:[._][0-9a-zA-Z]+)*@[0-9a-zA-Z]+(?:[._-][0-9a-zA-Z]+)*\.[0-9a-zA-Z]{2,3}$/";
$arrayDataMail["FROM_EMAIL"] = ($arrayData["MESS_FROM_MAIL"] != "" && preg_match($eregMail, $arrayData["MESS_FROM_MAIL"]))? $arrayData["MESS_FROM_MAIL"] : "";
$arrayDataMail["FROM_NAME"] = ($arrayData["MESS_FROM_NAME"] != "")? $arrayData["MESS_FROM_NAME"] : G::LoadTranslation("ID_MESS_TEST_BODY");
$arrayDataMail["MESS_ENGINE"] = "MAIL";
$arrayDataMail["MESS_SERVER"] = "localhost";
$arrayDataMail["MESS_PORT"] = 25;
$arrayDataMail["MESS_ACCOUNT"] = $arrayData["MAIL_TO"];
$arrayDataMail["FROM_EMAIL"] = ($arrayData["MESS_FROM_MAIL"] != "" && preg_match($eregMail, $arrayData["MESS_FROM_MAIL"])) ? $arrayData["MESS_FROM_MAIL"] : "";
$arrayDataMail["FROM_NAME"] = ($arrayData["MESS_FROM_NAME"] != "") ? $arrayData["MESS_FROM_NAME"] : G::LoadTranslation("ID_MESS_TEST_BODY");
$arrayDataMail["MESS_ENGINE"] = "MAIL";
$arrayDataMail["MESS_SERVER"] = "localhost";
$arrayDataMail["MESS_PORT"] = 25;
$arrayDataMail["MESS_ACCOUNT"] = $arrayData["MAIL_TO"];
$arrayDataMail["MESS_PASSWORD"] = "";
$arrayDataMail["TO"] = $arrayData["MAIL_TO"];
$arrayDataMail["MESS_RAUTH"] = true;
$arrayDataMail["TO"] = $arrayData["MAIL_TO"];
$arrayDataMail["MESS_RAUTH"] = true;
$arrayTestMailResult = array();
$arrayTestMailResult = [];
try {
$arrayTestMailResult = $this->sendTestMail($arrayDataMail);
} catch (Exception $e) {
$arrayTestMailResult["status"] = false;
$arrayTestMailResult["message"] = $e->getMessage();
}
$arrayResult = array(
"result" => $arrayTestMailResult["status"],
$arrayResult = [
"result" => $arrayTestMailResult["status"],
"message" => ""
);
];
if ($arrayTestMailResult["status"] == false) {
$arrayResult["message"] = G::LoadTranslation("ID_SENDMAIL_NOT_INSTALLED");
}
//Return
return $arrayResult;
}
@@ -311,7 +310,7 @@ class EmailServer
$passwdHide = "";
}
$passwdDec = G::decrypt($passwd,"EMAILENCRYPT");
$passwdDec = G::decrypt($passwd, "EMAILENCRYPT");
$auxPass = explode("hash:", $passwdDec);
if (count($auxPass) > 1) {
@@ -325,21 +324,24 @@ class EmailServer
$arrayData["MESS_PASSWORD"] = $passwd;
$port = (int)($arrayData["MESS_PORT"]);
$auth_required = (int)($arrayData["MESS_RAUTH"]);
$port = (int) ($arrayData["MESS_PORT"]);
$auth_required = (int) ($arrayData["MESS_RAUTH"]);
$useSecureCon = $arrayData["SMTPSECURE"];
$sendTestMail = (int)($arrayData["MESS_TRY_SEND_INMEDIATLY"]);
$sendTestMail = (int) ($arrayData["MESS_TRY_SEND_INMEDIATLY"]);
$mailTo = $arrayData["MAIL_TO"];
$smtpSecure = $arrayData["SMTPSECURE"];
$serverNet = new \Net($server);
$smtp = new \SMTP();
$serverNet = new Net($server);
$smtp = new SMTP();
$timeout = 10;
$hostinfo = array();
$hostinfo = [];
$srv = $arrayData["MESS_SERVER"];
$arrayResult = array();
$arrayResult = [
"result" => false,
"message" => ""
];
switch ($step) {
case 1:
@@ -348,7 +350,6 @@ class EmailServer
break;
case 2:
$serverNet->scannPort($port);
$arrayResult["result"] = $serverNet->getErrno() == 0;
$arrayResult["message"] = $serverNet->error;
break;
@@ -357,12 +358,10 @@ class EmailServer
if (preg_match("/^(.+):([0-9]+)$/", $srv, $hostinfo)) {
$server = $hostinfo[1];
$port = $hostinfo[2];
} else {
$host = $srv;
}
$tls = (strtoupper($smtpSecure) == "tls");
$ssl = (strtoupper($smtpSecure) == "ssl");
$tls = strtolower($smtpSecure) === "tls";
$ssl = strtolower($smtpSecure) === "ssl";
$arrayResult["result"] = $smtp->Connect(($ssl ? "ssl://" : "") . $server, $port, $timeout);
$arrayResult["message"] = $serverNet->error;
@@ -374,27 +373,12 @@ class EmailServer
if (preg_match("/^(.+):([0-9]+)$/", $srv, $hostinfo)) {
$server = $hostinfo[1];
$port = $hostinfo[2];
} else {
$server = $srv;
}
if (strtoupper($useSecureCon)=="TLS") {
$tls = "tls";
}
if (strtoupper($useSecureCon)=="SSL") {
$tls = "ssl";
}
$tls = strtolower($useSecureCon) === "tls";
$ssl = strtolower($useSecureCon) === "ssl";
$tls = (strtoupper($useSecureCon) == "tls");
$ssl = (strtoupper($useSecureCon) == "ssl");
$server = $arrayData["MESS_SERVER"];
if (strtoupper($useSecureCon) == "SSL") {
$resp = $smtp->Connect(("ssl://") . $server, $port, $timeout);
} else {
$resp = $smtp->Connect($server, $port, $timeout);
}
$resp = $smtp->Connect(($ssl ? "ssl://" : "") . $server, $port, $timeout);
if ($resp) {
$hello = $_SERVER["SERVER_NAME"];
@@ -404,7 +388,7 @@ class EmailServer
$smtp->Hello($hello);
}
if ($smtp->Authenticate($user, $passwd) ) {
if ($smtp->Authenticate($user, $passwd)) {
$arrayResult["result"] = true;
} else {
if (strtoupper($useSecureCon) == "TLS") {
@@ -432,18 +416,18 @@ class EmailServer
case 5:
if ($sendTestMail == 1) {
try {
$arrayDataPhpMailer = array();
$arrayDataPhpMailer = [];
$eregMail = "/^[0-9a-zA-Z]+(?:[._][0-9a-zA-Z]+)*@[0-9a-zA-Z]+(?:[._-][0-9a-zA-Z]+)*\.[0-9a-zA-Z]{2,3}$/";
$arrayDataPhpMailer["FROM_EMAIL"] = ($fromMail != "" && preg_match($eregMail, $fromMail))? $fromMail : "";
$arrayDataPhpMailer["FROM_NAME"] = $arrayData["MESS_FROM_NAME"] != "" ? $arrayData["MESS_FROM_NAME"] : G::LoadTranslation("ID_MESS_TEST_BODY");
$arrayDataPhpMailer["MESS_ENGINE"] = "PHPMAILER";
$arrayDataPhpMailer["MESS_SERVER"] = $server;
$arrayDataPhpMailer["MESS_PORT"] = $port;
$arrayDataPhpMailer["MESS_ACCOUNT"] = $user;
$arrayDataPhpMailer["FROM_EMAIL"] = ($fromMail != "" && preg_match($eregMail, $fromMail)) ? $fromMail : "";
$arrayDataPhpMailer["FROM_NAME"] = $arrayData["MESS_FROM_NAME"] != "" ? $arrayData["MESS_FROM_NAME"] : G::LoadTranslation("ID_MESS_TEST_BODY");
$arrayDataPhpMailer["MESS_ENGINE"] = "PHPMAILER";
$arrayDataPhpMailer["MESS_SERVER"] = $server;
$arrayDataPhpMailer["MESS_PORT"] = $port;
$arrayDataPhpMailer["MESS_ACCOUNT"] = $user;
$arrayDataPhpMailer["MESS_PASSWORD"] = $passwd;
$arrayDataPhpMailer["TO"] = $mailTo;
$arrayDataPhpMailer["TO"] = $mailTo;
if ($auth_required == 1) {
$arrayDataPhpMailer["MESS_RAUTH"] = true;
@@ -474,19 +458,12 @@ class EmailServer
break;
}
if (!isset($arrayResult["message"])) {
$arrayResult["message"] = "";
}
//Return
return $arrayResult;
} catch (Exception $e) {
$arrayResult = array();
$arrayResult["result"] = false;
$arrayResult["message"] = $e->getMessage();
//Return
$arrayResult = [
"result" => false,
"message" => $e->getMessage()
];
return $arrayResult;
}
}

View File

@@ -0,0 +1,480 @@
<?php
namespace ProcessMaker\EmailOAuth;
use AppMessage;
use Bootstrap;
use G;
use Google_Client;
use Google_Service_Gmail;
use Google_Service_Gmail_Message;
use Illuminate\Support\Facades\Log;
use ProcessMaker\BusinessModel\EmailServer;
use ProcessMaker\Core\System;
use TemplatePower;
use WsBase;
trait EmailBase
{
private $server;
private $port;
private $emailServerUid;
private $emailEngine;
private $clientID;
private $clientSecret;
private $fromAccount;
private $senderEmail;
private $senderName;
private $sendTestMail;
private $mailTo;
private $setDefaultConfiguration;
private $redirectURI;
private $refreshToken;
/**
* Set $server property.
* @param string $server
* @return void
*/
public function setServer($server): void
{
$this->server = $server;
}
/**
* Set $port property.
* @param string $port
* @return void
*/
public function setPort($port): void
{
$this->port = $port;
}
/**
* Set $emailServerUid property.
* @param string $emailServerUid
* @return void
*/
public function setEmailServerUid($emailServerUid): void
{
$this->emailServerUid = $emailServerUid;
}
/**
* Set $clientID property.
* @param string $clientID
* @return void
*/
public function setClientID($clientID): void
{
$this->clientID = $clientID;
}
/**
* Set $clientSecret property.
* @param string $clientSecret
* @return void
*/
public function setClientSecret($clientSecret): void
{
$this->clientSecret = $clientSecret;
}
/**
* Set $redirectURI property.
* @param string $redirectURI
* @return void
*/
public function setRedirectURI($redirectURI): void
{
$this->redirectURI = $redirectURI;
}
/**
* Set $emailEngine property.
* @param string $emailEngine
* @return void
*/
public function setEmailEngine($emailEngine): void
{
$this->emailEngine = $emailEngine;
}
/**
* Set $fromAccount property.
* @param string $fromAccount
* @return void
*/
public function setFromAccount($fromAccount): void
{
$this->fromAccount = $fromAccount;
}
/**
* Set $senderEmail property.
* @param string $senderEmail
* @return void
*/
public function setSenderEmail($senderEmail): void
{
$this->senderEmail = $senderEmail;
}
/**
* Set $senderName property.
* @param string $senderName
* @return void
*/
public function setSenderName($senderName): void
{
$this->senderName = $senderName;
}
/**
* Set $sendTestMail property.
* @param string $sendTestMail
* @return void
*/
public function setSendTestMail($sendTestMail): void
{
$this->sendTestMail = $sendTestMail;
}
/**
* Set $mailTo property.
* @param string $mailTo
* @return void
*/
public function setMailTo($mailTo): void
{
$this->mailTo = $mailTo;
}
/**
* Set $setDefaultConfiguration property.
* @param int $setDefaultConfiguration
* @return void
*/
public function setSetDefaultConfiguration($setDefaultConfiguration): void
{
$this->setDefaultConfiguration = $setDefaultConfiguration;
}
/**
* Set $refreshToken property.
* @param string $refreshToken
* @return void
*/
public function setRefreshToken($refreshToken): void
{
$this->refreshToken = $refreshToken;
}
/**
* Get $server property.
* @return string
*/
public function getServer()
{
return $this->server;
}
/**
* Get $port property.
* @return string
*/
public function getPort()
{
return $this->port;
}
/**
* Get $emailServerUid property.
* @return string
*/
public function getEmailServerUid()
{
return $this->emailServerUid;
}
/**
* Get $clientID property.
* @return string
*/
public function getClientID()
{
return $this->clientID;
}
/**
* Get $clientSecret property.
* @return string
*/
public function getClientSecret()
{
return $this->clientSecret;
}
/**
* Get $redirectURI property.
* @return string
*/
public function getRedirectURI()
{
return $this->redirectURI;
}
/**
* Get $emailEngine property.
* @return string
*/
public function getEmailEngine()
{
return $this->emailEngine;
}
/**
* Get $fromAccount property.
* @return string
*/
public function getFromAccount()
{
return $this->fromAccount;
}
/**
* Get $senderEmail property.
* @return string
*/
public function getSenderEmail()
{
return $this->senderEmail;
}
/**
* Get $senderName property.
* @return string
*/
public function getSenderName()
{
return $this->senderName;
}
/**
* Get $sendTestMail property.
* @return string
*/
public function getSendTestMail()
{
return $this->sendTestMail;
}
/**
* Get $mailTo property.
* @return string
*/
public function getMailTo()
{
return $this->mailTo;
}
/**
* Get $defaultConfiguration property.
* @return int
*/
public function getSetDefaultConfiguration()
{
return $this->setDefaultConfiguration;
}
/**
* Get $refreshToken property.
* @return string
*/
public function getRefreshToken()
{
return $this->refreshToken;
}
/**
* Save the data in the EmailServer table, and return the stored fields.
* @return array
*/
public function saveEmailServer(): array
{
$result = [];
$data = [
"MESS_ENGINE" => $this->emailEngine,
"OAUTH_CLIENT_ID" => $this->clientID,
"OAUTH_CLIENT_SECRET" => $this->clientSecret,
"OAUTH_REFRESH_TOKEN" => $this->refreshToken,
"MESS_ACCOUNT" => $this->fromAccount,
"MESS_FROM_MAIL" => $this->senderEmail,
"MESS_FROM_NAME" => $this->senderName,
"MESS_TRY_SEND_INMEDIATLY" => $this->sendTestMail,
"MAIL_TO" => $this->mailTo,
"MESS_DEFAULT" => $this->setDefaultConfiguration,
"MESS_RAUTH" => 1,
"SMTPSECURE" => "No",
"MESS_PASSWORD" => "",
"MESS_SERVER" => $this->server,
"MESS_PORT" => $this->port,
"MESS_PASSWORD" => "",
"MESS_INCOMING_SERVER" => "",
"MESS_INCOMING_PORT" => ""
];
$emailServer = new EmailServer();
if (empty($this->emailServerUid)) {
$result = $emailServer->create($data);
} else {
$result = $emailServer->update($this->emailServerUid, $data);
}
return $result;
}
/**
* Get message body.
* @return string
*/
public function getMessageBody(): string
{
$templateTower = new TemplatePower(PATH_TPL . "admin" . PATH_SEP . "email.tpl");
$templateTower->prepare();
$templateTower->assign("server", System::getServerProtocol() . System::getServerHost());
$templateTower->assign("date", date("H:i:s"));
$templateTower->assign("ver", System::getVersion());
$templateTower->assign("engine", G::LoadTranslation("ID_MESS_ENGINE_TYPE_4"));
$templateTower->assign("msg", G::LoadTranslation("ID_MESS_TEST_BODY"));
$outputContent = $templateTower->getOutputContent();
return $outputContent;
}
/**
* Get a plain text of the test message.
* @return string
*/
public function getRawMessage(): string
{
$outputContent = $this->getMessageBody();
$strRawMessage = ""
. "From: Email <{$this->fromAccount}> \r\n"
. "To: <{$this->mailTo}>\r\n"
. "Subject: =?utf-8?B?" . base64_encode(G::LoadTranslation("ID_MESS_TEST_SUBJECT")) . "?=\r\n"
. "MIME-Version: 1.0\r\n"
. "Content-Type: text/html; charset=utf-8\r\n"
. "Content-Transfer-Encoding: quoted-printable\r\n\r\n"
. "{$outputContent}\r\n";
$raw = rtrim(strtr(base64_encode($strRawMessage), '+/', '-_'), '=');
return $raw;
}
/**
* This sends a test email with PHPMailerOAuth object, as long
* as the test flag is activated.
* @param string $provider
* @return PHPMailerOAuth
*/
public function sendTestMailWithPHPMailerOAuth($provider = 'League\OAuth2\Client\Provider\Google'): PHPMailerOAuth
{
$phpMailerOAuth = new PHPMailerOAuth([
'provider' => new $provider([
'clientId' => $this->clientID,
'clientSecret' => $this->clientSecret,
'redirectUri' => $this->refreshToken,
'accessType' => 'offline'
]),
'clientId' => $this->clientID,
'clientSecret' => $this->clientSecret,
'refreshToken' => $this->refreshToken,
'userName' => $this->fromAccount
]);
if (!filter_var($this->fromAccount, FILTER_VALIDATE_EMAIL)) {
return $phpMailerOAuth;
}
if (!filter_var($this->mailTo, FILTER_VALIDATE_EMAIL)) {
return $phpMailerOAuth;
}
if ($this->sendTestMail === 0) {
return $phpMailerOAuth;
}
$senderEmail = $this->senderEmail;
if (!filter_var($senderEmail, FILTER_VALIDATE_EMAIL)) {
$senderEmail = $this->fromAccount;
}
if (empty($this->senderName)) {
$this->senderName = "";
}
$phpMailerOAuth->isHTML(true);
$phpMailerOAuth->isSMTP();
$phpMailerOAuth->Host = $this->server;
$phpMailerOAuth->Port = $this->port;
$phpMailerOAuth->SMTPSecure = 'tls';
$phpMailerOAuth->SMTPAuth = true;
$phpMailerOAuth->AuthType = 'XOAUTH2';
$phpMailerOAuth->SetFrom($senderEmail, $this->senderName);
$phpMailerOAuth->Subject = G::LoadTranslation("ID_MESS_TEST_SUBJECT");
$phpMailerOAuth->Body = utf8_encode($this->getMessageBody());
$phpMailerOAuth->AddAddress($this->mailTo);
$status = $phpMailerOAuth->Send();
$this->saveIntoStandardLogs($status ? "sent" : "pending");
$this->saveIntoAppMessage($status ? "sent" : "pending");
return $phpMailerOAuth;
}
/**
* Register into APP_MESSAGE table.
* @param string $status
*/
public function saveIntoAppMessage(string $status = "")
{
$appMsgUid = G::generateUniqueID();
$spool = new AppMessage();
$spool->setAppMsgUid($appMsgUid);
$spool->setMsgUid("");
$spool->setAppUid("");
$spool->setDelIndex(0);
$spool->setAppMsgType(WsBase::MESSAGE_TYPE_TEST_EMAIL);
$spool->setAppMsgTypeId(isset(AppMessage::$app_msg_type_values[WsBase::MESSAGE_TYPE_TEST_EMAIL]) ? AppMessage::$app_msg_type_values[WsBase::MESSAGE_TYPE_TEST_EMAIL] : 0);
$spool->setAppMsgSubject(G::LoadTranslation("ID_MESS_TEST_SUBJECT"));
$spool->setAppMsgFrom($this->fromAccount);
$spool->setAppMsgTo($this->mailTo);
$spool->setAppMsgBody(utf8_encode($this->getMessageBody()));
$spool->setAppMsgDate(date('Y-m-d H:i:s'));
$spool->setAppMsgCc("");
$spool->setAppMsgBcc("");
$spool->setappMsgAttach(serialize([""]));
$spool->setAppMsgTemplate("");
$spool->setAppMsgStatus($status);
$spool->setAppMsgStatusId(AppMessage::$app_msg_status_values[$status] ? AppMessage::$app_msg_status_values[$status] : 0);
$spool->setAppMsgSendDate(date('Y-m-d H:i:s'));
$spool->setAppMsgShowMessage(1);
$spool->setAppMsgError("");
$spool->setAppNumber(0);
$spool->setTasId(0);
$spool->setProId(0);
$spool->save();
}
/**
* Register into standard logs.
* @param string $status
*/
public function saveIntoStandardLogs(string $status = "")
{
$message = "Email Server test has been sent";
$context = [
"emailServerUid" => $this->emailServerUid,
"emailEngine" => $this->emailEngine,
"from" => $this->fromAccount,
"senderAccount" => $this->mailTo,
"senderEmail" => $this->senderEmail,
"senderName" => $this->senderName,
"status" => $status
];
Log::channel(':' . $this->emailEngine)->info($message, Bootstrap::context($context));
}
}

View File

@@ -0,0 +1,20 @@
<?php
namespace ProcessMaker\EmailOAuth;
use PHPMailer\PHPMailer\OAuth;
use PHPMailer\PHPMailer\PHPMailer;
class PHPMailerOAuth extends PHPMailer
{
/**
* Constructor of the class.
* @param array $options
*/
public function __construct($options)
{
$oauth = new OAuth($options);
$this->setOAuth($oauth);
}
}

View File

@@ -2,260 +2,23 @@
namespace ProcessMaker\GmailOAuth;
use AppMessage;
use Bootstrap;
use G;
use Google_Client;
use Google_Service_Gmail;
use Google_Service_Gmail_Message;
use Illuminate\Support\Facades\Log;
use PHPMailerOAuth;
use ProcessMaker\BusinessModel\EmailServer;
use ProcessMaker\Core\System;
use TemplatePower;
use WsBase;
use ProcessMaker\EmailOAuth\EmailBase;
class GmailOAuth
{
private $emailServerUid;
private $emailEngine;
private $clientID;
private $clientSecret;
private $fromAccount;
private $senderEmail;
private $senderName;
private $sendTestMail;
private $mailTo;
private $setDefaultConfiguration;
private $redirectURI;
private $refreshToken;
use EmailBase;
/**
* Set $emailServerUid property.
* @param string $emailServerUid
* @return void
* Constructor of the class.
*/
public function setEmailServerUid($emailServerUid): void
public function __construct()
{
$this->emailServerUid = $emailServerUid;
}
/**
* Set $clientID property.
* @param string $clientID
* @return void
*/
public function setClientID($clientID): void
{
$this->clientID = $clientID;
}
/**
* Set $clientSecret property.
* @param string $clientSecret
* @return void
*/
public function setClientSecret($clientSecret): void
{
$this->clientSecret = $clientSecret;
}
/**
* Set $redirectURI property.
* @param string $redirectURI
* @return void
*/
public function setRedirectURI($redirectURI): void
{
$this->redirectURI = $redirectURI;
}
/**
* Set $emailEngine property.
* @param string $emailEngine
* @return void
*/
public function setEmailEngine($emailEngine): void
{
$this->emailEngine = $emailEngine;
}
/**
* Set $fromAccount property.
* @param string $fromAccount
* @return void
*/
public function setFromAccount($fromAccount): void
{
$this->fromAccount = $fromAccount;
}
/**
* Set $senderEmail property.
* @param string $senderEmail
* @return void
*/
public function setSenderEmail($senderEmail): void
{
$this->senderEmail = $senderEmail;
}
/**
* Set $senderName property.
* @param string $senderName
* @return void
*/
public function setSenderName($senderName): void
{
$this->senderName = $senderName;
}
/**
* Set $sendTestMail property.
* @param string $sendTestMail
* @return void
*/
public function setSendTestMail($sendTestMail): void
{
$this->sendTestMail = $sendTestMail;
}
/**
* Set $mailTo property.
* @param string $mailTo
* @return void
*/
public function setMailTo($mailTo): void
{
$this->mailTo = $mailTo;
}
/**
* Set $setDefaultConfiguration property.
* @param string $setDefaultConfiguration
* @return void
*/
public function setSetDefaultConfiguration($setDefaultConfiguration): void
{
$this->setDefaultConfiguration = $setDefaultConfiguration;
}
/**
* Set $refreshToken property.
* @param string $refreshToken
* @return void
*/
public function setRefreshToken($refreshToken): void
{
$this->refreshToken = $refreshToken;
}
/**
* Get $emailServerUid property.
* @return string
*/
public function getEmailServerUid()
{
return $this->emailServerUid;
}
/**
* Get $clientID property.
* @return string
*/
public function getClientID()
{
return $this->clientID;
}
/**
* Get $clientSecret property.
* @return string
*/
public function getClientSecret()
{
return $this->clientSecret;
}
/**
* Get $redirectURI property.
* @return string
*/
public function getRedirectURI()
{
return $this->redirectURI;
}
/**
* Get $emailEngine property.
* @return string
*/
public function getEmailEngine()
{
return $this->emailEngine;
}
/**
* Get $fromAccount property.
* @return string
*/
public function getFromAccount()
{
return $this->fromAccount;
}
/**
* Get $senderEmail property.
* @return string
*/
public function getSenderEmail()
{
return $this->senderEmail;
}
/**
* Get $senderName property.
* @return string
*/
public function getSenderName()
{
return $this->senderName;
}
/**
* Get $sendTestMail property.
* @return string
*/
public function getSendTestMail()
{
return $this->sendTestMail;
}
/**
* Get $mailTo property.
* @return string
*/
public function getMailTo()
{
return $this->mailTo;
}
/**
* Get $defaultConfiguration property.
* @return string
*/
public function getSetDefaultConfiguration()
{
return $this->setDefaultConfiguration;
}
/**
* Get $refreshToken property.
* @return string
*/
public function getRefreshToken()
{
return $this->refreshToken;
$this->setServer("smtp.gmail.com");
$this->setPort(587);
}
/**
@@ -274,42 +37,6 @@ class GmailOAuth
return $googleClient;
}
/**
* Save the data in the EmailServer table, and return the stored fields.
* @return array
*/
public function saveEmailServer(): array
{
$result = [];
$data = [
"MESS_ENGINE" => $this->emailEngine,
"OAUTH_CLIENT_ID" => $this->clientID,
"OAUTH_CLIENT_SECRET" => $this->clientSecret,
"OAUTH_REFRESH_TOKEN" => $this->refreshToken,
"MESS_ACCOUNT" => $this->fromAccount,
"MESS_FROM_MAIL" => $this->senderEmail,
"MESS_FROM_NAME" => $this->senderName,
"MESS_TRY_SEND_INMEDIATLY" => $this->sendTestMail,
"MAIL_TO" => $this->mailTo,
"MESS_DEFAULT" => $this->setDefaultConfiguration,
"MESS_RAUTH" => 1,
"SMTPSECURE" => "No",
"MESS_PASSWORD" => "",
"MESS_SERVER" => "smtp.gmail.com",
"MESS_PORT" => "",
"MESS_PASSWORD" => "",
"MESS_INCOMING_SERVER" => "",
"MESS_INCOMING_PORT" => ""
];
$emailServer = new EmailServer();
if (empty($this->emailServerUid)) {
$result = $emailServer->create($data);
} else {
$result = $emailServer->update($this->emailServerUid, $data);
}
return $result;
}
/**
* This sends a test email with Google_Service_Gmail_Message object, as long
* as the test flag is activated.
@@ -342,139 +69,4 @@ class GmailOAuth
$result = $service->users_messages->send("me", $googleServiceGmailMessage);
return $result;
}
/**
* Get message body.
* @return string
*/
public function getMessageBody(): string
{
$templateTower = new TemplatePower(PATH_TPL . "admin" . PATH_SEP . "email.tpl");
$templateTower->prepare();
$templateTower->assign("server", System::getServerProtocol() . System::getServerHost());
$templateTower->assign("date", date("H:i:s"));
$templateTower->assign("ver", System::getVersion());
$templateTower->assign("engine", G::LoadTranslation("ID_MESS_ENGINE_TYPE_4"));
$templateTower->assign("msg", G::LoadTranslation("ID_MESS_TEST_BODY"));
$outputContent = $templateTower->getOutputContent();
return $outputContent;
}
/**
* Get a plain text of the test message.
* @return string
*/
public function getRawMessage(): string
{
$outputContent = $this->getMessageBody();
$strRawMessage = ""
. "From: Email <{$this->fromAccount}> \r\n"
. "To: <{$this->mailTo}>\r\n"
. "Subject: =?utf-8?B?" . base64_encode(G::LoadTranslation("ID_MESS_TEST_SUBJECT")) . "?=\r\n"
. "MIME-Version: 1.0\r\n"
. "Content-Type: text/html; charset=utf-8\r\n"
. "Content-Transfer-Encoding: quoted-printable\r\n\r\n"
. "{$outputContent}\r\n";
$raw = rtrim(strtr(base64_encode($strRawMessage), '+/', '-_'), '=');
return $raw;
}
/**
* This sends a test email with PHPMailerOAuth object, as long
* as the test flag is activated.
* @return PHPMailerOAuth
*/
public function sendTestMailWithPHPMailerOAuth(): PHPMailerOAuth
{
$phpMailerOAuth = new PHPMailerOAuth();
if (!filter_var($this->fromAccount, FILTER_VALIDATE_EMAIL)) {
return $phpMailerOAuth;
}
if (!filter_var($this->mailTo, FILTER_VALIDATE_EMAIL)) {
return $phpMailerOAuth;
}
if ($this->sendTestMail === 0) {
return $phpMailerOAuth;
}
$senderEmail = $this->senderEmail;
if (!filter_var($senderEmail, FILTER_VALIDATE_EMAIL)) {
$senderEmail = $this->fromAccount;
}
if (empty($this->senderName)) {
$this->senderName = "";
}
$phpMailerOAuth->isHTML(true);
$phpMailerOAuth->isSMTP();
$phpMailerOAuth->Host = 'smtp.gmail.com';
$phpMailerOAuth->SMTPAuth = true;
$phpMailerOAuth->AuthType = 'XOAUTH2';
$phpMailerOAuth->oauthUserEmail = $this->fromAccount;
$phpMailerOAuth->oauthClientId = $this->clientID;
$phpMailerOAuth->oauthClientSecret = $this->clientSecret;
$phpMailerOAuth->oauthRefreshToken = $this->refreshToken;
$phpMailerOAuth->SetFrom($senderEmail, $this->senderName);
$phpMailerOAuth->Subject = G::LoadTranslation("ID_MESS_TEST_SUBJECT");
$phpMailerOAuth->Body = utf8_encode($this->getMessageBody());
$phpMailerOAuth->AddAddress($this->mailTo);
$status = $phpMailerOAuth->Send();
$this->saveIntoStandardLogs($status ? "sent" : "pending");
$this->saveIntoAppMessage($status ? "sent" : "pending");
return $phpMailerOAuth;
}
/**
* Register into APP_MESSAGE table.
* @param string $status
*/
public function saveIntoAppMessage(string $status = "")
{
$appMsgUid = G::generateUniqueID();
$spool = new AppMessage();
$spool->setAppMsgUid($appMsgUid);
$spool->setMsgUid("");
$spool->setAppUid("");
$spool->setDelIndex(0);
$spool->setAppMsgType(WsBase::MESSAGE_TYPE_TEST_EMAIL);
$spool->setAppMsgTypeId(isset(AppMessage::$app_msg_type_values[WsBase::MESSAGE_TYPE_TEST_EMAIL]) ? AppMessage::$app_msg_type_values[WsBase::MESSAGE_TYPE_TEST_EMAIL] : 0);
$spool->setAppMsgSubject(G::LoadTranslation("ID_MESS_TEST_SUBJECT"));
$spool->setAppMsgFrom($this->fromAccount);
$spool->setAppMsgTo($this->mailTo);
$spool->setAppMsgBody(utf8_encode($this->getMessageBody()));
$spool->setAppMsgDate(date('Y-m-d H:i:s'));
$spool->setAppMsgCc("");
$spool->setAppMsgBcc("");
$spool->setappMsgAttach(serialize([""]));
$spool->setAppMsgTemplate("");
$spool->setAppMsgStatus($status);
$spool->setAppMsgStatusId(AppMessage::$app_msg_status_values[$status] ? AppMessage::$app_msg_status_values[$status] : 0);
$spool->setAppMsgSendDate(date('Y-m-d H:i:s'));
$spool->setAppMsgShowMessage(1);
$spool->setAppMsgError("");
$spool->setAppNumber(0);
$spool->setTasId(0);
$spool->setProId(0);
$spool->save();
}
/**
* Register into standard logs.
* @param string $status
*/
public function saveIntoStandardLogs(string $status = "")
{
$message = "Email Server test has been sent";
$context = [
"emailServerUid" => $this->emailServerUid,
"emailEngine" => $this->emailEngine,
"from" => $this->fromAccount,
"senderAccount" => $this->mailTo,
"senderEmail" => $this->senderEmail,
"senderName" => $this->senderName,
"status" => $status
];
Log::channel(':GmailOAuth')->info($message, Bootstrap::context($context));
}
}

View File

@@ -235,4 +235,21 @@ class User extends Model
return $info;
}
/**
* Get user information
*
* @param int $usrId
*
* @return array
*/
public static function getAllInformation($usrId)
{
$query = User::query()->select()
->userId($usrId)
->limit(1);
$result = $query->get()->values()->toArray();
return $result;
}
}

View File

@@ -0,0 +1,53 @@
<?php
namespace ProcessMaker\Office365OAuth;
use League\OAuth2\Client\Provider\GenericProvider;
use ProcessMaker\EmailOAuth\EmailBase;
use ProcessMaker\GmailOAuth\GmailOAuth;
use Stevenmaguire\OAuth2\Client\Provider\Microsoft;
class Office365OAuth
{
use EmailBase;
private $options = [
'scope' => [
'wl.imap',
'wl.offline_access'
]
];
/**
* Constructor of the class.
*/
public function __construct()
{
$this->setServer("smtp.office365.com");
$this->setPort(587);
}
/**
* Get $options property.
* @return array
*/
public function getOptions()
{
return $this->options;
}
/**
* Get a Microsoft object, this may vary depending on the service provider.
* @return Google_Client
*/
public function getOffice365Client()
{
$provider = new Microsoft([
'clientId' => $this->getClientID(),
'clientSecret' => $this->getClientSecret(),
'redirectUri' => $this->getRedirectURI(),
'accessType' => 'offline'
]);
return $provider;
}
}

View File

@@ -48,7 +48,7 @@ class ControlUnderUpdating implements iAuthenticate
public static function verifyUnderUpgrading()
{
$underUpdating = \Bootstrap::isPMUnderUpdating();
if ($underUpdating['action']) {
if (isset($underUpdating['action']) && $underUpdating['action']) {
$sysTemp = true;
if (defined('SYS_TEMP')) {
$sysTemp = $underUpdating['workspace'] == SYS_TEMP;

View File

@@ -275,11 +275,15 @@ emailServer.application = {
function emailServerSetEmailEngine(cboEmailEngine)
{
Ext.getCmp("txtServer").setValue("");
Ext.getCmp("txtPort").setValue("");
Ext.getCmp("frmEmailServer").getForm().clearInvalid();
Ext.getCmp("textClientId").setVisible(false);
Ext.getCmp("textClientSecret").setVisible(false);
Ext.getCmp("buttonContinue").setVisible(false);
Ext.getCmp("button2Continue").setVisible(false);
Ext.getCmp("btnTest").setVisible(true);
Ext.getCmp("btnSave").setVisible(true);
/*----------------------------------********---------------------------------*/
@@ -346,8 +350,12 @@ emailServer.application = {
Ext.getCmp("textClientSecret").allowBlank = true;
/*----------------------------------********---------------------------------*/
} else if (cboEmailEngine === "GMAILAPI") {
Ext.getCmp("txtServer").setVisible(false);
Ext.getCmp("txtPort").setVisible(false);
Ext.getCmp("txtServer").setVisible(true);
Ext.getCmp("txtServer").setValue("smtp.gmail.com");
Ext.getCmp("txtServer").label.update(_("ID_SERVER_API"));
Ext.getCmp("txtPort").setVisible(true);
Ext.getCmp("txtPort").setValue("587");
Ext.getCmp("txtPort").label.update(_("ID_EMAIL_SERVER_PORT"));
Ext.getCmp("txtIncomingServer").setVisible(false);
Ext.getCmp("txtIncomingPort").setVisible(false);
Ext.getCmp("chkReqAuthentication").setVisible(false);
@@ -362,6 +370,35 @@ emailServer.application = {
emailServerSetPassword(false);
Ext.getCmp("txtServer").allowBlank = true;
Ext.getCmp("txtPort").allowBlank = true;
Ext.getCmp("txtIncomingServer").allowBlank = true;
Ext.getCmp("txtIncomingPort").allowBlank = true;
Ext.getCmp("txtAccountFrom").allowBlank = false;
Ext.getCmp("txtPassword").allowBlank = true;
Ext.getCmp("textClientId").allowBlank = false;
Ext.getCmp("textClientSecret").allowBlank = false;
} else if (cboEmailEngine === "OFFICE365API") {
Ext.getCmp("txtServer").setVisible(true);
Ext.getCmp("txtServer").setValue("smtp.office365.com");
Ext.getCmp("txtServer").label.update(_("ID_SERVER_API"));
Ext.getCmp("txtPort").setVisible(true);
Ext.getCmp("txtPort").setValue("587");
Ext.getCmp("txtPort").label.update(_("ID_EMAIL_SERVER_PORT"));
Ext.getCmp("txtIncomingServer").setVisible(false);
Ext.getCmp("txtIncomingPort").setVisible(false);
Ext.getCmp("chkReqAuthentication").setVisible(false);
Ext.getCmp("rdoGrpSmtpSecure").setVisible(false);
Ext.getCmp("btnTest").setVisible(false);
Ext.getCmp("btnSave").setVisible(false);
Ext.getCmp("txtAccountFrom").setVisible(true);
Ext.getCmp("textClientId").setVisible(true);
Ext.getCmp("textClientSecret").setVisible(true);
Ext.getCmp("button2Continue").setVisible(true);
emailServerSetPassword(false);
Ext.getCmp("txtServer").allowBlank = true;
Ext.getCmp("txtPort").allowBlank = true;
Ext.getCmp("txtIncomingServer").allowBlank = true;
@@ -398,7 +435,9 @@ emailServer.application = {
function emailServerSetPassword(flagPassChecked)
{
if (flagPassChecked && Ext.getCmp("cboEmailEngine").getValue() !== 'GMAILAPI') {
if (flagPassChecked
&& Ext.getCmp("cboEmailEngine").getValue() !== 'GMAILAPI'
&& Ext.getCmp("cboEmailEngine").getValue() !== 'OFFICE365API') {
Ext.getCmp("txtPassword").setVisible(true);
Ext.getCmp("txtPassword").allowBlank = false;
} else {
@@ -596,7 +635,8 @@ emailServer.application = {
["IMAP", "SMTP - IMAP (PHPMailer)"],
/*----------------------------------********---------------------------------*/
["MAIL", "Mail (PHP)"],
["GMAILAPI", "GMAIL API (PHPMailer)"]
["GMAILAPI", "GMAIL API (PHPMailer)"],
["OFFICE365API", "OFFICE 365 API (PHPMailer)"]
]
});
@@ -822,10 +862,12 @@ emailServer.application = {
frmEmailServer = Ext.getCmp("frmEmailServer");
if (frmEmailServer.getForm().isValid()) {
winData.setDisabled(true);
parameters = {
option: 'createAuthUrl',
emailEngine: Ext.getCmp("cboEmailEngine").getValue(),
server: Ext.getCmp("txtServer").getValue(),
port: Ext.getCmp("txtPort").getValue(),
clientID: Ext.getCmp("textClientId").getValue(),
clientSecret: Ext.getCmp("textClientSecret").getValue(),
fromAccount: Ext.getCmp("txtAccountFrom").getValue(),
@@ -835,11 +877,79 @@ emailServer.application = {
mailTo: Ext.getCmp("txtMailTo").getValue(),
setDefaultConfiguration: Ext.getCmp("chkEmailServerDefault").checked ? 1 : 0
};
if (EMAILSERVEROPTION === "UPD") {
parameters.emailServerUid = Ext.getCmp("emailServerUid").getValue();
}
Ext.Ajax.request({
url: "emailServerAjax",
method: "POST",
params: parameters,
success: function (response) {
winData.setDisabled(false);
var dataResponse = Ext.util.JSON.decode(response.responseText);
if (dataResponse.status === 200) {
if (window.parent.parent) {
window.parent.parent.location = dataResponse.data;
} else if (window.parent) {
window.parent.location = dataResponse.data;
} else {
window.location = dataResponse.data;
}
} else {
Ext.MessageBox.show({
title: _("ID_ERROR"),
icon: Ext.MessageBox.ERROR,
msg: dataResponse.message,
buttons: {ok: _("ID_ACCEPT")}
});
}
},
failure: function () {
winData.setDisabled(false);
Ext.MessageBox.show({
title: _("ID_ERROR"),
icon: Ext.MessageBox.ERROR,
msg: "",
buttons: {ok: _("ID_ACCEPT")}
});
}
});
} else {
Ext.MessageBox.alert(_("ID_INVALID_DATA"), _("ID_CHECK_FIELDS_MARK_RED"));
}
}
});
var button2Continue = new Ext.Action({
id: 'button2Continue',
text: _("ID_CONTINUE"),
width: 85,
handler: function () {
var frmEmailServer, parameters;
frmEmailServer = Ext.getCmp("frmEmailServer");
if (frmEmailServer.getForm().isValid()) {
winData.setDisabled(true);
parameters = {
option: 'createAuthUrlOffice365',
emailEngine: Ext.getCmp("cboEmailEngine").getValue(),
server: Ext.getCmp("txtServer").getValue(),
port: Ext.getCmp("txtPort").getValue(),
clientID: Ext.getCmp("textClientId").getValue(),
clientSecret: Ext.getCmp("textClientSecret").getValue(),
fromAccount: Ext.getCmp("txtAccountFrom").getValue(),
senderEmail: Ext.getCmp("txtFromMail").getValue(),
senderName: Ext.getCmp("txtFromName").getValue(),
sendTestMail: (Ext.getCmp("chkSendTestMail").checked) ? 1 : 0,
mailTo: Ext.getCmp("txtMailTo").getValue(),
setDefaultConfiguration: Ext.getCmp("chkEmailServerDefault").checked ? 1 : 0
};
if (EMAILSERVEROPTION === "UPD") {
parameters.emailServerUid = Ext.getCmp("emailServerUid").getValue();
}
Ext.Ajax.request({
url: "emailServerAjax",
method: "POST",
@@ -925,7 +1035,7 @@ emailServer.application = {
resizable: false,
closeAction: "hide",
items: [frmEmailServer],
buttons: [buttonContinue, btnTest, btnSave, btnCancel]
buttons: [buttonContinue, button2Continue, btnTest, btnSave, btnCancel]
});
winData.show();
winData.hide();

View File

@@ -494,7 +494,7 @@ if (SYS_TARGET === false) {
// Bootstrap::mylog("sys_temp: ".SYS_TEMP);
$arrayUpdating = Bootstrap::isPMUnderUpdating();
if ($arrayUpdating['action']) {
if (isset($arrayUpdating['action']) && $arrayUpdating['action']) {
if ($arrayUpdating['workspace'] == "true" || $arrayUpdating['workspace'] == SYS_TEMP) {
header("location: /update/updating.php");
if (DEBUG_TIME_LOG) {