/** * @see \wcf\system\option\IOptionType::getFormElement() */ public function getFormElement(Option $option, $value) { $allowedBBCodes = array(); if ($option->allowedbbcodepermission) { $allowedBBCodes = explode(',', WCF::getSession()->getPermission($option->allowedbbcodepermission)); } else { $allowedBBCodes = array_keys(BBCodeCache::getInstance()->getBBCodes()); } BBCodeHandler::getInstance()->setAllowedBBCodes($allowedBBCodes); WCF::getTPL()->assign(array('defaultSmilies' => SmileyCache::getInstance()->getCategorySmilies(), 'option' => $option, 'value' => $value)); return WCF::getTPL()->fetch('messageOptionType'); }
/** * @see \cms\system\content\type\IContentType::getFormTemplate() */ public function getFormTemplate() { // init bbcodes BBCodeHandler::getInstance()->setAllowedBBCodes(explode(',', WCF::getSession()->getPermission('user.message.allowedBBCodes'))); return parent::getFormTemplate(); }
/** * @see \wcf\data\IMessageInlineEditorAction::beginEdit() */ public function beginEdit() { BBCodeHandler::getInstance()->setAllowedBBCodes(explode(',', WCF::getSession()->getPermission('user.message.allowedBBCodes'))); WCF::getTPL()->assign(array('defaultSmilies' => SmileyCache::getInstance()->getCategorySmilies(), 'message' => $this->message, 'permissionCanUseSmilies' => 'user.message.canUseSmilies', 'wysiwygSelector' => 'messageEditor' . $this->message->messageID)); if (MODULE_ATTACHMENT) { $tmpHash = StringUtil::getRandomID(); $attachmentHandler = new AttachmentHandler('com.woltlab.wcf.conversation.message', $this->message->messageID, $tmpHash); $attachmentList = $attachmentHandler->getAttachmentList(); WCF::getTPL()->assign(array('attachmentHandler' => $attachmentHandler, 'attachmentList' => $attachmentList->getObjects(), 'attachmentObjectID' => $this->message->messageID, 'attachmentObjectType' => 'com.woltlab.wcf.conversation.message', 'attachmentParentObjectID' => 0, 'tmpHash' => $tmpHash)); } return array('actionName' => 'beginEdit', 'template' => WCF::getTPL()->fetch('conversationMessageInlineEditor')); }
/** * @see \wcf\page\IPage::readData() */ public function readData() { // get attachments if (MODULE_ATTACHMENT && $this->attachmentObjectType) { $this->attachmentHandler = new AttachmentHandler($this->attachmentObjectType, $this->attachmentObjectID, $this->tmpHash, $this->attachmentParentObjectID); } if (empty($_POST)) { $this->enableBBCodes = ENABLE_BBCODES_DEFAULT_VALUE && WCF::getSession()->getPermission($this->permissionCanUseBBCodes) ? 1 : 0; $this->enableHtml = ENABLE_HTML_DEFAULT_VALUE && WCF::getSession()->getPermission($this->permissionCanUseHtml) ? 1 : 0; $this->enableSmilies = ENABLE_SMILIES_DEFAULT_VALUE && WCF::getSession()->getPermission($this->permissionCanUseSmilies) ? 1 : 0; $this->preParse = PRE_PARSE_DEFAULT_VALUE; $this->showSignature = SHOW_SIGNATURE_DEFAULT_VALUE; $this->languageID = WCF::getLanguage()->languageID; } parent::readData(); // get default smilies if (MODULE_SMILEY) { $this->smileyCategories = SmileyCache::getInstance()->getVisibleCategories(); $firstCategory = reset($this->smileyCategories); if ($firstCategory) { $this->defaultSmilies = SmileyCache::getInstance()->getCategorySmilies($firstCategory->categoryID ?: null); } } if ($this->enableBBCodes && $this->allowedBBCodesPermission) { BBCodeHandler::getInstance()->setAllowedBBCodes(explode(',', WCF::getSession()->getPermission($this->allowedBBCodesPermission))); } }
/** * @see \wcf\page\IPage::assignVariables() */ public function assignVariables() { parent::assignVariables(); MessageQuoteManager::getInstance()->assignVariables(); $tmpHash = StringUtil::getRandomID(); $attachmentHandler = new AttachmentHandler('com.woltlab.wcf.conversation.message', 0, $tmpHash, 0); WCF::getTPL()->assign(array('attachmentHandler' => $attachmentHandler, 'attachmentObjectID' => 0, 'attachmentObjectType' => 'com.woltlab.wcf.conversation.message', 'attachmentParentObjectID' => 0, 'tmpHash' => $tmpHash, 'attachmentList' => $this->objectList->getAttachmentList(), 'labelList' => $this->labelList, 'modificationLogList' => $this->modificationLogList, 'sortOrder' => $this->sortOrder, 'conversation' => $this->conversation, 'conversationID' => $this->conversationID, 'participants' => $this->participantList->getObjects(), 'defaultSmilies' => SmileyCache::getInstance()->getCategorySmilies(), 'permissionCanUseSmilies' => 'user.message.canUseSmilies')); BBCodeHandler::getInstance()->setAllowedBBCodes(explode(',', WCF::getSession()->getPermission('user.message.allowedBBCodes'))); }