Code Duplication    Length = 6-19 lines in 5 locations

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

@@ 309-320 (lines=12) @@
306
307
            // At least if the directory doesn't exist, tell so
308
            if (!is_dir($whereToSave)) {
309
                if (!mkdir($whereToSave, api_get_permissions_for_new_directories())) {
310
                    if ($output) {
311
                        Display::addFlash(
312
                            Display::return_message(
313
                                get_lang('DestDirectoryDoesntExist').' ('.$uploadPath.')',
314
                                'error'
315
                            )
316
                        );
317
                    }
318
319
                    return false;
320
                }
321
            }
322
323
            // Just upload the file "as is"

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

@@ 274-292 (lines=19) @@
271
            }
272
        }
273
274
        if (empty($password)) {
275
            if ($authSource === PLATFORM_AUTH_SOURCE) {
276
                Display::addFlash(
277
                    Display::return_message(
278
                        get_lang('ThisFieldIsRequired').': '.get_lang(
279
                            'Password'
280
                        ),
281
                        'warning'
282
                    )
283
                );
284
285
                return false;
286
            }
287
288
            // We use the authSource as password.
289
            // The real validation will be by processed by the auth
290
            // source not Chamilo
291
            //$password = $authSource;
292
        }
293
294
        // database table definition
295
        $table_user = Database::get_main_table(TABLE_MAIN_USER);

plugin/ims_lti/edit.php 1 location

@@ 18-25 (lines=8) @@
15
$plugin = ImsLtiPlugin::create();
16
$tool = ImsLtiTool::fetch($toolId);
17
18
if (empty($tool)) {
19
    Display::addFlash(
20
        Display::return_message($plugin->get_lang('NoTool'), 'error')
21
    );
22
23
    header('Location: '.api_get_path(WEB_PLUGIN_PATH).'ims_lti/list.php');
24
    exit;
25
}
26
27
$form = new FormValidator('ims_lti_edit_tool');
28
$form->addText('name', get_lang('Name'));

main/admin/user_update_import.php 1 location

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

main/admin/user_import.php 1 location

@@ 458-469 (lines=12) @@
455
    Display::addFlash(Display::return_message($warning_message, 'warning', false));
456
    Display::addFlash(Display::return_message($see_message_import, 'confirmation', false));
457
458
    if ($error_kind_file) {
459
        Display::addFlash(
460
            Display::return_message(
461
                get_lang('YouMustImportAFileAccordingToSelectedOption'),
462
                'error',
463
                false
464
            )
465
        );
466
    } else {
467
        header('Location: '.api_get_path(WEB_CODE_PATH).'admin/user_list.php?sec_token='.$tok);
468
        exit;
469
    }
470
}
471
472
Display :: display_header($tool_name);