Code Duplication    Length = 27-27 lines in 2 locations

other/install.php 1 location

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

other/upgrade.php 1 location

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