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 | $page = new Page("Post killmail"); |
---|
9 | $kb = new Killboard(KB_SITE); |
---|
10 | |
---|
11 | $config = $kb->getConfig(); |
---|
12 | if (isset($_POST['killmail'])) |
---|
13 | { |
---|
14 | if ($_POST['password'] == $config->getPostPassword() || $page->isAdmin()) |
---|
15 | { |
---|
16 | $parser = new Parser($_POST['killmail']); |
---|
17 | |
---|
18 | $killid = $parser->parse(true); |
---|
19 | |
---|
20 | if ($killid == 0 || $killid == -1 || $killid == -2) |
---|
21 | { |
---|
22 | if ($killid == 0) |
---|
23 | $html = "Killmail is malformed."; |
---|
24 | if ($killid == -1) |
---|
25 | { |
---|
26 | $html = "That killmail has already been posted <a href=\"?a=kill_detail&kll_id=" . $parser->dupeid_ . "\">here</a>."; |
---|
27 | } |
---|
28 | if ($killid == -2) |
---|
29 | $html = "You are not authorized to post this killmail."; |
---|
30 | } |
---|
31 | else |
---|
32 | { |
---|
33 | if ($config->getPostMailto() != "") |
---|
34 | { |
---|
35 | $mailer = new PHPMailer(); |
---|
36 | $kill = new Kill($killid); |
---|
37 | |
---|
38 | $mailer->From = "mailer@eve-killboard.net"; |
---|
39 | $mailer->FromName = "eve-killboard.net"; |
---|
40 | $mailer->Subject = "Killmail #" . $killid; |
---|
41 | $mailer->Host = "localhost"; |
---|
42 | $mailer->Port = 25; |
---|
43 | $mailer->Helo = "localhost"; |
---|
44 | $mailer->Mailer = "smtp"; |
---|
45 | $mailer->AddReplyTo("no_reply@eve-killboard.net", "No-Reply"); |
---|
46 | $mailer->Sender = "mailer@eve-killboard.net"; |
---|
47 | $mailer->Body = $kill->getRawMail(); |
---|
48 | $mailer->AddAddress($config->getPostMailto()); |
---|
49 | $mailer->Send(); |
---|
50 | } |
---|
51 | |
---|
52 | $qry = new DBQuery(); |
---|
53 | $qry->execute("insert into kb3_log |
---|
54 | values( " . $killid . ", '" . KB_SITE . "', |
---|
55 | '" . $_SERVER['REMOTE_ADDR'] . "', |
---|
56 | now() )"); |
---|
57 | |
---|
58 | header("Location: ?a=kill_detail&kll_id=" . $killid); |
---|
59 | exit; |
---|
60 | } |
---|
61 | } |
---|
62 | else |
---|
63 | { |
---|
64 | $html = "Invalid password."; |
---|
65 | } |
---|
66 | } |
---|
67 | else |
---|
68 | { |
---|
69 | $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."; |
---|
70 | $html .= "<br><br>Remember to post your losses as well.<br><br>"; |
---|
71 | $html .= "<b>Killmail:</b><br>"; |
---|
72 | $html .= "<form id=postform name=postform class=f_killmail method=post action=\"?a=post\">"; |
---|
73 | $html .= "<textarea name=killmail id=killmail class=f_killmail cols=\"70\" rows=\"24\"></textarea>"; |
---|
74 | if (!$page->isAdmin()) |
---|
75 | { |
---|
76 | $html .= "<br><br><b>Password:</b><br><input id=password name=password type=password></input>"; |
---|
77 | } |
---|
78 | $html .= " <input id=submit name=submit type=submit value=\"Process !\"></input>"; |
---|
79 | $html .= "</form>"; |
---|
80 | } |
---|
81 | |
---|
82 | $page->setContent($html); |
---|
83 | $page->generate(); |
---|
84 | ?> |
---|