@@ -172,7 +172,7 @@ |
||
172 | 172 | $this->fuelChannel = $this->toDiscordChannel; |
173 | 173 | } |
174 | 174 | //Set timer for next key based on number of keys |
175 | - $nextKey = (1900 / (int)$this->numberOfKeys) + time(); |
|
175 | + $nextKey = (1900 / (int) $this->numberOfKeys) + time(); |
|
176 | 176 | $nextKeyTime = gmdate("Y-m-d H:i:s", $nextKey); |
177 | 177 | setPermCache("notificationsLastChecked", $nextKey); |
178 | 178 | //Set cache timer for api key |
@@ -146,7 +146,7 @@ |
||
146 | 146 | $cacheClr = $baseUnix - 13500; |
147 | 147 | |
148 | 148 | //Set timer for next key based on number of keys |
149 | - $nextKey = (1900 / (int)$this->numberOfKeys) + time(); |
|
149 | + $nextKey = (1900 / (int) $this->numberOfKeys) + time(); |
|
150 | 150 | $nextKeyTime = gmdate("Y-m-d H:i:s", $nextKey); |
151 | 151 | setPermCache("mailLastChecked", $nextKey); |
152 | 152 |
@@ -158,21 +158,21 @@ discard block |
||
158 | 158 | $discord->updatePresence($game); |
159 | 159 | |
160 | 160 | // Server Status Check (tick plugins will not run if eve is offline) |
161 | - $discord->loop->addPeriodicTimer(60, function () use ($logger) { |
|
161 | + $discord->loop->addPeriodicTimer(60, function() use ($logger) { |
|
162 | 162 | $crestData = json_decode(downloadData('https://crest-tq.eveonline.com/'), true); |
163 | 163 | $crestStatus = isset($crestData['serviceStatus']) ? $crestData['serviceStatus'] : 'offline'; |
164 | 164 | setPermCache('serverState', $crestStatus); |
165 | 165 | }); |
166 | 166 | |
167 | 167 | // Run the Tick plugins |
168 | - $discord->loop->addPeriodicTimer(3, function () use ($pluginsT) { |
|
168 | + $discord->loop->addPeriodicTimer(3, function() use ($pluginsT) { |
|
169 | 169 | foreach ($pluginsT as $plugin) { |
170 | 170 | $plugin->tick(); |
171 | 171 | } |
172 | 172 | }); |
173 | 173 | |
174 | 174 | // Message queue |
175 | - $discord->loop->addPeriodicTimer(7, function () use ($discord, $logger) { |
|
175 | + $discord->loop->addPeriodicTimer(7, function() use ($discord, $logger) { |
|
176 | 176 | $x = 0; |
177 | 177 | while ($x < 3) { |
178 | 178 | $id = getOldestMessage(); |
@@ -228,7 +228,7 @@ discard block |
||
228 | 228 | }); |
229 | 229 | |
230 | 230 | // Mem cleanup every 30 minutes |
231 | - $discord->loop->addPeriodicTimer(1800, function () use ($logger) { |
|
231 | + $discord->loop->addPeriodicTimer(1800, function() use ($logger) { |
|
232 | 232 | $logger->addInfo('Memory in use: ' . memory_get_usage() / 1024 / 1024 . 'MB'); |
233 | 233 | gc_collect_cycles(); // Collect garbage |
234 | 234 | $logger->addInfo('Memory in use after garbage collection: ' . memory_get_usage() / 1024 / 1024 . 'MB'); |
@@ -101,6 +101,9 @@ |
||
101 | 101 | } |
102 | 102 | |
103 | 103 | //CORP INFO |
104 | +/** |
|
105 | + * @param string $corpName |
|
106 | + */ |
|
104 | 107 | function addCorpInfo($corpID, $corpTicker, $corpName) |
105 | 108 | { |
106 | 109 | dbExecute('REPLACE INTO corpIDs (`corpID`, `corpTicker`, `corpName`) VALUES (:corpID,:corpTicker,:corpName)', array(':corpID' => $corpID, ':corpTicker' => $corpTicker, ':corpName' => $corpName)); |
@@ -117,7 +117,7 @@ discard block |
||
117 | 117 | if (null === $corpInfo) { |
118 | 118 | $corpDetails = corpDetails($corpID); |
119 | 119 | $corpTicker = $corpDetails['ticker']; |
120 | - $corpName = (string)$corpDetails['corporation_name']; |
|
120 | + $corpName = (string) $corpDetails['corporation_name']; |
|
121 | 121 | if (null !== $corpTicker) { |
122 | 122 | addCorpInfo($corpID, $corpTicker, $corpName); |
123 | 123 | } |
@@ -145,7 +145,7 @@ discard block |
||
145 | 145 | //Check if corpID matches |
146 | 146 | if ($corpID === $authGroup['corpID']) { |
147 | 147 | foreach ($roles as $role) { |
148 | - if ((string)$role->name === (string)$authGroup['corpMemberRole']) { |
|
148 | + if ((string) $role->name === (string) $authGroup['corpMemberRole']) { |
|
149 | 149 | $member->addRole($role); |
150 | 150 | $corpRoleSet = 1; |
151 | 151 | } |
@@ -154,7 +154,7 @@ discard block |
||
154 | 154 | //Check if allianceID matches |
155 | 155 | if ($allianceID === $authGroup['allianceID'] && $authGroup['allianceID'] != 0) { |
156 | 156 | foreach ($roles as $role) { |
157 | - if ((string)$role->name === (string)$authGroup['allyMemberRole']) { |
|
157 | + if ((string) $role->name === (string) $authGroup['allyMemberRole']) { |
|
158 | 158 | $member->addRole($role); |
159 | 159 | $allianceRoleSet = 1; |
160 | 160 | } |
@@ -154,10 +154,10 @@ discard block |
||
154 | 154 | //Set corp/ally id arrays |
155 | 155 | foreach ($this->authGroups as $authGroup) { |
156 | 156 | if ($authGroup['corpID'] !== 0) { |
157 | - $corpArray[] = (int)$authGroup['corpID']; |
|
157 | + $corpArray[] = (int) $authGroup['corpID']; |
|
158 | 158 | } |
159 | 159 | if ($authGroup['allianceID'] !== 0) { |
160 | - $allianceArray[] = (int)$authGroup['allianceID']; |
|
160 | + $allianceArray[] = (int) $authGroup['allianceID']; |
|
161 | 161 | } |
162 | 162 | } |
163 | 163 | |
@@ -177,7 +177,7 @@ discard block |
||
177 | 177 | $corporationID = $character['corporation_id']; |
178 | 178 | $corporationDetails = corpDetails($corporationID); |
179 | 179 | $allianceID = @$corporationDetails['alliance_id']; |
180 | - if (!in_array((int)$allianceID, $allianceArray) && !in_array((int)$corporationID, $corpArray)) { |
|
180 | + if (!in_array((int) $allianceID, $allianceArray) && !in_array((int) $corporationID, $corpArray)) { |
|
181 | 181 | // Deactivate user in database |
182 | 182 | $sql = "UPDATE authUsers SET active='no' WHERE discordID='$discordID'"; |
183 | 183 | $this->logger->addInfo("AuthCheck: {$eveName} account has been deactivated as they are no longer in a correct corp/alliance."); |
@@ -281,7 +281,7 @@ discard block |
||
281 | 281 | $guild = $this->discord->guilds->get('id', $this->guildID); |
282 | 282 | |
283 | 283 | //Get name queue status |
284 | - $x = (int)getPermCache('nameQueueState'); |
|
284 | + $x = (int) getPermCache('nameQueueState'); |
|
285 | 285 | |
286 | 286 | //Establish connection to mysql |
287 | 287 | $conn = new mysqli($this->db, $this->dbUser, $this->dbPass, $this->dbName); |
@@ -333,10 +333,10 @@ discard block |
||
333 | 333 | $corpInfo = getCorpInfo($character['corporation_id']); |
334 | 334 | $nick = null; |
335 | 335 | if (null !== $corpInfo) { |
336 | - $corpTicker = (string)$corpInfo['corpTicker']; |
|
336 | + $corpTicker = (string) $corpInfo['corpTicker']; |
|
337 | 337 | if ($this->nameEnforce === 'true') { |
338 | 338 | $nick = "[{$corpTicker}] {$eveName}"; |
339 | - } elseif ((string)$nickName === "[{$corpTicker}]") { |
|
339 | + } elseif ((string) $nickName === "[{$corpTicker}]") { |
|
340 | 340 | $nick = "[{$corpTicker}] {$userName}"; |
341 | 341 | } elseif (strpos($nickName, $corpTicker) == false) { |
342 | 342 | $nick = "[{$corpTicker}] {$nickName}"; |
@@ -351,11 +351,11 @@ discard block |
||
351 | 351 | $corporationID = $character['corporation_id']; |
352 | 352 | $corporationDetails = corpDetails($corporationID); |
353 | 353 | $corpTicker = $corporationDetails['ticker']; |
354 | - $corpName = (string)$corporationDetails['corporation_name']; |
|
354 | + $corpName = (string) $corporationDetails['corporation_name']; |
|
355 | 355 | if (null !== $corporationDetails) { |
356 | 356 | if ($this->nameEnforce === 'true') { |
357 | 357 | $nick = "[{$corpTicker}] {$eveName}"; |
358 | - } elseif ((string)$nickName === "[{$corpTicker}]") { |
|
358 | + } elseif ((string) $nickName === "[{$corpTicker}]") { |
|
359 | 359 | $nick = "[{$corpTicker}] {$userName}"; |
360 | 360 | } elseif (strpos($nickName, $corpTicker) === false) { |
361 | 361 | $nick = "[{$corpTicker}] {$nickName}"; |
@@ -141,17 +141,17 @@ |
||
141 | 141 | $attackerAllianceArray = array(); |
142 | 142 | |
143 | 143 | foreach ($kill['killmail']['attackers'] as $attacker) { |
144 | - $attackerCorpArray[] = (int)@$attacker['corporation']['id']; |
|
145 | - $attackerAllianceArray[] = (int)@$attacker['alliance']['id']; |
|
144 | + $attackerCorpArray[] = (int) @$attacker['corporation']['id']; |
|
145 | + $attackerAllianceArray[] = (int) @$attacker['alliance']['id']; |
|
146 | 146 | } |
147 | 147 | |
148 | - if ((int)@$kill['killmail']['victim']['corporation']['id'] === $kmGroup['corpID'] && (int)$kmGroup['corpID'] !== 0) { |
|
148 | + if ((int) @$kill['killmail']['victim']['corporation']['id'] === $kmGroup['corpID'] && (int) $kmGroup['corpID'] !== 0) { |
|
149 | 149 | $corpLoss = true; |
150 | - } elseif ((int)@$kill['killmail']['victim']['alliance']['id'] === $kmGroup['allianceID'] && (int)$kmGroup['allianceID'] !== 0) { |
|
150 | + } elseif ((int) @$kill['killmail']['victim']['alliance']['id'] === $kmGroup['allianceID'] && (int) $kmGroup['allianceID'] !== 0) { |
|
151 | 151 | $allianceLoss = true; |
152 | - } elseif (in_array((int)$kmGroup['corpID'], $attackerCorpArray) && (int)$kmGroup['corpID'] !== 0) { |
|
152 | + } elseif (in_array((int) $kmGroup['corpID'], $attackerCorpArray) && (int) $kmGroup['corpID'] !== 0) { |
|
153 | 153 | $corpKill = true; |
154 | - } elseif (in_array((int)$kmGroup['allianceID'], $attackerAllianceArray) && (int)$kmGroup['allianceID'] !== 0) { |
|
154 | + } elseif (in_array((int) $kmGroup['allianceID'], $attackerAllianceArray) && (int) $kmGroup['allianceID'] !== 0) { |
|
155 | 155 | $allianceKill = true; |
156 | 156 | } else { |
157 | 157 | break; |
@@ -105,7 +105,7 @@ discard block |
||
105 | 105 | if (null === $character) { // Make sure it's always set. |
106 | 106 | return null; |
107 | 107 | } |
108 | - $name = (string)$character['name']; |
|
108 | + $name = (string) $character['name']; |
|
109 | 109 | |
110 | 110 | return $name; |
111 | 111 | } |
@@ -125,7 +125,7 @@ discard block |
||
125 | 125 | try { |
126 | 126 | $json = file_get_contents($url); |
127 | 127 | $data = json_decode($json, TRUE); |
128 | - $id = (int)$data['character'][0]; |
|
128 | + $id = (int) $data['character'][0]; |
|
129 | 129 | |
130 | 130 | } catch (Exception $e) { |
131 | 131 | $logger->error('EVE ESI Error: ' . $e->getMessage()); |
@@ -172,7 +172,7 @@ discard block |
||
172 | 172 | try { |
173 | 173 | $json = file_get_contents($url); |
174 | 174 | $data = json_decode($json, TRUE); |
175 | - $name = (string)$data['solar_system_name']; |
|
175 | + $name = (string) $data['solar_system_name']; |
|
176 | 176 | |
177 | 177 | } catch (Exception $e) { |
178 | 178 | $logger->error('EVE ESI Error: ' . $e->getMessage()); |
@@ -197,7 +197,7 @@ discard block |
||
197 | 197 | try { |
198 | 198 | $json = file_get_contents($url); |
199 | 199 | $data = json_decode($json, TRUE); |
200 | - $id = (int)$data['corporation'][0]; |
|
200 | + $id = (int) $data['corporation'][0]; |
|
201 | 201 | |
202 | 202 | } catch (Exception $e) { |
203 | 203 | $logger->error('EVE ESI Error: ' . $e->getMessage()); |
@@ -216,7 +216,7 @@ discard block |
||
216 | 216 | function corpName($corpID) |
217 | 217 | { |
218 | 218 | $corporation = corpDetails($corpID); |
219 | - $name = (string)$corporation['corporation_name']; |
|
219 | + $name = (string) $corporation['corporation_name']; |
|
220 | 220 | |
221 | 221 | if (null === $corporation) { // Make sure it's always set. |
222 | 222 | return null; |
@@ -258,7 +258,7 @@ discard block |
||
258 | 258 | $url = "https://esi.tech.ccp.is/latest/alliances/{$allianceID}/"; |
259 | 259 | $json = file_get_contents($url); |
260 | 260 | $data = json_decode($json, TRUE); |
261 | - $name = (string)$data['alliance_name']; |
|
261 | + $name = (string) $data['alliance_name']; |
|
262 | 262 | |
263 | 263 | if (null === $name) { // Make sure it's always set. |
264 | 264 | $name = 'Unknown'; |
@@ -278,7 +278,7 @@ discard block |
||
278 | 278 | $url = "https://esi.tech.ccp.is/latest/search/?search={$systemName}&categories=solarsystem&language=en-us&strict=true&datasource=tranquility"; |
279 | 279 | $json = file_get_contents($url); |
280 | 280 | $data = json_decode($json, TRUE); |
281 | - $id = (int)$data['solarsystem'][0]; |
|
281 | + $id = (int) $data['solarsystem'][0]; |
|
282 | 282 | |
283 | 283 | if (null === $id) { // Make sure it's always set. |
284 | 284 | $id = 'Unknown'; |
@@ -297,7 +297,7 @@ discard block |
||
297 | 297 | $url = "https://esi.tech.ccp.is/latest/universe/types/{$typeID}/"; |
298 | 298 | $json = file_get_contents($url); |
299 | 299 | $data = json_decode($json, TRUE); |
300 | - $name = (string)$data['type_name']; |
|
300 | + $name = (string) $data['type_name']; |
|
301 | 301 | |
302 | 302 | if (null === $name) { // Make sure it's always set. |
303 | 303 | $name = 'Unknown'; |
@@ -317,7 +317,7 @@ discard block |
||
317 | 317 | $url = "https://www.fuzzwork.co.uk/api/typeid.php?typename={$typeName}"; |
318 | 318 | $json = file_get_contents($url); |
319 | 319 | $data = json_decode($json, TRUE); |
320 | - $id = (int)$data['typeID']; |
|
320 | + $id = (int) $data['typeID']; |
|
321 | 321 | |
322 | 322 | if (null === $id) { // Make sure it's always set. |
323 | 323 | $id = 'Unknown'; |
@@ -116,7 +116,7 @@ discard block |
||
116 | 116 | $siloID = $structures->attributes()->itemID; |
117 | 117 | $lastAmount = getPermCache("silo{$siloID}Amount"); |
118 | 118 | $gooAmount = $silo->attributes()->quantity; |
119 | - $gooDifference = (int)$gooAmount - (int)$lastAmount; |
|
119 | + $gooDifference = (int) $gooAmount - (int) $lastAmount; |
|
120 | 120 | //Check if silo has been checked before |
121 | 121 | if (null === $lastAmount || $gooDifference < 0) { |
122 | 122 | setPermCache("silo{$siloID}Amount", $gooAmount); |
@@ -148,7 +148,7 @@ discard block |
||
148 | 148 | $couplingID = $structures->attributes()->itemID; |
149 | 149 | $lastAmount = getPermCache("couplingArray{$couplingID}Amount"); |
150 | 150 | $gooAmount = $coupling->attributes()->quantity; |
151 | - $gooDifference = (int)$gooAmount - (int)$lastAmount; |
|
151 | + $gooDifference = (int) $gooAmount - (int) $lastAmount; |
|
152 | 152 | //Check if silo has been checked before |
153 | 153 | if (null === $lastAmount || $gooDifference < 0) { |
154 | 154 | setPermCache("couplingArray{$couplingID}Amount", $gooAmount); |