diff --git a/html/includes/print-menubar.php b/html/includes/print-menubar.php
index 424d273ab..2a4e59c04 100644
--- a/html/includes/print-menubar.php
+++ b/html/includes/print-menubar.php
@@ -110,6 +110,8 @@ if ( dbFetchCell("SELECT 1 from `packages` LIMIT 1") ) {
IPv6 Search
MAC Search
ARP Tables
+
+ MIB definitions
diff --git a/html/includes/table/mibs.inc.php b/html/includes/table/mibs.inc.php
new file mode 100644
index 000000000..5011aa5a1
--- /dev/null
+++ b/html/includes/table/mibs.inc.php
@@ -0,0 +1,91 @@
+
+ *
+ * by Paul Gear
+ * based on code by Søren Friis Rosiak
+ * in commit 054bf3ae209f34a2c3bc8968300722004903df1b
+ *
+ * This program is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation, either version 3 of the License, or (at your
+ * option) any later version. Please see LICENSE.txt at the top level of
+ * the source code distribution for details.
+ */
+
+$columns = array(
+ 'module',
+ 'mib',
+ 'object_type',
+ 'oid',
+ 'syntax',
+ 'description',
+ 'max_access',
+ 'status',
+);
+
+function search_phrase_column($c)
+{
+ global $searchPhrase;
+ return "$c LIKE '%$searchPhrase%'";
+}
+
+function quote_sql_word($c)
+{
+ return "`$c`";
+}
+
+
+// start of sql definition
+$sql = 'SELECT * FROM `mibdefs`';
+
+// all columns are searchable - search across them
+if (isset($searchPhrase) && !empty($searchPhrase)) {
+ $searchsql = implode(' OR ', array_map("search_phrase_column", array_map("quote_sql_word", $columns)));
+ $wheresql .= " WHERE ( $searchsql )";
+ $sql .= $wheresql;
+}
+
+// get total
+$count_sql = "SELECT COUNT(`object_type`) FROM `mibdefs`".$wheresql;
+$total = dbFetchCell($count_sql);
+if (empty($total)) {
+ $total = 0;
+}
+
+// sort by first three columns by default
+if (!isset($sort) || empty($sort)) {
+ $sort = implode(', ', array_map("quote_sql_word", array_slice($columns, 0, 3)));
+}
+$sql .= " ORDER BY $sort";
+
+// select only the required rows
+if (isset($current)) {
+ $limit_low = (($current * $rowCount) - ($rowCount));
+ $limit_high = $rowCount;
+}
+if ($rowCount != -1) {
+ $sql .= " LIMIT $limit_low,$limit_high";
+}
+
+// load data from database into response array
+$response = array();
+foreach (dbFetchRows($sql) as $mib) {
+ $mibrow = array();
+ foreach ($columns as $col) {
+ $mibrow[$col] = $mib[$col];
+ }
+ $response[] = $mibrow;
+}
+
+$output = array(
+ 'current' => $current,
+ 'rowCount' => $rowCount,
+ 'rows' => $response,
+ 'total' => $total,
+ 'sql' => $sql,
+);
+echo _json_encode($output);
diff --git a/html/pages/mibs.inc.php b/html/pages/mibs.inc.php
new file mode 100644
index 000000000..a17e6b28c
--- /dev/null
+++ b/html/pages/mibs.inc.php
@@ -0,0 +1,36 @@
+ Loaded MIB definitions
+
+
+
+
+ | Module |
+ MIB |
+ Object Type |
+ Object Id |
+ Syntax |
+ Description |
+ Maximum Access |
+ Status |
+
+
+
+
+
+