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
$data = array();
//The widget's data itself.
$label = array();
//Widget's label such as legend in charts, titles in tag clouds, etc...
$links = array();
//Links of each element of the widget.
/*
*
*	The code below is copied from /panel and will have to be adapted to the new DB structutre of the 4.0 version, that's why it is not commented.
*
*/
session_write_close();
$otx = new Otx();
$otx->load();
$c1 = $otx->get_token();
$c2 = $c1 && $otx->get_key_version() < 2;
if (!$c1 || $c2) {
    $_GET['error_type'] = !$c1 ? 'token' : 'old_key';
    require '../draw/otx_unregistered.php';
    die;
}
//Now the widget's data will be calculated depending of the widget's type.
switch ($type) {
    case "top":
        $limit = $chart_info['top'] > 0 ? $chart_info['top'] : 5;
        $range = $chart_info['range'] > 0 ? $chart_info['range'] : 14;
        $params = array('top' => $limit, 'range' => $range);
        $range = $range * 86400;
        try {
            $top_otx = $otx->get_top_pulses($params);
            foreach ($top_otx as $p_id => $pulse) {