Code Duplication    Length = 3-3 lines in 2 locations

sources/upload/upload.attachments.php 1 location

@@ 179-181 (lines=3) @@
176
177
// Validate file name (for our purposes we'll just remove invalid characters)
178
$file_name = preg_replace('[^'.$valid_chars_regex.']', '', strtolower(basename($_FILES['file']['name'])));
179
if (strlen($file_name) == 0 || strlen($file_name) > $MAX_FILENAME_LENGTH) {
180
    handleAttachmentError('Invalid file name: '.$file_name.'.', 114);
181
}
182
183
// Validate file extension
184
$ext = strtolower(getFileExtension($_REQUEST["name"]));

sources/upload/upload.files.php 1 location

@@ 137-139 (lines=3) @@
134
        FILTER_SANITIZE_STRING
135
    )
136
);
137
if (strlen($file_name) == 0 || strlen($file_name) > $MAX_FILENAME_LENGTH) {
138
    handleUploadError('Invalid file name: '.$file_name.'.');
139
}
140
141
// Validate file extension
142
$ext = strtolower(getFileExtension($_REQUEST["name"]));