root/dev/common/home.php @ 368

Revision 368, 3.3 KB (checked in by exi, 14 years ago)

Fixed the pre PHP 5.1.0 issue with the current year, it will run on php4 again but stil has the week 52/1 issue (kindof).
Removed debug content from globals.php.

Line 
1<?php
2require_once('common/includes/class.killsummarytable.public.php');
3require_once('common/includes/class.corp.php');
4require_once('common/includes/class.alliance.php');
5require_once('common/includes/class.killlist.php');
6require_once('common/includes/class.killlisttable.php');
7require_once('common/includes/class.contract.php');
8require_once('common/includes/class.toplist.php');
9
10$week = kbdate('W');
11$year = getYear();
12
13$page = new Page('Week '.$week);
14
15$kslist = new KillList();
16involved::load($kslist,'kill');
17$kslist->setWeek($week);
18$kslist->setYear($year);
19
20if (config::get('summarytable')){
21if (config::get('public_summarytable')){
22        $summarytable = new KillSummaryTablePublic($kslist);
23}
24else
25{
26        $llist = new KillList();
27        involved::load($llist,'loss');
28        $llist->setWeek($week);
29        $llist->setYear($year);
30        $summarytable = new KillSummaryTable($kslist, $llist);
31}
32$summarytable->setBreak(config::get('summarytable_rowcount'));
33$html .= $summarytable->generate();
34}
35
36if ($week == 1)
37{
38    $pyear = $year - 1;
39    $pweek = 52;
40}
41else
42{
43    $pyear = $year;
44    $pweek = $week - 1;
45}
46
47if ($page->killboard_->hasCampaigns(true))
48{
49    $html .= "<div class=kb-campaigns-header>Active campaigns</div>";
50    $list = new ContractList();
51    $list->setActive("yes");
52    $list->setCampaigns(true);
53    $table = new ContractListTable($list);
54    $html .= $table->generate();
55}
56
57if ($page->killboard_->hasContracts(true))
58{
59    $html .= "<div class=kb-campaigns-header>Active contracts</div>";
60    $list = new ContractList();
61    $list->setActive("yes");
62    $list->setCampaigns(false);
63    $table = new ContractListTable($list);
64    $html .= $table->generate();
65}
66
67// bad hax0ring, we really need mod callback stuff
68if (strpos(config::get('mods_active'), 'rss_feed') !== false)
69{
70    $html .= "<div class=kb-kills-header><a href=\"?a=rss\"><img src=\"mods/rss_feed/rss_icon.png\" alt=\"RSS-Feed\" border=\"0\"></a>&nbsp;20 most recent kills</div>";
71}
72else
73{
74    $html .= "<div class=kb-kills-header>20 most recent kills</div>";
75}
76
77$klist = new KillList();
78$klist->setOrdered(true);
79involved::load($klist,'kill');
80
81
82// boards with low killcount could not display 20 kills with those limits
83//$klist->setStartWeek($week - 1);
84//$klist->setYear($year);
85$klist->setLimit(config::get('killcount'));
86
87if ($_GET['scl_id'])
88    $klist->addVictimShipClass(new ShipClass($_GET['scl_id']));
89else
90    $klist->setPodsNoobShips(false);
91
92$table = new KillListTable($klist);
93$table->setLimit(config::get('killcount'));
94$html .= $table->generate();
95
96$page->setContent($html);
97$menubox = new box("Menu");
98$menubox->setIcon("menu-item.gif");
99$menubox->addOption("caption","Navigation");
100$menubox->addOption("link","Previous week", "?a=kills&w=" . $pweek . "&y=" . $pyear);
101$page->addContext($menubox->generate());
102
103$tklist = new TopKillsList();
104$tklist->setWeek($week);
105$tklist->setYear($year);
106involved::load($tklist,'kill');
107
108$tklist->generate();
109$tkbox = new AwardBox($tklist, "Top killers", "kills in week " . $week, "kills", "eagle");
110$page->addContext($tkbox->generate());
111
112if (config::get('kill_points'))
113{
114    $tklist = new TopScoreList();
115    $tklist->setWeek($week);
116    $tklist->setYear($year);
117    involved::load($tklist,'kill');
118
119    $tklist->generate();
120    $tkbox = new AwardBox($tklist, "Top scorers", "points in week " . $week, "points", "redcross");
121    $page->addContext($tkbox->generate());
122}
123
124$page->generate();
125?>
Note: See TracBrowser for help on using the browser.