Code Duplication    Length = 9-13 lines in 2 locations

main/forum/forumfunction.inc.php 2 locations

@@ 1595-1607 (lines=13) @@
1592
    (last_post_id, last_poster_id, last_post_date, last_poster_name, last_poster_lastname, last_poster_firstname)*/
1593
    if ($id == '') {
1594
        if (is_array($forum_list)) {
1595
            foreach ($forum_list as $key => $value) {
1596
                $last_post_info_of_forum = get_last_post_information(
1597
                    $key,
1598
                    api_is_allowed_to_edit(),
1599
                    $course_id
1600
                );
1601
                $forum_list[$key]['last_post_id'] = $last_post_info_of_forum['last_post_id'];
1602
                $forum_list[$key]['last_poster_id'] = $last_post_info_of_forum['last_poster_id'];
1603
                $forum_list[$key]['last_post_date'] = $last_post_info_of_forum['last_post_date'];
1604
                $forum_list[$key]['last_poster_name'] = $last_post_info_of_forum['last_poster_name'];
1605
                $forum_list[$key]['last_poster_lastname'] = $last_post_info_of_forum['last_poster_lastname'];
1606
                $forum_list[$key]['last_poster_firstname'] = $last_post_info_of_forum['last_poster_firstname'];
1607
            }
1608
        } else {
1609
            $forum_list = array();
1610
        }
@@ 4993-5001 (lines=9) @@
4990
4991
    // Finding the last post information (last_post_id, last_poster_id, last_post_date, last_poster_name, last_poster_lastname, last_poster_firstname).
4992
    if (!empty($forum_list)) {
4993
        foreach ($forum_list as $key => $value) {
4994
            $last_post_info_of_forum = get_last_post_information($key, api_is_allowed_to_edit());
4995
            $forum_list[$key]['last_post_id'] = $last_post_info_of_forum['last_post_id'];
4996
            $forum_list[$key]['last_poster_id'] = $last_post_info_of_forum['last_poster_id'];
4997
            $forum_list[$key]['last_post_date'] = $last_post_info_of_forum['last_post_date'];
4998
            $forum_list[$key]['last_poster_name'] = $last_post_info_of_forum['last_poster_name'];
4999
            $forum_list[$key]['last_poster_lastname'] = $last_post_info_of_forum['last_poster_lastname'];
5000
            $forum_list[$key]['last_poster_firstname'] = $last_post_info_of_forum['last_poster_firstname'];
5001
        }
5002
    }
5003
5004
    return $forum_list;