1 | <?php |
---|
2 | require_once('common/includes/class.parser.php'); |
---|
3 | require_once('common/includes/class.phpmailer.php'); |
---|
4 | require_once('common/includes/class.kill.php'); |
---|
5 | |
---|
6 | $kb = new Killboard(KB_SITE); |
---|
7 | |
---|
8 | $html = '<html><head><title>'.KB_TITLE.' Killboard - Post Mail</title></head></html><body>'; |
---|
9 | |
---|
10 | if (isset($_POST['killmail'])) |
---|
11 | { |
---|
12 | if ($_POST['password'] == config::get('post_mailto')) |
---|
13 | { |
---|
14 | $parser = new Parser($_POST['killmail']); |
---|
15 | |
---|
16 | $killid = $parser->parse(true); |
---|
17 | |
---|
18 | if ($killid == 0 || $killid == -1 || $killid == -2 || $killid == -3) |
---|
19 | { |
---|
20 | if ($killid == 0) |
---|
21 | { |
---|
22 | $html = "Killmail is malformed."; |
---|
23 | } |
---|
24 | elseif ($killid == -1) |
---|
25 | { |
---|
26 | $html = "That killmail has already been posted."; |
---|
27 | } |
---|
28 | elseif ($killid == -2) |
---|
29 | { |
---|
30 | $html = "You are not authorized to post this killmail."; |
---|
31 | } |
---|
32 | elseif ($killid == -3) |
---|
33 | { |
---|
34 | $filterdate = kbdate("j F Y", config::get("filter_date")); |
---|
35 | $html = "You are not allowed to post killmails older than $filterdate."; |
---|
36 | } |
---|
37 | |
---|
38 | $html .= "<br><br><a href=\"?a=post_igb\">Try again</a>"; |
---|
39 | } |
---|
40 | else |
---|
41 | { |
---|
42 | if (config::get("post_mailto") != "") |
---|
43 | { |
---|
44 | $mailer = new PHPMailer(); |
---|
45 | $kill = new Kill($killid); |
---|
46 | |
---|
47 | $mailer->From = "mailer@".config::get('mail_host'); |
---|
48 | $mailer->FromName = config::get('mail_host'); |
---|
49 | $mailer->Subject = "Killmail #" . $killid; |
---|
50 | $mailer->Host = "localhost"; |
---|
51 | $mailer->Port = 25; |
---|
52 | $mailer->Helo = "localhost"; |
---|
53 | $mailer->Mailer = "smtp"; |
---|
54 | $mailer->AddReplyTo("no_reply@".config::get('mail_host'), "No-Reply"); |
---|
55 | $mailer->Sender = "mailer@".config::get('mail_host'); |
---|
56 | $mailer->Body = $kill->getRawMail(); |
---|
57 | $mailer->AddAddress(config::get('post_mailto')); |
---|
58 | $mailer->Send(); |
---|
59 | } |
---|
60 | |
---|
61 | $qry = new DBQuery(); |
---|
62 | $qry->execute("insert into kb3_log |
---|
63 | values( " . $killid . ", '" . KB_SITE . "', |
---|
64 | '" . $_SERVER['REMOTE_ADDR'] . "', |
---|
65 | now() )"); |
---|
66 | |
---|
67 | $html .= "Killmail posted successfully.<br><br>"; |
---|
68 | $html .= "<a href=\"?a=post_igb\">Post another killmail</a>"; |
---|
69 | } |
---|
70 | } |
---|
71 | else |
---|
72 | { |
---|
73 | $html .= "Invalid password."; |
---|
74 | $html .= "<br><br><a href=\"?a=post_igb\">Try again</a>"; |
---|
75 | } |
---|
76 | } |
---|
77 | elseif (!config::get('post_forbid')) |
---|
78 | { |
---|
79 | $html .= "Paste the killmail from your EVEMail inbox into the box below. Make sure you post the <b>ENTIRE</b> mail.<br>Posting fake or otherwise edited mails is not allowed. All posts are logged."; |
---|
80 | $html .= "<br><br>Remember to post your losses as well.<br><br>"; |
---|
81 | $html .= "<b>Killmail:</b><br>"; |
---|
82 | $html .= "<form name=postform method=\"post\" action=\"?a=post_igb\">"; |
---|
83 | $html .= "<textarea name=killmail id=killmail cols=\"70\" rows=\"24\"></textarea>"; |
---|
84 | $html .= "<br><br><b>Password:</b><br><input name=\"password\" type=\"password\">"; |
---|
85 | $html .= " <input id=submit name=\"submit\" type=\"submit\" value=\"Process !\">"; |
---|
86 | $html .= "</form>"; |
---|
87 | } |
---|
88 | else |
---|
89 | { |
---|
90 | $html .= 'Posting killmails is disabled<br/>'; |
---|
91 | } |
---|
92 | |
---|
93 | $html .= "</body></html>"; |
---|
94 | |
---|
95 | echo $html; |
---|
96 | ?> |
---|