Exemplo n.º 1
0
            <th>Jumps</th></tr>

            <?php 
                }
                ?>

          <tr><td>#<?php 
                echo $rank;
                ?>
</td>
          <td><?php 
                echo $id;
                ?>
</td>
          <td><?php 
                $steamid = SteamID::Parse($auth, SteamID::FORMAT_STEAMID3);
                echo "<a href=\"http://steamcommunity.com/profiles/" . $steamid->Format(SteamID::FORMAT_STEAMID64) . "/\">" . $auth . "</a>";
                ?>
</td>
          <td class="name"><?php 
                echo $name;
                ?>
</td>
          <td class="time">

          <?php 
                echo formattoseconds($time);
                ?>
</td>
          <td><?php 
                echo number_format($jumps);
Exemplo n.º 2
0
<?php

require_once APP_ROOT . '/lib/SteamID/SteamID.php';
use Curl\Curl;
$app->get('/tasks/link_steam_profiles', function () use($app) {
    $sleep_time = 100;
    $steam_api_key = $app['bm.config']['steam_api_key'];
    $unlinked_player_profiles = $app['mongo.db']->selectCollection('player_profiles')->find(['steamdata' => ['$type' => 10]])->sort(['points' => -1])->limit(50);
    $unlinked_player_profiles = array_map(function ($player_profile_doc) use($steam_api_key) {
        $steamid3_value = $player_profile_doc['payload_steamid'];
        $steam_api_url = "http://api.steampowered.com/ISteamUser/GetPlayerSummaries/v0002/?";
        $steam_api_url .= "key={$steam_api_key}";
        $steam_api_url .= "&steamids=";
        $steam_id = SteamID::Parse("[U:1:{$steamid3_value}]");
        $steamid64 = $steam_id->Format(SteamID::FORMAT_STEAMID64);
        if ($steamid64) {
            $steam_api_url .= $steamid64;
            $curl = new \Curl\Curl();
            $curl->get($steam_api_url);
            $steamdata = json_decode(json_encode($curl->response), 1);
            $player_profile_doc['steamdata'] = @$steamdata['response']['players'][0] ?: null;
            @($player_profile_doc['steamdata']['personaname'] = strip_tags($player_profile_doc['steamdata']['personaname']));
            // remove all unicode and html from usernames, move this to functions.php file
            $player_profile_doc['steamid64'] = $steamid64;
        }
        return $player_profile_doc;
    }, iterator_to_array($unlinked_player_profiles, 0));
    array_walk($unlinked_player_profiles, function ($player_profile_doc) use($app, $sleep_time) {
        if (empty($player_profile_doc['steamdata'])) {
            echo "no steamdata received for {$player_profile_doc['payload_steamid']}\n";
            return;