--- /dev/null
+<?php
+
+namespace wcf\system\gridView\filter;
+
+use wcf\data\DatabaseObjectList;
+use wcf\system\form\builder\field\AbstractFormField;
+use wcf\system\form\builder\field\TextFormField;
+use wcf\system\WCF;
+use wcf\util\UserUtil;
+
+/**
+ * Filter for columns that contain ipv6 addresses, allowing the user to enter addresses in the ipv4 format.
+ *
+ * @author Marcel Werk
+ * @copyright 2001-2024 WoltLab GmbH
+ * @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
+ * @since 6.2
+ */
+class IpAddressFilter implements IGridViewFilter
+{
+ #[\Override]
+ public function getFormField(string $id, string $label): AbstractFormField
+ {
+ return TextFormField::create($id)
+ ->label($label);
+ }
+
+ #[\Override]
+ public function applyFilter(DatabaseObjectList $list, string $id, string $value): void
+ {
+ $list->getConditionBuilder()->add(
+ "{$id} LIKE ?",
+ ['%' . WCF::getDB()->escapeLikeValue($this->convertIPv4To6($value)) . '%']
+ );
+ }
+
+ #[\Override]
+ public function matches(string $filterValue, string $rowValue): bool
+ {
+ return \str_contains($rowValue, $this->convertIPv4To6($filterValue));
+ }
+
+ #[\Override]
+ public function renderValue(string $value): string
+ {
+ return $value;
+ }
+
+ private function convertIPv4To6(string $value): string
+ {
+ return UserUtil::convertIPv4To6($value);
+ }
+}
--- /dev/null
+<?php
+
+namespace wcf\system\gridView\renderer;
+
+use wcf\util\StringUtil;
+use wcf\util\UserUtil;
+
+/**
+ * Renders ipv6 embedded ipv4 address into ipv4 or returns input if true ipv6.
+ *
+ * @author Marcel Werk
+ * @copyright 2001-2024 WoltLab GmbH
+ * @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
+ * @since 6.2
+ */
+class IpAddressColumnRenderer extends DefaultColumnRenderer
+{
+ #[\Override]
+ public function render(mixed $value, mixed $context = null): string
+ {
+ if (!$value) {
+ return '';
+ }
+
+ return StringUtil::encodeHTML(UserUtil::convertIPv6To4($value));
+ }
+}