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