Code Duplication    Length = 17-19 lines in 2 locations

main/forum/forumfunction.inc.php 1 location

@@ 5371-5387 (lines=17) @@
5368
5369
    $result = Database::query($sql);
5370
    $post_list = array();
5371
    while ($row = Database::fetch_array($result)) {
5372
        $row['status'] = '1';
5373
        $post_list[] = $row;
5374
        $sql = "SELECT * FROM $table_posts posts
5375
                LEFT JOIN $table_users users
5376
                ON (posts.poster_id=users.user_id)
5377
                WHERE
5378
                    posts.c_id = $course_id AND
5379
                    posts.thread_id='$thread_id'
5380
                    AND posts.post_parent_id='".$row['post_id']."'
5381
                ORDER BY posts.post_id ASC";
5382
        $result2 = Database::query($sql);
5383
        while ($row2 = Database::fetch_array($result2)) {
5384
            $row2['status'] = '0';
5385
            $post_list[] = $row2;
5386
        }
5387
    }
5388
5389
    return $post_list;
5390
}

main/inc/lib/tracking.lib.php 1 location

@@ 3087-3105 (lines=19) @@
3084
3085
        $result = Database::query($sql);
3086
3087
        while ($a_courses = Database::fetch_array($result)) {
3088
            $courseId = $a_courses['c_id'];
3089
            $id_session = $a_courses['session_id'];
3090
3091
            $sql = "SELECT DISTINCT srcru.user_id
3092
                    FROM $tbl_session_course_user AS srcru
3093
                    INNER JOIN $tbl_session_user sru
3094
                    ON (srcru.user_id = sru.user_id AND srcru.session_id = sru.session_id)
3095
                    WHERE
3096
                        sru.relation_type<>".SESSION_RELATION_TYPE_RRHH." AND
3097
                        srcru.c_id = '$courseId' AND
3098
                        srcru.session_id = '$id_session'";
3099
3100
            $rs = Database::query($sql);
3101
3102
            while ($row = Database::fetch_array($rs)) {
3103
                $students[$row['user_id']] = $row['user_id'];
3104
            }
3105
        }
3106
3107
        // Then, courses where $coach_id is coach of the session    //
3108
        $sql = 'SELECT session_course_user.user_id