@@ -112,7 +112,7 @@ |
||
| 112 | 112 | $cacheClr = $baseUnix - 13500; |
| 113 | 113 | |
| 114 | 114 | //Set timer for next key based on number of keys |
| 115 | - $nextKey = (1900 / (int)$this->numberOfKeys) + time(); |
|
| 115 | + $nextKey = (1900 / (int) $this->numberOfKeys) + time(); |
|
| 116 | 116 | $nextKeyTime = gmdate('Y-m-d H:i:s', $nextKey); |
| 117 | 117 | setPermCache('mailLastChecked', $nextKey); |
| 118 | 118 | |
@@ -125,7 +125,7 @@ |
||
| 125 | 125 | $this->fuelChannel = $this->toDiscordChannel; |
| 126 | 126 | } |
| 127 | 127 | //Set timer for next key based on number of keys |
| 128 | - $nextKey = (1900 / (int)$this->numberOfKeys) + time(); |
|
| 128 | + $nextKey = (1900 / (int) $this->numberOfKeys) + time(); |
|
| 129 | 129 | $nextKeyTime = gmdate('Y-m-d H:i:s', $nextKey); |
| 130 | 130 | setPermCache('notificationsLastChecked', $nextKey); |
| 131 | 131 | //Set cache timer for api key |
@@ -71,7 +71,7 @@ |
||
| 71 | 71 | $roles = $member->roles; |
| 72 | 72 | foreach ($roles as $role) { |
| 73 | 73 | if (in_array(strtolower($role->name), $adminRoles, true)) { |
| 74 | - $avatarURL = strtolower((string)$data['messageString']); |
|
| 74 | + $avatarURL = strtolower((string) $data['messageString']); |
|
| 75 | 75 | $ch = curl_init($avatarURL); |
| 76 | 76 | if (substr($avatarURL, -4) === '.jpg') { |
| 77 | 77 | $fp = fopen('/tmp/avatar.jpg', 'wb'); |
@@ -25,80 +25,80 @@ |
||
| 25 | 25 | /** |
| 26 | 26 | * @property message |
| 27 | 27 | */ |
| 28 | - class motd { |
|
| 29 | - public $config; |
|
| 30 | - public $discord; |
|
| 31 | - public $logger; |
|
| 32 | - public $message; |
|
| 33 | - private $excludeChannel; |
|
| 34 | - private $triggers; |
|
| 35 | - public function init($config, $discord, $logger) { |
|
| 36 | - $this->config = $config; |
|
| 37 | - $this->discord = $discord; |
|
| 38 | - $this->logger = $logger; |
|
| 39 | - $this->excludeChannel = $this->config['bot']['restrictedChannels']; |
|
| 40 | - $this->triggers[] = $this->config['bot']['trigger'] . 'motd'; |
|
| 41 | - $this->triggers[] = $this->config['bot']['trigger'] . 'Motd'; |
|
| 42 | - $this->triggers[] = $this->config['bot']['trigger'] . 'MOTD'; |
|
| 43 | - $this->keyID = $config['plugins']['motd']['keyID']; |
|
| 44 | - $this->vCode = $config['plugins']['motd']['vCode']; |
|
| 45 | - $this->characterID = $config['plugins']['motd']['characterID']; |
|
| 46 | - $this->channelname = $config['plugins']['motd']['channelname']; |
|
| 47 | - } |
|
| 48 | - public function onMessage($msgData, $message) { |
|
| 49 | - $channelID = (int) $msgData['message']['channelID']; |
|
| 50 | - if (in_array($channelID, $this->excludeChannel, true)) { |
|
| 51 | - return null; |
|
| 52 | - } |
|
| 53 | - $this->message = $message; |
|
| 54 | - $user = $msgData['message']['from']; |
|
| 55 | - $message = $msgData['message']['message']; |
|
| 56 | - $data = command($message, $this->information() ['trigger'], $this->config['bot']['trigger']); |
|
| 57 | - if (isset($data['trigger'])) { |
|
| 58 | - $keyID = $this->keyID; |
|
| 59 | - $vCode = $this->vCode; |
|
| 60 | - $characterID = $this->characterID; |
|
| 61 | - $channelname = $this->channelname; |
|
| 28 | + class motd { |
|
| 29 | + public $config; |
|
| 30 | + public $discord; |
|
| 31 | + public $logger; |
|
| 32 | + public $message; |
|
| 33 | + private $excludeChannel; |
|
| 34 | + private $triggers; |
|
| 35 | + public function init($config, $discord, $logger) { |
|
| 36 | + $this->config = $config; |
|
| 37 | + $this->discord = $discord; |
|
| 38 | + $this->logger = $logger; |
|
| 39 | + $this->excludeChannel = $this->config['bot']['restrictedChannels']; |
|
| 40 | + $this->triggers[] = $this->config['bot']['trigger'] . 'motd'; |
|
| 41 | + $this->triggers[] = $this->config['bot']['trigger'] . 'Motd'; |
|
| 42 | + $this->triggers[] = $this->config['bot']['trigger'] . 'MOTD'; |
|
| 43 | + $this->keyID = $config['plugins']['motd']['keyID']; |
|
| 44 | + $this->vCode = $config['plugins']['motd']['vCode']; |
|
| 45 | + $this->characterID = $config['plugins']['motd']['characterID']; |
|
| 46 | + $this->channelname = $config['plugins']['motd']['channelname']; |
|
| 47 | + } |
|
| 48 | + public function onMessage($msgData, $message) { |
|
| 49 | + $channelID = (int) $msgData['message']['channelID']; |
|
| 50 | + if (in_array($channelID, $this->excludeChannel, true)) { |
|
| 51 | + return null; |
|
| 52 | + } |
|
| 53 | + $this->message = $message; |
|
| 54 | + $user = $msgData['message']['from']; |
|
| 55 | + $message = $msgData['message']['message']; |
|
| 56 | + $data = command($message, $this->information() ['trigger'], $this->config['bot']['trigger']); |
|
| 57 | + if (isset($data['trigger'])) { |
|
| 58 | + $keyID = $this->keyID; |
|
| 59 | + $vCode = $this->vCode; |
|
| 60 | + $characterID = $this->characterID; |
|
| 61 | + $channelname = $this->channelname; |
|
| 62 | 62 | |
| 63 | 63 | $urlChar = "https://api.eveonline.com/char/ChatChannels.xml.aspx?keyID=$keyID&vCode=$vCode&characterID=$characterID"; |
| 64 | - $data = file_get_contents($urlChar); |
|
| 65 | - $list = new SimpleXMLElement($data); |
|
| 64 | + $data = file_get_contents($urlChar); |
|
| 65 | + $list = new SimpleXMLElement($data); |
|
| 66 | 66 | |
| 67 | 67 | |
| 68 | - foreach ($list->result->rowset->row as $row) { |
|
| 69 | - $channeln = $row["displayName"]; |
|
| 68 | + foreach ($list->result->rowset->row as $row) { |
|
| 69 | + $channeln = $row["displayName"]; |
|
| 70 | 70 | |
| 71 | - if ($channeln == $channelname) { |
|
| 72 | - //scrub the motd, then break it into 1900 chars or less. Limit is 2000 and want to leave room for the name of the person being replied too |
|
| 73 | - $comment = $row["motd"]; |
|
| 74 | - $comment = str_replace("<BR>", "\n", $comment); |
|
| 75 | - $comment = str_replace("<br>", "\n", $comment); |
|
| 76 | - $comment = str_replace("<u>", "__", $comment); |
|
| 77 | - $comment = str_replace("</u>", "__", $comment); |
|
| 78 | - $comment = str_replace("<b>", "**", $comment); |
|
| 79 | - $comment = str_replace("</b>", "**", $comment); |
|
| 80 | - $comment = str_replace("<i>", "*", $comment); |
|
| 81 | - $comment = str_replace("</i>", "*", $comment); |
|
| 82 | - $comment = str_replace("&", "&", $comment); |
|
| 83 | - $comment = strip_tags($comment); |
|
| 84 | - $comment2 = str_split($comment, 1900); |
|
| 71 | + if ($channeln == $channelname) { |
|
| 72 | + //scrub the motd, then break it into 1900 chars or less. Limit is 2000 and want to leave room for the name of the person being replied too |
|
| 73 | + $comment = $row["motd"]; |
|
| 74 | + $comment = str_replace("<BR>", "\n", $comment); |
|
| 75 | + $comment = str_replace("<br>", "\n", $comment); |
|
| 76 | + $comment = str_replace("<u>", "__", $comment); |
|
| 77 | + $comment = str_replace("</u>", "__", $comment); |
|
| 78 | + $comment = str_replace("<b>", "**", $comment); |
|
| 79 | + $comment = str_replace("</b>", "**", $comment); |
|
| 80 | + $comment = str_replace("<i>", "*", $comment); |
|
| 81 | + $comment = str_replace("</i>", "*", $comment); |
|
| 82 | + $comment = str_replace("&", "&", $comment); |
|
| 83 | + $comment = strip_tags($comment); |
|
| 84 | + $comment2 = str_split($comment, 1900); |
|
| 85 | 85 | |
| 86 | - $this->message->reply("\n $comment2[0]"); |
|
| 87 | - if (!empty($comment2[1])) { |
|
| 88 | - $this->message->reply("\n $comment2[1]"); |
|
| 89 | - } |
|
| 90 | - if (!empty($comment2[2])) { |
|
| 91 | - $this->message->reply("\n $comment2[2]"); |
|
| 92 | - } |
|
| 93 | - if (!empty($comment2[3])) { |
|
| 94 | - $this->message->reply("\n $comment2[3]"); |
|
| 95 | - } |
|
| 96 | - } |
|
| 97 | - } |
|
| 98 | - } |
|
| 99 | - } |
|
| 100 | - public function information() { |
|
| 86 | + $this->message->reply("\n $comment2[0]"); |
|
| 87 | + if (!empty($comment2[1])) { |
|
| 88 | + $this->message->reply("\n $comment2[1]"); |
|
| 89 | + } |
|
| 90 | + if (!empty($comment2[2])) { |
|
| 91 | + $this->message->reply("\n $comment2[2]"); |
|
| 92 | + } |
|
| 93 | + if (!empty($comment2[3])) { |
|
| 94 | + $this->message->reply("\n $comment2[3]"); |
|
| 95 | + } |
|
| 96 | + } |
|
| 97 | + } |
|
| 98 | + } |
|
| 99 | + } |
|
| 100 | + public function information() { |
|
| 101 | 101 | return array('name' => 'motd', 'trigger' => $this->triggers, 'information' => 'Displays the MOTD, useful for seeing information displayed there when not in-game.'); |
| 102 | - } |
|
| 103 | - } |
|
| 102 | + } |
|
| 103 | + } |
|
| 104 | 104 | ?> |
@@ -57,8 +57,8 @@ |
||
| 57 | 57 | //Check we are not running on a 32bit platform |
| 58 | 58 | if(PHP_INT_SIZE == 4) |
| 59 | 59 | { |
| 60 | - $logger->error('32bit PHP found, if you are running a 64bit OS please install 64bit PHP'); |
|
| 61 | - die(); |
|
| 60 | + $logger->error('32bit PHP found, if you are running a 64bit OS please install 64bit PHP'); |
|
| 61 | + die(); |
|
| 62 | 62 | } |
| 63 | 63 | |
| 64 | 64 | // Require the config |
@@ -55,7 +55,7 @@ discard block |
||
| 55 | 55 | GLOBAL $logger; |
| 56 | 56 | |
| 57 | 57 | //Check we are not running on a 32bit platform |
| 58 | -if(PHP_INT_SIZE == 4) |
|
| 58 | +if (PHP_INT_SIZE == 4) |
|
| 59 | 59 | { |
| 60 | 60 | $logger->error('32bit PHP found, if you are running a 64bit OS please install 64bit PHP'); |
| 61 | 61 | die(); |
@@ -206,7 +206,7 @@ discard block |
||
| 206 | 206 | clearQueuedMessages($id); |
| 207 | 207 | continue; |
| 208 | 208 | } |
| 209 | - $channel = $guild->channels->get('id', (int)$queuedMessage['channel']); |
|
| 209 | + $channel = $guild->channels->get('id', (int) $queuedMessage['channel']); |
|
| 210 | 210 | //Check if channel is bad |
| 211 | 211 | if (null === $channel) { |
| 212 | 212 | $logger->addInfo("QueueProcessing Error- Item #{$id} : Channel provided is incorrect, removing it from the queue"); |
@@ -197,7 +197,7 @@ |
||
| 197 | 197 | if ($i < 10) { |
| 198 | 198 | $killID = $kill['killID']; |
| 199 | 199 | //check if mail is old |
| 200 | - if ((int)$killID <= (int)$oldID) { |
|
| 200 | + if ((int) $killID <= (int) $oldID) { |
|
| 201 | 201 | continue; |
| 202 | 202 | } |
| 203 | 203 | //save highest killID for cache |
@@ -146,7 +146,7 @@ discard block |
||
| 146 | 146 | $conn = new mysqli($this->db, $this->dbUser, $this->dbPass, $this->dbName); |
| 147 | 147 | |
| 148 | 148 | //$sql = "SELECT characterID, discordID, eveName, role FROM authUsers WHERE active='yes'"; |
| 149 | - $sql = "SELECT characterID, discordID, eveName, active, role FROM authUsers"; |
|
| 149 | + $sql = "SELECT characterID, discordID, eveName, active, role FROM authUsers"; |
|
| 150 | 150 | |
| 151 | 151 | $result = $conn->query($sql); |
| 152 | 152 | |
@@ -175,130 +175,130 @@ discard block |
||
| 175 | 175 | |
| 176 | 176 | if ($result->num_rows >= 1) { |
| 177 | 177 | while ($rows = $result->fetch_assoc()) { |
| 178 | - $charID = $rows['characterID']; |
|
| 179 | - $discordID = $rows['discordID']; |
|
| 180 | - $role = $rows['role']; |
|
| 181 | - $member = $guild->members->get('id', $discordID); |
|
| 182 | - $eveName = $rows['eveName']; |
|
| 183 | - //Check if member has roles |
|
| 184 | - if (null === @$member->roles) { |
|
| 185 | - continue; |
|
| 186 | - } |
|
| 187 | - |
|
| 188 | - //Auth things |
|
| 189 | - $character = characterDetails($charID); |
|
| 190 | - //if issue with esi, skip |
|
| 191 | - $timeout = 0; |
|
| 192 | - while (null === $character) { //try 10 times to pull characterDetails |
|
| 193 | - if ($timeout > 9) { |
|
| 194 | - continue; |
|
| 195 | - } |
|
| 196 | - else{ |
|
| 197 | - $character = characterDetails($charID); |
|
| 198 | - $timeout++; |
|
| 199 | - } |
|
| 200 | - } |
|
| 201 | - $corporationID = $character['corporation_id']; |
|
| 202 | - $corporationDetails = corpDetails($corporationID); |
|
| 203 | - $timeout = 0; |
|
| 204 | - while (null === $corporationDetails) { //try 10 times to pull corporationDetails |
|
| 205 | - if ($timeout > 9) { |
|
| 206 | - continue; |
|
| 207 | - } |
|
| 208 | - else{ |
|
| 209 | - $corporationDetails = corpDetails($corporationID); |
|
| 210 | - $timeout++; |
|
| 211 | - } |
|
| 212 | - } |
|
| 213 | - $allianceID = @$corporationDetails['alliance_id']; |
|
| 214 | - if ($rows['active'] == "yes"){ |
|
| 215 | - |
|
| 216 | - //check if user authed based on standings |
|
| 217 | - $standings = null; |
|
| 218 | - if ($role === 'blue' || 'neut' || 'red') { |
|
| 219 | - $allianceContacts = getContacts($allianceID); |
|
| 220 | - $corpContacts = getContacts($corporationID); |
|
| 221 | - if ($role === 'blue' && ((int) $allianceContacts['standing'] === 5 || 10 || (int) $corpContacts['standing'] === 5 || 10)) { |
|
| 222 | - $standings = 1; |
|
| 223 | - } |
|
| 224 | - if ($role === 'red' && ((int) $allianceContacts['standing'] === -5 || -10 || (int) $corpContacts['standing'] === -5 || -10)) { |
|
| 225 | - $standings = 1; |
|
| 226 | - } |
|
| 227 | - if ($role === 'neut' && ((int) $allianceContacts['standing'] === 0 || (int) $corpContacts['standing'] === 0 || (@(int) $allianceContacts['standings'] === null || '' && @(int) $corpContacts['standings'] === null || ''))) { |
|
| 228 | - $standings = 1; |
|
| 229 | - } |
|
| 230 | - } |
|
| 231 | - if (!in_array((int) $allianceID, $allianceArray) && !in_array((int) $corporationID, $corpArray) && null === $standings) { |
|
| 232 | - // Deactivate user in database |
|
| 233 | - $sql = "UPDATE authUsers SET active='no' WHERE discordID='$discordID'"; |
|
| 234 | - $this->logger->addInfo("AuthCheck: {$eveName} account has been deactivated as they are no longer in a correct corp/alliance."); |
|
| 235 | - $conn->query($sql); |
|
| 236 | - continue; |
|
| 237 | - } |
|
| 238 | - } |
|
| 239 | - elseif($rows['active'] == "no") { |
|
| 240 | - $roles = @$guild->roles; |
|
| 241 | - $member = @$guild->members->get('id', $discordID); |
|
| 242 | - if (in_array((int) $allianceID, $allianceArray) || in_array((int) $corporationID, $corpArray)) { |
|
| 243 | - foreach ($this->authGroups as $authGroup) { |
|
| 244 | - //Check if it's set to match corp and alliance |
|
| 245 | - if ($authGroup['corpID'] !== 0 && $authGroup['allianceID'] !== 0) { |
|
| 246 | - //Check if corpID matches |
|
| 247 | - if ($corpID === $authGroup['corpID'] && $allianceID === $authGroup['allianceID']) { |
|
| 248 | - foreach ($roles as $role) { |
|
| 249 | - if ((string) $role->name === (string) $authGroup['corpMemberRole']) { |
|
| 250 | - $member->addRole($role); |
|
| 251 | - } |
|
| 252 | - if ((string) $role->name === (string) $authGroup['allyMemberRole']) { |
|
| 253 | - $member->addRole($role); |
|
| 254 | - $role = 'corp/ally'; |
|
| 255 | - $guild->members->save($member); |
|
| 256 | - // Deactivate user in database |
|
| 257 | - $sql = "UPDATE authUsers SET active='yes' WHERE discordID='$discordID'"; |
|
| 258 | - $this->logger->addInfo("AuthCheck: {$eveName} account has been activates as they are in correct corp/alliance."); |
|
| 259 | - $conn->query($sql); |
|
| 260 | - } |
|
| 261 | - } |
|
| 262 | - break; |
|
| 263 | - } |
|
| 264 | - } elseif ($authGroup['corpID'] !== 0 || $authGroup['allianceID'] !== 0) { |
|
| 265 | - //Check if corpID matches |
|
| 266 | - if ($corpID === $authGroup['corpID']) { |
|
| 267 | - foreach ($roles as $role) { |
|
| 268 | - if ((string) $role->name === (string) $authGroup['corpMemberRole']) { |
|
| 269 | - $member->addRole($role); |
|
| 270 | - $role = 'corp'; |
|
| 271 | - $guild->members->save($member); |
|
| 272 | - // Deactivate user in database |
|
| 273 | - $sql = "UPDATE authUsers SET active='yes' WHERE discordID='$discordID'"; |
|
| 274 | - $this->logger->addInfo("AuthCheck: {$eveName} account has been deactivated as they are in correct corp/alliance."); |
|
| 275 | - $conn->query($sql); |
|
| 276 | - } |
|
| 277 | - } |
|
| 278 | - break; |
|
| 279 | - } |
|
| 280 | - //Check if allianceID matches |
|
| 281 | - if ($allianceID === $authGroup['allianceID'] && $authGroup['allianceID'] !== 0) { |
|
| 282 | - foreach ($roles as $role) { |
|
| 283 | - if ((string) $role->name === (string) $authGroup['allyMemberRole']) { |
|
| 284 | - $member->addRole($role); |
|
| 285 | - $role = 'ally'; |
|
| 286 | - $guild->members->save($member); |
|
| 287 | - // Deactivate user in database |
|
| 288 | - $sql = "UPDATE authUsers SET active='yes' WHERE discordID='$discordID'"; |
|
| 289 | - $this->logger->addInfo("AuthCheck: {$eveName} account has been deactivated as they are in correct corp/alliance."); |
|
| 290 | - $conn->query($sql); |
|
| 291 | - } |
|
| 292 | - } |
|
| 293 | - break; |
|
| 294 | - } |
|
| 295 | - } |
|
| 296 | - } |
|
| 297 | - } |
|
| 298 | - } |
|
| 299 | - $nextCheck = time() + 10800; |
|
| 300 | - setPermCache('permsLastChecked', $nextCheck); |
|
| 301 | - } |
|
| 178 | + $charID = $rows['characterID']; |
|
| 179 | + $discordID = $rows['discordID']; |
|
| 180 | + $role = $rows['role']; |
|
| 181 | + $member = $guild->members->get('id', $discordID); |
|
| 182 | + $eveName = $rows['eveName']; |
|
| 183 | + //Check if member has roles |
|
| 184 | + if (null === @$member->roles) { |
|
| 185 | + continue; |
|
| 186 | + } |
|
| 187 | + |
|
| 188 | + //Auth things |
|
| 189 | + $character = characterDetails($charID); |
|
| 190 | + //if issue with esi, skip |
|
| 191 | + $timeout = 0; |
|
| 192 | + while (null === $character) { //try 10 times to pull characterDetails |
|
| 193 | + if ($timeout > 9) { |
|
| 194 | + continue; |
|
| 195 | + } |
|
| 196 | + else{ |
|
| 197 | + $character = characterDetails($charID); |
|
| 198 | + $timeout++; |
|
| 199 | + } |
|
| 200 | + } |
|
| 201 | + $corporationID = $character['corporation_id']; |
|
| 202 | + $corporationDetails = corpDetails($corporationID); |
|
| 203 | + $timeout = 0; |
|
| 204 | + while (null === $corporationDetails) { //try 10 times to pull corporationDetails |
|
| 205 | + if ($timeout > 9) { |
|
| 206 | + continue; |
|
| 207 | + } |
|
| 208 | + else{ |
|
| 209 | + $corporationDetails = corpDetails($corporationID); |
|
| 210 | + $timeout++; |
|
| 211 | + } |
|
| 212 | + } |
|
| 213 | + $allianceID = @$corporationDetails['alliance_id']; |
|
| 214 | + if ($rows['active'] == "yes"){ |
|
| 215 | + |
|
| 216 | + //check if user authed based on standings |
|
| 217 | + $standings = null; |
|
| 218 | + if ($role === 'blue' || 'neut' || 'red') { |
|
| 219 | + $allianceContacts = getContacts($allianceID); |
|
| 220 | + $corpContacts = getContacts($corporationID); |
|
| 221 | + if ($role === 'blue' && ((int) $allianceContacts['standing'] === 5 || 10 || (int) $corpContacts['standing'] === 5 || 10)) { |
|
| 222 | + $standings = 1; |
|
| 223 | + } |
|
| 224 | + if ($role === 'red' && ((int) $allianceContacts['standing'] === -5 || -10 || (int) $corpContacts['standing'] === -5 || -10)) { |
|
| 225 | + $standings = 1; |
|
| 226 | + } |
|
| 227 | + if ($role === 'neut' && ((int) $allianceContacts['standing'] === 0 || (int) $corpContacts['standing'] === 0 || (@(int) $allianceContacts['standings'] === null || '' && @(int) $corpContacts['standings'] === null || ''))) { |
|
| 228 | + $standings = 1; |
|
| 229 | + } |
|
| 230 | + } |
|
| 231 | + if (!in_array((int) $allianceID, $allianceArray) && !in_array((int) $corporationID, $corpArray) && null === $standings) { |
|
| 232 | + // Deactivate user in database |
|
| 233 | + $sql = "UPDATE authUsers SET active='no' WHERE discordID='$discordID'"; |
|
| 234 | + $this->logger->addInfo("AuthCheck: {$eveName} account has been deactivated as they are no longer in a correct corp/alliance."); |
|
| 235 | + $conn->query($sql); |
|
| 236 | + continue; |
|
| 237 | + } |
|
| 238 | + } |
|
| 239 | + elseif($rows['active'] == "no") { |
|
| 240 | + $roles = @$guild->roles; |
|
| 241 | + $member = @$guild->members->get('id', $discordID); |
|
| 242 | + if (in_array((int) $allianceID, $allianceArray) || in_array((int) $corporationID, $corpArray)) { |
|
| 243 | + foreach ($this->authGroups as $authGroup) { |
|
| 244 | + //Check if it's set to match corp and alliance |
|
| 245 | + if ($authGroup['corpID'] !== 0 && $authGroup['allianceID'] !== 0) { |
|
| 246 | + //Check if corpID matches |
|
| 247 | + if ($corpID === $authGroup['corpID'] && $allianceID === $authGroup['allianceID']) { |
|
| 248 | + foreach ($roles as $role) { |
|
| 249 | + if ((string) $role->name === (string) $authGroup['corpMemberRole']) { |
|
| 250 | + $member->addRole($role); |
|
| 251 | + } |
|
| 252 | + if ((string) $role->name === (string) $authGroup['allyMemberRole']) { |
|
| 253 | + $member->addRole($role); |
|
| 254 | + $role = 'corp/ally'; |
|
| 255 | + $guild->members->save($member); |
|
| 256 | + // Deactivate user in database |
|
| 257 | + $sql = "UPDATE authUsers SET active='yes' WHERE discordID='$discordID'"; |
|
| 258 | + $this->logger->addInfo("AuthCheck: {$eveName} account has been activates as they are in correct corp/alliance."); |
|
| 259 | + $conn->query($sql); |
|
| 260 | + } |
|
| 261 | + } |
|
| 262 | + break; |
|
| 263 | + } |
|
| 264 | + } elseif ($authGroup['corpID'] !== 0 || $authGroup['allianceID'] !== 0) { |
|
| 265 | + //Check if corpID matches |
|
| 266 | + if ($corpID === $authGroup['corpID']) { |
|
| 267 | + foreach ($roles as $role) { |
|
| 268 | + if ((string) $role->name === (string) $authGroup['corpMemberRole']) { |
|
| 269 | + $member->addRole($role); |
|
| 270 | + $role = 'corp'; |
|
| 271 | + $guild->members->save($member); |
|
| 272 | + // Deactivate user in database |
|
| 273 | + $sql = "UPDATE authUsers SET active='yes' WHERE discordID='$discordID'"; |
|
| 274 | + $this->logger->addInfo("AuthCheck: {$eveName} account has been deactivated as they are in correct corp/alliance."); |
|
| 275 | + $conn->query($sql); |
|
| 276 | + } |
|
| 277 | + } |
|
| 278 | + break; |
|
| 279 | + } |
|
| 280 | + //Check if allianceID matches |
|
| 281 | + if ($allianceID === $authGroup['allianceID'] && $authGroup['allianceID'] !== 0) { |
|
| 282 | + foreach ($roles as $role) { |
|
| 283 | + if ((string) $role->name === (string) $authGroup['allyMemberRole']) { |
|
| 284 | + $member->addRole($role); |
|
| 285 | + $role = 'ally'; |
|
| 286 | + $guild->members->save($member); |
|
| 287 | + // Deactivate user in database |
|
| 288 | + $sql = "UPDATE authUsers SET active='yes' WHERE discordID='$discordID'"; |
|
| 289 | + $this->logger->addInfo("AuthCheck: {$eveName} account has been deactivated as they are in correct corp/alliance."); |
|
| 290 | + $conn->query($sql); |
|
| 291 | + } |
|
| 292 | + } |
|
| 293 | + break; |
|
| 294 | + } |
|
| 295 | + } |
|
| 296 | + } |
|
| 297 | + } |
|
| 298 | + } |
|
| 299 | + $nextCheck = time() + 10800; |
|
| 300 | + setPermCache('permsLastChecked', $nextCheck); |
|
| 301 | + } |
|
| 302 | 302 | } |
| 303 | 303 | $nextCheck = time() + 10800; |
| 304 | 304 | setPermCache('permsLastChecked', $nextCheck); |
@@ -449,17 +449,17 @@ discard block |
||
| 449 | 449 | |
| 450 | 450 | //corp ticker |
| 451 | 451 | if ($this->corpTickers === 'true') { |
| 452 | - $timeout = 0; |
|
| 453 | - $character = characterDetails($charID); |
|
| 454 | - while (null === $character) { //try 10 times to pull characterDetails |
|
| 455 | - if ($timeout > 9) { |
|
| 456 | - continue; |
|
| 457 | - } |
|
| 458 | - else{ |
|
| 459 | - $character = characterDetails($charID); |
|
| 460 | - $timeout++; |
|
| 461 | - } |
|
| 462 | - } |
|
| 452 | + $timeout = 0; |
|
| 453 | + $character = characterDetails($charID); |
|
| 454 | + while (null === $character) { //try 10 times to pull characterDetails |
|
| 455 | + if ($timeout > 9) { |
|
| 456 | + continue; |
|
| 457 | + } |
|
| 458 | + else{ |
|
| 459 | + $character = characterDetails($charID); |
|
| 460 | + $timeout++; |
|
| 461 | + } |
|
| 462 | + } |
|
| 463 | 463 | if (!array_key_exists('corporation_id', $character)) { |
| 464 | 464 | continue; |
| 465 | 465 | } |
@@ -193,7 +193,7 @@ discard block |
||
| 193 | 193 | if ($timeout > 9) { |
| 194 | 194 | continue; |
| 195 | 195 | } |
| 196 | - else{ |
|
| 196 | + else { |
|
| 197 | 197 | $character = characterDetails($charID); |
| 198 | 198 | $timeout++; |
| 199 | 199 | } |
@@ -205,13 +205,13 @@ discard block |
||
| 205 | 205 | if ($timeout > 9) { |
| 206 | 206 | continue; |
| 207 | 207 | } |
| 208 | - else{ |
|
| 208 | + else { |
|
| 209 | 209 | $corporationDetails = corpDetails($corporationID); |
| 210 | 210 | $timeout++; |
| 211 | 211 | } |
| 212 | 212 | } |
| 213 | 213 | $allianceID = @$corporationDetails['alliance_id']; |
| 214 | - if ($rows['active'] == "yes"){ |
|
| 214 | + if ($rows['active'] == "yes") { |
|
| 215 | 215 | |
| 216 | 216 | //check if user authed based on standings |
| 217 | 217 | $standings = null; |
@@ -236,7 +236,7 @@ discard block |
||
| 236 | 236 | continue; |
| 237 | 237 | } |
| 238 | 238 | } |
| 239 | - elseif($rows['active'] == "no") { |
|
| 239 | + elseif ($rows['active'] == "no") { |
|
| 240 | 240 | $roles = @$guild->roles; |
| 241 | 241 | $member = @$guild->members->get('id', $discordID); |
| 242 | 242 | if (in_array((int) $allianceID, $allianceArray) || in_array((int) $corporationID, $corpArray)) { |
@@ -455,7 +455,7 @@ discard block |
||
| 455 | 455 | if ($timeout > 9) { |
| 456 | 456 | continue; |
| 457 | 457 | } |
| 458 | - else{ |
|
| 458 | + else { |
|
| 459 | 459 | $character = characterDetails($charID); |
| 460 | 460 | $timeout++; |
| 461 | 461 | } |
@@ -192,8 +192,7 @@ discard block |
||
| 192 | 192 | while (null === $character) { //try 10 times to pull characterDetails |
| 193 | 193 | if ($timeout > 9) { |
| 194 | 194 | continue; |
| 195 | - } |
|
| 196 | - else{ |
|
| 195 | + } else{ |
|
| 197 | 196 | $character = characterDetails($charID); |
| 198 | 197 | $timeout++; |
| 199 | 198 | } |
@@ -204,8 +203,7 @@ discard block |
||
| 204 | 203 | while (null === $corporationDetails) { //try 10 times to pull corporationDetails |
| 205 | 204 | if ($timeout > 9) { |
| 206 | 205 | continue; |
| 207 | - } |
|
| 208 | - else{ |
|
| 206 | + } else{ |
|
| 209 | 207 | $corporationDetails = corpDetails($corporationID); |
| 210 | 208 | $timeout++; |
| 211 | 209 | } |
@@ -235,8 +233,7 @@ discard block |
||
| 235 | 233 | $conn->query($sql); |
| 236 | 234 | continue; |
| 237 | 235 | } |
| 238 | - } |
|
| 239 | - elseif($rows['active'] == "no") { |
|
| 236 | + } elseif($rows['active'] == "no") { |
|
| 240 | 237 | $roles = @$guild->roles; |
| 241 | 238 | $member = @$guild->members->get('id', $discordID); |
| 242 | 239 | if (in_array((int) $allianceID, $allianceArray) || in_array((int) $corporationID, $corpArray)) { |
@@ -454,8 +451,7 @@ discard block |
||
| 454 | 451 | while (null === $character) { //try 10 times to pull characterDetails |
| 455 | 452 | if ($timeout > 9) { |
| 456 | 453 | continue; |
| 457 | - } |
|
| 458 | - else{ |
|
| 454 | + } else{ |
|
| 459 | 455 | $character = characterDetails($charID); |
| 460 | 456 | $timeout++; |
| 461 | 457 | } |