#26 Slideshow and special characters in path, filename, title

open
nobody
None
5
2007-05-02
2007-05-02
CrossroadsTech
No

Slideshow does not work when gallery folder/directory, image filename, or title has special characters such as "&". Effects version: 0.9.13a functions_slideshow.inc.php "396 2007-01-28 14:41:42Z jim". Fixed by changing display_slideshow() to the following:

function display_slideshow()
{

global $dir, $dir1, $files, $handled_image_types_preg, $txt, $base_images_dir;

$dir1 = $dir;
$dir = urlencode($dir);

$SCRIPT_NAME = SCRIPT_NAME;
$js_var ='';

foreach($files as $file_id=>$filename) {
if (preg_match($handled_image_types_preg, $filename)) {
$title = get_title($dir1.$filename);
$title = htmlspecialchars($title);
$filename = urlencode($filename);
$js_var .=<<<EOD

s = new slide();
s.src = "$SCRIPT_NAME?displaypic=$dir$filename&amp;non_lr=";
s.link = "$SCRIPT_NAME?display=$dir$filename";
s.text = "$title";
slides.add_slide(s);

EOD;
}
}

Discussion