root/dev/common/feed.php @ 190

Revision 190, 3.1 KB (checked in by exi, 15 years ago)

This is a big update...
Moved all admin scripts to common/admin.
Moved all includes and classes to common/includes.
Edited all include-paths to reflect the movement.
Fixed a bug with the session system allowing every registered user to access admin pages.
Replaced calls to date() to use a wrapper so gmdate can be used.
Replaced some calls to $config with calls to the static object.
Fixed a big which caused the portrait_grab to not download a new picute.
Added a classified-state to kills.
Removed the sync_server server script in this tree.
Added code to help modules find the includes to index.php.

Line 
1<?php
2////////////
3//////
4//////  feed writer after
5//////  liq's feed syndication mod v1.5
6//////
7////////////
8
9@set_time_limit(120);
10require_once('common/includes/db.php');
11require_once('common/includes/class.corp.php');
12require_once('common/includes/class.alliance.php');
13require_once('common/includes/class.killlist.php');
14require_once('common/includes/class.kill.php');
15
16$html .= '<rss version="2.0">
17        <channel>
18        <title>'.KB_TITLE.'</title>
19        <link>http://'.KB_HOST.'</link>
20        <description>Kill Feed v1.5</description>
21        <copyright>'.KB_TITLE.'</copyright>'."\n";
22
23$klist = new KillList();
24$klist->setPodsNoobShips(true);
25
26if ($_GET['week'])
27{
28    $klist->setWeek($_GET['week']);
29}
30elseif (!$_GET['lastkllid'])
31{
32    $klist->setWeek(kbdate("W"));
33}
34
35if ($_GET['year'])
36{
37    $klist->setYear($_GET['year']);
38}
39elseif (!$_GET['lastkllid'])
40{
41    $klist->setYear(kbdate("Y"));
42}
43
44if ($_GET['lastkllid'] && method_exists($klist, 'setMinKllID'))
45{
46    $klist->setMinKllID($_GET['lastkllid']);
47}
48
49if ($_GET['corp'] || $_GET['corp_name'])
50{
51    if ($_GET['corp'])
52    {
53        $c = $_GET['corp'];
54    }
55    if ($_GET['corp_name'])
56    {
57        $c = $_GET['corp_name'];
58    }
59    $corp = new Corporation();
60    $corp->lookup(urldecode($c));
61}
62
63if ($_GET['alli'] || $_GET['alliance_name'])
64{
65    if ($_GET['alli'])
66    {
67        $a = $_GET['alli'];
68    }
69    if ($_GET['alliance_name'])
70    {
71        $a = $_GET['alliance_name'];
72    }
73    $alli = new Alliance();
74    $alli->add(urldecode($a));
75}
76
77if ($_GET['losses'])
78{
79    if (CORP_ID) // local
80    {
81            $klist->addVictimCorp(new Corporation(CORP_ID));
82    }
83    if (ALLIANCE_ID) // local
84    {
85            $klist->addVictimAlliance(new Alliance(ALLIANCE_ID));
86    }
87    if ($corp && !$_GET['friend']) // remote
88    {
89            $klist->addInvolvedCorp($corp);
90    }
91    if ($alli && !$_GET['friend']) // remote
92    {
93            $klist->addInvolvedAlliance($alli);
94    }
95}
96else
97{
98    if (CORP_ID) // local
99    {
100            $klist->addInvolvedCorp(new Corporation(CORP_ID));
101    }
102    if (ALLIANCE_ID) // local
103    {
104            $klist->addInvolvedAlliance(new Alliance(ALLIANCE_ID));
105    }
106    if ($corp && !$_GET['friend']) // remote
107    {
108            $klist->addVictimCorp($corp);
109    }
110    if ($alli && !$_GET['friend']) // remote
111    {
112            $klist->addVictimAlliance($alli);
113    }
114}
115
116$kills = array();
117while ($kill = $klist->getKill())
118{
119    if ($kill->isClassified())
120    {
121        continue;
122    }
123
124    $kills[$kill->getID()] = $kill->getTimestamp();
125}
126asort($kills);
127
128foreach ($kills as $id => $timestamp)
129{
130    $kill = new Kill($id);
131    $html .= "<item>
132                                <title>" . $id . "</title>
133                                <description><![CDATA[ ".$kill->getRawMail()." ]]></description>
134                                <guid>?a=kill_detail&amp;kll_id=".$id."</guid>
135                                <pubDate>" . strftime("%a, %d %b %Y %T %Z", strtotime($timestamp)) . "</pubDate>
136                                </item>\n";
137}
138$html .= "</channel></rss>";
139
140if ($_GET['gz'])
141{
142    echo gzdeflate($html, 9);
143}
144else
145{
146    echo $html;
147}
148?>
Note: See TracBrowser for help on using the browser.