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
Branch master (69a36c)
by Marco
02:57
created
result.php 1 patch
Braces   +25 added lines, -15 removed lines patch added patch discarded remove patch
@@ -5,31 +5,38 @@  discard block
 block discarded – undo
5 5
 $net = new \dautkom\ipv4\IPv4();
6 6
 
7 7
 $_ = $_POST['genere'];
8
-if ( ($tables["$_"]['field']=='email') AND ($_POST['Value']!='ALL') )
8
+if ( ($tables["$_"]['field']=='email') AND ($_POST['Value']!='ALL') ) {
9 9
 	if (!(filter_var($_POST['Value'], FILTER_VALIDATE_EMAIL)))
10 10
 		exit ('<pre>&lt;'.$_POST['Value'].'&gt; is NOT a valid email address.</pre>');
11
+}
11 12
 
12
-if ( ($tables["$_"]['field']=='domain') AND ($_POST['Value']!='ALL') )
13
+if ( ($tables["$_"]['field']=='domain') AND ($_POST['Value']!='ALL') ) {
13 14
         if (!(filter_var(gethostbyname($_POST['Value']), FILTER_VALIDATE_IP)))
14 15
 		exit ('<pre>&lt;'.$_POST['Value'].'&gt; is NOT a valid domain.</pre>');
16
+}
15 17
 
16
-if ( ($tables["$_"]['field']=='ip')  AND ($_POST['Value']!='ALL') )
18
+if ( ($tables["$_"]['field']=='ip')  AND ($_POST['Value']!='ALL') ) {
17 19
 	if (!(filter_var($_POST['Value'], FILTER_VALIDATE_IP, FILTER_FLAG_IPV4)))
18 20
 		exit ('<pre>&lt;'.$_POST['Value'].'&gt; is NOT a valid IP address.</pre>');
21
+}
19 22
 	
20 23
 if ( ($tables["$_"]['field']=='network') AND ($_POST['Value']!='ALL') ) {
21 24
 	$value = explode('/',$_POST['Value']);
22
-	if (count($value) != 2)
23
-		exit ('<pre>&lt;'.$_POST['Value'].'&gt; is NOT a valid Network/Netmask pair.</pre>');
24
-	if (!$net->address($value[0])->mask($value[1])->isValid(1))
25
-		exit ('<pre>&lt;'.$_POST['Value'].'&gt; is NOT a valid Network/Netmask.</pre>');
26
-}
25
+	if (count($value) != 2) {
26
+			exit ('<pre>&lt;'.$_POST['Value'].'&gt; is NOT a valid Network/Netmask pair.</pre>');
27
+	}
28
+	if (!$net->address($value[0])->mask($value[1])->isValid(1)) {
29
+			exit ('<pre>&lt;'.$_POST['Value'].'&gt; is NOT a valid Network/Netmask.</pre>');
30
+	}
31
+	}
27 32
 
28 33
 if ( ($tables["$_"]['field']=='username') AND ($_POST['Value']!='ALL') ) {
29
-        if ( preg_match( '/[^\x20-\x7f]/', $_POST['Value']) )
30
-                exit('<pre>&lt;'.$_POST['Value'].'&gt; contains NON ASCII chars.</pre>');
31
-	if ( preg_match( '/[$~=#*+%,{}()\/\\<>;:\"`\[\]&?\s]/', $_POST['Value']) )
32
-		exit('<pre>&lt;'.$_POST['Value'].'&gt; contains invalid ASCII chars.</pre>');
34
+        if ( preg_match( '/[^\x20-\x7f]/', $_POST['Value']) ) {
35
+                        exit('<pre>&lt;'.$_POST['Value'].'&gt; contains NON ASCII chars.</pre>');
36
+        }
37
+	if ( preg_match( '/[$~=#*+%,{}()\/\\<>;:\"`\[\]&?\s]/', $_POST['Value']) ) {
38
+			exit('<pre>&lt;'.$_POST['Value'].'&gt; contains invalid ASCII chars.</pre>');
39
+	}
33 40
 	switch ( $_POST['Value'] ) {
34 41
 		case 'anonymous':
35 42
 		case 'anybody':
@@ -40,9 +47,12 @@  discard block
 block discarded – undo
40 47
 }	
41 48
 
42 49
 if (empty($_GET)) {
43
-	if ($tables["$_"]['bl']) print "<p><i>$_</i> is a blocklist of ".$tables["$_"]['field'].'.</p>';
44
-	else print "<p><i>$_</i> is a whitelist of ".$tables["$_"]['field'].'.</p>';
45
-}
50
+	if ($tables["$_"]['bl']) {
51
+		print "<p><i>$_</i> is a blocklist of ".$tables["$_"]['field'].'.</p>';
52
+	} else {
53
+		print "<p><i>$_</i> is a whitelist of ".$tables["$_"]['field'].'.</p>';
54
+	}
55
+	}
46 56
 
47 57
 openlog($tag, LOG_PID, $fac);
48 58
 $user = username();
Please login to merge, or discard this patch.
index.php 1 patch
Braces   +5 added lines, -2 removed lines patch added patch discarded remove patch
@@ -14,11 +14,14 @@
 block discarded – undo
14 14
 require_once('function.php');
15 15
 
16 16
 
17
-if ( $require_auth ) if ( username() == 'unknown' ) exit ("<p>You MUST configure your server to use authentication.</p>");
17
+if ( $require_auth ) {
18
+	if ( username() == 'unknown' ) exit ("<p>You MUST configure your server to use authentication.</p>");
19
+}
18 20
 
19 21
 
20
-if ( $imapListActive )
22
+if ( $imapListActive ) {
21 23
 	print ' <p style="text-align: right"><a href="/spamreport" target="_new">SPAM Learn Observer</a></p>';
24
+}
22 25
 
23 26
 print <<<END
24 27
 <form name="check" action="result.php" onSubmit="xmlhttpPost('result.php', 'check', 'Risultato', '<img src=\'/include/pleasewait.gif\'>'); return false;" enctype="text/plain" method="post" target="_self">
Please login to merge, or discard this patch.
function.php 1 patch
Braces   +84 added lines, -49 removed lines patch added patch discarded remove patch
@@ -3,9 +3,13 @@  discard block
 block discarded – undo
3 3
 $version='1.9d';
4 4
 
5 5
 function username() {
6
-	if (isset ($_SERVER['REMOTE_USER'])) $user = $_SERVER['REMOTE_USER'];
7
-        	else if (isset ($_SERVER['USER'])) $user = $_SERVER['USER'];
8
-                	else $user='unknown';
6
+	if (isset ($_SERVER['REMOTE_USER'])) {
7
+		$user = $_SERVER['REMOTE_USER'];
8
+	} else if (isset ($_SERVER['USER'])) {
9
+        		$user = $_SERVER['USER'];
10
+        	} else {
11
+                		$user='unknown';
12
+                	}
9 13
 	return $user;
10 14
 }
11 15
 
@@ -67,8 +71,9 @@  discard block
 block discarded – undo
67 71
 	if ($myconn->query($query) === TRUE) {
68 72
 	    syslog(LOG_INFO, "$user: $type <$value> successfully listed on <$table> for $expQ $expUnit.");
69 73
 	    $result=TRUE;
74
+	} else {
75
+		syslog(LOG_ERR, "$user: Error: ".$myconn->error);
70 76
 	}
71
-	else syslog(LOG_ERR, "$user: Error: ".$myconn->error);
72 77
 	return $result;
73 78
 }
74 79
 
@@ -109,8 +114,9 @@  discard block
 block discarded – undo
109 114
         if ($myconn->query($query) === TRUE) {
110 115
             syslog(LOG_INFO, "$user: relist $type <$value> on <$table> for $expQ $expUnit.");
111 116
 		$result=TRUE;
117
+        } else {
118
+        	syslog (LOG_ERR, "$user: Error: ". $myconn->error);
112 119
         }
113
-        else syslog (LOG_ERR, "$user: Error: ". $myconn->error);
114 120
 	return $result;
115 121
 }
116 122
 
@@ -134,9 +140,11 @@  discard block
 block discarded – undo
134 140
 	}
135 141
 
136 142
 
137
-        if ($return=$myconn->query($query) === TRUE) 
138
-            syslog(LOG_INFO, "$user: permanently DELETED $type <$value> from <$table>.");
139
-        else syslog(LOG_ERR, "$user: Error: ". $myconn->error);
143
+        if ($return=$myconn->query($query) === TRUE) {
144
+                    syslog(LOG_INFO, "$user: permanently DELETED $type <$value> from <$table>.");
145
+        } else {
146
+        	syslog(LOG_ERR, "$user: Error: ". $myconn->error);
147
+        }
140 148
 
141 149
         return $return;
142 150
 }
@@ -158,8 +166,9 @@  discard block
 block discarded – undo
158 166
 
159 167
         if ($return=$myconn->query($query) === TRUE) {
160 168
             syslog(LOG_INFO, "$user: change status of $type <$value>. The status is now <$status>");
169
+        } else {
170
+        	syslog(LOG_ERR, "$user: Error: ". $myconn->error);
161 171
         }
162
-        else syslog(LOG_ERR, "$user: Error: ". $myconn->error);
163 172
 	return $return;	
164 173
 }
165 174
 
@@ -182,14 +191,16 @@  discard block
 block discarded – undo
182 191
 				$j++;
183 192
 
184 193
 			} while ($myconn->next_result());
185
-		}
186
-		else {
194
+		} else {
187 195
 			syslog(LOG_ERR, "Expire job - Error: ". $myconn->error);
188 196
 			$return = FALSE;
189 197
 		}
190 198
 	}
191
-	if ( !($return) ) syslog(LOG_EMERG, 'End of Expire job with error. See above logs. SQL Connection terminated');
192
-	else  syslog(LOG_INFO, 'Successfully End of Expire job. SQL Connection successfully terminated.');
199
+	if ( !($return) ) {
200
+		syslog(LOG_EMERG, 'End of Expire job with error. See above logs. SQL Connection terminated');
201
+	} else {
202
+		syslog(LOG_INFO, 'Successfully End of Expire job. SQL Connection successfully terminated.');
203
+	}
193 204
         return $return;
194 205
 }
195 206
 
@@ -198,8 +209,11 @@  discard block
 block discarded – undo
198 209
 
199 210
 	$exp=new DateTime($row['exp']);
200 211
 	$now=new DateTime('NOW');
201
-	if (($exp > $now) and ($row['active'])) return true;
202
-	else return false;
212
+	if (($exp > $now) and ($row['active'])) {
213
+		return true;
214
+	} else {
215
+		return false;
216
+	}
203 217
 
204 218
 }
205 219
 
@@ -208,9 +222,12 @@  discard block
 block discarded – undo
208 222
 
209 223
 	switch ($what) {
210 224
 		case 'Ok':
211
-			if ($lock) return NULL;
212
-			if (in_array($user,array_keys($adm)))
213
-				if ( consistentListing($myconn,$alltables,$typedesc,$value,$whynot) ) return require('relistButton.php');
225
+			if ($lock) {
226
+				return NULL;
227
+			}
228
+			if (in_array($user,array_keys($adm))) {
229
+							if ( consistentListing($myconn,$alltables,$typedesc,$value,$whynot) ) return require('relistButton.php');
230
+			}
214 231
 			return htmlspecialchars($whynot);
215 232
 		case 'Listed':
216 233
 		case 'WhiteListed':
@@ -251,8 +268,9 @@  discard block
 block discarded – undo
251 268
         $type = $tablelist['field'];
252 269
         $table = $tablelist['name'];
253 270
 
254
-        if ($value == 'ALL') $query = 'select * from '.$table;
255
-        else {
271
+        if ($value == 'ALL') {
272
+        	$query = 'select * from '.$table;
273
+        } else {
256 274
                 switch ($type) {
257 275
                   case 'ip':
258 276
                         $query= "select * from $table where $type =  INET_ATON('$value')";
@@ -267,8 +285,9 @@  discard block
 block discarded – undo
267 285
         }
268 286
 
269 287
 	$result = $myconn->query($query);
270
-	if($result === false)
271
-		syslog(LOG_EMERG, "ALERT: Query <$query> failed: ".$myconn->error);
288
+	if($result === false) {
289
+			syslog(LOG_EMERG, "ALERT: Query <$query> failed: ".$myconn->error);
290
+	}
272 291
         return $result;
273 292
 }
274 293
 
@@ -286,8 +305,9 @@  discard block
 block discarded – undo
286 305
 
287 306
 function isFull($myconn,$typedesc,$alltables) {
288 307
         if (isset($alltables["$typedesc"]['limit'])) {
289
-                if ( countListed($myconn,$alltables["$typedesc"]['name']) >= $alltables["$typedesc"]['limit'] ) 
290
-                        return TRUE;
308
+                if ( countListed($myconn,$alltables["$typedesc"]['name']) >= $alltables["$typedesc"]['limit'] ) {
309
+                                        return TRUE;
310
+                }
291 311
         }
292 312
 	return FALSE;
293 313
 }
@@ -303,18 +323,23 @@  discard block
 block discarded – undo
303 323
 
304 324
         /* Check for limit in number of listed items */
305 325
 	$full = isFull($myconn,$typedesc,$tables);
306
-	if ($full) print '<p>'.htmlspecialchars("$typedesc has reached maximum value of ".$tables["$typedesc"]['limit'].' listed items.').'</p>';
326
+	if ($full) {
327
+		print '<p>'.htmlspecialchars("$typedesc has reached maximum value of ".$tables["$typedesc"]['limit'].' listed items.').'</p>';
328
+	}
307 329
 
308 330
 		if ($result->num_rows) {
309 331
 			print '<table><thead><tr><th>'.$type.'</th><th title="The date this object has been listed for the first time">DateAdd</th><th>DateMod</th><th>Exp</th><th>Status</th><th title="Number of times this object has been listed">#List</th><th>Authored by</th><th width="250">Reason</th><th>Action</th></tr></thead><tfoot><tr></tr></tfoot><tbody>'."\n";
310 332
 			$i=0;
311 333
         		while ($riga = $result->fetch_array(MYSQLI_ASSOC)) {
312 334
 				if (isListed($riga)) {
313
-					if ($tables["$typedesc"]['bl']) $listed='Listed';
314
-					else $listed='WhiteListed';
315
-				}	
316
-				else
317
-					$listed='Ok';
335
+					if ($tables["$typedesc"]['bl']) {
336
+						$listed='Listed';
337
+					} else {
338
+						$listed='WhiteListed';
339
+					}
340
+				} else {
341
+									$listed='Ok';
342
+				}
318 343
 
319 344
 				switch ($type) {
320 345
 				  case 'ip':
@@ -331,18 +356,20 @@  discard block
 block discarded – undo
331 356
 				$i++;
332 357
         		}
333 358
 			print '</tbody></table>';
334
-		}
335
-		else {
359
+		} else {
336 360
 			print "<pre>$type &lt;$value&gt; is not listed!\n</pre>";
337
-			if ( in_array($user,array_keys($adm)) AND ($value != 'ALL') )
338
-				if ( (!$full) AND (consistentListing($myconn,$tables,$typedesc,$value,$whynot)) ) require_once('listForm.php');
339
-									else print '<p>'.htmlspecialchars($whynot).'</p>';
361
+			if ( in_array($user,array_keys($adm)) AND ($value != 'ALL') ) {
362
+							if ( (!$full) AND (consistentListing($myconn,$tables,$typedesc,$value,$whynot)) ) require_once('listForm.php');
363
+			} else {
364
+										print '<p>'.htmlspecialchars($whynot).'</p>';
365
+									}
340 366
 				
341 367
 		}
342 368
 		$result->free();
369
+	} else {
370
+		print '<pre>Query error or something wrong in DB schema'."\n</pre>";
371
+	}
343 372
 	}
344
-	else print '<pre>Query error or something wrong in DB schema'."\n</pre>";
345
-}
346 373
 
347 374
 
348 375
 function sendEmailWarn($tplf,$from,$to,$sbj,$emailListed,$intervalToExpire,$detail) {
@@ -384,24 +411,32 @@  discard block
 block discarded – undo
384 411
                 $old_mailfrom = ini_get("sendmail_from");
385 412
                 ini_set("sendmail_from", $from);
386 413
                 $params = sprintf("-oi -f %s", '<>');
387
-                if (!(mail($to,$sbj, $body,$headers,$params))) $flag=FALSE;
388
-                else $flag=TRUE;
389
-                if (isset($old_mailfrom))
390
-                        ini_set("sendmail_from", $old_mailfrom);
391
-        }
392
-        else {
393
-                if (!(mail($to,$sbj, $body,$headers))) $flag=FALSE;
394
-                else $flag=TRUE;
414
+                if (!(mail($to,$sbj, $body,$headers,$params))) {
415
+                	$flag=FALSE;
416
+                } else {
417
+                	$flag=TRUE;
418
+                }
419
+                if (isset($old_mailfrom)) {
420
+                                        ini_set("sendmail_from", $old_mailfrom);
421
+                }
422
+        } else {
423
+                if (!(mail($to,$sbj, $body,$headers))) {
424
+                	$flag=FALSE;
425
+                } else {
426
+                	$flag=TRUE;
427
+                }
395 428
         }
396 429
         return $flag;
397 430
 }
398 431
 
399 432
 function emailToNotify($notify_file,$dom) {
400 433
 	$ini_array = parse_ini_file($notify_file);
401
-	if (in_array($dom,array_keys($ini_array)))
402
-		return $ini_array["$dom"];
403
-	else return FALSE;
404
-}
434
+	if (in_array($dom,array_keys($ini_array))) {
435
+			return $ini_array["$dom"];
436
+	} else {
437
+		return FALSE;
438
+	}
439
+	}
405 440
 
406 441
 
407 442
 function searchAndList ($myconn,$loguser,$tables,$typedesc,$value,$unit,&$quantity,$reason) {
Please login to merge, or discard this patch.
remove.php 1 patch
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -16,10 +16,11 @@
 block discarded – undo
16 16
 }
17 17
 syslog (LOG_INFO, $user.': Successfully connected to ' . $mysqli->host_info );
18 18
 
19
-if (remove ($_POST['value'],$type,$table))
19
+if (remove ($_POST['value'],$type,$table)) {
20 20
  print 'OK '.$typedesc.' &lt;'.$_POST['value'].'&gt; permanently REMOVED!';
21
-else
21
+} else {
22 22
  print 'Delete operation ERROR on '.$typedesc.' &lt;'.$_POST['value'].'&gt;; check log.';
23
+}
23 24
 $mysqli->close();
24 25
 closelog();
25 26
 ?>
Please login to merge, or discard this patch.
list.php 1 patch
Braces   +8 added lines, -4 removed lines patch added patch discarded remove patch
@@ -6,9 +6,12 @@  discard block
 block discarded – undo
6 6
 $table = $tables["$typedesc"]['name'];
7 7
 
8 8
 openlog($tag, LOG_PID, $fac);
9
-if (empty($_POST['reason'])) die ("<p>Please, specify a reason!</p>");
10
-if (preg_match( '/[^\x20-\x7f]/', $_POST['reason']))
9
+if (empty($_POST['reason'])) {
10
+	die ("<p>Please, specify a reason!</p>");
11
+}
12
+if (preg_match( '/[^\x20-\x7f]/', $_POST['reason'])) {
11 13
 	exit('<p>ERROR: &lt;'.htmlentities($_POST['reason'],ENT_COMPAT | ENT_HTML401, 'ISO-8859-1').'&gt; contains NON ASCII chars.</p>');
14
+}
12 15
 $user = username();
13 16
 
14 17
 $mysqli = new mysqli($dbhost, $userdb, $pwd, $db, $dbport);
@@ -20,10 +23,11 @@  discard block
 block discarded – undo
20 23
         }
21 24
 syslog (LOG_INFO, $user.': Successfully connected to ' . $mysqli->host_info );
22 25
 
23
-if (addtolist ($mysqli,username(),$_POST['value'],$type,$table,$_POST['unit'],$_POST['quantity'],$_POST['reason']))
26
+if (addtolist ($mysqli,username(),$_POST['value'],$type,$table,$_POST['unit'],$_POST['quantity'],$_POST['reason'])) {
24 27
  print 'OK '.$_POST["type"].' &lt;'.$_POST['value'].'&gt; first time listed for '.$_POST['quantity'].$_POST['unit'].'.';
25
-else
28
+} else {
26 29
  print 'List operation ERROR; check log.';
30
+}
27 31
 $mysqli->close();
28 32
 closelog();
29 33
 ?>
Please login to merge, or discard this patch.
relist.php 1 patch
Braces   +11 added lines, -5 removed lines patch added patch discarded remove patch
@@ -8,9 +8,12 @@  discard block
 block discarded – undo
8 8
 <td colspan="9" style="text-align: center">
9 9
 <?php
10 10
 openlog($tag, LOG_PID, $fac);
11
-if (empty($_POST['reason'])) die ("Specify a reason, please!</td>");
12
-if (preg_match( '/[^\x20-\x7f]/', $_POST['reason']))
11
+if (empty($_POST['reason'])) {
12
+	die ("Specify a reason, please!</td>");
13
+}
14
+if (preg_match( '/[^\x20-\x7f]/', $_POST['reason'])) {
13 15
         exit('ERROR: &lt;'.htmlentities($_POST['reason'],ENT_COMPAT | ENT_HTML401, 'ISO-8859-1').'&gt; contains NON ASCII chars.</td>');
16
+}
14 17
 $user = username();
15 18
 
16 19
 $mysqli = new mysqli($dbhost, $userdb, $pwd, $db, $dbport);
@@ -22,11 +25,14 @@  discard block
 block discarded – undo
22 25
 }
23 26
 syslog(LOG_INFO, $user.': Successfully connected to ' . $mysqli->host_info) ;
24 27
 
25
-if (isFull($mysqli,$typedesc,$tables)) die("ERROR in relist: ".htmlspecialchars("$typedesc has reached maximum value of ".$tables["$typedesc"]['limit'].' listed items.') );
26
-if (relist ($mysqli,username(),$_POST['value'],$type,$table,$_POST['unit'],$_POST['quantity'],$_POST['reason']))
28
+if (isFull($mysqli,$typedesc,$tables)) {
29
+	die("ERROR in relist: ".htmlspecialchars("$typedesc has reached maximum value of ".$tables["$typedesc"]['limit'].' listed items.') );
30
+}
31
+if (relist ($mysqli,username(),$_POST['value'],$type,$table,$_POST['unit'],$_POST['quantity'],$_POST['reason'])) {
27 32
  print 'OK '.$_POST["type"].' &lt;'.$_POST['value'].'&gt; relisted for '.$_POST['quantity'].$_POST['unit'];
28
-else
33
+} else {
29 34
  print 'ERROR in relist; check log';
35
+}
30 36
 $mysqli->close();
31 37
 closelog();
32 38
 print '</td>';
Please login to merge, or discard this patch.
listForm.php 1 patch
Braces   +5 added lines, -2 removed lines patch added patch discarded remove patch
@@ -1,6 +1,9 @@
 block discarded – undo
1 1
 <?php
2
-if (in_array($user,array_keys(array_filter($adm)))) $extopt = '<option value="MONTH">MONTHS</option><option value="YEAR">YEARS</option>';
3
-else $extopt = NULL;
2
+if (in_array($user,array_keys(array_filter($adm)))) {
3
+	$extopt = '<option value="MONTH">MONTHS</option><option value="YEAR">YEARS</option>';
4
+} else {
5
+	$extopt = NULL;
6
+}
4 7
 ?>
5 8
 <form style="margin:0; text-align: left;" name='ListButton<?php echo $type ?>' enctype="text/plain" method="post" target="_self" action="list.php"  onSubmit="xmlhttpPost('list.php', 'ListButton<?php echo $type ?>', 'Risultato', '<img src=\'/include/pleasewait.gif\'>'); return false;" />
6 9
 
Please login to merge, or discard this patch.
contrib/splunk/listFromSplunk.php 1 patch
Braces   +21 added lines, -12 removed lines patch added patch discarded remove patch
@@ -12,8 +12,12 @@  discard block
 block discarded – undo
12 12
 
13 13
 $shortopts = "c:";  // Required value
14 14
 $options = getopt($shortopts);
15
-if ( !isset($options['c']) ) exit ("\n\nUSAGE: ${_SERVER['SCRIPT_NAME']} -c <file.conf>\n\n");
16
-if ( !file_exists(dirname(__FILE__) . '/' . $options['c']) ) exit ("\n\nThe file <".$options['c']."> doesn't exists.\nExiting...\n\n");
15
+if ( !isset($options['c']) ) {
16
+	exit ("\n\nUSAGE: ${_SERVER['SCRIPT_NAME']} -c <file.conf>\n\n");
17
+}
18
+if ( !file_exists(dirname(__FILE__) . '/' . $options['c']) ) {
19
+	exit ("\n\nThe file <".$options['c']."> doesn't exists.\nExiting...\n\n");
20
+}
17 21
 
18 22
 /************** Start of conf ************************/
19 23
 require_once('config.php');
@@ -77,14 +81,18 @@  discard block
 block discarded – undo
77 81
         $row = -1;
78 82
         while (($data = fgetcsv($handle, 500, ',')) !== FALSE) {
79 83
                 $row++;
80
-                if ($row == 0) continue; /* Skip heading line */
84
+                if ($row == 0) {
85
+                	continue;
86
+                }
87
+                /* Skip heading line */
81 88
                 $thisVal = $data[1];
82 89
                 unset($data[1]);
83 90
                 $data = array_values($data);
84
-                if ( !in_array($thisVal,array_keys($tolist))  )
85
-                        $tolist["$thisVal"] = $data;
86
-                else if ($data[3]>$tolist[$thisVal][3])
87
-                        $tolist["$thisVal"] = $data;
91
+                if ( !in_array($thisVal,array_keys($tolist))  ) {
92
+                                        $tolist["$thisVal"] = $data;
93
+                } else if ($data[3]>$tolist[$thisVal][3]) {
94
+                                        $tolist["$thisVal"] = $data;
95
+                }
88 96
         }
89 97
         fclose($handle);
90 98
 }
@@ -115,17 +123,18 @@  discard block
 block discarded – undo
115 123
                                 		$recip = emailToNotify($domainNotify_file,$domain);
116 124
                                 		$subject = sprintf('%s <%s> is now blocked because exceedes limits on outgoing emails',
117 125
 								$tables["$typedesc"]['field'], $value);
118
-                                		if (!empty($recip))
119
-                                        		if ( sendEmailWarn($tplfile,'[email protected]',$recip,
126
+                                		if (!empty($recip)) {
127
+                                		                                        		if ( sendEmailWarn($tplfile,'[email protected]',$recip,
120 128
 								$subject,$value,"$quantity $unit",$reason) )
121 129
                                                 		syslog(LOG_INFO, "$user: \"$recip\" was notified about the \"$value\" abuse.");
130
+                                		}
131
+					} else {
132
+						syslog(LOG_ERR,"$user: <$domain> contains the '@' char. Notification cannot be sent.");
122 133
 					}
123
-					else syslog(LOG_ERR,"$user: <$domain> contains the '@' char. Notification cannot be sent.");
124 134
 				}
125 135
                         }
126 136
                 }
127
-        }
128
-	else {
137
+        } else {
129 138
 		$reason .= " But it has NOT been listed because it doesn't apply to the trigger condition.";
130 139
 		syslog (LOG_INFO, "$user: ".$reason);
131 140
 	}
Please login to merge, or discard this patch.
contrib/rbldns/exportdns.php 1 patch
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,8 +1,9 @@
 block discarded – undo
1 1
 #!/usr/bin/php
2 2
 <?php
3 3
 
4
-if (PHP_SAPI != "cli")
4
+if (PHP_SAPI != "cli") {
5 5
     exit;
6
+}
6 7
 
7 8
 $home = '/var/www/html/RBL';
8 9
 require_once($home.'/config.php');
Please login to merge, or discard this patch.