Beispiel #1
0
    die(show_message($q->errorInfo(), __LINE__, __FILE__, $sql));
}
$sql = "SELECT DISTINCT up FROM `col_players` ;";
$q = $db->prepare($sql);
if ($q->execute() == TRUE) {
    $col_check = count($q->fetchAll());
} else {
    die(show_message($q->errorInfo(), __LINE__, __FILE__, $sql));
}
$multiclan = read_multiclan();
$multiclan_main = multi_main($multiclan);
foreach ($multiclan as $clan) {
    if ($clan['id'] != $config['clan']) {
        $multiclan_info[$clan['id']] = $cache->get('get_last_roster_' . $clan['id'], 0);
        if ($multiclan_info[$clan['id']] === FALSE or empty($multiclan_info[$clan['id']])) {
            $multiclan_info[$clan['id']] = get_api_roster($clan['id'], $config);
        }
        if (empty($multiclan_info)) {
            $multiclan_info[$clan['id']]['status'] = 'error';
            $multiclan_info[$clan['id']]['status_code'] = 'ERROR';
        }
        if ($multiclan_info[$clan['id']]['status'] == 'ok' && $multiclan_info[$clan['id']]['status_code'] == 'NO_ERROR') {
            $cache->clear('get_last_roster_' . $clan['id']);
            $cache->set('get_last_roster_' . $clan['id'], $multiclan_info[$clan['id']]);
        } else {
            die('No cahced data');
        }
    } else {
        $multiclan_info[$clan['id']] =& $new;
    }
}
Beispiel #2
0
 }
 $sql = "SELECT COUNT(id) FROM multiclan WHERE id = '" . $_GET['id'] . "';";
 $q = $db->prepare($sql);
 if ($q->execute() == TRUE) {
     $status_clan = $q->fetchColumn();
 } else {
     die(show_message($q->errorInfo(), __LINE__, __FILE__, $sql));
 }
 $sql = "SELECT COUNT(id) FROM multiclan WHERE prefix = '" . $_GET['prefix'] . "';";
 $q = $db->prepare($sql);
 if ($q->execute() == TRUE) {
     $status_prefix = $q->fetchColumn();
 } else {
     die(show_message($q->errorInfo(), __LINE__, __FILE__, $sql));
 }
 $roster = get_api_roster($_GET['id'], $config);
 //print_r($roster);
 if ($roster['status'] == 'ok' && $roster['status_code'] == 'NO_ERROR') {
     if ($status_clan == 0) {
         if ($status_prefix != 0) {
             $message['prefix'] = $lang['error_multi_7'];
         } else {
             $cache = new Cache(ROOT_DIR . '/cache/');
             $cache->set('get_last_roster_' . $_GET['id'], $roster);
         }
     } else {
         $message['id'] = $lang['error_multi_6'];
     }
 } else {
     $message['id'] = $lang['error_multi_5'];
 }
Beispiel #3
0
function autoclean($time, $multi, $config, $directory)
{
    global $cache, $db;
    //$global = array();
    if ($config['autoclean'] + $time <= now()) {
        $map = directory_map($directory);
        foreach ($multi as $val) {
            $new = $cache->get('get_last_roster_' . $val['id'], 0);
            if ($new === FALSE) {
                $new = get_api_roster($val['id'], $config);
            } else {
                $cache->clear('get_last_roster_' . $val['id']);
                $cache->set('get_last_roster_' . $val['id'], $new);
            }
            //print_r($new); die;
            foreach ($new['data']['members'] as $player) {
                foreach ($map as $key => $file) {
                    if (sha1($player['account_name']) == $file) {
                        unset($map[$key]);
                    }
                }
            }
            $sql = "UPDATE " . $val['prefix'] . "config SET value = '" . now() . "' WHERE name = 'autoclean';";
            $q = $db->prepare($sql);
            if ($q->execute() != TRUE) {
                die(show_message($q->errorInfo(), __LINE__, __FILE__, $sql));
            }
        }
        foreach ($map as $file) {
            unlink($directory . $file);
        }
    }
}
Beispiel #4
0
    }
    if ($auth->isLoggedInAdmin(1)) {
        $logged = 2;
    }
    if ($logged != 2) {
        if ($log == 1) {
            fwrite($fh, $date . ": (Err) " . $lang['log_to_cron'] . "\n");
        }
        die($lang['log_to_cron']);
    }
}
if ($multi_prefix[$dbprefix]['cron'] + $config['cron_time'] * 3600 <= now()) {
    if ($config['cron'] == 1) {
        //Geting clan roster from local DB and from wargaming.
        $new = $cache->get('get_last_roster_' . $config['clan'], 0);
        $new2 = get_api_roster($config['clan'], $config);
        //dg65tbhjkloinm
        if ($new2 === FALSE) {
            if ($log == 1) {
                fwrite($fh, $date . ": (Err) No roster from WG!" . "\n");
            }
            die('Some problem with downloading data from WG');
        } else {
            //new2 ok
            if ($new === FALSE) {
                if ($log == 1) {
                    fwrite($fh, $date . ": (WG) First load of roster from WG." . "\n");
                }
            } else {
                if ($log == 1) {
                    fwrite($fh, $date . ": (WG) Successfully loaded roster from WG." . "\n");