Code Duplication    Length = 5-8 lines in 2 locations

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

@@ 2634-2638 (lines=5) @@
2631
    }
2632
2633
    // The student preview was on
2634
    if ($check_student_view &&
2635
        isset($_SESSION['studentview']) && $_SESSION['studentview'] == "studentview"
2636
    ) {
2637
        return false;
2638
    }
2639
2640
    if (!empty($courseId)) {
2641
        $courseId = intval($courseId);
@@ 2911-2918 (lines=8) @@
2908
    // Admins can edit anything.
2909
    if (api_is_platform_admin(false)) {
2910
        //The student preview was on
2911
        if ($check_student_view &&
2912
            isset($_SESSION['studentview']) &&
2913
            $_SESSION['studentview'] == "studentview"
2914
        ) {
2915
            return false;
2916
        } else {
2917
            return true;
2918
        }
2919
    }
2920
2921
    $is_courseAdmin = api_is_course_admin();