[MODDB] Steam Mod

A place for MOD Authors to post and receive feedback on MODs still in development. No MODs within this forum should be used within a live environment!
Ideas Centre
Locked
User avatar
keitzy
Registered User
Posts: 359
Joined: Thu Nov 12, 2009 6:32 am
Location: Esperance, Western Australia
Contact:

Re: [RC] Steam Mod

Post by keitzy » Sun Jan 09, 2011 11:38 am

add me to steam man
And ill give you the edits to go live with.

CBF atm to package into Automod install.

next couple of days maybe.

soz for steam type talk here guys.

Brain fried atm.
Image

User avatar
Mess
Registered User
Posts: 985
Joined: Wed Jul 01, 2009 6:37 am
Name: Kim

Re: [RC] Steam Mod

Post by Mess » Sun Jan 09, 2011 11:44 am

keitzy wrote:add me to steam man
And ill give you the edits to go live with.

CBF atm to package into Automod install.

next couple of days maybe.

soz for steam type talk here guys.

Brain fried atm.
Done! :D

User avatar
Prosk8er
Registered User
Posts: 1444
Joined: Sun Mar 12, 2006 3:30 am
Location: Rochester, NY
Name: Tyler
Contact:

Re: [RC] Steam Mod

Post by Prosk8er » Sun Jan 09, 2011 5:32 pm

keitzy wrote:add me to steam man
And ill give you the edits to go live with.

CBF atm to package into Automod install.

next couple of days maybe.

soz for steam type talk here guys.

Brain fried atm.
keep up the good work man
if you need help with the automod package let me know

User avatar
keitzy
Registered User
Posts: 359
Joined: Thu Nov 12, 2009 6:32 am
Location: Esperance, Western Australia
Contact:

Re: [RC] Steam Mod

Post by keitzy » Mon Jan 10, 2011 1:11 am

Yeah I have hit a wall.

I didn't think about a non steam user.

When a non steam user posts.
It cause's the xml to fail.

Working on that now.
Image

User avatar
keitzy
Registered User
Posts: 359
Joined: Thu Nov 12, 2009 6:32 am
Location: Esperance, Western Australia
Contact:

Re: [RC] Steam Mod

Post by keitzy » Mon Jan 10, 2011 3:33 am

OK. Steam Mod changes and additions are now working without errors.

In User Control Panel (UCP) -> Profile section I have added a steam sign in to aid in retreiving your steam ID 64 number.

http://www.ausgamigncore.com/clean/

username: testuser
password: testuser
Image

User avatar
Mess
Registered User
Posts: 985
Joined: Wed Jul 01, 2009 6:37 am
Name: Kim

Re: [RC] Steam Mod

Post by Mess » Mon Jan 10, 2011 7:58 am

Great work Keitzy. Glad I could help bug fix a little :P

User avatar
keitzy
Registered User
Posts: 359
Joined: Thu Nov 12, 2009 6:32 am
Location: Esperance, Western Australia
Contact:

Re: [RC] Steam Mod

Post by keitzy » Mon Jan 10, 2011 8:03 am

Your welcome and thank you. Did you get your games mod fixed and did you still want the redited version of the edits.
Image

User avatar
Mess
Registered User
Posts: 985
Joined: Wed Jul 01, 2009 6:37 am
Name: Kim

Re: [RC] Steam Mod

Post by Mess » Mon Jan 10, 2011 8:09 am

keitzy wrote:Your welcome and thank you. Did you get your games mod fixed and did you still want the redited version of the edits.
The games mod was broken by 3.0.8, I just didn't notice when I upgraded.
And yes I would very much like the new edits, both for this and xfire. :D

I can't log on steam since I'm at work though.

User avatar
muggins
Registered User
Posts: 1183
Joined: Fri Feb 22, 2008 5:12 pm
Location: Texas
Name: Donovan
Contact:

Re: [RC] Steam Mod

Post by muggins » Mon Jan 10, 2011 2:27 pm

Mess wrote:And yes I would very much like the new edits...
What he said. :mrgreen:
Muggins

User avatar
keitzy
Registered User
Posts: 359
Joined: Thu Nov 12, 2009 6:32 am
Location: Esperance, Western Australia
Contact:

Re: [RC] Steam Mod

Post by keitzy » Mon Jan 10, 2011 8:23 pm

Ok. Let me add a couple more additions and I'll give bprsk8r the edits to wack into the auto mod.

If you really want the edits now then I can put them into txt file and attach here if need be.
Image

User avatar
muggins
Registered User
Posts: 1183
Joined: Fri Feb 22, 2008 5:12 pm
Location: Texas
Name: Donovan
Contact:

Re: [RC] Steam Mod

Post by muggins » Mon Jan 10, 2011 8:52 pm

Please do. I'm not afraid of rough code. 8-)
Muggins

User avatar
Prosk8er
Registered User
Posts: 1444
Joined: Sun Mar 12, 2006 3:30 am
Location: Rochester, NY
Name: Tyler
Contact:

Re: [RC] Steam Mod

Post by Prosk8er » Mon Jan 10, 2011 9:59 pm

keitzy wrote:Ok. Let me add a couple more additions and I'll give bprsk8r the edits to wack into the auto mod.

If you really want the edits now then I can put them into txt file and attach here if need be.

i'll be on steam the rest of the night so im ready whenever

User avatar
keitzy
Registered User
Posts: 359
Joined: Thu Nov 12, 2009 6:32 am
Location: Esperance, Western Australia
Contact:

Re: [RC] Steam Mod

Post by keitzy » Mon Jan 10, 2011 11:47 pm

You will need to install steam mod first.
If you can't be bothered to manualy install. bprsk8r is creating a install for automod.

Credit for the steam sign in mod addition goes to sam aka syntax_error and voogru for the steam conversion algorithm.

Code: Select all

 

download icon from http://www.ausgamingcore.com/clean/styles/prosilver/imageset/icon_contact_steam_profile.gif

Copy: root/styles/prosilver/imageset/icon_contact_steam_profile.gif
To: styles/prosilver/imageset/icon_contact_steam_profile.gif

in viewtopic.php

//add steam profile icon
find in $template->assign_vars(array(

	'WWW_IMG' 			=> $user->img('icon_contact_www', 'VISIT_WEBSITE'),

add after

	'STEAM_PROFILE_IMG' 		=> $user->img('icon_contact_steam_proflie', 'VISIT_STEAM_PROFILE'),

//allow guests to view steam status	
find

				'steam'			=> ($row['user_steam'] && $auth->acl_get('u_sendim'))  ? $row['user_steam'] : '',

replace with
			
				'steam'			=> $row['user_steam'],
				
//ask if user has a steamid64 in the post and if has get steam xml data and load the file
find

	$delete_allowed = ($user->data['is_registered'] && ($auth->acl_get('m_delete', $forum_id) || (
		$user->data['user_id'] == $poster_id &&
		$auth->acl_get('f_delete', $forum_id) &&
		$topic_data['topic_last_post_id'] == $row['post_id'] &&
		($row['post_time'] > time() - ($config['delete_time'] * 60) || !$config['delete_time']) &&
		// we do not want to allow removal of the last post if a moderator locked it!
		!$row['post_edit_locked']
	)));

add after

// BEGIN steam mod
    if (empty($user_cache[$poster_id]['steam']))
    {
    $steamxml = '' ;
    }
    else
    {
    $steamxml = simplexml_load_file('http://steamcommunity.com/profiles/' . $user_cache[$poster_id]['steam'] . '?xml=1');
    }
//END steam mod

//ask if user had post steamid and get data from loaded xml file from steam to be ready for echo in template file
find in 	$postrow = array(

// BEGIN steam mod
		'U_STEAM'		=> $user_cache[$poster_id]['steam'],
		'STEAM_IS_INT'  => (!empty($user_cache[$poster_id]['steam']) && is_numeric($user_cache[$poster_id]['steam'])) ? true : false,
// END steam mod

replace with

// BEGIN steam mod
		'STEAM_IS_INT'      => (!isset($user_cache[$poster_id]['steam'])) ? true : false,
		'U_STEAM'		        => $user_cache[$poster_id]['steam'],
		'U_STEAM_PROFILE'		=> 'http://www.steamcommunity.com/profiles/ ' . $user_cache[$poster_id]['steam'],
		'STEAM_NAME'        => $steamxml->steamID,
    'STEAM_STATE'       => $steamxml->onlineState,
    'STEAM_STATE_MSG'   => $steamxml->stateMessage,
    'STEAM_AVATAR_ICON' => $steamxml->avatarIcon,
    'STEAM_AVATAR_FULL' => $steamxml->avatarFull,
    'STEAM_GAME'        => $steamxml->inGameInfo->gameIcon,
//END steam mod

end of viewtopic.php

in language/en/viewtopic.php

find

	'VISIT_WEBSITE'			=> 'WWW',

add after

	'VISIT_STEAM_PROFILE'			=> 'View Steam Profile',	
	
end of language/en/viewtopic.php

in includes/ucp/ucp_profile.php

find class ucp_profile

add before

// Begin steam mod
class ucp_steam
{

	const STEAM_LOGIN = 'https://steamcommunity.com/openid/login';

	/**
	* Get the URL to sign into steam
	*
	* @param mixed returnTo URI to tell steam where to return, MUST BE THE FULL URI WITH THE PROTOCOL
	* @param bool useAmp Use & in the URL, true; or just &, false. 
	* @return string The string to go in the URL
	*/	
	public static function genUrl($returnTo = false, $useAmp = true)
	{
		$returnTo = (!$returnTo) ? (!empty($_SERVER['HTTPS']) ? 'https' : 'http') . '://' . $_SERVER['HTTP_HOST'] . $_SERVER['SCRIPT_NAME'] : $returnTo;
		
		$params = array(
			'openid.ns'			=> 'http://specs.openid.net/auth/2.0',
			'openid.mode'		=> 'checkid_setup',
			'openid.return_to'	=> $returnTo,
			'openid.realm'		=> (!empty($_SERVER['HTTPS']) ? 'https' : 'http') . '://' . $_SERVER['HTTP_HOST'],
			'openid.identity'	=> 'http://specs.openid.net/auth/2.0/identifier_select',
			'openid.claimed_id'	=> 'http://specs.openid.net/auth/2.0/identifier_select',
		);
		
		$sep = ($useAmp) ? '&' : '&';
		return self::STEAM_LOGIN . '?' . http_build_query($params, '', $sep);
	}
	
	/**
	* Validate the incoming data
	*
	* @return string Returns the SteamID64 if successful or empty string on failure
	*/
	public static function validate()
	{
		// Star off with some basic params
		$params = array(
			'openid.assoc_handle'	=> $_GET['openid_assoc_handle'],
			'openid.signed'			=> $_GET['openid_signed'],
			'openid.sig'			=> $_GET['openid_sig'],
			'openid.ns'				=> 'http://specs.openid.net/auth/2.0',
		);
		
		// Get all the params that were sent back and resend them for validation
		$signed = explode(',', $_GET['openid_signed']);
		foreach($signed as $item)
		{
			$val = $_GET['openid_' . str_replace('.', '_', $item)];
			$params['openid.' . $item] = get_magic_quotes_gpc() ? stripslashes($val) : $val; 
		}

		// Finally, add the all important mode. 
		$params['openid.mode'] = 'check_authentication';
		
		// Stored to send a Content-Length header
		$data =  http_build_query($params);
		$context = stream_context_create(array(
			'http' => array(
				'method'  => 'POST',
				'header'  => 
					"Accept-language: en\r\n".
					"Content-type: application/x-www-form-urlencoded\r\n" .
					"Content-Length: " . strlen($data) . "\r\n",
				'content' => $data,
			),
		));

		$result = file_get_contents(self::STEAM_LOGIN, false, $context);
		
		// Validate wheather it's true and if we have a good ID
		preg_match("#^http://steamcommunity.com/openid/id/([0-9]{17,25})#", $_GET['openid_claimed_id'], $matches);
		$steamID64 = is_numeric($matches[1]) ? $matches[1] : 0;

		// Return our final value
		return preg_match("#is_valid\s*:\s*true#i", $result) == 1 ? $steamID64 : '';
	}
}

//END steam mod

find in class ucp_profile

		$s_hidden_fields = '';
		
add after

    $steamerror = false;
		$action = request_var('action', '');


//BEGIN steam mod
    if($user->data['user_steam'] > 0)
		{
			if($action == 'unlink')
			{
				$sql = 'UPDATE ' . USERS_TABLE . "
					SET user_steam = 0
					WHERE user_id = {$user->data['user_id']}";
				$db->sql_query($sql);
				
				trigger_error('Your Steam Account has been unlinked successfully.<br /><br /><a href="' . append_sid($this->u_action) . '">Return to the User Control Panel</a>');
			}
			
			$template->assign_vars(array(
				'U_UNLINK_STEAM'	=> append_sid($this->u_action . '&action=unlink'),
			));
		}
		else
		{
			if(isset($_GET['openid_mode']))
			{
				$steamID64 = ucp_steam::validate();
				
				if(!empty($steamID64))
				{
					$steamID64 = $db->sql_escape($steamID64);
					$sql = 'UPDATE ' . USERS_TABLE . "
						SET user_steam = $steamID64
						WHERE user_id = {$user->data['user_id']}";
					$db->sql_query($sql);
					
					trigger_error('Your Steam Account has been linked successfully.<br /><br /><a href="' . append_sid($this->u_action) . '">Return to Profile Edit</a>');
				}
				
				$error = 'There was an error with Authentication. Either the operation was canceled or the credentials were invalid.';
			}
			
			$template->assign_vars(array(
				'ERROR'				=> $steamerror,
				'U_STEAM_SIGNIN'	=> ucp_steam::genUrl(append_sid(generate_board_url() . '/ucp.php', 'i=' . $id . '&mode=' . $mode)),
			));
		}
//END steam mod

end of includes/ucp/ucp_profile.php

find in styles/prosilver/template/viewtopic_body.html

find 

	<dl>
		<dt><label for="steam">{L_STEAM}:</label><br /><span>{STEAM_EXPLAIN}</span></dt>
		<dd><input type="text" name="steam" id="steam" maxlength="255" value="{STEAM}" class="inputbox" /></dd>
	</dl>
	
replace with

			<!-- IF postrow.STEAM_IS_INT --><!-- ELSE --><!-- IF postrow.U_STEAM --><dd><label for="steam">{L_STEAM}:</label><!--<span class="steam_{postrow.STEAM_STATE}"><a href="http://steamcommunity.com/profiles/{postrow.U_STEAM}"><img src="{postrow.STEAM_AVATAR_ICON}" border="0"/></a></span>
			--><!-- <img class="steam_{postrow.STEAM_STATE}" style="float:left;padding:5px;" src="{postrow.STEAM_GAME}" /></span>--><span class="steam_{postrow.STEAM_STATE}">{postrow.STEAM_STATE_MSG}</span></dd><!-- ENDIF --><!-- ENDIF -->

find

 		<!-- IF postrow.U_PM or postrow.U_EMAIL or postrow.U_WWW or postrow.U_MSN or postrow.U_ICQ or postrow.U_YIM or postrow.U_AIM or postrow.U_JABBER -->

inline find 

or postrow.U_JABBER

after add

 or postrow.U_STEAM
 
find

 					<!-- IF postrow.U_JABBER --><li class="jabber-icon"><a href="{postrow.U_JABBER}" onclick="popup(this.href, 550, 320); return false;" title="{L_JABBER}"><span>{L_JABBER}</span></a></li><!-- ENDIF -->

after add

					<!-- IF postrow.U_STEAM --><li class="steam_profile-icon"><a href="http://www.steamcommunity.com/profiles/{postrow.U_STEAM}" title="{L_VISIT_STEAM_PROFILE}" target="_blank"><span>{L_VISIT_STEAM_PROFILE}</span></a></li><!-- ENDIF -->

end of styles/prosilver/template/viewtopic_body.html

in styles/prosilver/template/ucp_profile_profile_info.html

find

	<dl>
		<dt><label for="steam">{L_STEAM}:</label><br /><span>{STEAM_EXPLAIN}</span></dt>
		<dd><input type="text" name="steam" id="steam" maxlength="255" value="{STEAM}" class="inputbox" /></dd>
	</dl>

replace with

	<dl>
		<dt><label for="steam">{L_STEAM}:</label></span></dt>
		<dd><!-- IF U_STEAM_SIGNIN --><!-- IF ERROR --><span class="error">{ERROR}</span><!-- ENDIF --><br /><a href="{U_STEAM_SIGNIN}" /><img src="http://steamcommunity.com/public/images/signinthroughsteam/sits_small.png" border="0" /></a>	<!-- ELSE --><input type="text" name="steam" id="steam" maxlength="255" value="{STEAM}" class="inputbox" />	<!-- ENDIF --></dd>
	</dl>


end of styles/prosilver/template/ucp_profile_profile_info.html

in styles/prosilver/theme/buttons.css

find

.web-icon, .web-icon a			{ background: none top left no-repeat; }

after add

.steam_profile-icon, .steam_profile-icon a		{ background: none top left no-repeat; }

find

ul.profile-icons li.web-icon	{ width: {IMG_ICON_CONTACT_WWW_WIDTH}px; height: {IMG_ICON_CONTACT_WWW_HEIGHT}px; }

after add

ul.profile-icons li.steam_profile-icon	{ width: 20px; height: 20px; }

end of styles/prosilver/theme/buttons.css

in styles/prosilver/theme/colours.css

find

/* Miscellaneous styles
---------------------------------------- */

after add

.steam_online {
  color: #62A7E3;
  }

.steam_offline {
  color:#898989;
}

.steam_in-game {
  color:#8BC53F;
}

.steam_online_border {
  border: solid 2px #62A7E3;
  color: #62A7E3;
  }
  
.steam_offline_border {
  border: solid 2px #62A7E3;
  color: #898989;
  }
  
.steam_in-game_border {
  border: solid 2px #62A7E3;
  color: #8BC53F;
  }

find 

.web-icon, .web-icon a			{ background-image: url("{IMG_ICON_CONTACT_WWW_SRC}"); }

after add

.steam_profile-icon, .steam_profile-icon a			{ background-image: url("{T_IMAGESET_PATH}/icon_contact_steam_profile.gif"); }

end of styles/prosilver/theme/colours.css

Last edited by keitzy on Tue Jan 11, 2011 7:18 am, edited 2 times in total.
Image

User avatar
keitzy
Registered User
Posts: 359
Joined: Thu Nov 12, 2009 6:32 am
Location: Esperance, Western Australia
Contact:

Re: [RC] Steam Mod

Post by keitzy » Tue Jan 11, 2011 1:12 am

please change the http://steamcommunity.com/id/76561197984630148 to http://steamcommunity.com/profiles/76561197984630148 . Steam uses profiles/ directoy for steamID64 interger and id/ for custom url
so if i was to use the customurl for my steam profile with steam mod.
customurl - keitzy = http://steamcommunity.com/id/keitzy
steamID64 interger - 76561197984630148 = http://steamcommunity.com/profiles/76561197984630148

So I figure the <!-- IF STEAM_IS_INT --> part is broken or working backwards. It is in file styles/your_board_style_here/templates/memberlist_view.html.
muggins wrote:Sweet! 8-)

Easy and straightforward, installed flawlessly. Thank you!

Edit: Maybe not so good... When I click the profile link in viewtopic, the Steam page reports "Profile not found" even though the correct banner is displayed in the user's forum profile.

As an example, http://steamcommunity.com/id/76561197961017638 gives the error, but this is the profile view for that member's Steam id number:

Image

And here is the profile field contents: 76561197961017638

Did I miss something? :?
Image

User avatar
Prosk8er
Registered User
Posts: 1444
Joined: Sun Mar 12, 2006 3:30 am
Location: Rochester, NY
Name: Tyler
Contact:

Re: [RC] Steam Mod

Post by Prosk8er » Tue Jan 11, 2011 2:17 am

keitzy wrote:please change the http://steamcommunity.com/id/76561197984630148 to http://steamcommunity.com/profiles/76561197984630148 . Steam uses profiles/ directoy for steamID64 interger and id/ for custom url
so if i was to use the customurl for my steam profile with steam mod.
customurl - keitzy = http://steamcommunity.com/id/keitzy
steamID64 interger - 76561197984630148 = http://steamcommunity.com/profiles/76561197984630148

So I figure the <!-- IF STEAM_IS_INT --> part is broken or working backwards. It is in file styles/your_board_style_here/templates/memberlist_view.html.
muggins wrote:Sweet! 8-)

Easy and straightforward, installed flawlessly. Thank you!

Edit: Maybe not so good... When I click the profile link in viewtopic, the Steam page reports "Profile not found" even though the correct banner is displayed in the user's forum profile.

As an example, http://steamcommunity.com/id/76561197961017638 gives the error, but this is the profile view for that member's Steam id number:

Image

And here is the profile field contents: 76561197961017638

Did I miss something? :?
i fixed it later on and forgot to tell him about that the steam_is_int worked but just forgot to tell him :( at first that wasnt available but i started looking at it then rmcgirr did and came up with that fix

Locked

Return to “[3.0.x] MODs in Development”