Code Duplication    Length = 27-27 lines in 2 locations

other/install.php 1 location

@@ 1238-1264 (lines=27) @@
1235
1236
		// Attempt to register the site etc.
1237
		$fp = @fsockopen('www.simplemachines.org', 80, $errno, $errstr);
1238
		if ($fp)
1239
		{
1240
			$out = 'GET /smf/stats/register_stats.php?site=' . base64_encode($boardurl) . ' HTTP/1.1' . "\r\n";
1241
			$out .= 'Host: www.simplemachines.org' . "\r\n";
1242
			$out .= 'Connection: Close' . "\r\n\r\n";
1243
			fwrite($fp, $out);
1244
1245
			$return_data = '';
1246
			while (!feof($fp))
1247
				$return_data .= fgets($fp, 128);
1248
1249
			fclose($fp);
1250
1251
			// Get the unique site ID.
1252
			preg_match('~SITE-ID:\s(\w{10})~', $return_data, $ID);
1253
1254
			if (!empty($ID[1]))
1255
				$smcFunc['db_insert']('replace',
1256
					$db_prefix . 'settings',
1257
					array('variable' => 'string', 'value' => 'string'),
1258
					array(
1259
						array('sm_stats_key', $ID[1]),
1260
						array('enable_sm_stats', 1),
1261
					),
1262
					array('variable')
1263
				);
1264
		}
1265
	}
1266
	// Don't remove stat collection unless we unchecked the box for real, not from the loop.
1267
	elseif (empty($_POST['stats']) && empty($upcontext['allow_sm_stats']))

other/upgrade.php 1 location

@@ 964-990 (lines=27) @@
961
		{
962
			// Attempt to register the site etc.
963
			$fp = @fsockopen('www.simplemachines.org', 80, $errno, $errstr);
964
			if ($fp)
965
			{
966
				$out = 'GET /smf/stats/register_stats.php?site=' . base64_encode($boardurl) . ' HTTP/1.1' . "\r\n";
967
				$out .= 'Host: www.simplemachines.org' . "\r\n";
968
				$out .= 'Connection: Close' . "\r\n\r\n";
969
				fwrite($fp, $out);
970
971
				$return_data = '';
972
				while (!feof($fp))
973
					$return_data .= fgets($fp, 128);
974
975
				fclose($fp);
976
977
				// Get the unique site ID.
978
				preg_match('~SITE-ID:\s(\w{10})~', $return_data, $ID);
979
980
				if (!empty($ID[1]))
981
					$smcFunc['db_insert']('replace',
982
						$db_prefix . 'settings',
983
						array('variable' => 'string', 'value' => 'string'),
984
						array(
985
							array('sm_stats_key', $ID[1]),
986
							array('enable_sm_stats', 1),
987
						),
988
						array('variable')
989
					);
990
			}
991
		}
992
		else
993
		{