Skip to content

Commit

Permalink
Merge pull request #125 from aeberhard/CSSJS-Optimierung
Browse files Browse the repository at this point in the history
Cssjs optimierung
  • Loading branch information
IngoWinter authored Jan 21, 2021
2 parents 435d61b + 1da8cf3 commit 397c6d3
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 12 deletions.
2 changes: 1 addition & 1 deletion assets/consent_manager_frontend.js
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ document.addEventListener('DOMContentLoaded', function () {

var http = new XMLHttpRequest(),
url = consent_manager_parameters.fe_controller + '?rex-api-call=consent_manager',
params = 'consentid=' + consent_manager_parameters.consentid;
params = 'domain=' + consent_manager_parameters.domain + '&consentid=' + consent_manager_parameters.consentid;
http.open('POST', url, true);
http.setRequestHeader('Content-type', 'application/x-www-form-urlencoded');
http.send(params);
Expand Down
2 changes: 1 addition & 1 deletion boot.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
}
});

rex_extension::register('PACKAGES_INCLUDED', static function (rex_extension_point $ep) {
rex_extension::register('FE_OUTPUT', static function (rex_extension_point $ep) {
if (rex_get('consent_manager_outputjs', 'bool', false) === true) {
$consent_manager = new consent_manager_frontend(0);
$consent_manager->setDomain($_SERVER['HTTP_HOST']);
Expand Down
18 changes: 10 additions & 8 deletions fragments/consent_manager_box.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,16 @@
echo '<div class="consent_manager-cookiegroup">';
foreach ($cookiegroup['cookie_uids'] as $cookieUid) {
$cookie = $consent_manager->cookies[$cookieUid];
foreach ($cookie['definition'] as $def) {
echo '<div class="consent_manager-cookie">';
echo '<span class="consent_manager-cookie-name"><strong>'.$def['cookie_name'].'</strong> ('.$cookie['service_name'].')</span>';
echo '<span class="consent_manager-cookie-description">'.$def['description'].'</span>';
echo '<span class="consent_manager-cookie-description">'.$consent_manager->texts['lifetime'].' '.$def['cookie_lifetime'].'</span>';
echo '<span class="consent_manager-cookie-provider">'.$consent_manager->texts['provider'].' '.$cookie['provider'].'</span>';
echo '<span class="consent_manager-cookie-link-privacy-policy"><a href="'.$cookie['provider_link_privacy'].'">'.$consent_manager->texts['link_privacy'].'</a></span>';
echo '</div>' . PHP_EOL;
if (isset($cookie['definition'])) {
foreach ($cookie['definition'] as $def) {
echo '<div class="consent_manager-cookie">';
echo '<span class="consent_manager-cookie-name"><strong>'.$def['cookie_name'].'</strong> ('.$cookie['service_name'].')</span>';
echo '<span class="consent_manager-cookie-description">'.$def['description'].'</span>';
echo '<span class="consent_manager-cookie-description">'.$consent_manager->texts['lifetime'].' '.$def['cookie_lifetime'].'</span>';
echo '<span class="consent_manager-cookie-provider">'.$consent_manager->texts['provider'].' '.$cookie['provider'].'</span>';
echo '<span class="consent_manager-cookie-link-privacy-policy"><a href="'.$cookie['provider_link_privacy'].'">'.$consent_manager->texts['link_privacy'].'</a></span>';
echo '</div>' . PHP_EOL;
}
}
}
echo '</div>';
Expand Down
1 change: 1 addition & 0 deletions install.php
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@

rex_sql_table::get(rex::getTable('consent_manager_consent_log'))
->ensureColumn(new rex_sql_column('id', 'int(10) unsigned', false, null, 'AUTO_INCREMENT'))
->ensureColumn(new rex_sql_column('domain', 'varchar(255)'))
->ensureColumn(new rex_sql_column('consentid', 'varchar(255)'))
->ensureColumn(new rex_sql_column('consents', 'text'))
->ensureColumn(new rex_sql_column('cachelogid', 'varchar(255)'))
Expand Down
6 changes: 4 additions & 2 deletions lib/rex_api_consent_manager.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@ class rex_api_consent_manager extends rex_api_function

function execute()
{
$domain = rex_post('domain', 'string', false);
$consentid = rex_post('consentid', 'string', false);
$consent_manager = isset($_COOKIE['consent_manager']) ? json_decode($_COOKIE['consent_manager'],1) : false;
if (!$consentid || !$consent_manager) exit;
$consent_manager = isset($_COOKIE['consent_manager']) ? json_decode($_COOKIE['consent_manager'], 1) : false;
if (!$domain || !$consentid || !$consent_manager) exit;
if ((string)$consent_manager['consentid'] == $consentid) {
$ip = $_SERVER['REMOTE_ADDR'];
if (strpos($ip, '.') !== false) {
Expand All @@ -23,6 +24,7 @@ function execute()
}
$db = rex_sql::factory();
$db->setTable(rex::getTable('consent_manager_consent_log'));
$db->setValue('domain', $domain);
$db->setValue('consentid', $consentid);
$db->setValue('consents', json_encode($consent_manager['consents']));
$db->setValue('cachelogid', $consent_manager['cachelogid']);
Expand Down

0 comments on commit 397c6d3

Please sign in to comment.