Esempio n. 1
0
function user_data($id)
{
    //Accepts either a single or array of IDs, builds everything it needs to about all the users, returns the array keyed by ID. Gets EVERYTHING about the user. This defines from now on our user data...data. Badges are array'd only. userdata() will still exist but as a low level function. This will preformat, precalculate everything.
    global $file_db, $pcfg, $pokemon;
    //So, single or multiple users?
    if (is_array($id)) {
        $id = array_unique($id);
        $userdata = multiuserdata($id);
    } else {
        $userdata = $file_db->query('SELECT * FROM trainers WHERE id=' . (int) $id . '')->fetchAll();
        $userdata[$id] = $userdata[0];
    }
    //Add usernames to the mix.
    $smfdata = pokemon_fetchMember($member_ids = $id, $output_method = 'array');
    foreach ($userdata as $key => $value) {
        if (!empty($smfdata[$value['id']]['name'])) {
            $userdata[$value['id']]['name'] = $smfdata[$value['id']]['name'];
        } else {
            $userdata[$value['id']]['name'] = 'ERRORNO.';
        }
    }
}
Esempio n. 2
0
		<div class="tradeclear"></div>
		';
    }
    //$smfdata = pokemon_fetchmember(array(1,3));
    //print_r($smfdata);
    echo '
	</div>';
    layout_below();
    $file_db = null;
} elseif (isset($_GET['list'])) {
    //Spit out various lists of all the trainers. We may have to restrict or paginate this in the future, but for now, s'cool.
    //Cautious about performance here. Let's benchmark.
    $startScriptTime = microtime(TRUE);
    //Default list. Output all trainers by order of newest trainer first.
    $ids = $file_db->query('SELECT id FROM trainers ORDER BY starttime DESC')->fetchAll(PDO::FETCH_COLUMN, 0);
    $usersdata = multiuserdata($ids);
    $usersdatab = $usersdata;
    $smf_usersdata = pokemon_fetchMember($ids);
    //jesus
    function starttimeDESC($a, $b)
    {
        return $a['starttime'] < $b['starttime'];
    }
    function starttimeASC($a, $b)
    {
        return $a['starttime'] > $b['starttime'];
    }
    function pokemonDESC($a, $b)
    {
        return $a['total_pokemon'] < $b['total_pokemon'];
    }