diff --git a/core/class/layout.class.php b/core/class/layout.class.php index a60fa1cf..8e673563 100644 --- a/core/class/layout.class.php +++ b/core/class/layout.class.php @@ -341,14 +341,9 @@ class layout extends common ) { $items .= 'getData(['theme', 'footer', 'displaymemberAccount']) === false ? ' class="displayNone">' : '>'; - $items .= ' | ' . - template::ico('user', [ - 'margin' => 'all', - 'help' => 'Mon compte', - 'href' => helper::baseUrl() . 'user/edit/' . $this->getUser('id') . '/' . $_SESSION['csrf'] - ]); + $items .= ' | '; if ( - $this->getData(['user', $this->getUser('id'), 'files']) === true + $this->getgroup('folder', 'share') === true ) { $items .= '' . template::ico('folder', [ 'href' => helper::baseUrl(false) . 'core/vendor/filemanager/dialog.php?type=0&akey=' . md5_file(self::DATA_DIR . 'core.json') . '&lang=' . $this->getData(['user', $this->getUser('id'), 'language']), @@ -357,6 +352,11 @@ class layout extends common 'help' => 'Fichiers du site' ]); } + $items .= '' . template::ico('user', [ + 'margin' => 'all', + 'help' => 'Mon compte', + 'href' => helper::baseUrl() . 'user/edit/' . $this->getUser('id') . '/' . $_SESSION['csrf'] + ]); $items .= '' . template::ico('logout', [ 'margin' => 'all', 'help' => 'Déconnecter', @@ -497,7 +497,7 @@ class layout extends common && $this->getData(['theme', 'menu', 'memberBar']) === true ) { if ( - $this->getData(['user', $this->getUser('id'), 'files']) === true + $this->getGroup('folder', 'share') === true ) { $itemsRight .= '
  • ' . template::ico('folder', [ 'href' => helper::baseUrl(false) . 'core/vendor/filemanager/dialog.php?type=0&akey=' . md5_file(self::DATA_DIR . 'core.json') . '&lang=' . $this->getData(['user', $this->getUser('id'), 'language']), diff --git a/core/class/router.class.php b/core/class/router.class.php index c65b8a12..b786ff26 100644 --- a/core/class/router.class.php +++ b/core/class/router.class.php @@ -97,8 +97,8 @@ class core extends common */ // Fonts disponibles - $fontsAvailable['files'] = $this->getData(['fonts', 'files']); - $fontsAvailable['imported'] = $this->getData(['fonts', 'imported']); + $fontsAvailable['files'] = $this->getData(['font', 'files']); + $fontsAvailable['imported'] = $this->getData(['font', 'imported']); $fontsAvailable['websafe'] = self::$fontsWebSafe; // Fontes installées @@ -139,8 +139,8 @@ class core extends common $fontFile = $gf ? '' . $fontFile : $fontFile; // Enregistre la personnalisation - if (!is_dir(self::DATA_DIR . 'fonts')) { - mkdir(self::DATA_DIR . 'fonts'); + if (!is_dir(self::DATA_DIR . 'font')) { + mkdir(self::DATA_DIR . 'font'); } file_put_contents(self::DATA_DIR . 'fonts/fonts.html', $fontFile); @@ -319,8 +319,8 @@ class core extends common $css .= '#footerCopyright{text-align:' . $this->getData(['theme', 'footer', 'copyrightAlign']) . '}'; // Enregistre les fontes - if (!is_dir(self::DATA_DIR . 'fonts')) { - mkdir(self::DATA_DIR . 'fonts'); + if (!is_dir(self::DATA_DIR . 'font')) { + mkdir(self::DATA_DIR . 'font'); } file_put_contents(self::DATA_DIR . 'fonts/fonts.html', $fontFile); @@ -343,8 +343,8 @@ class core extends common $css = '/*' . md5(json_encode($this->getData(['admin']))) . '*/'; // Fonts disponibles - $fontsAvailable['files'] = $this->getData(['fonts', 'files']); - $fontsAvailable['imported'] = $this->getData(['fonts', 'imported']); + $fontsAvailable['files'] = $this->getData(['font', 'files']); + $fontsAvailable['imported'] = $this->getData(['font', 'imported']); $fontsAvailable['websafe'] = self::$fontsWebSafe; /** diff --git a/core/core.php b/core/core.php index 40212c18..dc235e33 100644 --- a/core/core.php +++ b/core/core.php @@ -911,6 +911,23 @@ class common } } + /** + * Accède aux données du groupe de l'utilisateur connecté + * @param int $key Clé de la valeur + * @return string|null + */ + public function getGroup($key1, $key2 = null) { + if (is_array($this->user) === false) { + return false; + } elseif ($key2 === null && array_key_exists($key1, $this->getData(['group', $this->user['group']]))) { + return $this->getData(['group', $this->user['group'], $key1]); + } elseif ($key2 && array_key_exists($key2, $this->getData(['group', $this->user['group'], $key1]))) { + return $this->getData(['group', $this->user['group'], $key1, $key2]); + } else { + return false; + } + } + /** * Check qu'une valeur est transmise par la méthode _POST * @return bool diff --git a/core/module/install/ressource/defaultdata.php b/core/module/install/ressource/defaultdata.php index 6e49ce95..eecc9aab 100644 --- a/core/module/install/ressource/defaultdata.php +++ b/core/module/install/ressource/defaultdata.php @@ -347,7 +347,7 @@ class init extends common ], '1' => [ 'name' => 'Membre', - 'readonly' => true, + 'readonly' => false, 'comment' => 'Accède aux pages réservées et à un dossier partagé', 'path' => '/site/file/source/partage/', 'file' => [ @@ -368,7 +368,9 @@ class init extends common 'delete' => false, 'rename' => false, 'copycut' => false, - 'permission' => false + 'permission' => false, + 'share' => false, + 'path' => '.\/site\/file\/source\/partage\/', ] ], '2' => [ @@ -394,7 +396,9 @@ class init extends common 'delete' => true, 'rename' => true, 'copycut' => false, - 'permission' => false + 'permission' => false, + 'share' => false, + 'path' => '.\/site\/file\/source\/partage\/', ] ], '99' => [ @@ -413,7 +417,9 @@ class init extends common 'duplicate' => true, 'extract' => true, 'copycut' => true, - 'permission' => true + 'permission' => true, + 'share' => false, + 'path' => '.\/site\/file\/source\/', ], 'folder' => [ 'create' => true, diff --git a/core/module/theme/theme.php b/core/module/theme/theme.php index d05d8b01..e0c0c659 100644 --- a/core/module/theme/theme.php +++ b/core/module/theme/theme.php @@ -31,7 +31,7 @@ class theme extends common 'export' => self::GROUP_ADMIN, 'import' => self::GROUP_ADMIN, 'save' => self::GROUP_ADMIN, - 'fonts' => self::GROUP_ADMIN, + 'font' => self::GROUP_ADMIN, 'fontAdd' => self::GROUP_ADMIN, 'fontEdit' => self::GROUP_ADMIN, 'fontDelete' => self::GROUP_ADMIN @@ -645,7 +645,7 @@ class theme extends common // Valeurs en sortie $this->addOutput([ 'title' => helper::translate('Fontes'), - 'view' => 'fonts' + 'view' => 'font' ]); } @@ -669,8 +669,8 @@ class theme extends common $fontFamilyName = str_replace('"', '\'', $fontFamilyName); // Supprime la fonte si elle existe dans le type inverse - if (is_array($this->getData(['fonts', $type, $fontId]))) { - $this->deleteData(['fonts', $type, $fontId]); + if (is_array($this->getData(['font', $type, $fontId]))) { + $this->deleteData(['font', $type, $fontId]); } // Stocker la fonte $this->setData([ @@ -733,8 +733,8 @@ class theme extends common $fontFamilyName = str_replace('"', '\'', $fontFamilyName); // Supprime la fonte si elle existe dans le type inverse - if (is_array($this->getData(['fonts', $type, $fontId]))) { - $this->deleteData(['fonts', $type, $fontId]); + if (is_array($this->getData(['font', $type, $fontId]))) { + $this->deleteData(['font', $type, $fontId]); } // Stocker les fontes diff --git a/core/module/user/user.php b/core/module/user/user.php index 28bf65d8..d46ae733 100644 --- a/core/module/user/user.php +++ b/core/module/user/user.php @@ -487,6 +487,7 @@ class user extends common 'rename' => $this->getInput('groupEditFolderRename', helper::FILTER_BOOLEAN), 'copycut' => $this->getInput('groupEditFolderCopycut', helper::FILTER_BOOLEAN), 'permission' => $this->getInput('groupEditFolderPermission', helper::FILTER_BOOLEAN), + 'share' => $this->getInput('groupEditShare', helper::FILTER_BOOLEAN), 'path' => $this->getInput('groupEditPath'), ] ] diff --git a/core/module/user/view/groupEdit/groupEdit.php b/core/module/user/view/groupEdit/groupEdit.php index 94844076..8402093b 100644 --- a/core/module/user/view/groupEdit/groupEdit.php +++ b/core/module/user/view/groupEdit/groupEdit.php @@ -85,8 +85,7 @@

    -
    - +
    $this->getData(['group', $this->getUrl(2), 'folder', 'create']) @@ -112,12 +111,16 @@ 'checked' => $this->getData(['group', $this->getUrl(2), 'folder', 'permission']) ]); ?>
    -
    +
    + $this->getData(['group', $this->getUrl(2), 'folder', 'share']) + ]); ?> +
    'Racine du dossier partagé', + 'label' => 'Racine du partage', 'selected' => $this->getData(['group', $this->getUrl(2), 'folder', 'path']) ]); ?>