Esempio n. 1
0
                $id = $_GET['openid_identity'];
                $url = "/^http:\\/\\/steamcommunity\\.com\\/openid\\/id\\/(7[0-9]{15,25}+)\$/";
                preg_match($url, $id, $match);
                $_SESSION['steam'] = $match[1];
                header('Location: ' . $_GET['openid_return_to']);
            }
            return true;
        } else {
            if (isset($_GET['openid_identity']) && !empty($_GET['openid_identity'])) {
                header('Location: ' . $_GET['openid_return_to']);
            }
            return false;
        }
    }
}
steam::auth() ? steam::login() : "";
class steamInfo
{
    public static $steamid;
    public static $username;
    public static $avaFll;
    public static $avaMed;
    public static $avaSml;
    public function __construct()
    {
        $this::$steamid = $_SESSION['steam'];
        $xml = simplexml_load_string(file_get_contents("http://steamcommunity.com/profiles/" . $this::$steamid . "?xml=1"));
        $this::$username = $xml->steamID;
        $this::$avaFll = $xml->avatarFull;
        $this::$avaMed = $xml->avatarMedium;
        $this::$avaSml = $xml->avatarIcon;
function fix_steam_username()
{
    global $db, $mybb;
    if ($mybb->user['uid'] > 0 && $mybb->usergroup['cancp']) {
        if ($mybb->input['action'] == 'fix_steam_username') {
            $get_key = $db->fetch_array($db->simple_select("settings", "name, value", "name = 'steamlogin_api_key'"));
            if ($get_key['value'] != null) {
                require_once MYBB_ROOT . 'inc/class_steam.php';
                // Create a new instance of the Steam class.
                $steam = new steam();
                // Grab a list of all users.
                $users_result = $db->simple_select("users", "uid, loginname", "");
                while ($user = $db->fetch_array($users_result)) {
                    $uid = $user['uid'];
                    $loginname = $user['loginname'];
                    if (is_numeric($uid) && (is_numeric($loginname) && strlen($loginname) == 17)) {
                        // Get the details of the user from their Steam ID.
                        $user_details = $steam->get_user_info($loginname);
                        // Get the persona from the Steam service.
                        $personaname = $user_details['personaname'];
                        // Create an array of data to update.
                        $update = array();
                        $update['loginname'] = $personaname;
                        // Run the update query.
                        $db->update_query('users', $update, "uid = '{$uid}'");
                    }
                    // close if(is_numeric($uid) && (is_numeric($loginname) && strlen($loginname) == 17))
                }
                // close while($user = $db->fetch_array($users_result))
                die("<p>Any user(s) that were missing a Steam name will have now been updated.</p>");
            } else {
                // close if(!is_null($get_key))
                die("<strong>Not Configured</strong> The Steam Login plugin hasn't been configured correctly. Please ensure an API key is set in the Configuration settings.");
            }
            // close else
        }
    } else {
        // close if($mybb->user['uid'] > 0)
        die("You shouldn't be here...");
    }
    // close else
}