Merge remote-tracking branch 'origin/bugfix/HOR-3670' into release/3.2.2
This commit is contained in:
@@ -2,7 +2,10 @@
|
||||
|
||||
namespace ProcessMaker\BusinessModel;
|
||||
|
||||
use ProcessMaker\Core\System;
|
||||
use ProcessMaker\Plugins\PluginRegistry;
|
||||
use PmDynaform;
|
||||
use SpoolRun;
|
||||
|
||||
/**
|
||||
* Description of ActionsByEmailService
|
||||
@@ -406,9 +409,9 @@ class ActionsByEmail
|
||||
$arrayConfigAux = $row;
|
||||
$arrayConfigAux["SMTPSecure"] = $row["SMTPSECURE"];
|
||||
}
|
||||
$aSetup = (!empty($arrayConfigAux))? $arrayConfigAux : \PmSystem::getEmailConfiguration();
|
||||
$aSetup = (!empty($arrayConfigAux))? $arrayConfigAux : System::getEmailConfiguration();
|
||||
|
||||
$spool = new \spoolRun();
|
||||
$spool = new SpoolRun();
|
||||
$spool->setConfig($aSetup);
|
||||
|
||||
$spool->create(array(
|
||||
@@ -579,7 +582,7 @@ class ActionsByEmail
|
||||
$configuration = $resultD->getRow();
|
||||
|
||||
$field = new \stdClass();
|
||||
$obj = new \pmDynaform($configuration);
|
||||
$obj = new PmDynaform($configuration);
|
||||
|
||||
if ($dataRes['ABE_RES_DATA'] !== '') {
|
||||
$value = unserialize($dataRes['ABE_RES_DATA']);
|
||||
@@ -670,7 +673,7 @@ class ActionsByEmail
|
||||
//SSO
|
||||
if (\PMLicensedFeatures::getSingleton()->verifyfeature('x4TTzlISnp2K2tnSTJoMC8rTDRMTjlhMCtZeXV0QnNCLzU=')) {
|
||||
|
||||
$sso = new \pmSsoClass();
|
||||
$sso = new \PmSsoClass();
|
||||
|
||||
if ($sso->ssocVerifyUser()) {
|
||||
global $RBAC;
|
||||
|
||||
@@ -5,16 +5,14 @@ use G;
|
||||
use UsersPeer;
|
||||
use CasesPeer;
|
||||
use AppDelegation;
|
||||
use ProcessMaker\Core\System;
|
||||
use ProcessMaker\Plugins\PluginRegistry;
|
||||
use Exception;
|
||||
use wsBase;
|
||||
use WsBase;
|
||||
use RBAC;
|
||||
use pmDynaform;
|
||||
use Applications;
|
||||
use PmDynaform;
|
||||
|
||||
/**
|
||||
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
|
||||
* @copyright Colosa - Bolivia
|
||||
*/
|
||||
class Cases
|
||||
{
|
||||
private $formatFieldNameInUppercase = true;
|
||||
@@ -187,7 +185,7 @@ class Cases
|
||||
{
|
||||
try {
|
||||
$solrEnabled = false;
|
||||
$solrConf = \PmSystem::solrEnv();
|
||||
$solrConf = System::solrEnv();
|
||||
|
||||
if ($solrConf !== false) {
|
||||
$ApplicationSolrIndex = new \AppSolr(
|
||||
@@ -262,7 +260,7 @@ class Cases
|
||||
$newerThan = (!empty($dataList['newerThan']))? $dataList['newerThan'] : '';
|
||||
$oldestThan = (!empty($dataList['oldestthan']))? $dataList['oldestthan'] : '';
|
||||
|
||||
$apps = new \Applications();
|
||||
$apps = new Applications();
|
||||
$response = $apps->getAll(
|
||||
$userUid,
|
||||
$start,
|
||||
@@ -336,7 +334,7 @@ class Cases
|
||||
$dateTo = (!empty( $dataList["dateTo"] )) ? substr( $dataList["dateTo"], 0, 10 ) : "";
|
||||
$filterStatus = isset( $dataList["filterStatus"] ) ? strtoupper( $dataList["filterStatus"] ) : "";
|
||||
|
||||
$apps = new \Applications();
|
||||
$apps = new Applications();
|
||||
$response = $apps->searchAll(
|
||||
$userId,
|
||||
$start,
|
||||
@@ -379,7 +377,7 @@ class Cases
|
||||
{
|
||||
try {
|
||||
$solrEnabled = 0;
|
||||
if (($solrEnv = \PmSystem::solrEnv()) !== false) {
|
||||
if (($solrEnv = System::solrEnv()) !== false) {
|
||||
$appSolr = new \AppSolr(
|
||||
$solrEnv["solr_enabled"],
|
||||
$solrEnv["solr_host"],
|
||||
@@ -406,7 +404,7 @@ class Cases
|
||||
$solrSearchText = "($solrSearchText)";
|
||||
//Add del_index dynamic fields to list of resulting columns
|
||||
$columsToIncludeFinal = array_merge($columsToInclude, $delegationIndexes);
|
||||
$solrRequestData = \Entity_SolrRequestData::createForRequestPagination(
|
||||
$solrRequestData = \EntitySolrRequestData::createForRequestPagination(
|
||||
array(
|
||||
"workspace" => $solrEnv["solr_instance"],
|
||||
"startAfter" => 0,
|
||||
@@ -420,7 +418,7 @@ class Cases
|
||||
)
|
||||
);
|
||||
//Use search index to return list of cases
|
||||
$searchIndex = new \BpmnEngine_Services_SearchIndex($appSolr->isSolrEnabled(), $solrEnv["solr_host"]);
|
||||
$searchIndex = new \BpmnEngineServicesSearchIndex($appSolr->isSolrEnabled(), $solrEnv["solr_host"]);
|
||||
//Execute query
|
||||
$solrQueryResult = $searchIndex->getDataTablePaginatedList($solrRequestData);
|
||||
//Get the missing data from database
|
||||
@@ -467,7 +465,7 @@ class Cases
|
||||
if (!isset($row)) {
|
||||
continue;
|
||||
}
|
||||
$ws = new wsBase();
|
||||
$ws = new WsBase();
|
||||
$fields = $ws->getCaseInfo($applicationUid, $row["DEL_INDEX"]);
|
||||
$array = json_decode(json_encode($fields), true);
|
||||
if ($array ["status_code"] != 0) {
|
||||
@@ -534,7 +532,7 @@ class Cases
|
||||
throw (new Exception($arrayData));
|
||||
}
|
||||
} else {
|
||||
$ws = new wsBase();
|
||||
$ws = new WsBase();
|
||||
$fields = $ws->getCaseInfo($applicationUid, 0);
|
||||
$array = json_decode(json_encode($fields), true);
|
||||
|
||||
@@ -680,7 +678,7 @@ class Cases
|
||||
{
|
||||
try {
|
||||
|
||||
$ws = new wsBase();
|
||||
$ws = new WsBase();
|
||||
if ($variables) {
|
||||
$variables = array_shift($variables);
|
||||
}
|
||||
@@ -724,7 +722,7 @@ class Cases
|
||||
{
|
||||
try {
|
||||
|
||||
$ws = new wsBase();
|
||||
$ws = new WsBase();
|
||||
if ($variables) {
|
||||
$variables = array_shift($variables);
|
||||
} elseif ($variables == null) {
|
||||
@@ -779,7 +777,7 @@ class Cases
|
||||
$delIndex = AppDelegation::getCurrentIndex($applicationUid);
|
||||
}
|
||||
|
||||
$ws = new wsBase();
|
||||
$ws = new WsBase();
|
||||
$fields = $ws->reassignCase($userUid, $applicationUid, $delIndex, $userUidSource, $userUidTarget);
|
||||
$array = json_decode(json_encode($fields), true);
|
||||
if (array_key_exists("status_code", $array)) {
|
||||
@@ -1010,7 +1008,7 @@ class Cases
|
||||
$RBAC->sSystem = 'PROCESSMAKER';
|
||||
}
|
||||
|
||||
$case = new wsBase();
|
||||
$case = new WsBase();
|
||||
$result = $case->executeTrigger($userUid, $appUid, $triUid, $delIndex);
|
||||
|
||||
if ($result->status_code != 0) {
|
||||
@@ -1077,7 +1075,7 @@ class Cases
|
||||
}
|
||||
}
|
||||
|
||||
$ws = new wsBase();
|
||||
$ws = new WsBase();
|
||||
$fields = $ws->derivateCase($userUid, $applicationUid, $delIndex, $bExecuteTriggersBeforeAssignment = false);
|
||||
$array = json_decode(json_encode($fields), true);
|
||||
if ($array ["status_code"] != 0) {
|
||||
@@ -1651,7 +1649,7 @@ class Cases
|
||||
}
|
||||
}
|
||||
return $caseVariable;
|
||||
} catch (Exception $e) {
|
||||
} catch (\Exception $e) {
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
@@ -1683,7 +1681,7 @@ class Cases
|
||||
if (!is_null($dynaFormUid)) {
|
||||
|
||||
$data["CURRENT_DYNAFORM"] = $dynaFormUid;
|
||||
$pmDynaForm = new \pmDynaform($data);
|
||||
$pmDynaForm = new PmDynaform($data);
|
||||
$arrayDynaFormData = $pmDynaForm->getDynaform();
|
||||
$arrayDynContent = \G::json_decode($arrayDynaFormData['DYN_CONTENT']);
|
||||
$pmDynaForm->jsonr($arrayDynContent);
|
||||
@@ -2302,7 +2300,7 @@ class Cases
|
||||
$tas_uid = $aCaseField["TAS_UID"];
|
||||
$pro_uid = $aCaseField["PRO_UID"];
|
||||
|
||||
$oApplication = new \Applications();
|
||||
$oApplication = new Applications();
|
||||
$aField = $oApplication->getSteps($app_uid, $del_index, $tas_uid, $pro_uid);
|
||||
|
||||
return $aField;
|
||||
|
||||
@@ -701,7 +701,7 @@ class InputDocument
|
||||
throw new \Exception(\G::LoadTranslation("ID_CASES_INPUT_DOES_NOT_EXIST", array($inputDocumentUid)));
|
||||
}
|
||||
|
||||
$ws = new \wsBase();
|
||||
$ws = new \WsBase();
|
||||
$ws->removeDocument($inputDocumentUid);
|
||||
} catch (\Exception $e) {
|
||||
throw $e;
|
||||
|
||||
@@ -1,18 +1,16 @@
|
||||
<?php
|
||||
namespace ProcessMaker\BusinessModel;
|
||||
|
||||
use \G;
|
||||
use \Smarty;
|
||||
use \Criteria;
|
||||
use \ReportTablePeer;
|
||||
use \ResultSet;
|
||||
use \CaseConsolidatedCorePeer;
|
||||
use \ContentPeer;
|
||||
use G;
|
||||
use Smarty;
|
||||
use Criteria;
|
||||
use ReportTablePeer;
|
||||
use ResultSet;
|
||||
use CaseConsolidatedCorePeer;
|
||||
use ContentPeer;
|
||||
use PmDynaform;
|
||||
use ReportTables;
|
||||
|
||||
/**
|
||||
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
|
||||
* @copyright Colosa - Bolivia
|
||||
*/
|
||||
class Consolidated
|
||||
{
|
||||
/**
|
||||
@@ -69,7 +67,7 @@ class Consolidated
|
||||
*/
|
||||
public function postDerivate($app_uid, $app_number, $del_index, $usr_uid, $fieldName = '', $fieldValue = '')
|
||||
{
|
||||
$ws = new \wsBase();
|
||||
$ws = new \WsBase();
|
||||
$oCase = new \Cases();
|
||||
|
||||
if (!isset($Fields["DEL_INIT_DATE"])) {
|
||||
@@ -361,7 +359,7 @@ class Consolidated
|
||||
$filter = new \InputFilter();
|
||||
|
||||
if ($sort != "") {
|
||||
$reportTable = new \ReportTables();
|
||||
$reportTable = new ReportTables();
|
||||
$arrayReportTableVar = $reportTable->getTableVars($tableUid);
|
||||
$tableName = $filter->validateInput($tableName);
|
||||
$sort = $filter->validateInput($sort);
|
||||
@@ -468,7 +466,7 @@ class Consolidated
|
||||
$dataTask = $oDyna->load($dyn_uid);
|
||||
if ($dataTask['DYN_VERSION'] > 0) {
|
||||
$_SESSION['PROCESS'] = $pro_uid;
|
||||
$pmDyna = new \pmDynaform(array('APP_DATA' => array(), "CURRENT_DYNAFORM" => $dyn_uid));
|
||||
$pmDyna = new PmDynaform(array('APP_DATA' => array(), "CURRENT_DYNAFORM" => $dyn_uid));
|
||||
$json = G::json_decode($dataTask["DYN_CONTENT"]);
|
||||
$pmDyna->jsonr($json);
|
||||
$fieldsDyna = $json->items[0]->items;
|
||||
|
||||
@@ -271,7 +271,7 @@ class DataBaseConnection
|
||||
$flagTns = ($dataCon["DBS_TYPE"] == "oracle" && $dataCon["DBS_CONNECTION_TYPE"] == "TNS")? 1 : 0;
|
||||
|
||||
if ($flagTns == 0) {
|
||||
$Server = new \NET($dataCon['DBS_SERVER']);
|
||||
$Server = new \Net($dataCon['DBS_SERVER']);
|
||||
|
||||
// STEP 1 : Resolving Host Name
|
||||
$respTest['0'] = array();
|
||||
@@ -356,7 +356,7 @@ class DataBaseConnection
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$net = new \NET();
|
||||
$net = new \Net();
|
||||
|
||||
//STEP 0: Trying to open database type TNS
|
||||
$respTest["0"] = array();
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
<?php
|
||||
namespace ProcessMaker\BusinessModel;
|
||||
use \G;
|
||||
use \Exception;
|
||||
use \Bootstrap;
|
||||
use G;
|
||||
use Exception;
|
||||
use Bootstrap;
|
||||
use SpoolRun;
|
||||
use ProcessMaker\Core\System;
|
||||
|
||||
class EmailServer
|
||||
{
|
||||
@@ -181,12 +183,12 @@ class EmailServer
|
||||
$sBodyPre->prepare();
|
||||
$sBodyPre->assign("server", $_SERVER["SERVER_NAME"]);
|
||||
$sBodyPre->assign("date", date("H:i:s"));
|
||||
$sBodyPre->assign("ver", \PmSystem::getVersion());
|
||||
$sBodyPre->assign("ver", System::getVersion());
|
||||
$sBodyPre->assign("engine", $engine);
|
||||
$sBodyPre->assign("msg", $msg);
|
||||
$sBody = $sBodyPre->getOutputContent();
|
||||
|
||||
$oSpool = new \spoolRun();
|
||||
$oSpool = new SpoolRun();
|
||||
|
||||
$oSpool->setConfig($aConfiguration);
|
||||
|
||||
@@ -316,7 +318,7 @@ class EmailServer
|
||||
$mailTo = $arrayData["MAIL_TO"];
|
||||
$smtpSecure = $arrayData["SMTPSECURE"];
|
||||
|
||||
$serverNet = new \NET($server);
|
||||
$serverNet = new \Net($server);
|
||||
$smtp = new \SMTP();
|
||||
|
||||
$timeout = 10;
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
<?php
|
||||
namespace ProcessMaker\BusinessModel;
|
||||
|
||||
use PmDynaform;
|
||||
|
||||
class InputDocument
|
||||
{
|
||||
private $arrayFieldDefinition = array(
|
||||
@@ -378,7 +380,7 @@ class InputDocument
|
||||
|
||||
$result = $inputDocument->update($arrayData);
|
||||
|
||||
$pmDynaform = new \pmDynaform();
|
||||
$pmDynaform = new PmDynaform();
|
||||
$pmDynaform->synchronizeInputDocument($processUid, $arrayData);
|
||||
|
||||
//Return
|
||||
|
||||
@@ -7,7 +7,9 @@ use Criteria;
|
||||
use UsersPeer;
|
||||
use AppDelegationPeer;
|
||||
use AppDelayPeer;
|
||||
use ProcessMaker\Core\System;
|
||||
use ProcessMaker\Util\DateTime;
|
||||
use PmLicenseManager;
|
||||
|
||||
class Light
|
||||
{
|
||||
@@ -524,7 +526,7 @@ class Light
|
||||
$delIndex = \AppDelegation::getCurrentIndex($applicationUid);
|
||||
}
|
||||
|
||||
$ws = new \wsBase();
|
||||
$ws = new \WsBase();
|
||||
$fields = $ws->derivateCase($userUid, $applicationUid, $delIndex, $bExecuteTriggersBeforeAssignment = false, $tasks);
|
||||
$array = json_decode(json_encode($fields), true);
|
||||
$array['message'] = trim(strip_tags($array['message']));
|
||||
@@ -779,7 +781,7 @@ class Light
|
||||
|
||||
/*----------------------------------********---------------------------------*/
|
||||
|
||||
$licenseManager =& \pmLicenseManager::getSingleton();
|
||||
$licenseManager =& PmLicenseManager::getSingleton();
|
||||
if (in_array(md5($licenseManager->result), array('38afd7ae34bd5e3e6fc170d8b09178a3', 'ba2b45bdc11e2a4a6e86aab2ac693cbb'))) {
|
||||
$G_PUBLISH = new \Publisher();
|
||||
$G_PUBLISH->AddContent('xmlform', 'xmlform', 'login/licenseExpired', '', array(), 'licenseUpdate');
|
||||
@@ -1259,7 +1261,7 @@ class Light
|
||||
$offset = timezone_offset_get( new \DateTimeZone( $tz ), new \DateTime() );
|
||||
$response['timeZone'] = sprintf( "GMT%s%02d:%02d", ( $offset >= 0 ) ? '+' : '-', abs( $offset / 3600 ), abs( ($offset % 3600) / 60 ) );
|
||||
$response['multiTimeZone'] = $multiTimeZone;
|
||||
$fields = \PmSystem::getSysInfo();
|
||||
$fields = System::getSysInfo();
|
||||
$response['version'] = $fields['PM_VERSION'];
|
||||
|
||||
$buildType = 'Community';
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace ProcessMaker\BusinessModel\Light;
|
||||
|
||||
use ProcessMaker\Core\System;
|
||||
use \ProcessMaker\Services\Api;
|
||||
use G;
|
||||
|
||||
@@ -11,7 +12,7 @@ class NotificationDevice
|
||||
|
||||
public function checkMobileNotifications()
|
||||
{
|
||||
$conf = \PmSystem::getSystemConfiguration('', '', SYS_SYS);
|
||||
$conf = System::getSystemConfiguration('', '', SYS_SYS);
|
||||
$activeNotifications = true;
|
||||
if (isset($conf['mobileNotifications'])) {
|
||||
$activeNotifications = $conf['mobileNotifications'] == 1 ? true : false;
|
||||
|
||||
@@ -13,6 +13,8 @@
|
||||
|
||||
namespace ProcessMaker\BusinessModel\Light;
|
||||
|
||||
use ProcessMaker\Core\System;
|
||||
|
||||
class PushMessageAndroid
|
||||
{
|
||||
private $url = 'https://android.googleapis.com/gcm/send';
|
||||
@@ -54,7 +56,7 @@ class PushMessageAndroid
|
||||
*/
|
||||
public function setSettingNotification()
|
||||
{
|
||||
$conf = \PmSystem::getSystemConfiguration(PATH_CONFIG . 'mobile.ini');
|
||||
$conf = System::getSystemConfiguration(PATH_CONFIG . 'mobile.ini');
|
||||
$this->setUrl($conf['android']['url']);
|
||||
$this->setKey($conf['android']['serverApiKey']);
|
||||
}
|
||||
|
||||
@@ -12,6 +12,8 @@
|
||||
|
||||
namespace ProcessMaker\BusinessModel\Light;
|
||||
|
||||
use ProcessMaker\Core\System;
|
||||
|
||||
class PushMessageIOS
|
||||
{
|
||||
private $url = 'ssl://gateway.sandbox.push.apple.com:2195';
|
||||
@@ -67,7 +69,7 @@ class PushMessageIOS
|
||||
*/
|
||||
public function setSettingNotification()
|
||||
{
|
||||
$conf = \PmSystem::getSystemConfiguration(PATH_CONFIG . 'mobile.ini');
|
||||
$conf = System::getSystemConfiguration(PATH_CONFIG . 'mobile.ini');
|
||||
$this->setUrl($conf['apple']['url']);
|
||||
$this->setKey($conf['apple']['passphrase']);
|
||||
$this->setPemFile($conf['apple']['pemFile']);
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace ProcessMaker\BusinessModel\Light;
|
||||
|
||||
use PmDynaform;
|
||||
|
||||
class Tracker
|
||||
{
|
||||
@@ -266,7 +267,7 @@ class Tracker
|
||||
$Fields["PRO_UID"] = $pro_uid;
|
||||
$Fields["CURRENT_DYNAFORM"] = $obj_uid;
|
||||
|
||||
$pmDynaForm = new \pmDynaform($Fields);
|
||||
$pmDynaForm = new PmDynaform($Fields);
|
||||
|
||||
// if ($pmDynaForm->isResponsive()) {
|
||||
// $pmDynaForm->printTracker();
|
||||
|
||||
@@ -368,7 +368,7 @@ class MessageApplication
|
||||
try {
|
||||
|
||||
//Set variables
|
||||
$ws = new \wsBase();
|
||||
$ws = new \WsBase();
|
||||
$case = new \Cases();
|
||||
$common = new \ProcessMaker\Util\Common();
|
||||
$sysSys = (defined("SYS_SYS"))? SYS_SYS : "Undefined";
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace ProcessMaker\BusinessModel\Migrator;
|
||||
|
||||
use ProcessMaker\Core\System;
|
||||
use ProcessMaker\Project;
|
||||
use ProcessMaker\Util\Common;
|
||||
|
||||
@@ -134,7 +135,7 @@ class GranularExporter
|
||||
$data["version"] = "3.1";
|
||||
$data["container"] = "ProcessMaker-Project";
|
||||
$data["metadata"] = array(
|
||||
"vendor_version" => \PmSystem::getVersion(),
|
||||
"vendor_version" => System::getVersion(),
|
||||
"vendor_version_code" => "Michelangelo",
|
||||
"export_timestamp" => date("U"),
|
||||
"export_datetime" => date("Y-m-d\TH:i:sP"),
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
<?php
|
||||
namespace ProcessMaker\BusinessModel;
|
||||
require_once (PATH_HOME . "engine" . PATH_SEP . "classes" . PATH_SEP . "model" . PATH_SEP . "Task.php");
|
||||
|
||||
use \G;
|
||||
use \Criteria;
|
||||
use \UsersPeer;
|
||||
use \GroupUserPeer;
|
||||
use \ResultSet;
|
||||
use ProcessMaker\Core\System;
|
||||
|
||||
/**
|
||||
* @copyright Colosa - Bolivia
|
||||
@@ -30,7 +30,7 @@ class Pmgmail {
|
||||
|
||||
//getting the skin
|
||||
require_once (PATH_HOME . "engine" . PATH_SEP . "classes" . PATH_SEP . "class.system.php");
|
||||
$sysConf = new \PmSystem();
|
||||
$sysConf = new System();
|
||||
$responseSysConfig = $sysConf->getSystemConfiguration( PATH_CONFIG . 'env.ini' );
|
||||
$response['enviroment'] = $responseSysConfig['default_skin'];
|
||||
|
||||
@@ -357,7 +357,7 @@ class Pmgmail {
|
||||
return false;
|
||||
}
|
||||
|
||||
$ws = new \wsBase();
|
||||
$ws = new \WsBase();
|
||||
$resultMail = $ws->sendMessage(
|
||||
$application['APP_UID'],
|
||||
$defaultEmail, //From,
|
||||
|
||||
@@ -1617,7 +1617,7 @@ class Process
|
||||
$triggerWizard->setFormatFieldNameInUppercase($this->formatFieldNameInUppercase);
|
||||
$triggerWizard->setArrayFieldNameForException($this->arrayFieldNameForException);
|
||||
|
||||
$triggerLibrary = \triggerLibrary::getSingleton();
|
||||
$triggerLibrary = \TriggerLibrary::getSingleton();
|
||||
$library = $triggerLibrary->getRegisteredClasses();
|
||||
|
||||
ksort($library);
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<?php
|
||||
namespace ProcessMaker\BusinessModel;
|
||||
|
||||
use PmSystem;
|
||||
use ProcessMaker\Core\System;
|
||||
use Exception;
|
||||
use G;
|
||||
|
||||
@@ -18,7 +18,7 @@ class Skins
|
||||
*/
|
||||
public function getSkins()
|
||||
{
|
||||
$list = PmSystem::getSkingList();
|
||||
$list = System::getSkingList();
|
||||
return $list['skins'];
|
||||
}
|
||||
|
||||
|
||||
@@ -1211,7 +1211,7 @@ class TimerEvent
|
||||
try {
|
||||
|
||||
//Set variables
|
||||
$ws = new \wsBase();
|
||||
$ws = new \WsBase();
|
||||
$case = new \Cases();
|
||||
$common = new \ProcessMaker\Util\Common();
|
||||
$sysSys = (defined("SYS_SYS"))? SYS_SYS : "Undefined";
|
||||
|
||||
@@ -38,7 +38,7 @@ class TriggerWizard
|
||||
|
||||
//Library
|
||||
|
||||
$this->library = \triggerLibrary::getSingleton();
|
||||
$this->library = \TriggerLibrary::getSingleton();
|
||||
} catch (\Exception $e) {
|
||||
throw $e;
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ namespace ProcessMaker\BusinessModel;
|
||||
use G;
|
||||
use Exception;
|
||||
use AdditionalTables;
|
||||
use PmDynaform;
|
||||
|
||||
class Variable
|
||||
{
|
||||
@@ -194,7 +195,7 @@ class Variable
|
||||
"VAR_ACCEPTED_VALUES" => $variable->getVarAcceptedValues()
|
||||
);
|
||||
|
||||
$pmDynaform = new \pmDynaform();
|
||||
$pmDynaform = new PmDynaform();
|
||||
$pmDynaform->synchronizeVariable($processUid, $newVariable, $oldVariable);
|
||||
} else {
|
||||
|
||||
@@ -236,7 +237,7 @@ class Variable
|
||||
$this->throwExceptionIfVariableIsAssociatedAditionalTable($variableUid);
|
||||
$variable = $this->getVariable($processUid, $variableUid);
|
||||
|
||||
$pmDynaform = new \pmDynaform();
|
||||
$pmDynaform = new PmDynaform();
|
||||
$isUsed = $pmDynaform->isUsed($processUid, $variable);
|
||||
if ($isUsed !== false) {
|
||||
$titleDynaform=$pmDynaform->getDynaformTitle($isUsed);
|
||||
@@ -783,7 +784,7 @@ class Variable
|
||||
//This value is required to be able to query the database.
|
||||
$_SESSION["PROCESS"] = $proUid;
|
||||
//The pmdynaform class is instantiated
|
||||
$pmDynaform = new \pmDynaform(array("APP_DATA" => $params));
|
||||
$pmDynaform = new PmDynaform(array("APP_DATA" => $params));
|
||||
|
||||
//Get control from dynaform.
|
||||
//The parameters: queryFilter, queryStart, queryLimit, are only necessary
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
<?php
|
||||
namespace ProcessMaker\BusinessModel;
|
||||
|
||||
use ProcessMaker\Core\System;
|
||||
|
||||
class WebEntry
|
||||
{
|
||||
private $arrayFieldDefinition = array(
|
||||
@@ -453,7 +455,7 @@ class WebEntry
|
||||
$template->assign("dynaform", empty($arrayDynaFormData) ? '' : $arrayDynaFormData["DYN_TITLE"]);
|
||||
$template->assign("timestamp", date("l jS \of F Y h:i:s A"));
|
||||
$template->assign("ws", $this->sysSys);
|
||||
$template->assign("version", \PmSystem::getVersion());
|
||||
$template->assign("version", System::getVersion());
|
||||
|
||||
$fileName = $pathDataPublicProcess . PATH_SEP . $weTitle . "Post.php";
|
||||
|
||||
|
||||
725
workflow/engine/src/ProcessMaker/Core/Installer.php
Normal file
725
workflow/engine/src/ProcessMaker/Core/Installer.php
Normal file
@@ -0,0 +1,725 @@
|
||||
<?php
|
||||
|
||||
namespace ProcessMaker\Core;
|
||||
|
||||
use AppCacheView;
|
||||
use Archive_Tar;
|
||||
use Configuration;
|
||||
use Exception;
|
||||
use G;
|
||||
|
||||
class Installer
|
||||
{
|
||||
|
||||
public $options = Array();
|
||||
public $result = Array();
|
||||
public $error = Array();
|
||||
public $report = Array();
|
||||
private $connection_database;
|
||||
|
||||
/**
|
||||
* construct of insert
|
||||
*
|
||||
* @param string $pPRO_UID
|
||||
* @return void
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* create_site
|
||||
*
|
||||
* @param array $config
|
||||
* @param boolean $confirmed
|
||||
* @return void
|
||||
*/
|
||||
public function create_site($config = Array(), $confirmed = false)
|
||||
{
|
||||
$this->options = G::array_concat(Array('isset' => false, 'password' => G::generate_password(15), 'path_data' => @PATH_DATA, 'path_compiled' => @PATH_C, 'name' => $config['name'], 'database' => Array(), 'admin' => Array('username' => 'admin', 'password' => 'admin'
|
||||
), 'advanced' => Array('ao_db_wf' => 'wf_' . $config['name'], 'ao_db_rb' => 'rb_' . $config['name'], 'ao_db_rp' => 'rp_' . $config['name'], 'ao_db_drop' => false
|
||||
)
|
||||
), $config);
|
||||
$a = @explode(SYSTEM_HASH, G::decrypt(HASH_INSTALLATION, SYSTEM_HASH));
|
||||
$this->options['database'] = G::array_concat(Array('username' => @$a[1], 'password' => @$a[2], 'hostname' => @$a[0]
|
||||
), $this->options['database']);
|
||||
return ($confirmed === true) ? $this->make_site() : $this->create_site_test();
|
||||
}
|
||||
|
||||
/**
|
||||
* isset_site
|
||||
*
|
||||
* @param string $name Default value "workflow"
|
||||
* @return string file_exists(PATH_DATA."sites/".$name);
|
||||
*/
|
||||
public static function isset_site($name = "workflow")
|
||||
{
|
||||
$pathSites = PATH_DATA . 'sites/' . '*';
|
||||
$directories = glob($pathSites, GLOB_ONLYDIR);
|
||||
foreach ($directories as $directory) {
|
||||
$site = basename($directory);
|
||||
if (strtolower($site) === strtolower($name)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* create_site_test
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
private function create_site_test()
|
||||
{
|
||||
$name = (preg_match('/^[\w]+$/i', trim($this->options['name']))) ? true : false;
|
||||
$result = Array('path_data' => $this->is_dir_writable($this->options['path_data']), 'path_compiled' => $this->is_dir_writable($this->options['path_compiled']), 'database' => $this->check_connection(), 'access_level' => $this->cc_status, 'isset' => ($this->options['isset'] == true) ? $this->isset_site($this->options['name']) : false, 'microtime' => microtime(), 'workspace' => $this->options['name'], 'name' => array('status' => $name, 'message' => ($name) ? 'PASSED' : 'Workspace name invalid'
|
||||
), 'admin' => array('username' => (preg_match('/^[\w@\.-]+$/i', trim($this->options['admin']['username']))) ? true : false, 'password' => ((trim($this->options['admin']['password']) == '') ? false : true)
|
||||
)
|
||||
);
|
||||
$result['name']['message'] = ($result['isset']) ? 'Workspace already exist' : $result['name']['message'];
|
||||
$result['name']['status'] = ($result['isset']) ? false : $result['name']['status'];
|
||||
//print_r($result);
|
||||
return Array('created' => G::var_compare(true,
|
||||
$result['path_data'],
|
||||
$result['database']['connection'],
|
||||
$result['name']['status'],
|
||||
$result['database']['version'],
|
||||
$result['database']['ao']['ao_db_wf']['status'],
|
||||
$result['admin']['username'],
|
||||
(($result['isset']) ? false : true),
|
||||
$result['admin']['password']),
|
||||
'result' => $result
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* make_site
|
||||
*
|
||||
* @return array $test
|
||||
*/
|
||||
private function make_site()
|
||||
{
|
||||
$test = $this->create_site_test();
|
||||
|
||||
if ($test["created"] == true || $this->options["advanced"]["ao_db_drop"] == true) {
|
||||
/* Check if the hostname is local (localhost or 127.0.0.1) */
|
||||
$islocal = (strcmp(substr($this->options['database']['hostname'], 0, strlen('localhost')), 'localhost') === 0) || (strcmp(substr($this->options['database']['hostname'], 0, strlen('127.0.0.1')), '127.0.0.1') === 0);
|
||||
|
||||
$this->wf_site_name = $wf = $this->options['advanced']['ao_db_wf'];
|
||||
$this->wf_user_db = isset($this->options['advanced']['ao_user_wf']) ? $this->options['advanced']['ao_user_wf'] : uniqid('wf_');
|
||||
|
||||
$this->rbac_site_name = $rb = $this->options['advanced']['ao_db_rb'];
|
||||
$this->report_site_name = $rp = $this->options['advanced']['ao_db_rp'];
|
||||
|
||||
$schema = "schema.sql";
|
||||
$values = "insert.sql";
|
||||
|
||||
if ($this->options['advanced']['ao_db_drop'] === true) {
|
||||
//Delete workspace directory if exists
|
||||
//Drop databases
|
||||
$this->run_query("DROP DATABASE IF EXISTS " . $wf, "Drop database $wf");
|
||||
}
|
||||
|
||||
$this->run_query("CREATE DATABASE IF NOT EXISTS " . $wf . " DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci", "Create database $wf");
|
||||
|
||||
if ($this->cc_status == 1) {
|
||||
$host = ($islocal) ? "localhost" : "%";
|
||||
$this->run_query("GRANT ALL PRIVILEGES ON `$wf`.* TO {$this->wf_user_db}@'$host' IDENTIFIED BY '{$this->options['password']}' WITH GRANT OPTION", "Grant privileges for user {$this->wf_user_db} on database $wf");
|
||||
}
|
||||
|
||||
/* Dump schema workflow && data */
|
||||
|
||||
$this->log("Import database schema:\n");
|
||||
$myPortA = explode(":", $this->options['database']['hostname']);
|
||||
if (count($myPortA) < 2) {
|
||||
$myPortA[1] = "3306";
|
||||
}
|
||||
$myPort = $myPortA[1];
|
||||
$this->options['database']['hostname'] = $myPortA[0];
|
||||
|
||||
mysql_select_db($wf, $this->connection_database);
|
||||
$pws = PATH_WORKFLOW_MYSQL_DATA . $schema;
|
||||
$qws = $this->query_sql_file(PATH_WORKFLOW_MYSQL_DATA . $schema, $this->connection_database);
|
||||
$this->log($qws, isset($qws['errors']));
|
||||
$qwv = $this->query_sql_file(PATH_WORKFLOW_MYSQL_DATA . $values, $this->connection_database);
|
||||
$this->log($qwv, isset($qwv['errors']));
|
||||
|
||||
$http = (G::is_https() == true) ? 'https' : 'http';
|
||||
$lang = defined('SYS_LANG') ? SYS_LANG : 'en';
|
||||
$host = $_SERVER['SERVER_NAME'] . ($_SERVER['SERVER_PORT'] != '80' ? ':' . $_SERVER['SERVER_PORT'] : '');
|
||||
$workspace = $this->options['name'];
|
||||
|
||||
$endpoint = sprintf(
|
||||
'%s://%s/sys%s/%s/%s/oauth2/grant',
|
||||
$http,
|
||||
$host,
|
||||
$workspace,
|
||||
$lang,
|
||||
SYS_SKIN
|
||||
);
|
||||
|
||||
// inserting the outh_client
|
||||
$query = ("INSERT INTO OAUTH_CLIENTS (CLIENT_ID,CLIENT_SECRET,CLIENT_NAME,CLIENT_DESCRIPTION,CLIENT_WEBSITE,REDIRECT_URI,USR_UID ) VALUES
|
||||
('x-pm-local-client','179ad45c6ce2cb97cf1029e212046e81','PM Web Designer','ProcessMaker Web Designer App','www.processmaker.com','" . $endpoint . "','00000000000000000000000000000001' )");
|
||||
$this->run_query($query);
|
||||
|
||||
/* Dump schema rbac && data */
|
||||
$pws = PATH_RBAC_MYSQL_DATA . $schema;
|
||||
mysql_select_db($rb, $this->connection_database);
|
||||
$qrs = $this->query_sql_file(PATH_RBAC_MYSQL_DATA . $schema, $this->connection_database);
|
||||
$this->log($qrs, isset($qrs['errors']));
|
||||
$qrv = $this->query_sql_file(PATH_RBAC_MYSQL_DATA . $values, $this->connection_database);
|
||||
$this->log($qrv, isset($qrv['errors']));
|
||||
|
||||
mysql_select_db($wf, $this->connection_database);
|
||||
|
||||
require_once("propel/Propel.php");
|
||||
require_once('classes/model/AppCacheView.php');
|
||||
|
||||
$appCache = new AppCacheView();
|
||||
$appCache->setPathToAppCacheFiles(PATH_METHODS . 'setup/setupSchemas/');
|
||||
$triggers = $appCache->getTriggers("en");
|
||||
$this->log("Create 'cases list cache' triggers");
|
||||
foreach ($triggers as $triggerName => $trigger) {
|
||||
$this->run_query($trigger, "-> Trigger $triggerName");
|
||||
}
|
||||
|
||||
$path_site = $this->options['path_data'] . "/sites/" . $this->options['name'] . "/";
|
||||
|
||||
@mkdir($path_site, 0777, true);
|
||||
@mkdir($path_site . "files/", 0777, true);
|
||||
@mkdir($path_site . "mailTemplates/", 0777, true);
|
||||
@mkdir($path_site . "public/", 0777, true);
|
||||
@mkdir($path_site . "reports/", 0777, true);
|
||||
@mkdir($path_site . "xmlForms", 0777, true);
|
||||
|
||||
//Generate the db.php file
|
||||
$db_file = $path_site . 'db.php';
|
||||
$db_text = "<?php\n" . "// Processmaker configuration\n" . "define ('DB_ADAPTER', 'mysql' );\n" . "define ('DB_HOST', '" . $this->options['database']['hostname'] . ":" . $myPort . "' );\n" . "define ('DB_NAME', '" . $wf . "' );\n" . "define ('DB_USER', '" . (($this->cc_status == 1) ? $this->wf_user_db : $this->options['database']['username']) . "' );\n" . "define ('DB_PASS', '" . (($this->cc_status == 1) ? $this->options['password'] : $this->options['database']['password']) . "' );\n" . "define ('DB_RBAC_HOST', '" . $this->options['database']['hostname'] . ":" . $myPort . "' );\n" . "define ('DB_RBAC_NAME', '" . $rb . "' );\n" . "define ('DB_RBAC_USER', '" . (($this->cc_status == 1) ? $this->wf_user_db : $this->options['database']['username']) . "' );\n" . "define ('DB_RBAC_PASS', '" . (($this->cc_status == 1) ? $this->options['password'] : $this->options['database']['password']) . "' );\n" . "define ('DB_REPORT_HOST', '" . $this->options['database']['hostname'] . ":" . $myPort . "' );\n" . "define ('DB_REPORT_NAME', '" . $rp . "' );\n" . "define ('DB_REPORT_USER', '" . (($this->cc_status == 1) ? $this->wf_user_db : $this->options['database']['username']) . "' );\n" . "define ('DB_REPORT_PASS', '" . (($this->cc_status == 1) ? $this->options['password'] : $this->options['database']['password']) . "' );\n";
|
||||
if (defined('PARTNER_FLAG') || isset($_REQUEST['PARTNER_FLAG'])) {
|
||||
$db_text .= "define ('PARTNER_FLAG', " . ((defined('PARTNER_FLAG') && PARTNER_FLAG != '') ? PARTNER_FLAG : ((isset($_REQUEST['PARTNER_FLAG'])) ? $_REQUEST['PARTNER_FLAG'] : 'false')) . ");\n";
|
||||
if (defined('SYSTEM_NAME')) {
|
||||
$db_text .= " define ('SYSTEM_NAME', '" . SYSTEM_NAME . "');\n";
|
||||
}
|
||||
}
|
||||
$db_text .= "?>";
|
||||
|
||||
$fp = @fopen($db_file, "w");
|
||||
$this->log("Create: " . $db_file . " => " . ((!$fp) ? $fp : "OK") . "\n", $fp === false);
|
||||
$ff = @fputs($fp, $db_text, strlen($db_text));
|
||||
$this->log("Write: " . $db_file . " => " . ((!$ff) ? $ff : "OK") . "\n", $ff === false);
|
||||
fclose($fp);
|
||||
|
||||
/*----------------------------------********---------------------------------*/
|
||||
//Generate the env.ini file
|
||||
$envIniFile = $path_site . 'env.ini';
|
||||
$content = 'system_utc_time_zone = 1' . "\n";
|
||||
|
||||
$fp = @fopen($envIniFile, 'w');
|
||||
$this->log('Create: ' . $envIniFile . ' => ' . ((!$fp) ? $fp : 'OK') . "\n", $fp === false);
|
||||
$ff = @fputs($fp, $content, strlen($content));
|
||||
$this->log('Write: ' . $envIniFile . ' => ' . ((!$ff) ? $ff : 'OK') . "\n", $ff === false);
|
||||
fclose($fp);
|
||||
/*----------------------------------********---------------------------------*/
|
||||
|
||||
//Set data
|
||||
$this->setPartner();
|
||||
$this->setAdmin();
|
||||
|
||||
$querySql = "INSERT INTO EMAIL_SERVER(MESS_UID, MESS_ENGINE) VALUES('" . \ProcessMaker\Util\Common::generateUID() . "', 'MAIL')";
|
||||
|
||||
$this->run_query($querySql);
|
||||
}
|
||||
return $test;
|
||||
}
|
||||
|
||||
/**
|
||||
* set_partner
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setPartner()
|
||||
{
|
||||
$partnerFlag = (defined('PARTNER_FLAG')) ? PARTNER_FLAG : false;
|
||||
if ($partnerFlag) {
|
||||
// Execute sql for partner
|
||||
$pathMysqlPartner = PATH_CORE . 'data' . PATH_SEP . 'partner' . PATH_SEP . 'mysql' . PATH_SEP;
|
||||
if (G::verifyPath($pathMysqlPartner)) {
|
||||
$res = array();
|
||||
$filesSlq = glob($pathMysqlPartner . '*.sql');
|
||||
foreach ($filesSlq as $value) {
|
||||
$this->query_sql_file($value, $this->connection_database);
|
||||
}
|
||||
}
|
||||
|
||||
// Execute to change of skin
|
||||
$pathSkinPartner = PATH_CORE . 'data' . PATH_SEP . 'partner' . PATH_SEP . 'skin' . PATH_SEP;
|
||||
if (G::verifyPath($pathSkinPartner)) {
|
||||
$res = array();
|
||||
$fileTar = glob($pathSkinPartner . '*.tar');
|
||||
foreach ($fileTar as $value) {
|
||||
$dataFile = pathinfo($value);
|
||||
$nameSkinTmp = $dataFile['filename'];
|
||||
|
||||
$tar = new Archive_Tar($value);
|
||||
|
||||
$pathSkinTmp = $pathSkinPartner . 'tmp' . PATH_SEP;
|
||||
G::rm_dir($pathSkinTmp);
|
||||
G::verifyPath($pathSkinTmp, true);
|
||||
chmod($pathSkinTmp, 0777);
|
||||
$tar->extract($pathSkinTmp);
|
||||
|
||||
$pathSkinName = $pathSkinTmp . $nameSkinTmp . PATH_SEP;
|
||||
chmod($pathSkinName, 0777);
|
||||
G::verifyPath(PATH_CORE . 'skinEngine' . PATH_SEP . 'tmp', true);
|
||||
$skinClassic = PATH_CORE . 'skinEngine' . PATH_SEP . 'tmp' . PATH_SEP;
|
||||
|
||||
if (is_dir($pathSkinName)) {
|
||||
$this->copyFile($pathSkinName, $skinClassic);
|
||||
}
|
||||
|
||||
G::rm_dir(PATH_CORE . 'skinEngine' . PATH_SEP . 'base');
|
||||
rename(PATH_CORE . 'skinEngine' . PATH_SEP . 'tmp', PATH_CORE . 'skinEngine' . PATH_SEP . 'base');
|
||||
G::rm_dir(PATH_CORE . 'skinEngine' . PATH_SEP . 'tmp');
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
//ACTIVE ENTERPRISE
|
||||
|
||||
ini_set('max_execution_time', '0');
|
||||
ini_set('memory_limit', '256M');
|
||||
|
||||
$serv = 'http://';
|
||||
if (isset($_SERVER['HTTPS']) && trim($_SERVER['HTTPS']) != '') {
|
||||
$serv = 'https://';
|
||||
}
|
||||
$serv .= $_SERVER['SERVER_NAME'];
|
||||
if (isset($_SERVER['SERVER_PORT']) && trim($_SERVER['SERVER_PORT']) != '') {
|
||||
$serv .= ':' . $_SERVER['SERVER_PORT'];
|
||||
}
|
||||
|
||||
// create session
|
||||
$cookiefile = sys_get_temp_dir() . PATH_SEP . 'curl-session';
|
||||
|
||||
$fp = fopen($cookiefile, "w");
|
||||
fclose($fp);
|
||||
chmod($cookiefile, 0777);
|
||||
|
||||
$user = urlencode($this->options['admin']['username']);
|
||||
$pass = urlencode($this->options['admin']['password']);
|
||||
$workspace = $this->options['name'];
|
||||
$lang = SYS_LANG;
|
||||
$skinName = SYS_SKIN;
|
||||
|
||||
$ch = curl_init();
|
||||
|
||||
// set URL and other appropriate options
|
||||
curl_setopt($ch, CURLOPT_URL, "$serv/sys{$workspace}/{$lang}/{$skinName}/login/authentication");
|
||||
curl_setopt($ch, CURLOPT_HEADER, 0);
|
||||
curl_setopt($ch, CURLOPT_COOKIEFILE, $cookiefile);
|
||||
curl_setopt($ch, CURLOPT_COOKIEJAR, $cookiefile);
|
||||
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, false);
|
||||
curl_setopt($ch, CURLOPT_POST, true);
|
||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
||||
curl_setopt($ch, CURLOPT_POSTFIELDS, "form[USR_USERNAME]=$user&form[USR_PASSWORD]=$pass&form[USER_LANG]=$lang");
|
||||
curl_setopt($ch, CURLOPT_TIMEOUT, 90);
|
||||
|
||||
$output = curl_exec($ch);
|
||||
curl_close($ch);
|
||||
|
||||
$ch = curl_init();
|
||||
$postData = array();
|
||||
// resolv the plugin name
|
||||
$plugins = glob(PATH_CORE . "plugins/*.tar");
|
||||
if (count($plugins) > 0) {
|
||||
$pluginName = $plugins[0];
|
||||
|
||||
// File to upload/post
|
||||
$postData['form[PLUGIN_FILENAME]'] = "@{$pluginName}";
|
||||
curl_setopt($ch, CURLOPT_URL, "$serv/sys{$workspace}/{$lang}/{$skinName}/setup/pluginsImportFile");
|
||||
curl_setopt($ch, CURLOPT_HEADER, 0);
|
||||
curl_setopt($ch, CURLOPT_VERBOSE, 0);
|
||||
curl_setopt($ch, CURLOPT_COOKIEFILE, $cookiefile);
|
||||
curl_setopt($ch, CURLOPT_COOKIEJAR, $cookiefile);
|
||||
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, false);
|
||||
curl_setopt($ch, CURLOPT_POST, true);
|
||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
||||
curl_setopt($ch, CURLOPT_POSTFIELDS, $postData);
|
||||
curl_setopt($ch, CURLOPT_TIMEOUT, 90);
|
||||
|
||||
$output = curl_exec($ch);
|
||||
curl_close($ch);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function copyFile($fromDir, $toDir, $chmod = 0777)
|
||||
{
|
||||
$errors = array();
|
||||
$messages = array();
|
||||
|
||||
if (!is_writable($toDir)) {
|
||||
$errors[] = 'target ' . $toDir . ' is not writable';
|
||||
}
|
||||
if (!is_dir($toDir)) {
|
||||
$errors[] = 'target ' . $toDir . ' is not a directory';
|
||||
}
|
||||
if (!is_dir($fromDir)) {
|
||||
$errors[] = 'source ' . $fromDir . ' is not a directory';
|
||||
}
|
||||
if (!empty($errors)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$exceptions = array('.', '..');
|
||||
$handle = opendir($fromDir);
|
||||
while (false !== ($item = readdir($handle))) {
|
||||
if (!in_array($item, $exceptions)) {
|
||||
$from = str_replace('//', '/', $fromDir . '/' . $item);
|
||||
$to = str_replace('//', '/', $toDir . '/' . $item);
|
||||
if (is_file($from)) {
|
||||
if (@copy($from, $to)) {
|
||||
chmod($to, $chmod);
|
||||
touch($to, filemtime($from));
|
||||
}
|
||||
}
|
||||
|
||||
if (is_dir($from)) {
|
||||
if (@mkdir($to)) {
|
||||
chmod($to, $chmod);
|
||||
}
|
||||
$this->copyFile($from, $to, $chmod);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
closedir($handle);
|
||||
}
|
||||
|
||||
/**
|
||||
* set_configuration
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setConfiguration()
|
||||
{
|
||||
$oConf = new Configuration();
|
||||
$dataCondif = $oConf->getAll();
|
||||
if (count($dataCondif)) {
|
||||
foreach ($dataCondif as $value) {
|
||||
if ($value['CFG_UID'] == 'ENVIRONMENT_SETTINGS') {
|
||||
$query = 'INSERT INTO CONFIGURATION (CFG_UID, OBJ_UID, CFG_VALUE, PRO_UID, USR_UID, APP_UID) VALUES';
|
||||
$query .= "('" .
|
||||
$value['CFG_UID'] . "', '" .
|
||||
$value['OBJ_UID'] . "', '" .
|
||||
$value['CFG_VALUE'] . "', '" .
|
||||
$value['PRO_UID'] . "', '" .
|
||||
$value['USR_UID'] . "', '" .
|
||||
$value['APP_UID'] . "')";
|
||||
mysql_select_db($this->wf_site_name, $this->connection_database);
|
||||
$this->run_query($query, "Copy configuracion environment");
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* set_admin
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setAdmin()
|
||||
{
|
||||
mysql_select_db($this->wf_site_name, $this->connection_database);
|
||||
// The mysql_escape_string function has been DEPRECATED as of PHP 5.3.0.
|
||||
// $this->run_query('UPDATE USERS SET USR_USERNAME = \''.mysql_escape_string($this->options['admin']['username']).'\', `USR_PASSWORD` = \''.md5($this->options['admin']['password']).'\' WHERE `USR_UID` = \'00000000000000000000000000000001\' LIMIT 1',
|
||||
// "Add 'admin' user in ProcessMaker (wf)");
|
||||
$this->run_query('UPDATE USERS SET USR_USERNAME = \'' . mysql_real_escape_string($this->options['admin']['username']) . '\', ' . ' `USR_PASSWORD` = \'' . G::encryptHash($this->options['admin']['password']) . '\' ' . ' WHERE `USR_UID` = \'00000000000000000000000000000001\' LIMIT 1', "Add 'admin' user in ProcessMaker (wf)");
|
||||
mysql_select_db($this->rbac_site_name, $this->connection_database);
|
||||
// The mysql_escape_string function has been DEPRECATED as of PHP 5.3.0.
|
||||
// $this->run_query('UPDATE USERS SET USR_USERNAME = \''.mysql_escape_string($this->options['admin']['username']).'\', `USR_PASSWORD` = \''.md5($this->options['admin']['password']).'\' WHERE `USR_UID` = \'00000000000000000000000000000001\' LIMIT 1',
|
||||
// "Add 'admin' user in ProcessMaker (rb)");
|
||||
$this->run_query('UPDATE RBAC_USERS SET USR_USERNAME = \'' . mysql_real_escape_string($this->options['admin']['username']) . '\', ' . ' `USR_PASSWORD` = \'' . G::encryptHash($this->options['admin']['password']) . '\' ' . ' WHERE `USR_UID` = \'00000000000000000000000000000001\' LIMIT 1', "Add 'admin' user in ProcessMaker (rb)");
|
||||
}
|
||||
|
||||
/**
|
||||
* Run a mysql query on the current database and take care of logging and
|
||||
* error handling.
|
||||
*
|
||||
* @param string $query SQL command
|
||||
* @param string $description Description to log instead of $query
|
||||
*/
|
||||
private function run_query($query, $description = null)
|
||||
{
|
||||
$result = @mysql_query($query, $this->connection_database);
|
||||
$error = ($result) ? false : mysql_error();
|
||||
$this->log(($description ? $description : $query) . " => " . (($error) ? $error : "OK") . "\n", $error);
|
||||
}
|
||||
|
||||
/**
|
||||
* query_sql_file
|
||||
*
|
||||
* @param string $file
|
||||
* @param string $connection
|
||||
* @return array $report
|
||||
*/
|
||||
public function query_sql_file($file, $connection)
|
||||
{
|
||||
$lines = file($file);
|
||||
$previous = null;
|
||||
$errors = '';
|
||||
@mysql_query("SET NAMES 'utf8';");
|
||||
foreach ($lines as $j => $line) {
|
||||
$line = trim($line); // Remove comments from the script
|
||||
|
||||
|
||||
if (strpos($line, "--") === 0) {
|
||||
$line = substr($line, 0, strpos($line, "--"));
|
||||
}
|
||||
|
||||
if (empty($line)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (strpos($line, "#") === 0) {
|
||||
$line = substr($line, 0, strpos($line, "#"));
|
||||
}
|
||||
|
||||
if (empty($line)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// Concatenate the previous line, if any, with the current
|
||||
if ($previous) {
|
||||
$line = $previous . " " . $line;
|
||||
}
|
||||
$previous = null;
|
||||
|
||||
// If the current line doesnt end with ; then put this line together
|
||||
// with the next one, thus supporting multi-line statements.
|
||||
if (strrpos($line, ";") != strlen($line) - 1) {
|
||||
$previous = $line;
|
||||
continue;
|
||||
}
|
||||
|
||||
$line = substr($line, 0, strrpos($line, ";"));
|
||||
@mysql_query($line, $connection);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* check_path
|
||||
*
|
||||
* @return void
|
||||
* @todo Empty function
|
||||
*/
|
||||
private function check_path()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* function find_root_path
|
||||
*
|
||||
* @param string $path
|
||||
* @return string $path
|
||||
*/
|
||||
private function find_root_path($path)
|
||||
{
|
||||
$i = 0; //prevent loop inifinity
|
||||
while (!is_dir($path) && ($path = dirname($path)) && ((strlen($path) > 1) && $i < 10)) {
|
||||
$i++;
|
||||
}
|
||||
return $path;
|
||||
}
|
||||
|
||||
/**
|
||||
* file_permisions
|
||||
*
|
||||
* @param string $file
|
||||
* @param integer $def default value 777
|
||||
* @return integer $def
|
||||
*/
|
||||
public function file_permisions($file, $def = 777)
|
||||
{
|
||||
if (PHP_OS == 'WINNT') {
|
||||
return $def;
|
||||
} else {
|
||||
return (int)substr(sprintf('%o', @fileperms($file)), -4);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* is_dir_writable
|
||||
*
|
||||
* @param string $dir default value empty
|
||||
* @return string $path
|
||||
*/
|
||||
public function is_dir_writable($dir = '')
|
||||
{
|
||||
if (PHP_OS == 'WINNT') {
|
||||
$dir = $this->find_root_path($dir);
|
||||
return file_exists($dir);
|
||||
} else {
|
||||
$dir = $this->find_root_path($dir);
|
||||
return (is_writable($dir) && is_readable($dir));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* getDirectoryFiles
|
||||
*
|
||||
* @param string $dir default value empty
|
||||
* @return string $path
|
||||
*/
|
||||
public function getDirectoryFiles($dir, $extension)
|
||||
{
|
||||
$filesArray = array();
|
||||
if (file_exists($dir)) {
|
||||
if ($handle = opendir($dir)) {
|
||||
while (false !== ($file = readdir($handle))) {
|
||||
$fileParts = explode(".", $file);
|
||||
if ($fileParts[count($fileParts) - 1] == $extension) {
|
||||
$filesArray[] = $file;
|
||||
}
|
||||
}
|
||||
closedir($handle);
|
||||
}
|
||||
}
|
||||
return $filesArray;
|
||||
}
|
||||
|
||||
/**
|
||||
* check_db_empty
|
||||
*
|
||||
* @param string $dbName
|
||||
* @return boolean true or false
|
||||
*/
|
||||
public function check_db_empty($dbName)
|
||||
{
|
||||
$a = @mysql_select_db($dbName, $this->connection_database);
|
||||
if (!$a) {
|
||||
return true;
|
||||
}
|
||||
$q = @mysql_query('SHOW TABLES', $this->connection_database);
|
||||
return (@mysql_num_rows($q) > 0) ? false : true;
|
||||
}
|
||||
|
||||
/**
|
||||
* check_db
|
||||
*
|
||||
* @param string $dbName
|
||||
* @return Array Array('status' => true or false,'message' => string)
|
||||
*/
|
||||
public function check_db($dbName)
|
||||
{
|
||||
if (!$this->connection_database) {
|
||||
//erik: new verification if the mysql extension is enabled
|
||||
$error = class_exists('mysql_error') ? mysql_error() : 'Mysql Module for PHP is not enabled!';
|
||||
return Array('status' => false, 'message' => $error
|
||||
);
|
||||
} else {
|
||||
if (!mysql_select_db($dbName, $this->connection_database) && $this->cc_status != 1) {
|
||||
return Array('status' => false, 'message' => mysql_error()
|
||||
);
|
||||
} else {
|
||||
/* var_dump($this->options['advanced']['ao_db_drop'],$this->cc_status,$this->check_db_empty($dbName));
|
||||
if(($this->options['advanced']['ao_db_drop']===false && $this->cc_status!=1 && !$this->check_db_empty($dbName)) )
|
||||
{
|
||||
return Array('status'=>false,'message'=>'Database is not empty');
|
||||
}
|
||||
else
|
||||
{
|
||||
return Array('status'=>true,'message'=>'OK');
|
||||
} */
|
||||
if ($this->options['advanced']['ao_db_drop'] === true || $this->check_db_empty($dbName)) {
|
||||
return Array('status' => true, 'message' => 'PASSED'
|
||||
);
|
||||
} else {
|
||||
return Array('status' => false, 'message' => 'Database is not empty'
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* check_connection
|
||||
*
|
||||
* @return Array $rt
|
||||
*/
|
||||
private function check_connection()
|
||||
{
|
||||
if (!function_exists("mysql_connect")) {
|
||||
$this->cc_status = 0;
|
||||
$rt = Array('connection' => false, 'grant' => 0, 'version' => false, 'message' => "ERROR: Mysql Module for PHP is not enabled, try install <b>php-mysql</b> package.", 'ao' => Array('ao_db_wf' => false, 'ao_db_rb' => false, 'ao_db_rp' => false
|
||||
)
|
||||
);
|
||||
} else {
|
||||
$this->connection_database = @mysql_connect($this->options['database']['hostname'], $this->options['database']['username'], $this->options['database']['password']);
|
||||
$rt = Array('version' => false, 'ao' => Array('ao_db_wf' => false, 'ao_db_rb' => false, 'ao_db_rp' => false
|
||||
)
|
||||
);
|
||||
if (!$this->connection_database) {
|
||||
$this->cc_status = 0;
|
||||
$rt['connection'] = false;
|
||||
$rt['grant'] = 0;
|
||||
$rt['message'] = "Mysql error: " . mysql_error();
|
||||
} else {
|
||||
preg_match('@[0-9]+\.[0-9]+\.[0-9]+@', mysql_get_server_info($this->connection_database), $version);
|
||||
$rt['version'] = version_compare(@$version[0], "4.1.0", ">=");
|
||||
$rt['connection'] = true;
|
||||
|
||||
$dbNameTest = "PROCESSMAKERTESTDC";
|
||||
$db = @mysql_query("CREATE DATABASE " . $dbNameTest, $this->connection_database);
|
||||
if (!$db) {
|
||||
$this->cc_status = 3;
|
||||
$rt['grant'] = 3;
|
||||
//$rt['message'] = "Db GRANTS error: ".mysql_error();
|
||||
$rt['message'] = "Successful connection";
|
||||
} else {
|
||||
|
||||
//@mysql_drop_db("processmaker_testGA");
|
||||
$usrTest = "wfrbtest";
|
||||
$chkG = "GRANT ALL PRIVILEGES ON `" . $dbNameTest . "`.* TO " . $usrTest . "@'%' IDENTIFIED BY 'sample' WITH GRANT OPTION";
|
||||
$ch = @mysql_query($chkG, $this->connection_database);
|
||||
if (!$ch) {
|
||||
$this->cc_status = 2;
|
||||
$rt['grant'] = 2;
|
||||
//$rt['message'] = "USER PRIVILEGES ERROR";
|
||||
$rt['message'] = "Successful connection";
|
||||
} else {
|
||||
$this->cc_status = 1;
|
||||
@mysql_query("DROP USER " . $usrTest . "@'%'", $this->connection_database);
|
||||
$rt['grant'] = 1;
|
||||
$rt['message'] = "Successful connection";
|
||||
}
|
||||
@mysql_query("DROP DATABASE " . $dbNameTest, $this->connection_database);
|
||||
}
|
||||
// var_dump($wf,$rb,$rp);
|
||||
}
|
||||
}
|
||||
$rt['ao']['ao_db_wf'] = $this->check_db($this->options['advanced']['ao_db_wf']);
|
||||
//$rt['ao']['ao_db_rb'] = $this->check_db($this->options['advanced']['ao_db_rb']);
|
||||
//$rt['ao']['ao_db_rp'] = $this->check_db($this->options['advanced']['ao_db_rp']);
|
||||
return $rt;
|
||||
}
|
||||
|
||||
/**
|
||||
* log
|
||||
*
|
||||
* @param string $text
|
||||
* @return void
|
||||
*/
|
||||
public function log($text, $failed = null)
|
||||
{
|
||||
array_push($this->report, $text);
|
||||
if ($failed) {
|
||||
throw new Exception(is_string($text) ? $text : var_export($text, true));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
1295
workflow/engine/src/ProcessMaker/Core/System.php
Normal file
1295
workflow/engine/src/ProcessMaker/Core/System.php
Normal file
File diff suppressed because it is too large
Load Diff
@@ -1,6 +1,7 @@
|
||||
<?php
|
||||
namespace ProcessMaker\Exporter;
|
||||
|
||||
use ProcessMaker\Core\System;
|
||||
use ProcessMaker\Project;
|
||||
use ProcessMaker\Util;
|
||||
|
||||
@@ -39,7 +40,7 @@ abstract class Exporter
|
||||
$this->projectData = $this->bpmnProject->getProject();
|
||||
|
||||
$this->metadata = array(
|
||||
"vendor_version" => \PmSystem::getVersion(),
|
||||
"vendor_version" => System::getVersion(),
|
||||
"vendor_version_code" => "Michelangelo",
|
||||
"export_timestamp" => date("U"),
|
||||
"export_datetime" => date("Y-m-d\TH:i:sP"),
|
||||
|
||||
@@ -11,7 +11,7 @@ use InputFilter;
|
||||
use Language;
|
||||
use PEAR;
|
||||
use PluginsRegistry;
|
||||
use PmSystem;
|
||||
use ProcessMaker\Core\System;
|
||||
use ProcessMaker\Plugins\Adapters\PluginAdapter;
|
||||
use ProcessMaker\Plugins\Interfaces\CaseSchedulerPlugin;
|
||||
use ProcessMaker\Plugins\Interfaces\CronFile;
|
||||
@@ -34,7 +34,6 @@ use ProcessMaker\Plugins\Traits\Attributes;
|
||||
use ProcessMaker\Plugins\Traits\PluginStructure;
|
||||
use Publisher;
|
||||
use stdClass;
|
||||
use System;
|
||||
|
||||
/**
|
||||
* Class PluginRegistry
|
||||
@@ -450,7 +449,7 @@ class PluginRegistry
|
||||
*/
|
||||
public function uninstallPluginWorkspaces($arrayPlugin)
|
||||
{
|
||||
$workspace = PmSystem::listWorkspaces();
|
||||
$workspace = System::listWorkspaces();
|
||||
|
||||
foreach ($workspace as $indexWS => $ws) {
|
||||
$pluginRegistry = PluginRegistry::loadSingleton();
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
<?php
|
||||
namespace ProcessMaker\Project;
|
||||
|
||||
use ProcessMaker\Core\System;
|
||||
use ProcessMaker\Util\Logger;
|
||||
|
||||
/**
|
||||
@@ -110,21 +111,21 @@ abstract class Handler
|
||||
*/
|
||||
public static function logstr($str)
|
||||
{
|
||||
if (\PmSystem::isDebugMode()) {
|
||||
if (System::isDebugMode()) {
|
||||
Logger::getInstance()->setLog($str);
|
||||
}
|
||||
}
|
||||
|
||||
public static function logInline()
|
||||
{
|
||||
if (\PmSystem::isDebugMode()) {
|
||||
if (System::isDebugMode()) {
|
||||
call_user_func_array(array(Logger::getInstance(), 'setLogInline'), func_get_args());
|
||||
}
|
||||
}
|
||||
|
||||
public static function log()
|
||||
{
|
||||
if (\PmSystem::isDebugMode()) {
|
||||
if (System::isDebugMode()) {
|
||||
$logger = Logger::getInstance();
|
||||
call_user_func_array(array($logger, 'setLogLine'), func_get_args());
|
||||
}
|
||||
|
||||
@@ -14,7 +14,7 @@ use \RoutePeer;
|
||||
use ProcessMaker\Util\Common;
|
||||
use ProcessMaker\Exception;
|
||||
use ProcessMaker\Util;
|
||||
|
||||
use ReportTables;
|
||||
/**
|
||||
* Class Workflow
|
||||
*
|
||||
@@ -594,7 +594,7 @@ class Workflow extends Handler
|
||||
$oSwimlaneElement = new \SwimlanesElements();
|
||||
$oConfiguration = new \Configuration();
|
||||
$oDbSource = new \DbSource();
|
||||
$oReportTable = new \ReportTables();
|
||||
$oReportTable = new ReportTables();
|
||||
$oCaseTracker = new \CaseTracker();
|
||||
$oCaseTrackerObject = new \CaseTrackerObject();
|
||||
|
||||
|
||||
@@ -2,12 +2,13 @@
|
||||
|
||||
namespace ProcessMaker\Services\Api;
|
||||
|
||||
use \G;
|
||||
use \ProcessMaker\Project\Adapter;
|
||||
use \ProcessMaker\Services\Api;
|
||||
use \Luracast\Restler\RestException;
|
||||
use \ProcessMaker\BusinessModel\Validator;
|
||||
use \ProcessMaker\Util\DateTime;
|
||||
use G;
|
||||
use ProcessMaker\Project\Adapter;
|
||||
use ProcessMaker\Services\Api;
|
||||
use Luracast\Restler\RestException;
|
||||
use ProcessMaker\BusinessModel\Validator;
|
||||
use ProcessMaker\Util\DateTime;
|
||||
use PmDynaform;
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -867,7 +868,7 @@ class Light extends Api
|
||||
$response = $process->getDynaForms($prj_uid);
|
||||
$result = $this->parserDataDynaForm($response);
|
||||
|
||||
$pmDynaForm = new \pmDynaform();
|
||||
$pmDynaForm = new PmDynaform();
|
||||
foreach ($result as $k => $form) {
|
||||
$result[$k]['formContent'] = (isset($form['formContent']) && $form['formContent'] != null)?json_decode($form['formContent']):"";
|
||||
$pmDynaForm->jsonr($result[$k]['formContent']);
|
||||
@@ -1009,7 +1010,7 @@ class Light extends Api
|
||||
$caseVariables = DateTime::convertUtcToTimeZone($caseVariables);
|
||||
}
|
||||
|
||||
$pmDynaform = new \pmDynaform(array("APP_DATA" => $caseVariables, "CURRENT_DYNAFORM" => $dyn_uid));
|
||||
$pmDynaform = new PmDynaform(array("APP_DATA" => $caseVariables, "CURRENT_DYNAFORM" => $dyn_uid));
|
||||
$pmDynaform->jsonr($result['formContent']);
|
||||
return $result;
|
||||
} catch (\Exception $e) {
|
||||
@@ -1033,7 +1034,7 @@ class Light extends Api
|
||||
$result = $this->parserDataDynaForm($response);
|
||||
$result['formContent'] = (isset($result['formContent']) && $result['formContent'] != null) ? \G::json_decode($result['formContent']) : "";
|
||||
|
||||
$pmDynaForm = new \pmDynaform(["CURRENT_DYNAFORM" => $dyn_uid]);
|
||||
$pmDynaForm = new PmDynaform(["CURRENT_DYNAFORM" => $dyn_uid]);
|
||||
$pmDynaForm->jsonr($result['formContent']);
|
||||
return $result;
|
||||
} catch (\Exception $e) {
|
||||
@@ -1057,7 +1058,7 @@ class Light extends Api
|
||||
$return = array();
|
||||
foreach ($request_data['formId'] as $dyn_uid) {
|
||||
$response = $dynaForm->getDynaForm($dyn_uid);
|
||||
$pmDynaForm = new \pmDynaform(array("CURRENT_DYNAFORM" => $dyn_uid));
|
||||
$pmDynaForm = new PmDynaform(array("CURRENT_DYNAFORM" => $dyn_uid));
|
||||
$result = $this->parserDataDynaForm($response);
|
||||
$result['formContent'] = (isset($result['formContent']) && $result['formContent'] != null)?json_decode($result['formContent']):"";
|
||||
$pmDynaForm->jsonr($result['formContent']);
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
<?php
|
||||
namespace ProcessMaker\Services\Api\Project;
|
||||
|
||||
use \ProcessMaker\Services\Api;
|
||||
use \Luracast\Restler\RestException;
|
||||
use \ProcessMaker\Util\DateTime;
|
||||
use ProcessMaker\Services\Api;
|
||||
use Luracast\Restler\RestException;
|
||||
use ProcessMaker\Util\DateTime;
|
||||
use PmDynaform;
|
||||
|
||||
/**
|
||||
* Project\DynaForm Api Controller
|
||||
@@ -128,7 +129,7 @@ class DynaForm extends Api
|
||||
{
|
||||
try {
|
||||
|
||||
$pmDynaform = new \pmDynaform();
|
||||
$pmDynaform = new PmDynaform();
|
||||
return $pmDynaform->downloadLanguage($dyn_uid, $lang);
|
||||
} catch (\Exception $e) {
|
||||
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
||||
@@ -145,7 +146,7 @@ class DynaForm extends Api
|
||||
{
|
||||
try {
|
||||
|
||||
$pmDynaform = new \pmDynaform();
|
||||
$pmDynaform = new PmDynaform();
|
||||
$pmDynaform->uploadLanguage($dyn_uid);
|
||||
} catch (\Exception $e) {
|
||||
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
||||
@@ -162,7 +163,7 @@ class DynaForm extends Api
|
||||
{
|
||||
try {
|
||||
|
||||
$pmDynaform = new \pmDynaform();
|
||||
$pmDynaform = new PmDynaform();
|
||||
$pmDynaform->deleteLanguage($dyn_uid, $lang);
|
||||
} catch (\Exception $e) {
|
||||
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
||||
@@ -179,7 +180,7 @@ class DynaForm extends Api
|
||||
{
|
||||
try {
|
||||
|
||||
$pmDynaform = new \pmDynaform();
|
||||
$pmDynaform = new PmDynaform();
|
||||
return $pmDynaform->listLanguage($dyn_uid);
|
||||
} catch (\Exception $e) {
|
||||
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
||||
|
||||
@@ -3,15 +3,8 @@ namespace ProcessMaker\Services\OAuth2;
|
||||
|
||||
use Luracast\Restler\iAuthenticate;
|
||||
use Luracast\Restler\RestException;
|
||||
use ProcessMaker\Core\System;
|
||||
|
||||
|
||||
/**
|
||||
* Class Server
|
||||
*
|
||||
* @package OAuth2
|
||||
* @author Erik Amaru Ortiz <aortiz.erik at gmail dot com>
|
||||
*
|
||||
*/
|
||||
class Server implements iAuthenticate
|
||||
{
|
||||
/**
|
||||
@@ -371,7 +364,7 @@ class Server implements iAuthenticate
|
||||
$userTimeZone = $user->getUsrTimeZone();
|
||||
|
||||
if (trim($userTimeZone) == '') {
|
||||
$arraySystemConfiguration = \PmSystem::getSystemConfiguration('', '', SYS_SYS);
|
||||
$arraySystemConfiguration = System::getSystemConfiguration('', '', SYS_SYS);
|
||||
|
||||
$userTimeZone = $arraySystemConfiguration['time_zone'];
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@ use Bootstrap;
|
||||
use Exception;
|
||||
use Maveriks\Util\ClassLoader;
|
||||
use PMPlugin;
|
||||
use Processmaker\Core\System AS PmSystem;
|
||||
use ProcessMaker\Plugins\Interfaces\PluginDetail;
|
||||
use ProcessMaker\Plugins\PluginRegistry;
|
||||
use ProcessMaker\Services\OAuth2\PmPdo;
|
||||
@@ -26,7 +27,7 @@ class System
|
||||
public static function getTimeZone()
|
||||
{
|
||||
try {
|
||||
$arraySystemConfiguration = \PmSystem::getSystemConfiguration('', '', SYS_SYS);
|
||||
$arraySystemConfiguration = PmSystem::getSystemConfiguration('', '', SYS_SYS);
|
||||
|
||||
//Return
|
||||
return $arraySystemConfiguration['time_zone'];
|
||||
@@ -47,10 +48,10 @@ class System
|
||||
{
|
||||
$workspaces = array();
|
||||
foreach ($args as $arg) {
|
||||
$workspaces[] = new \workspaceTools($arg);
|
||||
$workspaces[] = new \WorkspaceTools($arg);
|
||||
}
|
||||
if (empty($workspaces) && $includeAll) {
|
||||
$workspaces = \System::listWorkspaces();
|
||||
$workspaces = PmSystem::listWorkspaces();
|
||||
}
|
||||
return $workspaces;
|
||||
}
|
||||
|
||||
84
workflow/engine/src/ProcessMaker/Util/helpers.php
Normal file
84
workflow/engine/src/ProcessMaker/Util/helpers.php
Normal file
@@ -0,0 +1,84 @@
|
||||
<?php
|
||||
/**
|
||||
* We will send a case note in the actions by email
|
||||
* @param object $httpData
|
||||
* @return void
|
||||
*/
|
||||
function postNote($httpData)
|
||||
{
|
||||
$appUid = (isset($httpData->appUid)) ? $httpData->appUid : '';
|
||||
$usrUid = (isset($httpData->usrUid)) ? $httpData->usrUid : '';
|
||||
$appNotes = new AppNotes();
|
||||
$noteContent = addslashes($httpData->noteText);
|
||||
$result = $appNotes->postNewNote($appUid, $usrUid, $noteContent, false);
|
||||
|
||||
//send the response to client
|
||||
@ini_set('implicit_flush', 1);
|
||||
ob_start();
|
||||
@ob_flush();
|
||||
@flush();
|
||||
@ob_end_flush();
|
||||
ob_implicit_flush(1);
|
||||
|
||||
//send notification in background
|
||||
$noteRecipientsList = array();
|
||||
$oCase = new Cases();
|
||||
$p = $oCase->getUsersParticipatedInCase($appUid);
|
||||
foreach ($p['array'] as $key => $userParticipated) {
|
||||
$noteRecipientsList[] = $key;
|
||||
}
|
||||
|
||||
$noteRecipients = implode(",", $noteRecipientsList);
|
||||
$appNotes->sendNoteNotification($appUid, $usrUid, $noteContent, $noteRecipients);
|
||||
}
|
||||
|
||||
/**
|
||||
* We will get to the abeRequest data from actions by email
|
||||
* @param string $AbeRequestsUid
|
||||
* @return array $abeRequests
|
||||
*/
|
||||
function loadAbeRequest($AbeRequestsUid)
|
||||
{
|
||||
$criteria = new Criteria();
|
||||
$criteria->add(AbeRequestsPeer::ABE_REQ_UID, $AbeRequestsUid);
|
||||
$resultRequests = AbeRequestsPeer::doSelectRS($criteria);
|
||||
$resultRequests->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||
$resultRequests->next();
|
||||
$abeRequests = $resultRequests->getRow();
|
||||
|
||||
return $abeRequests;
|
||||
}
|
||||
|
||||
/**
|
||||
* We will get the AbeConfiguration by actions by email
|
||||
* @param string $AbeConfigurationUid
|
||||
* @return array $abeConfiguration
|
||||
*/
|
||||
function loadAbeConfiguration($AbeConfigurationUid)
|
||||
{
|
||||
$criteria = new Criteria();
|
||||
$criteria->add(AbeConfigurationPeer::ABE_UID, $AbeConfigurationUid);
|
||||
$result = AbeConfigurationPeer::doSelectRS($criteria);
|
||||
$result->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||
$result->next();
|
||||
$abeConfiguration = $result->getRow();
|
||||
|
||||
return $abeConfiguration;
|
||||
}
|
||||
|
||||
/**
|
||||
* We will update the request by actions by email
|
||||
* @param array $data
|
||||
* @return void
|
||||
* @throws Exception
|
||||
*/
|
||||
function uploadAbeRequest($data)
|
||||
{
|
||||
try {
|
||||
$abeRequestsInstance = new AbeRequests();
|
||||
$abeRequestsInstance->createOrUpdate($data);
|
||||
} catch (Exception $error) {
|
||||
throw $error;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user