Code Duplication    Length = 6-7 lines in 3 locations

main/inc/lib/api.lib.php 3 locations

@@ 5870-5875 (lines=6) @@
5867
 * @author Yannick Warnier <[email protected]>
5868
 */
5869
function api_is_in_course($course_code = null) {
5870
    if (isset($_SESSION['_course']['sysCode'])) {
5871
        if (!empty($course_code)) {
5872
            return $course_code == $_SESSION['_course']['sysCode'];
5873
        }
5874
        return true;
5875
    }
5876
    return false;
5877
}
5878
@@ 5889-5895 (lines=7) @@
5886
 */
5887
function api_is_in_group($group_id = null, $course_code = null) {
5888
5889
    if (!empty($course_code)) {
5890
        if (isset($_SESSION['_course']['sysCode'])) {
5891
            if ($course_code != $_SESSION['_course']['sysCode']) return false;
5892
        } else {
5893
            return false;
5894
        }
5895
    }
5896
5897
    if (isset($_SESSION['_gid']) && $_SESSION['_gid'] != '') {
5898
        if (!empty($group_id)) {
@@ 5897-5903 (lines=7) @@
5894
        }
5895
    }
5896
5897
    if (isset($_SESSION['_gid']) && $_SESSION['_gid'] != '') {
5898
        if (!empty($group_id)) {
5899
            return $group_id == $_SESSION['_gid'];
5900
        } else {
5901
            return true;
5902
        }
5903
    }
5904
    return false;
5905
}
5906