aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorScott Ullrich <sullrich@pfsense.org>2006-02-06 03:28:20 +0000
committerScott Ullrich <sullrich@pfsense.org>2006-02-06 03:28:20 +0000
commit373ac648ccfe7e9bae393f3cfb49d1195e081020 (patch)
tree7f2e6f49f9319ef8c8fcb1897f5a59d1a09a7c65
parentc123ca2922f22f19ca69e1c0d02b81533bee4312 (diff)
downloadpfsense-packages-373ac648ccfe7e9bae393f3cfb49d1195e081020.tar.gz
pfsense-packages-373ac648ccfe7e9bae393f3cfb49d1195e081020.tar.bz2
pfsense-packages-373ac648ccfe7e9bae393f3cfb49d1195e081020.zip
Add a limit option
-rw-r--r--packages/spamd_db.php13
1 files changed, 10 insertions, 3 deletions
diff --git a/packages/spamd_db.php b/packages/spamd_db.php
index c55a0e2c..a2e007b6 100644
--- a/packages/spamd_db.php
+++ b/packages/spamd_db.php
@@ -33,6 +33,10 @@ if($_POST['filter'])
$filter = $_POST['filter'];
if($_POST['not'])
$not = true;
+if($_POST['limit'])
+ $limit = $_POST['limit'];
+else
+ $limit = "25";
/* handle AJAX operations */
if($_GET['action'] or $_POST['action']) {
@@ -160,6 +164,7 @@ if (typeof getURL == 'undefined') {
<table>
<tr><td align="right">Filter by test:</td><td><input name="filter" value="<?=$filter?>"></input></td><td><input type="submit" value="Filter"></td><td>Inverse filter (NOT):</td><td><input type="checkbox" id="not" name="not" <?php if($not) echo " CHECKED"; ?>></td></tr>
<tr><td align="right">Add spam trap E-mail address:</td><td><input name="spamtrapemail" value="<?=$spamtrapemail?>"></input></td><td><input type="submit" value="Add"></td></tr>
+<tr><td align="right">Limit:</td><td><input name="limit" value="<?=$limit?>"></input></td></tr>
</table><br>
<table width="99%" border="0" cellpadding="0" cellspacing="0">
<tr><td>
@@ -188,21 +193,23 @@ if (typeof getURL == 'undefined') {
if($filter) {
if($not) {
$fd = fopen("/tmp/spamdb", "w");
- $cmd = "/usr/local/sbin/spamdb | grep -v \"" . $filter . "\"";
+ $cmd = "/usr/local/sbin/spamdb | grep -v \"" . $filter . "\" | tail -n {$limit}";
fwrite($fd, $cmd);
fclose($fd);
$pkgdb = split("\n", `$cmd`);
} else {
- $cmd = "/usr/local/sbin/spamdb | grep \"{$filter}\"";
+ $cmd = "/usr/local/sbin/spamdb | grep \"{$filter}\" | tail -n {$limit}";
$pkgdb = split("\n", `$cmd`);
}
} else {
- $pkgdb = split("\n", `/usr/local/sbin/spamdb`);
+ $pkgdb = split("\n", `/usr/local/sbin/spamdb | tail -n {$limit}`);
}
$rows = 0;
$lastseenip = "";
$srcip = "|";
foreach($pkgdb as $pkgdb_row) {
+ if($rows > $limit)
+ break;
$dontdisplay = false;
$rowtext = "";
$rowtext .= "<span class=\"{$rows}\"></span>";