root/dev/common/home.php @ 195

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