Uploaded image for project: 'phpBB3'
  1. phpBB3
  2. PHPBB3-9995

Unnecessary coding in display_forums() in functions_display.php

    Details

    • Type: Improvement
    • Status: Unverified Fix
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 3.0.8
    • Fix Version/s: 3.0.10-RC1
    • Component/s: Viewing forums
    • Labels:
      None

      Description

      The function display_forums() in includes/function_display.php has some inefficiencies and unnecessary codings when marking as read:

      When marking there is no reason to continue only if the forum is listable, you can continue anyway:
      Line 122:

                // Mark forums read?
       
                if ($mark_read == 'forums' || $mark_read == 'all')
                {
                    if ($auth->acl_get('f_list', $forum_id))
                    {
                        $forum_ids[] = $forum_id;
                    }
                    continue;  // move continue here!
                }
      

      Line 155 ( $forum_ids[] = $forum_id; ) can be deleted since this point is never reached when marking, and $forum_ids[] is only used for this purpose:

                if (!$auth->acl_get('f_list', $forum_id))
                {
                    // if the user does not have permissions to list this forum, skip everything until next branch
                    $right_id = $row['right_id'];
                    continue;
                }
        
                $forum_ids[] = $forum_id; // can be deleted!
      

      Additionally in general: If $mark_read='all', you don't need to do the whole SQL-stuff, could be bypassed in any way

        Attachments

          Activity

            People

            • Assignee:
              bantu Andreas Fischer
              Reporter:
              updown updown [X] (Inactive)
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: