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 | //Filtering |
---|
19 | if($config->getConfig("filter_apply") == "1"){ |
---|
20 | $filterdate = $config->getConfig("filter_date"); |
---|
21 | $year = substr($_POST['killmail'],0,4); |
---|
22 | $month = substr($_POST['killmail'],5,2); |
---|
23 | $day = substr($_POST['killmail'],8,2); |
---|
24 | $killstamp = mktime(0,0,0,$month,$day,$year); |
---|
25 | if($killstamp < $filterdate){ |
---|
26 | $killid = -3; |
---|
27 | }else{ |
---|
28 | $killid = $parser->parse(true); |
---|
29 | } |
---|
30 | }else{ |
---|
31 | $killid = $parser->parse(true); |
---|
32 | } |
---|
33 | |
---|
34 | if ($killid == 0 || $killid == -1 || $killid == -2 || $killid == -3) |
---|
35 | { |
---|
36 | if ($killid == 0) |
---|
37 | $html = "Killmail is malformed."; |
---|
38 | if ($killid == -1) |
---|
39 | { |
---|
40 | $html = "That killmail has already been posted <a href=\"?a=kill_detail&kll_id=" . $parser->dupeid_ . "\">here</a>."; |
---|
41 | } |
---|
42 | if ($killid == -2) |
---|
43 | $html = "You are not authorized to post this killmail."; |
---|
44 | |
---|
45 | if ($killid == -3){ |
---|
46 | $filterdate = date("j F Y",$config->getConfig("filter_date")); |
---|
47 | $html = "You are not allowed to post killmails older than $filterdate."; |
---|
48 | } |
---|
49 | } |
---|
50 | else |
---|
51 | { |
---|
52 | if ($config->getPostMailto() != "") |
---|
53 | { |
---|
54 | $mailer = new PHPMailer(); |
---|
55 | $kill = new Kill($killid); |
---|
56 | |
---|
57 | $mailer->From = "mailer@eve-killboard.net"; |
---|
58 | $mailer->FromName = "eve-killboard.net"; |
---|
59 | $mailer->Subject = "Killmail #" . $killid; |
---|
60 | $mailer->Host = "localhost"; |
---|
61 | $mailer->Port = 25; |
---|
62 | $mailer->Helo = "localhost"; |
---|
63 | $mailer->Mailer = "smtp"; |
---|
64 | $mailer->AddReplyTo("no_reply@eve-killboard.net", "No-Reply"); |
---|
65 | $mailer->Sender = "mailer@eve-killboard.net"; |
---|
66 | $mailer->Body = $kill->getRawMail(); |
---|
67 | $mailer->AddAddress($config->getPostMailto()); |
---|
68 | $mailer->Send(); |
---|
69 | } |
---|
70 | |
---|
71 | $qry = new DBQuery(); |
---|
72 | $qry->execute("insert into kb3_log |
---|
73 | values( " . $killid . ", '" . KB_SITE . "', |
---|
74 | '" . $_SERVER['REMOTE_ADDR'] . "', |
---|
75 | now() )"); |
---|
76 | |
---|
77 | header("Location: ?a=kill_detail&kll_id=" . $killid); |
---|
78 | exit; |
---|
79 | } |
---|
80 | } |
---|
81 | else |
---|
82 | { |
---|
83 | $html = "Invalid password."; |
---|
84 | } |
---|
85 | } |
---|
86 | else |
---|
87 | { |
---|
88 | $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."; |
---|
89 | $html .= "<br><br>Remember to post your losses as well.<br><br>"; |
---|
90 | $html .= "<b>Killmail:</b><br>"; |
---|
91 | $html .= "<form id=postform name=postform class=f_killmail method=post action=\"?a=post\">"; |
---|
92 | $html .= "<textarea name=killmail id=killmail class=f_killmail cols=\"70\" rows=\"24\"></textarea>"; |
---|
93 | if (!$page->isAdmin()) |
---|
94 | { |
---|
95 | $html .= "<br><br><b>Password:</b><br><input id=password name=password type=password></input>"; |
---|
96 | } |
---|
97 | $html .= " <input id=submit name=submit type=submit value=\"Process !\"></input>"; |
---|
98 | $html .= "</form>"; |
---|
99 | } |
---|
100 | |
---|
101 | $page->setContent($html); |
---|
102 | $page->generate(); |
---|
103 | ?> |
---|