Projects ⇒ Bugs ⇒ #669: Coppermine JS endSlideShow() function not LEO-aware ⇒ CPG Dragonfly™ CMS
Bug #669 Coppermine JS endSlideShow() function not LEO-aware
Project: Dragonfly 9.0.3 -> 9.3 Category: Coppermine
Submitted: Saturday, November 19, 2005 (20:35:42) Modified: Sunday, November 27, 2005 (02:28:09)
Status: Closed Assigned to:
PHP Version: 4.4 HTTPD Server: Apache 2.0

View/Vote Add Comment

by: darkgrue
Description:
------------
The Coppermine JavaScript endSlideShow() function returns an incorrect URL when LEO is enabled.

Reproduce code:
---------------
Replace html/includes/coppermine/slideshow.inc (v9.1) with (Devs, please double-check the loc string in endSlideShow() to make sure the fix actually is valid across all configurations LEO/non, default root and not):

<?php $slideshow = (isset($_GET['slideshow'])) ? intval($_GET['slideshow']) : cpg_die(_ERROR, sprintf(_ERROR_NOT_SET, 'slideshow')); global $module_name, $BASEHREF, $CPG_URL; echo "\n".'<!-- Coppermine Photo Gallery 1.3.1 for CPG-Nuke--> <script language="JavaScript" type="text/javascript"> <!-- Hide script from old browsers. // (C) 2000 www.CodeLifter.com // http://www.codelifter.com // Free for all users, but leave in this header // NS4-6,IE4-6 // Fade effect only in IE; degrades gracefully // Set slideShowSpeed (milliseconds) var slideShowSpeed = '.$slideshow.'; // Duration of crossfade (seconds) var crossFadeDuration = 3; // Specify the image files var Pic = new Array(); // don\'t touch this // to add more images, just continue // the pattern, adding to the array below'."\n"; $i = 0; $j = 0; $pid = intval($_GET['pid']) ? $_GET['pid'] : cpg_die(_ERROR, sprintf(_ERROR_NOT_SET, 'pid')); $start_img = ''; $album = (isset($_GET['album']) && $_GET['album'] != '') ? $_GET['album'] : NULL; $meta = (isset($_GET['meta']) && $_GET['meta'] != '') ? $_GET['meta'] : NULL; $thisalbumlink = ''; if (isset($album)) { $thisalbumlink = "&album=$album"; }else { $thisalbumlink = "&meta=$meta"; } $pic_data = get_pic_data($_GET['meta'], $_GET['album'], $pic_count, $album_name, -1, 1000, false); foreach ($pic_data as $picture) { if (($CONFIG['make_intermediate'] && max($picture['pwidth'], $picture['pheight']) > $CONFIG['picture_width'])&&(!$CONFIG['fullsize_slideshow'] )) { $picture_url = get_pic_url($picture, 'normal'); } else { $picture_url = get_pic_url($picture, 'fullsize'); } echo "Pic[$i] = '" . $picture_url . "';\n"; if ($picture['pid'] == $pid) { $j = $i; $start_img = $picture_url; } $i++; } echo "\n".'var t; var j = '.$j.'; var p = Pic.length; var pos = j; var preLoad = new Array(); function preLoadPic(index) { if (Pic[index] != "") { window.status = "Loading : " + Pic[index]; preLoad[index] = new Image(); preLoad[index].src = Pic[index]; Pic[index] = ""; window.status=""; } } function runSlideShow() { if (document.all) { document.images.SlideShow.style.filter = "blendTrans(duration=2)"; document.images.SlideShow.style.filter = "blendTrans(duration=crossFadeDuration)"; document.images.SlideShow.filters.blendTrans.Apply(); } document.images.SlideShow.src = preLoad[j].src; if (document.all) { document.images.SlideShow.filters.blendTrans.Play(); } pos = j; j = j + 1; if (j > (p-1)) { j=0; } t = setTimeout("runSlideShow()", slideShowSpeed); preLoadPic(j); } function endSlideShow() { var loc = new String("/' .getlink("{$module_name}&amp;file=displayimage{$thisalbumlink}&amp;cat=" .((isset($_GET['cat'])) ? intval($_GET['cat']) : 0) .'&amp;pos=0') .'"); // Redirect page. self.document.location = loc.replace(/pos=0/, "pos=" + pos); } preLoadPic(j); // End --> </script>';

Actual result:
--------------
With LEO enabled, the endSlideShow() function returns a URL of the form:

http://www.mysite.com/coppermine/displayimage/meta=lastalb/cat=0/pid=244/index.php?name=coppermine&file=displayimage&meta=lastalb&cat=0&pos=0

With LEO off, you get a working link of the form:

http://www.mysite.com/index.php?name=coppermine&file=displayimage&album=7&cat=0&pos=1
by: DJMaze
This bug has been fixed in the CVS.

Snapshots of the sources are packaged every 6 hours; this change
will be in the next snapshot. You can grab the snapshot at the
Downloads section.

Thank you for the report, and for helping us to make better.
User Info

Welcome Anonymous



(Register)
Community

Support for DragonflyCMS in a other languages:

Deutsch
Español