Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CK Editor emoticons showing unauthorized when show images for guests is set to No #9756

Closed
Pinkeltje opened this issue Oct 24, 2024 · 2 comments
Milestone

Comments

@Pinkeltje
Copy link
Contributor

Pinkeltje commented Oct 24, 2024

Describe the bug
CK Editor emoticons showing unauthorized when show images for guests is set to No

To Reproduce
Steps to reproduce the behavior:

  1. Set show images for guests to no
  2. Use CK Editor
  3. Insert emoticon in message
  4. Emoticon not shown. Instead "This image is hidden for guests" (free translated from Dutch).

Expected behavior
Emoticon visible

Actual result
See above

Screenshots
Logged in
2024-10-24 Screenshot 650
Guest
2024-10-24 Screenshot 651

Comparison CKEditor and SCEditor
2024-10-24 Screenshot 652
SCEditor keeps the shortcode (even when using toolbar to insert emoticons. CK editor translates to image.
[img]/media/kunena/emoticons/shocked.png[/img]

System information

Joomla version: 5.2.0
Kunena version: 6.3.5

@rich20 rich20 added this to the 6.3 milestone Oct 25, 2024
@rich20
Copy link
Member

rich20 commented Oct 25, 2024

Yes, this bug has existed for a very long time. #7856

Is it possible, that a click on a smiley add the short code instead a image link? With short code the smileys will be displayed.

@Pinkeltje
Copy link
Contributor Author

Pinkeltje commented Oct 26, 2024

I think I found the solution:
replace com_kunena/template/aurelia/layouts/bbcode/image/unauthorised.php
with

<?php

/**
 * Kunena Component
 *
 * @package         Kunena.Template.Aurelia
 * @subpackage      BBCode
 *
 * @copyright       Copyright (C) 2008 - 2024 Kunena Team. All rights reserved.
 * @license         https://www.gnu.org/copyleft/gpl.html GNU/GPL
 * @link            https://www.kunena.org
 **/

namespace Kunena\Forum\Site;

\defined('_JEXEC') or die();

use Joomla\CMS\Factory;
use Joomla\CMS\Language\Text;

// Get the current request path
$requestPath = Factory::getApplication()->input->server->getString('REQUEST_URI');

// Check if the request is for an image in the attachments folder
$isAttachmentsImage = (
    strpos($requestPath, 'media/kunena/attachments') !== false && 
    preg_match('/\.(jpg|jpeg|png|gif|webp)$/i', $requestPath)
);

?>

<div class="kmsgattach">
    <em>
        <?php if ($isAttachmentsImage): ?>
            <?php echo $this->title; ?>
        <?php endif; ?>
    </em>
</div>

Logged in:
2024-10-26 Screenshot 659

Logged out
2024-10-26 Screenshot 660

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants