Code Duplication    Length = 5-8 lines in 2 locations

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

@@ 2825-2829 (lines=5) @@
2822
    }
2823
2824
    // The student preview was on
2825
    if ($check_student_view &&
2826
        isset($_SESSION['studentview']) && $_SESSION['studentview'] == "studentview"
2827
    ) {
2828
        return false;
2829
    }
2830
2831
    if (!empty($courseId)) {
2832
        $courseId = intval($courseId);
@@ 3101-3108 (lines=8) @@
3098
    // Admins can edit anything.
3099
    if (api_is_platform_admin(false)) {
3100
        //The student preview was on
3101
        if ($check_student_view &&
3102
            isset($_SESSION['studentview']) &&
3103
            $_SESSION['studentview'] == "studentview"
3104
        ) {
3105
            return false;
3106
        } else {
3107
            return true;
3108
        }
3109
    }
3110
3111
    $is_courseAdmin = api_is_course_admin();