Code Duplication    Length = 5-8 lines in 2 locations

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

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