joomla-cms icon indicating copy to clipboard operation
joomla-cms copied to clipboard

[4.1] Fix Content - Email Cloaking removes CSS from Link

Open LukasHH opened this issue 3 years ago • 9 comments

Pull Request for Issue #36166 .

Summary of Changes

Changes to the content plugin emailcloak.php

  • Changes in the respective $replacement specifications
  • A change in the last pattern-string

Changes to the file joomla-hidden-mail.js under media/system/js Reason: When setting the tag "joomla-hidden-mail" the class and style attributes are duplicated. Therefore I have them both removed from the tag.

A change to the core.js file Here is the function sanitizeHtml. This had prevented that style specifications are not taken over with images. The attribute "style" was added to the allow list.

Testing Instructions

Include any of the following content with an email in an article. Examples are also in the source code of the "emailcloak" plugin

<p><a href="http://mce_host/ourdirectory/[email protected]" class="btn btn-danger" style="border: 2px solid #f00;">[email protected]</a></p>
<p><a href="http://mce_host/ourdirectory/[email protected]" class="btn btn-danger" style="border: 2px solid #f00;">anytext</a></p>
<p><a href="mailto:[email protected]" class="btn btn-danger" style="border: 2px solid #f00;">[email protected]</a></p>
<p><a href="mailto:[email protected]" class="btn btn-danger" style="border: 2px solid #f00;"><span class="test" style="text-transform: uppercase;">[email protected]</span></a></p>
<p><a href="mailto:[email protected]" class="btn btn-danger" style="border: 2px solid #f00;"><span class="test" style="text-transform: uppercase;">anytext</span></a></p>
<p><a href="mailto:[email protected]" class="btn btn-danger" style="border: 2px solid #f00;">anytext</a></p>
<p><a href="mailto:[email protected]" class="btn btn-danger" style="border: 2px solid #f00;"><img src="images/joomla_black.png" alt="" class="img-thumbnail" style="border: 1px solid #00f;" /></a></p>
<p><a href="mailto:[email protected]" class="btn btn-danger" style="border: 2px solid #f00;"><img src="images/joomla_black.png" alt="" class="img-thumbnail" style="border: 1px solid #00f;" />[email protected]</a></p>
<p><a href="mailto:[email protected]" class="btn btn-danger" style="border: 2px solid #f00;"><img src="images/joomla_black.png" alt="" class="img-thumbnail" style="border: 1px solid #00f;" />any text</a></p>
<p><a href="mailto:[email protected]?subject=Text" class="btn btn-danger" style="border: 2px solid #f00;">[email protected]</a></p>
<p><a href="mailto:[email protected]?subject=Text" class="btn btn-danger" style="border: 2px solid #f00;">anytext</a></p>
<p><a href="mailto:[email protected]?subject= Text" class="btn btn-danger" style="border: 2px solid #f00;"><span class="test" style="text-transform: uppercase;">[email protected]</span></a></p>
<p><a href="mailto:[email protected]?subject= Text" class="btn btn-danger" style="border: 2px solid #f00;"><span class="test" style="text-transform: uppercase;">anytext</span></a></p>
<p><a href="mailto:[email protected]?subject=Text" class="btn btn-danger" style="border: 2px solid #f00;"><img src="images/joomla_black.png" alt="" class="img-thumbnail" style="border: 1px solid #00f;" /></a></p>
<p><a href="mailto:[email protected]?subject=Text" class="btn btn-danger" style="border: 2px solid #f00;"><img src="images/joomla_black.png" alt="" class="img-thumbnail" style="border: 1px solid #00f;" />[email protected]</a></p>
<p><a href="mailto:[email protected]?subject=Text" class="btn btn-danger" style="border: 2px solid #f00;"><img src="images/joomla_black.png" alt="" class="img-thumbnail" style="border: 1px solid #00f;" />any text</a></p>
<p><img src="images/joomla_black.png" alt="" class="img-thumbnail" style="border: 1px solid #00f;" title="[email protected]" /></p>
<p><input type="text" placeholder="[email protected]" /></p>

Actual result BEFORE applying this Pull Request

image image image

Expected result AFTER applying this Pull Request

image image image image

Documentation Changes Required

no changes

LukasHH avatar Dec 08 '21 20:12 LukasHH

I have tested this item :white_check_mark: successfully on 152b089b2429880165e5fc2914d9bdaefd8e17b8


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/36269.

chmst avatar Dec 09 '21 22:12 chmst

@LukasHH thanks for your examples.backend: OK. wanted to test for frontend with prebuilt package. unfortunately can't reach github view (404) for installing prebuilt-package.


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/36269.

ChristineWk avatar Dec 10 '21 11:12 ChristineWk

I have tested this item :white_check_mark: successfully on 152b089b2429880165e5fc2914d9bdaefd8e17b8

OK, with automatic e-mail, I got now the prebuilt package via github.


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/36269.

ChristineWk avatar Dec 10 '21 11:12 ChristineWk

RTC


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/36269.

richard67 avatar Dec 10 '21 11:12 richard67

Works for me! Great work, thanks! 😊

nikzolahr avatar Dec 10 '21 12:12 nikzolahr

I have tested this item :white_check_mark: successfully on 152b089b2429880165e5fc2914d9bdaefd8e17b8


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/36269.

khu5h1 avatar Dec 14 '21 12:12 khu5h1

For me this solves a lot of problems but the first example is broken. It should NOT display the email address at all, even though there is a link around. The email address has to be "cloaked" there too (without a mailto link)

bembelimen avatar Mar 17 '22 19:03 bembelimen

This pull request has automatically rebased to 4.2-dev.

HLeithner avatar Jun 27 '22 13:06 HLeithner

This pull requests has been automatically converted to the PSR-12 coding standard.

joomla-bot avatar Jun 27 '22 21:06 joomla-bot

@LukasHH would you mind looking into this PR and fix the last issue?

bembelimen avatar Oct 21 '22 16:10 bembelimen

@bembelimen I will see that I can fix the last problem.

LukasHH avatar Oct 23 '22 17:10 LukasHH

@chmst @ChristineWk @khu5h1 Could you test again? The PR has received some change due to a review comment. Thanks in advance.

richard67 avatar Nov 26 '22 22:11 richard67

I have tested this item :white_check_mark: successfully on 35f0e39c699cecc34ac6a641a28783046322f167


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/36269.

chmst avatar Nov 27 '22 12:11 chmst

I have tested this item :white_check_mark: successfully on 35f0e39c699cecc34ac6a641a28783046322f167


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/36269.

ChristineWk avatar Nov 27 '22 17:11 ChristineWk

RTC


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/36269.

richard67 avatar Nov 27 '22 18:11 richard67

Thank you very much @LukasHH !

fancyFranci avatar Nov 29 '22 21:11 fancyFranci