@@ -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,7 +101,7 @@ discard block |
||
| 101 | 101 | function characterName($characterID) |
| 102 | 102 | { |
| 103 | 103 | $character = characterDetails($characterID); |
| 104 | - $name = (string)$character['name']; |
|
| 104 | + $name = (string) $character['name']; |
|
| 105 | 105 | |
| 106 | 106 | if (null === $name) { // Make sure it's always set. |
| 107 | 107 | $name = 'Unknown'; |
@@ -121,7 +121,7 @@ discard block |
||
| 121 | 121 | $url = "https://esi.tech.ccp.is/latest/search/?search={$characterName}&categories=character&language=en-us&strict=true&datasource=tranquility"; |
| 122 | 122 | $json = file_get_contents($url); |
| 123 | 123 | $data = json_decode($json, TRUE); |
| 124 | - $id = (int)$data['character'][0]; |
|
| 124 | + $id = (int) $data['character'][0]; |
|
| 125 | 125 | |
| 126 | 126 | if (null === $id) { // Make sure it's always set. |
| 127 | 127 | $id = 'Unknown'; |
@@ -158,7 +158,7 @@ discard block |
||
| 158 | 158 | $url = "https://esi.tech.ccp.is/latest/universe/systems/{$systemID}/"; |
| 159 | 159 | $json = file_get_contents($url); |
| 160 | 160 | $data = json_decode($json, TRUE); |
| 161 | - $name = (string)$data['solar_system_name']; |
|
| 161 | + $name = (string) $data['solar_system_name']; |
|
| 162 | 162 | |
| 163 | 163 | if (null === $name) { // Make sure it's always set. |
| 164 | 164 | $name = 'Unknown'; |
@@ -178,7 +178,7 @@ discard block |
||
| 178 | 178 | $url = "https://esi.tech.ccp.is/latest/search/?search={$corpName}&categories=corporation&language=en-us&strict=true&datasource=tranquility"; |
| 179 | 179 | $json = file_get_contents($url); |
| 180 | 180 | $data = json_decode($json, TRUE); |
| 181 | - $id = (int)$data['corporation'][0]; |
|
| 181 | + $id = (int) $data['corporation'][0]; |
|
| 182 | 182 | |
| 183 | 183 | if (null === $id) { // Make sure it's always set. |
| 184 | 184 | $id = 'Unknown'; |
@@ -196,7 +196,7 @@ discard block |
||
| 196 | 196 | function corpName($corpID) |
| 197 | 197 | { |
| 198 | 198 | $corporation = corpDetails($corpID); |
| 199 | - $name = (string)$corporation['corporation_name']; |
|
| 199 | + $name = (string) $corporation['corporation_name']; |
|
| 200 | 200 | |
| 201 | 201 | if (null === $name) { // Make sure it's always set. |
| 202 | 202 | $name = 'Unknown'; |
@@ -233,7 +233,7 @@ discard block |
||
| 233 | 233 | $url = "https://esi.tech.ccp.is/latest/alliances/{$allianceID}/"; |
| 234 | 234 | $json = file_get_contents($url); |
| 235 | 235 | $data = json_decode($json, TRUE); |
| 236 | - $name = (string)$data['alliance_name']; |
|
| 236 | + $name = (string) $data['alliance_name']; |
|
| 237 | 237 | |
| 238 | 238 | if (null === $name) { // Make sure it's always set. |
| 239 | 239 | $name = 'Unknown'; |
@@ -253,7 +253,7 @@ discard block |
||
| 253 | 253 | $url = "https://esi.tech.ccp.is/latest/search/?search={$systemName}&categories=solarsystem&language=en-us&strict=true&datasource=tranquility"; |
| 254 | 254 | $json = file_get_contents($url); |
| 255 | 255 | $data = json_decode($json, TRUE); |
| 256 | - $id = (int)$data['solarsystem'][0]; |
|
| 256 | + $id = (int) $data['solarsystem'][0]; |
|
| 257 | 257 | |
| 258 | 258 | if (null === $id) { // Make sure it's always set. |
| 259 | 259 | $id = 'Unknown'; |
@@ -272,7 +272,7 @@ discard block |
||
| 272 | 272 | $url = "https://esi.tech.ccp.is/latest/universe/types/{$typeID}/"; |
| 273 | 273 | $json = file_get_contents($url); |
| 274 | 274 | $data = json_decode($json, TRUE); |
| 275 | - $name = (string)$data['type_name']; |
|
| 275 | + $name = (string) $data['type_name']; |
|
| 276 | 276 | |
| 277 | 277 | if (null === $name) { // Make sure it's always set. |
| 278 | 278 | $name = 'Unknown'; |
@@ -292,7 +292,7 @@ discard block |
||
| 292 | 292 | $url = "https://www.fuzzwork.co.uk/api/typeid.php?typename={$typeName}"; |
| 293 | 293 | $json = file_get_contents($url); |
| 294 | 294 | $data = json_decode($json, TRUE); |
| 295 | - $id = (int)$data['typeID']; |
|
| 295 | + $id = (int) $data['typeID']; |
|
| 296 | 296 | |
| 297 | 297 | if (null === $id) { // Make sure it's always set. |
| 298 | 298 | $id = 'Unknown'; |
@@ -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}"; |