<commit_before><?php

namespace IPS\core\ProfileSync;

/* To prevent PHP errors (extending class does not exist) revealing path */
if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
{
	header( ( isset( $_SERVER['SERVER_PROTOCOL'] ) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.0' ) . ' 403 Forbidden' );
	exit;
}

/**
 * Steam Profile Sync
 */
class _Steam extends ProfileSyncAbstract
{
	/**
	 * @brief	Login handler key
	 */
	public static $loginKey = 'Steam';

	/**
	 * @brief	Icon
	 */
	public static $icon = 'steam';

	/**
	 * @brief	Authorization token
	 */
	protected $authToken = NULL;

	protected function userData() {
		$loginHandler = \IPS\Login\LoginAbstract::load('steam');

		/* If an api key is provided, attempt to load the user from steam */
		$response = null;

		if ($loginHandler->settings['api_key']) {
			try {
				$response = \IPS\Http\Url::external("http://api.steampowered.com/ISteamUser/GetPlayerSummaries/v0002/?key={$loginHandler->settings['api_key']}&steamids={$this->member->steamid}")->request()->get()->decodeJson();

				if ($response) {
					// Get the first player
					return $response['response']['players'][0];
				}
			} catch ( \IPS\Http\Request\Exception $e ) {
				// Fall through to return NULL below
			}<commit_msg>Use HTTPS URL<commit_after><?php

namespace IPS\core\ProfileSync;

/* To prevent PHP errors (extending class does not exist) revealing path */
if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
{
	header( ( isset( $_SERVER['SERVER_PROTOCOL'] ) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.0' ) . ' 403 Forbidden' );
	exit;
}

/**
 * Steam Profile Sync
 */
class _Steam extends ProfileSyncAbstract
{
	/**
	 * @brief	Login handler key
	 */
	public static $loginKey = 'Steam';

	/**
	 * @brief	Icon
	 */
	public static $icon = 'steam';

	/**
	 * @brief	Authorization token
	 */
	protected $authToken = NULL;

	protected function userData() {
		$loginHandler = \IPS\Login\LoginAbstract::load('steam');

		/* If an api key is provided, attempt to load the user from steam */
		$response = null;

		if ($loginHandler->settings['api_key']) {
			try {
				$response = \IPS\Http\Url::external("https://api.steampowered.com/ISteamUser/GetPlayerSummaries/v0002/?key={$loginHandler->settings['api_key']}&steamids={$this->member->steamid}")->request()->get()->decodeJson();

				if ($response) {
					// Get the first player
					return $response['response']['players'][0];
				}
			} catch ( \IPS\Http\Request\Exception $e ) {
				// Fall through to return NULL below
			}
{'fraction_non_alphanumeric': 0.16927396710790213, 'fraction_numerical': 0.008022462896109106, 'mean_word_length': 3.696798493408663, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 17, 'https://': 1, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2399382', 'n_tokens_mistral': 898, 'n_tokens_neox': 812, 'n_words': 190}