Skip to content

Commit

Permalink
Merge branch '3.2' into 'main'
Browse files Browse the repository at this point in the history
  • Loading branch information
thorsten committed Apr 21, 2024
2 parents 6b1a897 + 50d875f commit 0cc1f88
Show file tree
Hide file tree
Showing 16 changed files with 5,370 additions and 4,416 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ This is a log of major user-visible changes in each phpMyFAQ release.

### phpMyFAQ v3.2.7 - unreleased

- updated and improved cookie consent (Jan Harms, Thorsten, Zięba Bogusław Chaffinch)
- updated bundled dependencies (Thorsten)
- fixed minor bugs (Thorsten)

Expand Down
33 changes: 13 additions & 20 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"repository": "git://github.com/thorsten/phpMyFAQ.git",
"author": "Thorsten Rinne",
"license": "MPL-2.0",
"private": "true",
"readmeFilename": "README.md",
"bugs": {
"url": "https://github.com/thorsten/phpMyFAQ/issues"
Expand Down Expand Up @@ -32,44 +33,44 @@
"bootstrap": "^5.3.3",
"bootstrap-datepicker": "^1.10.0",
"bootstrap-icons": "^1.11.3",
"chart.js": "^4.4.1",
"chart.js": "^4.4.2",
"handlebars": "4.7.8",
"highlight.js": "^11.9.0",
"masonry-layout": "^4.2.2",
"sortablejs": "^1.15.2",
"tinymce": "^6.8.3",
"vanilla-cookieconsent": "^2.9.2"
"vanilla-cookieconsent": "^3.0.1"
},
"devDependencies": {
"@babel/core": "^7.23.9",
"@babel/preset-env": "^7.23.9",
"@babel/core": "^7.24.4",
"@babel/preset-env": "^7.24.4",
"@commitlint/cli": "^17.8.1",
"@commitlint/config-conventional": "^17.8.1",
"@mcler/webpack-concat-plugin": "^4.1.5",
"@playwright/test": "^1.41.2",
"@playwright/test": "^1.43.1",
"@testing-library/jest-dom": "^5.17.0",
"@types/node": "^20.11.19",
"autoprefixer": "^10.4.17",
"@types/node": "^20.12.7",
"autoprefixer": "^10.4.19",
"babel-jest": "^29.7.0",
"babel-loader": "^9.1.3",
"babel-preset-env": "^1.7.0",
"clean-webpack-plugin": "^4.0.0",
"css-loader": "^6.10.0",
"css-loader": "^6.11.0",
"file-loader": "^6.2.0",
"html-webpack-plugin": "^5.6.0",
"husky": "^8.0.3",
"jest": "^29.7.0",
"jest-environment-jsdom": "^29.7.0",
"mini-css-extract-plugin": "^2.8.0",
"mini-css-extract-plugin": "^2.9.0",
"node-sass": "^8.0.0",
"postcss": "^8.4.35",
"postcss": "^8.4.38",
"prettier": "^2.8.8",
"pretty-quick": "^3.3.1",
"raw-loader": "^4.0.2",
"sass-loader": "^13.3.3",
"sigmund": "^1.0.1",
"style-loader": "^3.3.4",
"webpack": "^5.90.3",
"webpack": "^5.91.0",
"webpack-cli": "^5.1.4",
"webpack-merge": "^5.10.0",
"webpack-sources": "^3.2.3"
Expand All @@ -82,13 +83,5 @@
"pre-commit": "composer lint && composer validate && composer test && pnpm pretty-quick --staged && pnpm test",
"pre-push": "composer lint && composer validate && composer test && pnpm pretty-quick --staged && pnpm test"
}
},
"packageManager": "pnpm@8.6.10",
"pnpm": {
"overrides": {
"glob-parent@<5.1.2": ">=5.1.2",
"webpack@>=5.0.0 <5.76.0": ">=5.76.0"
}
},
"packageManager": "yarn@1.22.19"
}
}
146 changes: 21 additions & 125 deletions phpmyfaq/assets/src/utils/cookie-consent.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
import * as cc from 'vanilla-cookieconsent';

cc.run({

// root: 'body',
autoShow: true,
// disablePageInteraction: true,
Expand All @@ -31,157 +30,54 @@ cc.run({
// sameSite: "Lax",
expiresAfterDays: 182,
},

// https://cookieconsent.orestbida.com/reference/configuration-reference.html#guioptions
guiOptions: {
consentModal: {
layout: 'cloud inline',
position: 'bottom right',
layout: 'box inline',
position: 'top center',
equalWeightButtons: true,
flipButtons: false
flipButtons: false,
},
preferencesModal: {
layout: 'box',
equalWeightButtons: true,
flipButtons: false
}
flipButtons: false,
},
},

onFirstConsent: ({cookie}) => {
console.log('onFirstConsent fired',cookie);
},
onFirstConsent: ({ cookie }) => {},

onConsent: ({cookie}) => {
console.log('onConsent fired!', cookie)
},
onConsent: ({ cookie }) => {},

onChange: ({changedCategories, changedServices}) => {
console.log('onChange fired!', changedCategories, changedServices);
},
onChange: ({ changedCategories, changedServices }) => {},

onModalReady: ({modalName}) => {
console.log('ready:', modalName);
},
onModalReady: ({ modalName }) => {},

onModalShow: ({modalName}) => {
console.log('visible:', modalName);
},
onModalShow: ({ modalName }) => {},

onModalHide: ({modalName}) => {
console.log('hidden:', modalName);
},
onModalHide: ({ modalName }) => {},

categories: {
necessary: {
enabled: true, // this category is enabled by default
readOnly: true // this category cannot be disabled
enabled: true, // this category is enabled by default
readOnly: true, // this category cannot be disabled
},
analytics: {
autoClear: {
cookies: [
{
name: /^_ga/, // regex: match all cookies starting with '_ga'
},
{
name: '_gid', // string: exact cookie name
}
]
},

services: {
ga: {
label: 'Google Analytics',
onAccept: () => {},
onReject: () => {}
},
youtube: {
label: 'Youtube Embed',
onAccept: () => {},
onReject: () => {}
},
}
},
ads: {}
},

language: {
default: 'en',
autoDetect: 'browser',
autoDetect: 'document',
translations: {
en: {
consentModal: {
title: 'phpMyFAQ use cookies!',
description:
'Hi, phpMyFAQ uses essential cookies to ensure its proper operation and tracking cookies to understand how you interact with it. The latter will be set only after consent.',
acceptAllBtn: 'Accept all',
acceptNecessaryBtn: 'Reject all',
showPreferencesBtn: 'Let me choose',
footer: `
<a href="contact.html" target="_blank">Impressum</a>
<a href="privacy.html" target="_blank">Privacy Policy</a>
`,
},
preferencesModal: {
title: 'Cookie preferences',
acceptAllBtn: 'Accept all',
savePreferencesBtn: 'Reject all',
closeIconLabel: 'Close',
cookie_table_headers: [{ col1: 'Name' }, { col2: 'Domain' }, { col3: 'Expiration' }, { col4: 'Description' }],
sections: [
{
title: 'Cookie usage 📢',
description:
'I use cookies to ensure the basic functionalities of the website and to enhance your online experience. You can choose for each category to opt-in/out whenever you want. For more details relative to cookies and other sensitive data, please read the full <a href="./privacy.html" class="cc-link">privacy policy</a>.',
},
{
title: 'Strictly necessary cookies',
description:
'These cookies are essential for the proper functioning of my website. Without these cookies, the website would not work properly',
linkedCategory: 'necessary'
},
],
},
},
de: {
consentModal: {
title: 'phpMyFAQ nutzt Cookies!',
description:
'Hallo, phpMyFAQ nutzt technisch notwendige und funktionale Cookies, um den Betrieb zu gewährleisten und Marketing-Cookies, um den Erfolg unserer Seite messen zu können. Diese werden erst nach Zustimmung gesetzt.',
acceptAllBtn: 'Alle akzeptieren',
acceptNecessaryBtn: 'Alle ablehnen',
showPreferencesBtn: 'Anpassen',
footer: `
<a href="contact.html" target="_blank">Impressum</a>
<a href="privacy.html" target="_blank">Datenschutzerklärung</a>
`,
},
preferencesModal: {
title: 'Cookie-Einstellungen',
acceptAllBtn: 'Alle akzeptieren',
savePreferencesBtn: 'Alle ablehnen',
closeIconLabel: 'Schließen',
sections: [
{
title: 'Cookie-Einstellungen 📢',
description:
'Ich nutze Cookies, um den ordnungsgemäßen Betrieb der Seite zu garantieren und deine Benutzererfahrung zu verbessern. Du kannst die Verwendung von Cookies für jede Kategorie aktivieren und deaktivieren. Weitere Informationen finden Sie in unserer <a href="./privacy.html" class="cc-link">Datenschutzerklärung</a>.',
},
{
title: 'Technisch notwendige und funktionale Cookies',
description:
'Diese Cookies sind für den reibungslosen Betrieb der Website unbedingt erforderlich. Ohne diese würde die Website nicht ordnungsgemäß funktionieren.',
linkedCategory: 'necessary'
},
],
},
},
de: './translations/cookie-consent/de.json',
en: './translations/cookie-consent/en.json',
pl: './translations/cookie-consent/pl.json',
},
}
},
});

const cookiePreferences = document.getElementById('showCookieConsent');
if(cookiePreferences) {
cookiePreferences.addEventListener('click', function() {
if (cookiePreferences) {
cookiePreferences.addEventListener('click', function (event) {
event.preventDefault();
cc.showPreferences();
});
}
6 changes: 3 additions & 3 deletions phpmyfaq/attachment.php
Original file line number Diff line number Diff line change
Expand Up @@ -95,18 +95,18 @@
}

if (
$attachment && ($faqConfig->get('records.allowDownloadsForGuests') ||
$attachment && $attachment->getRecordId() > 0 && ($faqConfig->get('records.allowDownloadsForGuests') ||
(($groupPermission || ($groupPermission && $userPermission)) && isset($permission['dlattachment'])))
) {
try {
$attachment->rawOut();
} catch (AttachmentException $e) {
$attachmentErrors[] = $e->getMessage();
}

exit(0);
} else {
$attachmentErrors[] = Translation::get('msgAttachmentInvalid');
}
$attachmentErrors[] = Translation::get('err_NotAuth');

// If we're here, there was an error with file download
$template->parseBlock('mainPageContent', 'attachmentErrors', ['item' => implode('<br>', $attachmentErrors)]);
Expand Down
2 changes: 2 additions & 0 deletions phpmyfaq/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -634,6 +634,8 @@
Strings::htmlentities($faqConfig->get('main.privacyURL')),
Translation::get('msgPrivacyNote')
),
'cookiePreferences' => '<a id="showCookieConsent" class="pmf-nav-link-footer">'
. Translation::get('cookiePreferences') . '</a>',
'faqOverview' => '<a class="pmf-nav-link-footer" href="./overview.html">' .
Translation::get('faqOverview') . '</a>',
'showSitemap' => '<a class="pmf-nav-link-footer" href="./sitemap/A/' . $faqLangCode . '.html">' .
Expand Down
27 changes: 27 additions & 0 deletions phpmyfaq/lang/cookie-consent/de.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
"consentModal": {
"title": "phpMyFAQ nutzt Cookies!",
"description": "Hallo, phpMyFAQ nutzt technisch notwendige und funktionale Cookies, um die ordnungsgemäße Funktion der Seite zu gewährleisten.",
"acceptAllBtn": "Alle akzeptieren",
"acceptNecessaryBtn": "Alle ablehnen",
"showPreferencesBtn": "Anpassen",
"footer": "<a href=\"contact.html\" target=\"_blank\">Impressum</a><a href=\"privacy.html\" target=\"_blank\">Datenschutzerklärung</a>"
},
"preferencesModal": {
"title": "Cookie-Einstellungen",
"acceptAllBtn": "Alle akzeptieren",
"savePreferencesBtn": "Alle ablehnen",
"closeIconLabel": "Schließen",
"sections": [
{
"title": "Cookie-Einstellungen 📢",
"description": "Ich nutze Cookies, um den ordnungsgemäßen Betrieb der Seite zu garantieren und deine Benutzererfahrung zu verbessern. Du kannst die Verwendung von Cookies für jede Kategorie aktivieren und deaktivieren. Weitere Informationen findest du in unserer <a href=\"./privacy.html\" class=\"cc-link\">Datenschutzerklärung</a>."
},
{
"title": "Technisch notwendige und funktionale Cookies",
"description": "Diese Cookies sind für den reibungslosen Betrieb der Website unbedingt erforderlich. Ohne diese würde die Website nicht ordnungsgemäß funktionieren.",
"linkedCategory": "necessary"
}
]
}
}
27 changes: 27 additions & 0 deletions phpmyfaq/lang/cookie-consent/en.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
"consentModal": {
"title": "phpMyFAQ use cookies!",
"description": "Hi, phpMyFAQ uses essential cookies to ensure its proper operation.",
"acceptAllBtn": "Accept all",
"acceptNecessaryBtn": "Reject all",
"showPreferencesBtn": "Let me choose",
"footer": "<a href=\"contact.html\" target=\"_blank\">Imprint</a><a href=\"privacy.html\" target=\"_blank\">Privacy Policy</a>"
},
"preferencesModal": {
"title": "Cookie preferences",
"acceptAllBtn": "Accept all",
"savePreferencesBtn": "Reject all",
"closeIconLabel": "Close",
"sections": [
{
"title": "Cookie usage 📢",
"description": "I use cookies to ensure the basic functionalities of the website and to enhance your online experience. You can choose for each category to opt-in/out whenever you want. For more details relative to cookies and other sensitive data, please read the full <a href=\"./privacy.html\" class=\"cc-link\">privacy policy</a>."
},
{
"title": "Strictly necessary cookies",
"description": "These cookies are essential for the proper functioning of my website. Without these cookies, the website would not work properly",
"linkedCategory": "necessary"
}
]
}
}
27 changes: 27 additions & 0 deletions phpmyfaq/lang/cookie-consent/pl.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
"consentModal": {
"title": "phpMyFAQ używaj plików cookie!",
"description": "Hi, phpMyFAQ wykorzystuje niezbędne pliki cookie, aby zapewnić jego prawidłowe działanie oraz śledzące pliki cookie, aby zrozumieć, w jaki sposób z nim współdziałasz. Te ostatnie zostaną ustalone dopiero po uzyskaniu zgody. <button type=\"button\" data-cc=\"c-settings\" class=\"cc-link\">Pozwól mi wybrać</button>",
"acceptAllBtn": "Akceptuj wszystkie",
"acceptNecessaryBtn": "Odrzuć wszystko",
"showPreferencesBtn": "Pozwól mi wybrać",
"footer": "<a href=\"contact.html\" target=\"_blank\">Nadruk</a><a href=\"privacy.html\" target=\"_blank\">Polityka prywatności</a>"
},
"preferencesModal": {
"title": "Preferencje plików cookie",
"acceptAllBtn": "Akceptuj wszystkie",
"savePreferencesBtn": "Odrzuć wszystkie",
"closeIconLabel": "Zamknij",
"sections": [
{
"title": "Wykorzystanie plików cookie \uD83D\uDCE2",
"description": "Używamy plików cookie, aby zapewnić podstawowe funkcjonalności witryny i poprawić komfort korzystania z Internetu. Dla każdej kategorii możesz zdecydować się na włączenie/wyłączenie, kiedy tylko chcesz. Aby uzyskać więcej informacji na temat plików cookie i innych wrażliwych danych, przeczytaj całość <a href=\"./privacy.html\" class=\"cc-link\">polityki prywatności</a>."
},
{
"title": "Tylko niezbędne pliki cookie",
"description": "Te pliki cookie są niezbędne do prawidłowego funkcjonowania tej witryny. Bez tych plików cookie witryna nie będzie działać poprawnie.",
"linkedCategory": "necessary"
}
]
}
}
3 changes: 2 additions & 1 deletion phpmyfaq/show.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,9 @@
$categoryHelper
->setConfiguration($faqConfig)
->setCategory($subCategory);

if (empty($records)) {
$records = $categoryHelper->renderCategoryTree();
$records = sprintf('<div class="mb-5 alert alert-info">%s</div>', Translation::get('err_noArticles'));
}

if ((is_countable($category->getChildNodes((int) $selectedCategoryId)) ? count($category->getChildNodes((int) $selectedCategoryId)) : 0) !== 0) {
Expand Down

0 comments on commit 0cc1f88

Please sign in to comment.