Esempio n. 1
0
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());
}
Esempio n. 2
0
function get_otx_info()
{
    $otx = new Otx();
    $otx->load();
    return array('token' => $otx->get_token(), 'username' => $otx->get_username(), 'user_id' => $otx->get_user_id(), 'contributing' => $otx->is_contributing(), 'key_version' => $otx->get_key_version(), 'latest_update' => $otx->get_latest_update());
}
Esempio n. 3
0
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;
}