|
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
|
|
|
class api_alliInfo implements apiEndpoint |
|
20
|
|
|
{ |
|
21
|
|
|
public function getDescription() |
|
22
|
|
|
{ |
|
23
|
|
|
return array("type" => "description", "message" => |
|
24
|
|
|
"Gives you informatiton on a corporation, including it's members" |
|
25
|
|
|
); |
|
26
|
|
|
} |
|
27
|
|
|
|
|
28
|
|
|
public function getAcceptedParameters() |
|
29
|
|
|
{ |
|
30
|
|
|
return array("type" => "parameters", "parameters" => |
|
31
|
|
|
array( |
|
32
|
|
|
"allianceID" => "The allianceID of the corporation you need information on" |
|
33
|
|
|
) |
|
34
|
|
|
); |
|
35
|
|
|
} |
|
36
|
|
|
public function execute($parameters) |
|
37
|
|
|
{ |
|
38
|
|
|
$data = array(); |
|
39
|
|
|
if(isset($parameters["allianceID"])) |
|
40
|
|
|
{ |
|
41
|
|
|
$allianceID = (int) $parameters["allianceID"][0]; |
|
|
|
|
|
|
42
|
|
|
//$data = json_decode(Db::queryField("SELECT information FROM zz_corporations WHERE allianceID = :alliID", "information", array(":alliID" => $allianceID)), true); |
|
43
|
|
|
} |
|
44
|
|
|
|
|
45
|
|
|
$allianceID = $parameters["allianceID"][0]; |
|
46
|
|
|
$allianceActiveSystemID = Db::queryField("SELECT solarSystemID, count(*) AS hits FROM zz_participants WHERE allianceID = :alliID AND dttm >= date_sub(now(), interval 30 day) GROUP BY solarSystemID ORDER BY hits DESC LIMIT 10000", "solarSystemID", array(":alliID" => $allianceID)); |
|
47
|
|
|
$data["allianceActiveArea"] = isset($allianceID) ? Info::getRegionName(Info::getRegionIDFromSystemID($allianceActiveSystemID)) : ""; |
|
48
|
|
|
$data["lifeTimeKills"] = Db::queryField("SELECT SUM(destroyed) AS kills FROM zz_stats WHERE typeID = :alliID", "kills", array(":alliID" => $allianceID), 3600); |
|
49
|
|
|
$data["lifeTimeLosses"] = Db::queryField("SELECT SUM(lost) AS losses FROM zz_stats WHERE typeID = :alliID", "losses", array(":alliID" => $allianceID), 3600); |
|
50
|
|
|
$data["top100FlownShips"] = Stats::getTopShips(array("allianceID" => $allianceID, "kills" => true, "month" => date("m"), "year" => date("y"), "limit" => 100), true); |
|
51
|
|
|
$data["top100ActiveSystems"] = Stats::getTopSystems(array("allianceID" => $allianceID, "kills" => true, "month" => date("m"), "year" => date("y"), "limit" => 100), true); |
|
52
|
|
|
$data["lastUpdatedOnBackend"] = Db::queryField("SELECT lastUpdated FROM zz_alliances WHERE allianceID = :alliID", "lastUpdated", array(":alliID" => $allianceID)); |
|
53
|
|
|
$members = Db::query("SELECT characterID, name FROM zz_characters WHERE allianceID = :alliID", array(":alliID" => $allianceID)); |
|
54
|
|
|
$data["memberArrayCount"] = count($members); |
|
55
|
|
|
$data["members"] = $members; |
|
56
|
|
|
$supers = Db::query("SELECT a.characterID AS characterID, b.name AS name, a.shipTypeID AS shipTypeID, MAX(a.dttm) AS lastSeenDate FROM zz_participants a, zz_characters b WHERE a.characterID = b.characterID AND a.groupID IN (30, 659) AND a.allianceID = :alliID GROUP BY name ORDER BY characterID", array(":alliID" => $allianceID), 3600); |
|
57
|
|
|
$data["superCaps"] = $supers; |
|
58
|
|
|
|
|
59
|
|
|
$penis = "(..)=="; |
|
60
|
|
|
$cnt = log($data["lifeTimeKills"]) * 3; |
|
61
|
|
|
$i = 0; |
|
62
|
|
|
while($i < $cnt) |
|
63
|
|
|
{ |
|
64
|
|
|
$penis .= "="; |
|
65
|
|
|
$i++; |
|
66
|
|
|
} |
|
67
|
|
|
$data["ePeenSize"] = $penis . "D"; |
|
68
|
|
|
return $data; |
|
69
|
|
|
} |
|
70
|
|
|
} |
|
71
|
|
|
|
This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.
Both the
$myVarassignment in line 1 and the$higherassignment in line 2 are dead. The first because$myVaris never used and the second because$higheris always overwritten for every possible time line.