Code Duplication    Length = 3-6 lines in 3 locations

main/auth/profile.php 1 location

@@ 29-31 (lines=3) @@
26
27
$_SESSION['this_section'] = $this_section;
28
29
if (!(isset($_user['user_id']) && $_user['user_id']) || api_is_anonymous($_user['user_id'], true)) {
30
    api_not_allowed(true);
31
}
32
33
$htmlHeadXtra[] = api_get_password_checker_js('#username', '#password1');
34
$htmlHeadXtra[] = '<link  href="'. api_get_path(WEB_PATH) .'web/assets/cropper/dist/cropper.min.css" rel="stylesheet">';

main/survey/fillsurvey.php 1 location

@@ 67-72 (lines=6) @@
64
    $resultAnonymous = Database::query($sql);
65
    $rowAnonymous = Database::fetch_array($resultAnonymous, 'ASSOC');
66
    // If is anonymous and is not allowed to take the survey to anonymous users, forbid access:
67
    if (!isset($rowAnonymous['anonymous']) ||
68
        ($rowAnonymous['anonymous'] == 0 && api_is_anonymous()) ||
69
        count($rowAnonymous) == 0
70
    ) {
71
        api_not_allowed(true);
72
    }
73
    // If is anonymous and it is allowed to take the survey as anonymous, mark survey as anonymous.
74
}
75

main/inc/lib/api.lib.php 1 location

@@ 1123-1126 (lines=4) @@
1120
function api_block_anonymous_users($printHeaders = true)
1121
{
1122
    $user = api_get_user_info();
1123
    if (!(isset($user['user_id']) && $user['user_id']) || api_is_anonymous($user['user_id'], true)) {
1124
        api_not_allowed($printHeaders);
1125
        return false;
1126
    }
1127
1128
    return true;
1129
}