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
Spacing   +85 added lines, -87 removed lines patch added patch discarded remove patch
@@ -1,56 +1,56 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3 3
 function imapFolder($cf, $username) {
4
-	$open='{'.$cf['mailhost'].':143/imap/novalidate-cert/authuser='.$cf['authuser'].'}';
4
+	$open = '{'.$cf['mailhost'].':143/imap/novalidate-cert/authuser='.$cf['authuser'].'}';
5 5
         $m_mail = imap_open($open, $username, $cf['authpassword'], OP_READONLY)
6
-                or syslog (LOG_EMERG, $cf['user'].': Error in IMAP connection to <'.$cf['mailhost'].'>: ' . imap_last_error());
7
-        if ( !$m_mail ) exit(254);
6
+                or syslog(LOG_EMERG, $cf['user'].': Error in IMAP connection to <'.$cf['mailhost'].'>: '.imap_last_error());
7
+        if (!$m_mail) exit(254);
8 8
 
9 9
 
10
-        syslog (LOG_INFO,$cf['user'].': Successfully connected to <'.$cf['mailhost'].'>; Listing folders of account <'.$username.'>...');
10
+        syslog(LOG_INFO, $cf['user'].': Successfully connected to <'.$cf['mailhost'].'>; Listing folders of account <'.$username.'>...');
11 11
         //get all folder
12 12
 	$list = imap_list($m_mail, $open, "*");
13 13
 	imap_close($m_mail);
14 14
 	if (is_array($list))
15 15
 		foreach ($list as $mbox)
16
-			$return[] = explode($open,$mbox,2)[1];
16
+			$return[] = explode($open, $mbox, 2)[1];
17 17
 	else
18
-		syslog (LOG_INFO,$cf['user'] . ': imap_list failed: ' . imap_last_error() );
18
+		syslog(LOG_INFO, $cf['user'].': imap_list failed: '.imap_last_error());
19 19
 	return $return;
20 20
 }
21 21
 
22
-function imapFind ($cf, $username, $folder) {
23
-	$head=array();
24
-	$m_mail = imap_open('{'.$cf['mailhost'].':143/imap/novalidate-cert/authuser='.$cf['authuser'].'}'.$folder, $username,$cf['authpassword'], OP_READONLY)
25
-        	or syslog (LOG_EMERG, $cf['user'].': Error in IMAP connection to <'.$cf['mailhost'].'>: ' . imap_last_error());
26
-	if ( !$m_mail ) exit(254);
22
+function imapFind($cf, $username, $folder) {
23
+	$head = array();
24
+	$m_mail = imap_open('{'.$cf['mailhost'].':143/imap/novalidate-cert/authuser='.$cf['authuser'].'}'.$folder, $username, $cf['authpassword'], OP_READONLY)
25
+        	or syslog(LOG_EMERG, $cf['user'].': Error in IMAP connection to <'.$cf['mailhost'].'>: '.imap_last_error());
26
+	if (!$m_mail) exit(254);
27 27
 		
28 28
 
29
-	syslog (LOG_INFO,$cf['user'].': Successfully connected to <'.$cf['mailhost'].">; Reading <$folder> messages of last ".$cf['oldestday'].' days on account <'.$username.'>...');
29
+	syslog(LOG_INFO, $cf['user'].': Successfully connected to <'.$cf['mailhost'].">; Reading <$folder> messages of last ".$cf['oldestday'].' days on account <'.$username.'>...');
30 30
 	//get all messages
31
-	$dateTh = date ( "d-M-Y", strToTime ( '-'.$cf['oldestday'].' days' ) );
32
-	$m_search=imap_search ($m_mail, "SINCE \"$dateTh\" TEXT \"Authentication-Results: \"" );
31
+	$dateTh = date("d-M-Y", strToTime('-'.$cf['oldestday'].' days'));
32
+	$m_search = imap_search($m_mail, "SINCE \"$dateTh\" TEXT \"Authentication-Results: \"");
33 33
 
34 34
 
35 35
 	// Order results starting from newest message
36
-	if ( empty($m_search) ) {
37
-		syslog (LOG_INFO,$cf['user'].": No suitable mail found in <$folder> folder.");
38
-	        if ( $ierr = imap_errors() )
39
-	                foreach ( $ierr as $thiserr )
40
-	                        syslog (LOG_ERR, $cf['user'].": IMAP Error: $thiserr");
41
-	        if ( $ierr = imap_alerts() )
42
-	                foreach ( $ierr as $thiserr )
43
-	                        syslog (LOG_ALERT, $cf['user'].": IMAP Alert: $thiserr");
44
-		imap_close( $m_mail );
36
+	if (empty($m_search)) {
37
+		syslog(LOG_INFO, $cf['user'].": No suitable mail found in <$folder> folder.");
38
+	        if ($ierr = imap_errors())
39
+	                foreach ($ierr as $thiserr)
40
+	                        syslog(LOG_ERR, $cf['user'].": IMAP Error: $thiserr");
41
+	        if ($ierr = imap_alerts())
42
+	                foreach ($ierr as $thiserr)
43
+	                        syslog(LOG_ALERT, $cf['user'].": IMAP Alert: $thiserr");
44
+		imap_close($m_mail);
45 45
 		return FALSE;
46 46
 	}
47
-	$nmes = count ($m_search);
48
-	syslog (LOG_INFO,$cf['user'].": Found $nmes mail in <$folder> folder.");
47
+	$nmes = count($m_search);
48
+	syslog(LOG_INFO, $cf['user'].": Found $nmes mail in <$folder> folder.");
49 49
 	if ($nmes>0) rsort($m_search);
50 50
 
51 51
         // loop for each message
52 52
 	foreach ($m_search as $onem) 
53
-		$head[] = imap_fetchheader($m_mail, $onem );
53
+		$head[] = imap_fetchheader($m_mail, $onem);
54 54
 	imap_close($m_mail);
55 55
 	return $head;
56 56
 }
@@ -58,11 +58,11 @@  discard block
 block discarded – undo
58 58
 function dspamLevel($prob, $conf) {
59 59
 /* Calculate DSPAM Level as the Spamassassin Plugin */
60 60
 	if (is_null($prob) or is_null($conf)) return '-';
61
-	$t_prob = abs((($prob - 0.5) * 2) * 100);
62
-	return round(($t_prob + ($conf*100)) / 2);
61
+	$t_prob = abs((($prob-0.5) * 2) * 100);
62
+	return round(($t_prob+($conf * 100)) / 2);
63 63
 }
64 64
 
65
-function imapInfo($header,$ARhosts,$dpl=false, $learn=false) {
65
+function imapInfo($header, $ARhosts, $dpl = false, $learn = false) {
66 66
 /* Get relevant Info from header's mail */
67 67
 /* Each line must end with /r/n         */
68 68
 
@@ -98,118 +98,118 @@  discard block
 block discarded – undo
98 98
         );
99 99
 		
100 100
 
101
-        if ( preg_match_all ('/^Authentication\-Results:\s+(?<host>[\w\.]+);(?:\s+|\r\n\s+)dmarc=(?<dmarc>\w+)\s+\(p=\w+\s+dis=\w+\)\s+header\.from=(?<DMARCfrom>[\w\.]+)/m',$header,$received) ) {
102
-		$k=0;
103
-                for ($i = count($received[0])-1;$i>=0;$i--) {
101
+        if (preg_match_all('/^Authentication\-Results:\s+(?<host>[\w\.]+);(?:\s+|\r\n\s+)dmarc=(?<dmarc>\w+)\s+\(p=\w+\s+dis=\w+\)\s+header\.from=(?<DMARCfrom>[\w\.]+)/m', $header, $received)) {
102
+		$k = 0;
103
+                for ($i = count($received[0])-1; $i>=0; $i--) {
104 104
 	                foreach ($ARhosts as $mx) {
105 105
 				if ($mx == $received['host'][$i]) {
106 106
 					/* This is a trusted AR result */
107
-					$result['dmarc']['result']=$received['dmarc'][$i];
107
+					$result['dmarc']['result'] = $received['dmarc'][$i];
108 108
 					$result['dmarc']['dom'] = $received['DMARCfrom'][$i];
109 109
 					$k++;
110 110
 				}
111 111
                 	}
112 112
 		}
113 113
         }
114
-	$received=NULL;
114
+	$received = NULL;
115 115
 	if ($k>1) $result['warn'][] = 'The trusted DMARC AR Headers are present more than once. Something wrong.';
116 116
 
117
-        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
-		$k=0;
119
-		for ($i = count($received[0])-1;$i>=0;$i--) {
117
+        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
+		$k = 0;
119
+		for ($i = count($received[0])-1; $i>=0; $i--) {
120 120
 			foreach ($ARhosts as $mx) {
121 121
 				if ($mx == $received['host'][$i]) {
122 122
 					/* This is a trusted AR result */
123
-					$result['spf']['result']=$received['spf'][$i];
123
+					$result['spf']['result'] = $received['spf'][$i];
124 124
 					$result['spf']['dom'] = $received['SPFfrom'][$i];
125 125
 					$k++;
126 126
                         	}
127 127
                 	}
128 128
         	}
129 129
 	}
130
-	$received=NULL;
130
+	$received = NULL;
131 131
 	if ($k>1) $result['warn'][] = 'The trusted SPF AR Headers are present more than once. Something wrong.';
132 132
 
133
-        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
-		$k=0;
135
-		for ($i = count($received[0])-1;$i>=0;$i--) {
133
+        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
+		$k = 0;
135
+		for ($i = count($received[0])-1; $i>=0; $i--) {
136 136
 	                foreach ($ARhosts as $mx) {
137 137
         	                if ($mx == $received['host'][$i]) {
138 138
                 	                /* This is a trusted AR result */
139
-                        	        $result['dkim']['result']=$received['dkim'][$i];
139
+                        	        $result['dkim']['result'] = $received['dkim'][$i];
140 140
                                 	$result['dkim']['dom'] = $received['DKIMdom'][$i];
141 141
 					$k++;
142 142
                         	}
143 143
                 	}
144 144
         	}
145 145
 	}
146
-	$received=NULL;
146
+	$received = NULL;
147 147
 	if ($k>1) $result['warn'][] = 'The trusted DKIM AR Headers are present more than once. Something wrong.';
148 148
 
149 149
 	if ($dpl) { /* Use Spamassassin Plugin */
150
-		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) ) {
151
-			$result['spam']['status']=$received['spamstatus'][0];
150
+		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)) {
151
+			$result['spam']['status'] = $received['spamstatus'][0];
152 152
                 	$result['spam']['score'] = $received['score'][0];
153 153
 			$result['spam']['th'] = $received['th'][0];
154 154
 			$result['dspam']['type'] = $received['dtype'][0];
155
-			$result['dspam']['level'] =$received['dlevel'][0];
155
+			$result['dspam']['level'] = $received['dlevel'][0];
156 156
         	}
157 157
         	if (count($received[0])>1) $result['warn'][] = 'The Spamassassin Headers are present more than once. I consider only the last one.';
158 158
 	}
159 159
 	else { /* Parse apart all DSPAM Header and calculate a level */
160
-		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
-                        $result['spam']['status']=$received['spamstatus'][0];
160
+		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
+                        $result['spam']['status'] = $received['spamstatus'][0];
162 162
                         $result['spam']['score'] = $received['score'][0];
163 163
                         $result['spam']['th'] = $received['th'][0];
164 164
 			if (count($received[0])>1)
165
-				$result['warn'][]= 'The Spamassassin Headers are present more than once. I consider only the last one.';
165
+				$result['warn'][] = 'The Spamassassin Headers are present more than once. I consider only the last one.';
166 166
 		}
167
-		if ( preg_match ('/\r\nX\-DSPAM\-Result:\s(?P<result>.*)\r\n/',$header,$received) != 1)
167
+		if (preg_match('/\r\nX\-DSPAM\-Result:\s(?P<result>.*)\r\n/', $header, $received) != 1)
168 168
 	                $result['warn'] = 'DSPAM Result invalid, not present or present more than once.';
169 169
 	        else
170
-                	$result['dspam']['type']=$received['result'];
170
+                	$result['dspam']['type'] = $received['result'];
171 171
 		$prob = NULL;
172 172
 		$conf = NULL;
173
-                if ( preg_match ('/\r\nX\-DSPAM\-Probability:\s(?P<prob>.*)\r\n/',$header,$received) != 1)
173
+                if (preg_match('/\r\nX\-DSPAM\-Probability:\s(?P<prob>.*)\r\n/', $header, $received) != 1)
174 174
                         $result['warn'][] = 'DSPAM Probability invalid, not present or present more than once.';
175 175
 		else
176 176
 			$prob = $received['prob'];
177
-		if ( preg_match ('/\r\nX\-DSPAM\-Confidence:\s(?P<conf>.*)\r\n/',$header,$received) != 1)
177
+		if (preg_match('/\r\nX\-DSPAM\-Confidence:\s(?P<conf>.*)\r\n/', $header, $received) != 1)
178 178
                         $result['warn'][] = 'DSPAM Confidence invalid, not present or present more than once.';
179 179
 		else
180 180
 			$conf = $received['conf'];
181
-		$result['dspam']['level'] = dspamLevel($prob,$conf);
181
+		$result['dspam']['level'] = dspamLevel($prob, $conf);
182 182
 	}
183
-	$received=NULL;
184
-	if ( preg_match ('/\r\nFrom:\s(?P<from>.*)\r\n/',$header,$received) != 1)
183
+	$received = NULL;
184
+	if (preg_match('/\r\nFrom:\s(?P<from>.*)\r\n/', $header, $received) != 1)
185 185
                 $result['warn'][] = 'From header invalid or not present';
186 186
         else
187 187
                 $result['from'] = $received['from'];
188 188
 
189
-        if ( preg_match ('/\r\nDate:\s(?P<date>.*)\r\n/',$header,$received) != 1)
189
+        if (preg_match('/\r\nDate:\s(?P<date>.*)\r\n/', $header, $received) != 1)
190 190
                 $result['warn'][] = 'Date header invalid or not present';
191 191
 	else
192 192
 		$result['date'] = $received['date'];
193 193
 
194
-	$received=NULL;
195
-        if ( preg_match ('/\r\nMessage\-I(?:D|d):\s(?P<mid>.*)\r\n/',$header,$received) != 1)
194
+	$received = NULL;
195
+        if (preg_match('/\r\nMessage\-I(?:D|d):\s(?P<mid>.*)\r\n/', $header, $received) != 1)
196 196
                 $result['warn'][] = 'Message-ID invalid, not present or present more than once.';
197 197
 	else
198
-		$result['messageid']=$received['mid'];
198
+		$result['messageid'] = $received['mid'];
199 199
 
200
-        $received=NULL;
200
+        $received = NULL;
201 201
 
202 202
         switch ($learn) {
203 203
 		case 'dspamc':
204
-        		if ( preg_match ('/\r\nX\-DSPAM\-Signature:\s(?P<sig>.*)\r\n/',$header,$received) != 1)
204
+        		if (preg_match('/\r\nX\-DSPAM\-Signature:\s(?P<sig>.*)\r\n/', $header, $received) != 1)
205 205
 				$result['warn'] = 'DSPAM Signature invalid, not present or present more than once.';
206 206
 			else
207
-				$result['dspam']['learn']=$received['sig'];			
207
+				$result['dspam']['learn'] = $received['sig'];			
208 208
 			break;
209 209
 		case false:
210 210
 			break;
211 211
 		default:
212
-			syslog (LOG_INFO,$user.': Error in "learn" imap configuration value. Please, set "dspamc" or "false".');
212
+			syslog(LOG_INFO, $user.': Error in "learn" imap configuration value. Please, set "dspamc" or "false".');
213 213
 	}
214 214
 	
215 215
         return $result;
@@ -218,7 +218,7 @@  discard block
 block discarded – undo
218 218
 
219 219
 
220 220
 
221
-function printTableHeader($title,$content,$footer=FALSE,$fcontent) {
221
+function printTableHeader($title, $content, $footer = FALSE, $fcontent) {
222 222
         print <<<END
223 223
 	<caption>$title</caption>
224 224
 	<thead>
@@ -226,21 +226,19 @@  discard block
 block discarded – undo
226 226
 END;
227 227
 	$kcontent = array_keys($content);
228 228
         $cols = count($kcontent);
229
-        for ($i=0; $i<$cols; $i++) {
229
+        for ($i = 0; $i<$cols; $i++) {
230 230
 		$key = $kcontent[$i];
231
-                printf ('<th colspan="%d" rowspan="%d">%s</th>',
232
-			!is_array($content[$key]) ?:
233
-			count(array_keys($content[$key])) ?: '1',
234
-			!is_array($content[$key]) ?:
235
-			empty(array_keys($content[$key])) ? '2' : '1',
231
+                printf('<th colspan="%d" rowspan="%d">%s</th>',
232
+			!is_array($content[$key]) ?: count(array_keys($content[$key])) ?: '1',
233
+			!is_array($content[$key]) ?: empty(array_keys($content[$key])) ? '2' : '1',
236 234
 			$kcontent[$i]);
237 235
 	}
238 236
 	print '</tr><tr>';
239
-	for ($i=0; $i<$cols; $i++) {
237
+	for ($i = 0; $i<$cols; $i++) {
240 238
 		$key = $kcontent[$i];
241
-		if (is_array($content[$key])&&($hs = array_keys($content[$key]))) {
239
+		if (is_array($content[$key]) && ($hs = array_keys($content[$key]))) {
242 240
 			foreach ($hs as $h)
243
-				printf('<th>%s</th>',$h);
241
+				printf('<th>%s</th>', $h);
244 242
 		}
245 243
 	}
246 244
 		
@@ -256,7 +254,7 @@  discard block
 block discarded – undo
256 254
 
257 255
 function formatVal($val, $learn) {
258 256
 	foreach (array_keys($val) as $key) {
259
-		if (is_array($val["$key"]) and ($key!='warn'))
257
+		if (is_array($val["$key"]) and ($key != 'warn'))
260 258
 			$val["$key"] = formatVal($val["$key"], $learn);
261 259
 		else {
262 260
 			switch ($key) {
@@ -264,7 +262,7 @@  discard block
 block discarded – undo
264 262
 					if (empty($val["$key"]))
265 263
 						$val["$key"] = '-';
266 264
 					else 
267
-						$val["$key"] = sprintf('<div title="%s">Y</div>',implode($val["$key"],"\n"));
265
+						$val["$key"] = sprintf('<div title="%s">Y</div>', implode($val["$key"], "\n"));
268 266
 					break;
269 267
 				case 'learn':
270 268
 					$val["$key"] = formLearn($learn, $val);
@@ -286,9 +284,9 @@  discard block
 block discarded – undo
286 284
 				$par['class'] = $class;
287 285
 				$val["$class"] = sprintf('dspamc --user dspam --deliver=summary --class=%s --source=error --signature=%s',
288 286
 							strtolower($class), $par['learn']);
289
-				if (($class != $par['type'])||($par['level']<99))
287
+				if (($class != $par['type']) || ($par['level']<99))
290 288
 					$return .= sprintf(file_get_contents('formLearnDSPAM.htm'),
291
-						$class,$class,$val["$class"],base64_encode(json_encode($par)),$class);
289
+						$class, $class, $val["$class"], base64_encode(json_encode($par)), $class);
292 290
 			}
293 291
 		default:
294 292
 			return $return;
@@ -296,18 +294,18 @@  discard block
 block discarded – undo
296 294
 	return $return;
297 295
 }
298 296
 
299
-function printTableRow($row, $learn, $init=true) {
297
+function printTableRow($row, $learn, $init = true) {
300 298
 	$bg = NULL;
301 299
 	$color = 'inherit';
302 300
 	if ($init) 
303
-		$row=formatVal($row,$learn);
304
-	foreach( $row as $key => $val) {
301
+		$row = formatVal($row, $learn);
302
+	foreach ($row as $key => $val) {
305 303
 		if (is_array($val))
306 304
 			printTableRow($val, $learn, false);
307 305
 		else {
308 306
 			/* DSPAM format */
309 307
 			if (isset($row['type']))
310
-				switch($row['type']) {
308
+				switch ($row['type']) {
311 309
 					case 'Innocent':
312 310
 					case 'HAM':
313 311
 						$color = 'rgba(0,255,0, %.1f)';
@@ -318,7 +316,7 @@  discard block
 block discarded – undo
318 316
 			}
319 317
 			/* DMARC, DKIM, SPF format */
320 318
 			if (isset($row['result']))
321
-				switch($row['result']) {
319
+				switch ($row['result']) {
322 320
 					case 'pass':
323 321
 						$color = 'rgba(0,255,0, %.1f)';
324 322
 						break;
@@ -327,7 +325,7 @@  discard block
 block discarded – undo
327 325
 				}
328 326
 			/* Spamassassin format */
329 327
 			if (isset($row['status']))
330
-	                        switch($row['status']) {
328
+	                        switch ($row['status']) {
331 329
 					case 'No':
332 330
 						$color = 'rgba(0,255,0, %.1f)';
333 331
 						break;
@@ -335,9 +333,9 @@  discard block
 block discarded – undo
335 333
 						$color = 'rgba(255,0,0,%.1f)';
336 334
 				}	
337 335
 				
338
-			$alpha = (is_numeric($val)AND($key=='type')) ? round($val/100,1) : 1.0;
336
+			$alpha = (is_numeric($val) AND ($key == 'type')) ? round($val / 100, 1) : 1.0;
339 337
 			$bg = sprintf(" style=\"background-color: $color\"", $alpha);		
340
-			printf ('<td%s>%s</td>',$bg, $val);
338
+			printf('<td%s>%s</td>', $bg, $val);
341 339
 		}
342 340
 	}
343 341
 }
Please login to merge, or discard this patch.
contrib/mailClassifier/list.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <select name="folder" style="width:215px" onChange="xmlhttpPost('result.php', 'Classify', 'Result', '<img src=\'/include/pleasewait.gif\'>', true); return false;">
2 2
 <?php
3
-$path='/var/www/html/RBL/';
3
+$path = '/var/www/html/RBL/';
4 4
 require_once($path.'function.php');
5 5
 require_once($path.'config.php');
6 6
 require_once('function.php');
@@ -11,9 +11,9 @@  discard block
 block discarded – undo
11 11
 openlog($tag, LOG_PID, $fac);
12 12
 
13 13
 $conf['imap']['user'] = username();
14
-$folders=imapFolder($conf['imap'], $_POST['username']);
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")));
Please login to merge, or discard this patch.
contrib/mailClassifier/result.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-$path='/var/www/html/RBL/';
2
+$path = '/var/www/html/RBL/';
3 3
 include_once($path.'config.php');
4 4
 require_once($path.'function.php');
5 5
 
@@ -14,14 +14,14 @@  discard block
 block discarded – undo
14 14
 $tag .= $conf['syslog']['tag'];
15 15
 openlog($tag, LOG_PID, $fac);
16 16
 
17
-if ( $confimap['learn']=='dspamc' ) {
17
+if ($confimap['learn'] == 'dspamc') {
18 18
 	$cmd = escapeshellcmd('which dspamc');
19 19
 	$cmd = escapeshellcmd('which ls');
20
-	exec ( $cmd, $out, $ret );
20
+	exec($cmd, $out, $ret);
21 21
 	if ($ret != 0) {
22 22
 		$err = 'No DSPAM Client found on your system. Please, force your sysadmin to install "dspamc".';
23 23
 		syslog(LOG_ERR, $username.': Error: '.$err);
24
-		exit (sprintf('<p>%s</p>',htmlentities($err)));
24
+		exit (sprintf('<p>%s</p>', htmlentities($err)));
25 25
 	}
26 26
 }
27 27
 
@@ -60,10 +60,10 @@  discard block
 block discarded – undo
60 60
 $headers = imapFind($confimap, $account, $folder);
61 61
 if (empty($headers)) exit (sprintf('<p>No suitable mail found in <b>%s</b> folder.</p>', htmlentities("<$folder>")));
62 62
 print '<table>';
63
-printTableHeader($folder,$data,TRUE,sprintf('Found %d suitable mails.',count($headers)));
63
+printTableHeader($folder, $data, TRUE, sprintf('Found %d suitable mails.', count($headers)));
64 64
 
65
-foreach ( $headers AS $header ) {
66
-	$values = imapInfo($header,$conf['host']['ar'],$confimap['dspamtospamass'],$confimap['learn']);
65
+foreach ($headers AS $header) {
66
+	$values = imapInfo($header, $conf['host']['ar'], $confimap['dspamtospamass'], $confimap['learn']);
67 67
 	print '<tr>';
68 68
 	printTableRow($values, $confimap['learn']);
69 69
 	print '</tr>';
Please login to merge, or discard this patch.
contrib/mailClassifier/index.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -10,24 +10,24 @@
 block discarded – undo
10 10
 <body>
11 11
 <h1> Mail Classifier</h1> 
12 12
 <?php
13
-$path='/var/www/html/RBL/';
13
+$path = '/var/www/html/RBL/';
14 14
 require_once($path.'config.php');
15 15
 require_once($path.'function.php');
16 16
 require_once('function.php');
17 17
 
18
-if ( !isset($version) ) {
18
+if (!isset($version)) {
19 19
         openlog('mailClassifierEmergency', LOG_PID, LOG_LOCAL0);
20
-        syslog (LOG_EMERG, sprintf('unknown: I can\'t read the config files. Do you have configured the $path in %s?', __FILE__));
20
+        syslog(LOG_EMERG, sprintf('unknown: I can\'t read the config files. Do you have configured the $path in %s?', __FILE__));
21 21
         closelog();
22 22
         exit(255);
23 23
 }
24 24
 
25 25
 checkSSL();
26 26
 $user = username();
27
-$isAdmin = in_array($user,array_keys($admins));
27
+$isAdmin = in_array($user, array_keys($admins));
28 28
 $canChange = ($isAdmin) ? '' : 'readonly';
29
-if ( $require_auth )
30
-	if ( $user == 'unknown' ) exit ("<p>You MUST configure your server to use authentication.</p>");
29
+if ($require_auth)
30
+	if ($user == 'unknown') exit ("<p>You MUST configure your server to use authentication.</p>");
31 31
 
32 32
 
33 33
 print <<<END
Please login to merge, or discard this patch.
contrib/mailClassifier/learn.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -1,7 +1,7 @@  discard block
 block discarded – undo
1 1
 <div id="content">
2 2
 <h3>Log</h3>
3 3
 <?php
4
-$path='/var/www/html/RBL/';
4
+$path = '/var/www/html/RBL/';
5 5
 require_once($path.'function.php');
6 6
 require_once($path.'config.php');
7 7
 $conf = parse_ini_file('imap.conf', TRUE);
@@ -16,17 +16,17 @@  discard block
 block discarded – undo
16 16
 
17 17
 syslog(LOG_INFO, sprintf('%s: Learn as <%s> on signature: <%s>', $username, $par->class, $par->learn));
18 18
 $cmd = escapeshellcmd($_POST['cmd']);
19
-exec ( $cmd, $out, $ret );
19
+exec($cmd, $out, $ret);
20 20
 if ($ret != 0) {
21 21
 	$err = 'DSPAM Client returns a bad exit state. Sorry, probably the learn was successful, but I don\'t know...';
22 22
 	syslog(LOG_ERR, $username.': Learn Error: '.$err);	
23
-	exit (sprintf('<p>%s</p>',htmlentities($err)));
23
+	exit (sprintf('<p>%s</p>', htmlentities($err)));
24 24
 }
25
-syslog(LOG_INFO,'%s: Learn result: "%s"',$username, $out[0]);  
26
-if ( preg_match ('/^X-DSPAM-Result:\s+(?P<user>[\w\.\@]+);\s+result="(?P<result>\w+)";\s+class="(?P<class>\w+)";\s+probability=(?P<prob>[\d\.]+);\s+confidence=(?P<conf>[\d\.]+);\s+signature=(?P<sig>[\w\,]+)$/',$out[0],$received) != 1) {
25
+syslog(LOG_INFO, '%s: Learn result: "%s"', $username, $out[0]);  
26
+if (preg_match('/^X-DSPAM-Result:\s+(?P<user>[\w\.\@]+);\s+result="(?P<result>\w+)";\s+class="(?P<class>\w+)";\s+probability=(?P<prob>[\d\.]+);\s+confidence=(?P<conf>[\d\.]+);\s+signature=(?P<sig>[\w\,]+)$/', $out[0], $received) != 1) {
27 27
 		$err = 'DSPAM Client returned an unparseable result.';
28 28
 		syslog(LOG_ERR, $username.': Learn Error: '.$err);
29
-                exit (sprintf('<p>%s</p>',htmlentities($err)));
29
+                exit (sprintf('<p>%s</p>', htmlentities($err)));
30 30
 }
31 31
 
32 32
 printf('<p>Message learned successfully with following result:</p><ul><li>Owner: <b>%s</b></li><li>Result: <b>%s</b></li><li>Class: <b>%s</b></li></ul>',
Please login to merge, or discard this patch.