Code Duplication    Length = 17-19 lines in 2 locations

main/forum/forumfunction.inc.php 1 location

@@ 5395-5411 (lines=17) @@
5392
5393
    $result = Database::query($sql);
5394
    $post_list = array();
5395
    while ($row = Database::fetch_array($result)) {
5396
        $row['status'] = '1';
5397
        $post_list[] = $row;
5398
        $sql = "SELECT * FROM $table_posts posts
5399
                LEFT JOIN $table_users users
5400
                ON (posts.poster_id=users.user_id)
5401
                WHERE
5402
                    posts.c_id = $course_id AND
5403
                    posts.thread_id='$thread_id'
5404
                    AND posts.post_parent_id='".$row['post_id']."'
5405
                ORDER BY posts.post_id ASC";
5406
        $result2 = Database::query($sql);
5407
        while ($row2 = Database::fetch_array($result2)) {
5408
            $row2['status'] = '0';
5409
            $post_list[] = $row2;
5410
        }
5411
    }
5412
5413
    return $post_list;
5414
}

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

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