Merge remote-tracking branch 'origin/feature/HOR-3559' into bugfix/HOR-3633-C
This commit is contained in:
@@ -52,58 +52,43 @@ class Common
|
||||
}
|
||||
|
||||
$files = glob("$path/$singlePattern", $flags);
|
||||
$dirs = glob("$path/*", GLOB_MARK|GLOB_ONLYDIR|GLOB_NOSORT);
|
||||
$dirs = glob("$path/*", GLOB_MARK | GLOB_ONLYDIR | GLOB_NOSORT);
|
||||
|
||||
if(is_array($dirs)){
|
||||
if (is_array($dirs)) {
|
||||
foreach ($dirs as $dir) {
|
||||
$files = array_merge($files, self::rglob("$dir/$singlePattern", $flags));
|
||||
}
|
||||
}
|
||||
|
||||
if ($onlyFiles) {
|
||||
$files = array_filter($files, function($v) { return is_dir($v) ? false : true;});
|
||||
$files = array_filter($files, function ($v) {
|
||||
return is_dir($v) ? false : true;
|
||||
});
|
||||
}
|
||||
|
||||
return $files;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the last version given a pattern of file name
|
||||
*
|
||||
* @param string $pattern a valid pattern for glob(...) native function
|
||||
* @param int $flag php flags for glob(...) native function
|
||||
* @return int|string
|
||||
*
|
||||
* Example:
|
||||
* - Given the following files inside a directory:
|
||||
* /example/path/myApplication-v1.tar
|
||||
* /example/path/myApplication-v2.tar
|
||||
* /example/path/myApplication-v3.tar
|
||||
* /example/path/myApplication-v5.tar
|
||||
* /example/path/myApplication-v7.tar
|
||||
*
|
||||
* $lastVer = ProcessMaker\Util\Common::getLastVersion("/example/path/myApplication-*.tar");
|
||||
*
|
||||
* It will returns: 7
|
||||
* This method get the last version of file when exists a special characters
|
||||
* @param $pattern
|
||||
* @param $extension
|
||||
* @param int $flag
|
||||
* @return int
|
||||
*/
|
||||
public static function getLastVersion($pattern, $flag = 0)
|
||||
public static function getLastVersionSpecialCharacters($dir, $pattern, $extension, $flag = 0)
|
||||
{
|
||||
$files = glob($pattern, $flag);
|
||||
$files = glob($dir . quotemeta($pattern) . "-*." . $extension, $flag);
|
||||
$maxVersion = 0;
|
||||
|
||||
$pattern = str_replace("*", '([0-9\.]+)', basename($pattern));
|
||||
|
||||
$pattern = preg_quote(basename($pattern)) . '-([0-9\.]+)pmx';
|
||||
foreach ($files as $file) {
|
||||
$filename = basename($file);
|
||||
|
||||
if (preg_match('/'.$pattern.'/', $filename, $match)) {
|
||||
|
||||
if (preg_match('/' . $pattern . '/', $filename, $match)) {
|
||||
if ($maxVersion < $match[1]) {
|
||||
$maxVersion = $match[1];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $maxVersion;
|
||||
}
|
||||
|
||||
@@ -141,8 +126,8 @@ class Common
|
||||
}
|
||||
|
||||
while ($parent_folder_path = array_pop($folder_path)) {
|
||||
if (! @is_dir($parent_folder_path)) {
|
||||
if (! @mkdir($parent_folder_path, $rights)) {
|
||||
if (!@is_dir($parent_folder_path)) {
|
||||
if (!@mkdir($parent_folder_path, $rights)) {
|
||||
umask($oldumask);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -35,6 +35,8 @@
|
||||
/**
|
||||
* require_once pakeFunction.php
|
||||
*/
|
||||
require_once( PATH_THIRDPARTY . 'pake' . PATH_SEP . 'pakeFunction.php');
|
||||
require_once( PATH_THIRDPARTY . 'pake' . PATH_SEP . 'pakeGetopt.class.php');
|
||||
require_once( PATH_CORE . 'config' . PATH_SEP . 'environments.php');
|
||||
|
||||
// trap -V before pake
|
||||
|
||||
@@ -3238,20 +3238,34 @@ class G
|
||||
* @param (array) additional characteres map
|
||||
*
|
||||
*/
|
||||
public function inflect ($string, $replacement = '_', $map = array())
|
||||
public function inflect($string, $replacement = '_', $map = array())
|
||||
{
|
||||
if (is_array( $replacement )) {
|
||||
if (is_array($replacement)) {
|
||||
$map = $replacement;
|
||||
$replacement = '_';
|
||||
}
|
||||
|
||||
$quotedReplacement = preg_quote( $replacement, '/' );
|
||||
$quotedReplacement = preg_quote($replacement, '/');
|
||||
|
||||
$default = array ('/à|á|å|â/' => 'a','/è|é|ê|ẽ|ë/' => 'e','/ì|í|î/' => 'i','/ò|ó|ô|ø/' => 'o','/ù|ú|ů|û/' => 'u','/ç/' => 'c','/ñ/' => 'n','/ä|æ/' => 'ae','/ö/' => 'oe','/ü/' => 'ue','/Ä/' => 'Ae','/Ü/' => 'Ue','/Ö/' => 'Oe','/ß/' => 'ss','/\.|\,|\:|\-|\\|\//' => " ",'/\\s+/' => $replacement
|
||||
);
|
||||
$default = array('/à|á|å|â/' => 'a',
|
||||
'/è|é|ê|ẽ|ë/' => 'e',
|
||||
'/ì|í|î/' => 'i',
|
||||
'/ò|ó|ô|ø/' => 'o',
|
||||
'/ù|ú|ů|û/' => 'u',
|
||||
'/ç/' => 'c',
|
||||
'/ñ/' => 'n',
|
||||
'/ä|æ/' => 'ae',
|
||||
'/ö/' => 'oe',
|
||||
'/ü/' => 'ue',
|
||||
'/Ä/' => 'Ae',
|
||||
'/Ü/' => 'Ue',
|
||||
'/Ö/' => 'Oe',
|
||||
'/ß/' => 'ss',
|
||||
'/[\.|\,|\+|\"|\:|\;|\-|\\|\/]/' => " ",
|
||||
'/\\s+/' => $replacement);
|
||||
|
||||
$map = array_merge( $default, $map );
|
||||
return preg_replace( array_keys( $map ), array_values( $map ), $string );
|
||||
$map = array_merge($default, $map);
|
||||
return preg_replace(array_keys($map), array_values($map), $string);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -165,6 +165,13 @@ class RBAC
|
||||
'updateCategory' => array('PM_SETUP', 'PM_SETUP_PROCESS_CATEGORIES'),
|
||||
'canDeleteCategory' => array('PM_SETUP', 'PM_SETUP_PROCESS_CATEGORIES'),
|
||||
'deleteCategory' => array('PM_SETUP', 'PM_SETUP_PROCESS_CATEGORIES')
|
||||
),
|
||||
'emailServerAjax.php' => array(
|
||||
'INS' => array('PM_SETUP'),
|
||||
'UPD' => array('PM_SETUP'),
|
||||
'DEL' => array('PM_SETUP'),
|
||||
'LST' => array('PM_SETUP'),
|
||||
'TEST' => array('PM_SETUP')
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
@@ -75,12 +75,13 @@ class RbacUsers extends BaseRbacUsers
|
||||
try {
|
||||
$c = new Criteria('rbac');
|
||||
$c->add(RbacUsersPeer::USR_USERNAME, $sUsername);
|
||||
/* @var $rs RbacUsers[] */
|
||||
$rs = RbacUsersPeer::doSelect($c, Propel::getDbConnection('rbac_ro'));
|
||||
if (is_array($rs) && isset($rs[0]) && is_object($rs[0]) && get_class($rs[0]) == 'RbacUsers') {
|
||||
$aFields = $rs[0]->toArray(BasePeer::TYPE_FIELDNAME);
|
||||
//verify password with md5, and md5 format
|
||||
if (mb_strtoupper($sUsername, 'utf-8') === mb_strtoupper($aFields['USR_USERNAME'], 'utf-8')) {
|
||||
if( Bootstrap::verifyHashPassword($sPassword, $aFields['USR_PASSWORD']) ) {
|
||||
if( Bootstrap::verifyHashPassword($sPassword, $rs[0]->getUsrPassword()) ) {
|
||||
if ($aFields['USR_DUE_DATE'] < date('Y-m-d')) {
|
||||
return -4;
|
||||
}
|
||||
@@ -317,6 +318,25 @@ class RbacUsers extends BaseRbacUsers
|
||||
throw($oError);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc} except USR_PASSWORD, for security reasons.
|
||||
*
|
||||
* @param string $keyType One of the class type constants TYPE_PHPNAME,
|
||||
* TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM
|
||||
* @return an associative array containing the field names (as keys) and field values
|
||||
*/
|
||||
public function toArray($keyType = BasePeer::TYPE_PHPNAME)
|
||||
{
|
||||
$key = RbacUsersPeer::translateFieldName(
|
||||
RbacUsersPeer::USR_PASSWORD,
|
||||
BasePeer::TYPE_COLNAME,
|
||||
$keyType
|
||||
);
|
||||
$array = parent::toArray($keyType);
|
||||
unset($array[$key]);
|
||||
return $array;
|
||||
}
|
||||
}
|
||||
|
||||
// Users
|
||||
|
||||
@@ -490,4 +490,23 @@ class Users extends BaseUsers
|
||||
$criteria->add(UsersPeer::USR_ID, $id);
|
||||
return UsersPeer::doSelect($criteria)[0];
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc} except USR_PASSWORD, for security reasons.
|
||||
*
|
||||
* @param string $keyType One of the class type constants TYPE_PHPNAME,
|
||||
* TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM
|
||||
* @return an associative array containing the field names (as keys) and field values
|
||||
*/
|
||||
public function toArray($keyType = BasePeer::TYPE_PHPNAME)
|
||||
{
|
||||
$key = UsersPeer::translateFieldName(
|
||||
UsersPeer::USR_PASSWORD,
|
||||
BasePeer::TYPE_COLNAME,
|
||||
$keyType
|
||||
);
|
||||
$array = parent::toArray($keyType);
|
||||
unset($array[$key]);
|
||||
return $array;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
<?php
|
||||
$option = (isset($_POST["option"]))? $_POST["option"] : "";
|
||||
|
||||
$response = array();
|
||||
|
||||
$RBAC->allows(basename(__FILE__), $option);
|
||||
switch ($option) {
|
||||
case "INS":
|
||||
$arrayData = array();
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
|
||||
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
|
||||
*/
|
||||
use ProcessMaker\Util\Common;
|
||||
|
||||
$response = new StdClass();
|
||||
$outputDir = PATH_DATA . "sites" . PATH_SEP . SYS_SYS . PATH_SEP . "files" . PATH_SEP . "output" . PATH_SEP;
|
||||
@@ -42,7 +43,7 @@ try {
|
||||
$projectName = $exporter->getProjectName();
|
||||
$getProjectName = $exporter->truncateName($projectName, false);
|
||||
|
||||
$version = ProcessMaker\Util\Common::getLastVersion($outputDir . $getProjectName . "-*.pmx") + 1;
|
||||
$version = Common::getLastVersionSpecialCharacters($outputDir, $getProjectName, "pmx") + 1;
|
||||
$outputFilename = sprintf("%s-%s.%s", str_replace(" ", "_", $getProjectName), $version, "pmx");
|
||||
$outputFilename = $exporter->saveExport($outputDir . $outputFilename);
|
||||
/*----------------------------------********---------------------------------*/
|
||||
|
||||
@@ -318,7 +318,7 @@ switch ($_POST['action']) {
|
||||
|
||||
require_once 'classes/model/UsersProperties.php';
|
||||
$oUserProperty = new UsersProperties();
|
||||
$aUserProperty = $oUserProperty->loadOrCreateIfNotExists($aFields['USR_UID'], array('USR_PASSWORD_HISTORY' => serialize(array($aFields['USR_PASSWORD']))));
|
||||
$aUserProperty = $oUserProperty->loadOrCreateIfNotExists($aFields['USR_UID'], array('USR_PASSWORD_HISTORY' => serialize(array($oUser->getUsrPassword()))));
|
||||
$aFields['USR_LOGGED_NEXT_TIME'] = $aUserProperty['USR_LOGGED_NEXT_TIME'];
|
||||
|
||||
if (array_key_exists('USR_PASSWORD', $aFields)) {
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
<?php
|
||||
namespace ProcessMaker\BusinessModel;
|
||||
use \G;
|
||||
use \Exception;
|
||||
use \Bootstrap;
|
||||
|
||||
class EmailServer
|
||||
{
|
||||
@@ -19,6 +22,8 @@ class EmailServer
|
||||
"MESS_DEFAULT" => array("type" => "int", "required" => false, "empty" => false, "defaultValues" => array(0, 1), "fieldNameAux" => "emailServerDefault")
|
||||
);
|
||||
|
||||
private $contextLog = array();
|
||||
|
||||
private $formatFieldNameInUppercase = true;
|
||||
|
||||
private $arrayFieldNameForException = array(
|
||||
@@ -37,17 +42,51 @@ class EmailServer
|
||||
foreach ($this->arrayFieldDefinition as $key => $value) {
|
||||
$this->arrayFieldNameForException[$value["fieldNameAux"]] = $key;
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
|
||||
//Define the variables for the logging
|
||||
global $RBAC;
|
||||
$currentUser = $RBAC->aUserInfo['USER_INFO'];
|
||||
$info = array(
|
||||
'ip' => G::getIpAddress(),
|
||||
'workspace' => (defined("SYS_SYS"))? SYS_SYS : "Workspace undefined",
|
||||
'usrUid' => $currentUser['USR_UID']
|
||||
);
|
||||
$this->setContextLog($info);
|
||||
|
||||
|
||||
} catch (Exception $e) {
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the $contextLog value.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getContextLog()
|
||||
{
|
||||
return $this->contextLog;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the value of $contextLog.
|
||||
*
|
||||
* @param array $k
|
||||
* @return void
|
||||
*/
|
||||
public function setContextLog($k)
|
||||
{
|
||||
$this->contextLog = array_merge($this->contextLog, $k);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the format of the fields name (uppercase, lowercase)
|
||||
*
|
||||
* @param bool $flag Value that set the format
|
||||
*
|
||||
* return void
|
||||
* @return void
|
||||
* @throws Exception
|
||||
*/
|
||||
public function setFormatFieldNameInUppercase($flag)
|
||||
{
|
||||
@@ -55,7 +94,7 @@ class EmailServer
|
||||
$this->formatFieldNameInUppercase = $flag;
|
||||
|
||||
$this->setArrayFieldNameForException($this->arrayFieldNameForException);
|
||||
} catch (\Exception $e) {
|
||||
} catch (Exception $e) {
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
@@ -65,7 +104,8 @@ class EmailServer
|
||||
*
|
||||
* @param array $arrayData Data with the fields
|
||||
*
|
||||
* return void
|
||||
* @return void
|
||||
* @throws Exception
|
||||
*/
|
||||
public function setArrayFieldNameForException(array $arrayData)
|
||||
{
|
||||
@@ -73,7 +113,7 @@ class EmailServer
|
||||
foreach ($arrayData as $key => $value) {
|
||||
$this->arrayFieldNameForException[$key] = $this->getFieldNameByFormatFieldName($value);
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
} catch (Exception $e) {
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
@@ -83,13 +123,14 @@ class EmailServer
|
||||
*
|
||||
* @param string $fieldName Field name
|
||||
*
|
||||
* return string Return the field name according the format
|
||||
* @return string, return the field name according the format
|
||||
* @throws Exception
|
||||
*/
|
||||
public function getFieldNameByFormatFieldName($fieldName)
|
||||
{
|
||||
try {
|
||||
return ($this->formatFieldNameInUppercase)? strtoupper($fieldName) : strtolower($fieldName);
|
||||
} catch (\Exception $e) {
|
||||
} catch (Exception $e) {
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
@@ -99,7 +140,8 @@ class EmailServer
|
||||
*
|
||||
* @param array $arrayData Data
|
||||
*
|
||||
* return array Return array with result of send test mail
|
||||
* @return array, return array with result of send test mail
|
||||
* @throws Exception
|
||||
*/
|
||||
public function sendTestMail(array $arrayData)
|
||||
{
|
||||
@@ -117,20 +159,20 @@ class EmailServer
|
||||
"SMTPSecure" => (isset($arrayData["SMTPSecure"]))? $arrayData["SMTPSecure"] : "none"
|
||||
);
|
||||
|
||||
$sFrom = \G::buildFrom($aConfiguration);
|
||||
$sFrom = G::buildFrom($aConfiguration);
|
||||
|
||||
$sSubject = \G::LoadTranslation("ID_MESS_TEST_SUBJECT");
|
||||
$msg = \G::LoadTranslation("ID_MESS_TEST_BODY");
|
||||
$sSubject = G::LoadTranslation("ID_MESS_TEST_SUBJECT");
|
||||
$msg = G::LoadTranslation("ID_MESS_TEST_BODY");
|
||||
|
||||
switch ($arrayData["MESS_ENGINE"]) {
|
||||
case "MAIL":
|
||||
$engine = \G::LoadTranslation("ID_MESS_ENGINE_TYPE_1");
|
||||
$engine = G::LoadTranslation("ID_MESS_ENGINE_TYPE_1");
|
||||
break;
|
||||
case "PHPMAILER":
|
||||
$engine = \G::LoadTranslation("ID_MESS_ENGINE_TYPE_2");
|
||||
$engine = G::LoadTranslation("ID_MESS_ENGINE_TYPE_2");
|
||||
break;
|
||||
case "OPENMAIL":
|
||||
$engine = \G::LoadTranslation("ID_MESS_ENGINE_TYPE_3");
|
||||
$engine = G::LoadTranslation("ID_MESS_ENGINE_TYPE_3");
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -175,7 +217,7 @@ class EmailServer
|
||||
if ($oSpool->status == "sent") {
|
||||
$arrayTestMailResult["status"] = true;
|
||||
$arrayTestMailResult["success"] = true;
|
||||
$arrayTestMailResult["msg"] = \G::LoadTranslation("ID_MAIL_TEST_SUCCESS");
|
||||
$arrayTestMailResult["msg"] = G::LoadTranslation("ID_MAIL_TEST_SUCCESS");
|
||||
} else {
|
||||
$arrayTestMailResult["status"] = false;
|
||||
$arrayTestMailResult["success"] = false;
|
||||
@@ -183,7 +225,7 @@ class EmailServer
|
||||
}
|
||||
|
||||
return $arrayTestMailResult;
|
||||
} catch (\Exception $e) {
|
||||
} catch (Exception $e) {
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
@@ -194,7 +236,8 @@ class EmailServer
|
||||
* @param array $arrayData Data
|
||||
* @param int $step Step
|
||||
*
|
||||
* return array Return array with result of test connection by step
|
||||
* @return array, return array with result of test connection by step
|
||||
* @throws Exception
|
||||
*/
|
||||
public function testConnectionByStep(array $arrayData, $step = 0)
|
||||
{
|
||||
@@ -208,7 +251,7 @@ class EmailServer
|
||||
$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["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;
|
||||
@@ -233,7 +276,7 @@ class EmailServer
|
||||
);
|
||||
|
||||
if ($arrayTestMailResult["status"] == false) {
|
||||
$arrayResult["message"] = \G::LoadTranslation("ID_SENDMAIL_NOT_INSTALLED");
|
||||
$arrayResult["message"] = G::LoadTranslation("ID_SENDMAIL_NOT_INSTALLED");
|
||||
}
|
||||
|
||||
//Return
|
||||
@@ -252,7 +295,7 @@ class EmailServer
|
||||
$passwdHide = "";
|
||||
}
|
||||
|
||||
$passwdDec = \G::decrypt($passwd,"EMAILENCRYPT");
|
||||
$passwdDec = G::decrypt($passwd,"EMAILENCRYPT");
|
||||
$auxPass = explode("hash:", $passwdDec);
|
||||
|
||||
if (count($auxPass) > 1) {
|
||||
@@ -378,7 +421,7 @@ class EmailServer
|
||||
$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["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;
|
||||
@@ -421,7 +464,7 @@ class EmailServer
|
||||
|
||||
//Return
|
||||
return $arrayResult;
|
||||
} catch (\Exception $e) {
|
||||
} catch (Exception $e) {
|
||||
$arrayResult = array();
|
||||
|
||||
$arrayResult["result"] = false;
|
||||
@@ -437,7 +480,8 @@ class EmailServer
|
||||
*
|
||||
* @param array $arrayData Data
|
||||
*
|
||||
* return array Return array with result of test connection
|
||||
* @return array, return array with result of test connection
|
||||
* @throws Exception
|
||||
*/
|
||||
public function testConnection(array $arrayData)
|
||||
{
|
||||
@@ -467,11 +511,11 @@ class EmailServer
|
||||
$arrayDataAux["MAIL_TO"] = "admin@processmaker.com";
|
||||
|
||||
$arrayResult[$arrayMailTestName[1]] = $this->testConnectionByStep($arrayDataAux);
|
||||
$arrayResult[$arrayMailTestName[1]]["title"] = \G::LoadTranslation("ID_EMAIL_SERVER_TEST_CONNECTION_VERIFYING_MAIL");
|
||||
$arrayResult[$arrayMailTestName[1]]["title"] = G::LoadTranslation("ID_EMAIL_SERVER_TEST_CONNECTION_VERIFYING_MAIL");
|
||||
|
||||
if ((int)($arrayData["MESS_TRY_SEND_INMEDIATLY"]) == 1 && $arrayData['MAIL_TO'] != '') {
|
||||
$arrayResult[$arrayMailTestName[2]] = $this->testConnectionByStep($arrayData);
|
||||
$arrayResult[$arrayMailTestName[2]]["title"] = \G::LoadTranslation("ID_EMAIL_SERVER_TEST_CONNECTION_SENDING_EMAIL", array($arrayData["MAIL_TO"]));
|
||||
$arrayResult[$arrayMailTestName[2]]["title"] = G::LoadTranslation("ID_EMAIL_SERVER_TEST_CONNECTION_SENDING_EMAIL", array($arrayData["MAIL_TO"]));
|
||||
}
|
||||
break;
|
||||
case "PHPMAILER":
|
||||
@@ -482,19 +526,19 @@ class EmailServer
|
||||
|
||||
switch ($step) {
|
||||
case 1:
|
||||
$arrayResult[$arrayPhpMailerTestName[$step]]["title"] = \G::LoadTranslation("ID_EMAIL_SERVER_TEST_CONNECTION_RESOLVING_NAME", array($arrayData["MESS_SERVER"]));
|
||||
$arrayResult[$arrayPhpMailerTestName[$step]]["title"] = G::LoadTranslation("ID_EMAIL_SERVER_TEST_CONNECTION_RESOLVING_NAME", array($arrayData["MESS_SERVER"]));
|
||||
break;
|
||||
case 2:
|
||||
$arrayResult[$arrayPhpMailerTestName[$step]]["title"] = \G::LoadTranslation("ID_EMAIL_SERVER_TEST_CONNECTION_CHECK_PORT", array($arrayData["MESS_PORT"]));
|
||||
$arrayResult[$arrayPhpMailerTestName[$step]]["title"] = G::LoadTranslation("ID_EMAIL_SERVER_TEST_CONNECTION_CHECK_PORT", array($arrayData["MESS_PORT"]));
|
||||
break;
|
||||
case 3:
|
||||
$arrayResult[$arrayPhpMailerTestName[$step]]["title"] = \G::LoadTranslation("ID_EMAIL_SERVER_TEST_CONNECTION_ESTABLISHING_CON_HOST", array($arrayData["MESS_SERVER"] . ":" . $arrayData["MESS_PORT"]));
|
||||
$arrayResult[$arrayPhpMailerTestName[$step]]["title"] = G::LoadTranslation("ID_EMAIL_SERVER_TEST_CONNECTION_ESTABLISHING_CON_HOST", array($arrayData["MESS_SERVER"] . ":" . $arrayData["MESS_PORT"]));
|
||||
break;
|
||||
case 4:
|
||||
$arrayResult[$arrayPhpMailerTestName[$step]]["title"] = \G::LoadTranslation("ID_EMAIL_SERVER_TEST_CONNECTION_LOGIN", array($arrayData["MESS_ACCOUNT"], $arrayData["MESS_SERVER"]));
|
||||
$arrayResult[$arrayPhpMailerTestName[$step]]["title"] = G::LoadTranslation("ID_EMAIL_SERVER_TEST_CONNECTION_LOGIN", array($arrayData["MESS_ACCOUNT"], $arrayData["MESS_SERVER"]));
|
||||
break;
|
||||
case 5:
|
||||
$arrayResult[$arrayPhpMailerTestName[$step]]["title"] = \G::LoadTranslation("ID_EMAIL_SERVER_TEST_CONNECTION_SENDING_EMAIL", array($arrayData["MAIL_TO"]));
|
||||
$arrayResult[$arrayPhpMailerTestName[$step]]["title"] = G::LoadTranslation("ID_EMAIL_SERVER_TEST_CONNECTION_SENDING_EMAIL", array($arrayData["MAIL_TO"]));
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -503,7 +547,7 @@ class EmailServer
|
||||
|
||||
//Result
|
||||
return $arrayResult;
|
||||
} catch (\Exception $e) {
|
||||
} catch (Exception $e) {
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
@@ -513,7 +557,8 @@ class EmailServer
|
||||
*
|
||||
* @param string $emailServerUid Unique id of Email Server
|
||||
*
|
||||
* return bool Return true if is default Email Server, false otherwise
|
||||
* @return bool, return true if is default Email Server, false otherwise
|
||||
* @throws Exception
|
||||
*/
|
||||
public function checkIfIsDefault($emailServerUid)
|
||||
{
|
||||
@@ -530,7 +575,7 @@ class EmailServer
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
} catch (Exception $e) {
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
@@ -541,7 +586,8 @@ class EmailServer
|
||||
* @param string $emailServerUid Unique id of Email Server
|
||||
* @param array $arrayData Data
|
||||
*
|
||||
* return void Throw exception if data has an invalid value
|
||||
* @return void Throw exception if data has an invalid value
|
||||
* @throws Exception
|
||||
*/
|
||||
public function throwExceptionIfDataIsInvalid($emailServerUid, array $arrayData)
|
||||
{
|
||||
@@ -609,10 +655,10 @@ class EmailServer
|
||||
}
|
||||
|
||||
if ($msg != "") {
|
||||
throw new \Exception($msg);
|
||||
throw new Exception($msg);
|
||||
}
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
} catch (Exception $e) {
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
@@ -623,7 +669,8 @@ class EmailServer
|
||||
* @param string $emailServerUid Unique id of Email Server
|
||||
* @param string $fieldNameForException Field name for the exception
|
||||
*
|
||||
* return void Throw exception if does not exist the Email Server in table EMAIL_SERVER
|
||||
* @return void Throw exception if does not exist the Email Server in table EMAIL_SERVER
|
||||
* @throws Exception
|
||||
*/
|
||||
public function throwExceptionIfNotExistsEmailServer($emailServerUid, $fieldNameForException)
|
||||
{
|
||||
@@ -631,9 +678,9 @@ class EmailServer
|
||||
$obj = \EmailServerPeer::retrieveByPK($emailServerUid);
|
||||
|
||||
if (is_null($obj)) {
|
||||
throw new \Exception(\G::LoadTranslation("ID_EMAIL_SERVER_DOES_NOT_EXIST", array($fieldNameForException, $emailServerUid)));
|
||||
throw new Exception(G::LoadTranslation("ID_EMAIL_SERVER_DOES_NOT_EXIST", array($fieldNameForException, $emailServerUid)));
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
} catch (Exception $e) {
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
@@ -644,15 +691,16 @@ class EmailServer
|
||||
* @param string $emailServerUid Unique id of Email Server
|
||||
* @param string $fieldNameForException Field name for the exception
|
||||
*
|
||||
* return void Throw exception if is default Email Server
|
||||
* @return void Throw exception if is default Email Server
|
||||
* @throws Exception
|
||||
*/
|
||||
public function throwExceptionIfIsDefault($emailServerUid, $fieldNameForException)
|
||||
{
|
||||
try {
|
||||
if ($this->checkIfIsDefault($emailServerUid)) {
|
||||
throw new \Exception(\G::LoadTranslation("ID_EMAIL_SERVER_IS_DEFAULT", array($fieldNameForException, $emailServerUid)));
|
||||
throw new Exception(G::LoadTranslation("ID_EMAIL_SERVER_IS_DEFAULT", array($fieldNameForException, $emailServerUid)));
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
} catch (Exception $e) {
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
@@ -662,7 +710,8 @@ class EmailServer
|
||||
*
|
||||
* @param string $emailServerUid Unique id of Email Server
|
||||
*
|
||||
* return void
|
||||
* @return void
|
||||
* @throws Exception
|
||||
*/
|
||||
public function setEmailServerDefaultByUid($emailServerUid)
|
||||
{
|
||||
@@ -703,7 +752,8 @@ class EmailServer
|
||||
*
|
||||
* @param array $arrayData Data
|
||||
*
|
||||
* return array Return data of the new Email Server created
|
||||
* @return array, data of the new Email Server created
|
||||
* @throws Exception
|
||||
*/
|
||||
public function create(array $arrayData)
|
||||
{
|
||||
@@ -729,7 +779,7 @@ class EmailServer
|
||||
$emailServer = new \EmailServer();
|
||||
|
||||
$passwd = $arrayData["MESS_PASSWORD"];
|
||||
$passwdDec = \G::decrypt($passwd, "EMAILENCRYPT");
|
||||
$passwdDec = G::decrypt($passwd, "EMAILENCRYPT");
|
||||
$auxPass = explode("hash:", $passwdDec);
|
||||
|
||||
if (count($auxPass) > 1) {
|
||||
@@ -745,7 +795,7 @@ class EmailServer
|
||||
|
||||
if ($arrayData["MESS_PASSWORD"] != "") {
|
||||
$arrayData["MESS_PASSWORD"] = "hash:" . $arrayData["MESS_PASSWORD"];
|
||||
$arrayData["MESS_PASSWORD"] = \G::encrypt($arrayData["MESS_PASSWORD"], "EMAILENCRYPT");
|
||||
$arrayData["MESS_PASSWORD"] = G::encrypt($arrayData["MESS_PASSWORD"], "EMAILENCRYPT");
|
||||
}
|
||||
|
||||
$emailServer->fromArray($arrayData, \BasePeer::TYPE_FIELDNAME);
|
||||
@@ -765,7 +815,28 @@ class EmailServer
|
||||
$this->setEmailServerDefaultByUid($emailServerUid);
|
||||
}
|
||||
|
||||
//Return
|
||||
//Logging the create action
|
||||
$info = array(
|
||||
'action' => 'Create email server',
|
||||
'messUid'=> $emailServerUid,
|
||||
'engine'=> $arrayData["MESS_ENGINE"],
|
||||
'server' => $arrayData["MESS_SERVER"],
|
||||
'port' => $arrayData["MESS_PORT"],
|
||||
'requireAuthentication' => $arrayData["MESS_RAUTH"],
|
||||
'account' => $arrayData["MESS_ACCOUNT"],
|
||||
'senderEmail' => $arrayData["MESS_FROM_MAIL"],
|
||||
'senderName' => $arrayData["MESS_FROM_NAME"],
|
||||
'useSecureConnection' => $arrayData["SMTPSECURE"],
|
||||
'sendTestEmail' => $arrayData["MESS_TRY_SEND_INMEDIATLY"],
|
||||
'setAsDefaultConfiguration' => $arrayData["MESS_DEFAULT"]
|
||||
);
|
||||
$this->setContextLog($info);
|
||||
$this->syslog(
|
||||
'CreateEmailServer',
|
||||
200,
|
||||
'New email server was created',
|
||||
$this->getContextLog()
|
||||
);
|
||||
return $this->getEmailServer($emailServerUid);
|
||||
} else {
|
||||
$msg = "";
|
||||
@@ -774,14 +845,14 @@ class EmailServer
|
||||
$msg = $msg . (($msg != "")? "\n" : "") . $validationFailure->getMessage();
|
||||
}
|
||||
|
||||
throw new \Exception(\G::LoadTranslation("ID_RECORD_CANNOT_BE_CREATED") . (($msg != "")? "\n" . $msg : ""));
|
||||
throw new Exception(G::LoadTranslation("ID_RECORD_CANNOT_BE_CREATED") . (($msg != "")? "\n" . $msg : ""));
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
} catch (Exception $e) {
|
||||
$cnn->rollback();
|
||||
|
||||
throw $e;
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
} catch (Exception $e) {
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
@@ -791,7 +862,8 @@ class EmailServer
|
||||
*
|
||||
* @param array $arrayData Data
|
||||
*
|
||||
* return array Return data of the new Email Server created
|
||||
* @return array, return data of the new Email Server created
|
||||
* @throws Exception
|
||||
*/
|
||||
public function create2(array $arrayData)
|
||||
{
|
||||
@@ -828,14 +900,14 @@ class EmailServer
|
||||
$msg = $msg . (($msg != "")? "\n" : "") . $validationFailure->getMessage();
|
||||
}
|
||||
|
||||
throw new \Exception(\G::LoadTranslation("ID_RECORD_CANNOT_BE_CREATED") . (($msg != "")? "\n" . $msg : ""));
|
||||
throw new Exception(G::LoadTranslation("ID_RECORD_CANNOT_BE_CREATED") . (($msg != "")? "\n" . $msg : ""));
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
} catch (Exception $e) {
|
||||
$cnn->rollback();
|
||||
|
||||
throw $e;
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
} catch (Exception $e) {
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
@@ -846,7 +918,8 @@ class EmailServer
|
||||
* @param string $emailServerUid Unique id of Group
|
||||
* @param array $arrayData Data
|
||||
*
|
||||
* return array Return data of the Email Server updated
|
||||
* @return array Return data of the Email Server updated
|
||||
* @throws Exception
|
||||
*/
|
||||
public function update($emailServerUid, $arrayData)
|
||||
{
|
||||
@@ -874,7 +947,7 @@ class EmailServer
|
||||
|
||||
if (isset($arrayData['MESS_PASSWORD'])) {
|
||||
$passwd = $arrayData['MESS_PASSWORD'];
|
||||
$passwdDec = \G::decrypt($passwd, 'EMAILENCRYPT');
|
||||
$passwdDec = G::decrypt($passwd, 'EMAILENCRYPT');
|
||||
$auxPass = explode('hash:', $passwdDec);
|
||||
|
||||
if (count($auxPass) > 1) {
|
||||
@@ -890,7 +963,7 @@ class EmailServer
|
||||
|
||||
if ($arrayData['MESS_PASSWORD'] != '') {
|
||||
$arrayData['MESS_PASSWORD'] = 'hash:' . $arrayData['MESS_PASSWORD'];
|
||||
$arrayData['MESS_PASSWORD'] = \G::encrypt($arrayData['MESS_PASSWORD'], 'EMAILENCRYPT');
|
||||
$arrayData['MESS_PASSWORD'] = G::encrypt($arrayData['MESS_PASSWORD'], 'EMAILENCRYPT');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -912,6 +985,29 @@ class EmailServer
|
||||
$arrayData = array_change_key_case($arrayData, CASE_LOWER);
|
||||
}
|
||||
|
||||
//Logging the update action
|
||||
$info = array(
|
||||
'action' => 'Update email server',
|
||||
'messUid' => $emailServerUid,
|
||||
'engine' => $arrayData["MESS_ENGINE"],
|
||||
'server' => $arrayData["MESS_SERVER"],
|
||||
'port' => $arrayData["MESS_PORT"],
|
||||
'requireAuthentication' => $arrayData["MESS_RAUTH"],
|
||||
'account' => $arrayData["MESS_ACCOUNT"],
|
||||
'senderEmail' => $arrayData["MESS_FROM_MAIL"],
|
||||
'senderName' => $arrayData["MESS_FROM_NAME"],
|
||||
'useSecureConnection' => $arrayData["SMTPSECURE"],
|
||||
'sendTestEmail' => $arrayData["MESS_TRY_SEND_INMEDIATLY"],
|
||||
'setAsDefaultConfiguration' => $arrayData["MESS_DEFAULT"]
|
||||
);
|
||||
$this->setContextLog($info);
|
||||
$this->syslog(
|
||||
'UpdateEmailServer',
|
||||
200,
|
||||
'The email server was updated',
|
||||
$this->getContextLog()
|
||||
);
|
||||
|
||||
return $arrayData;
|
||||
} else {
|
||||
$msg = "";
|
||||
@@ -920,14 +1016,14 @@ class EmailServer
|
||||
$msg = $msg . (($msg != "")? "\n" : "") . $validationFailure->getMessage();
|
||||
}
|
||||
|
||||
throw new \Exception(\G::LoadTranslation("ID_RECORD_CANNOT_BE_CREATED") . (($msg != "")? "\n" . $msg : ""));
|
||||
throw new Exception(G::LoadTranslation("ID_RECORD_CANNOT_BE_CREATED") . (($msg != "")? "\n" . $msg : ""));
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
} catch (Exception $e) {
|
||||
$cnn->rollback();
|
||||
|
||||
throw $e;
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
} catch (Exception $e) {
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
@@ -937,22 +1033,32 @@ class EmailServer
|
||||
*
|
||||
* @param string $emailServerUid Unique id of Email Server
|
||||
*
|
||||
* return void
|
||||
* @return void
|
||||
* @throws Exception
|
||||
*/
|
||||
public function delete($emailServerUid)
|
||||
{
|
||||
try {
|
||||
//Verify data
|
||||
$this->throwExceptionIfNotExistsEmailServer($emailServerUid, $this->arrayFieldNameForException["emailServerUid"]);
|
||||
|
||||
$this->throwExceptionIfIsDefault($emailServerUid, $this->arrayFieldNameForException["emailServerUid"]);
|
||||
|
||||
$criteria = $this->getEmailServerCriteria();
|
||||
|
||||
$criteria->add(\EmailServerPeer::MESS_UID, $emailServerUid, \Criteria::EQUAL);
|
||||
|
||||
\EmailServerPeer::doDelete($criteria);
|
||||
} catch (\Exception $e) {
|
||||
|
||||
//Logging the delete action
|
||||
$info = array(
|
||||
'action' => 'Delete email server',
|
||||
'messUid' => $emailServerUid
|
||||
);
|
||||
$this->setContextLog($info);
|
||||
$this->syslog(
|
||||
'DeleteEmailServer',
|
||||
200,
|
||||
'The email server was deleted',
|
||||
$this->getContextLog()
|
||||
);
|
||||
} catch (Exception $e) {
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
@@ -982,7 +1088,7 @@ class EmailServer
|
||||
$criteria->addSelectColumn(\EmailServerPeer::MESS_DEFAULT);
|
||||
|
||||
return $criteria;
|
||||
} catch (\Exception $e) {
|
||||
} catch (Exception $e) {
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
@@ -992,7 +1098,8 @@ class EmailServer
|
||||
*
|
||||
* @param array $record Record
|
||||
*
|
||||
* return array Return an array with data Email Server
|
||||
* @return array, return an array with data Email Server
|
||||
* @throws Exception
|
||||
*/
|
||||
public function getEmailServerDataFromRecord(array $record)
|
||||
{
|
||||
@@ -1016,7 +1123,7 @@ class EmailServer
|
||||
$this->getFieldNameByFormatFieldName("MESS_EXECUTE_EVERY") => '',
|
||||
$this->getFieldNameByFormatFieldName("MESS_SEND_MAX") => ''
|
||||
);
|
||||
} catch (\Exception $e) {
|
||||
} catch (Exception $e) {
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
@@ -1064,7 +1171,7 @@ class EmailServer
|
||||
|
||||
//Return
|
||||
return $arrayData;
|
||||
} catch (\Exception $e) {
|
||||
} catch (Exception $e) {
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
@@ -1078,7 +1185,8 @@ class EmailServer
|
||||
* @param int $start Start
|
||||
* @param int $limit Limit
|
||||
*
|
||||
* return array Return an array with all Email Servers
|
||||
* @return array, return an array with all Email Servers
|
||||
* @throws Exception
|
||||
*/
|
||||
public function getEmailServers($arrayFilterData = null, $sortField = null, $sortDir = null, $start = null, $limit = null)
|
||||
{
|
||||
@@ -1101,10 +1209,10 @@ class EmailServer
|
||||
if (!is_null($arrayFilterData) && is_array($arrayFilterData) && isset($arrayFilterData["filter"]) && trim($arrayFilterData["filter"]) != "") {
|
||||
$criteria->add(
|
||||
$criteria->getNewCriterion(\EmailServerPeer::MESS_ENGINE, "%" . $arrayFilterData["filter"] . "%", \Criteria::LIKE)->addOr(
|
||||
$criteria->getNewCriterion(\EmailServerPeer::MESS_SERVER, "%" . $arrayFilterData["filter"] . "%", \Criteria::LIKE))->addOr(
|
||||
$criteria->getNewCriterion(\EmailServerPeer::MESS_ACCOUNT, "%" . $arrayFilterData["filter"] . "%", \Criteria::LIKE))->addOr(
|
||||
$criteria->getNewCriterion(\EmailServerPeer::MESS_FROM_NAME, "%" . $arrayFilterData["filter"] . "%", \Criteria::LIKE))->addOr(
|
||||
$criteria->getNewCriterion(\EmailServerPeer::SMTPSECURE, "%" . $arrayFilterData["filter"] . "%", \Criteria::LIKE))
|
||||
$criteria->getNewCriterion(\EmailServerPeer::MESS_SERVER, "%" . $arrayFilterData["filter"] . "%", \Criteria::LIKE))->addOr(
|
||||
$criteria->getNewCriterion(\EmailServerPeer::MESS_ACCOUNT, "%" . $arrayFilterData["filter"] . "%", \Criteria::LIKE))->addOr(
|
||||
$criteria->getNewCriterion(\EmailServerPeer::MESS_FROM_NAME, "%" . $arrayFilterData["filter"] . "%", \Criteria::LIKE))->addOr(
|
||||
$criteria->getNewCriterion(\EmailServerPeer::SMTPSECURE, "%" . $arrayFilterData["filter"] . "%", \Criteria::LIKE))
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1156,7 +1264,7 @@ class EmailServer
|
||||
$row = $rsCriteria->getRow();
|
||||
|
||||
$passwd = $row["MESS_PASSWORD"];
|
||||
$passwdDec = \G::decrypt($passwd, "EMAILENCRYPT");
|
||||
$passwdDec = G::decrypt($passwd, "EMAILENCRYPT");
|
||||
$auxPass = explode("hash:", $passwdDec);
|
||||
|
||||
if (count($auxPass) > 1) {
|
||||
@@ -1181,7 +1289,7 @@ class EmailServer
|
||||
"filter" => (!is_null($arrayFilterData) && is_array($arrayFilterData) && isset($arrayFilterData["filter"]))? $arrayFilterData["filter"] : "",
|
||||
"data" => $arrayEmailServer
|
||||
);
|
||||
} catch (\Exception $e) {
|
||||
} catch (Exception $e) {
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
@@ -1192,7 +1300,8 @@ class EmailServer
|
||||
* @param string $emailServerUid Unique id of Email Server
|
||||
* @param bool $flagGetRecord Value that set the getting
|
||||
*
|
||||
* return array Return an array with data of a Email Server
|
||||
* @return array, return an array with data of a Email Server
|
||||
* @throws Exception
|
||||
*/
|
||||
public function getEmailServer($emailServerUid, $flagGetRecord = false)
|
||||
{
|
||||
@@ -1224,7 +1333,7 @@ class EmailServer
|
||||
|
||||
//Return
|
||||
return (!$flagGetRecord)? $this->getEmailServerDataFromRecord($row) : $row;
|
||||
} catch (\Exception $e) {
|
||||
} catch (Exception $e) {
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
@@ -1246,5 +1355,31 @@ class EmailServer
|
||||
$rsCriteria->next();
|
||||
return $rsCriteria->getRow();
|
||||
}
|
||||
|
||||
/**
|
||||
* Logging information related to the email server
|
||||
* When the user create, update, delete the email server
|
||||
*
|
||||
* @param string $channel
|
||||
* @param string $level
|
||||
* @param string $message
|
||||
* @param array $context
|
||||
*
|
||||
* @return void
|
||||
* @throws Exception
|
||||
*/
|
||||
private function syslog(
|
||||
$channel,
|
||||
$level,
|
||||
$message,
|
||||
$context = array()
|
||||
)
|
||||
{
|
||||
try {
|
||||
Bootstrap::registerMonolog($channel, $level, $message, $context, $context['workspace'], 'processmaker.log');
|
||||
} catch (Exception $e) {
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
namespace ProcessMaker\BusinessModel\Migrator;
|
||||
|
||||
use ProcessMaker\Project;
|
||||
use ProcessMaker\Util\Common;
|
||||
|
||||
class GranularExporter
|
||||
{
|
||||
@@ -64,7 +65,7 @@ class GranularExporter
|
||||
$this->prjName = $projectData['PRJ_NAME'];
|
||||
$getProjectName = $this->publisher->truncateName($projectData['PRJ_NAME'], false);
|
||||
$outputDir = PATH_DATA . "sites" . PATH_SEP . SYS_SYS . PATH_SEP . "files" . PATH_SEP . "output" . PATH_SEP;
|
||||
$version = \ProcessMaker\Util\Common::getLastVersion($outputDir . $getProjectName . "-*.pmx2") + 1;
|
||||
$version = Common::getLastVersionSpecialCharacters($outputDir, $getProjectName, "pmx2") + 1;
|
||||
$outputFilename = $outputDir . sprintf("%s-%s.%s", str_replace(" ", "_", $getProjectName), $version, "pmx2");
|
||||
|
||||
$bpnmDefinition = array(
|
||||
|
||||
@@ -785,7 +785,7 @@ class User
|
||||
$oUser = new Users();
|
||||
$aUser = $oUser->load($userUid);
|
||||
$oUserProperty = new UsersProperties();
|
||||
$aUserProperty = $oUserProperty->loadOrCreateIfNotExists($userUid, array("USR_PASSWORD_HISTORY" => serialize(array($aUser["USR_PASSWORD"]))));
|
||||
$aUserProperty = $oUserProperty->loadOrCreateIfNotExists($userUid, array("USR_PASSWORD_HISTORY" => serialize(array($oUser->getUsrPassword()))));
|
||||
$aUserProperty["USR_LOGGED_NEXT_TIME"] = $arrayData["USR_LOGGED_NEXT_TIME"];
|
||||
$oUserProperty->update($aUserProperty);
|
||||
}
|
||||
|
||||
@@ -382,7 +382,7 @@ class WebEntry
|
||||
$arrayUserData = $user->load($arrayWebEntryData["USR_UID"]);
|
||||
|
||||
$usrUsername = $arrayUserData["USR_USERNAME"];
|
||||
$usrPassword = $arrayUserData["USR_PASSWORD"];
|
||||
$usrPassword = $user->getUsrPassword();
|
||||
|
||||
$dynaForm = new \Dynaform();
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@ use ProcessMaker\Project;
|
||||
use ProcessMaker\Project\Adapter;
|
||||
use ProcessMaker\BusinessModel\Migrator;
|
||||
use ProcessMaker\BusinessModel\Migrator\ImportException;
|
||||
use ProcessMaker\Util\Common;
|
||||
|
||||
abstract class Importer
|
||||
{
|
||||
@@ -771,7 +772,7 @@ abstract class Importer
|
||||
$getProjectName = $exporter->truncateName($exporter->getProjectName(), false);
|
||||
|
||||
$outputDir = PATH_DATA . "sites" . PATH_SEP . SYS_SYS . PATH_SEP . "files" . PATH_SEP . "output" . PATH_SEP;
|
||||
$version = \ProcessMaker\Util\Common::getLastVersion($outputDir . $getProjectName . "-*.pmx") + 1;
|
||||
$version = Common::getLastVersionSpecialCharacters($outputDir, $getProjectName, "pmx") + 1;
|
||||
$outputFilename = $outputDir . sprintf("%s-%s.%s", str_replace(" ", "_", $getProjectName), $version, "pmx");
|
||||
|
||||
$exporter->setMetadata("export_version", $version);
|
||||
|
||||
@@ -10,6 +10,7 @@ use \ProcessMaker\BusinessModel\Validator;
|
||||
use \ProcessMaker\BusinessModel\Migrator\GranularExporter;
|
||||
use \ProcessMaker\BusinessModel\Migrator\ExportObjects;
|
||||
use \ProcessMaker\Util\IO\HttpStream;
|
||||
use \ProcessMaker\Util\Common;
|
||||
|
||||
/**
|
||||
* Class Project
|
||||
@@ -182,7 +183,7 @@ class Project extends Api
|
||||
$getProjectName = $exporter->truncateName($exporter->getProjectName(), false);
|
||||
|
||||
$outputDir = PATH_DATA . "sites" . PATH_SEP . SYS_SYS . PATH_SEP . "files" . PATH_SEP . "output" . PATH_SEP;
|
||||
$version = \ProcessMaker\Util\Common::getLastVersion($outputDir . $getProjectName . "-*.pmx") + 1;
|
||||
$version = Common::getLastVersionSpecialCharacters($outputDir, $getProjectName, "pmx") + 1;
|
||||
$outputFilename = $outputDir . sprintf("%s-%s.%s", str_replace(" ", "_", $getProjectName), $version, "pmx");
|
||||
|
||||
$exporter->setMetadata("export_version", $version);
|
||||
|
||||
Reference in New Issue
Block a user