Skip to content

Commit 4fab36e

Browse files
committed
some inline fixes
1 parent 1e88f63 commit 4fab36e

File tree

6 files changed

+13
-12
lines changed

6 files changed

+13
-12
lines changed

boot.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -322,12 +322,12 @@
322322

323323
try {
324324
$googleConsentModeConfig = GoogleConsentMode::getDomainConfig($domain);
325-
$debugScript = '<script>window.consentManagerDebugConfig = ' . json_encode($googleConsentModeConfig) . ';</script>' . PHP_EOL;
325+
$debugScript = '<script nonce="' . rex_response::getNonce() . '">window.consentManagerDebugConfig = ' . json_encode($googleConsentModeConfig) . ';</script>' . PHP_EOL;
326326
} catch (Exception $e) {
327-
$debugScript = '<script>window.consentManagerDebugConfig = {"mode": "unknown", "enabled": false};</script>' . PHP_EOL;
327+
$debugScript = '<script nonce="' . rex_response::getNonce() . '">window.consentManagerDebugConfig = {"mode": "unknown", "enabled": false};</script>' . PHP_EOL;
328328
}
329329

330-
$debugScript .= '<script src="' . $consentDebugUrl . '"></script>' . PHP_EOL;
330+
$debugScript .= '<script nonce="' . rex_response::getNonce() . '" src="' . $consentDebugUrl . '"></script>' . PHP_EOL;
331331

332332
// Debug-Script vor </head> einfügen
333333
$content = $ep->getSubject();

fragments/ConsentManager/box_cssjs.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -155,8 +155,8 @@
155155
$jsConfig = [
156156
'cookieSameSite' => 'Lax',
157157
'cookieSecure' => rex_request::isHttps(),
158-
'cookieName' => 'consentmanager',
159-
'cookieLifetime' => 14, // Tage
158+
'cookieName' => $addon->getConfig('cookie_name', 'consentmanager'),
159+
'cookieLifetime' => (int) $addon->getConfig('lifespan', 14), // Tage
160160
'domain' => rex_request::server('HTTP_HOST', 'string', ''),
161161
'version' => $consent_manager->version,
162162
'cacheLogId' => $consent_manager->cacheLogId,

fragments/ConsentManager/cookiedb.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,12 @@
2121

2222
if (0 !== count($consent_manager->cookiegroups)) { /** phpstan-ignore-line */
2323
// Cookie Consent + History
24+
$cookieName = rex_addon::get('consent_manager')->getConfig('cookie_name', 'consentmanager');
2425
$cookiedata = [];
25-
if (is_string(rex_request::cookie('consentmanager'))) {
26-
$cookiedata = (array) json_decode(rex_request::cookie('consentmanager'), true);
26+
if (is_string(rex_request::cookie($cookieName))) {
27+
$cookiedata = (array) json_decode(rex_request::cookie($cookieName), true);
2728
}
28-
$consent_manager_cookie = null !== rex_request::cookie('consentmanager') ? $cookiedata : null;
29+
$consent_manager_cookie = null !== rex_request::cookie($cookieName) ? $cookiedata : null;
2930
if (null !== $consent_manager_cookie && isset($consent_manager_cookie['cachelogid'])) {
3031
$db = rex_sql::factory();
3132
$db->setDebug(false);

fragments/ConsentManager/inline_placeholder.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ class="consent-inline-thumbnail"
121121
</div>
122122
</div>
123123

124-
<script type="text/plain" class="consent-content-data"
124+
<script nonce="<?= rex_response::getNonce() ?>" type="text/plain" class="consent-content-data"
125125
data-consent-code="<?= rex_escape($serviceKey) ?>">
126126
<?= str_replace('</script>', '<\/script>', $content) ?>
127127
</script>

lib/InlineConsent.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -400,11 +400,11 @@ public static function getJavaScript(): string
400400
$addon = \rex_addon::get('consent_manager');
401401
$sessionScope = $addon->getConfig('inline_consent_session_scope') ? 'true' : 'false';
402402

403-
$configScript = '<script>window.consentManagerInlineOptions = { sessionScope: ' . $sessionScope . ' };</script>';
403+
$configScript = '<script nonce="' . \rex_response::getNonce() . '">window.consentManagerInlineOptions = { sessionScope: ' . $sessionScope . ' };</script>';
404404

405405
// JavaScript-Datei laden
406406
$jsPath = rex_url::addonAssets('consent_manager', 'consent_inline.js');
407-
return $configScript . '<script defer src="' . $jsPath . '"></script>';
407+
return $configScript . '<script nonce="' . \rex_response::getNonce() . '" defer src="' . $jsPath . '"></script>';
408408
}
409409

410410
/**

pages/help.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@
166166
$tocHtml .= '</div></div>';
167167

168168
// JS for Live Search
169-
$tocHtml .= '<script>
169+
$tocHtml .= '<script nonce="' . rex_response::getNonce() . '">
170170
(function($) {
171171
$(document).on("rex:ready", function() {
172172
var $input = $("#cm-toc-filter");

0 commit comments

Comments
 (0)