|
22 | 22 |
|
23 | 23 | if( empty( $_GET['code'] ) && !isset($_GET['go'] )) { |
24 | 24 |
|
25 | | - // Empty query; show the startup page. |
26 | | - |
| 25 | + // Empty query; show the startup page. |
| 26 | + |
27 | 27 | echo ' |
28 | | - |
29 | | - <p>Sign-in using Battle.net. Please pick your region:</p> |
30 | | - |
31 | | - <p> |
32 | | - <a href="?go®ion=us">USA</a> |
33 | | - <a href="?go®ion=eu">Europe</a> |
34 | | - <a href="?go®ion=kr">Korea</a> |
35 | | - <a href="?go®ion=tw">Taiwan</a> |
36 | | - <a href="?go®ion=cn">China</a> |
37 | | - </p> |
38 | | - |
39 | | - '; |
40 | | - |
41 | | - die(); |
| 28 | + |
| 29 | + <p>Sign-in using Battle.net. Please pick your region:</p> |
| 30 | + |
| 31 | + <p> |
| 32 | + <a href="?go®ion=us">USA</a> |
| 33 | + <a href="?go®ion=eu">Europe</a> |
| 34 | + <a href="?go®ion=kr">Korea</a> |
| 35 | + <a href="?go®ion=tw">Taiwan</a> |
| 36 | + <a href="?go®ion=cn">China</a> |
| 37 | + </p> |
| 38 | + |
| 39 | + '; |
| 40 | + |
| 41 | + die(); |
42 | 42 | } |
43 | 43 |
|
44 | 44 | ////////////////////////////////////////////////////////////////////////////// |
|
58 | 58 | $region = isset($_GET['region']) ? $_GET['region'] : ""; |
59 | 59 |
|
60 | 60 | $region_map = array( |
61 | | - 'us' => BattleNet::API_URI_US, // USA - this is the default if you omit the base API URI. |
62 | | - 'eu' => BattleNet::API_URI_EU, // Europe |
63 | | - 'kr' => BattleNet::API_URI_KR, // Korea |
64 | | - 'tw' => BattleNet::API_URI_TW, // Taiwan |
65 | | - 'cn' => BattleNet::API_URI_CN, // China |
| 61 | + 'us' => BattleNet::API_URI_US, // USA - this is the default if you omit the base API URI. |
| 62 | + 'eu' => BattleNet::API_URI_EU, // Europe |
| 63 | + 'kr' => BattleNet::API_URI_KR, // Korea |
| 64 | + 'tw' => BattleNet::API_URI_TW, // Taiwan |
| 65 | + 'cn' => BattleNet::API_URI_CN, // China |
66 | 66 | ); |
67 | 67 |
|
68 | 68 | // Get base API URI from region. |
|
78 | 78 | // This was a callback request from Battle.net, get the token |
79 | 79 | $token = $battlenetService->requestAccessToken( $_GET['code'] ); |
80 | 80 |
|
81 | | - // See https://dev.battle.net/io-docs for OAuth request types. |
82 | | - // |
83 | | - // Without any scopes specified, we can get their BattleTag. |
| 81 | + // See https://dev.battle.net/io-docs for OAuth request types. |
| 82 | + // |
| 83 | + // Without any scopes specified, we can get their BattleTag. |
84 | 84 | $result = json_decode( $battlenetService->request('/account/user') ); |
85 | 85 |
|
86 | | - echo "Your BattleTag is \"$result->battletag\"."; |
| 86 | + echo "Your BattleTag is \"$result->battletag\"."; |
87 | 87 |
|
88 | 88 | } elseif( isset($_GET['go']) ) { |
89 | 89 |
|
90 | 90 | $url = $battlenetService->getAuthorizationUri(); |
91 | 91 | header( "Location: $url" ); |
92 | | - |
| 92 | + |
93 | 93 | } |
0 commit comments