public function getAssetPointers() { $assetPointers = parent::getAssetPointers(); $editor = Editor::getActive(); foreach ((array) $editor->getConversationEditorAssetPointers() as $assetPointer) { $assetPointers[] = $assetPointer; } return $assetPointers; }
<?php defined('C5_EXECUTE') or die("Access Denied."); ?> <?php if (!is_array($messages)) { $messages = array(); } $u = new User(); $ui = UserInfo::getByID($u->getUserID()); $page = Page::getByID($cID); $editor = \Concrete\Core\Conversation\Editor\Editor::getActive(); $editor->setConversationObject($args['conversation']); $val = Loader::helper('validation/token'); $form = Loader::helper('form'); ?> <?php if ($displayForm && $displayPostingForm != 'bottom') { ?> <h4><?php echo $addMessageLabel; ?> </h4> <?php if ($enablePosting) { ?> <div class="ccm-conversation-add-new-message" rel="main-reply-form">
public static function add(\Concrete\Core\Conversation\Conversation $cnv, Author $author, $cnvMessageSubject, $cnvMessageBody, $parentMessage = false) { $db = Loader::db(); $date = Loader::helper('date')->getOverridableNow(); $uID = 0; $user = $author->getUser(); $cnvMessageAuthorName = $author->getName(); $cnvMessageAuthorEmail = $author->getEmail(); $cnvMessageAuthorWebsite = $author->getWebsite(); if (is_object($user)) { $uID = $user->getUserID(); } $cnvMessageParentID = 0; $cnvMessageLevel = 0; if (is_object($parentMessage)) { $cnvMessageParentID = $parentMessage->getConversationMessageID(); $cnvMessageLevel = $parentMessage->getConversationMessageLevel() + 1; } $cnvID = 0; if ($cnv instanceof Conversation) { $cnvID = $cnv->getConversationID(); } $editor = ConversationEditor::getActive(); $cnvEditorID = $editor->getConversationEditorID(); /** @var \Concrete\Core\Permission\IPService $iph */ $iph = Core::make('helper/validation/ip'); $ip = $iph->getRequestIP(); $r = $db->Execute('insert into ConversationMessages (cnvMessageSubject, cnvMessageBody, cnvMessageDateCreated, cnvMessageParentID, cnvEditorID, cnvMessageLevel, cnvID, uID, cnvMessageAuthorName, cnvMessageAuthorEmail, cnvMessageAuthorWebsite, cnvMessageSubmitIP, cnvMessageSubmitUserAgent) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)', array($cnvMessageSubject, $cnvMessageBody, $date, $cnvMessageParentID, $cnvEditorID, $cnvMessageLevel, $cnvID, $uID, $cnvMessageAuthorName, $cnvMessageAuthorEmail, $cnvMessageAuthorWebsite, $ip === false ? '' : $ip->getIp(), $_SERVER['HTTP_USER_AGENT'])); $cnvMessageID = $db->Insert_ID(); $message = static::getByID($cnvMessageID); $event = new MessageEvent($message); Events::dispatch('on_new_conversation_message', $event); if ($cnv instanceof \Concrete\Core\Conversation\Conversation) { $cnv->updateConversationSummary(); $users = $cnv->getConversationUsersToEmail(); $c = $cnv->getConversationPageObject(); if (is_object($c)) { $formatter = new AuthorFormatter($author); $cnvMessageBody = html_entity_decode($cnvMessageBody, ENT_QUOTES, APP_CHARSET); foreach ($users as $ui) { $mail = Core::make('mail'); $mail->to($ui->getUserEmail()); $mail->addParameter('title', $c->getCollectionName()); $mail->addParameter('link', $c->getCollectionLink(true)); $mail->addParameter('poster', $formatter->getDisplayName()); $mail->addParameter('body', Core::make('helper/text')->prettyStripTags($cnvMessageBody)); $mail->load('new_conversation_message'); $mail->sendMail(); } } } return static::getByID($cnvMessageID); }