Файловый менеджер - Редактировать - /var/www/html/components/com_kunena/src/Controller/Topic/Form/Reply/TopicFormReplyDisplay.php
Ðазад
<?php /** * Kunena Component * * @package Kunena.Site * @subpackage Controller.Topic * * @copyright Copyright (C) 2008 - 2026 Kunena Team. All rights reserved. * @license https://www.gnu.org/copyleft/gpl.html GNU/GPL * @link https://www.kunena.org **/ namespace Kunena\Forum\Site\Controller\Topic\Form\Reply; \defined('_JEXEC') or die(); use Exception; use Joomla\CMS\Document\HtmlDocument; use Joomla\CMS\Language\Text; use Joomla\CMS\Plugin\PluginHelper; use Joomla\Registry\Registry; use Kunena\Forum\Libraries\Attachment\KunenaAttachmentHelper; use Kunena\Forum\Libraries\Controller\KunenaControllerDisplay; use Kunena\Forum\Libraries\Event\KunenaPrepareEvent; use Kunena\Forum\Libraries\Exception\KunenaExceptionAuthorise; use Kunena\Forum\Libraries\Factory\KunenaFactory; use Kunena\Forum\Libraries\Forum\Message\KunenaMessageHelper; use Kunena\Forum\Libraries\Forum\Topic\KunenaTopicHelper; use Kunena\Forum\Libraries\KunenaPrivate\KunenaPrivateMessage; use Kunena\Forum\Libraries\Template\KunenaTemplate; use Kunena\Forum\Libraries\User\KunenaUserHelper; /** * Class ComponentTopicControllerFormReplyDisplay * * @since Kunena 4.0 */ class TopicFormReplyDisplay extends KunenaControllerDisplay { /** * @var null * @since Kunena 6.0 */ public $captchaHtml = null; /** * @var string * @since Kunena 6.0 */ protected $name = 'Topic/Edit'; public $me; public $ktemplate; public $wa; public $doc; public $UserCanPostImage; public $selectcatlist; public $editorType; public $canSubscribe; public $subscriptionsChecked; public $postAnonymous; public $allowedExtensions; public $privateMessage; public $action; public $message; public $topicIcons; public $captchaEnabled; public $category; public $topic; public $captchaDisplay; /** * Prepare topic reply form. * * @return void * * @throws null * @throws Exception * @since Kunena 6.0 */ protected function before() { parent::before(); $id = $this->input->getInt('id'); $mesid = $this->input->getInt('mesid'); $quote = $this->input->getBool('quote', false); $saved = $this->app->getUserState('com_kunena.postfields'); $this->me = KunenaUserHelper::getMyself(); $this->ktemplate = KunenaFactory::getTemplate(); if (!$mesid) { $this->topic = KunenaTopicHelper::get($id); $parent = KunenaMessageHelper::get($this->topic->first_post_id); } else { $parent = KunenaMessageHelper::get($mesid); $this->topic = $parent->getTopic(); } if ($this->config->readOnly) { throw new KunenaExceptionAuthorise(Text::_('COM_KUNENA_NO_ACCESS'), '401'); } $doc = $this->app->getDocument(); foreach ($doc->_links as $key => $value) { if (\is_array($value)) { if (\array_key_exists('relation', $value)) { if ($value['relation'] == 'canonical') { $canonicalUrl = $this->topic->getUrl(); $doc->_links[$canonicalUrl] = $value; unset($doc->_links[$key]); break; } } } } $uri = trim(strtok($this->topic->getUrl(), '?')); $doc->addHeadLink($uri, 'canonical'); $this->category = $this->topic->getCategory(); if ($parent->isAuthorised('reply') && $this->me->canDoCaptcha()) { $this->captchaDisplay = KunenaTemplate::getInstance()->getCaptcha(); $this->captchaEnabled = true; } else { $this->captchaEnabled = false; } $parent->tryAuthorise('reply'); $arrayanynomousbox = []; $arraypollcatid = []; $this->ktemplate->addScriptOptions('com_kunena.arrayanynomousbox', json_encode($arrayanynomousbox)); $this->ktemplate->addScriptOptions('com_kunena.pollcategoriesid', json_encode($arraypollcatid)); // Run event. $params = new Registry(); $params->set('ksource', 'kunena'); $params->set('kunena_view', 'topic'); $params->set('kunena_layout', 'reply'); PluginHelper::importPlugin('kunena'); $prepareEvent = new KunenaPrepareEvent('onKunenaPrepare', [ 'context' => 'kunena.topic', 'subject' => $this->topic, 'params' => $params, 'page' => 0 ]); $this->app->getDispatcher()->dispatch('onKunenaPrepare', $prepareEvent); $this->headerText = Text::_('COM_KUNENA_BUTTON_MESSAGE_REPLY') . ': ' . $this->topic->subject; // Can user edit topic icons? if ($this->config->topicIcons && $this->topic->isAuthorised('edit')) { $this->topicIcons = $this->ktemplate->getTopicIcons(false, $saved ? $saved['icon_id'] : $this->topic->icon_id); } list($this->topic, $this->message) = $parent->newReply($saved ? $saved : ['quote' => $quote], $parent->userid); $this->action = 'post'; $this->privateMessage = new KunenaPrivateMessage(); $this->privateMessage->body = $saved ? $saved['private'] : $this->privateMessage->body; $this->allowedExtensions = KunenaAttachmentHelper::getExtensions($this->category); $this->postAnonymous = $saved ? $saved['anonymous'] : !empty($this->category->postAnonymous); if ($this->me->canSubscribe == -1) { $this->subscriptionsChecked = $saved ? $saved['subscribe'] : $this->config->subscriptionsChecked == 1; } else { $this->subscriptionsChecked = $this->me->canSubscribe; } $this->app->setUserState('com_kunena.postfields', null); $this->canSubscribe = $this->canSubscribe(); $this->editorType = $this->ktemplate->params->get('editorType'); $this->selectcatlist = false; $this->UserCanPostImage = $this->me->checkUserAllowedLinksImages(); /** @var HtmlDocument $doc */ $this->doc = $this->app->getDocument(); $this->wa = $this->doc->getWebAssetManager(); } /** * Can user subscribe to the topic? * * @return boolean * * @throws Exception * @since Kunena 6.0 */ protected function canSubscribe() { if ( !$this->me->userid || !$this->config->allowSubscriptions || $this->config->topicSubscriptions == 'disabled' ) { return false; } return !$this->topic->getUserTopic()->subscribed; } /** * Prepare document. * * @return void * * @throws Exception * @since Kunena 6.0 */ protected function prepareDocument() { $menu_item = $this->app->getMenu()->getActive(); $this->setMetaData('robots', 'nofollow, noindex'); if ($menu_item) { $params = $menu_item->getParams(); $params_title = $params->get('page_title'); $params_description = $params->get('menu-meta_description'); if (!empty($params_title)) { $title = $params->get('page_title'); $this->setTitle($title); } else { $this->setTitle($this->headerText); } if (!empty($params_description)) { $description = $params->get('menu-meta_description'); $this->setDescription($description); } else { $this->setDescription($this->headerText); } } } }
| ver. 1.1 | |
.
| PHP 8.4.18 | Ð“ÐµÐ½ÐµÑ€Ð°Ñ†Ð¸Ñ Ñтраницы: 0 |
proxy
|
phpinfo
|
ÐаÑтройка