This repository has been archived by the owner on Nov 27, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 12
/
auditorKillsPage.class.php
127 lines (108 loc) · 4.96 KB
/
auditorKillsPage.class.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
<?php
// ****************************************************************************
//
// ZZJ Audit Tool v1.0
// Copyright (C) 2010 ZigZagJoe (zigzagjoe@gmail.com)
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
// ****************************************************************************
include_once("auditorPage.base.php");
function force_nowrap($str) {
return str_replace(" "," ",$str);
}
function display_log($entries,$name) {
global $Db;
$output = "<table class=\"fancy $name\" style=\"font-size:80%\">";
$output .= "<tr><th colspan=7 style=\"font-size:120%\">$name</th></tr>";
$output .= "<tr><th>date</th><th>destroyed</th><th>victim</th>";
if (CORP_MODE) $output .= "<th>final blow</th>";
$output .= "<th>system</th><th>corp</th><th>alliance</th><th>#P</th></tr>";
$alt = " class=\"main\"";
foreach ($entries as $kill) {
if ($alt == " class=\"main\"") {
$alt = " class=\"alt\"";
} else $alt = " class=\"main\"";
$output .= "<tr style=\"cursor: pointer;\" $alt onclick=\"document.location='".FULL_URL."&view=kills&kill=".$kill["killID"]."';\">";
$output .= "<th scope=\"row\">".force_nowrap($kill['killTime'])."</th>";
$output .= "<td>".force_nowrap($Db->getNameFromTypeId((int)$kill->victim['shipTypeID']))."</td>";
$output .= "<td>".force_nowrap(getcharname($kill))."</td>";
if (CORP_MODE) {
$killer = $kill->xpath("/eveapi/result/rowset[@name='kills']/row[@killID=".$kill["killID"]."]/rowset[@name='attackers']/row[@finalBlow=1]");
if ((string)$killer[0]["characterName"] == "") {
$killer = $Db->getNameFromTypeId((int)($killer[0]['shipTypeID']));
} else
$killer = (string)$killer[0]["characterName"];
$output .= "<td>". force_nowrap($killer)."</td>";
}
$output .= "<td>".force_nowrap($Db->getNameFromSystemId((int)$kill['solarSystemID']))."</td>";
$output .= "<td>".force_nowrap($kill->victim['corporationName'])."</td>";
$output .= "<td>".force_nowrap($kill->victim['allianceName'])."</td>";
$output .= "<td>".count($kill->xpath("/eveapi/result/rowset[@name='kills']/row[@killID='".$kill['killID']."']/rowset[@name='attackers']/*"))."</td>";
$output .= "</tr>\n";
}
$output .= "</table>\n";
return $output;
}
class auditorKillsPage extends auditorPage {
public function GetName() { return "kills"; }
public function GetAccMode() { return ACC_BOTH; }
public function GetAccMask($corp) { return Killlog; }
public function GetOutput($Db) {
$KillLog = new eveApiKillLog($Db);
$full_url = FULL_URL; // TODO
$time_start = microtime_float();
if (!$KillLog->fetch(CHAR_ID, USER_ID, API_KEY, CORP_MODE, CORP_MODE ? CORP_ID : 0)) {
$this->Output = $KillLog->Error;
return false;
}
$time_end = microtime_float();
$time_api = $time_end - $time_start;
$this->Updated = APITime($KillLog);
$killmail = null;
if (isset($_GET['kill'])) {
$kill = $KillLog->All->xpath("/eveapi/result/rowset[@name='kills']/row[@killID=".$_GET['kill']."]");
if (count($kill) > 0)
$killmail = generate_kill($kill[0]);
}
if (!$killmail) {
$this->Title = "PVP Activity for ".USER_NAME;
if (isset($_GET['kill']))
$this->Output .= "Bad killID!<br>";
$this->Output .= "<table><tr><td valign=top>\n";
if (count($KillLog->Kills) > 1) { // TODO is this correct?
$this->Output .= display_log($KillLog->Kills,"Kills");
$this->Output .= "</td><td valign=top>";
} else
$this->Output .= "<b><span style=\"font-size:80%\">".strtoupper("[".(CORP_MODE?"corp":"char")." has no recent kills]")."</b></span><br><br>";
if (count($KillLog->Losses) > 1) {
$this->Output .= display_log($KillLog->Losses,"Losses");
$this->Output .= "</td>";
} else
$this->Output .= "<b><span style=\"font-size:80%\">".strtoupper("[".(CORP_MODE?"corp":"char")." has no recent losses]")."</b></span><br><br>";
$this->Output .= "</tr></table>";
} else {
$this->Title = "Details for kill ".$_GET['kill'];
$this->Output .= "<br>Displaying killID " .$_GET['kill'];
$this->Output .= "<br>[ <a href=\"" . FULL_URL ."&view=kills\">back</a> ]";
$this->Output .= "<pre>$killmail</pre>";
//}
}
$this->Times = getPageTimes($Db,$time_api,microtime_float() - $time_start);
return true;
}
}
$registered_pages[] = new auditorKillsPage();
?>