[RC4 BUGFIX] Picture is in a non existant album (xxx)!? [RC4 BUGFIX] Picture is in a non existant album (xxx)!?
 

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

[RC4 BUGFIX] Picture is in a non existant album (xxx)!?

Started by DJMaze, November 30, 2003, 12:28:46 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

DJMaze

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

Open displayimage.php and change:
Clean RC4if (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
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]
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);
    }
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

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 ?>  :!:
Sesto Avolio

tkx

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 ?>  :!:


tkx

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? :)

Ivo2

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  :(