= 2) { $search_results = globalSearch($search_query, 25, true, true); } $search_total = array_sum(array_column($search_results, 'total')); // Usernames for the credentials shown - decrypted here, the same as the // credentials list does, and only for rows that already passed the search's gates $credential_usernames = []; $credential_has_otp = []; foreach ($search_results as $search_group) { if ($search_group['key'] === 'credentials') { $credential_ids = implode(',', array_map('intval', array_column($search_group['items'], 'id'))); $sql_credential_usernames = mysqli_query($mysqli, "SELECT credential_id, credential_username, credential_otp_secret FROM credentials WHERE credential_id IN ($credential_ids)"); while ($row = mysqli_fetch_assoc($sql_credential_usernames)) { $credential_usernames[intval($row['credential_id'])] = credentialUsername($row); $credential_has_otp[intval($row['credential_id'])] = trim((string) $row['credential_otp_secret']) !== ''; } } } /** Escaped text with every occurrence of the query wrapped in . */ function searchResultHighlight($text, $query) { $text = (string) $text; if ($query === '' || $text === '') { return escapeHtml($text); } $output = ''; $offset = 0; $length = mb_strlen($query); while (($position = mb_stripos($text, $query, $offset)) !== false) { $output .= escapeHtml(mb_substr($text, $offset, $position - $offset)); $output .= '' . escapeHtml(mb_substr($text, $position, $length)) . ''; $offset = $position + $length; } return $output . escapeHtml(mb_substr($text, $offset)); } function searchResultBadge($badge) { if (empty($badge['text'])) { return ''; } $text = escapeHtml($badge['text']); if (!empty($badge['variant']) && in_array($badge['variant'], ['primary', 'secondary', 'success', 'danger', 'warning', 'info', 'light', 'dark'], true)) { return "$text"; } if (!empty($badge['hex']) && preg_match('/^#[0-9a-f]{3,8}$/i', $badge['hex'])) { return "$text"; } return "$text"; } ?>

Search

1) { ?>
Search everything in one place

Names, emails, phone numbers, IP and MAC addresses, serials, ticket, invoice and quote numbers - plus ticket conversations and document text.
Press Ctrl + K on any page to search without leaving it.

Type at least two characters
Nothing matches ""

Check the spelling, or try part of a name, a number or an address.

result for ""

$group_shown) { ?>