Code Duplication    Length = 5-8 lines in 2 locations

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

@@ 2557-2561 (lines=5) @@
2554
    }
2555
2556
    // The student preview was on
2557
    if ($check_student_view &&
2558
        isset($_SESSION['studentview']) && $_SESSION['studentview'] == "studentview"
2559
    ) {
2560
        return false;
2561
    }
2562
2563
    if (!empty($courseId)) {
2564
        $courseId = intval($courseId);
@@ 2834-2841 (lines=8) @@
2831
    // Admins can edit anything.
2832
    if (api_is_platform_admin(false)) {
2833
        //The student preview was on
2834
        if ($check_student_view &&
2835
            isset($_SESSION['studentview']) &&
2836
            $_SESSION['studentview'] == "studentview"
2837
        ) {
2838
            return false;
2839
        } else {
2840
            return true;
2841
        }
2842
    }
2843
2844
    $is_courseAdmin = api_is_course_admin();