root/dev/common/post_igb.php

Revision 370, 3.5 KB (checked in by kovell, 12 years ago)

- SQL queries optimised for speed and error protection.
- feed syndication optimised
- front page includes optional clock and optional kill/loss display
- mysqli support added
- transaction protection of kills added where supported (mysqli and InnoDB)
- summary tables and contracts show total destroyed value instead of ship value
- html errors reduced
- related kill calculation improved
- query caching errors reduced
- minor bugfixes
- Smarty 2.6.25 added
- apoc fitting mod added and modded
- code optimisations
- code comments added (doxygen format)
- conflicting mods are now identified

Line 
1<?php
2require_once('common/includes/class.parser.php');
3require_once('common/includes/class.phpmailer.php');
4require_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
10if (isset($_POST['killmail']))
11{
12    if ($_POST['password'] == config::get('post_password'))
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(log_kll_id, log_site, log_ip_address, log_timestamp)
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}
77elseif (!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 .= "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input id=submit name=\"submit\" type=\"submit\" value=\"Process !\">";
86    $html .= "</form>";
87}
88else
89{
90    $html .= 'Posting killmails is disabled<br/>';
91}
92
93$html .= "</body></html>";
94
95echo $html;
96?>
Note: See TracBrowser for help on using the browser.