Code Duplication    Length = 5-8 lines in 2 locations

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

@@ 2849-2853 (lines=5) @@
2846
    }
2847
2848
    // The student preview was on
2849
    if ($check_student_view &&
2850
        isset($_SESSION['studentview']) && $_SESSION['studentview'] == "studentview"
2851
    ) {
2852
        return false;
2853
    }
2854
2855
    if (!empty($courseId)) {
2856
        $courseId = intval($courseId);
@@ 3125-3132 (lines=8) @@
3122
    // Admins can edit anything.
3123
    if (api_is_platform_admin(false)) {
3124
        //The student preview was on
3125
        if ($check_student_view &&
3126
            isset($_SESSION['studentview']) &&
3127
            $_SESSION['studentview'] == "studentview"
3128
        ) {
3129
            return false;
3130
        } else {
3131
            return true;
3132
        }
3133
    }
3134
3135
    $is_courseAdmin = api_is_course_admin();