| @@ 1225-1251 (lines=27) @@ | ||
| 1222 | ||
| 1223 | // Attempt to register the site etc. |
|
| 1224 | $fp = @fsockopen('www.simplemachines.org', 80, $errno, $errstr); |
|
| 1225 | if ($fp) |
|
| 1226 | { |
|
| 1227 | $out = 'GET /smf/stats/register_stats.php?site=' . base64_encode($boardurl) . ' HTTP/1.1' . "\r\n"; |
|
| 1228 | $out .= 'Host: www.simplemachines.org' . "\r\n"; |
|
| 1229 | $out .= 'Connection: Close' . "\r\n\r\n"; |
|
| 1230 | fwrite($fp, $out); |
|
| 1231 | ||
| 1232 | $return_data = ''; |
|
| 1233 | while (!feof($fp)) |
|
| 1234 | $return_data .= fgets($fp, 128); |
|
| 1235 | ||
| 1236 | fclose($fp); |
|
| 1237 | ||
| 1238 | // Get the unique site ID. |
|
| 1239 | preg_match('~SITE-ID:\s(\w{10})~', $return_data, $ID); |
|
| 1240 | ||
| 1241 | if (!empty($ID[1])) |
|
| 1242 | $smcFunc['db_insert']('replace', |
|
| 1243 | $db_prefix . 'settings', |
|
| 1244 | array('variable' => 'string', 'value' => 'string'), |
|
| 1245 | array( |
|
| 1246 | array('sm_stats_key', $ID[1]), |
|
| 1247 | array('enable_sm_stats', 1), |
|
| 1248 | ), |
|
| 1249 | array('variable') |
|
| 1250 | ); |
|
| 1251 | } |
|
| 1252 | } |
|
| 1253 | // Don't remove stat collection unless we unchecked the box for real, not from the loop. |
|
| 1254 | elseif (empty($_POST['stats']) && empty($upcontext['allow_sm_stats'])) |
|
| @@ 939-965 (lines=27) @@ | ||
| 936 | { |
|
| 937 | // Attempt to register the site etc. |
|
| 938 | $fp = @fsockopen('www.simplemachines.org', 80, $errno, $errstr); |
|
| 939 | if ($fp) |
|
| 940 | { |
|
| 941 | $out = 'GET /smf/stats/register_stats.php?site=' . base64_encode($boardurl) . ' HTTP/1.1' . "\r\n"; |
|
| 942 | $out .= 'Host: www.simplemachines.org' . "\r\n"; |
|
| 943 | $out .= 'Connection: Close' . "\r\n\r\n"; |
|
| 944 | fwrite($fp, $out); |
|
| 945 | ||
| 946 | $return_data = ''; |
|
| 947 | while (!feof($fp)) |
|
| 948 | $return_data .= fgets($fp, 128); |
|
| 949 | ||
| 950 | fclose($fp); |
|
| 951 | ||
| 952 | // Get the unique site ID. |
|
| 953 | preg_match('~SITE-ID:\s(\w{10})~', $return_data, $ID); |
|
| 954 | ||
| 955 | if (!empty($ID[1])) |
|
| 956 | $smcFunc['db_insert']('replace', |
|
| 957 | $db_prefix . 'settings', |
|
| 958 | array('variable' => 'string', 'value' => 'string'), |
|
| 959 | array( |
|
| 960 | array('sm_stats_key', $ID[1]), |
|
| 961 | array('enable_sm_stats', 1), |
|
| 962 | ), |
|
| 963 | array('variable') |
|
| 964 | ); |
|
| 965 | } |
|
| 966 | } |
|
| 967 | else |
|
| 968 | { |
|