Code Duplication    Length = 10-11 lines in 2 locations

main/work/work.lib.php 2 locations

@@ 1251-1260 (lines=10) @@
1248
        $extra_conditions = " (work.post_group_id = '0' or work.post_group_id IS NULL) ";
1249
    }
1250
1251
    if ($is_allowed_to_edit) {
1252
        $extra_conditions .= ' AND work.active IN (0, 1) ';
1253
    } else {
1254
        $extra_conditions .= ' AND work.active IN (0, 1) AND accepted = 1';
1255
        if (isset($course_info['show_score']) && $course_info['show_score'] == 1) {
1256
            $extra_conditions .= " AND work.user_id = ".api_get_user_id()." ";
1257
        } else {
1258
            $extra_conditions .= '';
1259
        }
1260
    }
1261
1262
    $extra_conditions .= " AND parent_id  = ".$work_id."  ";
1263
@@ 1891-1901 (lines=11) @@
1888
            $extra_conditions = " (work.post_group_id = '0' OR work.post_group_id is NULL) ";
1889
        }
1890
1891
        if ($is_allowed_to_edit || $isDrhOfCourse) {
1892
            $extra_conditions .= ' AND work.active IN (0, 1) ';
1893
        } else {
1894
            if (isset($course_info['show_score']) &&
1895
                $course_info['show_score'] == 1
1896
            ) {
1897
                $extra_conditions .= " AND (u.user_id = ".api_get_user_id()." AND work.active IN (0, 1)) ";
1898
            } else {
1899
                $extra_conditions .= ' AND work.active IN (0, 1) ';
1900
            }
1901
        }
1902
1903
        $extra_conditions .= " AND parent_id  = ".$work_id." ";
1904