- Timestamp:
- 11/11/06 00:51:53 (14 years ago)
- Location:
- dev/mods/signature_generator
- Files:
-
- 12 added
- 2 removed
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
dev/mods/signature_generator/sig.php
r39 r72 6 6 $sig_name = str_replace('.', '', $sig_name); 7 7 $sig_name = str_replace('/', '', $sig_name); 8 $sig_name = str_replace('/', '', $sig_name); 8 9 9 10 if (!$plt_id = $_GET['i']) 10 11 { 12 header('location: error.jpg'); 11 13 exit; 12 14 } … … 19 21 if (!$pilot->exists()) 20 22 { 23 header('Location: error.jpg'); 21 24 exit; 22 25 } … … 27 30 if (ALLIANCE_ID && $alliance->getID() != ALLIANCE_ID) 28 31 { 32 header('Location: error.jpg'); 29 33 exit; 30 34 } 31 35 elseif (CORP_ID && $corp->getID() != CORP_ID) 32 36 { 37 header('Location: error.jpg'); 33 38 exit; 34 39 } 35 40 41 $id = abs(crc32($sig_name)); 36 42 // check for cached version 37 if (file_exists('cache/data/sig_'.$ plt_id))43 if (file_exists('cache/data/sig_'.$id.'_'.$plt_id)) 38 44 { 39 $age = filemtime('cache/data/sig_'.$ plt_id);45 $age = filemtime('cache/data/sig_'.$id.'_'.$plt_id); 40 46 41 47 // cache files for 30 minutes 42 48 if (time() - $age < 30*60) 43 49 { 44 header('Content-Type: image/ png');45 readfile('cache/data/sig_'.$ plt_id);50 header('Content-Type: image/jpg'); 51 readfile('cache/data/sig_'.$id.'_'.$plt_id); 46 52 return; 47 53 } … … 49 55 50 56 // check template 51 if (! file_exists('mods/signature_generator/signatures/'.$sig_name.'.png'))57 if (!is_dir('mods/signature_generator/signatures/'.$sig_name)) 52 58 { 59 header('Location: error.jpg'); 53 60 exit; 54 61 } 55 $im = imagecreatefrompng('mods/signature_generator/signatures/'.$sig_name.'.png');56 62 57 $red = imagecolorallocate($im, 255, 10, 10); 58 $orange = imagecolorallocate($im, 150, 120, 20); 59 $blue = imagecolorallocate($im, 0, 0, 200); 60 $white = imagecolorallocate($im, 255, 255, 255); 61 $black = imagecolorallocate($im, 0, 0, 0); 63 require('mods/signature_generator/signatures/'.$sig_name.'/'.$sig_name.'.php'); 62 64 63 $grey_trans = imagecolorallocatealpha($im, 50, 50, 50, 50); 64 $greyred_trans = imagecolorallocatealpha($im, 50, 10, 10, 50); 65 66 $name = $pilot->getName(); 67 68 $list = new KillList(); 69 $list->setOrdered(true); 70 $list->setLimit(1); 71 $list->setPodsNoobships(false); 72 $list->addInvolvedPilot($pilot); 73 $kill = $list->getKill(); 74 75 require('mods/signature_generator/settings/'.$sig_name.'.php'); 76 77 header('Content-Type: image/png'); 78 //imagepng($im); 79 imagepng($im, 'cache/data/sig_'.$plt_id); 80 readfile('cache/data/sig_'.$plt_id); 65 header('Content-Type: image/jpg'); 66 imagejpeg($im, 'cache/data/sig_'.$id.'_'.$plt_id, 95); 67 readfile('cache/data/sig_'.$id.'_'.$plt_id); 81 68 ?>