getConfig(); if (!$config->get('adminNotifications') || !$config->get('adminNotificationsNewVersion')) { return true; } $latestRelease = $this->getLatestRelease(); if (!empty($latestRelease['version']) && $config->get('latestVersion') != $latestRelease['version']) { $config->set('latestVersion', $latestRelease['version']); $config->save(); } return true; } protected function getLatestRelease($url = null, array $requestData = ['action' => 'latestRelease']) { if (function_exists('curl_version')) { $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url ? $url : base64_decode('aHR0cHM6Ly9zLmVzcG9jcm0uY29tLw==')); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 60); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($requestData)); $result = curl_exec($ch); $httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE); curl_close($ch); if ($httpCode === 200) { $data = json_decode($result, true); if (is_array($data)) { return $data; } } } } }