Code Duplication    Length = 5-8 lines in 2 locations

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

@@ 2580-2584 (lines=5) @@
2577
    }
2578
2579
    // The student preview was on
2580
    if ($check_student_view &&
2581
        isset($_SESSION['studentview']) && $_SESSION['studentview'] == "studentview"
2582
    ) {
2583
        return false;
2584
    }
2585
2586
    if (!empty($courseId)) {
2587
        $courseId = intval($courseId);
@@ 2857-2864 (lines=8) @@
2854
    // Admins can edit anything.
2855
    if (api_is_platform_admin(false)) {
2856
        //The student preview was on
2857
        if ($check_student_view &&
2858
            isset($_SESSION['studentview']) &&
2859
            $_SESSION['studentview'] == "studentview"
2860
        ) {
2861
            return false;
2862
        } else {
2863
            return true;
2864
        }
2865
    }
2866
2867
    $is_courseAdmin = api_is_course_admin();