root/dev/common/feed.php @ 151

Revision 151, 2.0 KB (checked in by exi, 15 years ago)

Rejecting changes to 1.2.1 tag, see svn guidelines for detail.
Reject change to dev/common/feed.php, new core file does not comply to coding guidelines.

Line 
1<?php
2@set_time_limit(0);
3
4// based on liq's feed syndication
5require_once("class.corp.php");
6require_once("class.alliance.php");
7require_once("class.killlist.php");
8require_once("class.kill.php");
9require_once("db.php");
10require_once("globals.php");
11
12$html .= "
13<rss version=\"2.0\">
14<channel>
15<title>".KB_TITLE."</title>
16<description>Kill Feed</description>
17<link>".KB_HOST."</link>
18<copyright>".KB_TITLE."</copyright>\n";
19
20$klist = new KillList();
21$klist->setPodsNoobShips(true);
22
23if ($_GET['week'])
24{
25    $klist->setWeek($_GET['week']);
26}
27elseif (!$_GET['lastkllid'])
28{
29    $klist->setWeek(date("W"));
30}
31if ($_GET['lastkllid'])
32{
33    if (method_exists($klist, 'setMinKllID'))
34    {
35        $klist->setMinKllID($_GET['lastkllid']);
36    }
37}
38
39if ($_GET['corp'])
40{
41    $_GET['corp_name'] = $_GET['corp'];
42}
43elseif ($_GET['alli'])
44{
45    $_GET['alliance_name'] = $_GET['corp'];
46}
47if ($_GET['corp_name'])
48{
49    $corp = new Corporation();
50    $corp->lookup($_GET['corp_name']);
51    if ($_GET['losses'])
52    {
53        $klist->addVictimCorp($corp);
54    }
55    else
56    {
57        $klist->addInvolvedCorp($corp);
58    }
59}
60elseif ($_GET['alliance_name'])
61{
62    $ally = new Alliance();
63    $ally->add($_GET['alliance_name']);
64    if ($_GET['losses'])
65    {
66        $klist->addVictimAlliance($ally);
67    }
68    else
69    {
70        $klist->addInvolvedAlliance($ally);
71    }
72}
73
74$kills = array();
75while ($kill = $klist->getKill())
76{
77    $kills[$kill->getID()] = $kill->getTimestamp();
78}
79asort($kills);
80
81foreach ($kills as $id => $timestamp)
82{
83        $kill = new Kill($id);
84    $html .= "<item>
85        <title>".$id."</title>
86        <description> <![CDATA[ ".$kill->getRawMail()." ]]>     </description>
87        <guid>?a=kill_detail&amp;kll_id=".$id."</guid>
88    <pubDate>".strftime("%a, %d %b %Y %T %Z" , strtotime($timestamp))."</pubDate>
89        </item>\n";
90}
91$html .= "
92</channel>
93</rss>";
94
95if ($_GET['compress'] == '1')
96{
97    echo gzdeflate($html);
98}
99else
100{
101    echo $html;
102}
103?>
Note: See TracBrowser for help on using the browser.