Example #1
0
}
//print_r($new);
if ($new['status'] == 'ok' && $new['status_code'] == 'NO_ERROR') {
    $cache->clear('get_last_roster_' . $config['clan']);
    $cache->set('get_last_roster_' . $config['clan'], $new);
} else {
    unset($new);
    $new = $cache->get('get_last_roster_' . $config['clan'], 0);
    if ($new === FALSE or empty($new)) {
        die('No cahced data');
    }
}
//Starting geting data
if ($new['status'] == 'ok' && $new['status_code'] == 'NO_ERROR') {
    //Sorting roster
    $roster = roster_sort($new['data']['members']);
    $roster_id = roster_resort_id($roster);
    // get list of all tanks in game from api
    /*$tanks = $cache->get('tanks_'.$config['clan'],0,ROOT_DIR.'/cache/other/');
      if(empty($tanks)){
          $tanks = get_api_tanks($config);
          if($tanks['status'] == 'ok' &&  $tanks['status_code'] == 'NO_ERROR'){
              $cache->clear('tanks_'.$config['clan'],ROOT_DIR.'/cache/other/');
              $cache->set('tanks_'.$config['clan'], $tanks['data']['items'],ROOT_DIR.'/cache/other/');
              $tanks = $tanks['data']['items'];
          }
      } */
    //Check if DB updating now
    while (lock_check() !== TRUE) {
        sleep('10');
    }
Example #2
0
if (is_valid_url($config['td']) == true) {
    $new = get_player(CLAN, $config);
    //dg65tbhjkloinm
    //print_r($new);
    if ($new['error'] != 0 && MYSQL == 'on' && MYSQL_ERROR != 'on') {
        $new = get_last_roster();
    } elseif ($new['error'] != 0 && (MYSQL != 'on' || MYSQL_ERROR == 'on')) {
        $new['data']['request_data']['items'] = array();
    }
} elseif (MYSQL == 'on' && MYSQL_ERROR != 'on') {
    $new = get_last_roster();
} else {
    $new['error'] = 1;
    $new['data']['request_data']['items'] = array();
}
$roster =& roster_sort($new['data']['request_data']['items']);
//print_r($roster);
if (count($new['data']['request_data']['items']) > 0) {
    foreach ($new['data']['request_data']['items'] as $val) {
        $tmp = checker($val, $lang, $config, $tables, $new['error']);
        if (isset($tmp['link'])) {
            $links[$val['name']] =& $tmp['link'];
        }
        if (isset($tmp['data'])) {
            $data[$val['name']] =& $tmp['data'];
        }
    }
    //print_r($new['data']['request_data']['items']);
    //print_r($links);
    if (count($links) > 0) {
        multiget($links, $result, PARS);