if (!Loader::helper('validation/token')->validate('add_conversation_message', $_POST['token'])) { $ve->add(t('Invalid conversation post token.')); } if (!$vs->notempty($_POST['cnvMessageBody'])) { $ve->add(t('Your message cannot be empty.')); } if (Loader::helper('validation/numbers')->integer($_POST['cnvMessageParentID']) && $_POST['cnvMessageParentID'] > 0) { $parent = ConversationMessage::getByID($_POST['cnvMessageParentID']); if (!is_object($parent)) { $ve->add(t('Invalid parent message.')); } } if (Config::get('conversation.banned_words') && Loader::helper('validation/banned_words')->hasBannedWords($_POST['cnvMessageBody'])) { $ve->add(t('Banned words detected.')); } if ($ve->has()) { $ax->sendError($ve); } else { $msg = ConversationMessage::add($cn, $cnvMessageSubject, $_POST['cnvMessageBody'], $parent); if (!Loader::helper('validation/antispam')->check($_POST['cnvMessageBody'], 'conversation_comment')) { $msg->flag(ConversationFlagType::getByHandle('spam')); } else { $msg->approve(); } if ($_POST['attachments'] && count($_POST['attachments'])) { foreach ($_POST['attachments'] as $attachmentID) { $msg->attachFile(File::getByID($attachmentID)); } } $ax->sendResult($msg); }