Skip to content

Commit

Permalink
BBcode: Hide Doesn't Work #4688 #4690 (#4738)
Browse files Browse the repository at this point in the history
  • Loading branch information
810 committed Oct 10, 2016
1 parent e0063e0 commit 590e82a
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 20 deletions.
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
<?php
/**
* Kunena Component
* @package Kunena.Template.Crypsis
* @subpackage Layout.BBCode
* @package Kunena.Template.Crypsis
* @subpackage Layout.BBCode
*
* @copyright Copyright (C) 2008 - 2016 Kunena Team. All rights reserved.
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
* @link https://www.kunena.org
* @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;

Expand All @@ -16,8 +16,8 @@
?>

<?php if ($this->me->exists()) : ?>
<strong><?php echo JText::_('COM_KUNENA_BBCODE_HIDDENTEXT'); ?></strong>
<?php else : ?>
<strong><?php JText::_('COM_KUNENA_BBCODE_HIDE_IN_MESSAGE'); ?></strong>
<div class="kmsgtext-hide"><?php echo $this->content; ?></div>
<?php else : ?>
<strong><?php echo JText::_('COM_KUNENA_BBCODE_HIDDENTEXT'); ?></strong>
<?php endif; ?>
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
<?php
/**
* Kunena Component
* @package Kunena.Template.Crypsis
* @subpackage Layout.BBCode
* @package Kunena.Template.Crypsis
* @subpackage Layout.BBCode
*
* @copyright Copyright (C) 2008 - 2016 Kunena Team. All rights reserved.
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
* @link https://www.kunena.org
* @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;

Expand All @@ -16,8 +16,8 @@
?>

<?php if ($this->me->exists()) : ?>
<strong><?php echo JText::_('COM_KUNENA_BBCODE_HIDDENTEXT'); ?></strong>
<?php else : ?>
<strong><?php JText::_('COM_KUNENA_BBCODE_HIDE_IN_MESSAGE'); ?></strong>
<div class="kmsgtext-hide"><?php echo $this->content; ?></div>
<?php else : ?>
<strong><?php echo JText::_('COM_KUNENA_BBCODE_HIDDENTEXT'); ?></strong>
<?php endif; ?>
30 changes: 24 additions & 6 deletions src/libraries/kunena/bbcode/bbcode.php
Original file line number Diff line number Diff line change
Expand Up @@ -1427,15 +1427,33 @@ public function DoHide($bbcode, $action, $name, $default, $params, $content)
}

$me = KunenaUserHelper::getMyself();
$message = $this->getMessage();
$moderator = $me->userid && $me->isModerator($message ? $message->getCategory() : null);

$layout = KunenaLayout::factory('BBCode/Hidden');
if (isset($bbcode->parent->message->userid))
{
$message_userid = $bbcode->parent->message->userid;
}
else
{
$message_userid = $bbcode->parent->userid;
}

if ($layout->getPath())
if (($me->userid && $message_userid == $me->userid) || $moderator)
{
return (string) $layout
->set('me', $me)
->set('content', $content)
->set('params', $params);
$layout = KunenaLayout::factory('BBCode/Hidden');

if ($layout->getPath())
{
return (string) $layout
->set('me', $me)
->set('content', $content)
->set('params', $params);
}
}
else
{
return '<br />' . JText::_('COM_KUNENA_BBCODE_HIDDENTEXT') . '<br />';
}
}

Expand Down

0 comments on commit 590e82a

Please sign in to comment.