Code Duplication    Length = 5-8 lines in 2 locations

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

@@ 2642-2646 (lines=5) @@
2639
    }
2640
2641
    // The student preview was on
2642
    if ($check_student_view &&
2643
        isset($_SESSION['studentview']) && $_SESSION['studentview'] == "studentview"
2644
    ) {
2645
        return false;
2646
    }
2647
2648
    if (!empty($courseId)) {
2649
        $courseId = intval($courseId);
@@ 2918-2925 (lines=8) @@
2915
    // Admins can edit anything.
2916
    if (api_is_platform_admin(false)) {
2917
        //The student preview was on
2918
        if ($check_student_view &&
2919
            isset($_SESSION['studentview']) &&
2920
            $_SESSION['studentview'] == "studentview"
2921
        ) {
2922
            return false;
2923
        } else {
2924
            return true;
2925
        }
2926
    }
2927
2928
    $is_courseAdmin = api_is_course_admin();