Code Duplication    Length = 4-11 lines in 7 locations

main/auth/profile.php 1 location

@@ 547-557 (lines=11) @@
544
                $changeemail = $user_data['email'];
545
            }
546
547
            if (!check_user_email($user_data['email']) &&
548
                empty($user_data['password0'])
549
            ){
550
                Display::addFlash(
551
                    Display:: return_message(
552
                        get_lang('ToChangeYourEmailMustTypeYourPassword'),
553
                        'error',
554
                        false
555
                    )
556
                );
557
            }
558
        }
559
    }
560

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

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

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

@@ 282-286 (lines=5) @@
279
            }
280
        }
281
282
        if (empty($password)) {
283
            Display::addFlash(Display::return_message(get_lang('ThisFieldIsRequired').': '.get_lang('Password') , 'warning'));
284
285
            return false;
286
        }
287
288
        // database table definition
289
        $table_user = Database::get_main_table(TABLE_MAIN_USER);

main/dropbox/dropbox_functions.inc.php 3 locations

@@ 952-955 (lines=4) @@
949
        return false;
950
    }
951
952
    if (empty($file['name'])) {
953
        Display::addFlash(Display::return_message(get_lang('NoFileSpecified'), 'warning'));
954
        return false;
955
    }
956
957
    // are we overwriting a previous file or sending a new one
958
@@ 979-983 (lines=5) @@
976
    }
977
978
    // check if the file is actually uploaded
979
    if (!is_uploaded_file($dropbox_filetmpname)) { // check user fraud : no clean error msg.
980
        Display::addFlash(Display::return_message(get_lang('TheFileIsNotUploaded'), 'warning'));
981
982
        return false;
983
    }
984
985
    $upload_ok = process_uploaded_file($file, true);
986
@@ 999-1002 (lines=4) @@
996
    $dropbox_filename = php2phps($dropbox_filename);
997
998
    //filter extension
999
    if (!filter_extension($dropbox_filename)) {
1000
        Display::addFlash(Display::return_message(get_lang('UplUnableToSaveFileFilteredExtension'), 'warning'));
1001
        return false;
1002
    }
1003
1004
    // set title
1005
    $dropbox_title = $dropbox_filename;

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

@@ 233-239 (lines=7) @@
230
    $maxSpace = DocumentManager::get_course_quota();
231
232
    // Check if there is enough space to save the file
233
    if (!DocumentManager::enough_space($uploadedFile['size'], $maxSpace)) {
234
        if ($output) {
235
            Display::addFlash(Display::return_message(get_lang('UplNotEnoughSpace'), 'error'));
236
        }
237
238
        return false;
239
    }
240
241
    // If the want to unzip, check if the file has a .zip (or ZIP,Zip,ZiP,...) extension
242
    if ($unzip == 1 && preg_match('/.zip$/', strtolower($uploadedFile['name']))) {