Code Duplication    Length = 6-7 lines in 3 locations

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

@@ 5885-5890 (lines=6) @@
5882
 * @author Yannick Warnier <[email protected]>
5883
 */
5884
function api_is_in_course($course_code = null) {
5885
    if (isset($_SESSION['_course']['sysCode'])) {
5886
        if (!empty($course_code)) {
5887
            return $course_code == $_SESSION['_course']['sysCode'];
5888
        }
5889
        return true;
5890
    }
5891
    return false;
5892
}
5893
@@ 5904-5910 (lines=7) @@
5901
 */
5902
function api_is_in_group($group_id = null, $course_code = null) {
5903
5904
    if (!empty($course_code)) {
5905
        if (isset($_SESSION['_course']['sysCode'])) {
5906
            if ($course_code != $_SESSION['_course']['sysCode']) return false;
5907
        } else {
5908
            return false;
5909
        }
5910
    }
5911
5912
    if (isset($_SESSION['_gid']) && $_SESSION['_gid'] != '') {
5913
        if (!empty($group_id)) {
@@ 5912-5918 (lines=7) @@
5909
        }
5910
    }
5911
5912
    if (isset($_SESSION['_gid']) && $_SESSION['_gid'] != '') {
5913
        if (!empty($group_id)) {
5914
            return $group_id == $_SESSION['_gid'];
5915
        } else {
5916
            return true;
5917
        }
5918
    }
5919
    return false;
5920
}
5921