Code Duplication    Length = 37-37 lines in 2 locations

Sources/News.php 2 locations

@@ 1024-1060 (lines=37) @@
1021
		else
1022
		{
1023
			$attachments = array();
1024
			if (!empty($loaded_attachments))
1025
			{
1026
				foreach ($loaded_attachments as $attachment)
1027
				{
1028
					$attachments[] = array(
1029
						'tag' => 'attachment',
1030
						'content' => array(
1031
							array(
1032
								'tag' => 'id',
1033
								'content' => $attachment['id_attach'],
1034
							),
1035
							array(
1036
								'tag' => 'name',
1037
								'content' => preg_replace('~&#(\\d{1,7}|x[0-9a-fA-F]{1,6});~', '&#\\1;', $smcFunc['htmlspecialchars']($attachment['filename'])),
1038
							),
1039
							array(
1040
								'tag' => 'downloads',
1041
								'content' => $attachment['downloads'],
1042
							),
1043
							array(
1044
								'tag' => 'size',
1045
								'content' => ($attachment['filesize'] < 1024000) ? round($attachment['filesize'] / 1024, 2) . ' ' . $txt['kilobyte'] : round($attachment['filesize'] / 1024 / 1024, 2) . ' ' . $txt['megabyte'],
1046
							),
1047
							array(
1048
								'tag' => 'byte_size',
1049
								'content' => $attachment['filesize'],
1050
							),
1051
							array(
1052
								'tag' => 'link',
1053
								'content' => $scripturl . '?action=dlattach;topic=' . $attachment['topic'] . '.0;attach=' . $attachment['id_attach'],
1054
							),
1055
						)
1056
					);
1057
				}
1058
			}
1059
			else
1060
				$attachments = null;
1061
1062
			$data[] = array(
1063
				'tag' => 'article',
@@ 1434-1470 (lines=37) @@
1431
		else
1432
		{
1433
			$attachments = array();
1434
			if (!empty($loaded_attachments))
1435
			{
1436
				foreach ($loaded_attachments as $attachment)
1437
				{
1438
					$attachments[] = array(
1439
						'tag' => 'attachment',
1440
						'content' => array(
1441
							array(
1442
								'tag' => 'id',
1443
								'content' => $attachment['id_attach'],
1444
							),
1445
							array(
1446
								'tag' => 'name',
1447
								'content' => preg_replace('~&amp;#(\\d{1,7}|x[0-9a-fA-F]{1,6});~', '&#\\1;', $smcFunc['htmlspecialchars']($attachment['filename'])),
1448
							),
1449
							array(
1450
								'tag' => 'downloads',
1451
								'content' => $attachment['downloads'],
1452
							),
1453
							array(
1454
								'tag' => 'size',
1455
								'content' => ($attachment['filesize'] < 1024000) ? round($attachment['filesize'] / 1024, 2) . ' ' . $txt['kilobyte'] : round($attachment['filesize'] / 1024 / 1024, 2) . ' ' . $txt['megabyte'],
1456
							),
1457
							array(
1458
								'tag' => 'byte_size',
1459
								'content' => $attachment['filesize'],
1460
							),
1461
							array(
1462
								'tag' => 'link',
1463
								'content' => $scripturl . '?action=dlattach;topic=' . $attachment['topic'] . '.0;attach=' . $attachment['id_attach'],
1464
							),
1465
						)
1466
					);
1467
				}
1468
			}
1469
			else
1470
				$attachments = null;
1471
1472
			$data[] = array(
1473
				'tag' => 'recent-post',