forked from ZwiiCMS-Team/ZwiiCMS
Protection des données de config
This commit is contained in:
parent
9158a48d39
commit
21580cf4fa
@ -230,41 +230,59 @@ class blog extends common {
|
|||||||
* Configuration
|
* Configuration
|
||||||
*/
|
*/
|
||||||
public function config() {
|
public function config() {
|
||||||
// Ids des articles par ordre de publication
|
// Soumission du formulaire
|
||||||
$articleIds = array_keys(helper::arrayCollumn($this->getData(['module', $this->getUrl(0)]), 'publishedOn', 'SORT_DESC'));
|
if($this->isPost()) {
|
||||||
// Pagination
|
$this->setData(['module', $this->getUrl(0), 'config',[
|
||||||
$pagination = helper::pagination($articleIds, $this->getUrl(),$this->getData(['config','itemsperPage']));
|
'feeds' => $this->getInput('blogConfigShowFeeds',helper::FILTER_BOOLEAN),
|
||||||
// Liste des pages
|
'feedsLabel' => $this->getInput('blogConfigFeedslabel',helper::FILTER_STRING_SHORT)
|
||||||
self::$pages = $pagination['pages'];
|
]]);
|
||||||
// Articles en fonction de la pagination
|
// Valeurs en sortie
|
||||||
for($i = $pagination['first']; $i < $pagination['last']; $i++) {
|
$this->addOutput([
|
||||||
// Met en forme le tableau
|
'redirect' => helper::baseUrl() . $this->getUrl(0) . '/config',
|
||||||
$date = mb_detect_encoding(strftime('%d %B %Y', $this->getData(['module', $this->getUrl(0), $articleIds[$i], 'publishedOn'])), 'UTF-8', true)
|
'notification' => 'Modifications enregistrées',
|
||||||
? strftime('%d %B %Y', $this->getData(['module', $this->getUrl(0), $articleIds[$i], 'publishedOn']))
|
'state' => true
|
||||||
: utf8_encode(strftime('%d %B %Y', $this->getData(['module', $this->getUrl(0), $articleIds[$i], 'publishedOn'])));
|
]);
|
||||||
$heure = mb_detect_encoding(strftime('%H:%M', $this->getData(['module', $this->getUrl(0), $articleIds[$i], 'publishedOn'])), 'UTF-8', true)
|
} else {
|
||||||
? strftime('%H:%M', $this->getData(['module', $this->getUrl(0), $articleIds[$i], 'publishedOn']))
|
// Extraire la clé config mot clé réservé
|
||||||
: utf8_encode(strftime('%H:%M', $this->getData(['module', $this->getUrl(0), $articleIds[$i], 'publishedOn'])));
|
$articles = $this->getData(['module', $this->getUrl(0)]);
|
||||||
self::$articles[] = [
|
unset($articles['config']);
|
||||||
$this->getData(['module', $this->getUrl(0), $articleIds[$i], 'title']),
|
// Ids des articles par ordre de publication
|
||||||
$date .' à '. $heure,
|
$articleIds = array_keys(helper::arrayCollumn($articles, 'publishedOn', 'SORT_DESC'));
|
||||||
self::$states[$this->getData(['module', $this->getUrl(0), $articleIds[$i], 'state'])],
|
// Supprimer le bloc config
|
||||||
template::button('blogConfigEdit' . $articleIds[$i], [
|
// Pagination
|
||||||
'href' => helper::baseUrl() . $this->getUrl(0) . '/edit/' . $articleIds[$i] . '/' . $_SESSION['csrf'],
|
$pagination = helper::pagination($articleIds, $this->getUrl(),$this->getData(['config','itemsperPage']));
|
||||||
'value' => template::ico('pencil')
|
// Liste des pages
|
||||||
]),
|
self::$pages = $pagination['pages'];
|
||||||
template::button('blogConfigDelete' . $articleIds[$i], [
|
// Articles en fonction de la pagination
|
||||||
'class' => 'blogConfigDelete buttonRed',
|
for($i = $pagination['first']; $i < $pagination['last']; $i++) {
|
||||||
'href' => helper::baseUrl() . $this->getUrl(0) . '/delete/' . $articleIds[$i] . '/' . $_SESSION['csrf'],
|
// Met en forme le tableau
|
||||||
'value' => template::ico('cancel')
|
$date = mb_detect_encoding(strftime('%d %B %Y', $this->getData(['module', $this->getUrl(0), $articleIds[$i], 'publishedOn'])), 'UTF-8', true)
|
||||||
])
|
? strftime('%d %B %Y', $this->getData(['module', $this->getUrl(0), $articleIds[$i], 'publishedOn']))
|
||||||
];
|
: utf8_encode(strftime('%d %B %Y', $this->getData(['module', $this->getUrl(0), $articleIds[$i], 'publishedOn'])));
|
||||||
|
$heure = mb_detect_encoding(strftime('%H:%M', $this->getData(['module', $this->getUrl(0), $articleIds[$i], 'publishedOn'])), 'UTF-8', true)
|
||||||
|
? strftime('%H:%M', $this->getData(['module', $this->getUrl(0), $articleIds[$i], 'publishedOn']))
|
||||||
|
: utf8_encode(strftime('%H:%M', $this->getData(['module', $this->getUrl(0), $articleIds[$i], 'publishedOn'])));
|
||||||
|
self::$articles[] = [
|
||||||
|
$this->getData(['module', $this->getUrl(0), $articleIds[$i], 'title']),
|
||||||
|
$date .' à '. $heure,
|
||||||
|
self::$states[$this->getData(['module', $this->getUrl(0), $articleIds[$i], 'state'])],
|
||||||
|
template::button('blogConfigEdit' . $articleIds[$i], [
|
||||||
|
'href' => helper::baseUrl() . $this->getUrl(0) . '/edit/' . $articleIds[$i] . '/' . $_SESSION['csrf'],
|
||||||
|
'value' => template::ico('pencil')
|
||||||
|
]),
|
||||||
|
template::button('blogConfigDelete' . $articleIds[$i], [
|
||||||
|
'class' => 'blogConfigDelete buttonRed',
|
||||||
|
'href' => helper::baseUrl() . $this->getUrl(0) . '/delete/' . $articleIds[$i] . '/' . $_SESSION['csrf'],
|
||||||
|
'value' => template::ico('cancel')
|
||||||
|
])
|
||||||
|
];
|
||||||
|
}
|
||||||
|
// Valeurs en sortie
|
||||||
|
$this->addOutput([
|
||||||
|
'title' => 'Configuration du module',
|
||||||
|
'view' => 'config'
|
||||||
|
]);
|
||||||
}
|
}
|
||||||
// Valeurs en sortie
|
|
||||||
$this->addOutput([
|
|
||||||
'title' => 'Configuration du module',
|
|
||||||
'view' => 'config'
|
|
||||||
]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1,32 +1,57 @@
|
|||||||
<div class="row">
|
<?php echo template::formOpen('blogConfig'); ?>
|
||||||
<div class="col2">
|
<div class="row">
|
||||||
<?php echo template::button('blogConfigBack', [
|
<div class="col2">
|
||||||
'class' => 'buttonGrey',
|
<?php echo template::button('blogConfigBack', [
|
||||||
'href' => helper::baseUrl() . 'page/edit/' . $this->getUrl(0),
|
'class' => 'buttonGrey',
|
||||||
'ico' => 'left',
|
'href' => helper::baseUrl() . 'page/edit/' . $this->getUrl(0),
|
||||||
'value' => 'Retour'
|
'ico' => 'left',
|
||||||
]); ?>
|
'value' => 'Retour'
|
||||||
|
]); ?>
|
||||||
|
</div>
|
||||||
|
<div class="col3 offset3">
|
||||||
|
<?php echo template::button('blogConfigComment', [
|
||||||
|
'href' => helper::baseUrl() . $this->getUrl(0) . '/comment',
|
||||||
|
'value' => 'Gérer les commentaires'
|
||||||
|
]); ?>
|
||||||
|
</div>
|
||||||
|
<div class="col2">
|
||||||
|
<?php echo template::button('blogConfigAdd', [
|
||||||
|
'href' => helper::baseUrl() . $this->getUrl(0) . '/add',
|
||||||
|
'ico' => 'plus',
|
||||||
|
'value' => 'Article'
|
||||||
|
]); ?>
|
||||||
|
</div>
|
||||||
|
<div class="col2">
|
||||||
|
<?php echo template::submit('blogConfigSubmit'); ?>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="col3 offset5">
|
<div class="row">
|
||||||
<?php echo template::button('blogConfigComment', [
|
<div class="col12">
|
||||||
'href' => helper::baseUrl() . $this->getUrl(0) . '/comment',
|
<div class="block">
|
||||||
'value' => 'Gérer les commentaires'
|
<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>
|
</div>
|
||||||
<div class="col2">
|
<?php if($module::$articles): ?>
|
||||||
<?php echo template::button('blogConfigAdd', [
|
<?php echo template::table([4, 4, 2, 1, 1], $module::$articles, ['Titre', 'Date de publication', 'État', '', '']); ?>
|
||||||
'href' => helper::baseUrl() . $this->getUrl(0) . '/add',
|
<?php echo $module::$pages; ?>
|
||||||
'ico' => 'plus',
|
<?php else: ?>
|
||||||
'value' => 'Article'
|
<?php echo template::speech('Aucun article.'); ?>
|
||||||
]); ?>
|
<?php endif; ?>
|
||||||
</div>
|
<?php echo template::formClose(); ?>
|
||||||
</div>
|
<div class="moduleVersion">Version n°
|
||||||
<?php if($module::$articles): ?>
|
<?php echo $module::BLOG_VERSION; ?>
|
||||||
<?php echo template::table([4, 4, 2, 1, 1], $module::$articles, ['Titre', 'Date de publication', 'État', '', '']); ?>
|
</div>
|
||||||
<?php echo $module::$pages; ?>
|
|
||||||
<?php else: ?>
|
|
||||||
<?php echo template::speech('Aucun article.'); ?>
|
|
||||||
<?php endif; ?>
|
|
||||||
<div class="moduleVersion">Version n°
|
|
||||||
<?php echo $module::BLOG_VERSION; ?>
|
|
||||||
</div>
|
|
Loading…
x
Reference in New Issue
Block a user