Code Duplication    Length = 4-8 lines in 3 locations

Sources/ManageAttachments.php 2 locations

@@ 1327-1330 (lines=4) @@
1324
			while ($row = $smcFunc['db_fetch_assoc']($result))
1325
			{
1326
				// Get the filename.
1327
				if ($row['attachment_type'] == 1)
1328
					$filename = $modSettings['custom_avatar_dir'] . '/' . $row['filename'];
1329
				else
1330
					$filename = getAttachmentFilename($row['filename'], $row['id_attach'], $row['id_folder'], false, $row['file_hash']);
1331
1332
				// File doesn't exist?
1333
				if (!file_exists($filename))
@@ 1478-1481 (lines=4) @@
1475
				// If we are repairing remove the file from disk now.
1476
				if ($fix_errors && in_array('avatar_no_member', $to_fix))
1477
				{
1478
					if ($row['attachment_type'] == 1)
1479
						$filename = $modSettings['custom_avatar_dir'] . '/' . $row['filename'];
1480
					else
1481
						$filename = getAttachmentFilename($row['filename'], $row['id_attach'], $row['id_folder'], false, $row['file_hash']);
1482
					@unlink($filename);
1483
				}
1484
			}

Sources/ShowAttachments.php 1 location

@@ 173-180 (lines=8) @@
170
			$smcFunc['db_free_result']($request);
171
172
			// Got something! replace the $file var with the thumbnail info.
173
			if ($thumbFile)
174
			{
175
				$attachId = $thumbFile['id_attach'];
176
177
				// set filePath and ETag time
178
				$thumbFile['filePath'] = getAttachmentFilename($thumbFile['filename'], $attachId, $thumbFile['id_folder'], false, $thumbFile['file_hash']);
179
				$thumbFile['etag'] = '"' . md5_file($thumbFile['filePath']) . '"';
180
			}
181
		}
182
183
		// Cache it.