function activate_account() { $data = POST('data'); $token = $data['token']; ossim_valid($token, OSS_ALPHA, 'illegal:' . _("OTX auth-token")); check_ossim_error(); $otx = new Otx(); $otx->register_token($token); return array('msg' => _("Your OTX account has been connected. The OTX pulses that you have subscribed to will begin downloading shortly. This process may take a few minutes."), 'token' => $token, 'username' => $otx->get_username(), 'user_id' => $otx->get_user_id(), 'contributing' => TRUE, 'key_version' => $otx->get_key_version(), 'latest_update' => $otx->get_latest_update()); }
function get_otx_user($data) { $response = array(); $token = $data['token']; /* VALIDATION */ ossim_valid($token, OSS_ALPHA, 'illegal:' . _("OTX auth-token")); check_ossim_error(); /* The try-catch check is done when the function is called in the main */ try { $otx = new Otx(); $otx->register_token($token); $response['error'] = FALSE; $response['msg'] = $otx->get_username(); } catch (Exception $e) { $response['error'] = TRUE; $response['msg'] = $e->getMessage(); } return $response; }