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: [RC4 BUGFIX] Picture is in a non existant album (xxx)!?  (Read 6907 times)

0 Members and 1 Guest are viewing this topic.

DJMaze

  • VIP
  • Coppermine addict
  • ***
  • Offline Offline
  • Posts: 831
    • Dragonfly CMS
[RC4 BUGFIX] Picture is in a non existant album (xxx)!?
« on: November 30, 2003, 12:28:46 am »

This is caused by viewing a picture that is in album which doesn't belong in a category.

Open displayimage.php and change:
Clean RC4
Code: [Select]
if (is_numeric($album)) {
                $cat = - $album;
                $actual_cat = $CURRENT_ALBUM_DATA['category'];
                breadcrumb($actual_cat, $breadcrumb, $breadcrumb_text);
                $cat = - $album;
            } else {
                $actual_cat = $CURRENT_ALBUM_DATA['category'];
                $RES = db_query("SELECT catname FROM {$CONFIG['TABLE_CATEGORIES']} WHERE cid='{$CURRENT_ALBUM_DATA['category']}' LIMIT 1");
                if (!mysql_num_rows($RES)) cpg_die(CRITICAL_ERROR, sprintf($lang_errors['pic_in_invalid_album'], $CURRENT_PIC_DATA['aid']), __FILE__, __LINE__);
                $actual_catname = mysql_fetch_array($RES);
                $actual_catname = $actual_catname[0];
                $breadcrumb_text = "$actual_catname > $lang_meta_album_names[$album]";
                breadcrumb(0, $breadcrumb, $breadcrumb_text);
            }

Or after Scotts first fix chang
Code: [Select]
if (is_numeric($album)) {
        $cat = - $album;
        $actual_cat = $CURRENT_ALBUM_DATA['category'];
        breadcrumb($actual_cat, $breadcrumb, $breadcrumb_text);
        $cat = - $album;
    } else {
        $actual_cat = $CURRENT_ALBUM_DATA['category'];
        if ($actual_cat >= FIRST_USER_CAT) {
            $this_name = get_username($actual_cat - FIRST_USER_CAT);
            $this_id = get_userid($this_name);
            if ($this_id < 2) $this_name = 'Mr. X';
            // next line doesn't because of if (defined('INDEX_PHP')) { in lang file
            // $actual_catname = sprintf($lang_list_categories['xx_s_gallery'], $this_name);
            $breadcrumb_text = "<a href=\"$CPG_URL&cat=1\">User galleries</a> > <a href=\"$CPG_URL&cat=$actual_cat\">$this_name</a> > $lang_meta_album_names[$album]";
           breadcrumb(0, $breadcrumb, $breadcrumb_text);
        }
        else {
            $RES = db_query("SELECT catname FROM {$CONFIG['TABLE_CATEGORIES']} WHERE cid='{$CURRENT_ALBUM_DATA['category']}' LIMIT 1");
            if (!mysql_num_rows($RES)) cpg_die(CRITICAL_ERROR, sprintf($lang_errors['pic_in_invalid_album'], $CURRENT_PIC_DATA['aid']), __FILE__, __LINE__);
            $actual_catname = mysql_fetch_array($RES);
            $actual_catname = $actual_catname[0];
            $breadcrumb_text = "$actual_catname > $lang_meta_album_names[$album]";
           breadcrumb(0, $breadcrumb, $breadcrumb_text);
        }
    }


[size=18]Into[/size]
Code: [Select]
if (is_numeric($album)) {
        $cat = - $album;
        $actual_cat = $CURRENT_ALBUM_DATA['category'];
        breadcrumb($actual_cat, $breadcrumb, $breadcrumb_text);
        $cat = - $album;
    } else {
        $actual_cat = $CURRENT_ALBUM_DATA['category'];
        if ($actual_cat >= FIRST_USER_CAT) {
            $this_name = get_username($actual_cat - FIRST_USER_CAT);
            $this_id = get_userid($this_name);
            if ($this_id < 2) $this_name = 'Mr. X';
            // next line doesn't because of if (defined('INDEX_PHP')) { in lang file
            // $actual_catname = sprintf($lang_list_categories['xx_s_gallery'], $this_name);
            $breadcrumb_text = "<a href=\"$CPG_URL&cat=1\">User galleries</a> > <a href=\"$CPG_URL&cat=$actual_cat\">$this_name</a> > $lang_meta_album_names[$album]";
        }
        else if ($actual_cat < 1) {
            $breadcrumb_text = "$lang_meta_album_names[$album]";
        }
        else {
            $RES = db_query("SELECT catname FROM {$CONFIG['TABLE_CATEGORIES']} WHERE cid='{$CURRENT_ALBUM_DATA['category']}' LIMIT 1");
            if (!mysql_num_rows($RES)) cpg_die(CRITICAL_ERROR, sprintf($lang_errors['pic_in_invalid_album'], $CURRENT_PIC_DATA['aid']), __FILE__, __LINE__);
            $actual_catname = mysql_fetch_array($RES);
            $actual_catname = $actual_catname[0];
            $breadcrumb_text = "$actual_catname > $lang_meta_album_names[$album]";
        }
        breadcrumb(0, $breadcrumb, $breadcrumb_text);
    }
Logged
There are 2 kinds of users in this world: satisfied and complainers.
Why do we never hear something from the satisfied users?
http://coppermine-gallery.net/forum/index.php?topic=24315.0

eolica

  • Translator
  • Coppermine frequent poster
  • **
  • Offline Offline
  • Gender: Male
  • Posts: 100
    • http://www.ilvaldinoto.net
[RC4 BUGFIX] Picture is in a non existant album (xxx)!?
« Reply #1 on: November 30, 2003, 01:51:56 am »

I have this error, but the change does worst:
Parse error: parse error, unexpected $ in c:\phpdev5\www\public\726\modules\Coppermine\displayimage.php on line 599

also for normal images
wait a second ... line 599? line 599 is ?>  :!:
Logged
Sesto Avolio

tkx

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 45
[RC4 BUGFIX] Picture is in a non existant album (xxx)!?
« Reply #2 on: November 30, 2003, 05:07:17 am »

Right AFTER the code add in a "}" ... I got the same error but then noticed the if statement wasn't complete right above it, so I closed it off...  I'm not too sure what the old code looked like, but that fixed it..  i am gunna go check if the old code included all that in the above if statement, or if it closed the if statement right above that piece of code.

Quote from: "eolica"
I have this error, but the change does worst:
Parse error: parse error, unexpected $ in c:\phpdev5\www\public\726\modules\Coppermine\displayimage.php on line 599

also for normal images
wait a second ... line 599? line 599 is ?>  :!:
Logged

gtroll

  • VIP
  • Coppermine addict
  • ***
  • Offline Offline
  • Posts: 618
    • CPG-Nuke
[RC4 BUGFIX] Picture is in a non existant album (xxx)!?
« Reply #3 on: November 30, 2003, 05:15:21 am »

DJMaze edited above code to show whole {} so there should be no extra } needed

tkx

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 45
[RC4 BUGFIX] Picture is in a non existant album (xxx)!?
« Reply #4 on: November 30, 2003, 05:20:20 am »

Quote from: "gtroll"
DJMaze edited above code to show whole {} so there should be no extra } needed


I just tried it, still needs the } at the end of the code...

btw: you fix that part about the album name not showing in navigation? :)
Logged

Ivo2

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 21
    • http://www.stammtisch1.net
[RC4 BUGFIX] Picture is in a non existant album (xxx)!?
« Reply #5 on: November 30, 2003, 09:01:54 pm »

thx,

this fixes all my problems in rc04 I've posted.

greetings

Ivo

P.S.: Sorry, but not in admin-mod. I could not make any changes. Looks like that a closing tag failed  :(
Logged
Pages: [1]   Go Up
 

Page created in 0.027 seconds with 19 queries.