Advanced search  

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]

Pages: [1]   Go Down

Author Topic: Navigation issue  (Read 2945 times)

0 Members and 1 Guest are viewing this topic.

oscar_rocha

  • Coppermine newbie
  • Offline Offline
  • Gender: Male
  • Posts: 14
Navigation issue
« on: September 17, 2007, 05:41:52 pm »

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
« Last Edit: September 21, 2007, 04:12:44 pm by GauGau »
Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Re: Navigation issue
« Reply #1 on: September 17, 2007, 06:13:55 pm »

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

I 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.
Logged

oscar_rocha

  • Coppermine newbie
  • Offline Offline
  • Gender: Male
  • Posts: 14
Re: Navigation issue
« Reply #2 on: September 21, 2007, 03:15:00 pm »

I solved this issue changing few lines:

In displaimage.php, changed:
Code: [Select]
// 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:
Code: [Select]
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:
Code: [Select]
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...
Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Re: Navigation issue
« Reply #3 on: September 21, 2007, 04:13:37 pm »

Thanks for returning and sharing your solution.
Logged
Pages: [1]   Go Up
 

Page created in 0.02 seconds with 20 queries.