@@ -26,12 +26,12 @@ |
||
26 | 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>', |
33 | 33 | htmlentities($received['user']), |
34 | - $received['result'], $received['class']); |
|
34 | + $received['result'], $received['class']); |
|
35 | 35 | closelog(); |
36 | 36 | ?> |
37 | 37 | </div> |
@@ -1,7 +1,7 @@ discard block |
||
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 |
||
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, sprintf('%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, sprintf('%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>', |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | exit ('<pre><'.$_POST['Value'].'> is NOT a valid email address.</pre>'); |
11 | 11 | |
12 | 12 | if ( ($tables["$_"]['field']=='domain') AND ($_POST['Value']!='ALL') ) |
13 | - if (!(isValid($_POST['Value']))) |
|
13 | + if (!(isValid($_POST['Value']))) |
|
14 | 14 | exit ('<pre><'.$_POST['Value'].'> is NOT a valid domain.</pre>'); |
15 | 15 | |
16 | 16 | if ( ($tables["$_"]['field']=='ip') AND ($_POST['Value']!='ALL') ) |
@@ -27,8 +27,8 @@ discard block |
||
27 | 27 | } |
28 | 28 | |
29 | 29 | if ( ($tables["$_"]['field']=='username') AND ($_POST['Value']!='ALL') ) { |
30 | - if ( preg_match( '/[^\x20-\x7f]/', $_POST['Value']) ) |
|
31 | - exit('<pre><'.$_POST['Value'].'> contains NON ASCII chars.</pre>'); |
|
30 | + if ( preg_match( '/[^\x20-\x7f]/', $_POST['Value']) ) |
|
31 | + exit('<pre><'.$_POST['Value'].'> contains NON ASCII chars.</pre>'); |
|
32 | 32 | if ( preg_match( '/[$~=#*+%,{}()\/\\<>;:\"`\[\]&?\s]/', $_POST['Value']) ) |
33 | 33 | exit('<pre><'.$_POST['Value'].'> contains invalid ASCII chars.</pre>'); |
34 | 34 | switch ( $_POST['Value'] ) { |
@@ -5,20 +5,20 @@ discard block |
||
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><'.$_POST['Value'].'> is NOT a valid email address.</pre>'); |
11 | 11 | |
12 | -if ( ($tables["$_"]['field']=='domain') AND ($_POST['Value']!='ALL') ) |
|
12 | +if (($tables["$_"]['field'] == 'domain') AND ($_POST['Value'] != 'ALL')) |
|
13 | 13 | if (!(isValid($_POST['Value']))) |
14 | 14 | exit ('<pre><'.$_POST['Value'].'> is NOT a valid domain.</pre>'); |
15 | 15 | |
16 | -if ( ($tables["$_"]['field']=='ip') AND ($_POST['Value']!='ALL') ) |
|
16 | +if (($tables["$_"]['field'] == 'ip') AND ($_POST['Value'] != 'ALL')) |
|
17 | 17 | if (!(filter_var($_POST['Value'], FILTER_VALIDATE_IP, FILTER_FLAG_IPV4))) |
18 | 18 | exit ('<pre><'.$_POST['Value'].'> is NOT a valid IP address.</pre>'); |
19 | 19 | |
20 | -if ( ($tables["$_"]['field']=='network') AND ($_POST['Value']!='ALL') ) { |
|
21 | - $value = explode('/',$_POST['Value']); |
|
20 | +if (($tables["$_"]['field'] == 'network') AND ($_POST['Value'] != 'ALL')) { |
|
21 | + $value = explode('/', $_POST['Value']); |
|
22 | 22 | if (count($value) != 2) |
23 | 23 | exit ('<pre><'.$_POST['Value'].'> is NOT a valid Network/Netmask pair.</pre>'); |
24 | 24 | if (!$net->address($value[0])->mask($value[1])->isValid(1)) |
@@ -26,16 +26,16 @@ discard block |
||
26 | 26 | $_POST['Value'] = $value[0].'/'.$net->mask($value[1])->convertTo('dec'); |
27 | 27 | } |
28 | 28 | |
29 | -if ( ($tables["$_"]['field']=='username') AND ($_POST['Value']!='ALL') ) { |
|
30 | - if ( preg_match( '/[^\x20-\x7f]/', $_POST['Value']) ) |
|
29 | +if (($tables["$_"]['field'] == 'username') AND ($_POST['Value'] != 'ALL')) { |
|
30 | + if (preg_match('/[^\x20-\x7f]/', $_POST['Value'])) |
|
31 | 31 | exit('<pre><'.$_POST['Value'].'> contains NON ASCII chars.</pre>'); |
32 | - if ( preg_match( '/[$~=#*+%,{}()\/\\<>;:\"`\[\]&?\s]/', $_POST['Value']) ) |
|
32 | + if (preg_match('/[$~=#*+%,{}()\/\\<>;:\"`\[\]&?\s]/', $_POST['Value'])) |
|
33 | 33 | exit('<pre><'.$_POST['Value'].'> contains invalid ASCII chars.</pre>'); |
34 | - switch ( $_POST['Value'] ) { |
|
34 | + switch ($_POST['Value']) { |
|
35 | 35 | case 'anonymous': |
36 | 36 | case 'anybody': |
37 | 37 | case 'anyone': |
38 | - case ( preg_match( '/^anyone@/',$_POST['Value']) == TRUE ): |
|
38 | + case (preg_match('/^anyone@/', $_POST['Value']) == TRUE): |
|
39 | 39 | exit('<pre><'.$_POST['Value'].'> is not allowed.</pre>'); |
40 | 40 | } |
41 | 41 | } |
@@ -51,10 +51,10 @@ discard block |
||
51 | 51 | openlog($tag, LOG_PID, $fac); |
52 | 52 | $user = username(); |
53 | 53 | |
54 | -if ( ($mysqli = myConnect($dbhost, $userdb, $pwd, $db, $dbport, $tables, $_, $user)) === FALSE ) |
|
55 | - exit ('Connect Error (' . $mysqli->connect_errno . ') '. $mysqli->connect_error); |
|
54 | +if (($mysqli = myConnect($dbhost, $userdb, $pwd, $db, $dbport, $tables, $_, $user)) === FALSE) |
|
55 | + exit ('Connect Error ('.$mysqli->connect_errno.') '.$mysqli->connect_error); |
|
56 | 56 | |
57 | -rlookup($mysqli,username(),$admins,$_POST['Value'],$_POST['genere'],$tables); |
|
57 | +rlookup($mysqli, username(), $admins, $_POST['Value'], $_POST['genere'], $tables); |
|
58 | 58 | $mysqli->close(); |
59 | 59 | closelog(); |
60 | 60 | ?> |
@@ -5,32 +5,39 @@ discard block |
||
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><'.$_POST['Value'].'> 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 (!(isValid($_POST['Value']))) |
14 | 15 | exit ('<pre><'.$_POST['Value'].'> 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><'.$_POST['Value'].'> 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><'.$_POST['Value'].'> is NOT a valid Network/Netmask pair.</pre>'); |
|
24 | - if (!$net->address($value[0])->mask($value[1])->isValid(1)) |
|
25 | - exit ('<pre><'.$_POST['Value'].'> is NOT a valid Network/Netmask.</pre>'); |
|
25 | + if (count($value) != 2) { |
|
26 | + exit ('<pre><'.$_POST['Value'].'> is NOT a valid Network/Netmask pair.</pre>'); |
|
27 | + } |
|
28 | + if (!$net->address($value[0])->mask($value[1])->isValid(1)) { |
|
29 | + exit ('<pre><'.$_POST['Value'].'> is NOT a valid Network/Netmask.</pre>'); |
|
30 | + } |
|
26 | 31 | $_POST['Value'] = $value[0].'/'.$net->mask($value[1])->convertTo('dec'); |
27 | 32 | } |
28 | 33 | |
29 | 34 | if ( ($tables["$_"]['field']=='username') AND ($_POST['Value']!='ALL') ) { |
30 | - if ( preg_match( '/[^\x20-\x7f]/', $_POST['Value']) ) |
|
31 | - exit('<pre><'.$_POST['Value'].'> contains NON ASCII chars.</pre>'); |
|
32 | - if ( preg_match( '/[$~=#*+%,{}()\/\\<>;:\"`\[\]&?\s]/', $_POST['Value']) ) |
|
33 | - exit('<pre><'.$_POST['Value'].'> contains invalid ASCII chars.</pre>'); |
|
35 | + if ( preg_match( '/[^\x20-\x7f]/', $_POST['Value']) ) { |
|
36 | + exit('<pre><'.$_POST['Value'].'> contains NON ASCII chars.</pre>'); |
|
37 | + } |
|
38 | + if ( preg_match( '/[$~=#*+%,{}()\/\\<>;:\"`\[\]&?\s]/', $_POST['Value']) ) { |
|
39 | + exit('<pre><'.$_POST['Value'].'> contains invalid ASCII chars.</pre>'); |
|
40 | + } |
|
34 | 41 | switch ( $_POST['Value'] ) { |
35 | 42 | case 'anonymous': |
36 | 43 | case 'anybody': |
@@ -41,18 +48,23 @@ discard block |
||
41 | 48 | } |
42 | 49 | |
43 | 50 | if (empty($_GET)) { |
44 | - if ($tables["$_"]['milter']) print "<p><i>$_</i> is a miltermap of ".$tables["$_"]['field'].'.</p>'; |
|
45 | - else { |
|
46 | - if ($tables["$_"]['bl']) print "<p><i>$_</i> is a blocklist of ".$tables["$_"]['field'].'.</p>'; |
|
47 | - else print "<p><i>$_</i> is a whitelist of ".$tables["$_"]['field'].'.</p>'; |
|
51 | + if ($tables["$_"]['milter']) { |
|
52 | + print "<p><i>$_</i> is a miltermap of ".$tables["$_"]['field'].'.</p>'; |
|
53 | + } else { |
|
54 | + if ($tables["$_"]['bl']) { |
|
55 | + print "<p><i>$_</i> is a blocklist of ".$tables["$_"]['field'].'.</p>'; |
|
56 | + } else { |
|
57 | + print "<p><i>$_</i> is a whitelist of ".$tables["$_"]['field'].'.</p>'; |
|
58 | + } |
|
48 | 59 | } |
49 | 60 | } |
50 | 61 | |
51 | 62 | openlog($tag, LOG_PID, $fac); |
52 | 63 | $user = username(); |
53 | 64 | |
54 | -if ( ($mysqli = myConnect($dbhost, $userdb, $pwd, $db, $dbport, $tables, $_, $user)) === FALSE ) |
|
65 | +if ( ($mysqli = myConnect($dbhost, $userdb, $pwd, $db, $dbport, $tables, $_, $user)) === FALSE ) { |
|
55 | 66 | exit ('Connect Error (' . $mysqli->connect_errno . ') '. $mysqli->connect_error); |
67 | +} |
|
56 | 68 | |
57 | 69 | rlookup($mysqli,username(),$admins,$_POST['Value'],$_POST['genere'],$tables); |
58 | 70 | $mysqli->close(); |
@@ -19,7 +19,7 @@ |
||
19 | 19 | <?php |
20 | 20 | $reports = array(); |
21 | 21 | foreach (glob("*.{htm,html}", GLOB_BRACE) as $filename) { |
22 | - $reports[$filename] = filemtime($filename); |
|
22 | + $reports[$filename] = filemtime($filename); |
|
23 | 23 | } |
24 | 24 | arsort($reports); |
25 | 25 | $newest = new DateTime('@'.array_shift($reports)); |