Page 1 of 1

Bug in Title and Alt attributes

Posted: 15 Sep 2022, 11:08
by nunoleite
Hi!

I have found a bug in the Plugin when the images title have Double Quotation Marks. This interferes with html.

So, this should the used with "htmlspecialchars".

Everywhere there is:

Code: Select all

title="'.$image->title.'"
It should be replaced with

Code: Select all

title="'.htmlspecialchars($image->title).'"
And everywhere there is:

Code: Select all

alt="'.$image->title.'"
It should be replaced with

Code: Select all

alt="'.htmlspecialchars($image->title).'"
Examples:

Code: Select all

$output .= '<a class="'.$button->methodname.'" title="'.htmlspecialchars($image->title).'" href="'. JRoute::_($image->link).'"';

Code: Select all

$output .= '<img class="pg-image"  src="'.$imgLink.'" alt="'.htmlspecialchars($image->title).'" width="'.$correctImageRes['width'].'" height="'.$correctImageRes['height'].'" />';

Code: Select all

$output .= '<img class="pg-image"  src="'.JURI::base(true).'/'.$image->linkthumbnailpath.'" alt="'.htmlspecialchars($image->title).'" width="'.$imageOrigWidth.'" height="'.$imageOrigHeight.'" />';
This is in version 4.4.3, but it could be happening in version 4.5.1 too.

Can you fix it please?

Thanks
Nuno Leite

Re: Bug in Title and Alt attributes

Posted: 15 Sep 2022, 14:00
by Jan
Hi, thank you very much for the info.

Jan