Code Duplication    Length = 27-27 lines in 2 locations

other/upgrade.php 1 location

@@ 1084-1110 (lines=27) @@
1081
		{
1082
			// Attempt to register the site etc.
1083
			$fp = @fsockopen('www.simplemachines.org', 80, $errno, $errstr);
1084
			if ($fp)
1085
			{
1086
				$out = 'GET /smf/stats/register_stats.php?site=' . base64_encode($boardurl) . ' HTTP/1.1' . "\r\n";
1087
				$out .= 'Host: www.simplemachines.org' . "\r\n";
1088
				$out .= 'Connection: Close' . "\r\n\r\n";
1089
				fwrite($fp, $out);
1090
1091
				$return_data = '';
1092
				while (!feof($fp))
1093
					$return_data .= fgets($fp, 128);
1094
1095
				fclose($fp);
1096
1097
				// Get the unique site ID.
1098
				preg_match('~SITE-ID:\s(\w{10})~', $return_data, $ID);
1099
1100
				if (!empty($ID[1]))
1101
					$smcFunc['db_insert']('replace',
1102
						$db_prefix . 'settings',
1103
						array('variable' => 'string', 'value' => 'string'),
1104
						array(
1105
							array('sm_stats_key', $ID[1]),
1106
							array('enable_sm_stats', 1),
1107
						),
1108
						array('variable')
1109
					);
1110
			}
1111
		}
1112
		else
1113
		{

other/install.php 1 location

@@ 1304-1330 (lines=27) @@
1301
1302
		// Attempt to register the site etc.
1303
		$fp = @fsockopen('www.simplemachines.org', 80, $errno, $errstr);
1304
		if ($fp)
1305
		{
1306
			$out = 'GET /smf/stats/register_stats.php?site=' . base64_encode($boardurl) . ' HTTP/1.1' . "\r\n";
1307
			$out .= 'Host: www.simplemachines.org' . "\r\n";
1308
			$out .= 'Connection: Close' . "\r\n\r\n";
1309
			fwrite($fp, $out);
1310
1311
			$return_data = '';
1312
			while (!feof($fp))
1313
				$return_data .= fgets($fp, 128);
1314
1315
			fclose($fp);
1316
1317
			// Get the unique site ID.
1318
			preg_match('~SITE-ID:\s(\w{10})~', $return_data, $ID);
1319
1320
			if (!empty($ID[1]))
1321
				$smcFunc['db_insert']('replace',
1322
					$db_prefix . 'settings',
1323
					array('variable' => 'string', 'value' => 'string'),
1324
					array(
1325
						array('sm_stats_key', $ID[1]),
1326
						array('enable_sm_stats', 1),
1327
					),
1328
					array('variable')
1329
				);
1330
		}
1331
	}
1332
	// Don't remove stat collection unless we unchecked the box for real, not from the loop.
1333
	elseif (empty($_POST['stats']) && empty($upcontext['allow_sm_stats']))