Code Duplication    Length = 5-8 lines in 2 locations

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

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