forum.coppermine-gallery.net

Support => Older/other versions => cpg1.2 PHPnuke/Postnuke Support => Topic started by: DJMaze on November 30, 2003, 12:28:46 am

Title: [RC4 BUGFIX] Picture is in a non existant album (xxx)!?
Post by: DJMaze 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);
    }
Title: [RC4 BUGFIX] Picture is in a non existant album (xxx)!?
Post by: eolica 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 ?>  :!:
Title: [RC4 BUGFIX] Picture is in a non existant album (xxx)!?
Post by: tkx 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 ?>  :!:
Title: [RC4 BUGFIX] Picture is in a non existant album (xxx)!?
Post by: gtroll on November 30, 2003, 05:15:21 am
DJMaze edited above code to show whole {} so there should be no extra } needed
Title: [RC4 BUGFIX] Picture is in a non existant album (xxx)!?
Post by: tkx 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? :)
Title: [RC4 BUGFIX] Picture is in a non existant album (xxx)!?
Post by: Ivo2 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  :(