Issues (438)

Security Analysis    not enabled

This project does not seem to handle request data directly as such no vulnerable execution paths were found.

  Cross-Site Scripting
Cross-Site Scripting enables an attacker to inject code into the response of a web-request that is viewed by other users. It can for example be used to bypass access controls, or even to take over other users' accounts.
  File Exposure
File Exposure allows an attacker to gain access to local files that he should not be able to access. These files can for example include database credentials, or other configuration files.
  File Manipulation
File Manipulation enables an attacker to write custom data to files. This potentially leads to injection of arbitrary code on the server.
  Object Injection
Object Injection enables an attacker to inject an object into PHP code, and can lead to arbitrary code execution, file exposure, or file manipulation attacks.
  Code Injection
Code Injection enables an attacker to execute arbitrary code on the server.
  Response Splitting
Response Splitting can be used to send arbitrary responses.
  File Inclusion
File Inclusion enables an attacker to inject custom files into PHP's file loading mechanism, either explicitly passed to include, or for example via PHP's auto-loading mechanism.
  Command Injection
Command Injection enables an attacker to inject a shell command that is execute with the privileges of the web-server. This can be used to expose sensitive data, or gain access of your server.
  SQL Injection
SQL Injection enables an attacker to execute arbitrary SQL code on your database server gaining access to user data, or manipulating user data.
  XPath Injection
XPath Injection enables an attacker to modify the parts of XML document that are read. If that XML document is for example used for authentication, this can lead to further vulnerabilities similar to SQL Injection.
  LDAP Injection
LDAP Injection enables an attacker to inject LDAP statements potentially granting permission to run unauthorized queries, or modify content inside the LDAP tree.
  Header Injection
  Other Vulnerability
This category comprises other attack vectors such as manipulating the PHP runtime, loading custom extensions, freezing the runtime, or similar.
  Regex Injection
Regex Injection enables an attacker to execute arbitrary code in your PHP process.
  XML Injection
XML Injection enables an attacker to read files on your local filesystem including configuration files, or can be abused to freeze your web-server process.
  Variable Injection
Variable Injection enables an attacker to overwrite program variables with custom data, and can lead to further vulnerabilities.
Unfortunately, the security analysis is currently not available for your project. If you are a non-commercial open-source project, please contact support to gain access.

view/group.php (2 issues)

Upgrade to new PHP Analysis Engine

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 groupID (GroupID can only be numeric...)
20
$groupID = (int) Db::queryField("SELECT groupID FROM ccp_invTypes WHERE groupID = :groupID", "groupID", array(":groupID" => (int) $group), 3600);
21
22
// If the groupID we get from above is zero, don't even bother anymore.....
23
if($groupID == 0)
24
	$app->redirect("/");
25
26
// Now we figure out all the parameters
27
$parameters = Util::convertUriToParameters();
28
29
// Unset the group => id, and make it groupID => id
30
unset($parameters["group"]);
31
$parameters["groupID"] = $groupID;
32
$parameters["index"] = "vGroupID_dttm";
33
34
// Make sure that the pageType is correct..
35
$subPageTypes = array("page", "group", "month", "year", "ship");
36
if(in_array($pageType, $subPageTypes))
37
	$pageType = "overview";
38
39
// Some defaults
40
@$page = max(1, $parameters["page"]);
0 ignored issues
show
Security Best Practice introduced by
It seems like you do not handle an error condition here. This can introduce security issues, and is generally not recommended.

If you suppress an error, we recommend checking for the error condition explicitly:

// For example instead of
@mkdir($dir);

// Better use
if (@mkdir($dir) === false) {
    throw new \RuntimeException('The directory '.$dir.' could not be created.');
}
Loading history...
41
$limit = 50;
42
$parameters["limit"] = $limit;
43
$parameters["page"] = $page;
44
45
// and now we fetch the info!
46
$detail = Info::getGroupDetails($groupID, $parameters);
0 ignored issues
show
The call to Info::getGroupDetails() 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 @ignore PhpDoc annotation to the duplicate definition and it will be ignored.

Loading history...
47
48
// Define the page information and scope etc.
49
$pageName = isset($detail["groupName"]) ? $detail["groupName"] : "???";
50
$columnName = "groupID";
51
$mixedKills = $pageType == "overview" && UserConfig::get("mixKillsWithLosses", true);
52
53
// Load kills for the various pages.
54
$mixed = $pageType == "overview" ? Kills::getKills($parameters) : array();
55
$kills = $pageType ==  "kills" ? Kills::getKills($parameters) : array();
56
57
// Solo parameters
58
//$soloParams = $parameters;
59
//if (!isset($parameters["kills"])) {
60
//	$soloParams["mixed"] = true;
61
//}
62
63
// Solo kills
64
//$soloKills = Kills::getKills($soloParams);
65
//$solo = Kills::mergeKillArrays($soloKills, array(), $limit, $columnName, $groupID);
66
67
$topLists = array();
68
$topKills = array();
69
if ($pageType == "top" || $pageType == "topalltime") {
70
	$topParameters = $parameters; // array("limit" => 10, "kills" => true, "$columnName" => $groupID);
71
	$topParameters["limit"] = 10;
72
73
	if ($pageType != "topalltime") {
74
		if (!isset($topParameters["year"])) {
75
			$topParameters["year"] = date("Y");
76
		}
77
78
		if (!isset($topParameters["month"])) {
79
			$topParameters["month"] = date("m");
80
		}
81
82
	}
83
	if (!array_key_exists("kills", $topParameters) && !array_key_exists("losses", $topParameters)) {
84
		$topParameters["kills"] = true;
85
	}
86
87
	$topLists[] = array("type" => "character", "data" => Stats::getTopPilots($topParameters, true));
88
	$topLists[] = array("type" => "corporation", "data" => Stats::getTopCorps($topParameters, true));
89
	$topLists[] = array("type" => "alliance", "data" => Stats::getTopAllis($topParameters, true));
90
	$topLists[] = array("type" => "ship", "data" => Stats::getTopShips($topParameters, true));
91
	$topLists[] = array("type" => "system", "data" => Stats::getTopSystems($topParameters, true));
92
	$topLists[] = array("type" => "weapon", "data" => Stats::getTopWeapons($topParameters, true));
93
}
94
else
95
{
96
	$p = $parameters;
97
	$numDays = 7;
98
	$p["limit"] = 10;
99
	$p["pastSeconds"] = $numDays * 86400;
100
	$p["kills"] = $pageType != "losses";
101
102
	$topLists[] = Info::doMakeCommon("Top Characters", "characterID", Stats::getTopPilots($p));
103
	$topLists[] = Info::doMakeCommon("Top Corporations", "corporationID", Stats::getTopCorps($p));
104
	$topLists[] = Info::doMakeCommon("Top Systems", "solarSystemID", Stats::getTopSystems($p));
105
106
	$p["limit"] = 5;
107
	$topKills = Stats::getTopIsk($p);
108
}
109
110
// Mixed kills yo!
111
if ($mixedKills)
112
	$kills = Kills::mergeKillArrays($mixed, array(), $limit, $columnName, $groupID);
113
114
// Find the next and previous groupID
115
$prevID = Db::queryField("select groupID from ccp_invTypes where groupID < :id order by groupID desc limit 1", "groupID", array(":id" => $groupID), 300);
116
$nextID = Db::queryField("select groupID from ccp_invTypes where groupID > :id order by groupID asc limit 1", "groupID", array(":id" => $groupID), 300);
117
118
$renderParams = array(
119
	"pageName" => $pageName,
120
	"kills" => $kills,
121
	"detail" => $detail,
122
	"page" => $page,
123
	"topKills" => $topKills,
124
	"mixed" => $mixedKills,
125
	"key" => "group",
126
	"id" => $groupID,
127
	"pageType" => $pageType,
128
//	"solo" => $solo,
129
	"topLists" => $topLists,
130
	"pager" => (sizeof($kills) >= $limit),
131
	"datepicker" => true,
132
	"prevID" => $prevID,
133
	"nextID" => $nextID
134
);
135
136
$app->etag(md5(serialize($renderParams)));
137
$app->expires("+5 minutes");
138
$app->render("overview.html", $renderParams);
139