public static function init_account($openbenchmarking, $settings) { if (isset($openbenchmarking['user_name']) && isset($openbenchmarking['communication_id']) && isset($openbenchmarking['sav'])) { if (IS_FIRST_RUN_TODAY && pts_network::internet_support_available()) { // Might as well make sure OpenBenchmarking.org account has the latest system info // But don't do it everytime to preserve bandwidth $openbenchmarking['s_s'] = base64_encode(phodevi::system_software(true)); $openbenchmarking['s_h'] = base64_encode(phodevi::system_hardware(true)); $return_state = pts_openbenchmarking::make_openbenchmarking_request('account_verify', $openbenchmarking); $json = json_decode($return_state, true); if (isset($json['openbenchmarking']['account']['valid'])) { // The account is valid self::$openbenchmarking_account = $openbenchmarking; self::$client_settings = $json['openbenchmarking']['account']['settings']; pts_storage_object::set_in_file(PTS_CORE_STORAGE, 'openbenchmarking_account_settings', $json['openbenchmarking']['account']['settings']); } else { pts_storage_object::set_in_file(PTS_CORE_STORAGE, 'openbenchmarking', false); trigger_error('Invalid OpenBenchmarking.org account supplied, please re-login.', E_USER_ERROR); } } else { self::$openbenchmarking_account = $openbenchmarking; self::$client_settings = $settings; } } }