root/dev/mods/signature_generator/sig.php @ 98

Revision 98, 2.1 KB (checked in by exi, 14 years ago)

Added EVE-Dev logo to about page.
Fix an issue with the error jpg in the siggen.
Made item values align right in the item_values mod.
Adding sqldata for the installer. However, this is not Kali data.

Line 
1<?php
2if (!$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
10if (!$plt_id = $_GET['i'])
11{
12    header('Location: mods/signature_generator/error.jpg');
13    exit;
14}
15require_once("common/class.pilot.php");
16require_once("common/class.corp.php");
17require_once("common/class.alliance.php");
18require_once("common/class.killlist.php");
19
20$pilot = new Pilot($plt_id);
21if (!$pilot->exists())
22{
23    header('Location: mods/signature_generator/error.jpg');
24    exit;
25}
26$corp = $pilot->getCorp();
27$alliance = $corp->getAlliance();
28
29// we dont generate pictures for non-member
30if (ALLIANCE_ID && $alliance->getID() != ALLIANCE_ID)
31{
32    header('Location: mods/signature_generator/error.jpg');
33    exit;
34}
35elseif (CORP_ID && $corp->getID() != CORP_ID)
36{
37    header('Location: mods/signature_generator/error.jpg');
38    exit;
39}
40
41$id = abs(crc32($sig_name));
42// check for cached version
43if (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        if (file_exists('mods/signature_generator/signatures/'.$sig_name.'/typ.png'))
51        {
52            header('Content-Type: image/png');
53        }
54        else
55        {
56            header('Content-Type: image/jpeg');
57        }
58        readfile('cache/data/sig_'.$id.'_'.$plt_id);
59        return;
60    }
61}
62
63// check template
64if (!is_dir('mods/signature_generator/signatures/'.$sig_name))
65{
66    header('Location: mods/signature_generator/error.jpg');
67    exit;
68}
69
70// let the template do the work, we just output $im
71require('mods/signature_generator/signatures/'.$sig_name.'/'.$sig_name.'.php');
72
73if (file_exists('mods/signature_generator/signatures/'.$sig_name.'/typ.png'))
74{
75    header('Content-Type: image/png');
76}
77else
78{
79    header('Content-Type: image/jpeg');
80}
81imagejpeg($im, 'cache/data/sig_'.$id.'_'.$plt_id, 95);
82readfile('cache/data/sig_'.$id.'_'.$plt_id);
83?>
Note: See TracBrowser for help on using the browser.