示例#1
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());
}
示例#2
0
文件: otx.php 项目: jackpf/ossim-arc
//Variables to store the chart information
$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);