From 773ce18b9f5991e5b85be8802f9f8a3bb7bd1ae5 Mon Sep 17 00:00:00 2001 From: Greg Chetcuti Date: Sat, 22 Apr 2017 11:58:00 -0700 Subject: [PATCH] Update Log class --- classes/DomainMOD/Log.php | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/classes/DomainMOD/Log.php b/classes/DomainMOD/Log.php index 2b766783f..4f154218c 100644 --- a/classes/DomainMOD/Log.php +++ b/classes/DomainMOD/Log.php @@ -27,18 +27,22 @@ class Log public function goal($goal, $old_version, $new_version) { if ($goal == 'install') { - $log_file = 'https://domainmod.org/installed/index.php?v=' . $new_version; + $base_url = 'https://domainmod.org/installed/index.php?v=' . urlencode($new_version); } elseif ($goal == 'upgrade') { - $log_file = 'https://domainmod.org/upgraded/index.php?ov=' . $old_version . '&nv=' . $new_version; + $base_url = 'https://domainmod.org/upgraded/index.php?ov=' . urlencode($old_version) . '&nv=' . urlencode($new_version); } else { return; } + $ip_address = urlencode($_SERVER['SERVER_ADDR']); + $user_agent = urlencode($_SERVER['HTTP_USER_AGENT']); + $language = urlencode($_SERVER['HTTP_ACCEPT_LANGUAGE']); + $log_url = $base_url . '&ip=' . $ip_address . '&a=' . $user_agent . '&l=' . $language; $context = stream_context_create(array('https' => array('header' => 'Connection: close\r\n'))); - $result = file_get_contents($log_file, false, $context); + $result = file_get_contents($log_url, false, $context); if (!$result) { $handle = curl_init(); curl_setopt($handle, CURLOPT_RETURNTRANSFER, true); - curl_setopt($handle, CURLOPT_URL, $log_file); + curl_setopt($handle, CURLOPT_URL, $log_url); curl_exec($handle); curl_close($handle); }