1 | <?php |
||
23 | class War |
||
24 | { |
||
25 | public static function getWars($id, $active = true, $combined = false) |
||
26 | { |
||
27 | if (!self::isAlliance($id)) |
||
28 | { |
||
29 | $alliID = Db::queryField("select allianceID from zz_corporations where corporationID = :id", "allianceID", array(":id" => $id)); |
||
30 | if ($alliID != 0) $id = $alliID; |
||
31 | } |
||
32 | $active = $active ? "" : "not"; |
||
33 | $aggressing = Db::query("select * from zz_wars where aggressor = :id and timeFinished is $active null", array(":id" => $id)); |
||
34 | $defending = Db::query("select * from zz_wars where defender = :id and timeFinished is $active null", array(":id" => $id)); |
||
35 | if ($combined) return array_merge($aggressing, $defending); |
||
36 | return array("agr" => $aggressing, "dfd" => $defending); |
||
37 | } |
||
38 | |||
39 | public static function getKillIDWarInfo($killID) |
||
40 | { |
||
41 | $warID = Db::queryField("select warID from zz_warmails where killID = :killID", "warID", array(":killID" => $killID)); |
||
42 | return self::getWarInfo($warID); |
||
43 | } |
||
44 | |||
45 | public static function getWarInfo($warID) |
||
46 | { |
||
47 | $warInfo = array(); |
||
48 | if ($warID == null) return $warInfo; |
||
49 | $warInfo = Db::queryRow("select * from zz_wars where warID = :warID", array(":warID" => $warID)); |
||
50 | |||
51 | $agr = $warInfo["aggressor"]; |
||
52 | $agrIsAlliance = self::isAlliance($agr); |
||
53 | $agrName = $agrIsAlliance ? Info::getAlliName($agr) : Info::getCorpName($agr); |
||
54 | $warInfo["agrName"] = $agrName; |
||
55 | $warInfo["agrLink"] = ($agrIsAlliance ? "/alliance/" : "/corporation/") . "$agr/"; |
||
56 | |||
57 | $dfd = $warInfo["defender"]; |
||
58 | $dfdIsAlliance = self::isAlliance($dfd); |
||
59 | $dfdName = $dfdIsAlliance ? Info::getAlliName($dfd) : Info::getCorpName($dfd); |
||
60 | $warInfo["dfdName"] = $dfdName; |
||
61 | $warInfo["dfdLink"] = ($dfdIsAlliance ? "/alliance/" : "/corporation/") . "$dfd/"; |
||
62 | |||
63 | $warInfo["dscr"] = "$agrName vs $dfdName"; |
||
64 | return $warInfo; |
||
65 | } |
||
66 | |||
67 | public static function isAlliance($entityID) |
||
71 | |||
72 | public static function getNamedWars($name, $query) |
||
73 | { |
||
74 | $warIDs = Db::query($query); |
||
82 | } |
||
83 |
This check looks for accesses to local static members using the fully qualified name instead of
self::
.While this is perfectly valid, the fully qualified name of
Certificate::TRIPLEDES_CBC
could just as well be replaced byself::TRIPLEDES_CBC
. Referencing local members withself::
assured the access will still work when the class is renamed, makes it perfectly clear that the member is in fact local and will usually be shorter.