forked from ZwiiCMS-Team/ZwiiCMS
Protection des données de config
This commit is contained in:
parent
9158a48d39
commit
21580cf4fa
@ -230,8 +230,25 @@ class blog extends common {
|
|||||||
* Configuration
|
* Configuration
|
||||||
*/
|
*/
|
||||||
public function config() {
|
public function config() {
|
||||||
|
// Soumission du formulaire
|
||||||
|
if($this->isPost()) {
|
||||||
|
$this->setData(['module', $this->getUrl(0), 'config',[
|
||||||
|
'feeds' => $this->getInput('blogConfigShowFeeds',helper::FILTER_BOOLEAN),
|
||||||
|
'feedsLabel' => $this->getInput('blogConfigFeedslabel',helper::FILTER_STRING_SHORT)
|
||||||
|
]]);
|
||||||
|
// Valeurs en sortie
|
||||||
|
$this->addOutput([
|
||||||
|
'redirect' => helper::baseUrl() . $this->getUrl(0) . '/config',
|
||||||
|
'notification' => 'Modifications enregistrées',
|
||||||
|
'state' => true
|
||||||
|
]);
|
||||||
|
} else {
|
||||||
|
// Extraire la clé config mot clé réservé
|
||||||
|
$articles = $this->getData(['module', $this->getUrl(0)]);
|
||||||
|
unset($articles['config']);
|
||||||
// Ids des articles par ordre de publication
|
// Ids des articles par ordre de publication
|
||||||
$articleIds = array_keys(helper::arrayCollumn($this->getData(['module', $this->getUrl(0)]), 'publishedOn', 'SORT_DESC'));
|
$articleIds = array_keys(helper::arrayCollumn($articles, 'publishedOn', 'SORT_DESC'));
|
||||||
|
// Supprimer le bloc config
|
||||||
// Pagination
|
// Pagination
|
||||||
$pagination = helper::pagination($articleIds, $this->getUrl(),$this->getData(['config','itemsperPage']));
|
$pagination = helper::pagination($articleIds, $this->getUrl(),$this->getData(['config','itemsperPage']));
|
||||||
// Liste des pages
|
// Liste des pages
|
||||||
@ -266,6 +283,7 @@ class blog extends common {
|
|||||||
'view' => 'config'
|
'view' => 'config'
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Suppression
|
* Suppression
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
<div class="row">
|
<?php echo template::formOpen('blogConfig'); ?>
|
||||||
|
<div class="row">
|
||||||
<div class="col2">
|
<div class="col2">
|
||||||
<?php echo template::button('blogConfigBack', [
|
<?php echo template::button('blogConfigBack', [
|
||||||
'class' => 'buttonGrey',
|
'class' => 'buttonGrey',
|
||||||
@ -7,7 +8,7 @@
|
|||||||
'value' => 'Retour'
|
'value' => 'Retour'
|
||||||
]); ?>
|
]); ?>
|
||||||
</div>
|
</div>
|
||||||
<div class="col3 offset5">
|
<div class="col3 offset3">
|
||||||
<?php echo template::button('blogConfigComment', [
|
<?php echo template::button('blogConfigComment', [
|
||||||
'href' => helper::baseUrl() . $this->getUrl(0) . '/comment',
|
'href' => helper::baseUrl() . $this->getUrl(0) . '/comment',
|
||||||
'value' => 'Gérer les commentaires'
|
'value' => 'Gérer les commentaires'
|
||||||
@ -20,13 +21,37 @@
|
|||||||
'value' => 'Article'
|
'value' => 'Article'
|
||||||
]); ?>
|
]); ?>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
<div class="col2">
|
||||||
<?php if($module::$articles): ?>
|
<?php echo template::submit('blogConfigSubmit'); ?>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col12">
|
||||||
|
<div class="block">
|
||||||
|
<h4>Paramètres du module</h4>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col6">
|
||||||
|
<?php echo template::checkbox('blogConfigShowFeeds', true, 'Afficher les flux RSS', [
|
||||||
|
'checked' => $this->getData(['module', $this->getUrl(0), 'config', 'feeds']),
|
||||||
|
]); ?>
|
||||||
|
</div>
|
||||||
|
<div class="col6">
|
||||||
|
<?php echo template::text('blogConfigFeedslabel', [
|
||||||
|
'label' => 'Etiquette',
|
||||||
|
'value' => empty($this->getData(['module', $this->getUrl(0), 'config','feedsLabel'])) ? 'Syndication RSS' : $this->getData(['module', $this->getUrl(0), 'config', 'feedsLabel'])
|
||||||
|
]); ?>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<?php if($module::$articles): ?>
|
||||||
<?php echo template::table([4, 4, 2, 1, 1], $module::$articles, ['Titre', 'Date de publication', 'État', '', '']); ?>
|
<?php echo template::table([4, 4, 2, 1, 1], $module::$articles, ['Titre', 'Date de publication', 'État', '', '']); ?>
|
||||||
<?php echo $module::$pages; ?>
|
<?php echo $module::$pages; ?>
|
||||||
<?php else: ?>
|
<?php else: ?>
|
||||||
<?php echo template::speech('Aucun article.'); ?>
|
<?php echo template::speech('Aucun article.'); ?>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
<div class="moduleVersion">Version n°
|
<?php echo template::formClose(); ?>
|
||||||
|
<div class="moduleVersion">Version n°
|
||||||
<?php echo $module::BLOG_VERSION; ?>
|
<?php echo $module::BLOG_VERSION; ?>
|
||||||
</div>
|
</div>
|
Loading…
Reference in New Issue
Block a user