root/1.2.1/common/feed.php @ 148

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

Reverted the changes in 1.2.1 tag, tags may not be changed.
Removed the admin menus for the syndication feeds as they don't meet the core-requirements and put them into a separate mod.
However, the modified feed engine itself remains core.

Line 
1<?php
2@set_time_limit(0);
3
4// liq's feed syndication mod v1.0
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
12class RSSTable
13{
14    function RSSTable($kill_list)
15    {
16        $this->limit = 0;
17        $this->offset = 0;
18        $this->kill_list_ = $kill_list;
19    }
20
21    function setLimit($limit)
22    {
23        $this->limit_ = $limit;
24    }
25
26    function generate()
27    {
28        $prevdate = "";
29        $this->kill_list_->rewind();
30
31        while ($kill = $this->kill_list_->getKill())
32        {
33            $rawkill = new Kill($kill->getID());
34
35            $html .= "
36                <item>
37                        <title>".$rawkill->getID()."</title>
38                <description> <![CDATA[ ".$rawkill->getRawMail()." ]]>  </description>
39                <guid>?a=kill_detail&amp;kll_id=".$kill->getID()."</guid>
40            <pubDate>".strftime("%a, %d %b %Y %T %Z" , strtotime($kill->getTimeStamp()))."</pubDate>
41                </item> ";
42        }
43        return $html;
44    }
45}
46
47$html .= "
48<rss version=\"2.0\">
49<channel>
50<title>".KB_TITLE."</title>
51<description>Kill Feed</description>
52<link>http://".KB_HOST."</link>
53<copyright>".KB_TITLE."</copyright>";
54
55$klist = new KillList();
56$klist->setOrdered(true);
57$klist->setPodsNoobShips(true);
58
59if ($_GET['week'])
60{
61    $klist->setWeek($_GET['week']);
62}
63elseif (!$_GET['lastkllid'])
64{
65    $klist->setWeek(date("W"));
66}
67if ($_GET['lastkllid'])
68{
69    if (method_exists($klist, 'setMinKllID'))
70    {
71        $klist->setMinKllID($_GET['lastkllid']);
72    }
73}
74
75if ($_GET['corp_name'])
76{
77    $corp = new Corporation();
78    $corp->lookup($_GET['corp_name']);
79    $klist->addInvolvedCorp($corp);
80}
81elseif ($_GET['alliance_name'])
82{
83    $ally = new Alliance();
84    $ally->add($_GET['alliance_name']);
85    $klist->addInvolvedAlliance($ally);
86}
87
88$table = new RSSTable($klist);
89
90$html .= $table->generate();
91$html .= "
92</channel>
93</rss>";
94
95echo $html;
96?>
Note: See TracBrowser for help on using the browser.