GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Completed
Push — master ( a5cd88...85bafa )
by Marco
02:37
created
contrib/mailClassifier/function.php 1 patch
Braces   +106 added lines, -72 removed lines patch added patch discarded remove patch
@@ -4,18 +4,21 @@  discard block
 block discarded – undo
4 4
 	$open='{'.$cf['mailhost'].':143/imap/novalidate-cert/authuser='.$cf['authuser'].'}';
5 5
         $m_mail = imap_open($open, $username, $cf['authpassword'], OP_READONLY)
6 6
                 or syslog (LOG_EMERG, $cf['user'].': Error in IMAP connection to <'.$cf['mailhost'].'>: ' . imap_last_error());
7
-        if ( !$m_mail ) exit(254);
7
+        if ( !$m_mail ) {
8
+        	exit(254);
9
+        }
8 10
 
9 11
 
10 12
         syslog (LOG_INFO,$cf['user'].': Successfully connected to <'.$cf['mailhost'].'>; Listing folders of account <'.$username.'>...');
11 13
         //get all folder
12 14
 	$list = imap_list($m_mail, $open, "*");
13 15
 	imap_close($m_mail);
14
-	if (is_array($list))
15
-		foreach ($list as $mbox)
16
+	if (is_array($list)) {
17
+			foreach ($list as $mbox)
16 18
 			$return[] = explode($open,$mbox,2)[1];
17
-	else
18
-		syslog (LOG_INFO,$cf['user'] . ': imap_list failed: ' . imap_last_error() );
19
+	} else {
20
+			syslog (LOG_INFO,$cf['user'] . ': imap_list failed: ' . imap_last_error() );
21
+	}
19 22
 	return $return;
20 23
 }
21 24
 
@@ -23,7 +26,9 @@  discard block
 block discarded – undo
23 26
 	$head=array();
24 27
 	$m_mail = imap_open('{'.$cf['mailhost'].':143/imap/novalidate-cert/authuser='.$cf['authuser'].'}'.$folder, $username,$cf['authpassword'], OP_READONLY)
25 28
         	or syslog (LOG_EMERG, $cf['user'].': Error in IMAP connection to <'.$cf['mailhost'].'>: ' . imap_last_error());
26
-	if ( !$m_mail ) exit(254);
29
+	if ( !$m_mail ) {
30
+		exit(254);
31
+	}
27 32
 		
28 33
 
29 34
 	syslog (LOG_INFO,$cf['user'].': Successfully connected to <'.$cf['mailhost'].">; Reading <$folder> messages of last ".$cf['oldestday'].' days on account <'.$username.'>...');
@@ -35,29 +40,36 @@  discard block
 block discarded – undo
35 40
 	// Order results starting from newest message
36 41
 	if ( empty($m_search) ) {
37 42
 		syslog (LOG_INFO,$cf['user'].": No suitable mail found in <$folder> folder.");
38
-	        if ( $ierr = imap_errors() )
39
-	                foreach ( $ierr as $thiserr )
43
+	        if ( $ierr = imap_errors() ) {
44
+	        	                foreach ( $ierr as $thiserr )
40 45
 	                        syslog (LOG_ERR, $cf['user'].": IMAP Error: $thiserr");
41
-	        if ( $ierr = imap_alerts() )
42
-	                foreach ( $ierr as $thiserr )
46
+	        }
47
+	        if ( $ierr = imap_alerts() ) {
48
+	        	                foreach ( $ierr as $thiserr )
43 49
 	                        syslog (LOG_ALERT, $cf['user'].": IMAP Alert: $thiserr");
50
+	        }
44 51
 		imap_close( $m_mail );
45 52
 		return FALSE;
46 53
 	}
47 54
 	$nmes = count ($m_search);
48 55
 	syslog (LOG_INFO,$cf['user'].": Found $nmes mail in <$folder> folder.");
49
-	if ($nmes>0) rsort($m_search);
56
+	if ($nmes>0) {
57
+		rsort($m_search);
58
+	}
50 59
 
51 60
         // loop for each message
52
-	foreach ($m_search as $onem) 
53
-		$head[] = imap_fetchheader($m_mail, $onem );
61
+	foreach ($m_search as $onem) {
62
+			$head[] = imap_fetchheader($m_mail, $onem );
63
+	}
54 64
 	imap_close($m_mail);
55 65
 	return $head;
56 66
 }
57 67
 
58 68
 function dspamLevel($prob, $conf) {
59 69
 /* Calculate DSPAM Level as the Spamassassin Plugin */
60
-	if (is_null($prob) or is_null($conf)) return '-';
70
+	if (is_null($prob) or is_null($conf)) {
71
+		return '-';
72
+	}
61 73
 	$t_prob = abs((($prob - 0.5) * 2) * 100);
62 74
 	return round(($t_prob + ($conf*100)) / 2);
63 75
 }
@@ -112,7 +124,9 @@  discard block
 block discarded – undo
112 124
 		}
113 125
         }
114 126
 	$received=NULL;
115
-	if ($k>1) $result['warn'][] = 'The trusted DMARC AR Headers are present more than once. Something wrong.';
127
+	if ($k>1) {
128
+		$result['warn'][] = 'The trusted DMARC AR Headers are present more than once. Something wrong.';
129
+	}
116 130
 
117 131
         if ( preg_match_all('/^Authentication\-Results:\s+(?<host>[\w\.]+);(?:\s+|\r\n\s+)spf=(?<spf>\w+)\s+smtp\.(?:mailfrom|helo)=(?<SPFfrom>[\w\.]+)/m',$header,$received) ) {
118 132
 		$k=0;
@@ -128,7 +142,9 @@  discard block
 block discarded – undo
128 142
         	}
129 143
 	}
130 144
 	$received=NULL;
131
-	if ($k>1) $result['warn'][] = 'The trusted SPF AR Headers are present more than once. Something wrong.';
145
+	if ($k>1) {
146
+		$result['warn'][] = 'The trusted SPF AR Headers are present more than once. Something wrong.';
147
+	}
132 148
 
133 149
         if ( preg_match_all('/^Authentication\-Results:\s+(?<host>[\w\.]+);(?:\s+|\r\n\s+)dkim=(?<dkim>\w+)\s+[\w\s\(\)\-]+header\.d=(?<DKIMdom>[\w\.]+)/m',$header,$received) ) {
134 150
 		$k=0;
@@ -144,7 +160,9 @@  discard block
 block discarded – undo
144 160
         	}
145 161
 	}
146 162
 	$received=NULL;
147
-	if ($k>1) $result['warn'][] = 'The trusted DKIM AR Headers are present more than once. Something wrong.';
163
+	if ($k>1) {
164
+		$result['warn'][] = 'The trusted DKIM AR Headers are present more than once. Something wrong.';
165
+	}
148 166
 
149 167
 	if ($dpl) { /* Use Spamassassin Plugin */
150 168
 		if ( preg_match_all('/^X\-Spam\-Status:\s(?P<spamstatus>\w+)\,(?:\s+|\r\n\s+)score=(?P<score>[\-\.\d]+)(?:\s+|\r\n\s+)tagged_above=\-{0,1}\d+(?:\s+|\r\n\s+)required=(?P<th>[\-\.\d]+)(?:\s+|\r\n\s+)tests=\[(?:.|\r\n\s+)*DSPAM_(?P<dtype>SPAM|HAM)_(?P<dlevel>\d\d)(?:.|\r\n\s+)*\]/m',$header,$received) ) {
@@ -154,57 +172,66 @@  discard block
 block discarded – undo
154 172
 			$result['dspam']['type'] = $received['dtype'][0];
155 173
 			$result['dspam']['level'] =$received['dlevel'][0];
156 174
         	}
157
-        	if (count($received[0])>1) $result['warn'][] = 'The Spamassassin Headers are present more than once. I consider only the last one.';
158
-	}
159
-	else { /* Parse apart all DSPAM Header and calculate a level */
175
+        	if (count($received[0])>1) {
176
+        		$result['warn'][] = 'The Spamassassin Headers are present more than once. I consider only the last one.';
177
+        	}
178
+	} else { /* Parse apart all DSPAM Header and calculate a level */
160 179
 		if ( preg_match_all('/^X\-Spam\-Status:\s(?P<spamstatus>\w+)\,(?:\s+|\r\n\s+)score=(?P<score>[\-\.\d]+)(?:\s+|\r\n\s+)tagged_above=\-{0,1}\d+(?:\s+|\r\n\s+)required=(?P<th>[\-\.\d]+)(?:\s+|\r\n\s+)tests=\[(?:.|\r\n\s+)*\]/m',$header,$received) ) {
161 180
                         $result['spam']['status']=$received['spamstatus'][0];
162 181
                         $result['spam']['score'] = $received['score'][0];
163 182
                         $result['spam']['th'] = $received['th'][0];
164
-			if (count($received[0])>1)
165
-				$result['warn'][]= 'The Spamassassin Headers are present more than once. I consider only the last one.';
183
+			if (count($received[0])>1) {
184
+							$result['warn'][]= 'The Spamassassin Headers are present more than once. I consider only the last one.';
185
+			}
166 186
 		}
167
-		if ( preg_match ('/\r\nX\-DSPAM\-Result:\s(?P<result>.*)\r\n/',$header,$received) != 1)
168
-	                $result['warn'] = 'DSPAM Result invalid, not present or present more than once.';
169
-	        else
170
-                	$result['dspam']['type']=$received['result'];
187
+		if ( preg_match ('/\r\nX\-DSPAM\-Result:\s(?P<result>.*)\r\n/',$header,$received) != 1) {
188
+			                $result['warn'] = 'DSPAM Result invalid, not present or present more than once.';
189
+		} else {
190
+	                        	$result['dspam']['type']=$received['result'];
191
+	        }
171 192
 		$prob = NULL;
172 193
 		$conf = NULL;
173
-                if ( preg_match ('/\r\nX\-DSPAM\-Probability:\s(?P<prob>.*)\r\n/',$header,$received) != 1)
174
-                        $result['warn'][] = 'DSPAM Probability invalid, not present or present more than once.';
175
-		else
176
-			$prob = $received['prob'];
177
-		if ( preg_match ('/\r\nX\-DSPAM\-Confidence:\s(?P<conf>.*)\r\n/',$header,$received) != 1)
178
-                        $result['warn'][] = 'DSPAM Confidence invalid, not present or present more than once.';
179
-		else
180
-			$conf = $received['conf'];
194
+                if ( preg_match ('/\r\nX\-DSPAM\-Probability:\s(?P<prob>.*)\r\n/',$header,$received) != 1) {
195
+                                        $result['warn'][] = 'DSPAM Probability invalid, not present or present more than once.';
196
+                } else {
197
+					$prob = $received['prob'];
198
+		}
199
+		if ( preg_match ('/\r\nX\-DSPAM\-Confidence:\s(?P<conf>.*)\r\n/',$header,$received) != 1) {
200
+		                        $result['warn'][] = 'DSPAM Confidence invalid, not present or present more than once.';
201
+		} else {
202
+					$conf = $received['conf'];
203
+		}
181 204
 		$result['dspam']['level'] = dspamLevel($prob,$conf);
182 205
 	}
183 206
 	$received=NULL;
184
-	if ( preg_match ('/\r\nFrom:\s(?P<from>.*)\r\n/',$header,$received) != 1)
185
-                $result['warn'][] = 'From header invalid or not present';
186
-        else
187
-                $result['from'] = $received['from'];
207
+	if ( preg_match ('/\r\nFrom:\s(?P<from>.*)\r\n/',$header,$received) != 1) {
208
+	                $result['warn'][] = 'From header invalid or not present';
209
+	} else {
210
+                        $result['from'] = $received['from'];
211
+        }
188 212
 
189
-        if ( preg_match ('/\r\nDate:\s(?P<date>.*)\r\n/',$header,$received) != 1)
190
-                $result['warn'][] = 'Date header invalid or not present';
191
-	else
192
-		$result['date'] = $received['date'];
213
+        if ( preg_match ('/\r\nDate:\s(?P<date>.*)\r\n/',$header,$received) != 1) {
214
+                        $result['warn'][] = 'Date header invalid or not present';
215
+        } else {
216
+			$result['date'] = $received['date'];
217
+	}
193 218
 
194 219
 	$received=NULL;
195
-        if ( preg_match ('/\r\nMessage\-I(?:D|d):\s(?P<mid>.*)\r\n/',$header,$received) != 1)
196
-                $result['warn'][] = 'Message-ID invalid, not present or present more than once.';
197
-	else
198
-		$result['messageid']=$received['mid'];
220
+        if ( preg_match ('/\r\nMessage\-I(?:D|d):\s(?P<mid>.*)\r\n/',$header,$received) != 1) {
221
+                        $result['warn'][] = 'Message-ID invalid, not present or present more than once.';
222
+        } else {
223
+			$result['messageid']=$received['mid'];
224
+	}
199 225
 
200 226
         $received=NULL;
201 227
 
202 228
         switch ($learn) {
203 229
 		case 'dspamc':
204
-        		if ( preg_match ('/\r\nX\-DSPAM\-Signature:\s(?P<sig>.*)\r\n/',$header,$received) != 1)
205
-				$result['warn'] = 'DSPAM Signature invalid, not present or present more than once.';
206
-			else
207
-				$result['dspam']['learn']=$received['sig'];			
230
+        		if ( preg_match ('/\r\nX\-DSPAM\-Signature:\s(?P<sig>.*)\r\n/',$header,$received) != 1) {
231
+        						$result['warn'] = 'DSPAM Signature invalid, not present or present more than once.';
232
+        		} else {
233
+							$result['dspam']['learn']=$received['sig'];
234
+			}
208 235
 			break;
209 236
 		case false:
210 237
 			break;
@@ -239,8 +266,9 @@  discard block
 block discarded – undo
239 266
 	for ($i=0; $i<$cols; $i++) {
240 267
 		$key = $kcontent[$i];
241 268
 		if (is_array($content[$key])&&($hs = array_keys($content[$key]))) {
242
-			foreach ($hs as $h)
243
-				printf('<th>%s</th>',$h);
269
+			foreach ($hs as $h) {
270
+							printf('<th>%s</th>',$h);
271
+			}
244 272
 		}
245 273
 	}
246 274
 		
@@ -256,15 +284,16 @@  discard block
 block discarded – undo
256 284
 
257 285
 function formatVal($val, $learn) {
258 286
 	foreach (array_keys($val) as $key) {
259
-		if (is_array($val["$key"]) and ($key!='warn'))
260
-			$val["$key"] = formatVal($val["$key"], $learn);
261
-		else {
287
+		if (is_array($val["$key"]) and ($key!='warn')) {
288
+					$val["$key"] = formatVal($val["$key"], $learn);
289
+		} else {
262 290
 			switch ($key) {
263 291
 				case 'warn':
264
-					if (empty($val["$key"]))
265
-						$val["$key"] = '-';
266
-					else 
267
-						$val["$key"] = sprintf('<div title="%s">Y</div>',implode($val["$key"],"\n"));
292
+					if (empty($val["$key"])) {
293
+											$val["$key"] = '-';
294
+					} else {
295
+											$val["$key"] = sprintf('<div title="%s">Y</div>',implode($val["$key"],"\n"));
296
+					}
268 297
 					break;
269 298
 				case 'learn':
270 299
 					$val["$key"] = formLearn($learn, $val);
@@ -286,9 +315,10 @@  discard block
 block discarded – undo
286 315
 				$par['class'] = $class;
287 316
 				$val["$class"] = sprintf('dspamc --user dspam --deliver=summary --class=%s --source=error --signature=%s',
288 317
 							strtolower($class), $par['learn']);
289
-				if (($class != $par['type'])||($par['level']<99))
290
-					$return .= sprintf(file_get_contents('formLearnDSPAM.htm'),
318
+				if (($class != $par['type'])||($par['level']<99)) {
319
+									$return .= sprintf(file_get_contents('formLearnDSPAM.htm'),
291 320
 						$class,$class,$val["$class"],base64_encode(json_encode($par)),$class);
321
+				}
292 322
 			}
293 323
 		default:
294 324
 			return $return;
@@ -299,37 +329,41 @@  discard block
 block discarded – undo
299 329
 function printTableRow($row, $learn, $init=true) {
300 330
 	$bg = NULL;
301 331
 	$color = 'inherit';
302
-	if ($init) 
303
-		$row=formatVal($row,$learn);
332
+	if ($init) {
333
+			$row=formatVal($row,$learn);
334
+	}
304 335
 	foreach( $row as $key => $val) {
305
-		if (is_array($val))
306
-			printTableRow($val, $learn, false);
307
-		else {
336
+		if (is_array($val)) {
337
+					printTableRow($val, $learn, false);
338
+		} else {
308 339
 			/* DSPAM format */
309
-			if (isset($row['type']))
310
-				switch($row['type']) {
340
+			if (isset($row['type'])) {
341
+							switch($row['type']) {
311 342
 					case 'Innocent':
312 343
 					case 'HAM':
313 344
 						$color = 'rgba(0,255,0, %.1f)';
345
+			}
314 346
 						break;
315 347
 					case 'Spam':
316 348
 					case 'SPAM':
317 349
 						$color = 'rgba(255,0,0,%.1f)';
318 350
 			}
319 351
 			/* DMARC, DKIM, SPF format */
320
-			if (isset($row['result']))
321
-				switch($row['result']) {
352
+			if (isset($row['result'])) {
353
+							switch($row['result']) {
322 354
 					case 'pass':
323 355
 						$color = 'rgba(0,255,0, %.1f)';
356
+			}
324 357
 						break;
325 358
 					case 'fail':
326 359
 						$color = 'rgba(255,0,0,%.1f)';
327 360
 				}
328 361
 			/* Spamassassin format */
329
-			if (isset($row['status']))
330
-	                        switch($row['status']) {
362
+			if (isset($row['status'])) {
363
+				                        switch($row['status']) {
331 364
 					case 'No':
332 365
 						$color = 'rgba(0,255,0, %.1f)';
366
+			}
333 367
 						break;
334 368
 					case 'Yes':
335 369
 						$color = 'rgba(255,0,0,%.1f)';
Please login to merge, or discard this patch.
contrib/mailClassifier/list.php 1 patch
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -13,10 +13,11 @@
 block discarded – undo
13 13
 $conf['imap']['user'] = username();
14 14
 $folders=imapFolder($conf['imap'], $_POST['username']);
15 15
 print '<option  value="" selected disabled>Choose a folder</option>';
16
-foreach ( $folders as $folder )
16
+foreach ( $folders as $folder ) {
17 17
         printf('<option  value="%s">%s</option>',
18 18
 		$folder,
19 19
 		htmlspecialchars(mb_convert_encoding($folder, "UTF-8", "UTF7-IMAP")));
20
+}
20 21
 closelog();
21 22
 ?>
22 23
 </select>
Please login to merge, or discard this patch.
contrib/mailClassifier/result.php 1 patch
Braces   +7 added lines, -2 removed lines patch added patch discarded remove patch
@@ -55,10 +55,15 @@
 block discarded – undo
55 55
                 'warn' => NULL
56 56
 );
57 57
 
58
-if (empty($folder)) exit ('<p>No folder found.</p>'); /* This should not occur */
58
+if (empty($folder)) {
59
+	exit ('<p>No folder found.</p>');
60
+}
61
+/* This should not occur */
59 62
 $confimap['user'] = $username;
60 63
 $headers = imapFind($confimap, $account, $folder);
61
-if (empty($headers)) exit (sprintf('<p>No suitable mail found in <b>%s</b> folder.</p>', htmlentities("<$folder>")));
64
+if (empty($headers)) {
65
+	exit (sprintf('<p>No suitable mail found in <b>%s</b> folder.</p>', htmlentities("<$folder>")));
66
+}
62 67
 print '<table>';
63 68
 printTableHeader($folder,$data,TRUE,sprintf('Found %d suitable mails.',count($headers)));
64 69
 
Please login to merge, or discard this patch.
contrib/mailClassifier/index.php 1 patch
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -26,8 +26,9 @@
 block discarded – undo
26 26
 $user = username();
27 27
 $isAdmin = in_array($user,array_keys($admins));
28 28
 $canChange = ($isAdmin) ? '' : 'readonly';
29
-if ( $require_auth )
29
+if ( $require_auth ) {
30 30
 	if ( $user == 'unknown' ) exit ("<p>You MUST configure your server to use authentication.</p>");
31
+}
31 32
 
32 33
 
33 34
 print <<<END
Please login to merge, or discard this patch.