function check_now($send_usage_info = true, $get_request_data = false, $response_data = false, $from_install = false) { global $sugar_config, $timedate; global $db, $license; // This section of code is a portion of the code referred // to as Critical Control Software under the End User // License Agreement. Neither the Company nor the Users // may modify any portion of the Critical Control Software. if (ocLicense()) { return array(); } // END REQUIRED CODE $return_array = array(); if (!$from_install && empty($license)) { loadLicense(true); } if (!$response_data) { $systemInfo = SugarSystemInfo::getInstance(); SugarAutoLoader::requireWithCustom('include/SugarHeartbeat/SugarHeartbeatClient.php', true); $sclientClass = SugarAutoLoader::customClass('SugarHeartbeatClient'); $sclient = new $sclientClass(); if ($from_install) { $info = $systemInfo->getBaseInfo(); } else { $info = $systemInfo->getInfo(); } // This section of code is a portion of the code referred // to as Critical Control Software under the End User // License Agreement. Neither the Company nor the Users // may modify any portion of the Critical Control Software. if (!empty($license->settings['license_key'])) { $key = $license->settings['license_key']; } else { //END REQUIRED CODE $key = '4829482749329'; } $encoded = sugarEncode($key, serialize($info)); if ($get_request_data) { $request_data = array('key' => $key, 'data' => $encoded); return serialize($request_data); } $encodedResult = $sclient->sugarHome($key, $info); } else { $encodedResult = $response_data['data']; $key = $response_data['key']; } if ($response_data || !$sclient->getError()) { $serializedResultData = sugarDecode($key, $encodedResult); $resultData = unserialize($serializedResultData); if ($response_data && empty($resultData)) { $resultData = array(); $resultData['validation'] = 'invalid validation key'; } } else { $resultData = array(); $resultData['versions'] = array(); } if (!isset($resultData['validation'])) { $resultData['validation'] = 'invalid'; } if ($response_data || !$sclient->getError()) { // This section of code is a portion of the code referred // to as Critical Control Software under the End User // License Agreement. Neither the Company nor the Users // may modify any portion of the Critical Control Software. checkDownloadKey($resultData['validation']); //END REQUIRED CODE if (!empty($resultData['msg'])) { if (!empty($resultData['msg']['admin'])) { $license->saveSetting('license', 'msg_admin', base64_encode($resultData['msg']['admin'])); } else { $license->saveSetting('license', 'msg_admin', ''); } if (!empty($resultData['msg']['all'])) { $license->saveSetting('license', 'msg_all', base64_encode($resultData['msg']['all'])); } else { $license->saveSetting('license', 'msg_all', ''); } } else { $license->saveSetting('license', 'msg_admin', ''); $license->saveSetting('license', 'msg_all', ''); } $license->saveSetting('license', 'last_validation', 'success'); unset($_SESSION['COULD_NOT_CONNECT']); } else { $resultData = array(); $resultData['versions'] = array(); $license->saveSetting('license', 'last_connection_fail', TimeDate::getInstance()->nowDb()); $license->saveSetting('license', 'last_validation', 'no_connection'); if (empty($license->settings['license_last_validation_success']) && empty($license->settings['license_last_validation_fail']) && empty($license->settings['license_vk_end_date'])) { $license->saveSetting('license', 'vk_end_date', TimeDate::getInstance()->nowDb()); $license->saveSetting('license', 'validation_key', base64_encode(serialize(array('verified' => false)))); } $_SESSION['COULD_NOT_CONNECT'] = TimeDate::getInstance()->nowDb(); } if (!empty($resultData['versions'])) { $license->saveSetting('license', 'latest_versions', base64_encode(serialize($resultData['versions']))); } else { $resultData['versions'] = array(); $license->saveSetting('license', 'latest_versions', ''); } include 'sugar_version.php'; if (sizeof($resultData) == 1 && !empty($resultData['versions'][0]['version']) && compareVersions($sugar_version, $resultData['versions'][0]['version'])) { $resultData['versions'][0]['version'] = $sugar_version; $resultData['versions'][0]['description'] = "You have the latest version."; } return $resultData['versions']; }
/** * Returns SugarSystemInfo object * * @return SugarSystemInfo */ protected function getSystemInfo() { return SugarSystemInfo::getInstance(); }