Code Duplication    Length = 27-27 lines in 2 locations

other/install.php 1 location

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

other/upgrade.php 1 location

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