Ejemplo n.º 1
0
 public function onReply($href = NULL)
 {
     $form = $this->formReply($href);
     if (false !== ($error = $form->validate($this->module))) {
         return $error . $this->templateReply($href);
     }
     $user = GWF_Session::getUser();
     $uid = $user === false ? '0' : $user->getID();
     $options = 0;
     $options |= isset($_POST['showmail']) ? GWF_Comment::SHOW_EMAIL : 0;
     //		$options |= $this->module->cfgModerated() ? 0 : GWF_Comment::VISIBLE;
     $comment = new GWF_Comment(array('cmt_id' => 0, 'cmt_pid' => $_POST['cmt_id'], 'cmt_cid' => $_POST['cmts_id'], 'cmt_uid' => $uid, 'cmt_username' => isset($_POST['username']) ? $_POST['username'] : '', 'cmt_www' => $_POST['www'], 'cmt_mail' => $_POST['email'], 'cmt_date' => GWF_Time::getDate(GWF_Date::LEN_SECOND), 'cmt_message' => $_POST['message'], 'cmt_options' => $options, 'cmt_thx' => 0, 'cmt_up' => 0, 'cmt_down' => 0));
     if (false === $comment->insert()) {
         return GWF_HTML::err('ERR_DATABASE', array(__FILE__, __LINE__));
     }
     if ($this->module->cfgModerated()) {
         return $this->onSendModerateMail($user, $comment);
     } else {
         if (false === $comment->onVisible(true)) {
             return GWF_HTML::err('ERR_DATABASE', array(__FILE__, __LINE__));
         }
         return $this->onSendCommentedMail($user, $comment);
     }
 }