1 | <?php |
---|
2 | if (!$sig_name = $_GET['s']) |
---|
3 | { |
---|
4 | $sig_name = 'default'; |
---|
5 | } |
---|
6 | $sig_name = str_replace('.', '', $sig_name); |
---|
7 | $sig_name = str_replace('/', '', $sig_name); |
---|
8 | $sig_name = str_replace('/', '', $sig_name); |
---|
9 | |
---|
10 | if (!$plt_id = $_GET['i']) |
---|
11 | { |
---|
12 | header('location: error.jpg'); |
---|
13 | exit; |
---|
14 | } |
---|
15 | require_once("common/class.pilot.php"); |
---|
16 | require_once("common/class.corp.php"); |
---|
17 | require_once("common/class.alliance.php"); |
---|
18 | require_once("common/class.killlist.php"); |
---|
19 | |
---|
20 | $pilot = new Pilot($plt_id); |
---|
21 | if (!$pilot->exists()) |
---|
22 | { |
---|
23 | header('Location: error.jpg'); |
---|
24 | exit; |
---|
25 | } |
---|
26 | $corp = $pilot->getCorp(); |
---|
27 | $alliance = $corp->getAlliance(); |
---|
28 | |
---|
29 | // we dont generate pictures for non-member |
---|
30 | if (ALLIANCE_ID && $alliance->getID() != ALLIANCE_ID) |
---|
31 | { |
---|
32 | header('Location: error.jpg'); |
---|
33 | exit; |
---|
34 | } |
---|
35 | elseif (CORP_ID && $corp->getID() != CORP_ID) |
---|
36 | { |
---|
37 | header('Location: error.jpg'); |
---|
38 | exit; |
---|
39 | } |
---|
40 | |
---|
41 | $id = abs(crc32($sig_name)); |
---|
42 | // check for cached version |
---|
43 | if (file_exists('cache/data/sig_'.$id.'_'.$plt_id)) |
---|
44 | { |
---|
45 | $age = filemtime('cache/data/sig_'.$id.'_'.$plt_id); |
---|
46 | |
---|
47 | // cache files for 30 minutes |
---|
48 | if (time() - $age < 30*60) |
---|
49 | { |
---|
50 | header('Content-Type: image/jpg'); |
---|
51 | readfile('cache/data/sig_'.$id.'_'.$plt_id); |
---|
52 | return; |
---|
53 | } |
---|
54 | } |
---|
55 | |
---|
56 | // check template |
---|
57 | if (!is_dir('mods/signature_generator/signatures/'.$sig_name)) |
---|
58 | { |
---|
59 | header('Location: error.jpg'); |
---|
60 | exit; |
---|
61 | } |
---|
62 | |
---|
63 | require('mods/signature_generator/signatures/'.$sig_name.'/'.$sig_name.'.php'); |
---|
64 | |
---|
65 | header('Content-Type: image/jpg'); |
---|
66 | imagejpeg($im, 'cache/data/sig_'.$id.'_'.$plt_id, 95); |
---|
67 | readfile('cache/data/sig_'.$id.'_'.$plt_id); |
---|
68 | ?> |
---|