Navigation issue Navigation issue
 

News:

cpg1.5.48 Security release - upgrade mandatory!
The Coppermine development team is releasing a security update for Coppermine in order to counter a recently discovered vulnerability. It is important that all users who run version cpg1.5.46 or older update to this latest version as soon as possible.
[more]

Main Menu

Navigation issue

Started by oscar_rocha, September 17, 2007, 05:41:52 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

oscar_rocha

Hi everybody,I will appreciate so much you contribution:

I use Coppermine Photo Gallery 1.4.8 (stable) to manage pictures and contents that are updated from cellular phone.

As I'm handling with so many uploads, when you're browsing an album (ex. lastuploads) and click over a thumbnail to view the image inside "displayimage.php" sometimes it takes you to the wrong image as in that moment a new picture was uploaded (the picture i clicked had "pos=1" but when the new picture was uploaded, it position changes changes to "pos=2").

Is there any way to solve this? maybe linking from thumbnails.php to a pic_id instead of a position?

Thanx!

cpg rocks

Joachim Müller

With cpg1.4.x: no. Will be taken care of in cpg1.5.x (not released yet).

Quote from: oscar_rocha on September 17, 2007, 05:41:52 PMI use Coppermine Photo Gallery 1.4.8
It is absolutely mandatory to upgrade to the most recent version (currently cpg1.4.13) for security reasons.

oscar_rocha

I solved this issue changing few lines:

In displaimage.php, changed:
// Retrieve data for the current picture
if ($pos < 0 || $pid > 0) {
    $pid = ($pos < 0) ? -$pos : $pid;
    $result = cpg_db_query("SELECT aid from {$CONFIG['TABLE_PICTURES']} WHERE pid='$pid' $ALBUM_SET LIMIT 1");
    if (mysql_num_rows($result) == 0) cpg_die(ERROR, $lang_errors['non_exist_ap'], __FILE__, __LINE__);
    $row = mysql_fetch_array($result);
    $album = $row['aid'];
    $pic_data = get_pic_data($album, $pic_count, $album_name, -1, -1, false);
    for($pos = 0; $pic_data[$pos]['pid'] != $pid && $pos < $pic_count; $pos++);
    $pic_data = get_pic_data($album, $pic_count, $album_name, $pos, 1, false);
    $CURRENT_PIC_DATA = $pic_data[0];

}

With:
if ($pos < 0 || $pid > 0) {
    $pid = ($pos < 0) ? -$pos : $pid;
    $result = cpg_db_query("SELECT aid from {$CONFIG['TABLE_PICTURES']} WHERE pid='$pid' $ALBUM_SET LIMIT 1");
    if (mysql_num_rows($result) == 0) cpg_die(ERROR, $lang_errors['non_exist_ap'], __FILE__, __LINE__);
    $row = mysql_fetch_array($result);
    if (empty($album))
    $album = $row['aid'];   
    $pic_data = get_pic_data($album, $pic_count, $album_name, -1, -1, false);
    for($pos = 0; $pic_data[$pos]['pid'] != $pid && $pos < $pic_count; $pos++);
    $pic_data = get_pic_data($album, $pic_count, $album_name, $pos, 1, false);
    $CURRENT_PIC_DATA = $pic_data[0];

}


As you see, I just added the: if (empty($album)) avlidation.
And making changes in thumbnails.php and include/themes.inc.php in order to show all the links to displayimage.php (from thumnails.php and from the filmstrip) also with the pid parameter.

Hope this helps...

Joachim Müller

Thanks for returning and sharing your solution.