Fixing missing index inactive_[prev,next]_tab notices Fixing missing index inactive_[prev,next]_tab notices
 

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

Fixing missing index inactive_[prev,next]_tab notices

Started by flar, April 28, 2006, 10:10:07 AM

Previous topic - Next topic

0 Members and 2 Guests are viewing this topic.

flar

I recently turned on debug mode and notices and saw a few errors about missing inactive_*_tab indices.  They look like they are harmless, but I decided to fix them anyway since the fix was simple and got rid of some "noise" in the debug output.

It looks like there are 3 locations where these values are used as indices into an array but the entries are never created in any array anywhere (that I could find by searching).  They may be obsolete entries for a feature which is now gone and maybe these lines can be deleted, but I decided to just put tests around them to only make the string substitutions if they are set in the array.  This made the notices go away and the code is still there in case some other themes may use this feature.

In include/themes.inc.php, find these 2 lines in 3 places (NOTE that the text <some LINK substitutions> varies by location):

    $theme_alb_list_tab_tmpl['inactive_next_tab'] = strtr($theme_alb_list_tab_tmpl['inactive_next_tab'], <some LINK substitutions>);
    $theme_alb_list_tab_tmpl['inactive_prev_tab'] = strtr($theme_alb_list_tab_tmpl['inactive_prev_tab'], <some LINK substitutions>);

and put the following tests around the lines (preserve the original lines above where you see <Same text as the line above> here):

    if (isset($theme_thumb_tab_tmpl['inactive_next_tab'])) {
        <Same text as first line above>
    }
    if (isset($theme_thumb_tab_tmpl['inactive_prev_tab'])) {
        <Same text as second line above>
    }


Some of the themes may have similar code (I also found these lines in the sample theme) and so may need the same tests inserted in them, especially if you based a theme off of the sample theme.

Paver

I meant to look into this some day and now I have.  Thanks for your comments, flar.

Instead of your suggestion, I added in the two missing entries to $template_tab_display and wrote some placeholder code to process these entries in create_tabs() which is in functions.inc.php.  I left implementing this code to the devel branch since it will change the look of the tabs and didn't want to add a new feature to the 1.4.x series.

I committed my changes to the stable & devel branch as a fix for the errant notices.  I put the code implementation on the to-do list for 1.5.