Code Duplication    Length = 5-8 lines in 2 locations

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

@@ 2829-2833 (lines=5) @@
2826
    }
2827
2828
    // The student preview was on
2829
    if ($check_student_view &&
2830
        isset($_SESSION['studentview']) && $_SESSION['studentview'] == "studentview"
2831
    ) {
2832
        return false;
2833
    }
2834
2835
    if (!empty($courseId)) {
2836
        $courseId = intval($courseId);
@@ 3105-3112 (lines=8) @@
3102
    // Admins can edit anything.
3103
    if (api_is_platform_admin(false)) {
3104
        //The student preview was on
3105
        if ($check_student_view &&
3106
            isset($_SESSION['studentview']) &&
3107
            $_SESSION['studentview'] == "studentview"
3108
        ) {
3109
            return false;
3110
        } else {
3111
            return true;
3112
        }
3113
    }
3114
3115
    $is_courseAdmin = api_is_course_admin();