Profil RFM

This commit is contained in:
Fred Tempez 2023-05-10 16:50:02 +02:00
parent 4901cb9052
commit f2636c87d8
7 changed files with 84 additions and 25 deletions

View File

@ -317,7 +317,7 @@ class layout extends common
$items .= '<span id="footerDisplayCookie"';
$items .= ($this->getData(['config', 'cookieConsent']) === true && $this->getData(['theme', 'footer', 'displayCookie']) === true) ? '>' : ' class="displayNone" >';
$label = empty($this->getData(['locale', 'cookies', 'cookiesFooterText'])) ? 'Cookies' : $this->getData(['locale', 'cookies', 'cookiesFooterText']);
$items .= '<wbr>&nbsp;|&nbsp;<a href="javascript:void(0)" class="skiptranslate" id="footerLinkCookie">' . $label . '</a>';
$items .= '<wbr>&nbsp;|&nbsp;<a href="javascript:void(0)" id="footerLinkCookie">' . $label . '</a>';
$items .= '</span>';
// Affichage du lien de connexion
if (
@ -344,7 +344,7 @@ class layout extends common
$items .= $this->getData(['theme', 'footer', 'displaymemberAccount']) === false ? ' class="displayNone">' : '>';
$items .= '<wbr>&nbsp;|&nbsp;';
if (
$this->getUser('group') >= self::GROUP_MEMBER && $this->getPermission('folder', 'share') === true
$this->getPermission('filemanager') === true
) {
$items .= '<wbr>' . 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']),
@ -354,10 +354,10 @@ class layout extends common
]);
}
$items .= '<wbr>' . template::ico('user', [
'margin' => 'all',
'help' => 'Mon compte',
'href' => helper::baseUrl() . 'user/edit/' . $this->getUser('id') . '/' . $_SESSION['csrf']
]);
'margin' => 'all',
'help' => 'Mon compte',
'href' => helper::baseUrl() . 'user/edit/' . $this->getUser('id') . '/' . $_SESSION['csrf']
]);
$items .= '<wbr>' . template::ico('logout', [
'margin' => 'all',
'help' => 'Déconnecter',
@ -523,14 +523,14 @@ class layout extends common
// Drapeau les langues
foreach (self::$languages as $key => $value) {
if (is_dir(self::DATA_DIR . $key)) {
$t[] = $this->showi18n($key);
$t[] = $this->showi18n($key);
}
}
// Pas de drapeau si la langue est unique
if (count($t) > 1) {
foreach ($t as $key) {
echo $key;
}
}
}
echo '</ul>';
}
@ -926,7 +926,7 @@ class layout extends common
}
$leftItems .= '</optgroup' >
// Afficher les barres
$leftItems .= '<optgroup label="'.helper::translate('Barres latérales').'">';
$leftItems .= '<optgroup label="' . helper::translate('Barres latérales') . '">';
foreach ($this->getHierarchy(null, false, true) as $parentPageId => $childrenPageIds) {
$leftItems .= '<option value="' . helper::baseUrl() . $parentPageId . '"' . ($parentPageId === $currentPageId ? ' selected' : false) . '>' . $this->getData(['page', $parentPageId, 'shortTitle']) . '</option>';
foreach ($childrenPageIds as $childKey) {
@ -977,7 +977,10 @@ class layout extends common
}
// Items de droite
$rightItems = '';
if ($this->getUser('group') >= self::GROUP_MODERATOR) {
if (
$this->getUser('group') >= self::GROUP_MODERATOR
&& $this->getPermission('filemanager')
) {
$rightItems .= '<li>' . template::ico('folder', [
'help' => 'Fichiers',
'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']),

View File

@ -415,7 +415,6 @@ class common
// Mise à jour des données core
include('core/include/update.inc.php');
// Données de proxy
$proxy = $this->getData(['config', 'proxyType']) . $this->getData(['config', 'proxyUrl']) . ':' . $this->getData(['config', 'proxyPort']);
if (
@ -911,13 +910,25 @@ class common
{
if (is_array($this->user) === false) {
return false;
} elseif ($key2 === null && array_key_exists($key1, $this->getData(['profil', $this->user['group']]))) {
return $this->getData(['profil', $this->user['group'], $key1]);
} elseif ($key2 && array_key_exists($key2, $this->getData(['profil', $this->user['group'], $key1]))) {
return $this->getData(['profil', $this->user['group'], $key1, $key2]);
} elseif ($this->getUser('group') === self::GROUP_ADMIN) {
return true;
} elseif ($this->getUser('group') < 1) {
return false;
} elseif (
$key2
&& $this->getData(['profil', $this->user['group'], $this->user['profil'], $key1])
&& array_key_exists($key2, $this->getData(['profil', $this->user['group'], $this->user['profil'], $key1]))
) {
return $this->getData(['profil', $this->user['group'], $this->user['profil'], $key1, $key2]);
} elseif (
$this->getData(['profil', $this->user['group'], $this->user['profil']])
&& array_key_exists($key1, $this->getData(['profil', $this->user['group'], $this->user['profil']]))
) {
return $this->getData(['profil', $this->user['group'], $this->user['profil'], $key1]);
} else {
return false;
}
}
/**
@ -1320,12 +1331,13 @@ class common
/**
* Journalisation
*/
public function saveLog($message = '') {
public function saveLog($message = '')
{
// Journalisation
$dataLog = helper::dateUTF8('%Y %m %d', time()) . ' - ' . helper::dateUTF8('%H:%M', time());
$dataLog .= helper::getIp($this->getData(['config', 'connect', 'anonymousIp'])) . ';';
$dataLog .= empty($this->getUser('id')) ? 'visitor;' : $this->getUser('id') . ';';
$dataLog .= $message ? $this->getUrl() . ';'. $message : $this->getUrl();
$dataLog .= $message ? $this->getUrl() . ';' . $message : $this->getUrl();
$dataLog .= PHP_EOL;
if ($this->getData(['config', 'connect', 'log'])) {
file_put_contents(self::DATA_DIR . 'journal.log', $dataLog, FILE_APPEND);

View File

@ -313,6 +313,7 @@ class init extends common
'name' => 'Membre simple',
'readonly' => false,
'comment' => 'Accède aux pages réservées',
'filemanager' => false,
'file' => [
'download' => false,
'edit' => false,
@ -333,13 +334,14 @@ class init extends common
'copycut' => false,
'chmod' => false,
'share' => false,
'path' => './site/file/source/partage/',
'path' => null,
]
],
'1' => [
'name' => 'Membre',
'readonly' => false,
'comment' => 'Accède aux pages réservées et à un dossier partagé',
'filemanager' => true,
'file' => [
'download' => false,
'edit' => false,
@ -369,6 +371,7 @@ class init extends common
'name' => 'Modérateur',
'readonly' => false,
'comment' => 'Edition des pages',
'filemanager' => true,
'file' => [
'download' => true,
'edit' => true,
@ -396,6 +399,7 @@ class init extends common
'name' => 'Editeur avec gestion des fichiers',
'readonly' => false,
'comment' => 'Edition des pages',
'filemanager' => true,
'file' => [
'download' => true,
'edit' => true,

View File

@ -535,8 +535,6 @@ class user extends common
$this->deleteData(['profil', $oldGroup, $profil]);
$profil = helper::increment($profil, $this->getData(['profil', $group]));
}
echo "groupe " . $group;
echo "profil " . $profil;
$this->setData([
'profil',
$group,
@ -545,6 +543,7 @@ class user extends common
'name' => $this->getInput('profilEditName', helper::FILTER_STRING_SHORT, true),
'readonly' => false,
'comment' => $this->getInput('profilEditComment', helper::FILTER_STRING_SHORT, true),
'filemanager' => $this->getInput('profilEditFileManager', helper::FILTER_BOOLEAN),
'file' => [
'download' => $this->getInput('profilEditDownload', helper::FILTER_BOOLEAN),
'edit' => $this->getInput('profilEditEdit', helper::FILTER_BOOLEAN),
@ -564,7 +563,6 @@ class user extends common
'rename' => $this->getInput('profilEditFolderRename', helper::FILTER_BOOLEAN),
'copycut' => $this->getInput('profilEditFolderCopycut', helper::FILTER_BOOLEAN),
'chmod' => $this->getInput('profilEditFolderChmod', helper::FILTER_BOOLEAN),
'share' => $this->getInput('profilEditShare', helper::FILTER_BOOLEAN),
'path' => $this->getInput('profilEditPath'),
]
]
@ -595,6 +593,48 @@ class user extends common
public function profilAdd()
{
// Soumission du formulaire
if ($this->isPost()) {
// Sauvegarder les données
$this->setData([
'profil',
$this->getInput('profilAddGroup'),
$this->getInput('profilAddProfil'),
[
'name' => $this->getInput('profilAddName', helper::FILTER_STRING_SHORT, true),
'readonly' => false,
'comment' => $this->getInput('profilAddComment', helper::FILTER_STRING_SHORT, true),
'filemanager' => $this->getInput('profilAddFileManager', helper::FILTER_BOOLEAN),
'file' => [
'download' => $this->getInput('profilAddDownload', helper::FILTER_BOOLEAN),
'edit' => $this->getInput('profilAddEdit', helper::FILTER_BOOLEAN),
'create' => $this->getInput('profilAddCreate', helper::FILTER_BOOLEAN),
'rename' => $this->getInput('profilAddRename', helper::FILTER_BOOLEAN),
'upload' => $this->getInput('profilAddUpload', helper::FILTER_BOOLEAN),
'delete' => $this->getInput('profilAddDelete', helper::FILTER_BOOLEAN),
'preview' => $this->getInput('profilAddPreview', helper::FILTER_BOOLEAN),
'duplicate' => $this->getInput('profilAddDuplicate', helper::FILTER_BOOLEAN),
'extract' => $this->getInput('profilAddExtract', helper::FILTER_BOOLEAN),
'copycut' => $this->getInput('profilAddCopycut', helper::FILTER_BOOLEAN),
'chmod' => $this->getInput('profilAddChmod', helper::FILTER_BOOLEAN),
],
'folder' => [
'create' => $this->getInput('profilAddFolderCreate', helper::FILTER_BOOLEAN),
'delete' => $this->getInput('profilAddFolderDelete', helper::FILTER_BOOLEAN),
'rename' => $this->getInput('profilAddFolderRename', helper::FILTER_BOOLEAN),
'copycut' => $this->getInput('profilAddFolderCopycut', helper::FILTER_BOOLEAN),
'chmod' => $this->getInput('profilAddFolderChmod', helper::FILTER_BOOLEAN),
'path' => $this->getInput('profilAddPath'),
]
]
]);
// Valeurs en sortie
$this->addOutput([
'redirect' => helper::baseUrl() . 'user/profil',
'notification' => helper::translate('Modifications enregistrées'),
'state' => true
]);
}
// Valeurs en sortie;
$this->addOutput([

View File

@ -52,7 +52,7 @@
</h4>
<div class="row">
<div class="col3">
<?php echo template::checkbox('profilAddShare', true, 'Activé'); ?>
<?php echo template::checkbox('profilAddFileManager', true, 'Activé'); ?>
</div>
<div class="col6">
<?php echo template::select('profilAddPath', $module::$sharePath, [

View File

@ -52,8 +52,8 @@
</h4>
<div class="row">
<div class="col3">
<?php echo template::checkbox('profilEditShare', true, 'Activé', [
'checked' => $this->getData(['profil', $this->getUrl(2), $this->getUrl(3), 'folder', 'share'])
<?php echo template::checkbox('profilEditFileManager', true, 'Activé', [
'checked' => $this->getData(['profil', $this->getUrl(2), $this->getUrl(3), 'filemanager'])
]); ?>
</div>
<div class="col6">

View File

@ -424,7 +424,7 @@ $config = array(
// for copy/cut files
'copy_cut_dirs' => $folder['copycut'] ? $folder['copycut'] : false,
// for copy/cut directories
'chmod_files' => $file['permission'] ? $file['permission'] : false,
'chmod_files' => $file['chmod'] ? $file['chmod'] : false,
// change file permissions
'chmod_dirs' => $folder['chmod'] ? $folder['chmod'] : false,
// change folder permissions