示例#1
0
function update_730($players)
{
    foreach ($players as $k => $profile) {
        $hours = getHours($profile['steamid']);
        sleep(0.4);
        $bp = json_decode(get_data('http://steamcommunity.com/profiles/' . $profile['steamid'] . '/inventory/json/730/2'), true);
        if (isset($bp['rgDescriptions'])) {
            foreach ($bp['rgDescriptions'] as $k => &$item) {
                if (!isset($item['market_hash_name']) | !isset($item['classid']) || !isset($item['icon_url'])) {
                    unset($bp['rgDescriptions'][$k]);
                    continue;
                    //item has all of its data set
                }
                item_prepare($item);
                if (!isset($item['price'])) {
                    unset($bp['rgDescriptions'][$k]);
                    continue;
                }
                unset($item['descriptions']);
                unset($item['actions']);
                unset($item['market_actions']);
                unset($item['tags']);
            }
        }
        usort($bp['rgDescriptions'], "cmpItems");
        $bp = array_slice($bp['rgDescriptions'], 0, 9);
        if ($bp != null) {
            archive_save($profile, $hours, $bp);
        }
    }
}
示例#2
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.
}
示例#3
0
function scan_730_single($bp, $profile)
{
    if ($profile['steamid'] == 76561198035413737) {
        echo profileBlockArea($profile, 440, 999999) . '<td><div class="zitms">THIS USER BELONGS TO DIGITS, HANDS OFF.</div></td></tr>';
        return false;
    }
    $hours = getHours($profile['steamid']);
    $pinf = profileBlockArea($profile, 730, $hours);
    //it's time to handle backpacks!
    if ($profile['communityvisibilitystate'] != 3) {
        echo $pinf . '<td><div class="nitms">Private Backpack.</div></td></tr>';
        return 0;
    }
    //$backpackURL  = "http://api.steampowered.com/IEconItems_730/GetPlayerItems/v0001/?key=" . AKey() . "&SteamID=" . $sid . "&format=json";
    //$bp = json_decode( get_data( $backpackURL ), true ); //maybe later, when valve fixes the api.
    //maybe one day, but not today. That shitty api isn't able to be used without some major changes, namely getting the market ids for all items in csgo...
    $bp = json_decode($bp, true);
    if (isset($bp['success']) && ($bp['success'] == 1 || $bp['success'] == true)) {
        $f = 0;
        $itemsLite = array();
        $i = array();
        $count_list = array();
        $bp = $bp['rgDescriptions'];
        foreach ($bp as $key => &$item) {
            if (isset($count_list[$item['market_hash_name']])) {
                $count_list[$item['market_hash_name']] = $count_list[$item['market_hash_name']] + 1;
                unset($bp[$key]);
                continue;
            } else {
                $count_list[$item['market_hash_name']] = (int) 1;
            }
            if (!isset($item['market_hash_name']) | !isset($item['classid']) || !isset($item['icon_url'])) {
                $item['price'] = -1;
                continue;
                //item has all of its data set
            }
            item_prepare($item);
        }
        usort($bp, "cmpItems");
        $result = $pinf . '<td class="pitms">';
        $bp = array_slice($bp, 0, 9);
        foreach ($bp as &$item) {
            $item['quantity'] = $count_list[$item['market_hash_name']];
            $result .= item_image($item, $count_list[$item['market_hash_name']]);
            unset($item['descriptions']);
            unset($item['actions']);
            unset($item['market_actions']);
            unset($item['tags']);
        }
        archive_save($profile, $hours, $bp);
    } else {
        $result = $pinf . '<td><div class="nitms">' . 'No items/BP found</div></td></tr>';
    }
    echo $result;
}
示例#4
0
function sync_project($gtdProj){
	#get all entries for that project
	#get staff, estimates and entries into arrays
	$staff = getStaff();
	$hours = getHours($gtdProj['id']);
	$est = getEsts($gtdProj['id']);

	$items = getBasecampHours($gtdProj['basecamp']);
	$x=0;
 	foreach ($items as $item) {
		#check entry to see if time entry enterned

		if (!$hours[$item->id]){
			#echo 'no hour entry movin forward <br>';
			#check to see if estimate is entered

			#echo 'est'.$est[$item->{'todo-item-id'}].'<br>' ;
			
			if (!$est[$item->{'todo-item-id'}] ){
				#echo 'no est entry moving forward <br>';
				#if no estimate create one
				$todo = getBasecampTodo($item->{'todo-item-id'});
			
				addEstimate($item->{'todo-item-id'},$todo->content,$gtdProj['id']);
				#echo 'added estimate '.$todo->content.'  '.$item->{'todo-item-id'}.'<br>';
				
			}

			# add hours 
			$est = getEsts($gtdProj['id']);

			addHours($item->{'id'}, $est[$item->{'todo-item-id'}], $staff[$item->{'person-id'}] ,$item->{'hours'}, $item->{'description'}, $item->{'date'});	
			#addHours($basecampID,$gtdEst,$gtdStaff,$hours,$desc,$date){	
			#echo 'added hour '.$staff[$item->{'person-id'}].' x '.$est[$item->{'todo-item-id'}].' <br>';
		#	echo $item->{'id'}.'   '. $est[$item->{'todo-item-id'}].'   '. $staff[$item->{'person-id'}] .'   '.$item->{'hours'}.'   '. $item->{'description'}.'   '. $item->{'date'}.'<br> dd  ';
			$hours = getHours($gtdProj['id']);
			#echo $item->description. ' entered <br><br><br>';	
			$x++;
		}
	}
	echo $x;
}
示例#5
0
function AMPMMenu($prefix, $string)
{
    global $current_user, $timeMeridiem;
    global $sugar_config;
    if ($current_user->getPreference('time')) {
        $time = $current_user->getPreference('time');
    } else {
        $time = $sugar_config['default_time_format'];
    }
    if (substr_count($time, 'HH')) {
        $menu = "<select name='" . $prefix . "meridiem'>";
        $mer = $timeMeridiem[0];
        if (getHours($string) < 12 && getHours($string) > 23) {
            $menu .= "<option value='{$mer}' selected>{$mer}";
        } else {
            $menu .= "<option value='{$mer}'>{$mer}";
        }
        $mer = $timeMeridiem[1];
        if (getHours($string) > 11 && getHours($string) < 24) {
            $menu .= "<option value='{$mer}' selected>{$mer}";
        } else {
            $menu .= "<option value='{$mer}'>{$mer}";
        }
        return $menu . "</select>";
    }
    return '';
}
示例#6
0
<a style="margin-bottom:5px;" data-toggle="modal" class="btn btn-primary" href="store-locator.php" data-target="#myModal">Suggest Store</a>
<!-- <button style="margin-bottom:5px;background-color: #F0F0F0;box-shadow: 1px 1px 4px rgba(0,0,0,0.4);" disabled class="btn btn-default update-order">Update Order</button> -->
<input type="hidden" id="user_id" value="<?php 
echo $userid;
?>
" />
<table id="sort1" class="grid table table-bordered store-list">
    <thead>

        <tr><th>SN</th><th>Address</th><th>Status</th><th>Hours</th><th>Action</th></tr>
    </thead>
    <tbody>
        <?php 
foreach ($records as $key => $value) {
    $operation_hours = isset($value['operation_hours']) ? $value['operation_hours'] : '';
    $h = getHours($operation_hours);
    if ($value['status'] == "2") {
        $value['status'] = "Pending";
    } elseif ($value['status'] == "1") {
        $value['status'] = "Live";
    }
    echo '<tr class="store-row">
                    <td style="width: 100px;">
                        <input type="hidden" id="' . $value['id'] . '" />
                        <span class="arrow arrow-up1"><i class="fa fa-arrow-up"></i></span>
                        <span class="row-no">' . ($key + 1) . '</span>
                        <span class="arrow arrow-down1"><i class="fa fa-arrow-down"></i></span>
                    </td>
                    <td><h4>' . $value['store_name'] . '</h4>' . $value['address'] . '</td>
                    <td>' . $value['status'] . '</td>
                    <td>' . $h . '</td>
示例#7
0
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>';
    }
}
示例#8
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);
}
示例#9
0
<?php

include "connect.php";
include "functions.php";
header("Content-Type: application/json");
$response = [];
if (isset($_GET["user_id"])) {
    $result = getHours($db, $_GET["user_id"], getSessionKey());
    if ($result) {
        $response["timelog"] = $result;
    } else {
        http_response_code(500);
        $response["error"] = "Error getting hours information.";
    }
} else {
    http_response_code(400);
    $response["error"] = "User ID is required.";
}
echo json_encode($response);
$db->close();
示例#10
0
<?php

include 'Dt.php';
include 'functions.php';
$userid = '110011';
$params = array('#sort1', 'oTable');
$dt = new DT($params);
$dt->setAjax($_SERVER["REQUEST_URI"]);
$columns = array(array('visible' => true, 'db' => 'store_info.id', "title" => "ID", 'formatter' => function ($d, $row, $r) {
    global $encrypt;
    $t = $encrypt->encode($d);
    return '<input type="hidden" id="' . $t . '" /><span class="arrow arrow-up1"><i class="fa fa-arrow-up"></i></span><span class="row-no">' . $d . '</span><span class="arrow arrow-down1"><i class="fa fa-arrow-down"></i></span>';
}), array('db' => 'store_info.store_name', 'visible' => false), array('db' => 'user_location.order', 'visible' => false), array('db' => 'store_info.street1', 'visible' => false), array('db' => 'store_info.street2', 'visible' => false), array('db' => 'store_info.city', 'visible' => false), array('db' => 'store_info.region', 'visible' => false), array('db' => 'store_info.country', 'visible' => false), array('db' => 'store_info.postalcode', 'visible' => false), array('db' => 'store_info.address', 'title' => 'Address', 'visible' => true, 'formatter' => function ($d, $row) {
    return '<h4>' . $row['store_name'] . '</h4>' . $row['street1'] . ', ' . $row['street2'] . '<br> ' . $row['city'] . ', ' . $row['region'] . '<br> ' . $row['country'] . '<br> ' . $row['postalcode'];
}), array('db' => 'store_info.status', 'title' => 'Status', 'visible' => true), array('db' => 'store_info.operation_hours', 'title' => 'Hours', 'visible' => true, 'formatter' => function ($d, $row) {
    return getHours($d);
}), array('db' => 'store_info.id', 'title' => 'Action', 'visible' => true, 'formatter' => function ($d, $row) {
    global $encrypt;
    return '<a href="add-store.php?id=' . $encrypt->encode($d) . '" class="edit" rel="' . $encrypt->encode($d) . '">Edit</a> 
        <a href="#" class="delete" rel="' . $encrypt->encode($d) . '">Delete</a>';
}));
if (isset($_REQUEST['draw'])) {
    /*$sql="SELECT store_info.*,user_location.`order` FROM user_location INNER JOIN store_info ON store_info.id=user_location.store_id ORDER BY user_location.`order`";*/
    $where = "";
    $table = 'store_info';
    $primaryKey = 'store_info.id';
    $from = "store_info";
    $join = " INNER JOIN user_location ON store_info.id=user_location.store_id";
    //$where="wi_individual_g.ind_deleted=0";
    $groupBy = "";
    /*$table = 'store_info';
示例#11
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>';
}