This project does not seem to handle request data directly as such no vulnerable execution paths were found.
include
, or for example
via PHP's auto-loading mechanism.
These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | /* zKillboard |
||
3 | * Copyright (C) 2012-2015 EVE-KILL Team and EVSCO. |
||
4 | * |
||
5 | * This program is free software: you can redistribute it and/or modify |
||
6 | * it under the terms of the GNU Affero General Public License as published by |
||
7 | * the Free Software Foundation, either version 3 of the License, or |
||
8 | * (at your option) any later version. |
||
9 | * |
||
10 | * This program is distributed in the hope that it will be useful, |
||
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
||
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||
13 | * GNU Affero General Public License for more details. |
||
14 | * |
||
15 | * You should have received a copy of the GNU Affero General Public License |
||
16 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
||
17 | */ |
||
18 | |||
19 | // Find the factionID |
||
20 | if(!is_numeric($faction)) |
||
21 | $factionID = (int) Db::queryField("SELECT factionID FROM ccp_zfactions WHERE name = :name", "factionID", array(":name" => $faction), 3600); |
||
22 | else // Verify it exists |
||
23 | $factionID = (int) Db::queryField("SELECT factionID FROM ccp_zfactions WHERE factionID = :factionID", "factionID", array(":factionID" => (int) $faction), 3600); |
||
24 | |||
25 | // If the factionID we get from above is zero, don't even bother anymore..... |
||
26 | if($factionID == 0) |
||
27 | $app->redirect("/"); |
||
28 | elseif(!is_numeric($faction)) // if faction isn't numeric, we redirect TO the factionID! |
||
29 | $app->redirect("/faction/{$factionID}/"); |
||
30 | |||
31 | // Now we figure out all the parameters |
||
32 | $parameters = Util::convertUriToParameters(); |
||
33 | |||
34 | // Unset the faction => id, and make it factionID => id |
||
35 | unset($parameters["faction"]); |
||
36 | $parameters["factionID"] = $factionID; |
||
37 | $parameters["index"] = "factionID_dttm"; |
||
38 | |||
39 | // Make sure that the pageType is correct.. |
||
40 | $subPageTypes = array("page", "groupID", "month", "year", "shipTypeID"); |
||
41 | if(in_array($pageType, $subPageTypes)) |
||
42 | $pageType = "overview"; |
||
43 | |||
44 | // Some defaults |
||
45 | @$page = max(1, $parameters["page"]); |
||
0 ignored issues
–
show
|
|||
46 | $limit = 50; |
||
47 | $parameters["limit"] = $limit; |
||
48 | $parameters["page"] = $page; |
||
49 | |||
50 | // and now we fetch the info! |
||
51 | $detail = Info::getFactionDetails($factionID, $parameters); |
||
52 | |||
53 | // Define the page information and scope etc. |
||
54 | $pageName = isset($detail["factionName"]) ? $detail["factionName"] : "???"; |
||
55 | $columnName = "factionID"; |
||
56 | $mixedKills = $pageType == "overview" && UserConfig::get("mixKillsWithLosses", true); |
||
57 | |||
58 | // Load kills for the various pages. |
||
59 | $mixed = $pageType == "overview" ? Kills::getKills($parameters) : array(); |
||
60 | $kills = $pageType == "kills" ? Kills::getKills($parameters) : array(); |
||
61 | $losses = $pageType == "losses" ? Kills::getKills($parameters) : array(); |
||
62 | |||
63 | // Solo parameters |
||
64 | //$soloParams = $parameters; |
||
65 | //if (!isset($parameters["kills"]) || !isset($parameters["losses"])) { |
||
66 | // $soloParams["mixed"] = true; |
||
67 | //} |
||
68 | |||
69 | // Solo kills |
||
70 | //$soloKills = Kills::getKills($soloParams); |
||
71 | //$solo = Kills::mergeKillArrays($soloKills, array(), $limit, $columnName, $factionID); |
||
72 | |||
73 | |||
74 | $topLists = array(); |
||
75 | $topKills = array(); |
||
76 | if ($pageType == "top)") { |
||
77 | $topParameters = $parameters; // array("limit" => 10, "kills" => true, "$columnName" => $factionID); |
||
78 | $topParameters["limit"] = 10; |
||
79 | |||
80 | if ($pageType != "topalltime") { |
||
81 | if (!isset($topParameters["year"])) { |
||
82 | $topParameters["year"] = date("Y"); |
||
83 | } |
||
84 | |||
85 | if (!isset($topParameters["month"])) { |
||
86 | $topParameters["month"] = date("m"); |
||
87 | } |
||
88 | |||
89 | } |
||
90 | if (!array_key_exists("kills", $topParameters) && !array_key_exists("losses", $topParameters)) { |
||
91 | $topParameters["kills"] = true; |
||
92 | } |
||
93 | |||
94 | $topLists[] = array("type" => "character", "data" => Stats::getTopPilots($topParameters, true)); |
||
95 | $topLists[] = array("type" => "corporation", "data" => Stats::getTopCorps($topParameters, true)); |
||
96 | $topLists[] = array("type" => "alliance", "data" => Stats::getTopAllis($topParameters, true)); |
||
97 | $topLists[] = array("type" => "ship", "data" => Stats::getTopShips($topParameters, true)); |
||
98 | $topLists[] = array("type" => "system", "data" => Stats::getTopSystems($topParameters, true)); |
||
99 | $topLists[] = array("type" => "weapon", "data" => Stats::getTopWeapons($topParameters, true)); |
||
100 | $topLists[] = array("name" => "Top Faction Characters", "type" => "character", "data" => Stats::getTopPilots($topParameters, true)); |
||
101 | $topLists[] = array("name" => "Top Faction Corporations", "type" => "corporation", "data" => Stats::getTopCorps($topParameters, true)); |
||
102 | $topLists[] = array("name" => "Top Faction Alliances", "type" => "alliance", "data" => Stats::getTopAllis($topParameters, true)); |
||
103 | } |
||
104 | else |
||
105 | { |
||
106 | $p = $parameters; |
||
107 | $numDays = 7; |
||
108 | $p["limit"] = 10; |
||
109 | $p["pastSeconds"] = $numDays * 86400; |
||
110 | $p["kills"] = $pageType != "losses"; |
||
111 | |||
112 | $topLists[] = Info::doMakeCommon("Top Characters", "characterID", Stats::getTopPilots($p)); |
||
113 | $topLists[] = Info::doMakeCommon("Top Corporations", "corporationID", Stats::getTopCorps($p)); |
||
114 | $topLists[] = Info::doMakeCommon("Top Alliances", "allianceID", Stats::getTopAllis($p)); |
||
115 | $topLists[] = Info::doMakeCommon("Top Ships", "shipTypeID", Stats::getTopShips($p)); |
||
116 | $topLists[] = Info::doMakeCommon("Top Systems", "solarSystemID", Stats::getTopSystems($p)); |
||
117 | |||
118 | $p["limit"] = 5; |
||
119 | $topKills = Stats::getTopIsk($p); |
||
120 | } |
||
121 | |||
122 | // Stats |
||
123 | $cnt = 0; |
||
124 | $cnid = 0; |
||
125 | $stats = array(); |
||
126 | $totalcount = ceil(count($detail["stats"]) / 4); |
||
127 | foreach ($detail["stats"] as $q) { |
||
128 | if ($cnt == $totalcount) { |
||
129 | $cnid++; |
||
130 | $cnt = 0; |
||
131 | } |
||
132 | $stats[$cnid][] = $q; |
||
133 | $cnt++; |
||
134 | } |
||
135 | // Fix the history data! |
||
136 | $detail["history"] = $pageType == "stats" ? Summary::getMonthlyHistory($columnName, $factionID) : array(); |
||
137 | |||
138 | // Mixed kills yo! |
||
139 | if ($mixedKills) |
||
140 | $kills = Kills::mergeKillArrays($mixed, array(), $limit, $columnName, $factionID); |
||
141 | |||
142 | // Find the next and previous factionID |
||
143 | $prevID = Db::queryField("select factionID from zz_factions where factionID < :id order by factionID desc limit 1", "factionID", array(":id" => $factionID), 300); |
||
144 | $nextID = Db::queryField("select factionID from zz_factions where factionID > :id order by factionID asc limit 1", "factionID", array(":id" => $factionID), 300); |
||
145 | |||
146 | /*$extra["supers"] = array(); |
||
147 | if ($pageType == "supers") |
||
148 | { |
||
149 | $minKillID = Db::queryField("select min(killID) killID from zz_participants where dttm >= date_sub(now(), interval 90 day) and dttm < date_sub(now(), interval 89 day)", "killID", array(), 900); |
||
150 | $months = 3; |
||
151 | $data = array(); |
||
152 | $data["titans"]["data"] = Db::query("SELECT distinct characterID, count(distinct killID) kills, shipTypeID FROM zz_participants WHERE killID >= $minKillID AND isVictim = 0 AND groupID = 30 AND factionID = :id GROUP BY characterID ORDER BY 2 DESC", array(":id" => $factionID), 900); |
||
153 | $data["titans"]["title"] = "Titans"; |
||
154 | |||
155 | $data["moms"]["data"] = Db::query("SELECT distinct characterID, count(distinct killID) kills, shipTypeID FROM zz_participants WHERE killID >= $minKillID AND isVictim = 0 AND groupID = 659 AND factionID = :id GROUP BY characterID ORDER BY 2 DESC", array(":id" => $factionID), 900); |
||
156 | $data["moms"]["title"] = "Supercarriers"; |
||
157 | |||
158 | Info::addInfo($data); |
||
159 | $extra["supers"] = $data; |
||
160 | }*/ |
||
161 | |||
162 | $renderParams = array( |
||
163 | "pageName" => $pageName, |
||
164 | "kills" => $kills, |
||
165 | "losses" => $losses, |
||
166 | "detail" => $detail, |
||
167 | "page" => $page, |
||
168 | "topKills" => $topKills, |
||
169 | "mixed" => $mixedKills, |
||
170 | "key" => "faction", |
||
171 | "id" => $factionID, |
||
172 | "pageType" => $pageType, |
||
173 | //"solo" => $solo, |
||
174 | "topLists" => $topLists, |
||
175 | "summaryTable" => $stats, |
||
176 | "pager" => (sizeof($kills) + sizeof($losses) >= $limit), |
||
177 | "datepicker" => true, |
||
178 | "prevID" => $prevID, |
||
179 | "nextID" => $nextID, |
||
180 | //"extra" => $extra |
||
181 | ); |
||
182 | |||
183 | $app->etag(md5(serialize($renderParams))); |
||
184 | $app->expires("+5 minutes"); |
||
185 | $app->render("overview.html", $renderParams); |
||
186 |
If you suppress an error, we recommend checking for the error condition explicitly: