本文整理匯總了PHP中PH7\Form::duplicateContentMsg方法的典型用法代碼示例。如果您正苦於以下問題:PHP Form::duplicateContentMsg方法的具體用法?PHP Form::duplicateContentMsg怎麽用?PHP Form::duplicateContentMsg使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類PH7\Form
的用法示例。
在下文中一共展示了Form::duplicateContentMsg方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: __construct
public function __construct()
{
parent::__construct();
$oCommentModel = new CommentModel();
$sComment = $this->httpRequest->post('comment');
$sCurrentTime = $this->dateTime->get()->dateTime('Y-m-d H:i:s');
$iTimeDelay = (int) DbConfig::getSetting('timeDelaySendComment');
$sTable = $this->httpRequest->get('table');
$iRecipientId = $this->httpRequest->get('recipient', 'int');
$iSenderId = (int) $this->session->get('member_id');
if (!$oCommentModel->idExists($iRecipientId, $sTable)) {
\PFBC\Form::setError('form_comment', t('The comment recipient does not exists.'));
} elseif (!$oCommentModel->checkWaitSend($iSenderId, $iTimeDelay, $sCurrentTime, $sTable)) {
\PFBC\Form::setError('form_comment', Form::waitWriteMsg($iTimeDelay));
} elseif ($oCommentModel->isDuplicateContent($iSenderId, $sComment, $sTable)) {
\PFBC\Form::setError('form_comment', Form::duplicateContentMsg());
} else {
if (!$oCommentModel->add($sComment, $iRecipientId, $iSenderId, 1, $sCurrentTime, $sTable)) {
\PFBC\Form::setError('form_comment', t('Oops! Error when adding comment.'));
} else {
/* Clean All Data of CommentModel Cache */
(new Framework\Cache\Cache())->start(CommentCoreModel::CACHE_GROUP, null, null)->clear();
HeaderUrl::redirect(Uri::get('comment', 'comment', 'read', $sTable . ',' . $iRecipientId), t('The comment has been sent successfully!'));
}
}
unset($oCommentModel);
}
示例2: __construct
public function __construct()
{
parent::__construct();
$oForumModel = new ForumModel();
$sMessage = $this->httpRequest->post('message', Http::ONLY_XSS_CLEAN);
$sCurrentTime = $this->dateTime->get()->dateTime('Y-m-d H:i:s');
$iTimeDelay = (int) DbConfig::getSetting('timeDelaySendForumTopic');
$iProfileId = (int) $this->session->get('member_id');
$iForumId = $this->httpRequest->get('forum_id', 'int');
if (!$oForumModel->checkWaitTopic($iProfileId, $iTimeDelay, $sCurrentTime)) {
\PFBC\Form::setError('form_msg', Form::waitWriteMsg($iTimeDelay));
} elseif ($oForumModel->isDuplicateTopic($iProfileId, $sMessage)) {
\PFBC\Form::setError('form_msg', Form::duplicateContentMsg());
} else {
$oForumModel->addTopic($iProfileId, $iForumId, $this->httpRequest->post('title'), $sMessage, $sCurrentTime);
Header::redirect(Uri::get('forum', 'forum', 'post', $this->httpRequest->get('forum_name') . ',' . $iForumId . ',' . $this->httpRequest->post('title') . ',' . Db::getInstance()->lastInsertId()), t('Your message has been added successfully!'));
}
unset($oForumModel);
}
示例3: __construct
public function __construct()
{
parent::__construct();
$oUserModel = new UserCoreModel();
$oMailModel = new MailModel();
$bIsAdmin = AdminCore::auth() && !UserCore::auth() && !$this->session->exists('login_user_as');
$sMessage = $this->httpRequest->post('message', Http::ONLY_XSS_CLEAN);
$sCurrentTime = $this->dateTime->get()->dateTime('Y-m-d H:i:s');
$iTimeDelay = (int) DbConfig::getSetting('timeDelaySendMail');
$sRecipient = $this->httpRequest->post('recipient');
$iRecipientId = $oUserModel->getId(null, $sRecipient);
$iSenderId = (int) ($bIsAdmin ? PH7_ADMIN_ID : $this->session->get('member_id'));
if ($iSenderId == $iRecipientId) {
\PFBC\Form::setError('form_compose_mail', t('Oops! You can not send a message to yourself.'));
} elseif ($sRecipient == PH7_ADMIN_USERNAME) {
\PFBC\Form::setError('form_compose_mail', t('Oops! You cannot reply to administrator! If you want to contact us, please use our <a href="%0%">contact form</a>.', Uri::get('contact', 'contact', 'index')));
} elseif (!(new ExistsCoreModel())->id($iRecipientId, 'Members')) {
\PFBC\Form::setError('form_compose_mail', t('Oops! The username "%0%" does not exist.', escape(substr($this->httpRequest->post('recipient'), 0, PH7_MAX_USERNAME_LENGTH), true)));
} elseif (!$bIsAdmin && !$oMailModel->checkWaitSend($iSenderId, $iTimeDelay, $sCurrentTime)) {
\PFBC\Form::setError('form_compose_mail', Form::waitWriteMsg($iTimeDelay));
} elseif (!$bIsAdmin && $oMailModel->isDuplicateContent($iSenderId, $sMessage)) {
\PFBC\Form::setError('form_compose_mail', Form::duplicateContentMsg());
} else {
$mSendMsg = $oMailModel->sendMsg($iSenderId, $iRecipientId, $this->httpRequest->post('title'), $sMessage, $sCurrentTime);
if (false === $mSendMsg) {
\PFBC\Form::setError('form_compose_mail', t('Problem while sending the message. Please try again later.'));
} else {
// If the notification is accepted and the message recipient isn't connected NOW, we send a message.
if (!$oUserModel->isNotification($iRecipientId, 'newMsg') && $oUserModel->isOnline($iRecipientId, 0)) {
$this->view->content = t('Hello %0%!<br />You have received a new message from <strong>%1%</strong>.<br /> <a href="%2%">Click here</a> to read your message.', $this->httpRequest->post('recipient'), $this->session->get('member_username'), Uri::get('mail', 'main', 'inbox', $mSendMsg));
$sRecipientEmail = $oUserModel->getEmail($iRecipientId);
$sMessageHtml = $this->view->parseMail(PH7_PATH_SYS . 'global/' . PH7_VIEWS . PH7_TPL_NAME . '/mail/sys/mod/mail/new_msg.tpl', $sRecipientEmail);
$aInfo = ['to' => $sRecipientEmail, 'subject' => t('New private message from %0% on %site_name%', $this->session->get('member_first_name'))];
(new Mail())->send($aInfo, $sMessageHtml);
}
$sUrl = $bIsAdmin ? Uri::get(PH7_ADMIN_MOD, 'user', 'browse') : Uri::get('mail', 'main', 'index');
Header::redirect($sUrl, t('Your message has been sent successfully!'));
}
unset($oUserModel, $oMailModel);
}
}