. * * @link http://librenms.org * @copyright 2018 Neil Lathwood * @author Neil Lathwood */ $asn = clean($vars['asn']); $sql = ' FROM `pdb_ix` WHERE `asn` = ?'; $params = [$asn]; if (isset($searchPhrase) && ! empty($searchPhrase)) { $sql .= ' AND (`name` LIKE ?)'; $params[] = "%$searchPhrase%"; } $count_sql = "SELECT COUNT(*) $sql"; $total = dbFetchCell($count_sql, $params); if (empty($total)) { $total = 0; } if (! isset($sort) || empty($sort)) { $sort = 'name ASC'; } $sql .= " ORDER BY $sort"; if (isset($current)) { $limit_low = (($current * $rowCount) - ($rowCount)); $limit_high = $rowCount; } if ($rowCount != -1) { $sql .= " LIMIT $limit_low,$limit_high"; } $sql = "SELECT * $sql"; foreach (dbFetchRows($sql, $params) as $ix) { $ix_id = $ix['ix_id']; $response[] = [ 'exchange' => $ix['name'], 'action' => " 'peering', 'section' => 'ix-peers', 'asn' => $asn, 'ixid' => $ix['ix_id']]) . "' role='button'>Show Peers", 'links' => "", ]; } $output = [ 'current' => $current, 'rowCount' => $rowCount, 'rows' => $response, 'total' => $total, ]; echo _json_encode($output);