Code Duplication    Length = 5-8 lines in 2 locations

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

@@ 2590-2594 (lines=5) @@
2587
    }
2588
2589
    // The student preview was on
2590
    if ($check_student_view &&
2591
        isset($_SESSION['studentview']) && $_SESSION['studentview'] == "studentview"
2592
    ) {
2593
        return false;
2594
    }
2595
2596
    if (!empty($courseId)) {
2597
        $courseId = intval($courseId);
@@ 2867-2874 (lines=8) @@
2864
    // Admins can edit anything.
2865
    if (api_is_platform_admin(false)) {
2866
        //The student preview was on
2867
        if ($check_student_view &&
2868
            isset($_SESSION['studentview']) &&
2869
            $_SESSION['studentview'] == "studentview"
2870
        ) {
2871
            return false;
2872
        } else {
2873
            return true;
2874
        }
2875
    }
2876
2877
    $is_courseAdmin = api_is_course_admin();