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 shipTypeID |
||
20 | if(!is_numeric($shipType)) |
||
21 | $shipTypeID = (int) Db::queryField("SELECT typeID FROM ccp_invTypes WHERE typeName = :typeName", "typeID", array(":typeName" => $shipType), 3600); |
||
22 | else // Verify it exists |
||
23 | $shipTypeID = (int) Db::queryField("SELECT typeID FROM ccp_invTypes WHERE typeID = :typeID", "typeID", array(":typeID" => (int) $shipType), 3600); |
||
24 | |||
25 | // If the shipTypeID we get from above is zero, don't even bother anymore..... |
||
26 | if($shipTypeID == 0) |
||
27 | $app->redirect("/"); |
||
28 | elseif(!is_numeric($shipType)) // if shipType isn't numeric, we redirect TO the shipTypeID! |
||
29 | $app->redirect("/ship/{$shipTypeID}/"); |
||
30 | |||
31 | // Now we figure out all the parameters |
||
32 | $parameters = Util::convertUriToParameters(); |
||
33 | |||
34 | // Unset the shipType => id, and make it shipTypeID => id |
||
35 | unset($parameters["shipType"]); |
||
36 | $parameters["shipTypeID"] = $shipTypeID; |
||
37 | $parameters["index"] = "shipTypeID_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::getShipDetails($shipTypeID, $parameters); |
||
0 ignored issues
–
show
The call to
Info::getShipDetails() has too many arguments starting with $parameters .
This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue. If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress. In this case you can add the ![]() |
|||
52 | |||
53 | // Define the page information and scope etc. |
||
54 | $pageName = isset($detail["shipTypeName"]) ? $detail["shipTypeName"] : "???"; |
||
55 | $columnName = "shipTypeID"; |
||
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, $shipTypeID); |
||
72 | |||
73 | $topLists = array(); |
||
74 | $topKills = array(); |
||
75 | if ($pageType == "top" || $pageType == "topalltime") { |
||
76 | $topParameters = $parameters; // array("limit" => 10, "kills" => true, "$columnName" => $shipTypeID); |
||
77 | $topParameters["limit"] = 10; |
||
78 | |||
79 | if ($pageType != "topalltime") { |
||
80 | if (!isset($topParameters["year"])) { |
||
81 | $topParameters["year"] = date("Y"); |
||
82 | } |
||
83 | |||
84 | if (!isset($topParameters["month"])) { |
||
85 | $topParameters["month"] = date("m"); |
||
86 | } |
||
87 | |||
88 | } |
||
89 | if (!array_key_exists("kills", $topParameters) && !array_key_exists("losses", $topParameters)) { |
||
90 | $topParameters["kills"] = true; |
||
91 | } |
||
92 | |||
93 | $topLists[] = array("type" => "character", "data" => Stats::getTopPilots($topParameters, true)); |
||
94 | $topLists[] = array("type" => "corporation", "data" => Stats::getTopCorps($topParameters, true)); |
||
95 | $topLists[] = array("type" => "alliance", "data" => Stats::getTopAllis($topParameters, true)); |
||
96 | $topLists[] = array("type" => "ship", "data" => Stats::getTopShips($topParameters, true)); |
||
97 | $topLists[] = array("type" => "system", "data" => Stats::getTopSystems($topParameters, true)); |
||
98 | $topLists[] = array("type" => "weapon", "data" => Stats::getTopWeapons($topParameters, true)); |
||
99 | } |
||
100 | else |
||
101 | { |
||
102 | $p = $parameters; |
||
103 | $numDays = 7; |
||
104 | $p["limit"] = 10; |
||
105 | $p["pastSeconds"] = $numDays * 86400; |
||
106 | $p["kills"] = $pageType != "losses"; |
||
107 | |||
108 | $topLists[] = Info::doMakeCommon("Top Characters", "characterID", Stats::getTopPilots($p)); |
||
109 | $topLists[] = Info::doMakeCommon("Top Corporations", "corporationID", Stats::getTopCorps($p)); |
||
110 | $topLists[] = Info::doMakeCommon("Top Systems", "solarSystemID", Stats::getTopSystems($p)); |
||
111 | |||
112 | $p["limit"] = 5; |
||
113 | $topKills = Stats::getTopIsk($p); |
||
114 | } |
||
115 | |||
116 | // Fix the history data! |
||
117 | $detail["history"] = $pageType == "stats" ? Summary::getMonthlyHistory($columnName, $shipTypeID) : array(); |
||
118 | |||
119 | // Stats |
||
120 | $cnt = 0; |
||
121 | $cnid = 0; |
||
122 | $stats = array(); |
||
123 | $totalcount = ceil(count($detail["stats"]) / 4); |
||
124 | foreach ($detail["stats"] as $q) { |
||
125 | if ($cnt == $totalcount) { |
||
126 | $cnid++; |
||
127 | $cnt = 0; |
||
128 | } |
||
129 | $stats[$cnid][] = $q; |
||
130 | $cnt++; |
||
131 | } |
||
132 | |||
133 | // Mixed kills yo! |
||
134 | if ($mixedKills) |
||
135 | $kills = Kills::mergeKillArrays($mixed, array(), $limit, $columnName, $shipTypeID); |
||
136 | |||
137 | // Find the next and previous shipTypeID |
||
138 | $prevID = Db::queryField("select typeID from ccp_invTypes where typeID < :id order by typeID desc limit 1", "typeID", array(":id" => $shipTypeID), 300); |
||
139 | $nextID = Db::queryField("select typeID from ccp_invTypes where typeID > :id order by typeID asc limit 1", "typeID", array(":id" => $shipTypeID), 300); |
||
140 | |||
141 | $renderParams = array( |
||
142 | "pageName" => $pageName, |
||
143 | "kills" => $kills, |
||
144 | "losses" => $losses, |
||
145 | "detail" => $detail, |
||
146 | "page" => $page, |
||
147 | "topKills" => $topKills, |
||
148 | "mixed" => $mixedKills, |
||
149 | "key" => "ship", |
||
150 | "id" => $shipTypeID, |
||
151 | "pageType" => $pageType, |
||
152 | // "solo" => $solo, |
||
153 | "topLists" => $topLists, |
||
154 | "summaryTable" => $stats, |
||
155 | "pager" => (sizeof($kills) + sizeof($losses) >= $limit), |
||
156 | "datepicker" => true, |
||
157 | "prevID" => $prevID, |
||
158 | "nextID" => $nextID |
||
159 | ); |
||
160 | |||
161 | $app->etag(md5(serialize($renderParams))); |
||
162 | $app->expires("+5 minutes"); |
||
163 | $app->render("overview.html", $renderParams); |
||
164 |
If you suppress an error, we recommend checking for the error condition explicitly: