forked from ZwiiCMS-Team/ZwiiCMS
Revert "Merge commit 'f924a2b2b3a8a6c53ce050da64e57ac76d388872'"
This reverts commitb8c0b47faf
, reversing changes made tof5f04c90d9
.
This commit is contained in:
parent
b8c0b47faf
commit
8d324f9c79
@ -129,7 +129,7 @@ class JsonDb extends \Prowebcraft\Dot
|
||||
}
|
||||
}
|
||||
$this->data = json_decode(file_get_contents($this->db), true);
|
||||
if (!$this->data === null && json_last_error() !== JSON_ERROR_NONE) {
|
||||
if (!$this->data === null) {
|
||||
throw new \InvalidArgumentException('Database file ' . $this->db
|
||||
. ' contains invalid json object. Please validate or remove file');
|
||||
}
|
||||
|
@ -761,9 +761,8 @@ class core extends common
|
||||
// Librairies
|
||||
if ($output['vendor'] !== $this->output['vendor']) {
|
||||
$this->addOutput([
|
||||
'vendor' => array_merge($this->output['vendor'], $this->output['vendor'])
|
||||
'vendor' => array_merge($this->output['vendor'], $output['vendor'])
|
||||
]);
|
||||
|
||||
}
|
||||
|
||||
if ($output['title'] !== null) {
|
||||
|
@ -1,149 +0,0 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* This file is part of Zwii.
|
||||
*
|
||||
* For full copyright and license information, please see the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*
|
||||
* @author Rémi Jean <remi.jean@outlook.com>
|
||||
* @copyright Copyright (C) 2008-2018, Rémi Jean
|
||||
* @author Frédéric Tempez <frederic.tempez@outlook.com>
|
||||
* @copyright Copyright (C) 2018-2024, Frédéric Tempez
|
||||
* @license CC Attribution-NonCommercial-NoDerivatives 4.0 International
|
||||
* @link http://zwiicms.fr/
|
||||
*/
|
||||
|
||||
class folder extends common
|
||||
{
|
||||
|
||||
const VERSION = '0.1';
|
||||
const REALNAME = 'Partage de dossier';
|
||||
const DATADIRECTORY = ''; // Contenu localisé inclus par défaut (page.json et module.json)
|
||||
|
||||
public static $actions = [
|
||||
'config' => self::GROUP_EDITOR,
|
||||
'index' => self::GROUP_VISITOR,
|
||||
];
|
||||
|
||||
// Contenu du chemin sélectionné
|
||||
public static $folders = '';
|
||||
|
||||
public static $sharePath = [
|
||||
'site/file/source/'
|
||||
];
|
||||
|
||||
public function index()
|
||||
{
|
||||
|
||||
self::$folders = $this->getFolderContent($this->getData(['module', $this->getUrl(0), 'path']));
|
||||
|
||||
// Valeurs en sortie
|
||||
$this->addOutput([
|
||||
'showBarEditButton' => true,
|
||||
'showPageContent' => true,
|
||||
'view' => 'index'
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
public function config()
|
||||
{
|
||||
// Soumission du formulaire
|
||||
if (
|
||||
$this->getUser('permission', __CLASS__, __FUNCTION__) === true &&
|
||||
$this->isPost()
|
||||
) {
|
||||
$this->setData(['module', $this->getUrl(0), 'path', preg_replace('/^\\./', '', $this->getInput('folderEditPath')) ]);
|
||||
|
||||
// Valeurs en sortie
|
||||
$this->addOutput([
|
||||
'redirect' => helper::baseUrl() . $this->getUrl(0),
|
||||
'notification' => helper::translate('Modifications enregistrées'),
|
||||
'state' => true
|
||||
]);
|
||||
|
||||
}
|
||||
|
||||
self::$sharePath = $this->getSubdirectories('site/file/source');
|
||||
self::$sharePath = array_flip(self::$sharePath);
|
||||
|
||||
// Valeurs en sortie
|
||||
$this->addOutput([
|
||||
'view' => 'config'
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
private function getFolderContent($chemin)
|
||||
{
|
||||
// Vérifier si le chemin existe et est un dossier
|
||||
if (is_dir($chemin)) {
|
||||
// Ouvrir le dossier
|
||||
if ($dh = opendir($chemin)) {
|
||||
$items = isset($items) ? $items : '<ul>';
|
||||
// Parcourir les éléments du dossier
|
||||
while (($element = readdir($dh)) !== false) {
|
||||
// Exclure les éléments spéciaux
|
||||
if ($element != '.' && $element != '..') {
|
||||
// Construire le chemin complet de l'élément
|
||||
$cheminComplet = $chemin . $element;
|
||||
|
||||
// Vérifier si c'est un dossier
|
||||
if (is_dir($cheminComplet)) {
|
||||
// Afficher le nom du dossier avec un élément details
|
||||
$items .= "<li class='directory'>$element";
|
||||
// Appeler récursivement la fonction pour ce sous-dossier
|
||||
$items .= $this->getFolderContent($cheminComplet);
|
||||
$items .= '</li>';
|
||||
} else {
|
||||
// Afficher le nom du fichier comme un lien
|
||||
$items .= "<li class='file'><a href='$cheminComplet' target='_blank'>$element</a></li>";
|
||||
}
|
||||
}
|
||||
}
|
||||
$items .= "</ul>";
|
||||
|
||||
// Fermer le dossier
|
||||
closedir($dh);
|
||||
}
|
||||
return $items;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Liste les dossier contenus dans RFM
|
||||
*/
|
||||
private function getSubdirectories($dir, $basePath = '')
|
||||
{
|
||||
$subdirs = array();
|
||||
// Ouvrez le répertoire spécifié
|
||||
$dh = opendir($dir);
|
||||
// Parcourez tous les fichiers et répertoires dans le répertoire
|
||||
while (($file = readdir($dh)) !== false) {
|
||||
// Ignorer les entrées de répertoire parent et actuel
|
||||
if ($file == '.' || $file == '..') {
|
||||
continue;
|
||||
}
|
||||
// Construisez le chemin complet du fichier ou du répertoire
|
||||
$path = $dir . '/' . $file;
|
||||
// Vérifiez si c'est un répertoire
|
||||
if (is_dir($path)) {
|
||||
// Construisez la clé et la valeur pour le tableau associatif
|
||||
$key = $basePath === '' ? ucfirst($file) : $basePath . '/' . $file;
|
||||
$value = $path . '/';
|
||||
// Ajouter la clé et la valeur au tableau associatif
|
||||
$subdirs[$key] = $value;
|
||||
// Appeler la fonction récursivement pour ajouter les sous-répertoires
|
||||
$subdirs = array_merge($subdirs, $this->getSubdirectories($path, $key));
|
||||
}
|
||||
}
|
||||
// Fermez le gestionnaire de dossier
|
||||
closedir($dh);
|
||||
return $subdirs;
|
||||
}
|
||||
|
||||
}
|
@ -1,19 +0,0 @@
|
||||
|
||||
/**
|
||||
* This file is part of Zwii.
|
||||
*
|
||||
* For full copyright and license information, please see the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*
|
||||
* @author Rémi Jean <remi.jean@outlook.com>
|
||||
* @copyright Copyright (C) 2008-2018, Rémi Jean
|
||||
* @author Frédéric Tempez <frederic.tempez@outlook.com>
|
||||
* @copyright Copyright (C) 2018-2024, Frédéric Tempez
|
||||
* @license CC Attribution-NonCommercial-NoDerivatives 4.0 International
|
||||
* @link http://zwiicms.fr/
|
||||
*/
|
||||
|
||||
/** NE PAS EFFACER
|
||||
* admin.css
|
||||
*/
|
||||
|
@ -1,33 +0,0 @@
|
||||
<?php echo template::formOpen('folderConfig'); ?>
|
||||
<div class="row">
|
||||
<div class="col1">
|
||||
<?php echo template::button('folderConfigBack', [
|
||||
'class' => 'buttonGrey',
|
||||
'href' => helper::baseUrl() . 'page/edit/' . $this->getUrl(0),
|
||||
'value' => template::ico('left')
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col2 offset9">
|
||||
<?php echo template::submit('folderConfigSubmit'); ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class='row'>
|
||||
<div class="col12">
|
||||
<div class="block">
|
||||
<h4><?php echo helper::translate('Paramètres'); ?></h4>
|
||||
<div class="row">
|
||||
<div class="col6">
|
||||
<?php echo template::select('folderEditPath', $module::$sharePath, [
|
||||
'label' => 'Dossier',
|
||||
'class' => 'filemanager',
|
||||
'selected' => $this->getData(['module', $this->getUrl(0), 'path'])
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php echo template::formClose(); ?>
|
||||
<div class="moduleVersion">Version n°
|
||||
<?php echo $module::VERSION; ?>
|
||||
</div>
|
@ -1,45 +0,0 @@
|
||||
#dirindex article {
|
||||
display: block;
|
||||
margin: 0 auto;
|
||||
width: 480px;
|
||||
}
|
||||
|
||||
#dirindex a {
|
||||
color: #004466;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
#dirindex a:hover {
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
#dirindex a:visited {
|
||||
color: #666666;
|
||||
}
|
||||
|
||||
#dirindex details summary,
|
||||
#dirindex details summary::-webkit-details-marker {
|
||||
list-style: none;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
#dirindex {
|
||||
list-style: none;
|
||||
}
|
||||
|
||||
#dirindex .directory {
|
||||
list-style-type: "\1F4C1";
|
||||
}
|
||||
|
||||
#dirindex .file {
|
||||
list-style-type: "\1F4C4";
|
||||
}
|
||||
|
||||
#dirindex ul li {
|
||||
margin-top: 10px;
|
||||
}
|
||||
|
||||
#dirindex li {
|
||||
padding-left: 5px;
|
||||
list-style-position : outside;
|
||||
}
|
@ -1,6 +0,0 @@
|
||||
<div id="dirindex">
|
||||
<article>
|
||||
<h1>Répertoire</h1>
|
||||
<?php echo $module::$folders; ?>
|
||||
</article>
|
||||
</div>
|
Loading…
Reference in New Issue
Block a user