public function formatConversationMessageBody($cnv, $cnvMessageBody, $config = array()) { /** @var \Concrete\Core\Utility\Service\Text $text */ $text = Core::make('helper/text'); $formatted = nl2br($text->entities($cnvMessageBody)); return parent::formatConversationMessageBody($cnv, $formatted, $config); }
public function exportAll() { $this->x = $this->getXMLRoot(); // First, attribute categories AttributeKeyCategory::exportList($this->x); // Features Feature::exportList($this->x); FeatureCategory::exportList($this->x); ConversationEditor::exportList($this->x); ConversationRatingType::exportList($this->x); // composer PageTypePublishTargetType::exportList($this->x); PageTypeComposerControlType::exportList($this->x); PageType::exportList($this->x); // attribute types AttributeType::exportList($this->x); // then block types BlockTypeList::exportList($this->x); // now block type sets (including user) BlockTypeSet::exportList($this->x); // gathering GatheringDataSource::exportList($this->x); GatheringItemTemplate::exportList($this->x); // now attribute keys (including user) AttributeKey::exportList($this->x); // now attribute keys (including user) AttributeSet::exportList($this->x); PageTemplate::exportList($this->x); // now theme PageTheme::exportList($this->x); // now packages PackageList::export($this->x); // permission access entity types PermissionAccessEntityType::exportList($this->x); // now task permissions PermissionKey::exportList($this->x); // workflow types WorkflowType::exportList($this->x); // now jobs Job::exportList($this->x); // now single pages $singlepages = $this->x->addChild("singlepages"); $db = Loader::db(); $r = $db->Execute('select cID from Pages where cFilename is not null and cFilename <> "" and cID not in (select cID from Stacks) order by cID asc'); while ($row = $r->FetchRow()) { $pc = Page::getByID($row['cID'], 'RECENT'); $pc->export($singlepages); } // now stacks/global areas StackList::export($this->x); // now content pages $this->exportPages($this->x); SystemCaptchaLibrary::exportList($this->x); \Concrete\Core\Sharing\SocialNetwork\Link::exportList($this->x); \Concrete\Core\Page\Feed::exportList($this->x); \Concrete\Core\File\Image\Thumbnail\Type\Type::exportList($this->x); Tree::exportList($this->x); }
public function getAssetPointers() { $assetPointers = parent::getAssetPointers(); $editor = Editor::getActive(); foreach ((array) $editor->getConversationEditorAssetPointers() as $assetPointer) { $assetPointers[] = $assetPointer; } return $assetPointers; }
public function getResults(Request $request) { $list = Editor::getList(); $items = array(); foreach ($list as $t) { $item = new \PortlandLabs\Concrete5\MigrationTool\Entity\Export\ConversationEditor(); $item->setItemId($t->getConversationEditorID()); $items[] = $item; } return $items; }
public function import(\SimpleXMLElement $sx) { if (isset($sx->conversationeditors)) { foreach ($sx->conversationeditors->editor as $th) { $pkg = static::getPackageObject($th['package']); $ce = Editor::add((string) $th['handle'], (string) $th['name'], $pkg); if ($th['activated'] == '1') { $ce->activate(); } } } }
public function execute(Batch $batch) { $editors = $batch->getObjectCollection('conversation_editor'); if ($editors) { foreach ($editors->getEditors() as $editor) { if (!$editor->getPublisherValidator()->skipItem()) { $pkg = null; if ($editor->getPackage()) { $pkg = \Package::getByHandle($editor->getPackage()); } $ce = Editor::add($editor->getHandle(), $editor->getName(), $pkg); if ($editor->getIsActive()) { $ce->activate(); } } } } $types = $batch->getObjectCollection('conversation_flag_type'); if ($types) { foreach ($types->getTypes() as $type) { if (!$type->getPublisherValidator()->skipItem()) { $pkg = null; if ($type->getPackage()) { $pkg = \Package::getByHandle($type->getPackage()); } $ce = \Concrete\Core\Conversation\FlagType\FlagType::add($type->getHandle()); } } } $types = $batch->getObjectCollection('conversation_rating_type'); if ($types) { foreach ($types->getTypes() as $type) { if (!$type->getPublisherValidator()->skipItem()) { $pkg = null; if ($type->getPackage()) { $pkg = \Package::getByHandle($type->getPackage()); } \Concrete\Core\Conversation\Rating\Type::add($type->getHandle(), $type->getName(), $type->getPoints(), $pkg); } } } }
$vs = Loader::helper('validation/strings'); $ve = Loader::helper('validation/error'); $as = Loader::helper('validation/antispam'); $pageObj = Page::getByID($_POST['cID']); $areaObj = Area::get($pageObj, $_POST['blockAreaHandle']); $blockObj = Block::getByID($_POST['bID'], $pageObj, $areaObj); $form = Loader::helper('form'); $u = new User(); $ui = UserInfo::getByID($u->getUserID()); $val = Loader::helper('validation/token'); if (Loader::helper('validation/numbers')->integer($_POST['cnvMessageID']) && $_POST['cnvMessageID'] > 0) { $message = ConversationMessage::getByID($_POST['cnvMessageID']); if (is_object($message)) { $mp = new Permissions($message); if ($mp->canEditConversationMessage()) { $editor = \Concrete\Core\Conversation\Editor\Editor::getByID($message->getConversationEditorID()); $editor->setConversationMessageObject($message); if (is_object($conversation)) { if ($conversation->getConversationAttachmentOverridesEnabled() > 0) { $attachmentsEnabled = $conversation->getConversationAttachmentsEnabled(); } else { $attachmentsEnabled = Config::get('conversations.attachments_enabled'); } } ?> <div class="ccm-conversation-edit-message" data-conversation-message-id="<?php echo $message->getConversationMessageID(); ?> "> <form method="post" class="aux-reply-form">
<?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">
/** * Returns an array of package items (e.g. blocks, themes) */ public function getPackageItems() { $items = array(); $items['attribute_categories'] = AttributeKeyCategory::getListByPackage($this); $items['permission_categories'] = PermissionKeyCategory::getListByPackage($this); $items['permission_access_entity_types'] = PermissionAccessEntityType::getListByPackage($this); $items['attribute_keys'] = AttributeKey::getListByPackage($this); $items['attribute_sets'] = AttributeSet::getListByPackage($this); $items['group_sets'] = GroupSet::getListByPackage($this); $items['page_types'] = PageType::getListByPackage($this); $items['page_templates'] = PageTemplate::getListByPackage($this); $items['mail_importers'] = MailImporter::getListByPackage($this); $items['gathering_item_template_types'] = GatheringItemTemplateType::getListByPackage($this); $items['gathering_item_templates'] = GatheringItemTemplate::getListByPackage($this); $items['gathering_data_sources'] = GatheringDataSource::getListByPackage($this); $items['features'] = Feature::getListByPackage($this); $items['feature_categories'] = FeatureCategory::getListByPackage($this); $btl = new BlockTypeList(); $btl->filterByPackage($this); $blocktypes = $btl->get(); $items['block_types'] = $blocktypes; $items['block_type_sets'] = BlockTypeSet::getListByPackage($this); $items['page_themes'] = PageTheme::getListByPackage($this); $items['permissions'] = PermissionKey::getListByPackage($this); $items['single_pages'] = SinglePage::getListByPackage($this); $items['attribute_types'] = AttributeType::getListByPackage($this); $items['captcha_libraries'] = SystemCaptchaLibrary::getListByPackage($this); $items['content_editor_snippets'] = SystemContentEditorSnippet::getListByPackage($this); $items['conversation_editors'] = ConversationEditor::getListByPackage($this); $items['conversation_rating_types'] = ConversationRatingType::getListByPackage($this); $items['page_type_publish_target_types'] = PageTypePublishTargetType::getListByPackage($this); $items['page_type_composer_control_types'] = PageTypeComposerControlType::getListByPackage($this); $items['antispam_libraries'] = SystemAntispamLibrary::getListByPackage($this); $items['community_point_actions'] = UserPointAction::getListByPackage($this); $items['jobs'] = Job::getListByPackage($this); $items['workflow_types'] = WorkflowType::getListByPackage($this); ksort($items); return $items; }
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); }
public function formatConversationMessageBody($cnv, $cnvMessageBody, $config = array()) { $md = Markdown::defaultTransform(Core::make('helper/text')->entities($cnvMessageBody)); $formatted = str_replace(array('&lt', '&gt'), array('<', '>'), $md); return parent::formatConversationMessageBody($cnv, $formatted, $config); }
public function formatConversationMessageBody($cnv, $cnvMessageBody, $config = array('htmlawed' => true)) { return parent::formatConversationMessageBody($cnv, $cnvMessageBody, $config); }
public function setPropertiesFromArray($arr) { return parent::setPropertiesFromArray($arr); }
public function skipItem() { $editor = Editor::getByHandle($this->object->getHandle()); return is_object($editor); }