1 | <?php |
---|
2 | @set_time_limit(0); |
---|
3 | |
---|
4 | // liq's feed syndication mod v1.0 |
---|
5 | require_once("class.corp.php"); |
---|
6 | require_once("class.alliance.php"); |
---|
7 | require_once("class.killlist.php"); |
---|
8 | require_once("class.kill.php"); |
---|
9 | require_once("db.php"); |
---|
10 | require_once("globals.php"); |
---|
11 | |
---|
12 | class 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&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 | |
---|
59 | if ($_GET['week']) |
---|
60 | { |
---|
61 | $klist->setWeek($_GET['week']); |
---|
62 | } |
---|
63 | elseif (!$_GET['lastkllid']) |
---|
64 | { |
---|
65 | $klist->setWeek(date("W")); |
---|
66 | } |
---|
67 | if ($_GET['lastkllid']) |
---|
68 | { |
---|
69 | if (method_exists($klist, 'setMinKllID')) |
---|
70 | { |
---|
71 | $klist->setMinKllID($_GET['lastkllid']); |
---|
72 | } |
---|
73 | } |
---|
74 | |
---|
75 | if ($_GET['corp_name']) |
---|
76 | { |
---|
77 | $corp = new Corporation(); |
---|
78 | $corp->lookup($_GET['corp_name']); |
---|
79 | $klist->addInvolvedCorp($corp); |
---|
80 | } |
---|
81 | elseif ($_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 | |
---|
95 | echo $html; |
---|
96 | ?> |
---|