@@ -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"); |
@@ -229,12 +229,16 @@ |
||
| 229 | 229 | //CORP INFO |
| 230 | 230 | /** |
| 231 | 231 | * @param string $corpName |
| 232 | + * @param integer $corpID |
|
| 232 | 233 | */ |
| 233 | 234 | function addCorpInfo($corpID, $corpTicker, $corpName) |
| 234 | 235 | { |
| 235 | 236 | dbExecute('REPLACE INTO corpCache (`corpID`, `corpTicker`, `corpName`) VALUES (:corpID,:corpTicker,:corpName)', array(':corpID' => $corpID, ':corpTicker' => $corpTicker, ':corpName' => $corpName)); |
| 236 | 237 | } |
| 237 | 238 | |
| 239 | +/** |
|
| 240 | + * @param integer $corpID |
|
| 241 | + */ |
|
| 238 | 242 | function getCorpInfo($corpID) |
| 239 | 243 | { |
| 240 | 244 | return dbQueryRow('SELECT * FROM corpCache WHERE `corpID` = :corpID', array(':corpID' => $corpID)); |
@@ -153,7 +153,7 @@ |
||
| 153 | 153 | } elseif (in_array((int) $kmGroup['allianceID'], $attackerAllianceArray) && (int) $kmGroup['allianceID'] !== 0) { |
| 154 | 154 | $allianceKill = true; |
| 155 | 155 | } else { |
| 156 | - //if it wasn't any of these continue in case there is another group to process |
|
| 156 | + //if it wasn't any of these continue in case there is another group to process |
|
| 157 | 157 | continue; |
| 158 | 158 | } |
| 159 | 159 | |
@@ -38,7 +38,7 @@ discard block |
||
| 38 | 38 | public $itemTitle; |
| 39 | 39 | public $itemUrl; |
| 40 | 40 | public $itemDate; |
| 41 | - public $strDate; |
|
| 41 | + public $strDate; |
|
| 42 | 42 | |
| 43 | 43 | /** |
| 44 | 44 | * @param $config |
@@ -91,15 +91,15 @@ discard block |
||
| 91 | 91 | } |
| 92 | 92 | |
| 93 | 93 | $rss = new SimpleXMLElement($rssUrl, null, true); // XML parser |
| 94 | - if ($rss===null || !is_object($rss)) { |
|
| 95 | - $this->logger->addInfo("Failed to load xml file: {$rssUrl}"); |
|
| 96 | - break; |
|
| 97 | - } |
|
| 98 | - if (!is_object($rss->feed)) { |
|
| 99 | - $this->logger->addInfo("Feed is not an object at: {$rssUrl}"); |
|
| 100 | - break; |
|
| 101 | - } |
|
| 102 | - $feedLink = $rss->feed->id; |
|
| 94 | + if ($rss===null || !is_object($rss)) { |
|
| 95 | + $this->logger->addInfo("Failed to load xml file: {$rssUrl}"); |
|
| 96 | + break; |
|
| 97 | + } |
|
| 98 | + if (!is_object($rss->feed)) { |
|
| 99 | + $this->logger->addInfo("Feed is not an object at: {$rssUrl}"); |
|
| 100 | + break; |
|
| 101 | + } |
|
| 102 | + $feedLink = $rss->feed->id; |
|
| 103 | 103 | $latestTopicDate = getPermCache("rssFeed{$feedLink}"); |
| 104 | 104 | |
| 105 | 105 | //Check if feed has been checked before |
@@ -114,7 +114,7 @@ discard block |
||
| 114 | 114 | $itemUrl = $rss->entry->id; |
| 115 | 115 | $strDate = $rss->entry->published; |
| 116 | 116 | |
| 117 | - $itemDate = strtotime($strDate); |
|
| 117 | + $itemDate = strtotime($strDate); |
|
| 118 | 118 | |
| 119 | 119 | //Check to see if feed is formatted correctly |
| 120 | 120 | if (is_null($itemTitle) || is_null($itemUrl) || is_null($itemDate)) { |
@@ -91,7 +91,7 @@ |
||
| 91 | 91 | } |
| 92 | 92 | |
| 93 | 93 | $rss = new SimpleXMLElement($rssUrl, null, true); // XML parser |
| 94 | - if ($rss===null || !is_object($rss)) { |
|
| 94 | + if ($rss === null || !is_object($rss)) { |
|
| 95 | 95 | $this->logger->addInfo("Failed to load xml file: {$rssUrl}"); |
| 96 | 96 | break; |
| 97 | 97 | } |
@@ -115,7 +115,7 @@ discard block |
||
| 115 | 115 | // $i = 0; |
| 116 | 116 | if (isset($kills)) { |
| 117 | 117 | foreach ($kills as $kill) { |
| 118 | - // if ($i < 10) { |
|
| 118 | + // if ($i < 10) { |
|
| 119 | 119 | //if big kill isn't set, disable it |
| 120 | 120 | if (!array_key_exists('bigKill', $kmGroup)) { |
| 121 | 121 | $kmGroup['bigKill'] = 99999999999999999999999999; |
@@ -201,7 +201,7 @@ discard block |
||
| 201 | 201 | if (isset($kills)) { |
| 202 | 202 | foreach ($kills as $kill) { |
| 203 | 203 | $cacheID = getPermCache('bigKillNewestKillmailID'); |
| 204 | - // if ($i < 10) { |
|
| 204 | + // if ($i < 10) { |
|
| 205 | 205 | $killID = $kill['killID']; |
| 206 | 206 | //check if mail is old |
| 207 | 207 | if ((int)$killID <= (int)$oldID) { |
@@ -93,16 +93,16 @@ discard block |
||
| 93 | 93 | if ($kmGroup['startMail'] > $SavedKillID || null === $SavedKillID) { |
| 94 | 94 | $SavedKillID = $kmGroup['startMail']; |
| 95 | 95 | } |
| 96 | - if ((string)$kmGroup['allianceID'] === '0' & $kmGroup['lossMails'] === 'true') { |
|
| 96 | + if ((string) $kmGroup['allianceID'] === '0' & $kmGroup['lossMails'] === 'true') { |
|
| 97 | 97 | $url = "https://zkillboard.com/api/corporationID/{$kmGroup['corpID']}/no-attackers/no-items/orderDirection/asc/pastSeconds/10800/"; |
| 98 | 98 | } |
| 99 | - if ((string)$kmGroup['allianceID'] === '0' & $kmGroup['lossMails'] === 'false') { |
|
| 99 | + if ((string) $kmGroup['allianceID'] === '0' & $kmGroup['lossMails'] === 'false') { |
|
| 100 | 100 | $url = "https://zkillboard.com/api/corporationID/{$kmGroup['corpID']}/no-attackers/no-items/kills/orderDirection/asc/pastSeconds/10800/"; |
| 101 | 101 | } |
| 102 | - if ((string)$kmGroup['allianceID'] !== '0' & $kmGroup['lossMails'] === 'true') { |
|
| 102 | + if ((string) $kmGroup['allianceID'] !== '0' & $kmGroup['lossMails'] === 'true') { |
|
| 103 | 103 | $url = "https://zkillboard.com/api/allianceID/{$kmGroup['allianceID']}/no-attackers/no-items/orderDirection/asc/pastSeconds/10800/"; |
| 104 | 104 | } |
| 105 | - if ((string)$kmGroup['allianceID'] !== '0' & $kmGroup['lossMails'] === 'false') { |
|
| 105 | + if ((string) $kmGroup['allianceID'] !== '0' & $kmGroup['lossMails'] === 'false') { |
|
| 106 | 106 | $url = "https://zkillboard.com/api/allianceID/{$kmGroup['allianceID']}/no-attackers/no-items/kills/orderDirection/asc/pastSeconds/10800/"; |
| 107 | 107 | } |
| 108 | 108 | |
@@ -204,7 +204,7 @@ discard block |
||
| 204 | 204 | // if ($i < 10) { |
| 205 | 205 | $killID = $kill['killID']; |
| 206 | 206 | //check if mail is old |
| 207 | - if ((int)$killID <= (int)$oldID) { |
|
| 207 | + if ((int) $killID <= (int) $oldID) { |
|
| 208 | 208 | continue; |
| 209 | 209 | } |
| 210 | 210 | //save highest killID for cache |