@@ -234,6 +234,9 @@ discard block |
||
234 | 234 | } |
235 | 235 | |
236 | 236 | |
237 | +/** |
|
238 | + * @param integer $id |
|
239 | + */ |
|
237 | 240 | function askMilter($myconn,$id,$obj,$typedesc,$miltId,$value,$user,$adm) { |
238 | 241 | $milts = readMiltName($myconn,$user); |
239 | 242 | $size = count($milts); |
@@ -264,6 +267,11 @@ discard block |
||
264 | 267 | } |
265 | 268 | |
266 | 269 | |
270 | +/** |
|
271 | + * @param integer $id |
|
272 | + * @param string $what |
|
273 | + * @param boolean $lock |
|
274 | + */ |
|
267 | 275 | function ask($myconn,$id,$what,$alltables,$typedesc,$value,$lock,$user,$adm) { |
268 | 276 | |
269 | 277 | $whynot=NULL; |
@@ -522,6 +530,9 @@ discard block |
||
522 | 530 | } |
523 | 531 | |
524 | 532 | |
533 | +/** |
|
534 | + * @param string $reason |
|
535 | + */ |
|
525 | 536 | function searchAndList ($myconn,$loguser,$tables,$typedesc,$value,$unit,&$quantity,&$reason) { |
526 | 537 | |
527 | 538 | /* Search and list value */ |
@@ -591,6 +602,9 @@ discard block |
||
591 | 602 | return array_map('long2ip', range( ip2long($range[0]), ip2long($range[1]) ) ); |
592 | 603 | } |
593 | 604 | |
605 | +/** |
|
606 | + * @param string $netA |
|
607 | + */ |
|
594 | 608 | function isIn($netA, $netB) { |
595 | 609 | /* TRUE if an IP of $netA is contained in netB */ |
596 | 610 | list($addressA,$maskA) = explode('/', $netA); |
@@ -56,6 +56,10 @@ discard block |
||
56 | 56 | return $head; |
57 | 57 | } |
58 | 58 | |
59 | +/** |
|
60 | + * @param null|string $prob |
|
61 | + * @param null|string $conf |
|
62 | + */ |
|
59 | 63 | function dspamLevel($prob, $conf) { |
60 | 64 | /* Calculate DSPAM Level as the Spamassassin Plugin */ |
61 | 65 | if (is_null($prob) or is_null($conf)) return '-'; |
@@ -63,6 +67,9 @@ discard block |
||
63 | 67 | return round(($t_prob + ($conf*100)) / 2); |
64 | 68 | } |
65 | 69 | |
70 | +/** |
|
71 | + * @param string $classSpam |
|
72 | + */ |
|
66 | 73 | function dspamType($classSpam) { |
67 | 74 | switch($classSpam) { |
68 | 75 | case 'HAM': |
@@ -1,4 +1,7 @@ discard block |
||
1 | 1 | <?php |
2 | +/** |
|
3 | + * @param string $header |
|
4 | + */ |
|
2 | 5 | function getIP($header,$mxserver,$msa) { |
3 | 6 | /* Get submission server's IP from header's mail */ |
4 | 7 | /* Each line must end with /r/n */ |
@@ -28,11 +31,23 @@ discard block |
||
28 | 31 | return array($ip,$host,$dateR,$dateC['date'],$mid['mid']); |
29 | 32 | } |
30 | 33 | |
34 | +/** |
|
35 | + * @param string $hostname |
|
36 | + * @param string $dateC |
|
37 | + * @param string|null $msgid |
|
38 | + * @param string|false $dateL |
|
39 | + */ |
|
31 | 40 | function updateReport ($ip,$uid,$ipcount,$uidcount,$hostname,$dateC,$msgid,$dateL) { |
32 | 41 | |
33 | 42 | return sprintf ('<tr><td nowrap>%s</td><td nowrap>%s</td><td>%s</td><td>%s</td><td>%u</td><td>%u</td><td>%s</td><td>%s</td></tr>'."\n",$dateL,$dateC,$uid,$ip,$uidcount,$ipcount,$hostname,htmlentities($msgid) ); |
34 | 43 | } |
35 | 44 | |
45 | +/** |
|
46 | + * @param string $dateC |
|
47 | + * @param string|null $msgid |
|
48 | + * @param false|string $dateL |
|
49 | + * @param string $text |
|
50 | + */ |
|
36 | 51 | function updatebadReport ( $uid,$dateC,$msgid,$dateL,$text ) { |
37 | 52 | return sprintf ('<tr><td nowrap>%s</td><td nowrap>%s</td><td>%s</td><td>%s</td><td nowrap>%s</td></tr>'."\n",$dateL,$dateC,$uid,htmlentities($msgid),$text ); |
38 | 53 | } |
@@ -84,6 +99,10 @@ discard block |
||
84 | 99 | } |
85 | 100 | |
86 | 101 | |
102 | +/** |
|
103 | + * @param null|mysqli $myconn |
|
104 | + * @param string $key |
|
105 | + */ |
|
87 | 106 | function summaryReportAndList ($cf,$myconn,$tables,$category,$vet,$key) { |
88 | 107 | $nk = $vet['count']; |
89 | 108 | |
@@ -160,6 +179,10 @@ discard block |
||
160 | 179 | } |
161 | 180 | |
162 | 181 | |
182 | +/** |
|
183 | + * @param string $message_id |
|
184 | + * @param string $date |
|
185 | + */ |
|
163 | 186 | function splunksearch ($service,$message_id,$date) { |
164 | 187 | |
165 | 188 | // Run a blocking search |
@@ -272,6 +295,9 @@ discard block |
||
272 | 295 | } |
273 | 296 | /***********************************/ |
274 | 297 | |
298 | +/** |
|
299 | + * @param string $text |
|
300 | + */ |
|
275 | 301 | function getDomains ($text,$exclude) { |
276 | 302 | /* Pattern from https://mathiasbynens.be/demo/url-regex */ |
277 | 303 | /* Current choice: @gruber */ |
@@ -330,6 +356,9 @@ discard block |
||
330 | 356 | return array(); |
331 | 357 | } |
332 | 358 | |
359 | +/** |
|
360 | + * @return string |
|
361 | + */ |
|
333 | 362 | function humanKey($key) { |
334 | 363 | switch($key) { |
335 | 364 | case 'ip': |
@@ -340,6 +369,11 @@ discard block |
||
340 | 369 | return $key; |
341 | 370 | } |
342 | 371 | |
372 | +/** |
|
373 | + * @param resource $f |
|
374 | + * @param string $key |
|
375 | + * @param string $rtime |
|
376 | + */ |
|
343 | 377 | function writeFileHeader($f,$conf,$key,$type,$rtime) { |
344 | 378 | fwrite( $f, file_get_contents(dirname(__FILE__) . '/' . $conf['report']['reportTemplateHeader']) ); |
345 | 379 | fwrite( $f,sprintf('<h1> Report of %s %s</h1><h5>%s</h5><h2>Detailed Report</h2>',$type, strtoupper(humanKey($key)),$rtime) ); |