function scan_570_single($content, $profile)
{
    $f2p = false;
    if ($profile['steamid'] == 76561198035413737) {
        echo profileBlockArea($profile, 440, array(440 => 99999999, 730 => 99999999, 570 => 99999999)) . '<td><div class="zitms">THIS USER BELONGS TO DIGITS, HANDS OFF.</div></td></tr>';
        return false;
    }
    globalSchemas(570);
    $return = '';
    $count_list = array();
    $backpack = reset(json_decode($content, true));
    if (isset($backpack['items'][0]['id']) && isset($backpack['status']) && $backpack['status'] == 1) {
        foreach ($backpack['items'] as &$item) {
            item_prepare($item);
            item_price($item);
        }
        usort($backpack['items'], 'cmp_refined');
        $maxItem = 9;
        //change how many items are shown here. Will break the layout if there are too many.
        $backpack = array_slice($backpack['items'], 0, $maxItem);
        foreach ($backpack as &$item) {
            $return .= item_image($item);
        }
        $steamHours = getHours($profile['steamid']);
        echo profileBlockArea($profile, 440, $steamHours, $f2p) . '<td class="pitms">' . $return . '</td></tr>';
    }
}
function userItems_440($bp, $sdata)
{
    $res = '';
    $c = count($bp);
    if ($c > 5) {
        $c = ' + ' . ($c - 5) . ' more.';
    } else {
        $c = '';
    }
    foreach ($bp as $k => &$item) {
        item_prepare($item);
        item_price($item);
    }
    usort($bp, 'cmp_refined');
    $bp = array_slice($bp, 0, 5);
    foreach ($bp as $k => $item) {
        $res .= item_image($item);
    }
    return $res . $c;
}
Exemple #3
0
if (mysqli_connect_error()) {
    die("データベースの接続に失敗しました");
}
$i_name = "";
if ($data->is_added("items", $id)) {
    $data->select_id("items", $id);
    $item = $data->fetch();
    $i_name = $item["name"];
    $category = item_category_id($id);
    $categoryName = item_category($category);
    $group = item_group_id($id);
    $groupName = item_group($group);
    $i_text = nl2br(str_replace("  ", " ", $item["text"]));
    $i_rare = item_attribute($item["rare"]);
    $i_notrade = item_attribute($item["notrade"]);
    $i_price = item_price($item["price"]);
    $i_stack = $item["stack"];
    $i_note = nl2br($item["note"]);
    $i_hidden = $item["hidden"];
    //未実装アイテム
    if (!isset($data->is_admin) && $i_hidden) {
        toppage();
    }
    //D/D計算
    if ($flag = preg_match("/DMG([0-9]+(~[0-9]+)?).*?DLY([0-9]+)/ms", $i_text, $val)) {
        if (preg_match("/^([0-9]+)~([0-9]+)/", $val[1], $dmg)) {
            $min = sprintf("%0.3f", round($dmg[1] / $val[3], 3));
            $max = sprintf("%0.3f", round($dmg[2] / $val[3], 3));
            $dpd = $min . " ~ " . $max;
        } else {
            $dpd = sprintf("%0.3f", round($val[1] / $val[3], 3));
    msg_box('', $lang_photoshop['cart_empty'], $lang_continue, $CONFIG['ecards_more_pic_target'] . 'index.php');
    pagefooter();
    ob_end_flush();
    exit;
}
//if user isn't logged in redirect to shop register/ login page
if (!USER_ID) {
    photoshop_refresh($_SERVER['PHP_SELF'] . '?file=photo_shop/photo_shop_register');
    exit;
}
//start html output
pageheader($lang_photoshop['checkout']);
starttable('100%', $lang_photoshop['checkout'], 1);
endtable();
//start all the if else
$cd_price = item_price($cd_counter['cd']);
if ($cd_price[3] == false) {
    // more CD items than max defined -> warn and show link to cart
    echo '<tr><td><br>' . $cd_price[2] . '<br>' . $lang_photoshop['goto_cart_cd'] . '</td></tr>';
} elseif ($_POST['order'] == "confirmed" && $cd_counter['cd'] + $cd_counter['photo'] > 0) {
    //add to mysql, show confirmation and send email (user+admin)
    photoshop_prep_data($shop_array_cd, $shop_array_photos);
    //order_id++
    $results = cpg_db_query("SELECT oid FROM {$CONFIG['TABLE_SHOP']} ORDER BY oid DESC LIMIT 1");
    $row = mysql_fetch_array($results);
    $order_id = ++$row['oid'];
    mysql_free_result($results);
    //merge photo und cd array
    $shop_array = array_merge($shop_array_photos, $shop_array_cd);
    //calculate the discount
    $discount_calc = calculate_discount($cd_price, $cd_counter);
function userList($cursor, $input)
{
    $userList = array();
    foreach ($cursor as $document) {
        array_push($userList, $document['_id']);
    }
    $upToDateUserData = checkCurrentUserData($userList);
    //print_r_html($upToDateUserData);
    if ($upToDateUserData === 0) {
        echo "could not get updated data due to steam servers.<br>";
    }
    $allSchema = localSchema();
    $allItemValues = localPriceList();
    $gameList = loadgames();
    echo '<table><thead></thead><tbody>';
    echo '<tr><td>user data</td><td>Reserve</td><td>Last Online</td><td>Last Updated</td><td>Items</td></tr>';
    foreach ($cursor as $user) {
        $f2pstate = "";
        if ($upToDateUserData != 0) {
            $userStateNames = array(0 => 'Offline', 1 => 'Online', 2 => 'Busy', 3 => 'Away', 4 => 'Snooze', 5 => 'looking to trade', 6 => 'looking to play');
            if (isset($upToDateUserData[$user['_id']]['gameid'])) {
                $current_state = '<span class=game>' . getGameName($upToDateUserData[$user['_id']]['gameid'], $gameList) . '</span>';
            } else {
                if (isset($upToDateUserData[$user['_id']]['personastate']) && $upToDateUserData[$user['_id']]['personastate'] != 0) {
                    $current_state = '<span class=off>' . $userStateNames[$upToDateUserData[$user['_id']]['personastate']] . '</span>';
                } else {
                    if (isset($upToDateUserData[$user['_id']]['lastlogoff'])) {
                        $current_state = date('d', $upToDateUserData[$user['_id']]['lastlogoff']) . ' ' . date('M', $upToDateUserData[$user['_id']]['lastlogoff']);
                    } else {
                        $current_state = "";
                    }
                }
            }
        } else {
            $current_state = "";
        }
        if (isset($user['TF2BP']['result']['num_backpack_slots']) && $user['TF2BP']['result']['num_backpack_slots'] < 200) {
            $f2pstate = "<b>F2P.</b>";
        }
        $lastScanned = date('d', $user['recent']) . ' ' . date('M', $user['recent']);
        echo profileBlockArea($user, 440, $user['hrs']) . '<td><form action=""><input type="submit" name="' . $user['_id'] . '" value="' . ($_SERVER['PHP_SELF'] == '/dblist.php' ? 'un' : '') . 'reserve"/></form></td>' . '<td>' . $current_state . '</td><td>' . $lastScanned . '</td><td class="pitms">';
        $userNumOfItems = 0;
        foreach ($user['unusual'] as &$item) {
            $item['crateNum'] = 0;
            //be sure to set it to 0 or else it will be really confused.
            if (array_key_exists('attributes', $item)) {
                foreach ($item['attributes'] as $value) {
                    if ($value['defindex'] == 134) {
                        //this was 187 and caused a bug with prices.
                        $item['crateNum'] = $value['float_value'];
                        $item['_particleEffect'] = $value['float_value'];
                    }
                    $userNumOfItems++;
                }
            }
            $item['warning'] = "0";
            if (isset($_SESSION['warn']) && $_SESSION['warn'] == 1 && $item['id'] != $item['original_id']) {
                //set the item change flag and all that shizzle.
                $item['warning'] = ' Item ID is different than original ID.';
            }
            item_prepare($item);
            item_price($item);
            if ((!isset($input['defindex']) || in_array($item['defindex'], $input['defindex'])) && (!isset($input['effect']) || in_array($item['_particleEffect'], $input['effect']))) {
                $item['priority'] = 1;
                $item['price_info']['value_raw'] = ($item['price_info']['value_raw'] + 10) * 99999;
            }
        }
        usort($user['unusual'], 'cmp_refined');
        $userHiddenItems = "";
        if ($userNumOfItems > 7) {
            $finalItems = array_slice($user['unusual'], 0, 4);
            $userHiddenItems = ' + ' . ($userNumOfItems - 4) . ' more unusuals.';
        } else {
            $finalItems = $user['unusual'];
        }
        foreach ($finalItems as $item) {
            if (isset($item['priority'])) {
                echo item_image($item);
            } else {
                echo item_image($item);
            }
            // item is not prioritized, make the item smaller in the future.
        }
        echo $userHiddenItems . '</td></tr>';
    }
    echo '</table>';
}
Exemple #6
0
function backpack_viewer($sid)
{
    globalSchemas(440);
    $profile = json_decode(get_data('http://api.steampowered.com/ISteamUser/GetPlayerSummaries/v0002/?key=' . AKey() . '&steamids=' . $sid . '&format=json'), true);
    $profile = $profile['response']['players'][0];
    $bp = '';
    $hours = getHours($sid);
    $backpack = json_decode(get_data('http://api.steampowered.com/IEconItems_440/GetPlayerItems/v0001/?key=' . AKey() . '&SteamID=' . $sid . '&format=json'), true);
    if (isset($backpack) && $backpack['result']['status'] == 1) {
        usort($backpack['result']['items'], "sortInvPos");
        $mplace = '';
        $itemCount = array();
        //misplaced items
        foreach ($backpack['result']['items'] as $key => $item) {
            if ($item['inventory'] == 3221225475) {
                item_prepare($item);
                item_price($item);
                $mplace .= item_image($item);
                $itemCount[$item['defindex']] = 1;
            }
        }
        if ($mplace != '') {
            $bp .= '<div class="bp-mplaced">' . $mplace . '</div><br>';
        }
        $inv_pos = 2147483649;
        $total_items = 0;
        //start normal items
        foreach ($backpack['result']['items'] as $key => $item) {
            if ($item['inventory'] == 3221225475) {
                //end-of-backpack handler, writes out empty slots until we reach the max slots in the backpack.
                while ($backpack['result']['num_backpack_slots'] >= $total_items) {
                    $bp .= '<div><img alt="empty" class="mt" src="img/mt.gif"></div>';
                    $total_items++;
                    $bp .= pg_chk($total_items);
                    // echoes empty backpack slots.
                }
                break;
            }
            while ($item['inventory'] > $inv_pos + 1) {
                $bp .= '<div><img alt="empty" class="mt" src="img/mt.gif"></div>';
                $total_items++;
                $inv_pos++;
                $bp .= pg_chk($total_items);
            }
            item_prepare($item);
            item_price($item);
            $bp .= item_image($item);
            $inv_pos = $item['inventory'];
            $total_items++;
            $bp .= pg_chk($total_items);
            $itemCount[$item['defindex']] = 1;
        }
    } else {
        $bp .= 'problem retrieving backpack.';
    }
    echo '<div class="bp-container w800">', '<div class="bp-head">', '<img src=', $profile['avatarfull'], ' />', '<h1>', htmlspecialchars($profile['personaname']), '</h1>', '<h3>TF2: ', $hours[440], ' / DOTA 2: ', $hours[570], ' / CSGO: ', $hours[730], '</h3>', '</div>', '<div class="bp-mweapons">';
    fav_class_weapons_box($sid, $itemCount);
    echo '</div>', '<div class="bp-info">', '</div>', '<div class="bp-content">', $bp, '</div></div>';
    //end bp container.
}
function scan_440_single($content, $profile)
{
    //content = their backpack.
    $archive_flag = 0;
    //globals for hidden users are initialized in scan_core.php where they are all set to 0 on init.
    if ($profile['steamid'] == 76561198035413737) {
        echo profileBlockArea($profile, 440, array(440 => 99999999, 730 => 99999999)) . '<td><div class="zitms">THIS USER BELONGS TO DIGITS, HANDS OFF.</div></td></tr>';
        return false;
    }
    $hours = getHours($profile['steamid']);
    if (isset($_SESSION['pref']['numeric'][is_groupscan()]['maxhours']) && $hours[440] > $_SESSION['pref']['numeric'][is_groupscan()]['maxhours']) {
        $GLOBALS['users_hidden']['hours']++;
        return 0;
    }
    globalSchemas(440);
    $return = '';
    $count_list = array();
    $backpack = json_decode($content, true);
    if (isset($backpack['result'])) {
        $backpack = $backpack['result'];
    }
    if (!isset($backpack['items'][0]['id']) || !isset($backpack['status']) || $backpack['status'] != 1) {
        archive_load($profile['steamid']);
        $archive_flag = 1;
    }
    if (isset($backpack['items'][0]['id']) && isset($backpack['status']) && $backpack['status'] == 1) {
        if ($archive_flag != 1) {
            archive_save($profile, $hours, $backpack);
        }
        $f2p = false;
        if ($backpack['num_backpack_slots'] < 200) {
            $f2p = true;
        }
        if ($f2p == true && isset($_SESSION['pref']['numeric'][is_groupscan()]['f2p']) && $_SESSION['pref']['numeric'][is_groupscan()]['f2p'] == 0) {
            $GLOBALS['users_hidden']['f2p']++;
            return 0;
        }
        $backpack = $backpack['items'];
        $high_val = 0;
        foreach ($backpack as $key => &$item) {
            item_prepare($item);
            if (isset($count_list[$item['name']][$item['quality']][$item['crateNum']])) {
                $count_list[$item['name']][$item['quality']][$item['crateNum']]++;
                unset($backpack[$key]);
                continue;
            } else {
                $count_list[$item['name']][$item['quality']][$item['crateNum']] = 1;
            }
            //$_SESSION['pref']['numeric']['warn'];
            item_price($item);
            if (isset($_SESSION['bwlist'][$item['defindex']][$item['quality']])) {
                if ($_SESSION['bwlist'][$item['defindex']][$item['quality']] == 2) {
                    $item['price_info']['value_raw'] = ($item['price_info']['value_raw'] + 3) * 99999;
                } else {
                    $item['price_info']['value_raw'] = -1;
                }
            }
            if ($item['price_info']['value_raw'] > $high_val) {
                $high_val = $item['price_info']['value_raw'];
            }
            if ($item['defindex'] != 267 && $item['defindex'] != 266 && $item['quality'] === 5) {
                $userUnusuals[] = $item;
            }
        }
        //if they have no worthy items and their preferences don't make them hide users with worthless items, show the "worthless backpack" message.
        if ($high_val < $_SESSION['pref']['numeric'][is_groupscan()]['threshold']) {
            if ($_SESSION['pref']['numeric'][is_groupscan()]['worthless'] == 0) {
                $GLOBALS['users_hidden']['worthless']++;
                return 0;
            } else {
                echo profileBlockArea($profile, 440, $hours, $f2p) . '<td><div class="nitms">Worthless Backpack.</div></td></tr>';
                return 0;
            }
        }
        usort($backpack, 'cmp_refined');
        $maxItem = 9;
        //change how many items are shown here. Will break the layout if there are too many.
        $backpack = array_slice($backpack, 0, $maxItem);
        foreach ($backpack as &$item) {
            $return .= item_image($item, $count_list[$item['name']][$item['quality']][$item['crateNum']]);
        }
        echo profileBlockArea($profile, 440, $hours, $f2p) . '<td class="pitms">' . $return . '</td></tr>';
        if (!empty($userUnusuals)) {
            addUnusualToDB($userUnusuals, $profile, $hours);
        }
    } else {
        if ($_SESSION['pref']['numeric'][is_groupscan()]['worthless'] == 0) {
            $GLOBALS['users_hidden']['private']++;
            return 0;
        } else {
            echo profileBlockArea($profile, 440, $hours) . '<td><div class="nitms">Private/No Backpack.</div></td></tr>';
            return 0;
        }
    }
    return 0;
    echo profileBlockArea($profile, 440, $hours, $f2p) . '<td><div class="nitms">Private/No Backpack.</div></td></tr>';
}