ZC v1.5.6c
Relevant mods: SBA, IH5, Colorbox
I've noticed that this mod is not escaping the apostrophe in a product's title - causing the javascript in templates/tpl_modules_main_product_image.php to fail and the medium image on the product info page to not display.
e.g
Product name: A Dog's Life
Colorbox code in templates/tpl_modules_main_product_image.php is
Code:
<script type="text/javascript"><!--
document.write('<?php echo '<a href="' . zen_colorbox($products_image_large, addslashes($products_name), defined('LARGE_IMAGE_WIDTH') ? LARGE_IMAGE_WIDTH : '', defined('LARGE_IMAGE_HEIGHT') ? LARGE_IMAGE_HEIGHT : '') . '" data-cbox-rel="' . $data_colorbox . '" class="' . "nofollow" . '" title="' . zen_output_string_protected($products_name) . '">' . zen_image($products_image_medium, addslashes($products_name), MEDIUM_IMAGE_WIDTH, MEDIUM_IMAGE_HEIGHT,'id="SBA_ProductImage"') . '<br \/><span class="imgLink">' . TEXT_CLICK_TO_ENLARGE . '<\/span><\/a>'; ?>');
//--></script>
Output is
Code:
<!--
document.write('<a href="images/artwork/0615_a_dogs_life.jpg" data-cbox-rel="colorbox" class="nofollow" title="A Dog's Life"><img src="bmz_cache/a/artwork-0615_a_dogs_lifejpg.image.500x347.jpg" alt="A Dog\'s Life" title=" A Dog\'s Life " width="500" height="347" id="SBA_ProductImage" /><br \/><span class="imgLink">larger image<\/span><\/a>');
//-->
You can see that it is the apostrophe in
Code:
title="A Dog's Life"
that is causing the problem.
My solution is, and I hope someone will correct me if there's a better way, to add 'addslashes' like so
Code:
<script type="text/javascript"><!--
document.write('<?php echo '<a href="' . zen_colorbox($products_image_large, addslashes($products_name), defined('LARGE_IMAGE_WIDTH') ? LARGE_IMAGE_WIDTH : '', defined('LARGE_IMAGE_HEIGHT') ? LARGE_IMAGE_HEIGHT : '') . '" data-cbox-rel="' . $data_colorbox . '" class="' . "nofollow" . '" title="' . zen_output_string_protected(addslashes($products_name)) . '">' . zen_image($products_image_medium, addslashes($products_name), MEDIUM_IMAGE_WIDTH, MEDIUM_IMAGE_HEIGHT,'id="SBA_ProductImage"') . '<br \/><span class="imgLink">' . TEXT_CLICK_TO_ENLARGE . '<\/span><\/a>'; ?>');
//--></script>
Bookmarks