当前位置: 首页>>代码示例>>PHP>>正文


PHP Form::waitWriteMsg方法代码示例

本文整理汇总了PHP中PH7\Form::waitWriteMsg方法的典型用法代码示例。如果您正苦于以下问题:PHP Form::waitWriteMsg方法的具体用法?PHP Form::waitWriteMsg怎么用?PHP Form::waitWriteMsg使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PH7\Form的用法示例。


在下文中一共展示了Form::waitWriteMsg方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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);
 }
开发者ID:joswilson,项目名称:NotJustOK,代码行数:27,代码来源:CommentFormProcess.php

示例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);
 }
开发者ID:nsrau,项目名称:pH7-Social-Dating-CMS,代码行数:19,代码来源:MsgFormProcess.php

示例3: __construct

 public function __construct()
 {
     parent::__construct();
     $oNote = new Note();
     $oNoteModel = new NoteModel();
     $sCurrentTime = $this->dateTime->get()->dateTime('Y-m-d H:i:s');
     $iProfileId = $this->session->get('member_id');
     $iTimeDelay = (int) DbConfig::getSetting('timeDelaySendNote');
     if (!$oNote->checkPostId($this->httpRequest->post('post_id'), $iProfileId)) {
         \PFBC\Form::setError('form_note', t('The ID of the article is invalid or incorrect.'));
     } elseif (!$oNoteModel->checkWaitSend($this->session->get('member_id'), $iTimeDelay, $sCurrentTime)) {
         \PFBC\Form::setError('form_note', Form::waitWriteMsg($iTimeDelay));
     } else {
         $iApproved = DbConfig::getSetting('noteManualApproval') == 0 ? '1' : '0';
         $aData = ['profile_id' => $iProfileId, 'post_id' => $this->httpRequest->post('post_id'), 'lang_id' => $this->httpRequest->post('lang_id'), 'title' => $this->httpRequest->post('title'), 'content' => $this->httpRequest->post('content', Http::ONLY_XSS_CLEAN), 'slogan' => $this->httpRequest->post('slogan'), 'tags' => $this->httpRequest->post('tags'), 'page_title' => $this->httpRequest->post('page_title'), 'meta_description' => $this->httpRequest->post('meta_description'), 'meta_keywords' => $this->httpRequest->post('meta_keywords'), 'meta_robots' => $this->httpRequest->post('meta_robots'), 'meta_author' => $this->httpRequest->post('meta_author'), 'meta_copyright' => $this->httpRequest->post('meta_copyright'), 'enable_comment' => $this->httpRequest->post('enable_comment'), 'created_date' => $sCurrentTime, 'approved' => $iApproved];
         if (!$oNoteModel->addPost($aData)) {
             $this->sMsg = t('An error occurred while adding the article.');
         } else {
             /*** Set the categorie(s) ***/
             /**
              * WARNING: Be careful, you should use the \PH7\Framework\Mvc\Request\Http::ONLY_XSS_CLEAN constant, otherwise the Http::post() method
              * removes the special tags and damages the SQL queries for entry into the database.
              */
             if (count($this->httpRequest->post('category_id', Http::ONLY_XSS_CLEAN)) > 3) {
                 \PFBC\Form::setError('form_note', t('You can not select more than 3 categories.'));
                 return;
                 // Stop execution of the method.
             }
             $iNoteId = Db::getInstance()->lastInsertId();
             foreach ($this->httpRequest->post('category_id', Http::ONLY_XSS_CLEAN) as $iCategoryId) {
                 $oNoteModel->addCategory($iCategoryId, $iNoteId, $iProfileId);
             }
             /*** Set the thumbnail if there's one ***/
             $oPost = $oNoteModel->readPost($aData['post_id'], $iProfileId, null);
             $oNote->setThumb($oPost, $oNoteModel, $this->file);
             /* Clean NoteModel Cache */
             (new Framework\Cache\Cache())->start(NoteModel::CACHE_GROUP, null, null)->clear();
             $this->sMsg = $iApproved == '0' ? t('Your Note has been received! But it will be visible once approved by our moderators. Please do not send a new Note because this is useless!') : t('Post created successfully!');
         }
         Header::redirect(Uri::get('note', 'main', 'read', $this->session->get('member_username') . ',' . $this->httpRequest->post('post_id')), $this->sMsg);
     }
 }
开发者ID:nsrau,项目名称:pH7-Social-Dating-CMS,代码行数:42,代码来源:NoteFormProcess.php

示例4: __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);
     }
 }
开发者ID:huangciyin,项目名称:pH7-Social-Dating-CMS,代码行数:41,代码来源:MailFormProcess.php


注:本文中的PH7\Form::waitWriteMsg方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。