本文整理汇总了PHP中erLhcoreClassTemplate::set方法的典型用法代码示例。如果您正苦于以下问题:PHP erLhcoreClassTemplate::set方法的具体用法?PHP erLhcoreClassTemplate::set怎么用?PHP erLhcoreClassTemplate::set使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类erLhcoreClassTemplate
的用法示例。
在下文中一共展示了erLhcoreClassTemplate::set方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: validateSendMail
public static function validateSendMail(erLhAbstractModelEmailTemplate &$sendMail, &$chat, $params = array())
{
$Errors = array();
$validationFields = array();
$validationFields['Message'] = new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'unsafe_raw');
$validationFields['Subject'] = new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'unsafe_raw');
$validationFields['FromName'] = new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'unsafe_raw');
$validationFields['FromEmail'] = new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'validate_email');
$validationFields['ReplyEmail'] = new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'validate_email');
$validationFields['RecipientEmail'] = new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'validate_email');
$form = new ezcInputForm(INPUT_POST, $validationFields);
$Errors = array();
if (isset($params['archive_mode']) && $params['archive_mode'] == true) {
$messages = array_reverse(erLhcoreClassChat::getList(array('limit' => 100, 'sort' => 'id DESC', 'filter' => array('chat_id' => $chat->id)), 'erLhcoreClassModelChatArchiveMsg', erLhcoreClassModelChatArchiveRange::$archiveMsgTable));
} else {
$messages = array_reverse(erLhcoreClassModelmsg::getList(array('limit' => 100, 'sort' => 'id DESC', 'filter' => array('chat_id' => $chat->id))));
}
// Fetch chat messages
$tpl = new erLhcoreClassTemplate('lhchat/messagelist/plain.tpl.php');
$tpl->set('chat', $chat);
$tpl->set('messages', $messages);
$sendMail->content = str_replace(array('{user_chat_nick}', '{messages_content}'), array($chat->nick, $tpl->fetch()), $sendMail->content);
if ($form->hasValidData('Message')) {
$sendMail->content = str_replace('{additional_message}', $form->Message, $sendMail->content);
}
$sendMail->content = erLhcoreClassBBCode::parseForMail($sendMail->content);
if ($form->hasValidData('FromEmail')) {
$sendMail->from_email = $form->FromEmail;
}
if ($form->hasValidData('ReplyEmail')) {
$sendMail->reply_to = $form->ReplyEmail;
}
if ($form->hasValidData('FromName')) {
$sendMail->from_name = $form->FromName;
}
if ($form->hasValidData('Subject')) {
$sendMail->subject = $form->Subject;
}
if ($form->hasValidData('RecipientEmail')) {
$sendMail->recipient = $form->RecipientEmail;
} else {
$Errors[] = erTranslationClassLhTranslation::getInstance()->getTranslation('chat/sendmail', 'Please enter recipient e-mail!');
}
if (empty($sendMail->from_email)) {
$Errors[] = erTranslationClassLhTranslation::getInstance()->getTranslation('chat/sendmail', 'From e-mail is missing!');
}
if (empty($sendMail->reply_to)) {
$Errors[] = erTranslationClassLhTranslation::getInstance()->getTranslation('chat/sendmail', 'Reply e-mail is missing!');
}
if (empty($sendMail->subject)) {
$Errors[] = erTranslationClassLhTranslation::getInstance()->getTranslation('chat/sendmail', 'Subject is missing!');
}
return $Errors;
}
示例2: array
$Errors = array();
if (!$form->hasValidData('email')) {
$Errors[] = erTranslationClassLhTranslation::getInstance()->getTranslation('user/edit', 'Wrong email address');
}
if (!isset($_SERVER['HTTP_X_CSRFTOKEN']) || !isset($_POST['csfr_token']) || $_POST['csfr_token'] != $_SERVER['HTTP_X_CSRFTOKEN']) {
$Errors[] = erTranslationClassLhTranslation::getInstance()->getTranslation('user/edit', 'Invalid CSRF token!');
}
if (empty($Errors)) {
$tpl = erLhcoreClassTemplate::getInstance('lhchat/sendmail.tpl.php');
$mailTemplate = erLhAbstractModelEmailTemplate::fetch(3);
erLhcoreClassChatMail::prepareSendMail($mailTemplate);
$mailTemplate->recipient = $form->email;
$messages = array_reverse(erLhcoreClassModelmsg::getList(array('customfilter' => array('user_id != -1'), 'limit' => 500, 'sort' => 'id DESC', 'filter' => array('chat_id' => $chat->id))));
// Fetch chat messages
$tpl = new erLhcoreClassTemplate('lhchat/messagelist/plain.tpl.php');
$tpl->set('chat', $chat);
$tpl->set('messages', $messages);
$mailTemplate->content = str_replace(array('{user_chat_nick}', '{messages_content}'), array($chat->nick, $tpl->fetch()), $mailTemplate->content);
erLhcoreClassChatMail::sendMail($mailTemplate, $chat);
echo json_encode(array('error' => 'false'));
exit;
} else {
$tpl = erLhcoreClassTemplate::getInstance('lhkernel/validation_error.tpl.php');
$tpl->set('errors', $Errors);
echo json_encode(array('error' => 'true', 'result' => $tpl->fetch()));
exit;
}
} else {
$tpl = erLhcoreClassTemplate::getInstance('lhchat/sendchat.tpl.php');
$tpl->set('chat', $chat);
echo $tpl->fetch();
示例3: catch
} catch (Exception $e) {
$Errors[] = 'Cannot login with provided logins. Returned message: <br/>' . $e->getMessage();
}
}
if (count($Errors) == 0) {
$cfgSite = erConfigClassLhConfig::getInstance();
$cfgSite->setSetting('db', 'host', $form->DatabaseHost);
$cfgSite->setSetting('db', 'user', $form->DatabaseUsername);
$cfgSite->setSetting('db', 'password', $form->DatabasePassword);
$cfgSite->setSetting('db', 'database', $form->DatabaseDatabaseName);
$cfgSite->setSetting('db', 'port', $form->DatabasePort);
$cfgSite->setSetting('site', 'secrethash', substr(md5(time() . ":" . mt_rand()), 0, 10));
$cfgSite->save();
$tpl->setFile('lhinstall/install3.tpl.php');
} else {
$tpl->set('db_username', $form->DatabaseUsername);
$tpl->set('db_password', $form->DatabasePassword);
$tpl->set('db_host', $form->DatabaseHost);
$tpl->set('db_port', $form->DatabasePort);
$tpl->set('db_name', $form->DatabaseDatabaseName);
$tpl->set('errors', $Errors);
$tpl->setFile('lhinstall/install2.tpl.php');
}
break;
case '3':
$Errors = array();
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
$definition = array('AdminUsername' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::REQUIRED, 'unsafe_raw'), 'AdminPassword' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::REQUIRED, 'unsafe_raw'), 'AdminPassword1' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::REQUIRED, 'unsafe_raw'), 'AdminEmail' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::REQUIRED, 'validate_email'), 'AdminName' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'unsafe_raw'), 'AdminSurname' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'unsafe_raw'), 'DefaultDepartament' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::REQUIRED, 'string'));
$form = new ezcInputForm(INPUT_POST, $definition);
if (!$form->hasValidData('AdminUsername') || $form->AdminUsername == '') {
$Errors[] = 'Please enter admin username';
示例4: chatExportJSON
public function chatExportJSON(erLhcoreClassModelChat $chat)
{
$tpl = new erLhcoreClassTemplate('lhexport/json.tpl.php');
$tpl->set('chat', $chat);
return $tpl->fetch();
}
示例5: addSMSMessageSend
public function addSMSMessageSend($number)
{
$this->sms_left -= $number;
$this->sms_processed += $number;
if ($this->soft_limit_in_effect == true && $this->soft_warning_send == 0) {
$this->soft_warning_send = 1;
// Send mail to global administrator
$mail = new PHPMailer(true);
$mail->CharSet = "UTF-8";
$mail->Subject = erTranslationClassLhTranslation::getInstance()->getTranslation('instance/edit', 'Instance has reached soft SMS limit') . ' - ' . $this->id;
$mail->AddReplyTo($this->email, (string) $this->address);
$tpl = new erLhcoreClassTemplate();
$tpl->set('instance', $this);
// Remove new line characters
$content = str_replace("\n", "", $tpl->fetch('lhinstance/mail/phone_soft_limit.tpl.php'));
// Replace br with new line characters
$content = str_replace("<br/>", "\n", $content);
$mail->Body = $content;
$mail->AddAddress(erConfigClassLhConfig::getInstance()->getSetting('site', 'support_mail'));
erLhcoreClassChatMail::setupSMTP($mail);
try {
$mail->Send();
} catch (Exception $e) {
}
$mail->ClearAddresses();
// Send mail to instance admin
$mail = new PHPMailer(true);
$mail->CharSet = "UTF-8";
$mail->Subject = erTranslationClassLhTranslation::getInstance()->getTranslation('instance/edit', 'You have reached soft SMS limit');
$mail->AddReplyTo($this->email, (string) $this->address);
$tpl = new erLhcoreClassTemplate();
$tpl->set('instance', $this);
// Remove new line characters
$content = str_replace("\n", "", $tpl->fetch('lhinstance/mail/phone_soft_limit_user.tpl.php'));
// Replace br with new line characters
$content = str_replace("<br/>", "\n", $content);
$mail->Body = $content;
$mail->AddAddress($this->email);
erLhcoreClassChatMail::setupSMTP($mail);
try {
$mail->Send();
} catch (Exception $e) {
}
$mail->ClearAddresses();
}
if ($this->hard_limit_in_effect == true && $this->hard_warning_send == 0) {
$this->hard_warning_send = 1;
// Send mail to global administrator
$mail = new PHPMailer(true);
$mail->CharSet = "UTF-8";
$mail->Subject = erTranslationClassLhTranslation::getInstance()->getTranslation('instance/edit', 'Instance has reached hard SMS limit') . ' - ' . $this->id;
$mail->AddReplyTo($this->email, (string) $this->address);
$tpl = new erLhcoreClassTemplate();
$tpl->set('instance', $this);
// Remove new line characters
$content = str_replace("\n", "", $tpl->fetch('lhinstance/mail/phone_hard_limit.tpl.php'));
// Replace br with new line characters
$content = str_replace("<br/>", "\n", $content);
$mail->Body = $content;
$mail->AddAddress(erConfigClassLhConfig::getInstance()->getSetting('site', 'support_mail'));
erLhcoreClassChatMail::setupSMTP($mail);
try {
$mail->Send();
} catch (Exception $e) {
}
$mail->ClearAddresses();
// Send mail to instance admin
$mail = new PHPMailer(true);
$mail->CharSet = "UTF-8";
$mail->Subject = erTranslationClassLhTranslation::getInstance()->getTranslation('instance/edit', 'You have reached hard SMS limit');
$mail->AddReplyTo($this->email, (string) $this->address);
$tpl = new erLhcoreClassTemplate();
$tpl->set('instance', $this);
// Remove new line characters
$content = str_replace("\n", "", $tpl->fetch('lhinstance/mail/phone_hard_limit_user.tpl.php'));
// Replace br with new line characters
$content = str_replace("<br/>", "\n", $content);
$mail->Body = $content;
$mail->AddAddress($this->email);
erLhcoreClassChatMail::setupSMTP($mail);
try {
$mail->Send();
} catch (Exception $e) {
}
$mail->ClearAddresses();
}
$this->saveToInstanceThis();
}