Exemplo n.º 1
0
function mongoUpdateUsers($profile, $is_additive)
{
    $timestamp = time();
    file_put_contents('/cron/history.txt', 'started on ' . gmdate("Y-m-d\\TH:i:s\\Z", $timestamp) . '
			', FILE_APPEND);
    $i = 0;
    $add = 0;
    $upd = 0;
    $rmv = 0;
    foreach ($profile as $userProfile) {
        $i++;
        $userUnusuals = array();
        $profile = $userProfile['steamid'];
        $backpack = NULL;
        $steamHours = getHours($profile);
        $backpackURL = "http://api.steampowered.com/IEconItems_440/GetPlayerItems/v0001/?key=" . AKey() . "&SteamID=" . $profile . "&format=json";
        $backpack = json_decode(get_data($backpackURL), true);
        if (isset($backpack['result']['items'][0]['defindex'])) {
            $items = $backpack['result']['items'];
        } else {
            $items = "";
            goto skipBackPack;
        }
        if (!isset($backpack['result']['status']) || $backpack['result']['status'] === 15) {
            goto skipBackPack;
        }
        foreach ($items as $item) {
            if (array_key_exists('flag_cannot_trade', $item)) {
                $item['flag_cannot_trade'] = 1;
            } else {
                $item['flag_cannot_trade'] = 0;
            }
            if (array_key_exists('flag_cannot_craft', $item)) {
                $item['flag_cannot_craft'] = 1;
            } else {
                $item['flag_cannot_craft'] = 0;
            }
            if ($item['quality'] == 5 && array_key_exists('attributes', $item)) {
                foreach ($item['attributes'] as $key => $value) {
                    if ($value['defindex'] == 134) {
                        $item['_particleEffect'] = $item['attributes'][$key]['float_value'];
                    }
                }
                if ($item['defindex'] != 267 && $item['defindex'] != 266 && $item['quality'] === 5) {
                    $userUnusuals[] = $item;
                }
            } else {
                if ($item['quality'] == 5 && !isset($item['_particleEffect'])) {
                    $item['_particleEffect'] = "none";
                }
            }
            $item['crateNum'] = 0;
            if (array_key_exists('attributes', $item)) {
                foreach ($item['attributes'] as $key => $value) {
                    if ($value['defindex'] == 187) {
                        $item['crateNum'] = $item['attributes'][$key]['float_value'];
                    }
                    if ($value['defindex'] == 2027) {
                        $item['isAus'] = 1;
                    }
                }
            }
        }
        skipBackPack:
        //echo $i . ' <a href="http://steamcommunity.com/profiles/' . $profile . '" target=blank>' . $userProfile['personaname'] . '</a> ';
        if (!empty($userUnusuals)) {
            addUnusualToDB($userUnusuals, $userProfile, $steamHours);
            if ($is_additive == true) {
                $add++;
            } else {
                $upd++;
            }
        }
        if (empty($userUnusuals) && $backpack['result']['status'] === 1) {
            //deleteUserFromDB($profile);
            //echo'removed. (no unusuals)';
            //deleteUserFromDB($profile);
            if ($is_additive == true) {
            } else {
                $rmv++;
            }
        }
        /*
        	if ( $backpack['result']['status'] === 15 ) {
        	deleteUserFromDB( $profile );
        	//echo'removed. (private bp)';
        	deleteUserFromDB( $profile );
        	if ( $is_additive == true );
        	else $rmv++;
        	}
        */
    }
    $timestamp = time();
    file_put_contents('/cron/history.txt', 'finished on ' . gmdate("Y-m-d\\TH:i:s\\Z", $timestamp) . ' add:' . $add . ' rem' . $rmv . ' updt' . $upd . "\n", FILE_APPEND);
}
Exemplo n.º 2
0
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>';
}