コード例 #1
0
 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('timeDelaySendForumMsg');
     $iProfileId = (int) $this->session->get('member_id');
     $iForumId = $this->httpRequest->get('forum_id', 'int');
     $iTopicId = $this->httpRequest->get('topic_id', 'int');
     if (!$oForumModel->checkWaitReply($iTopicId, $iProfileId, $iTimeDelay, $sCurrentTime)) {
         \PFBC\Form::setError('form_reply', Form::waitWriteMsg($iTimeDelay));
     } elseif ($oForumModel->isDuplicateMessage($iProfileId, $sMessage)) {
         \PFBC\Form::setError('form_reply', Form::duplicateContentMsg());
     } else {
         $oForumModel->addMessage($iProfileId, $iTopicId, $sMessage, $sCurrentTime);
         Header::redirect(Uri::get('forum', 'forum', 'post', $this->httpRequest->get('forum_name') . ',' . $iForumId . ',' . $this->httpRequest->get('topic_name') . ',' . $iTopicId), t('Your message has been updated successfully!'));
     }
     unset($oForumModel);
 }