? Success

User tests: Successful: Unsuccessful:

avatar infograf768
infograf768
28 Feb 2014

To test, add some single quotes for example by changing
COM_NEWSFEEDS_EDIT_NEWSFEED="Edit News Feed"
to
COM_NEWSFEEDS_EDIT_NEWSFEED="Edit News' Feed"
Then edit a newsfeed: the tabs will not display.
screen shot 2014-02-28 at 09 14 47
Patch and test again.
Also, these sprintf are useless as we have no variable value in the strings concerned.
http://joomlacode.org/gf/project/joomla/tracker/?action=TrackerItemEdit&tracker_item_id=33368&start=0

avatar infograf768 infograf768 - open - 28 Feb 2014
avatar infograf768
infograf768 - comment - 2 Mar 2014

You are correct: I reinstated the sprintf there.
This meant that the issue remained for that one.
I therefore corrected the issue in the library

To test: Edit a link in the redirect component after adding a single quote in the string:
COM_REDIRECT_EDIT_LINK="Edit Link #%d"
to
COM_REDIRECT_EDIT_LINK="Edit' Link #%d"

avatar Bakual
Bakual - comment - 2 Mar 2014

Would it work to htmlspecialchars the results from JText? I didn't test but sounds like encoding the single quote (and other special HTML chars) would solve the issue. Eg:
htmlspecialchars(JText::sprintf('COM_REDIRECT_EDIT_LINK', $this->item->id, true))

avatar infograf768
infograf768 - comment - 2 Mar 2014

I think it is better to do it correctly globally in the library here infograf768@f4f1148 instead of having to do it for each possible occurence, so that the issue is not only corrected for core but also for 3pds

avatar beat
beat - comment - 2 Mar 2014

That's the wrong escaping and at the wrong place (and suggestion of JM goes into the right direction but not far enough):

  1. The right place to escape title is in layout libraries.cms.html.bootstrap.addtabscript called from here: https://github.com/infograf768/joomla-cms/blob/f4f11485e6c5e6ca72b3d9347632bc3fef53ad97/libraries/cms/html/bootstrap.php#L722

  2. The right method to escape javascript strings is addslashes and not htmlspecialchars.

Best Regards,
Beat

avatar infograf768 infograf768 - change - 3 Mar 2014
Title
Wrong sprintf prevents escaping single quotes in tabs language strings values
[#33368] Wrong sprintf prevents escaping single quotes in tabs language strings values
avatar infograf768
infograf768 - comment - 3 Mar 2014

thanks. Patch now uses addslashes

avatar beat
beat - comment - 3 Mar 2014

As proposed in chat, addslashes should be in file
https://github.com/infograf768/joomla-cms/blob/bootstrap_tabs/layouts/libraries/cms/html/bootstrap/addtabscript.php
(gave you source code in chat as github does a 404 when i try saving editing that file!)

avatar infograf768 infograf768 - close - 3 Mar 2014
avatar infograf768 infograf768 - change - 3 Mar 2014
Status New Closed
Closed_Date 0000-00-00 00:00:00 2014-03-03 11:11:18
avatar infograf768 infograf768 - close - 3 Mar 2014
avatar infograf768 infograf768 - head_ref_deleted - 3 Mar 2014
avatar Bakual Bakual - reference | - 4 Mar 14
avatar Bakual Bakual - reference | 4197530 - 12 May 14

Add a Comment

Login with GitHub to post a comment