Code Duplication    Length = 27-27 lines in 2 locations

other/install.php 1 location

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

other/upgrade.php 1 location

@@ 1068-1094 (lines=27) @@
1065
		{
1066
			// Attempt to register the site etc.
1067
			$fp = @fsockopen('www.simplemachines.org', 80, $errno, $errstr);
1068
			if ($fp)
1069
			{
1070
				$out = 'GET /smf/stats/register_stats.php?site=' . base64_encode($boardurl) . ' HTTP/1.1' . "\r\n";
1071
				$out .= 'Host: www.simplemachines.org' . "\r\n";
1072
				$out .= 'Connection: Close' . "\r\n\r\n";
1073
				fwrite($fp, $out);
1074
1075
				$return_data = '';
1076
				while (!feof($fp))
1077
					$return_data .= fgets($fp, 128);
1078
1079
				fclose($fp);
1080
1081
				// Get the unique site ID.
1082
				preg_match('~SITE-ID:\s(\w{10})~', $return_data, $ID);
1083
1084
				if (!empty($ID[1]))
1085
					$smcFunc['db_insert']('replace',
1086
						$db_prefix . 'settings',
1087
						array('variable' => 'string', 'value' => 'string'),
1088
						array(
1089
							array('sm_stats_key', $ID[1]),
1090
							array('enable_sm_stats', 1),
1091
						),
1092
						array('variable')
1093
					);
1094
			}
1095
		}
1096
		else
1097
		{