Code Duplication    Length = 5-8 lines in 2 locations

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

@@ 2835-2839 (lines=5) @@
2832
    }
2833
2834
    // The student preview was on
2835
    if ($check_student_view &&
2836
        isset($_SESSION['studentview']) && $_SESSION['studentview'] == "studentview"
2837
    ) {
2838
        return false;
2839
    }
2840
2841
    if (!empty($courseId)) {
2842
        $courseId = intval($courseId);
@@ 3111-3118 (lines=8) @@
3108
    // Admins can edit anything.
3109
    if (api_is_platform_admin(false)) {
3110
        //The student preview was on
3111
        if ($check_student_view &&
3112
            isset($_SESSION['studentview']) &&
3113
            $_SESSION['studentview'] == "studentview"
3114
        ) {
3115
            return false;
3116
        } else {
3117
            return true;
3118
        }
3119
    }
3120
3121
    $is_courseAdmin = api_is_course_admin();