Skip to content

Commit

Permalink
Differentiate validity problems from private profiles.
Browse files Browse the repository at this point in the history
  • Loading branch information
icculus committed Jul 5, 2010
1 parent 47d9a77 commit 6ffa404
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 5 deletions.
8 changes: 7 additions & 1 deletion index.html
Expand Up @@ -101,7 +101,13 @@
return null;
} // if

if (prof.find('valid').text() != '1')
if (prof.find('valid').text() == '0')
{
popover('#loginfailurepopover');
return null;
} // if

if (prof.find('private').text() == '1')
{
var url = 'http://steamcommunity.com/profiles/' + steamid + '/edit/settings';
$('a#privpage').attr('href', url);
Expand Down
9 changes: 7 additions & 2 deletions steamprofile.php
Expand Up @@ -47,9 +47,14 @@ function dump_array_as_xml($name, $a)
} // if

$steamid = $_SESSION['steamid'];
$profile = load_steam_profile($steamid);
$profile = load_steam_profile($steamid, $isprivate);

if ($profile == NULL)
if ($isprivate)
{
print("<profile><steamid>$steamid</steamid><valid>1</valid><private>1</private></profile>");
exit(0);
} // if
else if ($profile == NULL)
{
print("<profile><steamid>$steamid</steamid><valid>0</valid></profile>");
exit(0);
Expand Down
6 changes: 4 additions & 2 deletions steamtags.php
Expand Up @@ -56,7 +56,7 @@ function load_profile_game_tags(&$profile)
return true;
} // load_profile_game_tags

function load_steam_profile($user)
function load_steam_profile($user, &$isprivate)
{
$sxe = url_to_simplexml(steam_profile_url($user));
if ($sxe === false)
Expand All @@ -65,7 +65,8 @@ function load_steam_profile($user)
return NULL;
} // if

if ($sxe->privacyState != 'public')
$isprivate = ($sxe->privacyState != 'public');
if ($isprivate)
{
//write_error("This user's profile is marked private");
return NULL;
Expand All @@ -77,6 +78,7 @@ function load_steam_profile($user)

$profile = array();
$profile['valid'] = 1;
$profile['private'] = 0;
$profile['nickname'] = (string) $sxe->steamID;
$profile['steamid'] = (string) $steamid64;
$profile['name'] = $scid;
Expand Down

0 comments on commit 6ffa404

Please sign in to comment.