-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPS3API_Details.php
More file actions
165 lines (121 loc) · 4.57 KB
/
PS3API_Details.php
File metadata and controls
165 lines (121 loc) · 4.57 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
<?php
/*
#######################################
# AACGC PS API #
# by M@CH!N3 #
# http://www.AACGC.com #
#######################################
*/
require_once("../../class2.php");
require_once(HEADERF);
if (e_QUERY) {
$tmp = explode('.', e_QUERY);
$action = $tmp[0];
$sub_action = $tmp[1];
$id = $tmp[2];
unset($tmp);
}
if ($pref['psapi_enable_gold'] == "1"){$gold_obj = new gold();}
//--------------------------------------------------------------
$title .= "Member PS3 Details";
//--------------------------------------------------------------
$text .= "<center>[ <a href='PS3API_List.php'>Back To List
</a> ]</center><br><br>";
//--------------------------------------------------------------
$sql ->db_Select("user_extended", "*", "user_extended_id='".intval($sub_action)."'");
$row = $sql->db_Fetch();
$sql2 = new db;
$sql2 ->db_Select("user", "*", "user_id='".intval($row['user_extended_id'])."'");
$row2 = $sql2->db_Fetch();
if ($pref['psapi_enable_gold'] == "1")
{$username = "".$gold_obj->show_orb($row2['user_id'])."";}
else
{$username = "".$row2['user_name']."";}
if ($pref['psapi_enable_uavatar'] == "1"){
if ($row2['user_image'] == "")
{$uavatar = "";}
else
{$useravatar = $row2[user_image];
require_once(e_HANDLER."avatar_handler.php");
$useravatar = avatar($useravatar);
$uavatar = "<img src='".$useravatar."' width=".$pref['psapi_uavatar_size']."px></img>";}}
$psusername = "".$row['user_ps3api']."";
$response = file_get_contents('http://api.ps3heroes.com/api/hero/'.$psusername.'');
$data = json_decode($response, true);
$url = 'http://api.ps3heroes.com/api/hero/'.$psusername.'';
$cache_age = 60*30; # 30 minutes
$filename = 'tmp/trophy/cache.' . md5($url);
$data = null;
if(file_exists($filename))
$stat = stat($filename);
$age = time() - $stat['ctime'];
if($age < $cache_age)
$data = file_get_contents($filename);
$data = unserialize($data);
if(is_null($data))
$response = file_get_contents($url);
$data = json_decode($response, true);
if($data)
file_put_contents($filename, serialize($data));
$platinum = $data['trophies']['platinum'];
$gold = $data['trophies']['gold'];
$silver = $data['trophies']['silver'];
$bronze = $data['trophies']['bronze'];
$all = $platinum + $gold + $silver + $bronze;
$text .= "<table style='width:100%'>";
$text .= "<tr>
<td colspan=3 class='forumheader3'><center><a href='".e_BASE."user.php?id.".$row['user_extended_id']."'>".$uavatar." ".$username."</a></td>
</tr><tr>
<td rowspan=6 class='indent' style='width:0%'><center><a href='".$data['url']."' target='_blank'><img src='".$data['avatar']."'/></a></td>
<td class='indent' style='width:20%'>PS3 Username:</td>
<td class='indent' style='width:80%'>".$psusername."</td>
</tr><tr>
<td class='indent'>Bronze:</td>
<td class='indent'>".$bronze."</td>
</tr><tr>
<td class='indent'>Silver:</td>
<td class='indent'>".$silver."</td>
</tr><tr>
<td class='indent'>Gold:</td>
<td class='indent'>".$gold."</td>
</tr><tr>
<td class='indent'>Platinum:</td>
<td class='indent'>".$platinum."</td>
</tr><tr>
<td class='indent'>Total: </td>
<td class='indent'>".$all."</td>
</tr><tr>
</table><br><br>";
//--------------------------------------
$response = file_get_contents('http://api.ps3heroes.com/api/hero/'.$psusername.'/games');
$data = json_decode($response, true);
$url = 'http://api.ps3heroes.com/api/hero/'.$username.'/games';
$cache_age = 60*30; # 30 minutes
$filename = 'tmp/games/cache.' . md5($url);
$data = null;
if(file_exists($filename))
$stat = stat($filename);
$age = time() - $stat['ctime'];
if($age < $cache_age)
$data = file_get_contents($filename);
$data = unserialize($data);
if(is_null($data))
$response = file_get_contents($url);
$data = json_decode($response, true);
if($data)
file_put_contents($filename, serialize($data));
if(!$data)
$text .= 'No PS3 Information Found For This User';
$text .= '';
foreach($data as $item)
$text .= "<img src='".$item['img']."' width='100' hight='100'><a herf='".$item['url']."' target='_blank'></a>";
//----#AACGC Plugin Copyright® - DO NOT REMOVE BELOW THIS LINE! - #-------+
require(e_PLUGIN . 'aacgc_psapi/plugin.php');
$text .= "<br><br><br><br><br><br><br>
<a href='http://www.aacgc.com' target='_blank'>
<font color='808080' size='1'>".$eplug_name." V".$eplug_version." ®</font>
</a>";
//------------------------------------------------------------------------+
$ns -> tablerender($title, $text);
//----------------------------------------------------------------------------------
require_once(FOOTERF);