From c90b3131c8723f2727dcb6be2f99801846414a20 Mon Sep 17 00:00:00 2001 From: Matt Friedman Date: Thu, 14 May 2026 10:39:26 -0700 Subject: [PATCH 1/3] Display registered services in the ACP --- adm/style/consentmanager_acp.html | 33 ++++++++++++++++++++++++++++++ language/en/acp_consentmanager.php | 11 ++++++++-- service/acp_manager.php | 1 + 3 files changed, 43 insertions(+), 2 deletions(-) diff --git a/adm/style/consentmanager_acp.html b/adm/style/consentmanager_acp.html index a345bdd..f4ac8ad 100644 --- a/adm/style/consentmanager_acp.html +++ b/adm/style/consentmanager_acp.html @@ -37,6 +37,39 @@

{{ lang('WARNING') }}

+
+ {{ lang('ACP_CONSENTMANAGER_REGISTRATIONS') }} +
+
{{ lang('ACP_CONSENTMANAGER_REGISTRATIONS_EXPLAIN') }}
+
+ {% if CONSENTMANAGER_SERVICES %} + {% set services = S_CONSENTMANAGER_MEDIA ? CONSENTMANAGER_SERVICES|merge([{'category': 'media', 'label': 'iframes', 'id': 'phpbb.consentmanager'}]) : CONSENTMANAGER_SERVICES %} + {% for category in [ + { id: 'necessary', label: lang('CONSENTMANAGER_CATEGORY_NECESSARY') }, + { id: 'analytics', label: lang('CONSENTMANAGER_CATEGORY_ANALYTICS') }, + { id: 'marketing', label: lang('CONSENTMANAGER_CATEGORY_MARKETING') }, + { id: 'media', label: lang('CONSENTMANAGER_CATEGORY_MEDIA') } + ] %} + {% set category_has_services = false %} + {% for service in services if service.category == category.id %} + {% if not category_has_services %} + {% set category_has_services = true %} + {{ category.label }} +
    + {% endif %} +
  • {{ service.label }} ยป {{ service.id }}
  • + {% endfor %} + {% if category_has_services %} +
+ {% endif %} + {% endfor %} + {% else %} + {{ lang('ACP_CONSENTMANAGER_REGISTRATIONS_NONE') }} + {% endif %} +
+
+
+
{{ lang('ACP_CONSENTMANAGER_INTEGRATIONS') }}
diff --git a/language/en/acp_consentmanager.php b/language/en/acp_consentmanager.php index dc415b9..d47c006 100644 --- a/language/en/acp_consentmanager.php +++ b/language/en/acp_consentmanager.php @@ -27,16 +27,23 @@ 'ACP_CONSENTMANAGER_MARKETING_EXPLAIN' => 'Allows advertising and marketing integrations to be presented to users and loaded after consent.', 'ACP_CONSENTMANAGER_MEDIA' => 'Enable embedded media category', 'ACP_CONSENTMANAGER_MEDIA_EXPLAIN' => 'Allows videos, players, widgets, and other iframe-based external media to be loaded after consent.', - 'ACP_CONSENTMANAGER_INTEGRATIONS' => 'ACP-managed integrations', - 'ACP_CONSENTMANAGER_INTEGRATIONS_EXPLAIN' => 'Use this to add simple third-party analytics, marketing, or scripts directly from the ACP instead of through an extension. These entries appear in the consent UI and are only loaded after consent.

Provide a JSON array of integrations.

Each object must include: id, category, src. The id may only use letters, numbers, dots, underscores, colons, and hyphens. The category must be necessary, analytics, or marketing. The src must be a valid http, https, or relative script URL.

Optional fields: label, description, async, defer.', + 'ACP_CONSENTMANAGER_INTEGRATIONS' => 'Manual integrations', + 'ACP_CONSENTMANAGER_INTEGRATIONS_EXPLAIN' => 'Use this to add third-party analytics, marketing, or other scripts directly from the ACP. These integrations appear in the consent UI and are only loaded after the required consent has been granted.

Provide a JSON array of integrations.

Each object must include: id, category, src. The id may only use letters, numbers, dots, underscores, colons, and hyphens. The category must be necessary, analytics, or marketing. The src must be a valid http, https, or relative script URL.

Optional fields: label, description, async, defer.', 'ACP_CONSENTMANAGER_INTEGRATIONS_EXAMPLE_LABEL' => 'Example Analytics', 'ACP_CONSENTMANAGER_INTEGRATIONS_EXAMPLE_DESC' => 'Loads a simple analytics library after consent.', + 'ACP_CONSENTMANAGER_REGISTRATIONS' => 'Registered integrations', + 'ACP_CONSENTMANAGER_REGISTRATIONS_EXPLAIN' => 'These services are registered with Consent Manager and automatically respect consent settings.', + 'ACP_CONSENTMANAGER_REGISTRATIONS_NONE' => 'No services are currently registered with Consent Manager.', 'ACP_CONSENTMANAGER_VERSION' => 'Current consent version', 'ACP_CONSENTMANAGER_VERSION_EXPLAIN' => 'Increase the version to force a fresh prompt for every visitor when the consent text or integrations materially change.', 'ACP_CONSENTMANAGER_FORCE_REPROMPT' => 'Force re-prompt', 'ACP_CONSENTMANAGER_REPROMPT_SUCCESS' => 'Consent version increased. Visitors will be asked to review their settings again.', 'ACP_CONSENTMANAGER_INVALID_INTEGRATIONS' => 'The integrations field must contain a valid JSON array.', 'ACP_CONSENTMANAGER_INVALID_INTEGRATION_ENTRY' => 'Integration entry %1$s is invalid. Each entry must include a safe id, supported category, and valid script source URL.', + 'CONSENTMANAGER_CATEGORY_NECESSARY' => 'Necessary', + 'CONSENTMANAGER_CATEGORY_ANALYTICS' => 'Analytics', + 'CONSENTMANAGER_CATEGORY_MARKETING' => 'Marketing', + 'CONSENTMANAGER_CATEGORY_MEDIA' => 'Media', 'EXAMPLE' => 'Example', // Consent logs diff --git a/service/acp_manager.php b/service/acp_manager.php index 12d67e2..264feae 100644 --- a/service/acp_manager.php +++ b/service/acp_manager.php @@ -100,6 +100,7 @@ public function get_settings_template_data() 'S_CONSENTMANAGER_MARKETING' => (bool) $this->config['consentmanager_marketing_enabled'], 'S_CONSENTMANAGER_MEDIA' => (bool) $this->config['consentmanager_media_enabled'], 'CONSENTMANAGER_VERSION' => (int) $this->config['consentmanager_consent_version'], + 'CONSENTMANAGER_SERVICES' => $this->consent_manager->get_services(), 'CONSENTMANAGER_INTEGRATIONS' => $this->get_integrations_json(), 'CONSENTMANAGER_INTEGRATIONS_EXAMPLE' => $this->get_integrations_example_json(), ]; From 611cca7fba6883673921da55df0a89b2476ce2fe Mon Sep 17 00:00:00 2001 From: Matt Friedman Date: Fri, 15 May 2026 12:44:03 -0700 Subject: [PATCH 2/3] Tweak naming --- adm/style/consentmanager_acp.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/adm/style/consentmanager_acp.html b/adm/style/consentmanager_acp.html index f4ac8ad..0324376 100644 --- a/adm/style/consentmanager_acp.html +++ b/adm/style/consentmanager_acp.html @@ -43,7 +43,7 @@

{{ lang('WARNING') }}

{{ lang('ACP_CONSENTMANAGER_REGISTRATIONS_EXPLAIN') }}
{% if CONSENTMANAGER_SERVICES %} - {% set services = S_CONSENTMANAGER_MEDIA ? CONSENTMANAGER_SERVICES|merge([{'category': 'media', 'label': 'iframes', 'id': 'phpbb.consentmanager'}]) : CONSENTMANAGER_SERVICES %} + {% set services = S_CONSENTMANAGER_MEDIA ? CONSENTMANAGER_SERVICES|merge([{'category': 'media', 'label': 'iframe bbcodes', 'id': 'phpbb.consentmanager'}]) : CONSENTMANAGER_SERVICES %} {% for category in [ { id: 'necessary', label: lang('CONSENTMANAGER_CATEGORY_NECESSARY') }, { id: 'analytics', label: lang('CONSENTMANAGER_CATEGORY_ANALYTICS') }, From 98b7bd73b99e3a749531b28f56dd9712b182a1bb Mon Sep 17 00:00:00 2001 From: Matt Friedman Date: Fri, 15 May 2026 12:45:32 -0700 Subject: [PATCH 3/3] Add JSON validation during input in ACP field --- adm/style/consentmanager_acp.html | 44 +++++++++++++++++++++++++++++- language/en/acp_consentmanager.php | 1 + 2 files changed, 44 insertions(+), 1 deletion(-) diff --git a/adm/style/consentmanager_acp.html b/adm/style/consentmanager_acp.html index 0324376..afe0fe8 100644 --- a/adm/style/consentmanager_acp.html +++ b/adm/style/consentmanager_acp.html @@ -77,7 +77,12 @@

{{ lang('WARNING') }}

{{ lang('EXAMPLE') ~ lang('COLON') }}
{{ CONSENTMANAGER_INTEGRATIONS_EXAMPLE }}
-
+
+
+ + +
+
@@ -96,4 +101,41 @@

{{ lang('WARNING') }}

+ + {% include 'overall_footer.html' %} diff --git a/language/en/acp_consentmanager.php b/language/en/acp_consentmanager.php index d47c006..95aca51 100644 --- a/language/en/acp_consentmanager.php +++ b/language/en/acp_consentmanager.php @@ -40,6 +40,7 @@ 'ACP_CONSENTMANAGER_REPROMPT_SUCCESS' => 'Consent version increased. Visitors will be asked to review their settings again.', 'ACP_CONSENTMANAGER_INVALID_INTEGRATIONS' => 'The integrations field must contain a valid JSON array.', 'ACP_CONSENTMANAGER_INVALID_INTEGRATION_ENTRY' => 'Integration entry %1$s is invalid. Each entry must include a safe id, supported category, and valid script source URL.', + 'ACP_CONSENTMANAGER_INVALID_JSON' => 'Invalid JSON', 'CONSENTMANAGER_CATEGORY_NECESSARY' => 'Necessary', 'CONSENTMANAGER_CATEGORY_ANALYTICS' => 'Analytics', 'CONSENTMANAGER_CATEGORY_MARKETING' => 'Marketing',