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

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

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

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