1 | <?php |
---|
2 | require_once("class.page.php"); |
---|
3 | require_once("class.pilot.php"); |
---|
4 | require_once("class.corp.php"); |
---|
5 | require_once("class.alliance.php"); |
---|
6 | |
---|
7 | $page = new Page("Capture portrait"); |
---|
8 | |
---|
9 | $html .= "<html><head><title>Update portrait</title></head><body>"; |
---|
10 | |
---|
11 | if (!$page->igb()) |
---|
12 | { |
---|
13 | $html .= "You need to access this page from the EVE ingame browser."; |
---|
14 | } |
---|
15 | else |
---|
16 | { |
---|
17 | if (($_SERVER['HTTP_EVE_TRUSTED'] == 'no')) |
---|
18 | { |
---|
19 | Header('eve.trustme:http://' . $_SERVER['HTTP_HOST'] . '/::Need trust to grab character portrait.'); |
---|
20 | $html .= '<h1>Trust Required</h1>'; |
---|
21 | $html .= 'This site needs to be trusted in order to grab your character portrait.'; |
---|
22 | } |
---|
23 | else |
---|
24 | { |
---|
25 | $now = date("Y-m-d H:m:s"); |
---|
26 | |
---|
27 | $alliance = new Alliance(); |
---|
28 | $all_id = $alliance->add($_SERVER['HTTP_EVE_ALLIANCENAME']); |
---|
29 | $corp = new Corporation(); |
---|
30 | $crp_id = $corp->add($_SERVER['HTTP_EVE_CORPNAME'], $alliance, $now); |
---|
31 | $pilot = new Pilot(); |
---|
32 | $plt_id = $pilot->add($_SERVER['HTTP_EVE_CHARNAME'], $corp, $now); |
---|
33 | $pilot->setCharacterID($_SERVER['HTTP_EVE_CHARID']); |
---|
34 | @unlink("cache/portraits/" . $_SERVER['HTTP_EVE_CHARID'] . "_32.jpg"); |
---|
35 | @unlink("cache/portraits/" . $_SERVER['HTTP_EVE_CHARID'] . "_64.jpg"); |
---|
36 | @unlink("cache/portraits/" . $_SERVER['HTTP_EVE_CHARID'] . "_128.jpg"); |
---|
37 | @unlink("cache/portraits/" . $_SERVER['HTTP_EVE_CHARID'] . "_512.jpg"); |
---|
38 | //$html .= "<img src=\"".$pilot->getPortraitURL(64).".jpg\" border=\"0\">"; |
---|
39 | $html .= "Character portrait updated !<br>"; |
---|
40 | $html .= "<a href=\"?a=igb\">Return</a><br>"; |
---|
41 | |
---|
42 | //$updated = true; |
---|
43 | } |
---|
44 | } |
---|
45 | |
---|
46 | $html .= "</body></html>"; |
---|
47 | |
---|
48 | echo $html; |
---|
49 | if ($updated) |
---|
50 | { |
---|
51 | flush(); |
---|
52 | ignore_user_abort(1); |
---|
53 | $id = $_SERVER['HTTP_EVE_CHARID']; |
---|
54 | |
---|
55 | $img = imagecreatefromjpeg("http://img.eve.is/serv.asp?s=512&c=".$id); |
---|
56 | if ($img) |
---|
57 | { |
---|
58 | $newimg = imagecreatetruecolor(32, 32); |
---|
59 | imagecopyresampled($newimg, $img, 0, 0, 0, 0, 32, 32, 512, 512); |
---|
60 | imagejpeg($newimg, "cache/portraits/" . $id . "_32.jpg"); |
---|
61 | $newimg = imagecreatetruecolor(64, 64); |
---|
62 | imagecopyresampled($newimg, $img, 0, 0, 0, 0, 64, 64, 512, 512); |
---|
63 | imagejpeg($newimg, "cache/portraits/" . $id . "_64.jpg"); |
---|
64 | $newimg = imagecreatetruecolor(128, 128); |
---|
65 | imagecopyresampled($newimg, $img, 0, 0, 0, 0, 128, 128, 512, 512); |
---|
66 | imagejpeg($newimg, "cache/portraits/" . $id . "_128.jpg"); |
---|
67 | } |
---|
68 | } |
---|
69 | ?> |
---|