function GetGroups($friendid)
{
    set_time_limit(0);
    $objResponse = new xajaxResponse();
    if ($GLOBALS['config']['config.enablegroupbanning'] == 0 || !is_numeric($friendid)) {
        return $objResponse;
    }
    global $userbank, $username;
    if (!$userbank->HasAccess(ADMIN_OWNER | ADMIN_ADD_BAN)) {
        $objResponse->redirect("index.php?p=login&m=no_access", 0);
        $log = new CSystemLog("w", "Ошибка доступа", $username . " пытался получить список групп '" . $friendid . "', не имея на это прав.");
        return $objResponse;
    }
    // check if we're getting redirected, if so there is $result["Location"] (the player uses custom id)  else just use the friendid. !We can't get the xml with the friendid url if the player has a custom one!
    $result = get_headers("http://steamcommunity.com/profiles/" . $friendid . "/", 1);
    $raw = file_get_contents((!empty($result["Location"]) ? $result["Location"] : "http://steamcommunity.com/profiles/" . $friendid . "/") . "?xml=1");
    preg_match("/<privacyState>([^\\]]*)<\\/privacyState>/", $raw, $status);
    if ($status && $status[1] != "public" || strstr($raw, "<groups>")) {
        $raw = str_replace("&", "", $raw);
        $raw = strip_31_ascii($raw);
        $raw = utf8_encode($raw);
        $xml = simplexml_load_string($raw);
        // parse xml
        $result = $xml->xpath('/profile/groups/group');
        // go to the group nodes
        $i = 0;
        while (list(, $node) = each($result)) {
            // Checkbox & Groupname table cols
            $objResponse->addScript('var e = document.getElementById("steamGroupsTable");
													var tr = e.insertRow("-1");
														var td = tr.insertCell("-1");
															td.className = "listtable_1";
															td.style.padding = "0px";
															td.style.width = "3px";
																var input = document.createElement("input");
																input.setAttribute("type","checkbox");
																input.setAttribute("id","chkb_' . $i . '");
																input.setAttribute("value","' . $node->groupURL . '");
															td.appendChild(input);
														var td = tr.insertCell("-1");
															td.className = "listtable_1";
															var a = document.createElement("a");
																a.href = "http://steamcommunity.com/groups/' . $node->groupURL . '";
																a.setAttribute("target","_blank");
																	var txt = document.createTextNode("' . utf8_decode($node->groupName) . '");
																a.appendChild(txt);
															td.appendChild(a);
																var txt = document.createTextNode(" (");
															td.appendChild(txt);
																var span = document.createElement("span");
																span.setAttribute("id","membcnt_' . $i . '");
																span.setAttribute("value","' . $node->memberCount . '");
																	var txt3 = document.createTextNode("' . $node->memberCount . '");
																span.appendChild(txt3);
															td.appendChild(span);
																var txt2 = document.createTextNode(" Members)");
															td.appendChild(txt2);
														');
            $i++;
        }
    } else {
        $objResponse->addScript("ShowBox('Ошибка', 'Ошибка получения информации о группе. <br>Возможно это участник другой группы, или его профиль скрыт.<br><a href=\"http://steamcommunity.com/profiles/" . $friendid . "/\" title=\"Профиль участника\" target=\"_blank\">Профиль участника</a>', 'red', 'index.php?p=banlist', true);");
        $objResponse->addScript("\$('steamGroupsText').innerHTML = '<i>Нет групп...</i>';");
        return $objResponse;
    }
    $objResponse->addScript("\$('steamGroupsText').setStyle('display', 'none');");
    $objResponse->addScript("\$('steamGroups').setStyle('display', 'block');");
    return $objResponse;
}
Пример #2
0
function GetGroups($friendid)
{
    set_time_limit(0);
    $objResponse = new xajaxResponse();
    if ($GLOBALS['config']['config.enablegroupbanning'] == 0 || !is_numeric($friendid)) {
        return $objResponse;
    }
    global $userbank, $username;
    if (!$userbank->HasAccess(ADMIN_OWNER | ADMIN_ADD_BAN)) {
        $objResponse->redirect("index.php?p=login&m=no_access", 0);
        $log = new CSystemLog("w", "Hacking Attempt", $username . " tried to list groups of '" . $friendid . "', but doesnt have access.");
        return $objResponse;
    }
    // check if we're getting redirected, if so there is $result["Location"] (the player uses custom id)  else just use the friendid. !We can't get the xml with the friendid url if the player has a custom one!
    $result = get_headers("http://steamcommunity.com/profiles/" . $friendid . "/", 1);
    $raw = file_get_contents((!empty($result["Location"]) ? $result["Location"] : "http://steamcommunity.com/profiles/" . $friendid . "/") . "?xml=1");
    preg_match("/<privacyState>([^\\]]*)<\\/privacyState>/", $raw, $status);
    if ($status && $status[1] != "public" || strstr($raw, "<groups>")) {
        $raw = str_replace("&", "", $raw);
        $raw = strip_31_ascii($raw);
        $raw = utf8_encode($raw);
        $xml = simplexml_load_string($raw);
        // parse xml
        $result = $xml->xpath('/profile/groups/group');
        // go to the group nodes
        $i = 0;
        while (list(, $node) = each($result)) {
            // Steam only provides the details of the first 3 groups of a players profile. We need to fetch the individual groups seperately to get the correct information.
            if (empty($node->groupName)) {
                $memberlistxml = file_get_contents("http://steamcommunity.com/gid/" . $node->groupID64 . "/memberslistxml/?xml=1");
                $memberlistxml = str_replace("&", "", $memberlistxml);
                $memberlistxml = strip_31_ascii($memberlistxml);
                $memberlistxml = utf8_encode($memberlistxml);
                $groupxml = simplexml_load_string($memberlistxml);
                // parse xml
                $node = $groupxml->xpath('/memberList/groupDetails');
                $node = $node[0];
            }
            // Checkbox & Groupname table cols
            $objResponse->addScript('var e = document.getElementById("steamGroupsTable");
													var tr = e.insertRow("-1");
														var td = tr.insertCell("-1");
															td.className = "listtable_1";
															td.style.padding = "0px";
															td.style.width = "3px";
																var input = document.createElement("input");
																input.setAttribute("type","checkbox");
																input.setAttribute("id","chkb_' . $i . '");
																input.setAttribute("value","' . $node->groupURL . '");
															td.appendChild(input);
														var td = tr.insertCell("-1");
															td.className = "listtable_1";
															var a = document.createElement("a");
																a.href = "http://steamcommunity.com/groups/' . $node->groupURL . '";
																a.setAttribute("target","_blank");
																	var txt = document.createTextNode("' . utf8_decode($node->groupName) . '");
																a.appendChild(txt);
															td.appendChild(a);
																var txt = document.createTextNode(" (");
															td.appendChild(txt);
																var span = document.createElement("span");
																span.setAttribute("id","membcnt_' . $i . '");
																span.setAttribute("value","' . $node->memberCount . '");
																	var txt3 = document.createTextNode("' . $node->memberCount . '");
																span.appendChild(txt3);
															td.appendChild(span);
																var txt2 = document.createTextNode(" Members)");
															td.appendChild(txt2);
														');
            $i++;
        }
    } else {
        $objResponse->addScript("ShowBox('Error', 'There was an error retrieving the group data. <br>Maybe the player isn\\'t member of any group or his profile is private?<br><a href=\"http://steamcommunity.com/profiles/" . $friendid . "/\" title=\"Community profile\" target=\"_blank\">Community profile</a>', 'red', 'index.php?p=banlist', true);");
        $objResponse->addScript("\$('steamGroupsText').innerHTML = '<i>No groups...</i>';");
        return $objResponse;
    }
    $objResponse->addScript("\$('steamGroupsText').setStyle('display', 'none');");
    $objResponse->addScript("\$('steamGroups').setStyle('display', 'block');");
    return $objResponse;
}
Пример #3
0
function GetCommunityName($steamid)
{
    $friendid = SteamIDToFriendID($steamid);
    $result = get_headers("http://steamcommunity.com/profiles/" . $friendid . "/", 1);
    $raw = file_get_contents(($result["Location"] != "" ? $result["Location"] : "http://steamcommunity.com/profiles/" . $friendid . "/") . "?xml=1");
    if (strstr($raw, "</profile>")) {
        $raw = str_replace("&", "", $raw);
        $raw = strip_31_ascii($raw);
        $raw = utf8_encode($raw);
        $xml = simplexml_load_string($raw);
        $result = $xml->xpath('/profile/steamID');
        $friendid = (string) $result[0];
        return $friendid;
    }
    return "";
}