Code Duplication    Length = 11-15 lines in 2 locations

main/forum/forumfunction.inc.php 2 locations

@@ 1615-1629 (lines=15) @@
1612
    (last_post_id, last_poster_id, last_post_date, last_poster_name, last_poster_lastname, last_poster_firstname)*/
1613
    if ($id == '') {
1614
        if (is_array($forum_list)) {
1615
            foreach ($forum_list as $key => $value) {
1616
                $last_post_info_of_forum = get_last_post_information(
1617
                    $key,
1618
                    api_is_allowed_to_edit(),
1619
                    $course_id
1620
                );
1621
1622
                if ($last_post_info_of_forum) {
1623
                    $forum_list[$key]['last_post_id'] = $last_post_info_of_forum['last_post_id'];
1624
                    $forum_list[$key]['last_poster_id'] = $last_post_info_of_forum['last_poster_id'];
1625
                    $forum_list[$key]['last_post_date'] = $last_post_info_of_forum['last_post_date'];
1626
                    $forum_list[$key]['last_poster_name'] = $last_post_info_of_forum['last_poster_name'];
1627
                    $forum_list[$key]['last_poster_lastname'] = $last_post_info_of_forum['last_poster_lastname'];
1628
                    $forum_list[$key]['last_poster_firstname'] = $last_post_info_of_forum['last_poster_firstname'];
1629
                }
1630
            }
1631
        } else {
1632
            $forum_list = array();
@@ 5141-5151 (lines=11) @@
5138
    // Finding the last post information
5139
    // (last_post_id, last_poster_id, last_post_date, last_poster_name, last_poster_lastname, last_poster_firstname).
5140
    if (!empty($forum_list)) {
5141
        foreach ($forum_list as $key => $value) {
5142
            $last_post_info_of_forum = get_last_post_information($key, api_is_allowed_to_edit());
5143
            if ($last_post_info_of_forum) {
5144
                $forum_list[$key]['last_post_id'] = $last_post_info_of_forum['last_post_id'];
5145
                $forum_list[$key]['last_poster_id'] = $last_post_info_of_forum['last_poster_id'];
5146
                $forum_list[$key]['last_post_date'] = $last_post_info_of_forum['last_post_date'];
5147
                $forum_list[$key]['last_poster_name'] = $last_post_info_of_forum['last_poster_name'];
5148
                $forum_list[$key]['last_poster_lastname'] = $last_post_info_of_forum['last_poster_lastname'];
5149
                $forum_list[$key]['last_poster_firstname'] = $last_post_info_of_forum['last_poster_firstname'];
5150
            }
5151
        }
5152
    }
5153
5154
    return $forum_list;