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: Slideshow link on the thumbnails.php page  (Read 7177 times)

0 Members and 1 Guest are viewing this topic.

jake

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 39
Slideshow link on the thumbnails.php page
« on: April 03, 2011, 02:34:18 am »

Hello,
I have recently upgraded to Coppermine 1.5.12, and have been struggling with getting a slideshow link to work on my thumbnails page.  Because I use the enlargeit! plugin (which opens photos from the thumbnails.php page), my visitors need a slideshow link on the thumbnails.php page to have an opportunity to use the slideshow feature.
Previously I was able to work around this issue by adding a “Start slideshow” link to the thumbnails page by adding the add this code to my include/functions.inc.php file (below the “//Add Link for album if aid is set” code)

Code: [Select]
//Add Link for slideshow if aid is set
        {
            $breadcrumb_links[2] = '<a href="displayimage.php?album='.$CURRENT_ALBUM_DATA['aid'].'&slideshow=5000">Start slideshow</a>';
            $BREADCRUMB_TEXTS[2] = $CURRENT_ALBUM_DATA['Start slideshow'];
        }

My problem seems to be that cpg1.5.12 requires the pid#  in the url for the slideshow to work.  Example: http://woodardphotos.net/coppermine/displayimage.php?album=68&pid=8680&slideshow=5000

I tried to resolve the issue by altering the code (see below), which outputs the following url and causes the user to be directed to an error page.  See: http://woodardphotos.net/coppermine/displayimage.php?album=68&pid=&slideshow=5000


Code: [Select]
//Add Link for slideshow if aid is set
        {
            $breadcrumb_links[2] = '<a href="displayimage.php?album='.$CURRENT_ALBUM_DATA['aid'].'&pid='.$PIC_DATA['pid'].'&slideshow=5000">Start slideshow</a>';
            $BREADCRUMB_TEXTS[2] = $CURRENT_ALBUM_DATA['Start slideshow'];
        }

Any suggestions would be greatly appreciated!
Thanks for your time.
- Jake
Logged

Αndré

  • Administrator
  • Coppermine addict
  • *****
  • Country: de
  • Offline Offline
  • Gender: Male
  • Posts: 15764
Re: Slideshow link on the thumbnails.php page
« Reply #1 on: April 05, 2011, 02:27:02 pm »

Replace
Code: [Select]
            $breadcrumb_links[2] = '<a href="displayimage.php?album='.$CURRENT_ALBUM_DATA['aid'].'&pid='.$PIC_DATA['pid'].'&slideshow=5000">Start slideshow</a>';with
Code: [Select]
            $pid = mysql_result(cpg_db_query("SELECT pid FROM {$CONFIG['TABLE_PICTURES']} WHERE aid = {$CURRENT_ALBUM_DATA['aid']} LIMIT 1"), 0);
            $breadcrumb_links[2] = '<a href="displayimage.php?album='.$CURRENT_ALBUM_DATA['aid'].'&pid='.$pid.'&slideshow=5000">Start slideshow</a>';
Logged

jake

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 39
Re: Slideshow link on the thumbnails.php page
« Reply #2 on: April 08, 2011, 07:24:04 am »

Andre,
Thanks so much for your time.  After changing my include/functions.inc.php file I get the following error:
Code: [Select]
While executing query 'SELECT pid FROM cpg15x_pictures WHERE aid = ' in include/functions.inc.php on line 2866

mySQL error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1
Logged

jake

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 39
Re: Slideshow link on the thumbnails.php page
« Reply #3 on: April 08, 2011, 07:28:17 am »

Disregard the previous code, this is the actual error:
Code: [Select]
While executing query 'SELECT pid FROM cpg15x_pictures WHERE aid =  LIMIT 1' in include/functions.inc.php on line 2866

mySQL error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'LIMIT 1' at line 1
Logged

Αndré

  • Administrator
  • Coppermine addict
  • *****
  • Country: de
  • Offline Offline
  • Gender: Male
  • Posts: 15764
Re: Slideshow link on the thumbnails.php page
« Reply #4 on: April 08, 2011, 08:47:54 am »

Please post your whole modified breadcrumb function from include/functions.inc.php.
Logged

jake

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 39
Re: Slideshow link on the thumbnails.php page
« Reply #5 on: April 08, 2011, 09:34:54 am »

Code: [Select]
/**
 * breadcrumb()
 *
 * Build the breadcrumb navigation
 *
 * @param integer $cat
 * @param string $breadcrumb
 * @param string $BREADCRUMB_TEXT
 * @return
 **/

function breadcrumb($cat, &$breadcrumb, &$BREADCRUMB_TEXT)
{
    global $lang_list_categories, $lang_common;
    global $CONFIG,$CURRENT_ALBUM_DATA, $CURRENT_CAT_NAME;

    $category_array = array();

    // first we build the category path: names and id
    if ($cat != 0) { //Categories other than 0 need to be selected

        if ($cat >= FIRST_USER_CAT) {

            $result = cpg_db_query("SELECT name FROM {$CONFIG['TABLE_CATEGORIES']} WHERE cid = " . USER_GAL_CAT);

            $row = mysql_fetch_assoc($result);

            $category_array[] = array(USER_GAL_CAT, $row['name']);

            $user_name = get_username($cat - FIRST_USER_CAT);

            if (!$user_name) {
                $user_name = $lang_common['username_if_blank'];
            }

            $category_array[] = array($cat, $user_name);
            $CURRENT_CAT_NAME = sprintf($lang_list_categories['xx_s_gallery'], $user_name);

            $row['parent'] = 1;

        } else {

            $result = cpg_db_query("SELECT p.cid, p.name FROM {$CONFIG['TABLE_CATEGORIES']} AS c,
                {$CONFIG['TABLE_CATEGORIES']} AS p
                WHERE c.lft BETWEEN p.lft AND p.rgt
                AND c.cid = $cat
                ORDER BY p.lft");

            while ( ($row = mysql_fetch_assoc($result)) ) {
                $category_array[] = array($row['cid'], $row['name']);
                $CURRENT_CAT_NAME = $row['name'];
            }

            mysql_free_result($result);
        }
    }

    $breadcrumb_links = array();
    $BREADCRUMB_TEXTS = array();

    // Add the Home link  to breadcrumb
    $breadcrumb_links[0] = '<a href="index.php">'.$lang_list_categories['home'].'</a>';
    $BREADCRUMB_TEXTS[0] = $lang_list_categories['home'];

    $cat_order = 1;

    foreach ($category_array as $category) {

        $breadcrumb_links[$cat_order] = "<a href=\"index.php?cat={$category[0]}\">{$category[1]}</a>";
        $BREADCRUMB_TEXTS[$cat_order] = $category[1];

        $cat_order += 1;
    }

    //Add Link for album if aid is set
    if (isset($CURRENT_ALBUM_DATA['aid'])) {
        $breadcrumb_links[$cat_order] = "<a href=\"thumbnails.php?album=".$CURRENT_ALBUM_DATA['aid']."\">".$CURRENT_ALBUM_DATA['title']."</a>";
        $BREADCRUMB_TEXTS[$cat_order] = $CURRENT_ALBUM_DATA['title'];
    }
       
    //Add Link for slideshow if aid is set
        {
            $pid = mysql_result(cpg_db_query("SELECT pid FROM {$CONFIG['TABLE_PICTURES']} WHERE aid = {$CURRENT_ALBUM_DATA['aid']} LIMIT 1"), 0);
            $breadcrumb_links[2] = '<a href="displayimage.php?album='.$CURRENT_ALBUM_DATA['aid'].'&pid='.$pid.'&slideshow=5000">Start slideshow</a>';
    }

    // Build $breadcrumb,$BREADCRUMB_TEXT from _links and _TEXTS
    theme_breadcrumb($breadcrumb_links, $BREADCRUMB_TEXTS, $breadcrumb, $BREADCRUMB_TEXT);
}  // function breadcrumb
Logged

Αndré

  • Administrator
  • Coppermine addict
  • *****
  • Country: de
  • Offline Offline
  • Gender: Male
  • Posts: 15764
Re: Slideshow link on the thumbnails.php page
« Reply #6 on: April 08, 2011, 12:20:42 pm »

Find
Code: [Select]
    //Add Link for album if aid is set
    if (isset($CURRENT_ALBUM_DATA['aid'])) {
        $breadcrumb_links[$cat_order] = "<a href=\"thumbnails.php?album=".$CURRENT_ALBUM_DATA['aid']."\">".$CURRENT_ALBUM_DATA['title']."</a>";
        $BREADCRUMB_TEXTS[$cat_order] = $CURRENT_ALBUM_DATA['title'];
    }
       
    //Add Link for slideshow if aid is set
        {
            $pid = mysql_result(cpg_db_query("SELECT pid FROM {$CONFIG['TABLE_PICTURES']} WHERE aid = {$CURRENT_ALBUM_DATA['aid']} LIMIT 1"), 0);
            $breadcrumb_links[2] = '<a href="displayimage.php?album='.$CURRENT_ALBUM_DATA['aid'].'&pid='.$pid.'&slideshow=5000">Start slideshow</a>';
    }
and replace with
Code: [Select]
    //Add Link for album if aid is set
    if (isset($CURRENT_ALBUM_DATA['aid'])) {
        $breadcrumb_links[$cat_order] = "<a href=\"thumbnails.php?album=".$CURRENT_ALBUM_DATA['aid']."\">".$CURRENT_ALBUM_DATA['title']."</a>";
        $BREADCRUMB_TEXTS[$cat_order] = $CURRENT_ALBUM_DATA['title'];

        //Add Link for slideshow if aid is set
        $pid = mysql_result(cpg_db_query("SELECT pid FROM {$CONFIG['TABLE_PICTURES']} WHERE aid = {$CURRENT_ALBUM_DATA['aid']} LIMIT 1"), 0);
        $breadcrumb_links[2] = '<a href="displayimage.php?album='.$CURRENT_ALBUM_DATA['aid'].'&pid='.$pid.'&slideshow=5000">Start slideshow</a>';
    }
Logged

jake

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 39
Re: Slideshow link on the thumbnails.php page
« Reply #7 on: April 08, 2011, 05:25:23 pm »

Αndré,
Your code worked like a charm!  Thank you so much!  You are a hero! 
Logged

Αndré

  • Administrator
  • Coppermine addict
  • *****
  • Country: de
  • Offline Offline
  • Gender: Male
  • Posts: 15764
Re: Slideshow link on the thumbnails.php page
« Reply #8 on: April 11, 2011, 10:06:07 am »

you can tag your answer as "solved" by clicking on the little image in your initial posting on your thread.
Logged
Pages: [1]   Go Up
 

Page created in 0.021 seconds with 17 queries.