Passed
Branch master (b6f4c9)
by
unknown
03:07
created
src/plugins/onMessage/motd.php 1 patch
Indentation   +69 added lines, -69 removed lines patch added patch discarded remove patch
@@ -25,80 +25,80 @@
 block discarded – undo
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("&amp;", "&", $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("&amp;", "&", $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
 ?>
Please login to merge, or discard this patch.
Dramiel.php 1 patch
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -57,8 +57,8 @@
 block discarded – undo
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
Please login to merge, or discard this patch.
src/plugins/onTick/getKillmailsRedis.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -153,7 +153,7 @@
 block discarded – undo
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
 
Please login to merge, or discard this patch.
src/plugins/onTick/rssReader.php 1 patch
Indentation   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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)) {
Please login to merge, or discard this patch.
src/plugins/onTick/getKillmails.php 1 patch
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -115,7 +115,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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) {
Please login to merge, or discard this patch.
src/plugins/onMessage/sysInfo.php 2 patches
Unused Use Statements   -2 removed lines patch added patch discarded remove patch
@@ -1,7 +1,5 @@
 block discarded – undo
1 1
 <?php
2 2
 
3
-use Discord\Discord;
4
-
5 3
 class sysInfo
6 4
 {
7 5
 	public $config;
Please login to merge, or discard this patch.
Indentation   +113 added lines, -113 removed lines patch added patch discarded remove patch
@@ -4,93 +4,93 @@  discard block
 block discarded – undo
4 4
 
5 5
 class sysInfo
6 6
 {
7
-	public $config;
8
-	public $discord;
9
-	public $logger;
10
-	private $excludeChannel;
11
-	private $message;
12
-	private $triggers;
13
-
14
-	public function init($config, $discord, $logger)
15
-	{
16
-		$this->config = $config;
17
-		$this->discord = $discord;
18
-		$this->logger = $logger;
19
-		$this->excludeChannel = $this->config['bot']['restrictedChannels'];
20
-		$this->triggers[] = $this->config['bot']['trigger'] . 'sys';
21
-		$this->triggers[] = $this->config['bot']['trigger'] . 'Sys';
22
-		$this->triggers[] = $this->config['bot']['trigger'] . 'sysinfo';
23
-		$this->triggers[] = $this->config['bot']['trigger'] . 'system';
24
-		$this->triggers[] = $this->config['bot']['trigger'] . 'System';
25
-		$this->triggers[] = $this->config['bot']['trigger'] . 'Sysinfo';
26
-	}
27
-
28
-	public function onMessage($msgData, $message)
29
-	{
30
-		$channelID = (int) $msgData['message']['channelID'];
31
-
32
-		if(in_array($channelID, $this->excludeChannel, true))
33
-		{
34
-			return null;
35
-		}
36
-
37
-		$this->message = $message;
38
-
39
-		$message = $msgData['message']['message'];
40
-		$user = $msgData['message']['from'];
41
-
42
-		$data = command($message, $this->information()['trigger'], $this->config['bot']['trigger']);
43
-		if(isset($data['trigger']))
44
-		{
45
-			$messageString = strstr($data['messageString'], '@') ? str_replace('<@', '', str_replace('>', '', $data['messageString'])) : $data['messageString'];
46
-			if(is_numeric($messageString))
47
-			{
48
-				$messageString = dbQueryField('SELECT name FROM usersSeen WHERE id = :id', 'name', array(':id' => $messageString));
49
-			}
50
-			$cleanString = urlencode($messageString);
51
-			$sysID = urlencode(getSystemID($cleanString));
52
-
53
-			//Check if we get a system back, otherwise check for partials
54
-			if(empty($sysID))
55
-			{
56
-				$search = "http://tools.pandemic-legion.pl/api/search/{$cleanString}";
57
-				$search = json_decode(file_get_contents($search));
58
-				$tot = 0;
59
-				$res = array();
60
-				foreach ($search as $s){
61
-					if ($s->type == "system"){
62
-						$tot++;
63
-						$res[] = $s->name;
64
-					}
65
-				}
66
-				if ($tot == 0){
67
-					return $this->message->reply('**Error:** no data available');
68
-				}
69
-				if ($tot == 1){
70
-					$sysID = urlencode(getSystemID($res[0]));
71
-					if(empty($sysID)){
72
-						return $this->message->reply('**Error:** no data available');
73
-					}
74
-				}
75
-				if ($tot > 1){
76
-					$res = implode(", ",$res);
77
-					return $this->message->reply("**Error:** Did you mean one of these? {$res}");
78
-				}			
79
-			}
80
-
81
-			$systemDetails = systemDetails($sysID);
82
-			if (null === $systemDetails)
83
-			{
84
-				return $this->message->reply('**Error:** ESI is down. Try again later.');
85
-			}
86
-
87
-			$url = "https://zkillboard.com/api/stats/solarSystemID/{$sysID}/";
88
-			$json = json_decode(file_get_contents($url));
89
-
90
-			$regionID = $json->info->regionID;
91
-			$regionName = getRegionName($regionID);
92
-
93
-			$thisMonth = (string)date('Ym');
7
+    public $config;
8
+    public $discord;
9
+    public $logger;
10
+    private $excludeChannel;
11
+    private $message;
12
+    private $triggers;
13
+
14
+    public function init($config, $discord, $logger)
15
+    {
16
+        $this->config = $config;
17
+        $this->discord = $discord;
18
+        $this->logger = $logger;
19
+        $this->excludeChannel = $this->config['bot']['restrictedChannels'];
20
+        $this->triggers[] = $this->config['bot']['trigger'] . 'sys';
21
+        $this->triggers[] = $this->config['bot']['trigger'] . 'Sys';
22
+        $this->triggers[] = $this->config['bot']['trigger'] . 'sysinfo';
23
+        $this->triggers[] = $this->config['bot']['trigger'] . 'system';
24
+        $this->triggers[] = $this->config['bot']['trigger'] . 'System';
25
+        $this->triggers[] = $this->config['bot']['trigger'] . 'Sysinfo';
26
+    }
27
+
28
+    public function onMessage($msgData, $message)
29
+    {
30
+        $channelID = (int) $msgData['message']['channelID'];
31
+
32
+        if(in_array($channelID, $this->excludeChannel, true))
33
+        {
34
+            return null;
35
+        }
36
+
37
+        $this->message = $message;
38
+
39
+        $message = $msgData['message']['message'];
40
+        $user = $msgData['message']['from'];
41
+
42
+        $data = command($message, $this->information()['trigger'], $this->config['bot']['trigger']);
43
+        if(isset($data['trigger']))
44
+        {
45
+            $messageString = strstr($data['messageString'], '@') ? str_replace('<@', '', str_replace('>', '', $data['messageString'])) : $data['messageString'];
46
+            if(is_numeric($messageString))
47
+            {
48
+                $messageString = dbQueryField('SELECT name FROM usersSeen WHERE id = :id', 'name', array(':id' => $messageString));
49
+            }
50
+            $cleanString = urlencode($messageString);
51
+            $sysID = urlencode(getSystemID($cleanString));
52
+
53
+            //Check if we get a system back, otherwise check for partials
54
+            if(empty($sysID))
55
+            {
56
+                $search = "http://tools.pandemic-legion.pl/api/search/{$cleanString}";
57
+                $search = json_decode(file_get_contents($search));
58
+                $tot = 0;
59
+                $res = array();
60
+                foreach ($search as $s){
61
+                    if ($s->type == "system"){
62
+                        $tot++;
63
+                        $res[] = $s->name;
64
+                    }
65
+                }
66
+                if ($tot == 0){
67
+                    return $this->message->reply('**Error:** no data available');
68
+                }
69
+                if ($tot == 1){
70
+                    $sysID = urlencode(getSystemID($res[0]));
71
+                    if(empty($sysID)){
72
+                        return $this->message->reply('**Error:** no data available');
73
+                    }
74
+                }
75
+                if ($tot > 1){
76
+                    $res = implode(", ",$res);
77
+                    return $this->message->reply("**Error:** Did you mean one of these? {$res}");
78
+                }			
79
+            }
80
+
81
+            $systemDetails = systemDetails($sysID);
82
+            if (null === $systemDetails)
83
+            {
84
+                return $this->message->reply('**Error:** ESI is down. Try again later.');
85
+            }
86
+
87
+            $url = "https://zkillboard.com/api/stats/solarSystemID/{$sysID}/";
88
+            $json = json_decode(file_get_contents($url));
89
+
90
+            $regionID = $json->info->regionID;
91
+            $regionName = getRegionName($regionID);
92
+
93
+            $thisMonth = (string)date('Ym');
94 94
             $lastMonth = (string)date('Ym', strtotime('first day of previous month'));
95 95
 
96 96
             $thisMonthKill = $json->months->$thisMonth->shipsDestroyed;
@@ -100,21 +100,21 @@  discard block
 block discarded – undo
100 100
             $activeKills = $activePVP->kills->count;
101 101
             $activeChars = $activePVP->characters->count;
102 102
 
103
-			$sysName = $systemDetails['name'];
104
-			$secStatus = round($systemDetails['security_status'],2);
103
+            $sysName = $systemDetails['name'];
104
+            $secStatus = round($systemDetails['security_status'],2);
105 105
 
106
-			$npc = "https://api.eveonline.com/map/kills.xml.aspx";
107
-			$npc = new SimpleXMLElement(file_get_contents($npc));
108
-			foreach($npc->result->rowset->row as $row){
109
-				if($row->attributes()->solarSystemID == $sysID){
110
-					$npcKills = $row->attributes()->factionKills;
111
-					$podKills = $row->attributes()->podKills;
112
-				}
113
-			}
106
+            $npc = "https://api.eveonline.com/map/kills.xml.aspx";
107
+            $npc = new SimpleXMLElement(file_get_contents($npc));
108
+            foreach($npc->result->rowset->row as $row){
109
+                if($row->attributes()->solarSystemID == $sysID){
110
+                    $npcKills = $row->attributes()->factionKills;
111
+                    $podKills = $row->attributes()->podKills;
112
+                }
113
+            }
114 114
 
115
-			$url = "https://zkillboard.com/system/{$sysID}/";
115
+            $url = "https://zkillboard.com/system/{$sysID}/";
116 116
 
117
-			$msg = "```Systeminfo
117
+            $msg = "```Systeminfo
118 118
 Name: {$sysName} 
119 119
 Region: {$regionName}
120 120
 Security: {$secStatus}
@@ -131,18 +131,18 @@  discard block
 block discarded – undo
131 131
 ```
132 132
 
133 133
 More information: $url";
134
-			$this->logger->addInfo("sysInfo: Sending system information to {$user}");
135
-			$this->message->reply($msg);
136
-		}
137
-		return null;
138
-	}
139
-
140
-	public function information()
141
-	{
142
-		return array(
143
-			'name' => 'sys',
144
-			'trigger' => $this->triggers,
145
-			'information' => 'Returns information for the given system'
146
-			);
147
-	}
134
+            $this->logger->addInfo("sysInfo: Sending system information to {$user}");
135
+            $this->message->reply($msg);
136
+        }
137
+        return null;
138
+    }
139
+
140
+    public function information()
141
+    {
142
+        return array(
143
+            'name' => 'sys',
144
+            'trigger' => $this->triggers,
145
+            'information' => 'Returns information for the given system'
146
+            );
147
+    }
148 148
 }
Please login to merge, or discard this patch.