本文整理汇总了PHP中G::buildFrom方法的典型用法代码示例。如果您正苦于以下问题:PHP G::buildFrom方法的具体用法?PHP G::buildFrom怎么用?PHP G::buildFrom使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类G
的用法示例。
在下文中一共展示了G::buildFrom方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: sendTestMail
/**
* Send a test email
*
* @param array $arrayData Data
*
* return array Return array with result of send test mail
*/
public function sendTestMail(array $arrayData)
{
try {
\G::LoadClass("system");
\G::LoadClass("spool");
$aConfiguration = array("MESS_ENGINE" => $arrayData["MESS_ENGINE"], "MESS_SERVER" => $arrayData["MESS_SERVER"], "MESS_PORT" => (int) $arrayData["MESS_PORT"], "MESS_ACCOUNT" => $arrayData["MESS_ACCOUNT"], "MESS_PASSWORD" => $arrayData["MESS_PASSWORD"], "MESS_FROM_NAME" => $arrayData["FROM_NAME"], "MESS_FROM_MAIL" => $arrayData["FROM_EMAIL"], "MESS_RAUTH" => (int) $arrayData["MESS_RAUTH"], "SMTPSecure" => isset($arrayData["SMTPSecure"]) ? $arrayData["SMTPSecure"] : "none");
$sFrom = \G::buildFrom($aConfiguration);
$sSubject = \G::LoadTranslation("ID_MESS_TEST_SUBJECT");
$msg = \G::LoadTranslation("ID_MESS_TEST_BODY");
switch ($arrayData["MESS_ENGINE"]) {
case "MAIL":
$engine = \G::LoadTranslation("ID_MESS_ENGINE_TYPE_1");
break;
case "PHPMAILER":
$engine = \G::LoadTranslation("ID_MESS_ENGINE_TYPE_2");
break;
case "OPENMAIL":
$engine = \G::LoadTranslation("ID_MESS_ENGINE_TYPE_3");
break;
}
$sBodyPre = new \TemplatePower(PATH_TPL . "admin" . PATH_SEP . "email.tpl");
$sBodyPre->prepare();
$sBodyPre->assign("server", $_SERVER["SERVER_NAME"]);
$sBodyPre->assign("date", date("H:i:s"));
$sBodyPre->assign("ver", \System::getVersion());
$sBodyPre->assign("engine", $engine);
$sBodyPre->assign("msg", $msg);
$sBody = $sBodyPre->getOutputContent();
$oSpool = new \spoolRun();
$oSpool->setConfig($aConfiguration);
$oSpool->create(array("msg_uid" => "", "app_uid" => "", "del_index" => 0, "app_msg_type" => "TEST", "app_msg_subject" => $sSubject, "app_msg_from" => $sFrom, "app_msg_to" => $arrayData["TO"], "app_msg_body" => $sBody, "app_msg_cc" => "", "app_msg_bcc" => "", "app_msg_attach" => "", "app_msg_template" => "", "app_msg_status" => "pending", "app_msg_attach" => ""));
$oSpool->sendMail();
//Return
$arrayTestMailResult = array();
if ($oSpool->status == "sent") {
$arrayTestMailResult["status"] = true;
$arrayTestMailResult["success"] = true;
$arrayTestMailResult["msg"] = \G::LoadTranslation("ID_MAIL_TEST_SUCCESS");
} else {
$arrayTestMailResult["status"] = false;
$arrayTestMailResult["success"] = false;
$arrayTestMailResult["msg"] = $oSpool->error;
}
return $arrayTestMailResult;
} catch (\Exception $e) {
throw $e;
}
}
示例2: sendMessage
//.........这里部分代码省略.........
if (! file_exists( $fileTemplate )) {
$data['FILE_TEMPLATE'] = $fileTemplate;
$result = new wsResponse( 28, G::LoadTranslation( 'ID_TEMPLATE_FILE_NOT_EXIST', SYS_LANG, $data ) );
return $result;
}
if ($appFields == null) {
$Fields = $oldFields['APP_DATA'];
} else {
$Fields = array_merge( $oldFields['APP_DATA'], $appFields );
}
$sBody = G::replaceDataGridField(file_get_contents($fileTemplate), $Fields, false);
$sFrom = G::buildFrom($aSetup, $sFrom);
$showMessage = ($showMessage) ? 1 : 0 ;
$messageArray = array(
"msg_uid" => "",
"app_uid" => $caseId,
"del_index" => $delIndex,
"app_msg_type" => "TRIGGER",
"app_msg_subject" => $sSubject,
"app_msg_from" => $sFrom,
"app_msg_to" => $sTo,
"app_msg_body" => $sBody,
"app_msg_cc" => $sCc,
"app_msg_bcc" => $sBcc,
"app_msg_attach" => $aAttachment,
"app_msg_template" => "",
示例3: sendNotifications
public function sendNotifications($sCurrentTask, $aTasks, $aFields, $sApplicationUID, $iDelegation, $sFrom = "")
{
try {
$applicationData = $this->loadCase($sApplicationUID);
$aFields["APP_NUMBER"] = $applicationData["APP_NUMBER"];
if (!class_exists('System')) {
G::LoadClass('system');
}
$aConfiguration = System::getEmailConfiguration();
$msgError = "";
if (!isset($aConfiguration['MESS_ENABLED']) || $aConfiguration['MESS_ENABLED'] != '1') {
$msgError = "The default configuration wasn't defined";
$aConfiguration['MESS_ENGINE'] = '';
}
//Send derivation notification - Start
$oTask = new Task();
$aTaskInfo = $oTask->load($sCurrentTask);
if ($aTaskInfo['TAS_SEND_LAST_EMAIL'] != 'TRUE') {
return false;
}
$sFrom = G::buildFrom($aConfiguration, $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;
//.........这里部分代码省略.........
示例4: resendEmails
/**
* try resend the emails from spool
*
* @param string $dateResend
* @return none or exception
*/
public function resendEmails ($dateResend = null, $cron = 0)
{
if (!class_exists('System')) {
G::LoadClass('system');
}
$aConfiguration = System::getEmailConfiguration();
if (!isset($aConfiguration["MESS_ENABLED"])) {
$aConfiguration["MESS_ENABLED"] = '0';
}
if ($aConfiguration["MESS_ENABLED"] == "1") {
require_once ("classes/model/AppMessage.php");
$this->setConfig($aConfiguration);
$criteria = new Criteria( "workflow" );
$criteria->add( AppMessagePeer::APP_MSG_STATUS, "sent", Criteria::NOT_EQUAL );
if ($dateResend != null) {
$criteria->add( AppMessagePeer::APP_MSG_DATE, $dateResend, Criteria::GREATER_EQUAL );
}
$rsCriteria = AppMessagePeer::doSelectRS( $criteria );
$rsCriteria->setFetchmode( ResultSet::FETCHMODE_ASSOC );
while ($rsCriteria->next()) {
if ($cron == 1) {
$arrayCron = unserialize( trim( @file_get_contents( PATH_DATA . "cron" ) ) );
$arrayCron["processcTimeStart"] = time();
@file_put_contents( PATH_DATA . "cron", serialize( $arrayCron ) );
}
$row = $rsCriteria->getRow();
try {
$sFrom = G::buildFrom($aConfiguration, $row["APP_MSG_FROM"]);
$this->setData( $row["APP_MSG_UID"], $row["APP_MSG_SUBJECT"], $sFrom, $row["APP_MSG_TO"], $row["APP_MSG_BODY"], date( "Y-m-d H:i:s" ), $row["APP_MSG_CC"], $row["APP_MSG_BCC"], $row["APP_MSG_TEMPLATE"], $row["APP_MSG_ATTACH"] );
$this->sendMail();
} catch (Exception $e) {
$strAux = "Spool::resendEmails(): Using " . $aConfiguration["MESS_ENGINE"] . " for APP_MGS_UID=" . $row["APP_MSG_UID"] . " -> With message: " . $e->getMessage();
if ($e->getCode() == $this->ExceptionCode["WARNING"]) {
array_push( $this->aWarnings, $strAux );
continue;
} else {
throw $e;
}
}
}
}
}
示例5: sendNoteNotification
public function sendNoteNotification($appUid, $usrUid, $noteContent, $noteRecipients, $sFrom = "")
{
try {
if (!class_exists('System')) {
G::LoadClass('system');
}
$aConfiguration = System::getEmailConfiguration();
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}";
$sFrom = G::buildFrom($aConfiguration, $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();
$oSpool->setConfig($aConfiguration);
$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;
}
}
示例6: md5
$userData = $rbacUser->getByUsername($data['USR_USERNAME']);
if ($userData['USR_EMAIL'] != '' && $userData['USR_EMAIL'] === $data['USR_EMAIL'] && ($userData['USR_AUTH_TYPE'] === '' || $userData['USR_AUTH_TYPE'] == 'MYSQL')) {
$aSetup = System::getEmailConfiguration();
if (count($aSetup) == 0 || !isset($aSetup['MESS_ENGINE'])) {
G::SendTemporalMessage('ID_EMAIL_ENGINE_IS_NOT_ENABLED', "warning");
G::header('location: forgotPassword');
die;
}
$newPass = G::generate_password();
$aData['USR_UID'] = $userData['USR_UID'];
$aData['USR_PASSWORD'] = md5($newPass);
/* **Save after sending the mail
$rbacUser->update($aData);
$user->update($aData);
*/
$sFrom = G::buildFrom($aSetup, $sFrom);
$sSubject = G::LoadTranslation('ID_RESET_PASSWORD') . ' - ProcessMaker';
$msg = '<h3>ProcessMaker Forgot password Service</h3>';
$msg .= '<p>' . G::LoadTranslation('ID_YOUR_USERMANE_IS') . ' : <strong>' . $userData['USR_USERNAME'] . '</strong></p>';
$msg .= '<p>' . G::LoadTranslation('ID_YOUR_PASSWORD_IS') . ' : <strong>' . $newPass . '</strong></p>';
switch ($aSetup['MESS_ENGINE']) {
case 'MAIL':
$engine = G::LoadTranslation('ID_MESS_ENGINE_TYPE_1');
break;
case 'PHPMAILER':
$engine = G::LoadTranslation('ID_MESS_ENGINE_TYPE_2');
break;
case 'OPENMAIL':
$engine = G::LoadTranslation('ID_MESS_ENGINE_TYPE_3');
break;
}
示例7: sendTestMail
/**
* for send email configuration
* @autor Alvaro <alvaro@colosa.com>
*/
public function sendTestMail()
{
global $G_PUBLISH;
G::LoadClass("system");
G::LoadClass('spool');
$aConfiguration = array('MESS_ENGINE' => $_POST['MESS_ENGINE'], 'MESS_SERVER' => $_POST['MESS_SERVER'], 'MESS_PORT' => $_POST['MESS_PORT'], 'MESS_ACCOUNT' => $_POST['MESS_ACCOUNT'], 'MESS_PASSWORD' => $_POST['MESS_PASSWORD'], 'MESS_FROM_NAME' => $_POST["FROM_NAME"], 'MESS_FROM_MAIL' => $_POST["FROM_EMAIL"], 'MESS_RAUTH' => $_POST['MESS_RAUTH'], 'SMTPSecure' => isset($_POST['SMTPSecure']) ? $_POST['SMTPSecure'] : 'none');
$sFrom = G::buildFrom($aConfiguration);
$sSubject = G::LoadTranslation('ID_MESS_TEST_SUBJECT');
$msg = G::LoadTranslation('ID_MESS_TEST_BODY');
switch ($_POST['MESS_ENGINE']) {
case 'MAIL':
$engine = G::LoadTranslation('ID_MESS_ENGINE_TYPE_1');
break;
case 'PHPMAILER':
$engine = G::LoadTranslation('ID_MESS_ENGINE_TYPE_2');
break;
case 'OPENMAIL':
$engine = G::LoadTranslation('ID_MESS_ENGINE_TYPE_3');
break;
}
$sBodyPre = new TemplatePower(PATH_TPL . 'admin' . PATH_SEP . 'email.tpl');
$sBodyPre->prepare();
$sBodyPre->assign('server', $_SERVER['SERVER_NAME']);
$sBodyPre->assign('date', date('H:i:s'));
$sBodyPre->assign('ver', System::getVersion());
$sBodyPre->assign('engine', $engine);
$sBodyPre->assign('msg', $msg);
$sBody = $sBodyPre->getOutputContent();
$oSpool = new spoolRun();
$oSpool->setConfig($aConfiguration);
$oSpool->create(array('msg_uid' => '', 'app_uid' => '', 'del_index' => 0, 'app_msg_type' => 'TEST', 'app_msg_subject' => $sSubject, 'app_msg_from' => $sFrom, 'app_msg_to' => $_POST['TO'], 'app_msg_body' => $sBody, 'app_msg_cc' => '', 'app_msg_bcc' => '', 'app_msg_attach' => '', 'app_msg_template' => '', 'app_msg_status' => 'pending', 'app_msg_attach' => ''));
$oSpool->sendMail();
$G_PUBLISH = new Publisher();
$o = new stdclass();
if ($oSpool->status == 'sent') {
$o->status = true;
$o->success = true;
$o->msg = G::LoadTranslation('ID_MAIL_TEST_SUCCESS');
} else {
$o->status = false;
$o->success = false;
$o->msg = $oSpool->error;
}
return $o;
}
示例8: sendNotifications
public function sendNotifications($taskUid, $arrayTask, $arrayData, $applicationUid, $delIndex, $from = '')
{
try {
$arrayApplicationData = $this->loadCase($applicationUid);
$arrayData['APP_NUMBER'] = $arrayApplicationData['APP_NUMBER'];
if (!class_exists('System')) {
G::LoadClass('system');
}
$aConfiguration = System::getEmailConfiguration();
$msgError = "";
if (!isset($aConfiguration['MESS_ENABLED']) || $aConfiguration['MESS_ENABLED'] != '1') {
$msgError = "The default configuration wasn't defined";
$aConfiguration['MESS_ENGINE'] = '';
}
//Send derivation notification - Start
$oTask = new Task();
$aTaskInfo = $oTask->load($taskUid);
if ($aTaskInfo['TAS_SEND_LAST_EMAIL'] != 'TRUE') {
return false;
}
$from = G::buildFrom($aConfiguration, $from);
if (isset($aTaskInfo['TAS_DEF_SUBJECT_MESSAGE']) && $aTaskInfo['TAS_DEF_SUBJECT_MESSAGE'] != '') {
$sSubject = G::replaceDataField($aTaskInfo['TAS_DEF_SUBJECT_MESSAGE'], $arrayData);
} 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)) {
$tempale = PATH_CORE . "templates" . PATH_SEP . "mails" . PATH_SEP . "alert_message.html";
$copied = @copy($tempale, $fileTemplate);
if ($copied) {
$dataTemplate = array("prf_filename" => $conf["TAS_DEF_MESSAGE_TEMPLATE"], "prf_path" => $fileTemplate, "pro_uid" => $aTaskInfo["PRO_UID"], "usr_uid" => "00000000000000000000000000000001", "prf_uid" => G::generateUniqueID(), "prf_type" => "file", "prf_create_date" => date("Y-m-d H:i:s"));
$filesManager = new ProcessMaker\BusinessModel\FilesManager();
$filesManager->addProcessFilesManagerInDb($dataTemplate);
} else {
throw new Exception("Template file \"{$fileTemplate}\" does not exist.");
}
}
$sBody = file_get_contents($fileTemplate);
} else {
$sBody = nl2br($aTaskInfo['TAS_DEF_MESSAGE']);
}
G::LoadClass("tasks");
G::LoadClass("groups");
G::LoadClass("spool");
$task = new Tasks();
$group = new Groups();
$oUser = new Users();
foreach ($arrayTask as $aTask) {
$sTo = null;
$sCc = null;
if (isset($aTask['DEL_INDEX'])) {
$arrayData2 = $arrayData;
$appDelegation = AppDelegationPeer::retrieveByPK($applicationUid, $aTask['DEL_INDEX']);
if (!is_null($appDelegation)) {
$arrayData2['TAS_TITLE'] = Content::load('TAS_TITLE', '', $appDelegation->getTasUid(), SYS_LANG);
$arrayData2['DEL_TASK_DUE_DATE'] = $appDelegation->getDelTaskDueDate();
}
} else {
$arrayData2 = $arrayData;
}
if (isset($aTask['USR_UID']) && !empty($aTask['USR_UID'])) {
$user = new \ProcessMaker\BusinessModel\User();
$arrayUserData = $user->getUser($aTask['USR_UID'], true);
$arrayData2 = \ProcessMaker\Util\DateTime::convertUtcToTimeZone($arrayData2, trim($arrayUserData['USR_TIME_ZONE']) != '' ? trim($arrayUserData['USR_TIME_ZONE']) : \ProcessMaker\Util\System::getTimeZone());
} else {
$arrayData2 = \ProcessMaker\Util\DateTime::convertUtcToTimeZone($arrayData2);
}
$sBody2 = G::replaceDataGridField($sBody, $arrayData2, false);
switch ($aTask["TAS_ASSIGN_TYPE"]) {
case "SELF_SERVICE":
if ($swtplDefault == 1) {
G::verifyPath($pathEmail, true);
//Create if it does not exist
$fileTemplate = $pathEmail . G::LoadTranslation('ID_UNASSIGNED_MESSAGE');
if (!file_exists($fileTemplate) && file_exists(PATH_TPL . "mails" . PATH_SEP . G::LoadTranslation('ID_UNASSIGNED_MESSAGE'))) {
@copy(PATH_TPL . "mails" . PATH_SEP . G::LoadTranslation('ID_UNASSIGNED_MESSAGE'), $fileTemplate);
}
$sBody2 = G::replaceDataField(file_get_contents($fileTemplate), $arrayData2);
}
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"];
}
//.........这里部分代码省略.........