From 239fa36b47971d0a8d1a82e4db175e2179c57952 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Tempez?= Date: Fri, 7 Feb 2025 17:31:43 +0100 Subject: [PATCH] renomme les constantes --- core/class/layout.class.php | 34 +- core/class/router.class.php | 12 +- core/core.php | 62 +- core/layout/main.php | 4 +- core/module/config/config.php | 28 +- core/module/course/course.php | 64 +- .../course/view/userReport/userReport.php | 4 +- core/module/install/install.php | 10 +- core/module/install/ressource/defaultdata.php | 22 +- core/module/language/language.php | 18 +- core/module/maintenance/maintenance.php | 2 +- core/module/page/page.php | 20 +- core/module/page/view/edit/edit.php | 8 +- core/module/plugin/plugin.php | 14 +- core/module/sitemap/sitemap.php | 2 +- core/module/theme/theme.php | 34 +- core/module/user/user.php | 88 +- core/module/user/view/add/add.php | 28 +- core/module/user/view/edit/edit.php | 42 +- .../user/view/profilEdit/profilEdit.php | 2 +- module/blog/blog.php | 38 +- module/blog/view/add/add.php | 2 +- module/blog/view/article/article.php | 6 +- module/blog/view/edit/edit.php | 4 +- module/blog/view/index/index.php | 6 +- module/download/changes.md | 23 + module/download/download.php | 1358 +++++++++++++++++ module/download/enum.json | 1 + module/download/i18n/de.json | 27 + module/download/i18n/en_EN.json | 27 + module/download/i18n/es.json | 27 + module/download/i18n/fr_FR.json | 27 + module/download/i18n/gr_GR.json | 27 + module/download/i18n/it.json | 27 + module/download/i18n/pt_PT.json | 27 + module/download/i18n/tr_TR.json | 27 + module/download/profil/main/add.inc.php | 22 + module/download/profil/main/edit.inc.php | 25 + module/download/profil/view/add.inc.php | 52 + module/download/profil/view/edit.inc.php | 76 + module/download/ressource/feed-icon-16.gif | Bin 0 -> 652 bytes module/download/view/add/add.css | 18 + module/download/view/add/add.js.php | 54 + module/download/view/add/add.php | 193 +++ .../download/view/categories/categories.css | 18 + .../view/categories/categories.js.php | 23 + .../download/view/categories/categories.php | 40 + .../view/categoryEdit/categoryEdit.css | 18 + .../view/categoryEdit/categoryEdit.php | 30 + module/download/view/comment/comment.css | 18 + module/download/view/comment/comment.js.php | 62 + module/download/view/comment/comment.php | 21 + module/download/view/config/config.css | 18 + module/download/view/config/config.js.php | 21 + module/download/view/config/config.php | 40 + module/download/view/edit/edit.css | 18 + module/download/view/edit/edit.js.php | 77 + module/download/view/edit/edit.php | 210 +++ module/download/view/index/index.css | 69 + module/download/view/index/index.php | 67 + module/download/view/item/item.css | 67 + module/download/view/item/item.js.php | 50 + module/download/view/item/item.php | 235 +++ module/download/view/list/list.php | 1 + module/download/view/option/option.css | 18 + module/download/view/option/option.php | 47 + module/download/view/rss/rss.php | 1 + module/download/view/stats/stats.css | 18 + module/download/view/stats/stats.js.php | 22 + module/download/view/stats/stats.php | 36 + module/form/form.php | 14 +- module/gallery/gallery.php | 20 +- module/news/news.php | 14 +- module/news/view/article/article.php | 2 +- module/news/view/index/index.php | 2 +- module/redirection/redirection.php | 6 +- module/search/search.php | 4 +- module/slider/slider.php | 12 +- module/suscribe/suscribe.php | 32 +- module/suscribe/view/edit/edit.php | 32 +- module/workshop/workshop.php | 4 +- 81 files changed, 3631 insertions(+), 348 deletions(-) create mode 100644 module/download/changes.md create mode 100644 module/download/download.php create mode 100644 module/download/enum.json create mode 100644 module/download/i18n/de.json create mode 100644 module/download/i18n/en_EN.json create mode 100644 module/download/i18n/es.json create mode 100644 module/download/i18n/fr_FR.json create mode 100644 module/download/i18n/gr_GR.json create mode 100644 module/download/i18n/it.json create mode 100644 module/download/i18n/pt_PT.json create mode 100644 module/download/i18n/tr_TR.json create mode 100644 module/download/profil/main/add.inc.php create mode 100644 module/download/profil/main/edit.inc.php create mode 100644 module/download/profil/view/add.inc.php create mode 100644 module/download/profil/view/edit.inc.php create mode 100644 module/download/ressource/feed-icon-16.gif create mode 100644 module/download/view/add/add.css create mode 100644 module/download/view/add/add.js.php create mode 100644 module/download/view/add/add.php create mode 100644 module/download/view/categories/categories.css create mode 100644 module/download/view/categories/categories.js.php create mode 100644 module/download/view/categories/categories.php create mode 100644 module/download/view/categoryEdit/categoryEdit.css create mode 100644 module/download/view/categoryEdit/categoryEdit.php create mode 100644 module/download/view/comment/comment.css create mode 100644 module/download/view/comment/comment.js.php create mode 100644 module/download/view/comment/comment.php create mode 100644 module/download/view/config/config.css create mode 100644 module/download/view/config/config.js.php create mode 100644 module/download/view/config/config.php create mode 100644 module/download/view/edit/edit.css create mode 100644 module/download/view/edit/edit.js.php create mode 100644 module/download/view/edit/edit.php create mode 100644 module/download/view/index/index.css create mode 100644 module/download/view/index/index.php create mode 100644 module/download/view/item/item.css create mode 100644 module/download/view/item/item.js.php create mode 100644 module/download/view/item/item.php create mode 100644 module/download/view/list/list.php create mode 100644 module/download/view/option/option.css create mode 100644 module/download/view/option/option.php create mode 100644 module/download/view/rss/rss.php create mode 100644 module/download/view/stats/stats.css create mode 100644 module/download/view/stats/stats.js.php create mode 100644 module/download/view/stats/stats.php diff --git a/core/class/layout.class.php b/core/class/layout.class.php index 5cd3dc3..0385662 100644 --- a/core/class/layout.class.php +++ b/core/class/layout.class.php @@ -353,7 +353,7 @@ class layout extends common } // Affichage de la barre de membre simple if ( - $this->getUser('role') >= self::GROUP_MEMBER && $this->getUser('role') < self::GROUP_ADMIN + $this->getUser('role') >= self::ROLE_MEMBER && $this->getUser('role') < self::ROLE_ADMIN && $this->getData(['theme', 'footer', 'memberBar']) === true ) { $items .= 'getUser('role') === self::GROUP_MEMBER + $this->getUser('role') === self::ROLE_MEMBER && $this->getData(['theme', 'menu', 'selectSpace']) === true ) { if ($this->getCoursesByProfil()) { @@ -533,10 +533,10 @@ class layout extends common ) { $href = ''; switch ($this->getUser('role')) { - case self::GROUP_MEMBER: + case self::ROLE_MEMBER: $href = helper::baseUrl() . 'course/userReport/' . self::$siteContent . '/' . $this->getUser('id'); break; - case self::GROUP_EDITOR: + case self::ROLE_EDITOR: if ( $this->getData(['enrolment', self::$siteContent]) && ($this->getUser('id') === $this->getData(['course', self::$siteContent, 'author'])) // Permission d'accéder aux espaces dans lesquels le membre est inscrit @@ -548,7 +548,7 @@ class layout extends common $href = helper::baseUrl() . 'course/users/' . self::$siteContent; } break; - case self::GROUP_ADMIN: + case self::ROLE_ADMIN: $href = helper::baseUrl() . 'course/users/' . self::$siteContent; } if ($href) { @@ -565,7 +565,7 @@ class layout extends common * Affichage des boutons gestionnaire de fichiers et mon compte */ if ( - $this->getUser('role') === self::GROUP_MEMBER + $this->getUser('role') === self::ROLE_MEMBER && $this->getData(['theme', 'menu', 'memberBar']) === true ) { @@ -648,7 +648,7 @@ class layout extends common and $this->isConnected() === false ) or ($this->getData(['page', $parentPageId, 'disable']) === true and $this->isConnected() === true - and $this->getUser('role') < self::GROUP_EDITOR + and $this->getUser('role') < self::ROLE_EDITOR ) ) { $pageUrl = ($this->getData(['config', 'homePageId']) === $this->getUrl(0)) ? helper::baseUrl(false) : helper::baseUrl() . $this->getUrl(0); @@ -714,7 +714,7 @@ class layout extends common and $this->isConnected() === false ) or ($this->getData(['page', $childKey, 'disable']) === true and $this->isConnected() === true - and $this->getUser('role') < self::GROUP_EDITOR + and $this->getUser('role') < self::ROLE_EDITOR ) ) { $pageUrl = ($this->getData(['config', 'homePageId']) === $this->getUrl(0)) ? helper::baseUrl(false) : helper::baseUrl() . $this->getUrl(0); @@ -975,7 +975,7 @@ class layout extends common * Les admins voient tous les contenus * Les enseignants les contenus dont ils sont auteurs */ - if ($this->getUser('role') >= self::GROUP_EDITOR) { + if ($this->getUser('role') >= self::ROLE_EDITOR) { if (is_array($this->getCoursesByProfil())) { $leftItems .= '
  • '; $leftItems .= ''; @@ -1122,11 +1122,11 @@ class layout extends common $rightItems = ''; if ( ( - $this->getUser('role') === self::GROUP_EDITOR + $this->getUser('role') === self::ROLE_EDITOR && $this->getUser('permission', 'filemanager') === true && $this->getUser('permission', 'folder', (self::$siteContent === 'home' ? 'homePath' : 'coursePath')) !== 'none' ) - || $this->getUser('role') === self::GROUP_ADMIN + || $this->getUser('role') === self::ROLE_ADMIN ) { $folder = '&fldr=/' . (self::$siteContent === 'home' ? '' : self::$siteContent); $rightItems .= '
  • ' . template::ico('folder', [ @@ -1137,7 +1137,7 @@ class layout extends common } if ( self::$siteContent === 'home' - && $this->getUser('role') >= self::GROUP_ADMIN + && $this->getUser('role') >= self::ROLE_ADMIN ) { $rightItems .= '
  • ' . template::ico('flag', [ 'help' => 'Langues', @@ -1211,7 +1211,7 @@ class layout extends common } // Boutons depuis le groupe éditeur if ( - $this->getUser('role') >= self::GROUP_EDITOR + $this->getUser('role') >= self::ROLE_EDITOR && $this->getUser('permission', 'user', 'edit') ) { @@ -1297,7 +1297,7 @@ class layout extends common $vars .= 'var baseUrlQs = ' . json_encode(helper::baseUrl()) . ';'; if ( $this->isConnected() === true - and $this->getUser('role') >= self::GROUP_EDITOR + and $this->getUser('role') >= self::ROLE_EDITOR ) { $vars .= 'var privateKey = ' . json_encode(md5_file(self::DATA_DIR . 'core.json')) . ';'; } diff --git a/core/class/router.class.php b/core/class/router.class.php index 694f1bf..a4c9cc2 100644 --- a/core/class/router.class.php +++ b/core/class/router.class.php @@ -446,7 +446,7 @@ class core extends common && $this->getData(['course', self::$siteContent, 'enrolment']) > 0 // Le userId n'est pas celui d'un admis ni le compte d'un gestionnaire de cet espace && ( - $this->getUser('role') < common::GROUP_ADMIN + $this->getUser('role') < common::ROLE_ADMIN || $this->getUser('id') !== $this->getData(['course', common::$siteContent, 'author']) ) ) { @@ -473,7 +473,7 @@ class core extends common // Force la déconnexion des membres bannis ou d'une seconde session if ( $this->isConnected() === true - and ($this->getUser('role') === common::GROUP_BANNED + and ($this->getUser('role') === common::ROLE_BANNED or ($_SESSION['csrf'] !== $this->getData(['user', $this->getUser('id'), 'accessCsrf']) and $this->getData(['config', 'connect', 'autoDisconnect']) === true) ) @@ -488,7 +488,7 @@ class core extends common and $this->getUrl(1) !== 'login' and ($this->isConnected() === false or ($this->isConnected() === true - and $this->getUser('role') < common::GROUP_ADMIN + and $this->getUser('role') < common::ROLE_ADMIN ) ) ) { @@ -505,7 +505,7 @@ class core extends common $access = null; if ($this->getData(['page', $this->getUrl(0)]) !== null) { if ( - $this->getData(['page', $this->getUrl(0), 'role']) === common::GROUP_VISITOR + $this->getData(['page', $this->getUrl(0), 'role']) === common::ROLE_VISITOR or ($this->isConnected() === true // and $this->getUser('role') >= $this->getData(['page', $this->getUrl(0), 'role']) // Modification qui tient compte du profil de la page @@ -526,7 +526,7 @@ class core extends common and $this->isConnected() === false ) or ($this->getData(['page', $this->getUrl(0), 'disable']) === true and $this->isConnected() === true - and $this->getUser('role') < common::GROUP_EDITOR + and $this->getUser('role') < common::ROLE_EDITOR ) ) { $access = false; @@ -707,7 +707,7 @@ class core extends common $output = $module->output; // Check le groupe de l'utilisateur if ( - ($module::$actions[$action] === common::GROUP_VISITOR + ($module::$actions[$action] === common::ROLE_VISITOR or ($this->isConnected() === true and $this->getUser('role') >= $module::$actions[$action] and $this->getUser('permission', $moduleId, $action) diff --git a/core/core.php b/core/core.php index 03565d4..2ce268a 100644 --- a/core/core.php +++ b/core/core.php @@ -24,13 +24,13 @@ class common const DISPLAY_LAYOUT_BLANK = 3; const DISPLAY_LAYOUT_MAIN = 4; const DISPLAY_LAYOUT_LIGHT = 5; - const GROUP_BANNED = -1; - const GROUP_VISITOR = 0; - const GROUP_MEMBER = 1; - const GROUP_EDITOR = 2; + const ROLE_BANNED = -1; + const ROLE_VISITOR = 0; + const ROLE_MEMBER = 1; + const ROLE_EDITOR = 2; // Groupe MODERATOR, compatibilité avec les anciens modules : - const GROUP_MODERATOR = 2; - const GROUP_ADMIN = 3; + const ROLE_MODERATOR = 2; + const ROLE_ADMIN = 3; const SIGNATURE_ID = 1; const SIGNATURE_PSEUDO = 2; const SIGNATURE_FIRSTLASTNAME = 3; @@ -148,28 +148,28 @@ class common 'view' => '' ]; public static $roles = [ - self::GROUP_BANNED => 'Banni', - self::GROUP_VISITOR => 'Visiteur', - self::GROUP_MEMBER => 'Étudiant', - self::GROUP_EDITOR => 'Formateur', - self::GROUP_ADMIN => 'Administrateur' + self::ROLE_BANNED => 'Banni', + self::ROLE_VISITOR => 'Visiteur', + self::ROLE_MEMBER => 'Étudiant', + self::ROLE_EDITOR => 'Formateur', + self::ROLE_ADMIN => 'Administrateur' ]; public static $roleEdits = [ - self::GROUP_BANNED => 'Banni', - self::GROUP_MEMBER => 'Étudiant', - self::GROUP_EDITOR => 'Formateur', - self::GROUP_ADMIN => 'Administrateur' + self::ROLE_BANNED => 'Banni', + self::ROLE_MEMBER => 'Étudiant', + self::ROLE_EDITOR => 'Formateur', + self::ROLE_ADMIN => 'Administrateur' ]; public static $roleNews = [ - self::GROUP_MEMBER => 'Étudiant', - self::GROUP_EDITOR => 'Formateur', - self::GROUP_ADMIN => 'Administrateur' + self::ROLE_MEMBER => 'Étudiant', + self::ROLE_EDITOR => 'Formateur', + self::ROLE_ADMIN => 'Administrateur' ]; public static $rolePublics = [ - self::GROUP_VISITOR => 'Visiteur', - self::GROUP_MEMBER => 'Étudiant', - self::GROUP_EDITOR => 'Formateur', - self::GROUP_ADMIN => 'Administrateur' + self::ROLE_VISITOR => 'Visiteur', + self::ROLE_MEMBER => 'Étudiant', + self::ROLE_EDITOR => 'Formateur', + self::ROLE_ADMIN => 'Administrateur' ]; //Langues de l'UI @@ -821,7 +821,7 @@ class common // Page parent $this->getData(['page', $pageId, 'parentPageId']) === "" // Ignore les pages dont l'utilisateur n'a pas accès - and ($this->getData(['page', $pageId, 'role']) === self::GROUP_VISITOR + and ($this->getData(['page', $pageId, 'role']) === self::ROLE_VISITOR or ($this->getUser('authKey') === $this->getInput('ZWII_AUTH_KEY') //and $this->getUser('role') >= $this->getData(['page', $pageId, 'role']) // Modification qui tient compte du profil de la page @@ -848,9 +848,9 @@ class common // Ignore les pages dont l'utilisateur n'a pas accès and ( ( - $this->getData(['page', $pageId, 'role']) === self::GROUP_VISITOR + $this->getData(['page', $pageId, 'role']) === self::ROLE_VISITOR and - $this->getData(['page', $parentId, 'role']) === self::GROUP_VISITOR + $this->getData(['page', $parentId, 'role']) === self::ROLE_VISITOR ) or ( $this->getUser('authKey') === $this->getInput('ZWII_AUTH_KEY') @@ -1048,9 +1048,9 @@ class common public function getPermission($key1, $key2 = null) { // Administrateur, toutes les permissions - if ($this->getUser('role') === self::GROUP_ADMIN) { + if ($this->getUser('role') === self::ROLE_ADMIN) { return true; - } elseif ($this->getUser('role') <= self::GROUP_VISITOR) { // Groupe sans autorisation + } elseif ($this->getUser('role') <= self::ROLE_VISITOR) { // Groupe sans autorisation return false; } elseif ( // Groupe avec profil, consultation des autorisations sur deux clés @@ -1625,10 +1625,10 @@ function makeThumb($src, $dest, $desired_width) $courses = helper::arraycolumn($courses, 'title', 'SORT_ASC'); $filter = array(); switch ($this->getUser('role')) { - case self::GROUP_ADMIN: + case self::ROLE_ADMIN: // Affiche tout return $courses; - case self::GROUP_EDITOR: + case self::ROLE_EDITOR: foreach ($courses as $courseId => $value) { // Affiche les espaces gérés par l'éditeur, les espaces où il participe et les espaces anonymes if ( @@ -1643,7 +1643,7 @@ function makeThumb($src, $dest, $desired_width) } } return $filter; - case self::GROUP_MEMBER: + case self::ROLE_MEMBER: foreach ($courses as $courseId => $value) { // Affiche les espaces du participant et les espaces anonymes if ( @@ -1654,7 +1654,7 @@ function makeThumb($src, $dest, $desired_width) } } return $filter; - case self::GROUP_VISITOR: + case self::ROLE_VISITOR: foreach ($courses as $courseId => $value) { // Affiche les espaces anonymes if ($this->getData(['course', $courseId, 'enrolment']) === self::COURSE_ENROLMENT_GUEST) { diff --git a/core/layout/main.php b/core/layout/main.php index c1f23c6..6add3d5 100644 --- a/core/layout/main.php +++ b/core/layout/main.php @@ -35,7 +35,7 @@ - getUser('role') > self::GROUP_MEMBER) : ?> + getUser('role') > self::ROLE_MEMBER) : ?> showBar(); ?> @@ -48,7 +48,7 @@ $this->getData(['theme', 'menu', 'position']) === 'top' and $this->getData(['theme', 'menu', 'fixed']) === true and $this->isConnected() === true - and $this->getUser('role') > self::GROUP_MEMBER + and $this->getUser('role') > self::ROLE_MEMBER ) { echo '