@@ -174,18 +174,18 @@ discard block |
||
| 174 | 174 | |
| 175 | 175 | if ($result->num_rows >= 1) { |
| 176 | 176 | while ($rows = $result->fetch_assoc()) { |
| 177 | - $charID = $rows['characterID']; |
|
| 178 | - $discordID = $rows['discordID']; |
|
| 179 | - $role = $rows['role']; |
|
| 180 | - $member = $guild->members->get('id', $discordID); |
|
| 181 | - $eveName = $rows['eveName']; |
|
| 182 | - //Check if member has roles |
|
| 183 | - if (null === @$member->roles) { |
|
| 184 | - continue; |
|
| 185 | - } |
|
| 186 | - |
|
| 187 | - //Auth things |
|
| 188 | - $character = characterDetails($charID); |
|
| 177 | + $charID = $rows['characterID']; |
|
| 178 | + $discordID = $rows['discordID']; |
|
| 179 | + $role = $rows['role']; |
|
| 180 | + $member = $guild->members->get('id', $discordID); |
|
| 181 | + $eveName = $rows['eveName']; |
|
| 182 | + //Check if member has roles |
|
| 183 | + if (null === @$member->roles) { |
|
| 184 | + continue; |
|
| 185 | + } |
|
| 186 | + |
|
| 187 | + //Auth things |
|
| 188 | + $character = characterDetails($charID); |
|
| 189 | 189 | |
| 190 | 190 | //Postpone check if ESI is down to prevent timeouts |
| 191 | 191 | if (@$character['error'] === 'The datasource tranquility is temporarily unavailable') { |
@@ -195,56 +195,56 @@ discard block |
||
| 195 | 195 | return null; |
| 196 | 196 | } |
| 197 | 197 | |
| 198 | - //if issue with esi, skip |
|
| 199 | - $timeout = 0; |
|
| 198 | + //if issue with esi, skip |
|
| 199 | + $timeout = 0; |
|
| 200 | 200 | while (null === @$character['corporation_id']) { //try 10 times to pull characterDetails |
| 201 | 201 | if ($timeout > 3) { |
| 202 | - continue; |
|
| 203 | - } |
|
| 204 | - else{ |
|
| 205 | - $character = characterDetails($charID); |
|
| 206 | - $timeout++; |
|
| 207 | - } |
|
| 208 | - } |
|
| 209 | - $corporationID = $character['corporation_id']; |
|
| 210 | - $corporationDetails = corpDetails($corporationID); |
|
| 211 | - $timeout = 0; |
|
| 212 | - while (null === $corporationDetails) { //try 10 times to pull corporationDetails |
|
| 213 | - if ($timeout > 9) { |
|
| 214 | - continue; |
|
| 215 | - } |
|
| 216 | - else{ |
|
| 217 | - $corporationDetails = corpDetails($corporationID); |
|
| 218 | - $timeout++; |
|
| 219 | - } |
|
| 220 | - } |
|
| 221 | - $allianceID = @$corporationDetails['alliance_id']; |
|
| 222 | - //check if user authed based on standings |
|
| 223 | - $standings = null; |
|
| 224 | - if ($role === 'blue' || 'neut' || 'red') { |
|
| 225 | - $allianceContacts = getContacts($allianceID); |
|
| 226 | - $corpContacts = getContacts($corporationID); |
|
| 227 | - if ($role === 'blue' && ((int) $allianceContacts['standing'] === 5 || 10 || (int) $corpContacts['standing'] === 5 || 10)) { |
|
| 228 | - $standings = 1; |
|
| 229 | - } |
|
| 230 | - if ($role === 'red' && ((int) $allianceContacts['standing'] === -5 || -10 || (int) $corpContacts['standing'] === -5 || -10)) { |
|
| 231 | - $standings = 1; |
|
| 232 | - } |
|
| 233 | - if ($role === 'neut' && ((int) $allianceContacts['standing'] === 0 || (int) $corpContacts['standing'] === 0 || (@(int) $allianceContacts['standings'] === null || '' && @(int) $corpContacts['standings'] === null || ''))) { |
|
| 234 | - $standings = 1; |
|
| 235 | - } |
|
| 236 | - } |
|
| 237 | - if (!in_array((int) $allianceID, $allianceArray) && !in_array((int) $corporationID, $corpArray) && null === $standings) { |
|
| 238 | - // Deactivate user in database |
|
| 239 | - $sql = "UPDATE authUsers SET active='no' WHERE discordID='$discordID'"; |
|
| 240 | - $this->logger->addInfo("AuthCheck: {$eveName} account has been deactivated as they are no longer in a correct corp/alliance."); |
|
| 241 | - $conn->query($sql); |
|
| 242 | - continue; |
|
| 243 | - } |
|
| 244 | - |
|
| 245 | - $nextCheck = time() + 10800; |
|
| 246 | - setPermCache('permsLastChecked', $nextCheck); |
|
| 247 | - } |
|
| 202 | + continue; |
|
| 203 | + } |
|
| 204 | + else{ |
|
| 205 | + $character = characterDetails($charID); |
|
| 206 | + $timeout++; |
|
| 207 | + } |
|
| 208 | + } |
|
| 209 | + $corporationID = $character['corporation_id']; |
|
| 210 | + $corporationDetails = corpDetails($corporationID); |
|
| 211 | + $timeout = 0; |
|
| 212 | + while (null === $corporationDetails) { //try 10 times to pull corporationDetails |
|
| 213 | + if ($timeout > 9) { |
|
| 214 | + continue; |
|
| 215 | + } |
|
| 216 | + else{ |
|
| 217 | + $corporationDetails = corpDetails($corporationID); |
|
| 218 | + $timeout++; |
|
| 219 | + } |
|
| 220 | + } |
|
| 221 | + $allianceID = @$corporationDetails['alliance_id']; |
|
| 222 | + //check if user authed based on standings |
|
| 223 | + $standings = null; |
|
| 224 | + if ($role === 'blue' || 'neut' || 'red') { |
|
| 225 | + $allianceContacts = getContacts($allianceID); |
|
| 226 | + $corpContacts = getContacts($corporationID); |
|
| 227 | + if ($role === 'blue' && ((int) $allianceContacts['standing'] === 5 || 10 || (int) $corpContacts['standing'] === 5 || 10)) { |
|
| 228 | + $standings = 1; |
|
| 229 | + } |
|
| 230 | + if ($role === 'red' && ((int) $allianceContacts['standing'] === -5 || -10 || (int) $corpContacts['standing'] === -5 || -10)) { |
|
| 231 | + $standings = 1; |
|
| 232 | + } |
|
| 233 | + if ($role === 'neut' && ((int) $allianceContacts['standing'] === 0 || (int) $corpContacts['standing'] === 0 || (@(int) $allianceContacts['standings'] === null || '' && @(int) $corpContacts['standings'] === null || ''))) { |
|
| 234 | + $standings = 1; |
|
| 235 | + } |
|
| 236 | + } |
|
| 237 | + if (!in_array((int) $allianceID, $allianceArray) && !in_array((int) $corporationID, $corpArray) && null === $standings) { |
|
| 238 | + // Deactivate user in database |
|
| 239 | + $sql = "UPDATE authUsers SET active='no' WHERE discordID='$discordID'"; |
|
| 240 | + $this->logger->addInfo("AuthCheck: {$eveName} account has been deactivated as they are no longer in a correct corp/alliance."); |
|
| 241 | + $conn->query($sql); |
|
| 242 | + continue; |
|
| 243 | + } |
|
| 244 | + |
|
| 245 | + $nextCheck = time() + 10800; |
|
| 246 | + setPermCache('permsLastChecked', $nextCheck); |
|
| 247 | + } |
|
| 248 | 248 | } |
| 249 | 249 | $nextCheck = time() + 10800; |
| 250 | 250 | setPermCache('permsLastChecked', $nextCheck); |
@@ -395,17 +395,17 @@ discard block |
||
| 395 | 395 | |
| 396 | 396 | //corp ticker |
| 397 | 397 | if ($this->corpTickers === 'true') { |
| 398 | - $timeout = 0; |
|
| 399 | - $character = characterDetails($charID); |
|
| 400 | - while (null === $character) { //try 10 times to pull characterDetails |
|
| 401 | - if ($timeout > 9) { |
|
| 402 | - continue; |
|
| 403 | - } |
|
| 404 | - else{ |
|
| 405 | - $character = characterDetails($charID); |
|
| 406 | - $timeout++; |
|
| 407 | - } |
|
| 408 | - } |
|
| 398 | + $timeout = 0; |
|
| 399 | + $character = characterDetails($charID); |
|
| 400 | + while (null === $character) { //try 10 times to pull characterDetails |
|
| 401 | + if ($timeout > 9) { |
|
| 402 | + continue; |
|
| 403 | + } |
|
| 404 | + else{ |
|
| 405 | + $character = characterDetails($charID); |
|
| 406 | + $timeout++; |
|
| 407 | + } |
|
| 408 | + } |
|
| 409 | 409 | if (!array_key_exists('corporation_id', $character)) { |
| 410 | 410 | continue; |
| 411 | 411 | } |