From 23c015f69694c802a56219b6ead8cdb3aa41874a Mon Sep 17 00:00:00 2001 From: fredtempez Date: Wed, 28 Jun 2023 17:51:48 +0200 Subject: [PATCH] Module delete supprimer le checkcsrf et change l'appel de la fonction profil --- module/blog/blog.php | 10 +--------- module/form/form.php | 4 +--- module/gallery/gallery.php | 11 +---------- module/news/news.php | 10 +--------- 4 files changed, 4 insertions(+), 31 deletions(-) diff --git a/module/blog/blog.php b/module/blog/blog.php index 29cd5017..9f10a5cc 100755 --- a/module/blog/blog.php +++ b/module/blog/blog.php @@ -593,21 +593,13 @@ class blog extends common public function delete() { if ( - $this->getUser('permission', 'blog', 'delete') === false || + $this->getUser('permission', __CLASS__, __FUNCTION__) === false || $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(2)]) === null) { // Valeurs en sortie $this->addOutput([ 'access' => false ]); } - // Action interdite - elseif ($this->checkCSRF()) { - // Valeurs en sortie - $this->addOutput([ - 'redirect' => helper::baseUrl() . $this->getUrl(0) . '/config', - 'notification' => helper::translate('Action interdite') - ]); - } // Suppression else { $this->deleteData(['module', $this->getUrl(0), 'posts', $this->getUrl(2)]); diff --git a/module/form/form.php b/module/form/form.php index f21994cb..c13e34d5 100644 --- a/module/form/form.php +++ b/module/form/form.php @@ -344,9 +344,7 @@ class form extends common public function delete() { // Action interdite - if ( - $this->getUser('permission', 'form', 'delete') === false || - $this->checkCSRF()) { + if ($this->getUser('permission', __CLASS__, __FUNCTION__) === false) { // Valeurs en sortie $this->addOutput([ 'redirect' => helper::baseUrl() . $this->getUrl(0) . '/data', diff --git a/module/gallery/gallery.php b/module/gallery/gallery.php index 53288aa6..39e5abd5 100644 --- a/module/gallery/gallery.php +++ b/module/gallery/gallery.php @@ -498,23 +498,14 @@ class gallery extends common */ public function delete() { - // $url prend l'adresse sans le token // La galerie n'existe pas - if ($this->getUser('permission', 'gallery', 'delete') === false || + if ($this->getUser('permission', __CLASS__, __FUNCTION__) === false || $this->getData(['module', $this->getUrl(0), 'content', $this->getUrl(2)]) === null) { // Valeurs en sortie $this->addOutput([ 'access' => false ]); } - // Action interdite - if ($this->checkCSRF()) { - // Valeurs en sortie - $this->addOutput([ - 'redirect' => helper::baseUrl() . $this->getUrl(0) . '/config', - 'notification' => helper::translate('Suppression interdite') - ]); - } // Suppression else { $this->deleteData(['module', $this->getUrl(0), 'content', $this->getUrl(2)]); diff --git a/module/news/news.php b/module/news/news.php index eb970abf..b4d9382e 100644 --- a/module/news/news.php +++ b/module/news/news.php @@ -365,21 +365,13 @@ class news extends common public function delete() { // La news n'existe pas - if ($this->getUser('permission', 'news', 'delete') === false || + if ($this->getUser('permission', __CLASS__, __FUNCTION__) === false || $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(2)]) === null) { // Valeurs en sortie $this->addOutput([ 'access' => false ]); } - // Action interdite - elseif ($this->checkCSRF()) { - // Valeurs en sortie - $this->addOutput([ - 'redirect' => helper::baseUrl() . $this->getUrl(0) . '/config', - 'notification' => helper::translate('Action interdite') - ]); - } // Suppression else { $this->deleteData(['module', $this->getUrl(0), 'posts', $this->getUrl(2)]);