Bug in Title and Alt attributes

Phoca Gallery plugins - plugins for Phoca Gallery extension
nunoleite
Phoca Member
Phoca Member
Posts: 38
Joined: 15 Apr 2018, 01:00

Bug in Title and Alt attributes

Post 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
User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 47810
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

Re: Bug in Title and Alt attributes

Post by Jan »

Hi, thank you very much for the info.

Jan
If you find Phoca extensions useful, please support the project
Post Reply