public function __construct($applicationPath = null) { if (is_null($applicationPath)) { $applicationPath = realpath($_SERVER["DOCUMENT_ROOT"] . '/../app'); } $this->applicationPath = $applicationPath; $this->configuration = Configuration::create($this->applicationPath); }
function CreateConfiguration($data, $fields) { try { $Configuration = new Configuration(); $result = $Configuration->create($fields); $this->domain->addDomainValue('CREATED_UID', $Configuration->getCfgUid()); $this->domain->addDomainValue('CREATED_OBJ', $Configuration->getObjUid()); $this->domain->addDomainValue('CREATED_PRO', $Configuration->getProUid()); $this->domain->addDomainValue('CREATED_USR', $Configuration->getUsrUid()); return $result; } catch (Exception $e) { return array('Exception!! ' => $e->getMessage()); } }
public function sendNoteNotification($appUid, $usrUid, $noteContent, $noteRecipients, $sFrom = "") { try { require_once 'classes/model/Configuration.php'; $oConfiguration = new Configuration(); $sDelimiter = DBAdapter::getStringDelimiter(); $oCriteria = new Criteria('workflow'); $oCriteria->add(ConfigurationPeer::CFG_UID, 'Emails'); $oCriteria->add(ConfigurationPeer::OBJ_UID, ''); $oCriteria->add(ConfigurationPeer::PRO_UID, ''); $oCriteria->add(ConfigurationPeer::USR_UID, ''); $oCriteria->add(ConfigurationPeer::APP_UID, ''); if (ConfigurationPeer::doCount($oCriteria) == 0) { $oConfiguration->create(array('CFG_UID' => 'Emails', 'OBJ_UID' => '', 'CFG_VALUE' => '', 'PRO_UID' => '', 'USR_UID' => '', 'APP_UID' => '')); $aConfiguration = array(); } else { $aConfiguration = $oConfiguration->load('Emails', '', '', '', ''); if ($aConfiguration['CFG_VALUE'] != '') { $aConfiguration = unserialize($aConfiguration['CFG_VALUE']); $passwd = $aConfiguration['MESS_PASSWORD']; $passwdDec = G::decrypt($passwd, 'EMAILENCRYPT'); $auxPass = explode('hash:', $passwdDec); if (count($auxPass) > 1) { if (count($auxPass) == 2) { $passwd = $auxPass[1]; } else { array_shift($auxPass); $passwd = implode('', $auxPass); } } $aConfiguration['MESS_PASSWORD'] = $passwd; } else { $aConfiguration = array(); } } if (!isset($aConfiguration['MESS_ENABLED']) || $aConfiguration['MESS_ENABLED'] != '1') { return false; } $oUser = new Users(); $aUser = $oUser->load($usrUid); $authorName = ($aUser['USR_FIRSTNAME'] != '' || $aUser['USR_LASTNAME'] != '' ? $aUser['USR_FIRSTNAME'] . ' ' . $aUser['USR_LASTNAME'] . ' ' : '') . '<' . $aUser['USR_EMAIL'] . '>'; G::LoadClass('case'); $oCase = new Cases(); $aFields = $oCase->loadCase($appUid); $configNoteNotification['subject'] = G::LoadTranslation('ID_MESSAGE_SUBJECT_NOTE_NOTIFICATION') . " @#APP_TITLE "; $configNoteNotification['body'] = G::LoadTranslation('ID_CASE') . ": @#APP_TITLE<br />" . G::LoadTranslation('ID_AUTHOR') . ": {$authorName}<br /><br />{$noteContent}"; /* if ($sFrom == '') { $sFrom = '"ProcessMaker"'; } */ if (isset($aConfiguration['MESS_FROM_NAME']) && $aConfiguration['MESS_FROM_NAME'] != '') { $sFrom = $aConfiguration['MESS_FROM_NAME']; } $hasEmailFrom = preg_match('/(.+)@(.+)\\.(.+)/', $sFrom, $match); if (!$hasEmailFrom || strpos($sFrom, $aConfiguration['MESS_ACCOUNT']) === false) { if ($aConfiguration['MESS_ENGINE'] != 'MAIL' && $aConfiguration['MESS_ACCOUNT'] != '') { $sFrom .= ' <' . $aConfiguration['MESS_ACCOUNT'] . '>'; } else { if ($aConfiguration['MESS_ENGINE'] == 'MAIL') { $sFrom .= ' <info@' . gethostbyaddr('127.0.0.1') . '>'; } else { if ($aConfiguration['MESS_SERVER'] != '') { if ($sAux = @gethostbyaddr($aConfiguration['MESS_SERVER'])) { $sFrom .= ' <info@' . $sAux . '>'; } else { $sFrom .= ' <info@' . $aConfiguration['MESS_SERVER'] . '>'; } } else { $sFrom .= ' <*****@*****.**>'; } } } } $sSubject = G::replaceDataField($configNoteNotification['subject'], $aFields); $sBody = nl2br(G::replaceDataField($configNoteNotification['body'], $aFields)); G::LoadClass('spool'); $oUser = new Users(); $recipientsArray = explode(",", $noteRecipients); foreach ($recipientsArray as $recipientUid) { $aUser = $oUser->load($recipientUid); $sTo = ($aUser['USR_FIRSTNAME'] != '' || $aUser['USR_LASTNAME'] != '' ? $aUser['USR_FIRSTNAME'] . ' ' . $aUser['USR_LASTNAME'] . ' ' : '') . '<' . $aUser['USR_EMAIL'] . '>'; $oSpool = new spoolRun(); if ($aConfiguration['MESS_RAUTH'] == false || is_string($aConfiguration['MESS_RAUTH']) && $aConfiguration['MESS_RAUTH'] == 'false') { $aConfiguration['MESS_RAUTH'] = 0; } else { $aConfiguration['MESS_RAUTH'] = 1; } $oSpool->setConfig(array('MESS_ENGINE' => $aConfiguration['MESS_ENGINE'], 'MESS_SERVER' => $aConfiguration['MESS_SERVER'], 'MESS_PORT' => $aConfiguration['MESS_PORT'], 'MESS_ACCOUNT' => $aConfiguration['MESS_ACCOUNT'], 'MESS_PASSWORD' => $aConfiguration['MESS_PASSWORD'], 'SMTPAuth' => $aConfiguration['MESS_RAUTH'] == '1' ? true : false, 'SMTPSecure' => isset($aConfiguration['SMTPSecure']) ? $aConfiguration['SMTPSecure'] : '')); $oSpool->create(array('msg_uid' => '', 'app_uid' => $appUid, 'del_index' => 0, 'app_msg_type' => 'DERIVATION', 'app_msg_subject' => $sSubject, 'app_msg_from' => $sFrom, 'app_msg_to' => $sTo, 'app_msg_body' => $sBody, 'app_msg_cc' => '', 'app_msg_bcc' => '', 'app_msg_attach' => '', 'app_msg_template' => '', 'app_msg_status' => 'pending')); if ($aConfiguration['MESS_BACKGROUND'] == '' || $aConfiguration['MESS_TRY_SEND_INMEDIATLY'] == '1') { $oSpool->sendMail(); } } //Send derivation notification - End } catch (Exception $oException) { throw $oException; } }
$criteria->add(ConfigurationPeer::CFG_UID, "EE"); $criteria->add(ConfigurationPeer::OBJ_UID, $confEeUid); $rsCriteria = ConfigurationPeer::doSelectRS($criteria); if ($rsCriteria->next()) { $row = $rsCriteria->getRow(); $data = unserialize($row[0]); $data["internetConnection"] = $swInternetConnection; //Update values $criteria1 = new Criteria("workflow"); $criteria1->add(ConfigurationPeer::CFG_UID, "EE"); $criteria1->add(ConfigurationPeer::OBJ_UID, $confEeUid); //Update set $criteria2 = new Criteria("workflow"); $criteria2->add(ConfigurationPeer::CFG_VALUE, serialize($data)); BasePeer::doUpdate($criteria1, $criteria2, Propel::getConnection("workflow")); } else { $conf = new Configuration(); $data = array("internetConnection" => $swInternetConnection); $conf->create(array("CFG_UID" => "EE", "OBJ_UID" => $confEeUid, "CFG_VALUE" => serialize($data), "PRO_UID" => "", "USR_UID" => "", "APP_UID" => "")); } $response["status"] = "OK"; } catch (Exception $e) { $response["message"] = $e->getMessage(); $status = 0; } if ($status == 0) { $response["status"] = "ERROR"; } break; } echo G::json_encode($response);
/** * This function checks if List tables are going to migrated * * return boolean value */ public function listFirstExecution ($action){ $this->initPropel(true); switch ($action) { case 'insert': $conf = new Configuration(); if (!($conf->exists('MIGRATED_LIST', 'list', 'list', 'list', 'list'))) { $data["CFG_UID"] ='MIGRATED_LIST'; $data["OBJ_UID"] ='list'; $data["CFG_VALUE"]='true'; $data["PRO_UID"] ='list'; $data["USR_UID"] ='list'; $data["APP_UID"] ='list'; $conf->create($data); } return true; break; case 'check': $criteria = new Criteria("workflow"); $criteria->addSelectColumn(ConfigurationPeer::CFG_UID); $criteria->add(ConfigurationPeer::CFG_UID, "MIGRATED_LIST", CRITERIA::EQUAL); $rsCriteria = AppCacheViewPeer::doSelectRS($criteria); $rsCriteria->setFetchmode(ResultSet::FETCHMODE_ASSOC); $aRows = array (); while ($rsCriteria->next()) { $aRows[] = $rsCriteria->getRow(); } if(empty($aRows)){ return false; //If is false continue with the migrated } else { return true; //Stop } break; default: return true; } }
public function sendNotifications($sCurrentTask, $aTasks, $aFields, $sApplicationUID, $iDelegation, $sFrom = "") { try { $applicationData = $this->loadCase($sApplicationUID); $aFields["APP_NUMBER"] = $applicationData["APP_NUMBER"]; $oConfiguration = new Configuration(); $sDelimiter = DBAdapter::getStringDelimiter(); $oCriteria = new Criteria('workflow'); $oCriteria->add(ConfigurationPeer::CFG_UID, 'Emails'); $oCriteria->add(ConfigurationPeer::OBJ_UID, ''); $oCriteria->add(ConfigurationPeer::PRO_UID, ''); $oCriteria->add(ConfigurationPeer::USR_UID, ''); $oCriteria->add(ConfigurationPeer::APP_UID, ''); if (ConfigurationPeer::doCount($oCriteria) == 0) { $oConfiguration->create(array('CFG_UID' => 'Emails', 'OBJ_UID' => '', 'CFG_VALUE' => '', 'PRO_UID' => '', 'USR_UID' => '', 'APP_UID' => '')); $aConfiguration = array(); } else { $aConfiguration = $oConfiguration->load('Emails', '', '', '', ''); if ($aConfiguration['CFG_VALUE'] != '') { $aConfiguration = unserialize($aConfiguration["CFG_VALUE"]); $passwd = $aConfiguration["MESS_PASSWORD"]; $passwdDec = G::decrypt($passwd, "EMAILENCRYPT"); $auxPass = explode('hash:', $passwdDec); if (count($auxPass) > 1) { if (count($auxPass) == 2) { $passwd = $auxPass[1]; } else { array_shift($auxPass); $passwd = implode('', $auxPass); } } $aConfiguration["MESS_PASSWORD"] = $passwd; } else { $aConfiguration = array(); } } if (!isset($aConfiguration['MESS_ENABLED']) || $aConfiguration['MESS_ENABLED'] != '1') { return false; } //Send derivation notification - Start $oTask = new Task(); $aTaskInfo = $oTask->load($sCurrentTask); if ($aTaskInfo['TAS_SEND_LAST_EMAIL'] != 'TRUE') { return false; } if ($sFrom == '') { $sFrom = '"ProcessMaker"'; } $hasEmailFrom = preg_match('/(.+)@(.+)\\.(.+)/', $sFrom, $match); if (!$hasEmailFrom || strpos($sFrom, $aConfiguration['MESS_ACCOUNT']) === false) { if ($aConfiguration['MESS_ENGINE'] != 'MAIL' && $aConfiguration['MESS_ACCOUNT'] != '') { $sFrom .= ' <' . $aConfiguration['MESS_ACCOUNT'] . '>'; } else { if ($aConfiguration['MESS_ENGINE'] == 'MAIL') { $sFrom .= ' <info@' . gethostbyaddr('127.0.0.1') . '>'; } else { if ($aConfiguration['MESS_SERVER'] != '') { if ($sAux = @gethostbyaddr($aConfiguration['MESS_SERVER'])) { $sFrom .= ' <info@' . $sAux . '>'; } else { $sFrom .= ' <info@' . $aConfiguration['MESS_SERVER'] . '>'; } } else { $sFrom .= ' <*****@*****.**>'; } } } } if (isset($aTaskInfo['TAS_DEF_SUBJECT_MESSAGE']) && $aTaskInfo['TAS_DEF_SUBJECT_MESSAGE'] != '') { $sSubject = G::replaceDataField($aTaskInfo['TAS_DEF_SUBJECT_MESSAGE'], $aFields); } else { $sSubject = G::LoadTranslation('ID_MESSAGE_SUBJECT_DERIVATION'); } //erik: new behaviour for messages G::loadClass('configuration'); $oConf = new Configurations(); $oConf->loadConfig($x, 'TAS_EXTRA_PROPERTIES', $aTaskInfo['TAS_UID'], '', ''); $conf = $oConf->aConfig; $pathEmail = PATH_DATA_SITE . "mailTemplates" . PATH_SEP . $aTaskInfo["PRO_UID"] . PATH_SEP; $swtplDefault = 0; $sBody = null; if (isset($conf["TAS_DEF_MESSAGE_TYPE"]) && isset($conf["TAS_DEF_MESSAGE_TEMPLATE"]) && $conf["TAS_DEF_MESSAGE_TYPE"] == "template" && $conf["TAS_DEF_MESSAGE_TEMPLATE"] != "") { if ($conf["TAS_DEF_MESSAGE_TEMPLATE"] == "alert_message.html") { $swtplDefault = 1; } $fileTemplate = $pathEmail . $conf["TAS_DEF_MESSAGE_TEMPLATE"]; if (!file_exists($fileTemplate)) { throw new Exception("Template file \"{$fileTemplate}\" does not exist."); } $sBody = G::replaceDataGridField(file_get_contents($fileTemplate), $aFields); } else { $sBody = nl2br(G::replaceDataGridField($aTaskInfo["TAS_DEF_MESSAGE"], $aFields)); } G::LoadClass("tasks"); G::LoadClass("groups"); G::LoadClass("spool"); $task = new Tasks(); $group = new Groups(); $oUser = new Users(); foreach ($aTasks as $aTask) { $sTo = null; $sCc = null; switch ($aTask["TAS_ASSIGN_TYPE"]) { case "SELF_SERVICE": if ($swtplDefault == 1) { G::verifyPath($pathEmail, true); //Create if it does not exist $fileTemplate = $pathEmail . "unassignedMessage.html"; if (!file_exists($fileTemplate)) { @copy(PATH_TPL . "mails" . PATH_SEP . "unassignedMessage.html", $fileTemplate); } $sBody = G::replaceDataField(file_get_contents($fileTemplate), $aFields); } if (isset($aTask["TAS_UID"]) && !empty($aTask["TAS_UID"])) { $arrayTaskUser = array(); $arrayAux1 = $task->getGroupsOfTask($aTask["TAS_UID"], 1); foreach ($arrayAux1 as $arrayGroup) { $arrayAux2 = $group->getUsersOfGroup($arrayGroup["GRP_UID"]); foreach ($arrayAux2 as $arrayUser) { $arrayTaskUser[] = $arrayUser["USR_UID"]; } } $arrayAux1 = $task->getUsersOfTask($aTask["TAS_UID"], 1); foreach ($arrayAux1 as $arrayUser) { $arrayTaskUser[] = $arrayUser["USR_UID"]; } $criteria = new Criteria("workflow"); $criteria->addSelectColumn(UsersPeer::USR_UID); $criteria->addSelectColumn(UsersPeer::USR_USERNAME); $criteria->addSelectColumn(UsersPeer::USR_FIRSTNAME); $criteria->addSelectColumn(UsersPeer::USR_LASTNAME); $criteria->addSelectColumn(UsersPeer::USR_EMAIL); $criteria->add(UsersPeer::USR_UID, $arrayTaskUser, Criteria::IN); $rsCriteria = UsersPeer::doSelectRs($criteria); $rsCriteria->setFetchmode(ResultSet::FETCHMODE_ASSOC); $to = null; $cc = null; $sw = 1; while ($rsCriteria->next()) { $row = $rsCriteria->getRow(); $toAux = ($row["USR_FIRSTNAME"] != "" || $row["USR_LASTNAME"] != "" ? $row["USR_FIRSTNAME"] . " " . $row["USR_LASTNAME"] . " " : "") . "<" . $row["USR_EMAIL"] . ">"; if ($sw == 1) { $to = $toAux; $sw = 0; } else { $cc = $cc . ($cc != null ? "," : null) . $toAux; } } $sTo = $to; $sCc = $cc; } break; default: if (isset($aTask["USR_UID"]) && !empty($aTask["USR_UID"])) { $aUser = $oUser->load($aTask["USR_UID"]); $sTo = ($aUser["USR_FIRSTNAME"] != "" || $aUser["USR_LASTNAME"] != "" ? $aUser["USR_FIRSTNAME"] . " " . $aUser["USR_LASTNAME"] . " " : "") . "<" . $aUser["USR_EMAIL"] . ">"; } break; } if ($sTo != null) { $oSpool = new spoolRun(); if ($aConfiguration['MESS_RAUTH'] == false || is_string($aConfiguration['MESS_RAUTH']) && $aConfiguration['MESS_RAUTH'] == 'false') { $aConfiguration['MESS_RAUTH'] = 0; } else { $aConfiguration['MESS_RAUTH'] = 1; } $oSpool->setConfig(array("MESS_ENGINE" => $aConfiguration["MESS_ENGINE"], "MESS_SERVER" => $aConfiguration["MESS_SERVER"], "MESS_PORT" => $aConfiguration["MESS_PORT"], "MESS_ACCOUNT" => $aConfiguration["MESS_ACCOUNT"], "MESS_PASSWORD" => $aConfiguration["MESS_PASSWORD"], "SMTPAuth" => $aConfiguration["MESS_RAUTH"] == "1" ? true : false, "SMTPSecure" => isset($aConfiguration["SMTPSecure"]) ? $aConfiguration["SMTPSecure"] : "")); $oSpool->create(array("msg_uid" => "", "app_uid" => $sApplicationUID, "del_index" => $iDelegation, "app_msg_type" => "DERIVATION", "app_msg_subject" => $sSubject, "app_msg_from" => $sFrom, "app_msg_to" => $sTo, "app_msg_body" => $sBody, "app_msg_cc" => $sCc, "app_msg_bcc" => "", "app_msg_attach" => "", "app_msg_template" => "", "app_msg_status" => "pending")); if ($aConfiguration["MESS_BACKGROUND"] == "" || $aConfiguration["MESS_TRY_SEND_INMEDIATLY"] == "1") { $oSpool->sendMail(); } } } //Send derivation notification - End } catch (Exception $oException) { throw $oException; } }
public function sendNoteNotification($appUid, $usrUid, $noteContent, $noteRecipients, $sFrom = "") { try { require_once 'classes/model/Configuration.php'; $oConfiguration = new Configuration(); $sDelimiter = DBAdapter::getStringDelimiter(); $oCriteria = new Criteria('workflow'); $oCriteria->add(ConfigurationPeer::CFG_UID, 'Emails'); $oCriteria->add(ConfigurationPeer::OBJ_UID, ''); $oCriteria->add(ConfigurationPeer::PRO_UID, ''); $oCriteria->add(ConfigurationPeer::USR_UID, ''); $oCriteria->add(ConfigurationPeer::APP_UID, ''); if (ConfigurationPeer::doCount($oCriteria) == 0) { $oConfiguration->create(array('CFG_UID' => 'Emails', 'OBJ_UID' => '', 'CFG_VALUE' => '', 'PRO_UID' => '', 'USR_UID' => '', 'APP_UID' => '')); $aConfiguration = array(); } else { $aConfiguration = $oConfiguration->load('Emails', '', '', '', ''); if ($aConfiguration['CFG_VALUE'] != '') { $aConfiguration = unserialize($aConfiguration['CFG_VALUE']); $passwd = $aConfiguration['MESS_PASSWORD']; $passwdDec = G::decrypt($passwd, 'EMAILENCRYPT'); if (strpos($passwdDec, 'hash:') !== false) { list($hash, $pass) = explode(":", $passwdDec); $aConfiguration['MESS_PASSWORD'] = $pass; } } else { $aConfiguration = array(); } } if (!isset($aConfiguration['MESS_ENABLED']) || $aConfiguration['MESS_ENABLED'] != '1') { return false; } $oUser = new Users(); $aUser = $oUser->load($usrUid); $authorName = ($aUser['USR_FIRSTNAME'] != '' || $aUser['USR_LASTNAME'] != '' ? $aUser['USR_FIRSTNAME'] . ' ' . $aUser['USR_LASTNAME'] . ' ' : '') . '<' . $aUser['USR_EMAIL'] . '>'; G::LoadClass('case'); $oCase = new Cases(); $aFields = $oCase->loadCase($appUid); $configNoteNotification['subject'] = G::LoadTranslation('ID_MESSAGE_SUBJECT_NOTE_NOTIFICATION') . " @#APP_TITLE "; $configNoteNotification['body'] = G::LoadTranslation('ID_CASE') . ": @#APP_TITLE<br />" . G::LoadTranslation('ID_AUTHOR') . ": {$authorName}<br /><br />{$noteContent}"; if ($sFrom == '') { $sFrom = '"ProcessMaker"'; } if ($aConfiguration['MESS_ENGINE'] != 'MAIL' && $aConfiguration['MESS_ACCOUNT'] != '') { $sFrom .= ' <' . $aConfiguration['MESS_ACCOUNT'] . '>'; } else { if ($aConfiguration['MESS_ENGINE'] == 'MAIL') { $sFrom .= ' <info@' . gethostbyaddr('127.0.0.1') . '>'; } else { if ($aConfiguration['MESS_SERVER'] != '') { if ($sAux = @gethostbyaddr($aConfiguration['MESS_SERVER'])) { $sFrom .= ' <info@' . $sAux . '>'; } else { $sFrom .= ' <info@' . $aConfiguration['MESS_SERVER'] . '>'; } } else { $sFrom .= ' <*****@*****.**>'; } } } $sSubject = G::replaceDataField($configNoteNotification['subject'], $aFields); //erik: new behaviour for messages //G::loadClass('configuration'); //$oConf = new Configurations; //$oConf->loadConfig($x, 'TAS_EXTRA_PROPERTIES', $aTaskInfo['TAS_UID'], '', ''); //$conf = $oConf->aConfig; /* if( isset($conf['TAS_DEF_MESSAGE_TYPE']) && isset($conf['TAS_DEF_MESSAGE_TEMPLATE']) && $conf['TAS_DEF_MESSAGE_TYPE'] == 'template' && $conf['TAS_DEF_MESSAGE_TEMPLATE'] != '') { $pathEmail = PATH_DATA_SITE . 'mailTemplates' . PATH_SEP . $aTaskInfo['PRO_UID'] . PATH_SEP; $fileTemplate = $pathEmail . $conf['TAS_DEF_MESSAGE_TEMPLATE']; if ( ! file_exists ( $fileTemplate ) ) { throw new Exception("Template file '$fileTemplate' does not exist."); } $sBody = G::replaceDataField(file_get_contents($fileTemplate), $aFields); } else {*/ $sBody = nl2br(G::replaceDataField($configNoteNotification['body'], $aFields)); /*}*/ G::LoadClass('spool'); $oUser = new Users(); $recipientsArray = explode(",", $noteRecipients); foreach ($recipientsArray as $recipientUid) { $aUser = $oUser->load($recipientUid); $sTo = ($aUser['USR_FIRSTNAME'] != '' || $aUser['USR_LASTNAME'] != '' ? $aUser['USR_FIRSTNAME'] . ' ' . $aUser['USR_LASTNAME'] . ' ' : '') . '<' . $aUser['USR_EMAIL'] . '>'; $oSpool = new spoolRun(); $oSpool->setConfig(array('MESS_ENGINE' => $aConfiguration['MESS_ENGINE'], 'MESS_SERVER' => $aConfiguration['MESS_SERVER'], 'MESS_PORT' => $aConfiguration['MESS_PORT'], 'MESS_ACCOUNT' => $aConfiguration['MESS_ACCOUNT'], 'MESS_PASSWORD' => $aConfiguration['MESS_PASSWORD'], 'SMTPAuth' => $aConfiguration['MESS_RAUTH'] == '1' ? true : false, 'SMTPSecure' => isset($aConfiguration['SMTPSecure']) ? $aConfiguration['SMTPSecure'] : '')); $oSpool->create(array('msg_uid' => '', 'app_uid' => $appUid, 'del_index' => 1, 'app_msg_type' => 'DERIVATION', 'app_msg_subject' => $sSubject, 'app_msg_from' => $sFrom, 'app_msg_to' => $sTo, 'app_msg_body' => $sBody, 'app_msg_cc' => '', 'app_msg_bcc' => '', 'app_msg_attach' => '', 'app_msg_template' => '', 'app_msg_status' => 'pending')); if ($aConfiguration['MESS_BACKGROUND'] == '' || $aConfiguration['MESS_TRY_SEND_INMEDIATLY'] == '1') { $oSpool->sendMail(); } } //Send derivation notification - End } catch (Exception $oException) { throw $oException; } }
/** * The current method is for filter every row that exist in * the Configuration table * * @param array $aTaskExtraProperties * @return void */ public function createTaskExtraPropertiesRows ($aTaskExtraProperties) { if (count($aTaskExtraProperties) > 0) { foreach ($aTaskExtraProperties as $key => $row) { $oConfig = new Configuration(); if ($oConfig->exists( $row['CFG_UID'], $row['OBJ_UID'], $row['PRO_UID'], $row['USR_UID'], $row['APP_UID']) ) { $oConfig->remove( $row['CFG_UID'], $row['OBJ_UID'], $row['PRO_UID'], $row['USR_UID'], $row['APP_UID'] ); $oConfig->setDeleted(false); } $res = $oConfig->create( $row ); $oConfig->setNew(true); if (method_exists($oConfig, "setProperties")) { $oConfig->setProperties(); } } } return; }
case 'resendMessage': //require_once 'classes/model/Configuration.php'; G::LoadClass('spool'); $oCase = new Cases(); $data = $oCase->getHistoryMessagesTrackerView($_POST['APP_UID'], $_POST['APP_MSG_UID']); //print_r($data); $oConfiguration = new Configuration(); $sDelimiter = DBAdapter::getStringDelimiter(); $oCriteria = new Criteria('workflow'); $oCriteria->add(ConfigurationPeer::CFG_UID, 'Emails'); $oCriteria->add(ConfigurationPeer::OBJ_UID, ''); $oCriteria->add(ConfigurationPeer::PRO_UID, ''); $oCriteria->add(ConfigurationPeer::USR_UID, ''); $oCriteria->add(ConfigurationPeer::APP_UID, ''); if (ConfigurationPeer::doCount($oCriteria) == 0) { $oConfiguration->create(array('CFG_UID' => 'Emails', 'OBJ_UID' => '', 'CFG_VALUE' => '', 'PRO_UID' => '', 'USR_UID' => '', 'APP_UID' => '')); $aConfiguration = array(); } else { $aConfiguration = $oConfiguration->load('Emails', '', '', '', ''); if ($aConfiguration['CFG_VALUE'] != '') { $aConfiguration = unserialize($aConfiguration['CFG_VALUE']); } else { $aConfiguration = array(); } } $oSpool = new spoolRun(); if ($aConfiguration['MESS_RAUTH'] == false || is_string($aConfiguration['MESS_RAUTH']) && $aConfiguration['MESS_RAUTH'] == 'false') { $aConfiguration['MESS_RAUTH'] = 0; } else { $aConfiguration['MESS_RAUTH'] = 1; }
/** * Process-Files upgrade * * @param string $projectUid Unique id of Project * * return void */ public function processFilesUpgrade($projectUid = "") { try { //Set variables $conf = new \Configuration(); //Create/Get PROCESS_FILES_CHECKED $arrayProjectUid = array(); $configuration = \ConfigurationPeer::retrieveByPK("PROCESS_FILES_CHECKED", "", "", "", ""); if (is_null($configuration)) { $result = $conf->create(array( "CFG_UID" => "PROCESS_FILES_CHECKED", "OBJ_UID" => "", "CFG_VALUE" => serialize($arrayProjectUid), "PRO_UID" => "", "USR_UID" => "", "APP_UID" => "" )); } else { $arrayProjectUid = unserialize($configuration->getCfgValue()); } //Set variables $arrayPath = array("templates" => PATH_DATA_MAILTEMPLATES, "public" => PATH_DATA_PUBLIC); $flagProjectUid = false; //Query $criteria = new \Criteria("workflow"); $criteria->addSelectColumn(\BpmnProjectPeer::PRJ_UID); if ($projectUid != "") { $criteria->add( $criteria->getNewCriterion(\BpmnProjectPeer::PRJ_UID, $arrayProjectUid, \Criteria::NOT_IN)->addAnd( $criteria->getNewCriterion(\BpmnProjectPeer::PRJ_UID, $projectUid, \Criteria::EQUAL)) ); } else { $criteria->add(\BpmnProjectPeer::PRJ_UID, $arrayProjectUid, \Criteria::NOT_IN); } $rsCriteria = \BpmnProjectPeer::doSelectRS($criteria); $rsCriteria->setFetchmode(\ResultSet::FETCHMODE_ASSOC); while ($rsCriteria->next()) { $row = $rsCriteria->getRow(); foreach ($arrayPath as $key => $value) { $path = $key; $dir = $value . $row["PRJ_UID"]; if (is_dir($dir)) { if ($dirh = opendir($dir)) { while (($file = readdir($dirh)) !== false) { if ($file != "" && $file != "." && $file != "..") { $f = $dir . PATH_SEP . $file; if (is_file($f)) { $arrayProcessFilesData = $this->getFileManagerUid($f); if (is_null($arrayProcessFilesData["PRF_UID"])) { rename($dir . PATH_SEP . $file, $dir . PATH_SEP . $file . ".tmp"); $arrayData = array( "prf_path" => $path, "prf_filename" => $file, "prf_content" => "" ); $arrayData = $this->addProcessFilesManager($row["PRJ_UID"], "00000000000000000000000000000001", $arrayData); rename($dir . PATH_SEP . $file . ".tmp", $dir . PATH_SEP . $file); } } } } closedir($dirh); } } } $arrayProjectUid[$row["PRJ_UID"]] = $row["PRJ_UID"]; $flagProjectUid = true; } //Update PROCESS_FILES_CHECKED if ($flagProjectUid) { $result = $conf->update(array( "CFG_UID" => "PROCESS_FILES_CHECKED", "OBJ_UID" => "", "CFG_VALUE" => serialize($arrayProjectUid), "PRO_UID" => "", "USR_UID" => "", "APP_UID" => "" )); } } catch (\Exception $e) { throw $e; } }
* GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. * * For more information, contact Colosa Inc, 2566 Le Jeune Rd., * Coral Gables, FL, 33134, USA, or email info@colosa.com. * */ try { G::LoadInclude('ajax'); if (isset($_POST['form'])) { $_POST = $_POST['form']; } $_POST['function'] = get_ajax_value('function'); switch ($_POST['function']) { case 'getStarted_save': require_once 'classes/model/Configuration.php'; $aData['CFG_UID'] = 'getStarted'; $aData['OBJ_UID'] = ''; $aData['CFG_VALUE'] = '1'; $aData['PRO_UID'] = ''; $aData['USR_UID'] = ''; $aData['APP_UID'] = ''; $oConfig = new Configuration(); $oConfig->create($aData); break; } } catch (Exception $oException) { die($oException->getMessage()); }
public function update($fields) { require_once "classes/model/AppCacheView.php"; require_once "classes/model/Configuration.php"; $con = Propel::getConnection(TaskPeer::DATABASE_NAME); try { $con->begin(); $this->load($fields["TAS_UID"]); $this->fromArray($fields, BasePeer::TYPE_FIELDNAME); if ($this->validate()) { $taskDefTitlePrevious = null; $criteria = new Criteria("workflow"); $criteria->addSelectColumn(ContentPeer::CON_VALUE); $criteria->add(ContentPeer::CON_CATEGORY, "TAS_DEF_TITLE"); $criteria->add(ContentPeer::CON_ID, $fields["TAS_UID"]); $criteria->add(ContentPeer::CON_LANG, SYS_LANG); $rsCriteria = ContentPeer::doSelectRS($criteria); $rsCriteria->setFetchmode(ResultSet::FETCHMODE_ASSOC); while ($rsCriteria->next()) { $row = $rsCriteria->getRow(); $taskDefTitlePrevious = $row["CON_VALUE"]; } $contentResult = 0; if (array_key_exists("TAS_TITLE", $fields)) { $contentResult += $this->setTasTitle($fields["TAS_TITLE"]); } if (array_key_exists("TAS_DESCRIPTION", $fields)) { $contentResult += $this->setTasDescription($fields["TAS_DESCRIPTION"]); } if (array_key_exists("TAS_DEF_TITLE", $fields)) { $contentResult += $this->setTasDefTitle($fields["TAS_DEF_TITLE"]); } if (array_key_exists("TAS_DEF_DESCRIPTION", $fields)) { $contentResult += $this->setTasDefDescription($fields["TAS_DEF_DESCRIPTION"]); } if (array_key_exists("TAS_DEF_PROC_CODE", $fields)) { $contentResult += $this->setTasDefProcCode($fields["TAS_DEF_PROC_CODE"]); } if (array_key_exists("TAS_DEF_MESSAGE", $fields)) { $contentResult += $this->setTasDefMessage(trim($fields["TAS_DEF_MESSAGE"])); } if (array_key_exists("TAS_DEF_SUBJECT_MESSAGE", $fields)) { $contentResult += $this->setTasDefSubjectMessage(trim($fields["TAS_DEF_SUBJECT_MESSAGE"])); } if (array_key_exists("TAS_CALENDAR", $fields)) { $contentResult += $this->setTasCalendar($fields['TAS_UID'], $fields["TAS_CALENDAR"]); } $result = $this->save(); $result = $result == 0 ? $contentResult > 0 ? 1 : 0 : $result; $con->commit(); if ($result == 1 && array_key_exists("TAS_DEF_TITLE", $fields) && $fields["TAS_DEF_TITLE"] != $taskDefTitlePrevious) { $criteria = new Criteria("workflow"); $criteria->addAsColumn("APPCV_NUM_ROWS", "COUNT(DISTINCT " . AppCacheViewPeer::APP_UID . ")"); $criteria->add(AppCacheViewPeer::DEL_THREAD_STATUS, "OPEN"); $criteria->add(AppCacheViewPeer::TAS_UID, $fields["TAS_UID"]); $rsCriteria = AppCacheViewPeer::doSelectRS($criteria); $rsCriteria->setFetchmode(ResultSet::FETCHMODE_ASSOC); $rsCriteria->next(); $row = $rsCriteria->getRow(); $appcvNumRows = intval($row["APPCV_NUM_ROWS"]); if ($appcvNumRows <= 1000) { $appcv = new AppCacheView(); $appcv->appTitleByTaskCaseLabelUpdate($fields["TAS_UID"], SYS_LANG); $result = 2; } else { //Delete record $criteria = new Criteria("workflow"); $criteria->add(ConfigurationPeer::CFG_UID, "TAS_APP_TITLE_UPDATE"); $criteria->add(ConfigurationPeer::OBJ_UID, $fields["TAS_UID"]); $criteria->add(ConfigurationPeer::CFG_VALUE, SYS_LANG); $numRowDeleted = ConfigurationPeer::doDelete($criteria); //Insert record $conf = new Configuration(); $conf->create(array("CFG_UID" => "TAS_APP_TITLE_UPDATE", "OBJ_UID" => $fields["TAS_UID"], "CFG_VALUE" => SYS_LANG, "PRO_UID" => "", "USR_UID" => "", "APP_UID" => "")); $result = 3; } } return $result; } else { $con->rollback(); throw new Exception("Failed Validation in class " . get_class($this) . "."); } } catch (Exception $e) { $con->rollback(); throw $e; } }
public function setConfiguration() { $confEeUid = "enterpriseConfiguration"; $criteria = new Criteria("workflow"); $criteria->addSelectColumn(ConfigurationPeer::CFG_VALUE); $criteria->add(ConfigurationPeer::CFG_UID, "EE"); $criteria->add(ConfigurationPeer::OBJ_UID, $confEeUid); $rsCriteria = ConfigurationPeer::doSelectRS($criteria); if (!$rsCriteria->next()) { $conf = new Configuration(); $data = array("internetConnection" => 1); $conf->create(array("CFG_UID" => "EE", "OBJ_UID" => $confEeUid, "CFG_VALUE" => serialize($data), "PRO_UID" => "", "USR_UID" => "", "APP_UID" => "")); } }
if (isset($_POST['install'])) { if (isset($_POST['password']) && trim($_POST['password']) != '' && isset($_POST['login']) && trim($_POST['login']) != '') { //Supression de l'ancienne base si elle existe if (file_exists(DB_NAME)) { unlink(DB_NAME); } //Instanciation des managers d'entités $user = new User(); $configuration = new Configuration(); $right = new Right(); $rank = new Rank(); $section = new Section(); $event = new Event(); $client = new Client(); //Création des tables SQL $configuration->create(); $user->create(); $right->create(); $rank->create(); $section->create(); $event->create(); $client->create(); $configuration->put('UPDATE_URL', 'http://update.idleman.fr/yana?callback=?'); $configuration->put('DEFAULT_THEME', 'default'); $configuration->put('COOKIE_NAME', 'yana'); $configuration->put('COOKIE_LIFETIME', '7'); $configuration->put('VOCAL_ENTITY_NAME', 'YANA'); $configuration->put('PROGRAM_VERSION', '3.0.6'); $configuration->put('HOME_PAGE', 'index.php'); $configuration->put('VOCAL_SENSITIVITY', '0.0'); //Création du rang admin
$folderManager = new Folder(); $folderManager->create(); if ($folderManager->rowCount() == 0) { //Création du dossier général $folder = new Folder(); $folder->setName(_t('GENERAL_FOLDER')); $folder->setParent(-1); $folder->setIsopen(1); $folder->save(); } // REMET À ZÉRO LA CONFIGURATION $configurationManager = new Configuration(); if ($configurationManager->tableExists()) { $configurationManager->truncate(); } $configurationManager->create(); $configurationManager->add('articleDisplayAnonymous', '0'); $configurationManager->add('articleDisplayAuthor', '1'); $configurationManager->add('articleDisplayDate', '1'); $configurationManager->add('articleDisplayFolderSort', '1'); $configurationManager->add('articleDisplayHomeSort', '1'); $configurationManager->add('articleDisplayLink', '1'); $configurationManager->add('articleDisplayMode', 'summary'); $configurationManager->add('articlePerPages', '5'); $configurationManager->add('cryptographicSalt', $cryptographicSalt); $configurationManager->add('displayOnlyUnreadFeedFolder', 'false'); $configurationManager->add('feedMaxEvents', '50'); $configurationManager->add('language', $_POST['install_changeLngLeed']); $configurationManager->add('optionFeedIsVerbose', 1); $configurationManager->add('paginationScale', 5); $configurationManager->add('syncGradCount', '10');
/** * getting Save email configuration * @autor Alvaro <*****@*****.**> */ public function saveConfiguration() { require_once 'classes/model/Configuration.php'; try { $oConfiguration = new Configuration(); $aFields['MESS_PASSWORD'] = $_POST['passwd']; if ($_POST['passwdHide'] != '') { $aFields['MESS_PASSWORD'] = $_POST['passwdHide']; } $aFields['MESS_PASSWORD_HIDDEN'] = ''; $passwd = $aFields['MESS_PASSWORD']; $passwdDec = G::decrypt($passwd, 'EMAILENCRYPT'); $auxPass = explode('hash:', $passwdDec); if (count($auxPass) > 1) { if (count($auxPass) == 2) { $passwd = $auxPass[1]; } else { array_shift($auxPass); $passwd = implode('', $auxPass); } } $aFields['MESS_PASSWORD'] = $passwd; if ($aFields['MESS_PASSWORD'] != '') { $aFields['MESS_PASSWORD'] = '******' . $aFields['MESS_PASSWORD']; $aFields['MESS_PASSWORD'] = G::encrypt($aFields['MESS_PASSWORD'], 'EMAILENCRYPT'); } $aFields['MESS_ENABLED'] = isset($_POST['EnableEmailNotifications']) ? $_POST['EnableEmailNotifications'] : ''; $aFields['MESS_ENABLED'] = $aFields['MESS_ENABLED'] == 'true' ? '1' : $aFields['MESS_ENABLED']; $aFields['MESS_ENGINE'] = $_POST['EmailEngine']; $aFields['MESS_SERVER'] = trim($_POST['server']); $aFields['MESS_RAUTH'] = isset($_POST['req_auth']) ? $_POST['req_auth'] : ''; $aFields['MESS_RAUTH'] = $aFields['MESS_RAUTH'] == 'true' ? '1' : $aFields['MESS_RAUTH']; $aFields['MESS_PORT'] = $_POST['port']; $aFields['MESS_ACCOUNT'] = $_POST['from']; $aFields['MESS_BACKGROUND'] = ''; //isset($_POST['background']) ? $_POST['background'] : ''; $aFields['MESS_EXECUTE_EVERY'] = ''; //$_POST['form']['MESS_EXECUTE_EVERY']; $aFields['MESS_SEND_MAX'] = ''; //$_POST['form']['MESS_SEND_MAX']; $aFields['SMTPSecure'] = $_POST['UseSecureCon']; $aFields['SMTPSecure'] = $aFields['SMTPSecure'] == 'No' ? 'none' : $aFields['SMTPSecure']; $aFields['MAIL_TO'] = $_POST['eMailto']; $aFields['MESS_TRY_SEND_INMEDIATLY'] = $_POST['SendaTestMail']; //isset($_POST['form']['MESS_TRY_SEND_INMEDIATLY']) ? $_POST['form']['MESS_TRY_SEND_INMEDIATLY'] : ''; $aFields['MESS_TRY_SEND_INMEDIATLY'] = $aFields['MESS_TRY_SEND_INMEDIATLY'] == 'true' ? '1' : $aFields['MESS_TRY_SEND_INMEDIATLY']; $CfgUid = 'Emails'; $ObjUid = ''; $ProUid = ''; $UsrUid = ''; $AppUid = ''; if ($oConfiguration->exists($CfgUid, $ObjUid, $ProUid, $UsrUid, $AppUid)) { $oConfiguration->update(array('CFG_UID' => 'Emails', 'OBJ_UID' => '', 'CFG_VALUE' => serialize($aFields), 'PRO_UID' => '', 'USR_UID' => '', 'APP_UID' => '')); $this->success = 'true'; $this->msg = 'Saved'; } else { $oConfiguration->create(array('CFG_UID' => 'Emails', 'OBJ_UID' => '', 'CFG_VALUE' => serialize($aFields), 'PRO_UID' => '', 'USR_UID' => '', 'APP_UID' => '')); $this->success = 'true'; $this->msg = 'Saved'; } } catch (Exception $e) { $this->success = false; $this->msg = $e->getMessage(); } }
$oProcesses = new Processes(); try { if ($oProcesses->ws_open($oData->u, $oData->p) == 1) { $bExists = true; } else { $bExists = false; } } catch (Exception $oException) { $bExists = false; } $oResponse = new stdclass(); if ($bExists) { require_once 'classes/model/Configuration.php'; $oConfiguration = new Configuration(); $oConfiguration->create(array('CFG_UID' => 'REGISTER_INFORMATION', 'OBJ_UID' => '', 'CFG_VALUE' => serialize(array('u' => $oData->u, 'p' => $oData->p )), 'PRO_UID' => '', 'USR_UID' => $_SESSION['USER_LOGGED'], 'APP_UID' => '' )); $oResponse->sLabel = G::LoadTranslation('ID_DOWNLOAD'); $oResponse->sLink = '../processes/downloadPML?id=' . $oData->pro_uid . '&s=' . $sessionId; } $oResponse->bExists = $bExists; //$oJSON = new Services_JSON(); echo Bootstrap::json_encode($oResponse); break; case 'editFile': //echo $_REQUEST['filename']; global $G_PUBLISH; $G_PUBLISH = new Publisher(); ///-- $sDirectory = PATH_DATA_MAILTEMPLATES . $_REQUEST['pro_uid'] . PATH_SEP . $_REQUEST['filename']; $sDir = ""; if (isset($_SESSION['PFMDirectory'])) {
/** * * @url POST /forwardMail */ public function forwardMail($params) { if (!isset($_REQUEST['REQ_UID'])) { $_REQUEST['REQ_UID'] = ''; } $criteria = new Criteria(); $criteria->addSelectColumn(AbeConfigurationPeer::ABE_UID); $criteria->addSelectColumn(AbeConfigurationPeer::PRO_UID); $criteria->addSelectColumn(AbeConfigurationPeer::TAS_UID); $criteria->addSelectColumn(AbeRequestsPeer::ABE_REQ_UID); $criteria->addSelectColumn(AbeRequestsPeer::APP_UID); $criteria->addSelectColumn(AbeRequestsPeer::DEL_INDEX); $criteria->addSelectColumn(AbeRequestsPeer::ABE_REQ_SENT_TO); $criteria->addSelectColumn(AbeRequestsPeer::ABE_REQ_SUBJECT); $criteria->addSelectColumn(AbeRequestsPeer::ABE_REQ_BODY); $criteria->addSelectColumn(AbeRequestsPeer::ABE_REQ_ANSWERED); $criteria->addSelectColumn(AbeRequestsPeer::ABE_REQ_STATUS); $criteria->addSelectColumn(AppDelegationPeer::DEL_FINISH_DATE); $criteria->add(AbeRequestsPeer::ABE_REQ_UID, $_REQUEST['REQ_UID']); $criteria->addJoin(AbeRequestsPeer::ABE_UID, AbeConfigurationPeer::ABE_UID); $criteria->addJoin(AppDelegationPeer::APP_UID, AbeRequestsPeer::APP_UID); $criteria->addJoin(AppDelegationPeer::DEL_INDEX, AbeRequestsPeer::DEL_INDEX); $resultRes = AbeRequestsPeer::doSelectRS($criteria); $resultRes->setFetchmode(ResultSet::FETCHMODE_ASSOC); $resultRes->next(); $dataRes = Array(); if ($dataRes = $resultRes->getRow()) { if (is_null($dataRes['DEL_FINISH_DATE'])) { require_once 'classes/model/Configuration.php'; G::LoadClass('spool'); $configuration = new Configuration(); $sDelimiter = DBAdapter::getStringDelimiter(); $criteria = new Criteria('workflow'); $criteria->add(ConfigurationPeer::CFG_UID, 'Emails'); $criteria->add(ConfigurationPeer::OBJ_UID, ''); $criteria->add(ConfigurationPeer::PRO_UID, ''); $criteria->add(ConfigurationPeer::USR_UID, ''); $criteria->add(ConfigurationPeer::APP_UID, ''); if (ConfigurationPeer::doCount($criteria) == 0) { $configuration->create(array('CFG_UID' => 'Emails', 'OBJ_UID' => '', 'CFG_VALUE' => '', 'PRO_UID' => '', 'USR_UID' => '', 'APP_UID' => '')); $newConfiguration = array(); } else { $newConfiguration = $configuration->load('Emails', '', '', '', ''); if ($newConfiguration['CFG_VALUE'] != '') { $newConfiguration = unserialize($newConfiguration['CFG_VALUE']); } else { $newConfiguration = array(); } } $spool = new spoolRun(); $spool->setConfig(array( 'MESS_ENGINE' => $newConfiguration['MESS_ENGINE'], 'MESS_SERVER' => $newConfiguration['MESS_SERVER'], 'MESS_PORT' => $newConfiguration['MESS_PORT'], 'MESS_ACCOUNT' => $newConfiguration['MESS_ACCOUNT'], 'MESS_PASSWORD' => $newConfiguration['MESS_PASSWORD'], 'SMTPAuth' => $newConfiguration['MESS_RAUTH'] )); $spool->create(array( 'msg_uid' => '', 'app_uid' => $dataRes['APP_UID'], 'del_index' => $dataRes['DEL_INDEX'], 'app_msg_type' => 'TEST', 'app_msg_subject' => $dataRes['ABE_REQ_SUBJECT'], 'app_msg_from' => $newConfiguration['MESS_ACCOUNT'], 'app_msg_to' => $dataRes['ABE_REQ_SENT_TO'], 'app_msg_body' => $dataRes['ABE_REQ_BODY'], 'app_msg_cc' => '', 'app_msg_bcc' => '', 'app_msg_attach' => '', 'app_msg_template' => '', 'app_msg_status' => 'pending' )); if ($spool->sendMail()) { $dataRes['ABE_REQ_STATUS'] = 'SENT'; $message = 'The email was resend to: ' . $dataRes['ABE_REQ_SENT_TO']; } else { $dataRes['ABE_REQ_STATUS'] = 'ERROR'; $message = 'There was a problem sending the email to: ' . $dataRes['ABE_REQ_SENT_TO'] . ', please try later.'; } try { $abeRequestsInstance = new AbeRequests(); $abeRequestsInstance->createOrUpdate($dataRes); } catch (Exception $error) { throw $error; } } else { $message = 'Unable to send email, the task is closed.'; } } else { $message = 'An unexpected error occurred please try again later.'; } return $message; }
/** * Post Dashboards User Configuration * * @param array $arrayData Data * @param string $usrUid * * return array Return data of the user configuration * * @author Jenny Murillo <*****@*****.**> */ public function postConfigByUsr($arrayData, $usrUid) { $cnfgData[$arrayData['dashId']] = $arrayData; $data['CFG_UID'] = 'DASHBOARDS_SETTINGS'; $data['OBJ_UID'] = ''; $data['CFG_VALUE'] = serialize($cnfgData); $data['USR_UID'] = $usrUid; $data['PRO_UID'] = ""; $data['APP_UID'] = ""; //require_once (PATH_HOME . "engine" . PATH_SEP . "classes" . PATH_SEP . "model" . PATH_SEP . "Configuration.php"); $oConfig = new \Configuration(); $response = $oConfig->create($data); return $response; }
public function sendNotifications($sCurrentTask, $aTasks, $aFields, $sApplicationUID, $iDelegation, $sFrom = '') { try { $oConfiguration = new Configuration(); $sDelimiter = DBAdapter::getStringDelimiter(); $oCriteria = new Criteria('workflow'); $oCriteria->add(ConfigurationPeer::CFG_UID, 'Emails'); $oCriteria->add(ConfigurationPeer::OBJ_UID, ''); $oCriteria->add(ConfigurationPeer::PRO_UID, ''); $oCriteria->add(ConfigurationPeer::USR_UID, ''); $oCriteria->add(ConfigurationPeer::APP_UID, ''); if (ConfigurationPeer::doCount($oCriteria) == 0) { $oConfiguration->create(array('CFG_UID' => 'Emails', 'OBJ_UID' => '', 'CFG_VALUE' => '', 'PRO_UID' => '', 'USR_UID' => '', 'APP_UID' => '')); $aConfiguration = array(); } else { $aConfiguration = $oConfiguration->load('Emails', '', '', '', ''); if ($aConfiguration['CFG_VALUE'] != '') { $aConfiguration = unserialize($aConfiguration["CFG_VALUE"]); $passwd = $aConfiguration["MESS_PASSWORD"]; $passwdDec = G::decrypt($passwd, "EMAILENCRYPT"); if (strpos($passwdDec, "hash:") !== false) { list($hash, $pass) = explode(":", $passwdDec); $passwd = $pass; } $aConfiguration["MESS_PASSWORD"] = $passwd; } else { $aConfiguration = array(); } } if (!isset($aConfiguration['MESS_ENABLED']) || $aConfiguration['MESS_ENABLED'] != '1') { return false; } //Send derivation notification - Start $oTask = new Task(); $aTaskInfo = $oTask->load($sCurrentTask); if ($aTaskInfo['TAS_SEND_LAST_EMAIL'] != 'TRUE') { return false; } if ($sFrom == '') { $sFrom = '"ProcessMaker"'; } if ($aConfiguration['MESS_ENGINE'] != 'MAIL' && $aConfiguration['MESS_ACCOUNT'] != '') { $sFrom .= ' <' . $aConfiguration['MESS_ACCOUNT'] . '>'; } else { if ($aConfiguration['MESS_ENGINE'] == 'MAIL') { $sFrom .= ' <info@' . gethostbyaddr('127.0.0.1') . '>'; } else { if ($aConfiguration['MESS_SERVER'] != '') { if ($sAux = @gethostbyaddr($aConfiguration['MESS_SERVER'])) { $sFrom .= ' <info@' . $sAux . '>'; } else { $sFrom .= ' <info@' . $aConfiguration['MESS_SERVER'] . '>'; } } else { $sFrom .= ' <*****@*****.**>'; } } } if (isset($aTaskInfo['TAS_DEF_SUBJECT_MESSAGE']) && $aTaskInfo['TAS_DEF_SUBJECT_MESSAGE'] != '') { $sSubject = G::replaceDataField($aTaskInfo['TAS_DEF_SUBJECT_MESSAGE'], $aFields); } else { $sSubject = G::LoadTranslation('ID_MESSAGE_SUBJECT_DERIVATION'); } //erik: new behaviour for messages G::loadClass('configuration'); $oConf = new Configurations(); $oConf->loadConfig($x, 'TAS_EXTRA_PROPERTIES', $aTaskInfo['TAS_UID'], '', ''); $conf = $oConf->aConfig; if (isset($conf['TAS_DEF_MESSAGE_TYPE']) && isset($conf['TAS_DEF_MESSAGE_TEMPLATE']) && $conf['TAS_DEF_MESSAGE_TYPE'] == 'template' && $conf['TAS_DEF_MESSAGE_TEMPLATE'] != '') { $pathEmail = PATH_DATA_SITE . 'mailTemplates' . PATH_SEP . $aTaskInfo['PRO_UID'] . PATH_SEP; $fileTemplate = $pathEmail . $conf['TAS_DEF_MESSAGE_TEMPLATE']; if (!file_exists($fileTemplate)) { throw new Exception("Template file '{$fileTemplate}' does not exist."); } $sBody = G::replaceDataField(file_get_contents($fileTemplate), $aFields); } else { $sBody = nl2br(G::replaceDataField($aTaskInfo['TAS_DEF_MESSAGE'], $aFields)); } G::LoadClass('spool'); $oUser = new Users(); foreach ($aTasks as $aTask) { if (isset($aTask['USR_UID'])) { $aUser = $oUser->load($aTask['USR_UID']); $sTo = ($aUser['USR_FIRSTNAME'] != '' || $aUser['USR_LASTNAME'] != '' ? $aUser['USR_FIRSTNAME'] . ' ' . $aUser['USR_LASTNAME'] . ' ' : '') . '<' . $aUser['USR_EMAIL'] . '>'; $oSpool = new spoolRun(); $oSpool->setConfig(array('MESS_ENGINE' => $aConfiguration['MESS_ENGINE'], 'MESS_SERVER' => $aConfiguration['MESS_SERVER'], 'MESS_PORT' => $aConfiguration['MESS_PORT'], 'MESS_ACCOUNT' => $aConfiguration['MESS_ACCOUNT'], 'MESS_PASSWORD' => $aConfiguration['MESS_PASSWORD'], 'SMTPAuth' => $aConfiguration['MESS_RAUTH'] == '1' ? true : false, 'SMTPSecure' => isset($aConfiguration['SMTPSecure']) ? $aConfiguration['SMTPSecure'] : '')); $oSpool->create(array('msg_uid' => '', 'app_uid' => $sApplicationUID, 'del_index' => $iDelegation, 'app_msg_type' => 'DERIVATION', 'app_msg_subject' => $sSubject, 'app_msg_from' => $sFrom, 'app_msg_to' => $sTo, 'app_msg_body' => $sBody, 'app_msg_cc' => '', 'app_msg_bcc' => '', 'app_msg_attach' => '', 'app_msg_template' => '', 'app_msg_status' => 'pending')); if ($aConfiguration['MESS_BACKGROUND'] == '' || $aConfiguration['MESS_TRY_SEND_INMEDIATLY'] == '1') { $oSpool->sendMail(); } } } //Send derivation notification - End } catch (Exception $oException) { throw $oException; } }