|
1
|
|
|
<?php |
|
2
|
|
|
/** |
|
3
|
|
|
* The MIT License (MIT) |
|
4
|
|
|
* |
|
5
|
|
|
* Copyright (c) 2016 Robert Sardinia |
|
6
|
|
|
* |
|
7
|
|
|
* Permission is hereby granted, free of charge, to any person obtaining a copy |
|
8
|
|
|
* of this software and associated documentation files (the "Software"), to deal |
|
9
|
|
|
* in the Software without restriction, including without limitation the rights |
|
10
|
|
|
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
|
11
|
|
|
* copies of the Software, and to permit persons to whom the Software is |
|
12
|
|
|
* furnished to do so, subject to the following conditions: |
|
13
|
|
|
* |
|
14
|
|
|
* The above copyright notice and this permission notice shall be included in all |
|
15
|
|
|
* copies or substantial portions of the Software. |
|
16
|
|
|
* |
|
17
|
|
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
|
18
|
|
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
|
19
|
|
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
|
20
|
|
|
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
|
21
|
|
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
|
22
|
|
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE |
|
23
|
|
|
* SOFTWARE. |
|
24
|
|
|
*/ |
|
25
|
|
|
|
|
26
|
|
|
|
|
27
|
|
|
/** |
|
28
|
|
|
* Class fileAuthCheck |
|
29
|
|
|
* @property int nextCheck |
|
30
|
|
|
*/ |
|
31
|
|
|
class authCheck |
|
|
|
|
|
|
32
|
|
|
{ |
|
33
|
|
|
|
|
34
|
|
|
/** |
|
35
|
|
|
* @var |
|
36
|
|
|
*/ |
|
37
|
|
|
private $active; |
|
38
|
|
|
private $config; |
|
39
|
|
|
private $discord; |
|
40
|
|
|
private $logger; |
|
41
|
|
|
private $db; |
|
42
|
|
|
private $dbUser; |
|
43
|
|
|
private $dbPass; |
|
44
|
|
|
private $dbName; |
|
45
|
|
|
private $guildID; |
|
46
|
|
|
private $exempt; |
|
47
|
|
|
private $corpTickers; |
|
48
|
|
|
private $nameEnforce; |
|
49
|
|
|
private $standingsBased; |
|
50
|
|
|
private $apiKey; |
|
51
|
|
|
private $authGroups; |
|
52
|
|
|
private $alertChannel; |
|
53
|
|
|
private $nameCheck; |
|
54
|
|
|
|
|
55
|
|
|
/** |
|
56
|
|
|
* @param $config |
|
57
|
|
|
* @param $discord |
|
58
|
|
|
* @param $logger |
|
59
|
|
|
*/ |
|
60
|
|
|
public function init($config, $discord, $logger) |
|
61
|
|
|
{ |
|
62
|
|
|
$this->active = true; |
|
63
|
|
|
$this->config = $config; |
|
64
|
|
|
$this->discord = $discord; |
|
65
|
|
|
$this->logger = $logger; |
|
66
|
|
|
$this->db = $config['database']['host']; |
|
67
|
|
|
$this->dbUser = $config['database']['user']; |
|
68
|
|
|
$this->dbPass = $config['database']['pass']; |
|
69
|
|
|
$this->dbName = $config['database']['database']; |
|
70
|
|
|
$this->guildID = $config['bot']['guild']; |
|
71
|
|
|
$this->exempt = $config['plugins']['auth']['exempt']; |
|
72
|
|
|
$this->corpTickers = $config['plugins']['auth']['corpTickers']; |
|
73
|
|
|
$this->nameEnforce = $config['plugins']['auth']['nameEnforce']; |
|
74
|
|
|
$this->standingsBased = $config['plugins']['auth']['standings']['enabled']; |
|
75
|
|
|
$this->apiKey = $config['eve']['apiKeys']; |
|
76
|
|
|
$this->authGroups = $config['plugins']['auth']['authGroups']; |
|
77
|
|
|
$this->alertChannel = $config['plugins']['auth']['alertChannel']; |
|
78
|
|
|
$this->nextCheck = 0; |
|
79
|
|
|
|
|
80
|
|
|
//Set name check to happen if corpTicker or nameEnforce is set |
|
81
|
|
|
if ($this->nameEnforce === 'true' || $this->corpTickers === 'true') { |
|
82
|
|
|
$this->nameCheck = 'true'; |
|
83
|
|
|
} |
|
84
|
|
|
|
|
85
|
|
|
//check if cache has been set |
|
86
|
|
|
$permsChecked = getPermCache('permsLastChecked'); |
|
87
|
|
|
$namesChecked = getPermCache('nextRename'); |
|
88
|
|
|
if ($namesChecked === NULL) { |
|
89
|
|
|
setPermCache('nextRename', time()); |
|
90
|
|
|
} |
|
91
|
|
|
|
|
92
|
|
|
//if not set set for now (30 minutes from now for role removal) |
|
93
|
|
|
if ($permsChecked === NULL) { |
|
94
|
|
|
setPermCache('permsLastChecked', time() - 1); |
|
95
|
|
|
} |
|
96
|
|
|
|
|
97
|
|
|
// If config is outdated |
|
98
|
|
|
if (null === $this->authGroups) { |
|
99
|
|
|
$msg = '**Auth Failure:** Please update the bots config to the latest version.'; |
|
100
|
|
|
queueMessage($msg, $this->alertChannel, $this->guildID); |
|
101
|
|
|
$this->logger->addInfo($msg); |
|
102
|
|
|
$this->active = false; |
|
103
|
|
|
} |
|
104
|
|
|
|
|
105
|
|
|
} |
|
106
|
|
|
|
|
107
|
|
|
public function tick() |
|
108
|
|
|
{ |
|
109
|
|
|
// What was the servers last reported state |
|
110
|
|
|
$lastStatus = getPermCache('serverState'); |
|
111
|
|
|
if ($this->active && $lastStatus === 'online') { |
|
112
|
|
|
$permsChecked = getPermCache('permsLastChecked'); |
|
113
|
|
|
$namesChecked = getPermCache('nextRename'); |
|
114
|
|
|
$standingsChecked = getPermCache('nextStandingsCheck'); |
|
115
|
|
|
|
|
116
|
|
|
if ($permsChecked <= time()) { |
|
117
|
|
|
$this->logger->addInfo('AuthCheck: Checking for users who have left corp/alliance....'); |
|
118
|
|
|
$this->checkPermissions(); |
|
119
|
|
|
$this->logger->addInfo('AuthCheck: Corp/alliance check complete.'); |
|
120
|
|
|
} |
|
121
|
|
|
|
|
122
|
|
|
if ($this->nameCheck === 'true' && $namesChecked <= time()) { |
|
123
|
|
|
$this->logger->addInfo('AuthCheck: Resetting player names....'); |
|
124
|
|
|
$this->nameReset(); |
|
125
|
|
|
$this->logger->addInfo('AuthCheck: Names reset.'); |
|
126
|
|
|
} |
|
127
|
|
|
|
|
128
|
|
|
if ($this->standingsBased === 'true' && $standingsChecked <= time()) { |
|
129
|
|
|
$this->logger->addInfo('AuthCheck: Updating Standings'); |
|
130
|
|
|
$this->standingsUpdate(); |
|
131
|
|
|
$this->logger->addInfo('AuthCheck: Standings Updated'); |
|
132
|
|
|
} |
|
133
|
|
|
} |
|
134
|
|
|
} |
|
135
|
|
|
|
|
136
|
|
|
// remove user roles |
|
137
|
|
|
private function removeRoles($member) |
|
138
|
|
|
{ |
|
139
|
|
|
$discordNick = $member->nick ?: $member->username; |
|
140
|
|
|
$dbh = new PDO("mysql:host={$this->db};dbname={$this->dbName}", $this->dbUser, $this->dbPass); |
|
141
|
|
|
$rows = array_column($dbh->query('SELECT discordID, characterID, eveName, role FROM authUsers')->fetchAll(), null, 'discordID'); |
|
142
|
|
|
$roleRemoved = false; |
|
143
|
|
|
if (null === $member->roles) |
|
144
|
|
|
continue; |
|
145
|
|
|
if (!isset($rows[$member->id])) { |
|
146
|
|
|
foreach ($member->roles as $role) { |
|
147
|
|
|
if (!in_array($role->name, $this->exempt, true)) { |
|
148
|
|
|
$roleRemoved = true; |
|
149
|
|
|
$member->removeRole($role); |
|
150
|
|
|
$this->discord->guilds->get('id', $this->guildID)->members->save($member); |
|
151
|
|
|
} |
|
152
|
|
|
} |
|
153
|
|
|
} |
|
154
|
|
|
if ($roleRemoved) { |
|
155
|
|
|
$this->logger->addInfo("AuthCheck: Roles removed from $discordNick"); |
|
156
|
|
|
$msg = "Discord roles removed from $discordNick"; |
|
157
|
|
|
queueMessage($msg, $this->alertChannel, $this->guildID); |
|
158
|
|
|
} |
|
159
|
|
|
} |
|
160
|
|
|
/** |
|
161
|
|
|
* @return null |
|
162
|
|
|
*/ |
|
163
|
|
|
|
|
164
|
|
|
//Check user corp/alliance affiliation |
|
165
|
|
|
//Remove members who have roles but never authed |
|
166
|
|
|
private function checkPermissions() |
|
167
|
|
|
{ |
|
168
|
|
|
$rows = array(); |
|
|
|
|
|
|
169
|
|
|
$dbh = new PDO("mysql:host={$this->db};dbname={$this->dbName}", $this->dbUser, $this->dbPass); |
|
170
|
|
|
$rows = array_column($dbh->query('SELECT discordID, characterID, eveName, role FROM authUsers')->fetchAll(), null, 'discordID'); |
|
171
|
|
|
|
|
172
|
|
|
//Set empty arrays |
|
173
|
|
|
$corpArray = array_column($this->authGroups, 'corpID'); |
|
174
|
|
|
$allianceArray = array_column($this->authGroups, 'allianceID'); |
|
175
|
|
|
|
|
176
|
|
|
foreach ($this->discord->guilds->get('id', $this->guildID)->members as $member) { |
|
177
|
|
|
$discordID = $member->getIdAttribute(); |
|
178
|
|
|
$discordNick = $member->nick ?: $member->getUsernameAttribute(); |
|
179
|
|
|
if ($member->getRolesAttribute()->isEmpty()) { |
|
180
|
|
|
continue; |
|
181
|
|
|
} |
|
182
|
|
|
if ($this->discord->id == $discordID) { |
|
183
|
|
|
continue; |
|
184
|
|
|
} |
|
185
|
|
|
$this->logger->addDebug("AuthCheck: Username: $discordNick"); |
|
186
|
|
|
if (!isset($rows[$discordID])) { |
|
187
|
|
|
$this->logger->addInfo("AuthCheck: User [$discordNick] not found in database."); |
|
188
|
|
|
$this->removeRoles($member); |
|
189
|
|
|
continue; |
|
190
|
|
|
} |
|
191
|
|
|
$charID = $rows[$discordID]['characterID']; |
|
192
|
|
|
|
|
193
|
|
|
// corporation membership check |
|
194
|
|
|
for ($i=0; $i<3; $i++) { |
|
195
|
|
|
$character = characterDetails($charID); |
|
196
|
|
|
//if (isset($character['corporation_id']) && in_array($character['corporation_id'], $corpArray)) |
|
|
|
|
|
|
197
|
|
|
if (!is_null($character)) |
|
198
|
|
|
break; |
|
199
|
|
|
//Postpone check if ESI is down to prevent timeouts |
|
200
|
|
|
if (isset($character['error']) && $character['error'] === 'The datasource tranquility is temporarily unavailable') { |
|
201
|
|
|
$this->logger->addInfo('AuthCheck: The datasource tranquility is temporarily unavailable, check canceled.'); |
|
202
|
|
|
$nextCheck = time() + 10800; |
|
203
|
|
|
setPermCache('permsLastChecked', $nextCheck); |
|
204
|
|
|
return; |
|
205
|
|
|
} |
|
206
|
|
|
} |
|
207
|
|
View Code Duplication |
if (is_null($character) || isset($character['error'])) { |
|
|
|
|
|
|
208
|
|
|
$this->logger->addInfo('AuthCheck: characterDetails lookup failed.'); |
|
209
|
|
|
continue; |
|
210
|
|
|
} elseif (isset($character['corporation_id']) && in_array($character['corporation_id'], $corpArray)) { |
|
211
|
|
|
continue; // user is in a valid corporation, stop checking |
|
212
|
|
|
} |
|
213
|
|
|
|
|
214
|
|
|
// alliance membership check |
|
215
|
|
|
for ($i=0; $i<3; $i++) { |
|
216
|
|
|
$corporationDetails = corpDetails($corporationID); |
|
|
|
|
|
|
217
|
|
|
if (!is_null($corporationDetails)) |
|
218
|
|
|
break; |
|
219
|
|
|
} |
|
220
|
|
View Code Duplication |
if (is_null($corporationDetails) || isset($corporationDetails['error'])) { |
|
|
|
|
|
|
221
|
|
|
$this->logger->addInfo('AuthCheck: corpDetails lookup failed.'); |
|
222
|
|
|
continue; |
|
223
|
|
|
} else if (isset($corporationDetails['alliance_id']) && in_array($corporationDetails['alliance_id'], $allianceArray)) { |
|
224
|
|
|
continue; // user is in a valid alliance, stop checking |
|
225
|
|
|
} |
|
226
|
|
|
|
|
227
|
|
|
//check if user authed based on standings |
|
228
|
|
|
$role = $rows[$discordID]['role']; |
|
229
|
|
|
$standings = null; |
|
230
|
|
|
if ($role === 'blue' || 'neut' || 'red') { |
|
231
|
|
|
$allianceContacts = getContacts($allianceID); |
|
|
|
|
|
|
232
|
|
|
$corpContacts = getContacts($corporationID); |
|
|
|
|
|
|
233
|
|
|
if ($role === 'blue' && ((int) $allianceContacts['standing'] === 5 || 10 || (int) $corpContacts['standing'] === 5 || 10)) { |
|
234
|
|
|
$standings = 1; |
|
235
|
|
|
} |
|
236
|
|
|
if ($role === 'red' && ((int) $allianceContacts['standing'] === -5 || -10 || (int) $corpContacts['standing'] === -5 || -10)) { |
|
237
|
|
|
$standings = 1; |
|
238
|
|
|
} |
|
239
|
|
|
if ($role === 'neut' && ((int) $allianceContacts['standing'] === 0 || (int) $corpContacts['standing'] === 0 || (@(int) $allianceContacts['standings'] === null || '' && @(int) $corpContacts['standings'] === null || ''))) { |
|
240
|
|
|
$standings = 1; |
|
241
|
|
|
} |
|
242
|
|
|
} |
|
243
|
|
|
if ($standings) |
|
|
|
|
|
|
244
|
|
|
continue; //keep the user based on standings |
|
245
|
|
|
|
|
246
|
|
|
// User failed all checks, deactivate user in database |
|
247
|
|
|
$sql = "UPDATE authUsers SET active='no' WHERE discordID='$discordID'"; |
|
248
|
|
|
$this->logger->addInfo("AuthCheck: {$eveName} account has been deactivated as they are no longer in a correct corp/alliance."); |
|
|
|
|
|
|
249
|
|
|
$dbh->query($sql); |
|
250
|
|
|
$this->removeRoles($member); |
|
251
|
|
|
} |
|
252
|
|
|
setPermCache('permsLastChecked', time() + 1800); |
|
253
|
|
|
} |
|
254
|
|
|
|
|
255
|
|
|
private function nameReset() |
|
256
|
|
|
{ |
|
257
|
|
|
//Get guild object |
|
258
|
|
|
$guild = $this->discord->guilds->get('id', $this->guildID); |
|
259
|
|
|
|
|
260
|
|
|
//Get name queue status |
|
261
|
|
|
$x = (int) getPermCache('nameQueueState'); |
|
262
|
|
|
|
|
263
|
|
|
//Establish connection to mysql |
|
264
|
|
|
$conn = new mysqli($this->db, $this->dbUser, $this->dbPass, $this->dbName); |
|
265
|
|
|
$sql = "SELECT id FROM authUsers WHERE active='yes'"; |
|
266
|
|
|
$count = $conn->query($sql); |
|
267
|
|
|
$rowAmount = round($count->num_rows / 2); |
|
268
|
|
|
if ($x === 1) { |
|
269
|
|
|
$sql = "SELECT characterID, discordID, eveName FROM authUsers WHERE active='yes' ORDER BY id ASC LIMIT {$rowAmount} OFFSET {$rowAmount}"; |
|
270
|
|
|
setPermCache('nameQueueState', 0); |
|
271
|
|
|
} else { |
|
272
|
|
|
$sql = "SELECT characterID, discordID, eveName FROM authUsers WHERE active='yes' ORDER BY id ASC LIMIT {$rowAmount}"; |
|
273
|
|
|
setPermCache('nameQueueState', 1); |
|
274
|
|
|
} |
|
275
|
|
|
$result = $conn->query($sql); |
|
276
|
|
|
|
|
277
|
|
|
if (@$result->num_rows >= 1) { |
|
278
|
|
|
while ($rows = $result->fetch_assoc()) { |
|
279
|
|
|
$charID = $rows['characterID']; |
|
280
|
|
|
$discordID = $rows['discordID']; |
|
281
|
|
|
$member = $guild->members->get('id', $discordID); |
|
282
|
|
|
$eveName = $rows['eveName']; |
|
283
|
|
|
//Check if member has roles |
|
284
|
|
|
if (null === @$member->roles) { |
|
285
|
|
|
continue; |
|
286
|
|
|
} |
|
287
|
|
|
|
|
288
|
|
|
//Get current nickname |
|
289
|
|
|
$guild = $this->discord->guilds->get('id', $this->guildID); |
|
290
|
|
|
$member = $guild->members->get('id', $discordID); |
|
291
|
|
|
$nickName = $member->nick; |
|
292
|
|
|
$userName = $member->user->username; |
|
293
|
|
|
//If nick isn't set than make it username |
|
294
|
|
|
if ($nickName === '' || null === $nickName) { |
|
295
|
|
|
$nickName = $userName; |
|
296
|
|
|
} |
|
297
|
|
|
|
|
298
|
|
|
//Check for bad tickers |
|
299
|
|
|
if (strpos($nickName, '[U]') !== false) { |
|
300
|
|
|
$nickName = str_replace('[U]', '', $nickName); |
|
301
|
|
|
queueRename($discordID, $nickName, $this->guildID); |
|
302
|
|
|
continue; |
|
303
|
|
|
} |
|
304
|
|
|
|
|
305
|
|
|
//corp ticker |
|
306
|
|
|
if ($this->corpTickers === 'true') { |
|
307
|
|
|
$timeout = 0; |
|
308
|
|
|
$character = characterDetails($charID); |
|
309
|
|
|
while (null === $character) { //try 10 times to pull characterDetails |
|
310
|
|
|
if ($timeout > 9) { |
|
311
|
|
|
continue; |
|
312
|
|
|
} |
|
313
|
|
|
else{ |
|
314
|
|
|
$character = characterDetails($charID); |
|
315
|
|
|
$timeout++; |
|
316
|
|
|
} |
|
317
|
|
|
} |
|
318
|
|
|
if (!array_key_exists('corporation_id', $character)) { |
|
319
|
|
|
continue; |
|
320
|
|
|
} |
|
321
|
|
|
$corpInfo = getCorpInfo($character['corporation_id']); |
|
|
|
|
|
|
322
|
|
|
//Clean bad entries |
|
323
|
|
|
if (@$corpInfo['corpTicker'] === 'U') { |
|
324
|
|
|
deleteCorpInfo(@$corpInfo['corpID']); |
|
325
|
|
|
} |
|
326
|
|
|
$nick = null; |
|
327
|
|
View Code Duplication |
if (null !== @$corpInfo['corpTicker']) { |
|
|
|
|
|
|
328
|
|
|
$corpTicker = (string) $corpInfo['corpTicker']; |
|
329
|
|
|
if ($this->nameEnforce === 'true') { |
|
330
|
|
|
$nick = "[{$corpTicker}] {$eveName}"; |
|
331
|
|
|
} elseif ((string) $nickName === "[{$corpTicker}]") { |
|
332
|
|
|
$nick = "[{$corpTicker}] {$userName}"; |
|
333
|
|
|
} elseif (strpos($nickName, $corpTicker) === false) { |
|
334
|
|
|
$nick = "[{$corpTicker}] {$nickName}"; |
|
335
|
|
|
} elseif (strpos($nickName, $corpTicker) !== false) { |
|
336
|
|
|
continue; |
|
337
|
|
|
} |
|
338
|
|
|
if ($nick !== $nickName) { |
|
339
|
|
|
queueRename($discordID, $nick, $this->guildID); |
|
340
|
|
|
} |
|
341
|
|
|
continue; |
|
342
|
|
|
} |
|
343
|
|
|
$corporationDetails = corpDetails($character['corporation_id']); |
|
344
|
|
|
if (null === $corporationDetails) { |
|
345
|
|
|
continue; |
|
346
|
|
|
} |
|
347
|
|
|
$corpTicker = $corporationDetails['ticker']; |
|
348
|
|
|
//Check for bad tickers (ESI ERROR?) |
|
349
|
|
|
if (@$corpTicker === 'U') { |
|
350
|
|
|
continue; |
|
351
|
|
|
} |
|
352
|
|
|
$corpName = (string) $corporationDetails['corporation_name']; |
|
353
|
|
View Code Duplication |
if (null !== $corpTicker) { |
|
|
|
|
|
|
354
|
|
|
if ($this->nameEnforce === 'true') { |
|
355
|
|
|
$nick = "[{$corpTicker}] {$eveName}"; |
|
356
|
|
|
} elseif ((string) $nickName === "[{$corpTicker}]") { |
|
357
|
|
|
$nick = "[{$corpTicker}] {$userName}"; |
|
358
|
|
|
} elseif (strpos($nickName, $corpTicker) === false) { |
|
359
|
|
|
$nick = "[{$corpTicker}] {$nickName}"; |
|
360
|
|
|
} elseif (strpos($nickName, $corpTicker) !== false) { |
|
361
|
|
|
continue; |
|
362
|
|
|
} |
|
363
|
|
|
if ($nick !== $nickName) { |
|
364
|
|
|
queueRename($discordID, $nick, $this->guildID); |
|
365
|
|
|
addCorpInfo($character['corporation_id'], $corpTicker, $corpName); |
|
366
|
|
|
} |
|
367
|
|
|
continue; |
|
368
|
|
|
} |
|
369
|
|
|
continue; |
|
370
|
|
|
} |
|
371
|
|
|
$nick = "{$eveName}"; |
|
372
|
|
|
if ($nick !== $nickName) { |
|
373
|
|
|
queueRename($discordID, $nick, $this->guildID); |
|
374
|
|
|
} |
|
375
|
|
|
continue; |
|
376
|
|
|
} |
|
377
|
|
|
$nextCheck = time() + 1800; |
|
378
|
|
|
setPermCache('nextRename', $nextCheck); |
|
379
|
|
|
return null; |
|
380
|
|
|
} |
|
381
|
|
|
$nextCheck = time() + 1800; |
|
382
|
|
|
setPermCache('nextRename', $nextCheck); |
|
383
|
|
|
return null; |
|
384
|
|
|
|
|
385
|
|
|
} |
|
386
|
|
|
|
|
387
|
|
|
private function standingsUpdate() |
|
388
|
|
|
{ |
|
389
|
|
|
foreach ($this->apiKey as $apiKey) { |
|
390
|
|
|
if ((string) $apiKey['keyID'] === (string) $this->config['plugins']['auth']['standings']['apiKey']) { |
|
391
|
|
|
$url = "https://api.eveonline.com/char/ContactList.xml.aspx?keyID={$apiKey['keyID']}&vCode={$apiKey['vCode']}&characterID={$apiKey['characterID']}"; |
|
392
|
|
|
$xml = makeApiRequest($url); |
|
393
|
|
|
if (empty($xml)) { |
|
394
|
|
|
return null; |
|
395
|
|
|
} |
|
396
|
|
|
foreach ($xml->result->rowset as $contactType) { |
|
397
|
|
|
if ((string) $contactType->attributes()->name === 'corporateContactList' || 'allianceContactList') { |
|
398
|
|
|
foreach ($contactType->row as $contact) { |
|
399
|
|
|
if (null !== $contact['contactID'] && $contact['contactName'] && $contact['standing']) { |
|
400
|
|
|
addContactInfo($contact['contactID'], $contact['contactName'], $contact['standing']); |
|
401
|
|
|
} |
|
402
|
|
|
} |
|
403
|
|
|
} |
|
404
|
|
|
} |
|
405
|
|
|
} |
|
406
|
|
|
} |
|
407
|
|
|
$nextCheck = time() + 86400; |
|
408
|
|
|
setPermCache('nextStandingsCheck', $nextCheck); |
|
409
|
|
|
} |
|
410
|
|
|
} |
|
411
|
|
|
|
You can fix this by adding a namespace to your class:
When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.