diff --git a/htdocs/crashes.php b/htdocs/crashes.php index d8fb510..901d639 100644 --- a/htdocs/crashes.php +++ b/htdocs/crashes.php @@ -4,9 +4,12 @@ define("SITE_ROOT", realpath(dirname(__file__))); require_once SITE_ROOT . "/lib/init.php"; $S->requireUser(); -$total = CrashReport::getTotal(); -$reports = CrashReport::getReports(); +$filter = new SearchFilter(); +$total = CrashReport::getTotal($filter); +$reports = CrashReport::getReports($filter); Layout::header(); + +$filter->render(); ?>
Reports
diff --git a/htdocs/lib/CrashReport.php b/htdocs/lib/CrashReport.php index 5ec8827..176ea7c 100644 --- a/htdocs/lib/CrashReport.php +++ b/htdocs/lib/CrashReport.php @@ -61,11 +61,12 @@ class CrashReport } return $ret; } - function getTotal() + function getTotal($filter) { global $DB; - if (!$res = $DB->query("select count(id) as total from reports") OR !$row = $DB->fetchRow($res)) + $where = $filter->getWhere(); + if (!$res = $DB->query("select count(id) as total from reports $where") OR !$row = $DB->fetchRow($res)) { return 0; } @@ -75,12 +76,12 @@ class CrashReport } } - function getReports($offset = 0, $limit = 100) + function getReports($filter) { global $DB; $ret = array(); - if (!$res = $DB->query(kl_str_sql("select * from reports order by id desc limit !i offset !i", $limit, $offset))) + if (!$res = $DB->query("select * from reports " . $filter->getWhere() . kl_str_sql(" order by id desc limit !i offset !i", $filter->limit, $filter->offset))) { return $ret; } diff --git a/htdocs/lib/Layout.php b/htdocs/lib/Layout.php index 3d04cac..6e85eed 100644 --- a/htdocs/lib/Layout.php +++ b/htdocs/lib/Layout.php @@ -156,7 +156,7 @@ $().ready(function(){