Code Duplication    Length = 4-11 lines in 12 locations

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

@@ 529-535 (lines=7) @@
526
        }
527
528
        // If the URL is invalid, an error occurs.
529
        if (!api_valid_url($values['url'], true)) {
530
            Display::addFlash(
531
                Display::return_message(get_lang('GiveURL'), 'error')
532
            );
533
534
            return false;
535
        }
536
537
        // Finding the old category_id.
538
        $sql = "SELECT * FROM " . $tbl_link . "

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

@@ 162-166 (lines=5) @@
159
        }
160
        $original_password = $password;
161
162
        if (empty($password)) {
163
            Display::addFlash(Display::return_message(get_lang('ThisFieldIsRequired').': '.get_lang('Password') , 'warning'));
164
165
            return false;
166
        }
167
168
        // database table definition
169
        $table_user = Database::get_main_table(TABLE_MAIN_USER);

main/auth/profile.php 1 location

@@ 634-644 (lines=11) @@
631
                $changeemail = $user_data['email'];
632
            }
633
634
            if (!check_user_email($user_data['email']) && empty($user_data['password0'])) {
635
                Display::addFlash(
636
                    Display:: return_message(
637
                        get_lang('ToChangeYourEmailMustTypeYourPassword'),
638
                        'error',
639
                        false
640
                    )
641
                );
642
            }
643
        }
644
    }
645
646
    // Upload picture if a new one is provided
647
    if ($_FILES['picture']['size']) {

main/dropbox/dropbox_functions.inc.php 3 locations

@@ 850-853 (lines=4) @@
847
        return false;
848
    }
849
850
    if (empty($file['name'])) {
851
        Display::addFlash(Display::return_message(get_lang('NoFileSpecified'), 'warning'));
852
        return false;
853
    }
854
855
    // are we overwriting a previous file or sending a new one
856
@@ 878-882 (lines=5) @@
875
    }
876
877
    // check if the file is actually uploaded
878
    if (!is_uploaded_file($dropbox_filetmpname)) { // check user fraud : no clean error msg.
879
        Display::addFlash(Display::return_message(get_lang('TheFileIsNotUploaded'), 'warning'));
880
881
        return false;
882
    }
883
884
    $upload_ok = process_uploaded_file($file, true);
885
@@ 898-901 (lines=4) @@
895
    $dropbox_filename = php2phps($dropbox_filename);
896
897
    //filter extension
898
    if (!filter_extension($dropbox_filename)) {
899
        Display::addFlash(Display::return_message(get_lang('UplUnableToSaveFileFilteredExtension'), 'warning'));
900
        return false;
901
    }
902
903
    // set title
904
    $dropbox_title = $dropbox_filename;

main/forum/forumfunction.inc.php 1 location

@@ 2494-2502 (lines=9) @@
2491
        $has_attachment = true;
2492
    }
2493
2494
    if (!$upload_ok) {
2495
        if ($showMessage) {
2496
            Display::addFlash(
2497
                Display::return_message(get_lang('UplNoFileUploaded'), 'error', false)
2498
            );
2499
        }
2500
2501
        return null;
2502
    }
2503
2504
    $post_date = new DateTime(api_get_utc_datetime(), new DateTimeZone('UTC'));
2505

main/glossary/index.php 5 locations

@@ 289-293 (lines=5) @@
286
                }
287
            }
288
289
            if (count($termsDeleted) > 0) {
290
                Display::addFlash(
291
                    Display::return_message(get_lang("TermDeleted").': '.implode(', ', $termsDeleted))
292
                );
293
            }
294
295
            if (count($updatedList) > 0) {
296
                Display::addFlash(
@@ 295-299 (lines=5) @@
292
                );
293
            }
294
295
            if (count($updatedList) > 0) {
296
                Display::addFlash(
297
                    Display::return_message(get_lang("TermsUpdated").': '.implode(', ', $updatedList))
298
                );
299
            }
300
301
            if (count($addedList) > 0) {
302
                Display::addFlash(
@@ 301-305 (lines=5) @@
298
                );
299
            }
300
301
            if (count($addedList) > 0) {
302
                Display::addFlash(
303
                    Display::return_message(get_lang("TermsAdded").': '.implode(', ', $addedList))
304
                );
305
            }
306
307
            if (count($badList) > 0) {
308
                Display::addFlash(
@@ 307-314 (lines=8) @@
304
                );
305
            }
306
307
            if (count($badList) > 0) {
308
                Display::addFlash(
309
                    Display::return_message(
310
                        get_lang("GlossaryTermAlreadyExists").': ' . implode(', ', $badList),
311
                        'error'
312
                    )
313
                );
314
            }
315
316
            if (count($doubles) > 0) {
317
                Display::addFlash(
@@ 316-323 (lines=8) @@
313
                );
314
            }
315
316
            if (count($doubles) > 0) {
317
                Display::addFlash(
318
                    Display::return_message(
319
                        get_lang("TermsDuplicatedInFile").': '.implode(', ', $doubles),
320
                        'warning'
321
                    )
322
                );
323
            }
324
325
            header('Location: '.$currentUrl);
326
            exit;