public function execute() { KUNENA_PROFILER ? KunenaProfiler::instance()->start('function '.get_class($this).'::'.__FUNCTION__.'()') : null; // Run before executing action. $result = $this->before(); if ($result === false) { KUNENA_PROFILER ? KunenaProfiler::instance()->stop('function '.get_class($this).'::'.__FUNCTION__.'()') : null; throw new KunenaExceptionAuthorise(JText::_('COM_KUNENA_NO_ACCESS'), 404); } // Wrapper layout. $this->output = KunenaLayout::factory('Page') ->set('me', $this->me) ->setOptions($this->getOptions()); if ($this->config->board_offline && !$this->me->isAdmin ()) { // Forum is offline. $this->setResponseStatus(503); $this->output->setLayout('offline'); $this->content = KunenaLayout::factory('Widget/Custom') ->set('header', JText::_('COM_KUNENA_FORUM_IS_OFFLINE')) ->set('body', $this->config->offline_message); } elseif ($this->config->regonly && !$this->me->exists()) { // Forum is for registered users only. $this->setResponseStatus(403); $this->output->setLayout('offline'); $this->content = KunenaLayout::factory('Widget/Custom') ->set('header', JText::_('COM_KUNENA_LOGIN_NOTIFICATION')) ->set('body', JText::_('COM_KUNENA_LOGIN_FORUM')); } else { // Display real content. try { // Split into two lines for exception handling. $content = $this->display()->set('breadcrumb', $this->breadcrumb); $this->content = $content->render(); } catch (KunenaExceptionAuthorise $e) { $this->setResponseStatus($e->getResponseCode()); $this->output->setLayout('unauthorized'); $this->document->setTitle($e->getResponseStatus()); $this->content = KunenaLayout::factory('Widget/Custom') ->set('header', $e->getResponseStatus()) ->set('body', $e->getMessage()); } catch (Exception $e) { if (!($e instanceof KunenaExceptionAuthorise)) { $header = 'Error while rendering layout'; $content = isset($content) ? $content->renderError($e) : $this->content->renderError($e); $e = new KunenaExceptionAuthorise($e->getMessage(), $e->getCode(), $e); } else { $header = $e->getResponseStatus(); $content = $e->getMessage(); } $this->setResponseStatus($e->getResponseCode()); $this->output->setLayout('unauthorized'); $this->document->setTitle($header); $this->content = KunenaLayout::factory('Widget/Custom') ->set('header', $header) ->set('body', $content); } } // Display wrapper layout with given parameters. $this->output ->set('content', $this->content) ->set('breadcrumb', $this->breadcrumb); // Run after executing action. $this->after(); KUNENA_PROFILER ? KunenaProfiler::instance()->stop('function '.get_class($this).'::'.__FUNCTION__.'()') : null; return $this->output; }
<?php /** * Kunena Component * @package Kunena.Template.Crypsis * @subpackage BBCode * * @copyright (C) 2008 - 2016 Kunena Team. All rights reserved. * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL * @link https://www.kunena.org **/ defined ( '_JEXEC' ) or die (); /** @var KunenaAttachment $attachment */ $attachment = $this->attachment; /** @var KunenaUser $user */ $user = isset($this->user) ? $this->user : null; // Get authorisation message. $exception = $attachment->tryAuthorise('read', $user, false); if (!$exception) $exception = new KunenaExceptionAuthorise('Bad Request.', 400); ?> <div class="kmsgattach"> <?php echo $exception->getMessage(); ?> </div>
<?php /** * Kunena Component * @package Kunena.Template.Crypsis * @subpackage BBCode * * @copyright (C) 2008 - 2015 Kunena Team. All rights reserved. * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL * @link http://www.kunena.org **/ defined('_JEXEC') or die; /** @var KunenaAttachment $attachment */ $attachment = $this->attachment; /** @var KunenaUser $user */ $user = isset($this->user) ? $this->user : null; // Get authorisation message. $exception = $attachment->tryAuthorise('read', $user, false); if (!$exception) { $exception = new KunenaExceptionAuthorise('Bad Request.', 400); } ?> <div class="kmsgattach"> <?php echo $exception->getMessage(); ?> </div>