From f3062fb5d328b1a0b0a522e7cb1d6367311b3fcf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20Fa=C3=9Fbender?= Date: Sun, 17 Oct 2021 16:48:18 +0200 Subject: [PATCH 1/9] implement csrf token check for popup message --- .../modules/documents-files/documents_files_function.php | 2 +- adm_program/system/js/common_functions.js | 5 +++-- adm_program/system/popup_message.php | 2 +- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/adm_program/modules/documents-files/documents_files_function.php b/adm_program/modules/documents-files/documents_files_function.php index 57d432f1f..737ff9729 100644 --- a/adm_program/modules/documents-files/documents_files_function.php +++ b/adm_program/modules/documents-files/documents_files_function.php @@ -68,7 +68,7 @@ } // check the CSRF token of the form against the session token -if(in_array($getMode, array(3, 4, 7))) +if(in_array($getMode, array(2, 3, 4, 5, 7))) { try { diff --git a/adm_program/system/js/common_functions.js b/adm_program/system/js/common_functions.js index 05191c45a..a87768bcb 100644 --- a/adm_program/system/js/common_functions.js +++ b/adm_program/system/js/common_functions.js @@ -32,13 +32,14 @@ function showHideBlock(elementId) { * the element will be hidden otherwise the data will be shown in an error block. * @param {string} elementId This is the id of a html element that should be hidden. * @param {string} url This is the url that will be called. + * @param {string} csrfToken If this is set than it will be added to the post request. * @param {function} [callback] A name of a function that should be called if the return was positive. */ -function callUrlHideElement(elementId, url, callback) { +function callUrlHideElement(elementId, url, csrfToken, callback) { var entryDeleted = document.getElementById(elementId); // send RequestObject and delete entry - $.get(url, function(data) { + $.post(url, {"admidio-csrf-token": csrfToken}, function(data) { if (data === "done") { $("#admidio-modal").modal("hide"); diff --git a/adm_program/system/popup_message.php b/adm_program/system/popup_message.php index 97af06bf0..71ef0e28f 100644 --- a/adm_program/system/popup_message.php +++ b/adm_program/system/popup_message.php @@ -159,7 +159,7 @@
'.$gL10n->get($text, array($getName, '')).'