Code Duplication    Length = 14-14 lines in 3 locations

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

@@ 976-989 (lines=14) @@
973
        }
974
975
        // This is the common name for the new photos.
976
        if (KEEP_THE_NAME_WHEN_CHANGE_IMAGE && !empty($old_file)) {
977
            $old_extension = strtolower(substr(strrchr($old_file, '.'), 1));
978
            $filename = in_array($old_extension, $allowed_types) ? substr($old_file, 0, -strlen($old_extension)) : $old_file;
979
            $filename = (substr($filename, -1) == '.') ? $filename.$extension : $filename.'.'.$extension;
980
        } else {
981
            $filename = api_replace_dangerous_char($filename);
982
            if (PREFIX_IMAGE_FILENAME_WITH_UID) {
983
                $filename = uniqid('').'_'.$filename;
984
            }
985
            // We always prefix user photos with user ids, so on setting
986
            // api_get_setting('split_users_upload_directory') === 'true'
987
            // the correspondent directories to be found successfully.
988
            $filename = $group_id.'_'.$filename;
989
        }
990
991
        // Storing the new photos in 4 versions with various sizes.
992

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

@@ 1623-1636 (lines=14) @@
1620
        }
1621
1622
        // This is the common name for the new photos.
1623
        if (KEEP_THE_NAME_WHEN_CHANGE_IMAGE && !empty($old_file)) {
1624
            $old_extension = strtolower(substr(strrchr($old_file, '.'), 1));
1625
            $filename = in_array($old_extension, $allowed_types) ? substr($old_file, 0, -strlen($old_extension)) : $old_file;
1626
            $filename = (substr($filename, -1) == '.') ? $filename.$extension : $filename.'.'.$extension;
1627
        } else {
1628
            $filename = api_replace_dangerous_char($filename);
1629
            if (PREFIX_IMAGE_FILENAME_WITH_UID) {
1630
                $filename = uniqid('').'_'.$filename;
1631
            }
1632
            // We always prefix user photos with user ids, so on setting
1633
            // api_get_setting('split_users_upload_directory') === 'true'
1634
            // the correspondent directories to be found successfully.
1635
            $filename = $user_id.'_'.$filename;
1636
        }
1637
1638
        //Crop the image to adjust 1:1 ratio
1639
        $image = new Image($source_file);

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

@@ 1108-1121 (lines=14) @@
1105
        }
1106
1107
        // This is the common name for the new photos.
1108
        if (KEEP_THE_NAME_WHEN_CHANGE_IMAGE && !empty($old_file)) {
1109
            $old_extension = strtolower(substr(strrchr($old_file, '.'), 1));
1110
            $filename = in_array($old_extension, $allowed_types) ? substr($old_file, 0, -strlen($old_extension)) : $old_file;
1111
            $filename = (substr($filename, -1) == '.') ? $filename.$extension : $filename.'.'.$extension;
1112
        } else {
1113
            $filename = api_replace_dangerous_char($filename);
1114
            if (PREFIX_IMAGE_FILENAME_WITH_UID) {
1115
                $filename = uniqid('').'_'.$filename;
1116
            }
1117
            // We always prefix user photos with user ids, so on setting
1118
            // api_get_setting('split_users_upload_directory') === 'true'
1119
            // the correspondent directories to be found successfully.
1120
            $filename = $group_id.'_'.$filename;
1121
        }
1122
1123
        // Storing the new photos in 4 versions with various sizes.
1124