Code Duplication    Length = 5-9 lines in 9 locations

main/admin/course_category.php 1 location

@@ 37-42 (lines=6) @@
34
                header('Location: ' . api_get_self() . '?category=' . Security::remove_XSS($category));
35
                exit();
36
            }
37
        } else {
38
            deleteNode($categoryId);
39
            Display::addFlash(Display::return_message(get_lang('Deleted')));
40
            header('Location: ' . api_get_self() . '?category=' . Security::remove_XSS($category));
41
            exit();
42
        }
43
    } elseif (($action == 'add' || $action == 'edit') && isset($_POST['formSent']) && $_POST['formSent']) {
44
        if ($action == 'add') {
45
            $ret = addNode(

main/inc/ajax/social.ajax.php 1 location

@@ 44-49 (lines=6) @@
41
        } else {
42
            $relation_type = USER_RELATION_TYPE_UNKNOW;//Contact unknown
43
        }
44
        if (isset($_GET['denied_friend_id'])) {
45
            SocialManager::invitation_denied($_GET['denied_friend_id'], $current_user_id);
46
            Display::display_confirmation_message(api_xml_http_response_encode(get_lang('InvitationDenied')));
47
            
48
            header('Location: ' . api_get_path(WEB_CODE_PATH) . 'social/invitations.php');
49
        }
50
        break;
51
    case 'delete_friend':
52
        if (api_is_anonymous()) {

main/session/session_course_user.php 1 location

@@ 83-87 (lines=5) @@
80
        exit;
81
    }
82
83
    if (count($CourseList) == count($existingCourses)) {
84
        Display::addFlash(Display::return_message(get_lang('MaybeYouWantToDeleteThisUserFromSession')));
85
        header('Location: session_course_user.php?id_session='.$id_session.'&id_user='.$id_user);
86
        exit;
87
    }
88
89
    foreach ($CourseList as $enreg_course) {
90
        $exists = false;

main/social/profile.php 1 location

@@ 88-94 (lines=7) @@
85
    $messageInfo = MessageManager::get_message_by_id($messageId);
86
    if (!empty($messageInfo)) {
87
        // I can only delete messages of my own wall
88
        if ($messageInfo['user_receiver_id'] == $user_id) {
89
            $status = SocialManager::deleteMessage($messageId);
90
91
            Display::addFlash(Display::return_message(get_lang('MessageDeleted')));
92
            header('Location: ' . api_get_path(WEB_CODE_PATH) . 'social/profile.php');
93
            exit;
94
        }
95
    }
96
    api_not_allowed(true);
97
} else if (isset($_GET['u'])) { //I'm your friend? I can see your profile?

main/admin/user_import.php 1 location

@@ 430-435 (lines=6) @@
427
428
    Display::addFlash(Display::return_message($see_message_import, 'confirmation', false));
429
430
    if ($error_kind_file) {
431
        Display::addFlash(Display::return_message(get_lang('YouMustImportAFileAccordingToSelectedOption'), 'error', false));
432
    } else {
433
        header('Location: '.api_get_path(WEB_CODE_PATH).'admin/user_list.php?sec_token='.$tok);
434
        exit;
435
    }
436
}
437
438
Display :: display_header($tool_name);

main/admin/user_update_import.php 1 location

@@ 411-416 (lines=6) @@
408
    // if the warning message is too long then we display the warning message trough a session
409
    Display::addFlash(Display::return_message($warning_message, 'warning', false));
410
411
    if ($error_kind_file) {
412
        Display::addFlash(Display::return_message(get_lang('YouMustImportAFileAccordingToSelectedOption'), 'error', false));
413
    } else {
414
        header('Location: '.api_get_path(WEB_CODE_PATH).'admin/user_list.php?sec_token='.$tok);
415
        exit;
416
    }
417
418
}
419
Display :: display_header($tool_name);

main/exercice/exercise_report.php 1 location

@@ 247-253 (lines=7) @@
244
            api_get_user_id()
245
        );
246
247
        if ($allowCoachFeedbackExercises) {
248
            Display::addFlash(
249
                Display::return_message(get_lang('MessageSent'))
250
            );
251
            header('Location: ' . api_get_self().'?'.api_get_cidreq().'&exerciseId='.$exerciseId);
252
            exit;
253
        }
254
    }
255
256
    // Updating LP score here

main/auth/lostPassword.php 1 location

@@ 101-107 (lines=7) @@
98
        exit;
99
    }
100
101
    if ($user['auth_source'] == 'extldap') {
102
        Display::addFlash(
103
            Display::return_message(get_lang('CouldNotResetPasswordBecauseLDAP'), 'info', false)
104
        );
105
        header('Location: ' . api_get_path(WEB_PATH));
106
        exit;
107
    }
108
109
    $userResetPasswordSetting = api_get_setting('user_reset_password');
110

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

@@ 291-299 (lines=9) @@
288
289
            // At least if the directory doesn't exist, tell so
290
            if (!is_dir($whereToSave)) {
291
                if (!mkdir($whereToSave, api_get_permissions_for_new_directories())) {
292
                    if ($output) {
293
                        Display::addFlash(
294
                            Display::return_message(get_lang('DestDirectoryDoesntExist').' ('.$uploadPath.')', 'error')
295
                        );
296
                    }
297
298
                    return false;
299
                }
300
            }
301
302
            // Just upload the file "as is"