Merge branch 'master' into 10400

This commit is contained in:
Fred Tempez 2020-11-18 21:45:14 +01:00
commit a9ee02d1bc
35 changed files with 3802 additions and 327 deletions

View File

@ -15,10 +15,16 @@
- Approbation des commentaires - Approbation des commentaires
- Gestion des thèmes : - Gestion des thèmes :
- Bouton de réinitialisation avec confirmation - Bouton de réinitialisation avec confirmation
## Version 10.3.07
- Petites corrections
- Bouton format dans TinyMCE
## version 10.3.06 ## version 10.3.06
- Correction : - Correction :
- Edition de page avec module, le changement de mise en page désactive le bouton d'option du module. - Edition de page avec module, le changement de mise en page désactive le bouton d'option du module.
- Modification :
- Modules News et Blog : ajout de l'option flux RSS. L'option est activée par défaut.
## version 10.3.05 ## version 10.3.05
- Correction : - Correction :

View File

@ -17,9 +17,10 @@ class common {
const DISPLAY_RAW = 0; const DISPLAY_RAW = 0;
const DISPLAY_JSON = 1; const DISPLAY_JSON = 1;
const DISPLAY_LAYOUT_BLANK = 2; const DISPLAY_RSS = 2;
const DISPLAY_LAYOUT_MAIN = 3; const DISPLAY_LAYOUT_BLANK = 3;
const DISPLAY_LAYOUT_LIGHT = 4; const DISPLAY_LAYOUT_MAIN = 4;
const DISPLAY_LAYOUT_LIGHT = 5;
const GROUP_BANNED = -1; const GROUP_BANNED = -1;
const GROUP_VISITOR = 0; const GROUP_VISITOR = 0;
const GROUP_MEMBER = 1; const GROUP_MEMBER = 1;
@ -938,8 +939,9 @@ class common {
public function setData($keys = []) { public function setData($keys = []) {
// Pas d'enregistrement lorsqu'une notice est présente ou tableau transmis vide // Pas d'enregistrement lorsqu'une notice est présente ou tableau transmis vide
if (!empty(self::$inputNotices if (!empty(self::$inputNotices)
OR empty($keys))) { OR empty($keys)
OR in_array(NULL, $keys) ) {
return false; return false;
} }
@ -1427,6 +1429,39 @@ class common {
} }
$this->setData(['core', 'dataVersion', 10304]); $this->setData(['core', 'dataVersion', 10304]);
} }
// Version 10.3.06
if ($this->getData(['core', 'dataVersion']) < 10306) {
// Liste des pages
$pageList = array();
foreach ($this->getHierarchy(null,null,null) as $parentKey=>$parentValue) {
$pageList [] = $parentKey;
foreach ($parentValue as $childKey) {
$pageList [] = $childKey;
}
}
// Mettre à jour les données des blogs les articles sont dans posts
foreach ($pageList as $parentKey => $parent) {
//La page a une galerie
if ($this->getData(['page',$parent,'moduleId']) === 'blog' ) {
foreach ( $this->getData(['module', $parent]) as $blogKey => $blogItem) {
$data = $this->getdata(['module',$parent,$blogKey]);
$this->deleteData(['module',$parent, $blogKey]);
$this->setData([ 'module', $parent, 'posts', $blogKey, $data ]);
}
}
}
foreach ($pageList as $parentKey => $parent) {
//La page a une galerie
if ($this->getData(['page',$parent,'moduleId']) === 'news' ) {
foreach ( $this->getData(['module', $parent]) as $newsKey => $newsItem) {
$data = $this->getdata(['module',$parent,$newsKey]);
$this->deleteData(['module',$parent, $newsKey]);
$this->setData([ 'module', $parent, 'posts', $newsKey, $data ]);
}
}
}
$this->setData(['core', 'dataVersion', 10306]);
}
// Version 10.4.00 // Version 10.4.00
if ($this->getData(['core', 'dataVersion']) < 10400) { if ($this->getData(['core', 'dataVersion']) < 10400) {
// Ajouter le prénom comme pseudo et le pseudo comme signature // Ajouter le prénom comme pseudo et le pseudo comme signature
@ -1448,24 +1483,24 @@ class common {
foreach ($pageList as $parentKey => $parent) { foreach ($pageList as $parentKey => $parent) {
//La page a une galerie //La page a une galerie
if ($this->getData(['page',$parent,'moduleId']) === 'blog' ) { if ($this->getData(['page',$parent,'moduleId']) === 'blog' ) {
$articleIds = array_keys(helper::arrayCollumn($this->getData(['module',$parent]), 'publishedOn', 'SORT_DESC')); $articleIds = array_keys(helper::arrayCollumn($this->getData(['module',$parent], 'posts'), 'publishedOn', 'SORT_DESC'));
foreach ($articleIds as $key => $article) { foreach ($articleIds as $key => $article) {
// Droits les deux groupes // Droits les deux groupes
$this->setData(['module', $parent, $article,'editConsent', 3]); $this->setData(['module', $parent, 'posts', $article,'editConsent', 3]);
// Limite de taille 500 // Limite de taille 500
$this->setData(['module', $parent, $article,'commentMaxlength', '500']); $this->setData(['module', $parent, 'posts', $article,'commentMaxlength', '500']);
// Pas d'approbation des commentaires // Pas d'approbation des commentaires
$this->setData(['module', $parent, $article,'commentApproved', false ]); $this->setData(['module', $parent, 'posts', $article,'commentApproved', false ]);
// pas de notification // pas de notification
$this->setData(['module', $parent, $article,'commentNotification', false ]); $this->setData(['module', $parent, 'posts', $article,'commentNotification', false ]);
// groupe de notification // groupe de notification
$this->setData(['module', $parent, $article,'commentGroupNotification', 3 ]); $this->setData(['module', $parent, 'posts', $article,'commentGroupNotification', 3 ]);
} }
// Traitement des commentaires // Traitement des commentaires
if ( is_array($this->getData(['module', $parent, $article,'comment'])) ) { if ( is_array($this->getData(['module', $parent, 'posts', $article,'comment'])) ) {
foreach($this->getData(['module', $parent, $article,'comment']) as $commentId => $comment) { foreach($this->getData(['module', $parent, 'posts', $article,'comment']) as $commentId => $comment) {
// Approbation // Approbation
$this->setData(['module', $parent, $article,'comment', $commentId, 'approval', true ]); $this->setData(['module', $parent, 'posts', $article,'comment', $commentId, 'approval', true ]);
} }
} }
} }
@ -1885,7 +1920,7 @@ class core extends common {
'title' => $title, 'title' => $title,
// Meta description = 160 premiers caractères de l'article // Meta description = 160 premiers caractères de l'article
'metaDescription' => $this->getData(['page',$this->getUrl(0),'moduleId']) === 'blog' && !empty($this->getUrl(1)) 'metaDescription' => $this->getData(['page',$this->getUrl(0),'moduleId']) === 'blog' && !empty($this->getUrl(1))
? strip_tags(substr($this->getData(['module',$this->getUrl(0),$this->getUrl(1),'content']) ,0,159)) ? strip_tags(substr($this->getData(['module',$this->getUrl(0),'posts',$this->getUrl(1),'content']) ,0,159))
: $this->getData(['page', $this->getUrl(0), 'metaDescription']), : $this->getData(['page', $this->getUrl(0), 'metaDescription']),
'metaTitle' => $this->getData(['page', $this->getUrl(0), 'metaTitle']), 'metaTitle' => $this->getData(['page', $this->getUrl(0), 'metaTitle']),
'typeMenu' => $this->getData(['page', $this->getUrl(0), 'typeMenu']), 'typeMenu' => $this->getData(['page', $this->getUrl(0), 'typeMenu']),
@ -2130,7 +2165,12 @@ class core extends common {
header('Content-Type: application/json'); header('Content-Type: application/json');
echo json_encode($this->output['content']); echo json_encode($this->output['content']);
break; break;
// Layout alléger // RSS feed
case self::DISPLAY_RSS:
header('Content-type: application/rss+xml; charset=UTF-8');
echo $this->output['content'];
break;
// Layout allégé
case self::DISPLAY_LAYOUT_LIGHT: case self::DISPLAY_LAYOUT_LIGHT:
require 'core/layout/light.php'; require 'core/layout/light.php';
break; break;

View File

@ -648,65 +648,55 @@ class init extends common {
], ],
'module' => [ 'module' => [
'blog' => [ 'blog' => [
'mon-premier-article' => [ 'config' => [
'comment' => [ 'feeds' => true,
'58e11d09e5aff' => [ 'feedsLabel' => "Syndication RSS"
'author' => 'Rémi', ],
'content' => 'Article bien rédigé et très pertinent, bravo !', 'posts' => [
'createdOn' => 1421748000, 'mon-premier-article' => [
'userId' => '', 'closeComment' => false,
'approval' => true 'comment' => [
] '58e11d09e5aff' => [
'author' => 'Rémi',
'content' => 'Article bien rédigé et très pertinent, bravo !',
'createdOn' => 1421748000,
'userId' => ''
]
],
'content' => '<p>Et eodem impetu Domitianum praecipitem per scalas itidem funibus constrinxerunt, eosque coniunctos per ampla spatia civitatis acri raptavere discursu. iamque artuum et membrorum divulsa conpage superscandentes corpora mortuorum ad ultimam truncata deformitatem velut exsaturati mox abiecerunt in flumen.</p><p>Ex his quidam aeternitati se commendari posse per statuas aestimantes eas ardenter adfectant quasi plus praemii de figmentis aereis sensu carentibus adepturi, quam ex conscientia honeste recteque factorum, easque auro curant inbracteari, quod Acilio Glabrioni delatum est primo, cum consiliis armisque regem superasset Antiochum. quam autem sit pulchrum exigua haec spernentem et minima ad ascensus verae gloriae tendere longos et arduos, ut memorat vates Ascraeus, Censorius Cato monstravit. qui interrogatus quam ob rem inter multos... statuam non haberet malo inquit ambigere bonos quam ob rem id non meruerim, quam quod est gravius cur inpetraverim mussitare.</p><p>Latius iam disseminata licentia onerosus bonis omnibus Caesar nullum post haec adhibens modum orientis latera cuncta vexabat nec honoratis parcens nec urbium primatibus nec plebeiis.</p>',
'picture' => 'galerie/landscape/meadow.jpg',
'hidePicture' => false,
'pictureSize' => 20,
'publishedOn' => 1548790902,
'state' => true,
'title' => 'Mon premier article',
'userId' => '' // Géré au moment de l'installation
],
'mon-deuxieme-article' => [
'closeComment' => false,
'comment' => [],
'content' => '<p>Et prima post Osdroenam quam, ut dictum est, ab hac descriptione discrevimus, Commagena, nunc Euphratensis, clementer adsurgit, Hierapoli, vetere Nino et Samosata civitatibus amplis inlustris.</p><p>Ob haec et huius modi multa, quae cernebantur in paucis, omnibus timeri sunt coepta. et ne tot malis dissimulatis paulatimque serpentibus acervi crescerent aerumnarum, nobilitatis decreto legati mittuntur: Praetextatus ex urbi praefecto et ex vicario Venustus et ex consulari Minervius oraturi, ne delictis supplicia sint grandiora, neve senator quisquam inusitato et inlicito more tormentis exponeretur.</p><p>Sed ut tum ad senem senex de senectute, sic hoc libro ad amicum amicissimus scripsi de amicitia. Tum est Cato locutus, quo erat nemo fere senior temporibus illis, nemo prudentior; nunc Laelius et sapiens (sic enim est habitus) et amicitiae gloria excellens de amicitia loquetur. Tu velim a me animum parumper avertas, Laelium loqui ipsum putes. C. Fannius et Q. Mucius ad socerum veniunt post mortem Africani; ab his sermo oritur, respondet Laelius, cuius tota disputatio est de amicitia, quam legens te ipse cognosces.</p>',
'picture' => 'galerie/landscape/desert.jpg',
'hidePicture' => false,
'pictureSize' => 40,
'publishedOn' => 1550432502,
'state' => true,
'title' => 'Mon deuxième article',
'userId' => '' // Géré au moment de l'installation
],
'mon-troisieme-article' => [
'closeComment' => true,
'comment' => [],
'content' => '<p>Rogatus ad ultimum admissusque in consistorium ambage nulla praegressa inconsiderate et leviter proficiscere inquit ut praeceptum est, Caesar sciens quod si cessaveris, et tuas et palatii tui auferri iubebo prope diem annonas. hocque solo contumaciter dicto subiratus abscessit nec in conspectum eius postea venit saepius arcessitus.</p><p>Proinde concepta rabie saeviore, quam desperatio incendebat et fames, amplificatis viribus ardore incohibili in excidium urbium matris Seleuciae efferebantur, quam comes tuebatur Castricius tresque legiones bellicis sudoribus induratae.</p><p>Inter has ruinarum varietates a Nisibi quam tuebatur accitus Vrsicinus, cui nos obsecuturos iunxerat imperiale praeceptum, dispicere litis exitialis certamina cogebatur abnuens et reclamans, adulatorum oblatrantibus turmis, bellicosus sane milesque semper et militum ductor sed forensibus iurgiis longe discretus, qui metu sui discriminis anxius cum accusatores quaesitoresque subditivos sibi consociatos ex isdem foveis cerneret emergentes, quae clam palamve agitabantur, occultis Constantium litteris edocebat inplorans subsidia, quorum metu tumor notissimus Caesaris exhalaret.</p>',
'picture' => 'galerie/landscape/iceberg.jpg',
'hidePicture' => false,
'pictureSize' => 100,
'publishedOn' => 1550864502,
'state' => true,
'title' => 'Mon troisième article',
'userId' => '' // Géré au moment de l'installation
], ],
'content' => '<p>Et eodem impetu Domitianum praecipitem per scalas itidem funibus constrinxerunt, eosque coniunctos per ampla spatia civitatis acri raptavere discursu. iamque artuum et membrorum divulsa conpage superscandentes corpora mortuorum ad ultimam truncata deformitatem velut exsaturati mox abiecerunt in flumen.</p><p>Ex his quidam aeternitati se commendari posse per statuas aestimantes eas ardenter adfectant quasi plus praemii de figmentis aereis sensu carentibus adepturi, quam ex conscientia honeste recteque factorum, easque auro curant inbracteari, quod Acilio Glabrioni delatum est primo, cum consiliis armisque regem superasset Antiochum. quam autem sit pulchrum exigua haec spernentem et minima ad ascensus verae gloriae tendere longos et arduos, ut memorat vates Ascraeus, Censorius Cato monstravit. qui interrogatus quam ob rem inter multos... statuam non haberet malo inquit ambigere bonos quam ob rem id non meruerim, quam quod est gravius cur inpetraverim mussitare.</p><p>Latius iam disseminata licentia onerosus bonis omnibus Caesar nullum post haec adhibens modum orientis latera cuncta vexabat nec honoratis parcens nec urbium primatibus nec plebeiis.</p>',
'picture' => 'galerie/landscape/meadow.jpg',
'hidePicture' => false,
'pictureSize' => 20,
'publishedOn' => 1548790902,
'state' => true,
'title' => 'Mon premier article',
'userId' => '', // Géré au moment de l'installation
'editConsent' => 'all',
'commentMaxlength' => '500',
'commentApproved' => false,
'commentClose' => false,
'commentNotification' => false,
'commentGroupNotification' => 3
], ],
'mon-deuxieme-article' => [
'comment' => [],
'content' => '<p>Et prima post Osdroenam quam, ut dictum est, ab hac descriptione discrevimus, Commagena, nunc Euphratensis, clementer adsurgit, Hierapoli, vetere Nino et Samosata civitatibus amplis inlustris.</p><p>Ob haec et huius modi multa, quae cernebantur in paucis, omnibus timeri sunt coepta. et ne tot malis dissimulatis paulatimque serpentibus acervi crescerent aerumnarum, nobilitatis decreto legati mittuntur: Praetextatus ex urbi praefecto et ex vicario Venustus et ex consulari Minervius oraturi, ne delictis supplicia sint grandiora, neve senator quisquam inusitato et inlicito more tormentis exponeretur.</p><p>Sed ut tum ad senem senex de senectute, sic hoc libro ad amicum amicissimus scripsi de amicitia. Tum est Cato locutus, quo erat nemo fere senior temporibus illis, nemo prudentior; nunc Laelius et sapiens (sic enim est habitus) et amicitiae gloria excellens de amicitia loquetur. Tu velim a me animum parumper avertas, Laelium loqui ipsum putes. C. Fannius et Q. Mucius ad socerum veniunt post mortem Africani; ab his sermo oritur, respondet Laelius, cuius tota disputatio est de amicitia, quam legens te ipse cognosces.</p>',
'picture' => 'galerie/landscape/desert.jpg',
'hidePicture' => false,
'pictureSize' => 40,
'publishedOn' => 1550432502,
'state' => true,
'title' => 'Mon deuxième article',
'userId' => '', // Géré au moment de l'installation
'editConsent' => 'all',
'commentMaxlength' => '500',
'commentApproved' => false,
'commentClose' => false,
'commentNotification' => false,
'commentGroupNotification' => 3
],
'mon-troisieme-article' => [
'comment' => [],
'content' => '<p>Rogatus ad ultimum admissusque in consistorium ambage nulla praegressa inconsiderate et leviter proficiscere inquit ut praeceptum est, Caesar sciens quod si cessaveris, et tuas et palatii tui auferri iubebo prope diem annonas. hocque solo contumaciter dicto subiratus abscessit nec in conspectum eius postea venit saepius arcessitus.</p><p>Proinde concepta rabie saeviore, quam desperatio incendebat et fames, amplificatis viribus ardore incohibili in excidium urbium matris Seleuciae efferebantur, quam comes tuebatur Castricius tresque legiones bellicis sudoribus induratae.</p><p>Inter has ruinarum varietates a Nisibi quam tuebatur accitus Vrsicinus, cui nos obsecuturos iunxerat imperiale praeceptum, dispicere litis exitialis certamina cogebatur abnuens et reclamans, adulatorum oblatrantibus turmis, bellicosus sane milesque semper et militum ductor sed forensibus iurgiis longe discretus, qui metu sui discriminis anxius cum accusatores quaesitoresque subditivos sibi consociatos ex isdem foveis cerneret emergentes, quae clam palamve agitabantur, occultis Constantium litteris edocebat inplorans subsidia, quorum metu tumor notissimus Caesaris exhalaret.</p>',
'picture' => 'galerie/landscape/iceberg.jpg',
'hidePicture' => false,
'pictureSize' => 100,
'publishedOn' => 1550864502,
'state' => true,
'title' => 'Mon troisième article',
'userId' => '', // Géré au moment de l'installation
'editConsent' => 'all',
'commentMaxlength' => '500',
'commentApproved' => false,
'commentClose' => true,
'commentNotification' => false,
'commentGroupNotification' => 3
]
], ],
'galeries' => [ 'galeries' => [
'beaux-paysages' => [ 'beaux-paysages' => [

View File

@ -1,48 +1,48 @@
<ul> <ul>
<?php foreach($this->getHierarchy(null,true,null) as $parentId => $childIds): ?> <?php foreach($this->getHierarchy(null,true,null) as $parentId => $childIds): ?>
<li> <li>
<?php <?php
if ($this->getData(['page', $parentId, 'disable']) === false && $this->getUser('group') >= $this->getData(['page', $parentId, 'group'])) if ($this->getData(['page', $parentId, 'disable']) === false && $this->getUser('group') >= $this->getData(['page', $parentId, 'group']))
{ ?> { ?>
<a href="<?php echo helper::baseUrl() . $parentId; ?>"><?php echo $this->getData(['page', $parentId, 'title']); ?></a> <a href="<?php echo helper::baseUrl() . $parentId; ?>"><?php echo $this->getData(['page', $parentId, 'title']); ?></a>
<?php <?php
} else { } else {
// page désactivée // page désactivée
echo $this->getData(['page', $parentId, 'title']); echo $this->getData(['page', $parentId, 'title']);
} ?> } ?>
<ul> <ul>
<?php foreach($childIds as $childId): ?> <?php foreach($childIds as $childId): ?>
<li> <li>
<!-- Sous-page --> <!-- Sous-page -->
<?php if ($this->getData(['page', $childId, 'disable']) === false && $this->getUser('group') >= $this->getData(['page', $parentId, 'group'])) <?php if ($this->getData(['page', $childId, 'disable']) === false && $this->getUser('group') >= $this->getData(['page', $parentId, 'group']))
{ ?> { ?>
<a href="<?php echo helper::baseUrl() . $childId; ?>"><?php echo $this->getData(['page', $childId, 'title']); ?></a> <a href="<?php echo helper::baseUrl() . $childId; ?>"><?php echo $this->getData(['page', $childId, 'title']); ?></a>
<?php } else { ?> <?php } else { ?>
<!-- page désactivée --> <!-- page désactivée -->
<?php echo $this->getData(['page', $childId, 'title']); }?> <?php echo $this->getData(['page', $childId, 'title']); }?>
<!-- articles d'une sous-page blog--> <!-- articles d'une sous-page blog-->
<ul> <ul>
<?php if ($this->getData(['page', $childId, 'moduleId']) === 'blog') { ?> <?php if ($this->getData(['page', $childId, 'moduleId']) === 'blog') { ?>
<?php <?php
foreach($this->getData(['module',$childId]) as $articleId => $article): ?> foreach($this->getData(['module',$childId]) as $articleId => $article): ?>
<?php if($this->getData(['module',$childId,$articleId,'state']) === true) {?> <?php if($this->getData(['module',$childId,'posts',$articleId,'state']) === true) {?>
<li> <li>
<a href="<?php echo helper::baseUrl() . $childId . '/' . $articleId;?>"><?php echo $article['title']; ?></a> <a href="<?php echo helper::baseUrl() . $childId . '/' . $articleId;?>"><?php echo $article['title']; ?></a>
</li> </li>
<?php } ?> <?php } ?>
<?php endforeach; <?php endforeach;
} ?> } ?>
</ul> </ul>
</li> </li>
<?php endforeach; ?> <?php endforeach; ?>
<!-- ou articles d'un blog--> <!-- ou articles d'un blog-->
<?php if ($this->getData(['page', $parentId, 'moduleId']) === 'blog' && <?php if ($this->getData(['page', $parentId, 'moduleId']) === 'blog' &&
!empty($this->getData(['module',$parentId])) ) { ?> !empty($this->getData(['module',$parentId, 'posts' ])) ) { ?>
<?php foreach($this->getData(['module',$parentId]) as $articleId => $article): ?> <?php foreach($this->getData(['module',$parentId, 'posts' ]) as $articleId => $article): ?>
<?php if($this->getData(['module',$parentId,$articleId,'state']) === true ): ?> <?php if($this->getData(['module',$parentId,'posts',$articleId,'state']) === true ): ?>
<li> <li>
<a href="<?php echo helper::baseUrl() . $parentId. '/' . $articleId;?>"><?php echo $article['title']; ?></a> <a href="<?php echo helper::baseUrl() . $parentId. '/' . $articleId;?>"><?php echo $article['title']; ?></a>
</li> </li>

View File

@ -27,7 +27,8 @@ class blog extends common {
'config' => self::GROUP_MODERATOR, 'config' => self::GROUP_MODERATOR,
'delete' => self::GROUP_MODERATOR, 'delete' => self::GROUP_MODERATOR,
'edit' => self::GROUP_MODERATOR, 'edit' => self::GROUP_MODERATOR,
'index' => self::GROUP_VISITOR 'index' => self::GROUP_VISITOR,
'rss' => self::GROUP_VISITOR
]; ];
public static $articles = []; public static $articles = [];
@ -86,7 +87,7 @@ class blog extends common {
public static $users = []; public static $users = [];
const BLOG_VERSION = '3.1'; const BLOG_VERSION = '3.2';
/** /**
* Édition * Édition
@ -108,8 +109,9 @@ class blog extends common {
// Crée l'article // Crée l'article
$this->setData(['module', $this->setData(['module',
$this->getUrl(0), $this->getUrl(0),
'posts',
$articleId, [ $articleId, [
'comment' => $this->getData(['module', $this->getUrl(0), $this->getUrl(2), 'comment']), 'comment' => $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(2), 'comment']),
'content' => $this->getInput('blogAddContent', null), 'content' => $this->getInput('blogAddContent', null),
'picture' => $this->getInput('blogAddPicture', helper::FILTER_STRING_SHORT, true), 'picture' => $this->getInput('blogAddPicture', helper::FILTER_STRING_SHORT, true),
'hidePicture' => $this->getInput('blogAddHidePicture', helper::FILTER_BOOLEAN), 'hidePicture' => $this->getInput('blogAddHidePicture', helper::FILTER_BOOLEAN),
@ -156,7 +158,7 @@ class blog extends common {
* Liste des commentaires * Liste des commentaires
*/ */
public function comment() { public function comment() {
$comments = $this->getData(['module', $this->getUrl(0), $this->getUrl(2),'comment']); $comments = $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(2),'comment']);
self::$commentsDelete = template::button('blogCommentDeleteAll', [ self::$commentsDelete = template::button('blogCommentDeleteAll', [
'class' => 'blogCommentDeleteAll buttonRed', 'class' => 'blogCommentDeleteAll buttonRed',
'href' => helper::baseUrl() . $this->getUrl(0) . '/commentDeleteAll/' . $this->getUrl(2).'/' . $_SESSION['csrf'] , 'href' => helper::baseUrl() . $this->getUrl(0) . '/commentDeleteAll/' . $this->getUrl(2).'/' . $_SESSION['csrf'] ,
@ -177,7 +179,7 @@ class blog extends common {
$buttonApproval = ''; $buttonApproval = '';
// Compatibilité avec les commentaires des versions précédentes, les valider // Compatibilité avec les commentaires des versions précédentes, les valider
$comment['approval'] = array_key_exists('approval', $comment) === false ? true : $comment['approval'] ; $comment['approval'] = array_key_exists('approval', $comment) === false ? true : $comment['approval'] ;
if ( $this->getData(['module', $this->getUrl(0), $this->getUrl(2),'commentApproved']) === true) { if ( $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(2),'commentApproved']) === true) {
$buttonApproval = template::button('blogCommentApproved' . $commentIds[$i], [ $buttonApproval = template::button('blogCommentApproved' . $commentIds[$i], [
'class' => $comment['approval'] === true ? 'blogCommentRejected buttonGreen' : 'blogCommentApproved buttonRed' , 'class' => $comment['approval'] === true ? 'blogCommentRejected buttonGreen' : 'blogCommentApproved buttonRed' ,
'href' => helper::baseUrl() . $this->getUrl(0) . '/commentApprove/' . $this->getUrl(2) . '/' . $commentIds[$i] . '/' . $_SESSION['csrf'] , 'href' => helper::baseUrl() . $this->getUrl(0) . '/commentApprove/' . $this->getUrl(2) . '/' . $commentIds[$i] . '/' . $_SESSION['csrf'] ,
@ -200,7 +202,7 @@ class blog extends common {
} }
// Valeurs en sortie // Valeurs en sortie
$this->addOutput([ $this->addOutput([
'title' => 'Gestion des commentaires : '. $this->getData(['module', $this->getUrl(0), $this->getUrl(2), 'title']), 'title' => 'Gestion des commentaires : '. $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(2), 'title']),
'view' => 'comment' 'view' => 'comment'
]); ]);
} }
@ -210,7 +212,7 @@ class blog extends common {
*/ */
public function commentDelete() { public function commentDelete() {
// Le commentaire n'existe pas // Le commentaire n'existe pas
if($this->getData(['module', $this->getUrl(0), $this->getUrl(2), 'comment', $this->getUrl(3)]) === null) { if($this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(2), 'comment', $this->getUrl(3)]) === null) {
// Valeurs en sortie // Valeurs en sortie
$this->addOutput([ $this->addOutput([
'access' => false 'access' => false
@ -226,7 +228,7 @@ class blog extends common {
} }
// Suppression // Suppression
else { else {
$this->deleteData(['module', $this->getUrl(0), $this->getUrl(2), 'comment', $this->getUrl(3)]); $this->deleteData(['module', $this->getUrl(0), 'posts', $this->getUrl(2), 'comment', $this->getUrl(3)]);
// Valeurs en sortie // Valeurs en sortie
$this->addOutput([ $this->addOutput([
'redirect' => helper::baseUrl() . $this->getUrl(0) . '/comment/'.$this->getUrl(2), 'redirect' => helper::baseUrl() . $this->getUrl(0) . '/comment/'.$this->getUrl(2),
@ -250,7 +252,7 @@ class blog extends common {
} }
// Suppression // Suppression
else { else {
$this->setData(['module', $this->getUrl(0), $this->getUrl(2), 'comment',[] ]); $this->setData(['module', $this->getUrl(0), 'posts', $this->getUrl(2), 'comment',[] ]);
// Valeurs en sortie // Valeurs en sortie
$this->addOutput([ $this->addOutput([
'redirect' => helper::baseUrl() . $this->getUrl(0) . '/comment', 'redirect' => helper::baseUrl() . $this->getUrl(0) . '/comment',
@ -265,7 +267,7 @@ class blog extends common {
*/ */
public function commentApprove() { public function commentApprove() {
// Le commentaire n'existe pas // Le commentaire n'existe pas
if($this->getData(['module', $this->getUrl(0), $this->getUrl(2), 'comment', $this->getUrl(3)]) === null) { if($this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(2), 'comment', $this->getUrl(3)]) === null) {
// Valeurs en sortie // Valeurs en sortie
$this->addOutput([ $this->addOutput([
'access' => false 'access' => false
@ -281,12 +283,12 @@ class blog extends common {
} }
// Inversion du statut // Inversion du statut
else { else {
$approved = !$this->getData(['module', $this->getUrl(0), $this->getUrl(2), 'comment', $this->getUrl(3), 'approval']) ; $approved = !$this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(2), 'comment', $this->getUrl(3), 'approval']) ;
$this->setData(['module', $this->getUrl(0), $this->getUrl(2), 'comment', $this->getUrl(3), [ $this->setData(['module', $this->getUrl(0), 'posts', $this->getUrl(2), 'comment', $this->getUrl(3), [
'author' => $this->getData(['module', $this->getUrl(0), $this->getUrl(2), 'comment', $this->getUrl(3), 'author']), 'author' => $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(2), 'comment', $this->getUrl(3), 'author']),
'content' => $this->getData(['module', $this->getUrl(0), $this->getUrl(2), 'comment', $this->getUrl(3), 'content']), 'content' => $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(2), 'comment', $this->getUrl(3), 'content']),
'createdOn' => $this->getData(['module', $this->getUrl(0), $this->getUrl(2), 'comment', $this->getUrl(3), 'createdOn']), 'createdOn' => $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(2), 'comment', $this->getUrl(3), 'createdOn']),
'userId' => $this->getData(['module', $this->getUrl(0), $this->getUrl(2), 'comment', $this->getUrl(3), 'userId']), 'userId' => $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(2), 'comment', $this->getUrl(3), 'userId']),
'approval' => $approved 'approval' => $approved
]]); ]]);
@ -303,90 +305,99 @@ 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()) {
// Gestion des droits d'accès $this->setData(['module', $this->getUrl(0), 'config',[
$filterData=[]; 'feeds' => $this->getInput('blogConfigShowFeeds',helper::FILTER_BOOLEAN),
foreach ($articleIds as $key => $value) { 'feedsLabel' => $this->getInput('blogConfigFeedslabel',helper::FILTER_STRING_SHORT)
if ( ]]);
( // Propriétaire // Valeurs en sortie
$this->getData(['module', $this->getUrl(0), $value,'editConsent']) === self::EDIT_OWNER $this->addOutput([
AND ( $this->getData(['module', $this->getUrl(0), $value,'userId']) === $this->getUser('id') 'redirect' => helper::baseUrl() . $this->getUrl(0) . '/config',
OR $this->getUser('group') === self::GROUP_ADMIN ) 'notification' => 'Modifications enregistrées',
) 'state' => true
]);
} else {
// Ids des articles par ordre de publication
$articleIds = array_keys(helper::arrayCollumn($this->getData(['module', $this->getUrl(0)]), 'publishedOn', 'SORT_DESC'));
// Gestion des droits d'accès
$filterData=[];
foreach ($articleIds as $key => $value) {
if (
( // Propriétaire
$this->getData(['module', $this->getUrl(0), 'posts', $value,'editConsent']) === self::EDIT_OWNER
AND ( $this->getData(['module', $this->getUrl(0), 'posts', $value,'userId']) === $this->getUser('id')
OR $this->getUser('group') === self::GROUP_ADMIN )
)
OR ( OR (
// Groupe // Groupe
$this->getData(['module', $this->getUrl(0), $value,'editConsent']) !== self::EDIT_OWNER $this->getData(['module', $this->getUrl(0), 'posts', $value,'editConsent']) !== self::EDIT_OWNER
AND $this->getUser('group') >= $this->getData(['module',$this->getUrl(0), $value,'editConsent']) AND $this->getUser('group') >= $this->getData(['module',$this->getUrl(0), 'posts', $value,'editConsent'])
) )
OR ( OR (
// Tout le monde // Tout le monde
$this->getData(['module', $this->getUrl(0), $value,'editConsent']) === self::EDIT_ALL $this->getData(['module', $this->getUrl(0), 'posts', $value,'editConsent']) === self::EDIT_ALL
) )
) { ) {
$filterData[] = $value; $filterData[] = $value;
}
}
$articleIds = $filterData;
// Pagination
$pagination = helper::pagination($articleIds, $this->getUrl(),$this->getData(['config','itemsperPage']));
// Liste des pages
self::$pages = $pagination['pages'];
// Articles en fonction de la pagination
for($i = $pagination['first']; $i < $pagination['last']; $i++) {
// Nombre de commentaires à approuver et approuvés
$approvals = helper::arrayCollumn($this->getData(['module', $this->getUrl(0), 'posts', $articleIds[$i], 'comment' ]),'approval', 'SORT_DESC');
if ( is_array($approvals) ) {
$a = array_values($approvals);
$toApprove = count(array_keys($a,false));
$approved = count(array_keys($a,true));
} else {
$toApprove = 0;
$approved = count($this->getData(['module', $this->getUrl(0), 'posts', $articleIds[$i],'comment']));
}
// Met en forme le tableau
$date = mb_detect_encoding(strftime('%d %B %Y', $this->getData(['module', $this->getUrl(0), 'posts', $articleIds[$i], 'publishedOn'])), 'UTF-8', true)
? strftime('%d %B %Y', $this->getData(['module', $this->getUrl(0), 'posts', $articleIds[$i], 'publishedOn']))
: utf8_encode(strftime('%d %B %Y', $this->getData(['module', $this->getUrl(0), 'posts', $articleIds[$i], 'publishedOn'])));
$heure = mb_detect_encoding(strftime('%H:%M', $this->getData(['module', $this->getUrl(0), 'posts', $articleIds[$i], 'publishedOn'])), 'UTF-8', true)
? strftime('%H:%M', $this->getData(['module', $this->getUrl(0), 'posts', $articleIds[$i], 'publishedOn']))
: utf8_encode(strftime('%H:%M', $this->getData(['module', $this->getUrl(0), 'posts', $articleIds[$i], 'publishedOn'])));
self::$articles[] = [
'<a href="' . helper::baseurl() . $this->getUrl(0) . '/' . $articleIds[$i] . '" target="_blank" >' .
$this->getData(['module', $this->getUrl(0), 'posts', $articleIds[$i], 'title']) .
'</a>',
$date .' à '. $heure,
self::$states[$this->getData(['module', $this->getUrl(0), 'posts', $articleIds[$i], 'state'])],
// Bouton pour afficher les commentaires de l'article
template::button('blogConfigComment' . $articleIds[$i], [
'class' => ($toApprove || $approved ) > 0 ? 'buttonBlue' : 'buttonGrey' ,
'href' => ($toApprove || $approved ) > 0 ? helper::baseUrl() . $this->getUrl(0) . '/comment/' . $articleIds[$i] : '',
'value' => $toApprove > 0 ? $toApprove . '/' . $approved : $approved
]),
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')
])
];
} }
} }
$articleIds = $filterData;
// Pagination
$pagination = helper::pagination($articleIds, $this->getUrl(),$this->getData(['config','itemsperPage']));
// Liste des pages
self::$pages = $pagination['pages'];
// Articles en fonction de la pagination
for($i = $pagination['first']; $i < $pagination['last']; $i++) {
// Nombre de commentaires à approuver et approuvés
$approvals = helper::arrayCollumn($this->getData(['module', $this->getUrl(0), $articleIds[$i], 'comment' ]),'approval', 'SORT_DESC');
if ( is_array($approvals) ) {
$a = array_values($approvals);
$toApprove = count(array_keys($a,false));
$approved = count(array_keys($a,true));
} else {
$toApprove = 0;
$approved = count($this->getData(['module', $this->getUrl(0), $articleIds[$i],'comment']));
}
// Met en forme le tableau
$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[] = [
'<a href="' . helper::baseurl() . $this->getUrl(0) . '/' . $articleIds[$i] . '" target="_blank" >' .
$this->getData(['module', $this->getUrl(0), $articleIds[$i], 'title']) .
'</a>',
$date .' à '. $heure,
self::$states[$this->getData(['module', $this->getUrl(0), $articleIds[$i], 'state'])],
// Bouton pour afficher les commentaires de l'article
template::button('blogConfigComment' . $articleIds[$i], [
'class' => ($toApprove || $approved ) > 0 ? 'buttonBlue' : 'buttonGrey' ,
'href' => ($toApprove || $approved ) > 0 ? helper::baseUrl() . $this->getUrl(0) . '/comment/' . $articleIds[$i] : '',
'value' => $toApprove > 0 ? $toApprove . '/' . $approved : $approved
]),
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'
]);
} }
/** /**
* Suppression * Suppression
*/ */
public function delete() { public function delete() {
if($this->getData(['module', $this->getUrl(0), $this->getUrl(2)]) === null) { if($this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(2)]) === null) {
// Valeurs en sortie // Valeurs en sortie
$this->addOutput([ $this->addOutput([
'access' => false 'access' => false
@ -402,7 +413,7 @@ class blog extends common {
} }
// Suppression // Suppression
else { else {
$this->deleteData(['module', $this->getUrl(0), $this->getUrl(2)]); $this->deleteData(['module', $this->getUrl(0), 'posts', $this->getUrl(2)]);
// Valeurs en sortie // Valeurs en sortie
$this->addOutput([ $this->addOutput([
'redirect' => helper::baseUrl() . $this->getUrl(0) . '/config', 'redirect' => helper::baseUrl() . $this->getUrl(0) . '/config',
@ -425,7 +436,7 @@ class blog extends common {
]); ]);
} }
// L'article n'existe pas // L'article n'existe pas
if($this->getData(['module', $this->getUrl(0), $this->getUrl(2)]) === null) { if($this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(2)]) === null) {
// Valeurs en sortie // Valeurs en sortie
$this->addOutput([ $this->addOutput([
'access' => false 'access' => false
@ -445,13 +456,14 @@ class blog extends common {
// Incrémente le nouvel id de l'article // Incrémente le nouvel id de l'article
if($articleId !== $this->getUrl(2)) { if($articleId !== $this->getUrl(2)) {
$articleId = helper::increment($articleId, $this->getData(['page'])); $articleId = helper::increment($articleId, $this->getData(['page']));
$articleId = helper::increment($articleId, $this->getData(['module', $this->getUrl(0)])); $articleId = helper::increment($articleId, $this->getData(['module', $this->getUrl(0),'posts']));
$articleId = helper::increment($articleId, array_keys(self::$actions)); $articleId = helper::increment($articleId, array_keys(self::$actions));
} }
$this->setData(['module', $this->setData(['module',
$this->getUrl(0), $this->getUrl(0),
'posts',
$articleId, [ $articleId, [
'comment' => $this->getData(['module', $this->getUrl(0), $this->getUrl(2), 'comment']), 'comment' => $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(2), 'comment']),
'content' => $this->getInput('blogEditContent', null), 'content' => $this->getInput('blogEditContent', null),
'picture' => $this->getInput('blogEditPicture', helper::FILTER_STRING_SHORT, true), 'picture' => $this->getInput('blogEditPicture', helper::FILTER_STRING_SHORT, true),
'hidePicture' => $this->getInput('blogEditHidePicture', helper::FILTER_BOOLEAN), 'hidePicture' => $this->getInput('blogEditHidePicture', helper::FILTER_BOOLEAN),
@ -471,7 +483,7 @@ class blog extends common {
]); ]);
// Supprime l'ancien article // Supprime l'ancien article
if($articleId !== $this->getUrl(2)) { if($articleId !== $this->getUrl(2)) {
$this->deleteData(['module', $this->getUrl(0), $this->getUrl(2)]); $this->deleteData(['module', $this->getUrl(0), 'posts', $this->getUrl(2)]);
} }
// Valeurs en sortie // Valeurs en sortie
$this->addOutput([ $this->addOutput([
@ -493,7 +505,7 @@ class blog extends common {
unset($userFirstname); unset($userFirstname);
// Valeurs en sortie // Valeurs en sortie
$this->addOutput([ $this->addOutput([
'title' => $this->getData(['module', $this->getUrl(0), $this->getUrl(2), 'title']), 'title' => $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(2), 'title']),
'vendor' => [ 'vendor' => [
'flatpickr', 'flatpickr',
'tinymce' 'tinymce'
@ -514,7 +526,7 @@ class blog extends common {
AND intval($this->getUrl(1)) === 0 AND intval($this->getUrl(1)) === 0
) { ) {
// L'article n'existe pas // L'article n'existe pas
if($this->getData(['module', $this->getUrl(0), $this->getUrl(1)]) === null) { if($this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1)]) === null) {
// Valeurs en sortie // Valeurs en sortie
$this->addOutput([ $this->addOutput([
'access' => false 'access' => false
@ -533,27 +545,27 @@ class blog extends common {
self::$inputNotices['blogArticleCaptcha'] = 'Incorrect'; self::$inputNotices['blogArticleCaptcha'] = 'Incorrect';
} }
// Crée le commentaire // Crée le commentaire
$commentId = helper::increment(uniqid(), $this->getData(['module', $this->getUrl(0), $this->getUrl(1), 'comment'])); $commentId = helper::increment(uniqid(), $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'comment']));
$content = $this->getInput('blogArticleContent', false); $content = $this->getInput('blogArticleContent', false);
$this->setData(['module', $this->getUrl(0), $this->getUrl(1), 'comment', $commentId, [ $this->setData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'comment', $commentId, [
'author' => $this->getInput('blogArticleAuthor', helper::FILTER_STRING_SHORT, empty($this->getInput('blogArticleUserId')) ? TRUE : FALSE), 'author' => $this->getInput('blogArticleAuthor', helper::FILTER_STRING_SHORT, empty($this->getInput('blogArticleUserId')) ? TRUE : FALSE),
'content' => $content, 'content' => $content,
'createdOn' => time(), 'createdOn' => time(),
'userId' => $this->getInput('blogArticleUserId'), 'userId' => $this->getInput('blogArticleUserId'),
'approval' => !$this->getData(['module', $this->getUrl(0), $this->getUrl(1), 'commentApproved']) // true commentaire publié false en attente de publication 'approval' => !$this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'commentApproved']) // true commentaire publié false en attente de publication
]]); ]]);
// Envoi d'une notification aux administrateurs // Envoi d'une notification aux administrateurs
// Init tableau // Init tableau
$to = []; $to = [];
// Liste des destinataires // Liste des destinataires
foreach($this->getData(['user']) as $userId => $user) { foreach($this->getData(['user']) as $userId => $user) {
if ($user['group'] >= $this->getData(['module', $this->getUrl(0), $this->getUrl(1), 'commentGroupNotification']) ) { if ($user['group'] >= $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'commentGroupNotification']) ) {
$to[] = $user['mail']; $to[] = $user['mail'];
} }
} }
// Envoi du mail $sent code d'erreur ou de réussite // Envoi du mail $sent code d'erreur ou de réussite
$notification = $this->getData(['module', $this->getUrl(0), $this->getUrl(1), 'commentApproved']) === true ? 'Commentaire déposé en attente d\'approbation': 'Commentaire déposé'; $notification = $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'commentApproved']) === true ? 'Commentaire déposé en attente d\'approbation': 'Commentaire déposé';
if ($this->getData(['module', $this->getUrl(0), $this->getUrl(1), 'commentNotification']) === true) { if ($this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'commentNotification']) === true) {
$sent = $this->sendMail( $sent = $this->sendMail(
$to, $to,
'Nouveau commentaire', 'Nouveau commentaire',
@ -580,7 +592,7 @@ class blog extends common {
} }
// Ids des commentaires approuvés par ordre de publication // Ids des commentaires approuvés par ordre de publication
$commentsApproved = $this->getData(['module', $this->getUrl(0), $this->getUrl(1), 'comment']); $commentsApproved = $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'comment']);
if ($commentsApproved) { if ($commentsApproved) {
foreach( $commentsApproved as $key => $value){ foreach( $commentsApproved as $key => $value){
if($value['approval']===false) unset($commentsApproved[$key]); if($value['approval']===false) unset($commentsApproved[$key]);
@ -594,7 +606,7 @@ class blog extends common {
// Liste des pages // Liste des pages
self::$pages = $pagination['pages']; self::$pages = $pagination['pages'];
// Signature de l'article // Signature de l'article
$userIdArticle = $this->getData(['module', $this->getUrl(0), $this->getUrl(1), 'userId']); $userIdArticle = $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'userId']);
switch ($this->getData(['user', $userIdArticle, 'signature'])){ switch ($this->getData(['user', $userIdArticle, 'signature'])){
case 1: case 1:
self::$articleSignature = $userIdArticle; self::$articleSignature = $userIdArticle;
@ -634,7 +646,7 @@ class blog extends common {
// Commentaires en fonction de la pagination // Commentaires en fonction de la pagination
for($i = $pagination['first']; $i < $pagination['last']; $i++) { for($i = $pagination['first']; $i < $pagination['last']; $i++) {
// Signatures des commentaires // Signatures des commentaires
$e = $this->getData(['module', $this->getUrl(0), $this->getUrl(1), 'comment', $commentIds[$i],'userId']); $e = $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'comment', $commentIds[$i],'userId']);
if ($e) { if ($e) {
switch ($this->getData(['user', $e, 'signature'])){ switch ($this->getData(['user', $e, 'signature'])){
case 1: case 1:
@ -651,17 +663,17 @@ class blog extends common {
break; break;
} }
} else { } else {
self::$commentsSignature[$commentIds[$i]] = $this->getData(['module', $this->getUrl(0), $this->getUrl(1), 'comment', $commentIds[$i],'author']); self::$commentsSignature[$commentIds[$i]] = $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'comment', $commentIds[$i],'author']);
} }
// Données du commentaire si approuvé // Données du commentaire si approuvé
if ($this->getData(['module', $this->getUrl(0), $this->getUrl(1), 'comment', $commentIds[$i],'approval']) === true ) { if ($this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'comment', $commentIds[$i],'approval']) === true ) {
self::$comments[$commentIds[$i]] = $this->getData(['module', $this->getUrl(0), $this->getUrl(1), 'comment', $commentIds[$i]]); self::$comments[$commentIds[$i]] = $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'comment', $commentIds[$i]]);
} }
} }
// Valeurs en sortie // Valeurs en sortie
$this->addOutput([ $this->addOutput([
'showBarEditButton' => true, 'showBarEditButton' => true,
'title' => $this->getData(['module', $this->getUrl(0), $this->getUrl(1), 'title']), 'title' => $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'title']),
'vendor' => [ 'vendor' => [
'tinymce' 'tinymce'
], ],
@ -673,8 +685,8 @@ class blog extends common {
// Liste des articles // Liste des articles
else { else {
// Ids des articles par ordre de publication // Ids des articles par ordre de publication
$articleIdsPublishedOns = helper::arrayCollumn($this->getData(['module', $this->getUrl(0)]), 'publishedOn', 'SORT_DESC'); $articleIdsPublishedOns = helper::arrayCollumn($this->getData(['module', $this->getUrl(0),'posts']), 'publishedOn', 'SORT_DESC');
$articleIdsStates = helper::arrayCollumn($this->getData(['module', $this->getUrl(0)]), 'state', 'SORT_DESC'); $articleIdsStates = helper::arrayCollumn($this->getData(['module', $this->getUrl(0), 'posts']), 'state', 'SORT_DESC');
$articleIds = []; $articleIds = [];
foreach($articleIdsPublishedOns as $articleId => $articlePublishedOn) { foreach($articleIdsPublishedOns as $articleId => $articlePublishedOn) {
if($articlePublishedOn <= time() AND $articleIdsStates[$articleId]) { if($articlePublishedOn <= time() AND $articleIdsStates[$articleId]) {
@ -687,7 +699,7 @@ class blog extends common {
self::$pages = $pagination['pages']; self::$pages = $pagination['pages'];
// Articles en fonction de la pagination // Articles en fonction de la pagination
for($i = $pagination['first']; $i < $pagination['last']; $i++) { for($i = $pagination['first']; $i < $pagination['last']; $i++) {
self::$articles[$articleIds[$i]] = $this->getData(['module', $this->getUrl(0), $articleIds[$i]]); self::$articles[$articleIds[$i]] = $this->getData(['module', $this->getUrl(0), 'posts', $articleIds[$i]]);
} }
// Valeurs en sortie // Valeurs en sortie
$this->addOutput([ $this->addOutput([

Binary file not shown.

After

Width:  |  Height:  |  Size: 652 B

38
module/blog/vendor/FeedWriter/ATOM.php vendored Normal file
View File

@ -0,0 +1,38 @@
<?php
namespace FeedWriter;
/*
* Copyright (C) 2012 Michael Bemmerl <mail@mx-server.de>
*
* This file is part of the "Universal Feed Writer" project.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/**
* Wrapper for creating ATOM feeds
*
* @package UniversalFeedWriter
*/
class ATOM extends Feed
{
/**
* {@inheritdoc}
*/
public function __construct()
{
parent::__construct(Feed::ATOM);
}
}

1017
module/blog/vendor/FeedWriter/Feed.php vendored Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,33 @@
<?php
namespace FeedWriter;
use \LogicException;
/*
* Copyright (C) 2016 Michael Bemmerl <mail@mx-server.de>
*
* This file is part of the "Universal Feed Writer" project.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/**
* The exception that is thrown when an invalid operation is performed on
* the object.
*
* @package UniversalFeedWriter
*/
class InvalidOperationException extends LogicException
{
}

413
module/blog/vendor/FeedWriter/Item.php vendored Normal file
View File

@ -0,0 +1,413 @@
<?php
namespace FeedWriter;
use \DateTime;
/*
* Copyright (C) 2008 Anis uddin Ahmad <anisniit@gmail.com>
* Copyright (C) 2010-2013, 2015-2016 Michael Bemmerl <mail@mx-server.de>
*
* This file is part of the "Universal Feed Writer" project.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/**
* Universal Feed Writer
*
* Item class - Used as feed element in Feed class
*
* @package UniversalFeedWriter
* @author Anis uddin Ahmad <anisniit@gmail.com>
* @link http://www.ajaxray.com/projects/rss
*/
class Item
{
/**
* Collection of feed item elements
*/
private $elements = array();
/**
* Contains the format of this feed.
*/
private $version;
/**
* Is used as a suffix when multiple elements have the same name.
**/
private $_cpt = 0;
/**
* Constructor
*
* @param string $version constant (RSS1/RSS2/ATOM) RSS2 is default.
*/
public function __construct($version = Feed::RSS2)
{
$this->version = $version;
}
/**
* Return an unique number
*
* @access private
* @return int
**/
private function cpt()
{
return $this->_cpt++;
}
/**
* Add an element to elements array
*
* @access public
* @param string $elementName The tag name of an element
* @param string $content The content of tag
* @param array $attributes Attributes (if any) in 'attrName' => 'attrValue' format
* @param boolean $overwrite Specifies if an already existing element is overwritten.
* @param boolean $allowMultiple Specifies if multiple elements of the same name are allowed.
* @return self
* @throws \InvalidArgumentException if the element name is not a string, empty or NULL.
*/
public function addElement($elementName, $content, array $attributes = null, $overwrite = FALSE, $allowMultiple = FALSE)
{
if (empty($elementName))
throw new \InvalidArgumentException('The element name may not be empty or NULL.');
if (!is_string($elementName))
throw new \InvalidArgumentException('The element name must be a string.');
$key = $elementName;
// return if element already exists & if overwriting is disabled
// & if multiple elements are not allowed.
if (isset($this->elements[$elementName]) && !$overwrite) {
if (!$allowMultiple)
return $this;
$key .= '-' . $this->cpt();
}
$this->elements[$key]['name'] = $elementName;
$this->elements[$key]['content'] = $content;
$this->elements[$key]['attributes'] = $attributes;
return $this;
}
/**
* Set multiple feed elements from an array.
* Elements which have attributes cannot be added by this method
*
* @access public
* @param array array of elements in 'tagName' => 'tagContent' format.
* @return self
*/
public function addElementArray(array $elementArray)
{
foreach ($elementArray as $elementName => $content) {
$this->addElement($elementName, $content);
}
return $this;
}
/**
* Return the collection of elements in this feed item
*
* @access public
* @return array All elements of this item.
* @throws InvalidOperationException on ATOM feeds if either a content or link element is missing.
* @throws InvalidOperationException on RSS1 feeds if a title or link element is missing.
*/
public function getElements()
{
// ATOM feeds have some specific requirements...
if ($this->version == Feed::ATOM)
{
// Add an 'id' element, if it was not added by calling the setLink method.
// Use the value of the title element as key, since no link element was specified.
if (!array_key_exists('id', $this->elements))
$this->setId(Feed::uuid($this->elements['title']['content'], 'urn:uuid:'));
// Either a 'link' or 'content' element is needed.
if (!array_key_exists('content', $this->elements) && !array_key_exists('link', $this->elements))
throw new InvalidOperationException('ATOM feed entries need a link or a content element. Call the setLink or setContent method.');
}
// ...same with RSS1 feeds.
else if ($this->version == Feed::RSS1)
{
if (!array_key_exists('title', $this->elements))
throw new InvalidOperationException('RSS1 feed entries need a title element. Call the setTitle method.');
if (!array_key_exists('link', $this->elements))
throw new InvalidOperationException('RSS1 feed entries need a link element. Call the setLink method.');
}
return $this->elements;
}
/**
* Return the type of this feed item
*
* @access public
* @return string The feed type, as defined in Feed.php
*/
public function getVersion()
{
return $this->version;
}
// Wrapper functions ------------------------------------------------------
/**
* Set the 'description' element of feed item
*
* @access public
* @param string $description The content of the 'description' or 'summary' element
* @return self
*/
public function setDescription($description)
{
$tag = ($this->version == Feed::ATOM) ? 'summary' : 'description';
return $this->addElement($tag, $description);
}
/**
* Set the 'content' element of the feed item
* For ATOM feeds only
*
* @access public
* @param string $content Content for the item (i.e., the body of a blog post).
* @return self
* @throws InvalidOperationException if this method is called on non-ATOM feeds.
*/
public function setContent($content)
{
if ($this->version != Feed::ATOM)
throw new InvalidOperationException('The content element is supported in ATOM feeds only.');
return $this->addElement('content', $content, array('type' => 'html'));
}
/**
* Set the 'title' element of feed item
*
* @access public
* @param string $title The content of 'title' element
* @return self
*/
public function setTitle($title)
{
return $this->addElement('title', $title);
}
/**
* Set the 'date' element of the feed item.
*
* The value of the date parameter can be either an instance of the
* DateTime class, an integer containing a UNIX timestamp or a string
* which is parseable by PHP's 'strtotime' function.
*
* @access public
* @param DateTime|int|string $date Date which should be used.
* @return self
* @throws \InvalidArgumentException if the given date was not parseable.
*/
public function setDate($date)
{
if (!is_numeric($date)) {
if ($date instanceof DateTime)
$date = $date->getTimestamp();
else {
$date = strtotime($date);
if ($date === FALSE)
throw new \InvalidArgumentException('The given date string was not parseable.');
}
} elseif ($date < 0)
throw new \InvalidArgumentException('The given date is not an UNIX timestamp.');
if ($this->version == Feed::ATOM) {
$tag = 'updated';
$value = date(\DATE_ATOM, $date);
} elseif ($this->version == Feed::RSS2) {
$tag = 'pubDate';
$value = date(\DATE_RSS, $date);
} else {
$tag = 'dc:date';
$value = date("Y-m-d", $date);
}
return $this->addElement($tag, $value);
}
/**
* Set the 'link' element of feed item
*
* @access public
* @param string $link The content of 'link' element
* @return self
*/
public function setLink($link)
{
if ($this->version == Feed::RSS2 || $this->version == Feed::RSS1) {
$this->addElement('link', $link);
} else {
$this->addElement('link','',array('href'=>$link));
$this->setId(Feed::uuid($link,'urn:uuid:'));
}
return $this;
}
/**
* Attach a external media to the feed item.
* Not supported in RSS 1.0 feeds.
*
* See RFC 4288 for syntactical correct MIME types.
*
* Note that you should avoid the use of more than one enclosure in one item,
* since some RSS aggregators don't support it.
*
* @access public
* @param string $url The URL of the media.
* @param integer $length The length of the media.
* @param string $type The MIME type attribute of the media.
* @param boolean $multiple Specifies if multiple enclosures are allowed
* @return self
* @link https://tools.ietf.org/html/rfc4288
* @throws \InvalidArgumentException if the length or type parameter is invalid.
* @throws InvalidOperationException if this method is called on RSS1 feeds.
*/
public function addEnclosure($url, $length, $type, $multiple = TRUE)
{
if ($this->version == Feed::RSS1)
throw new InvalidOperationException('Media attachment is not supported in RSS1 feeds.');
// the length parameter should be set to 0 if it can't be determined
// see http://www.rssboard.org/rss-profile#element-channel-item-enclosure
if (!is_numeric($length) || $length < 0)
throw new \InvalidArgumentException('The length parameter must be an integer and greater or equals to zero.');
// Regex used from RFC 4287, page 41
if (!is_string($type) || preg_match('/.+\/.+/', $type) != 1)
throw new \InvalidArgumentException('type parameter must be a string and a MIME type.');
$attributes = array('length' => $length, 'type' => $type);
if ($this->version == Feed::RSS2) {
$attributes['url'] = $url;
$this->addElement('enclosure', '', $attributes, FALSE, $multiple);
} else {
$attributes['href'] = $url;
$attributes['rel'] = 'enclosure';
$this->addElement('atom:link', '', $attributes, FALSE, $multiple);
}
return $this;
}
/**
* Set the 'author' element of feed item.
* Not supported in RSS 1.0 feeds.
*
* @access public
* @param string $author The author of this item
* @param string|null $email Optional email address of the author
* @param string|null $uri Optional URI related to the author
* @return self
* @throws \InvalidArgumentException if the provided email address is syntactically incorrect.
* @throws InvalidOperationException if this method is called on RSS1 feeds.
*/
public function setAuthor($author, $email = null, $uri = null)
{
if ($this->version == Feed::RSS1)
throw new InvalidOperationException('The author element is not supported in RSS1 feeds.');
// Regex from RFC 4287 page 41
if ($email != null && preg_match('/.+@.+/', $email) != 1)
throw new \InvalidArgumentException('The email address is syntactically incorrect.');
if ($this->version == Feed::RSS2)
{
if ($email != null)
$author = $email . ' (' . $author . ')';
$this->addElement('author', $author);
}
else
{
$elements = array('name' => $author);
if ($email != null)
$elements['email'] = $email;
if ($uri != null)
$elements['uri'] = $uri;
$this->addElement('author', $elements);
}
return $this;
}
/**
* Set the unique identifier of the feed item
*
* On ATOM feeds, the identifier must begin with an valid URI scheme.
*
* @access public
* @param string $id The unique identifier of this item
* @param boolean $permaLink The value of the 'isPermaLink' attribute in RSS 2 feeds.
* @return self
* @throws \InvalidArgumentException if the permaLink parameter is not boolean.
* @throws InvalidOperationException if this method is called on RSS1 feeds.
*/
public function setId($id, $permaLink = false)
{
if ($this->version == Feed::RSS2) {
if (!is_bool($permaLink))
throw new \InvalidArgumentException('The permaLink parameter must be boolean.');
$permaLink = $permaLink ? 'true' : 'false';
$this->addElement('guid', $id, array('isPermaLink' => $permaLink));
} elseif ($this->version == Feed::ATOM) {
// Check if the given ID is an valid URI scheme (see RFC 4287 4.2.6)
// The list of valid schemes was generated from http://www.iana.org/assignments/uri-schemes
// by using only permanent or historical schemes.
$validSchemes = array('aaa', 'aaas', 'about', 'acap', 'acct', 'cap', 'cid', 'coap', 'coaps', 'crid', 'data', 'dav', 'dict', 'dns', 'example', 'fax', 'file', 'filesystem', 'ftp', 'geo', 'go', 'gopher', 'h323', 'http', 'https', 'iax', 'icap', 'im', 'imap', 'info', 'ipp', 'ipps', 'iris', 'iris.beep', 'iris.lwz', 'iris.xpc', 'iris.xpcs', 'jabber', 'ldap', 'mailserver', 'mailto', 'mid', 'modem', 'msrp', 'msrps', 'mtqp', 'mupdate', 'news', 'nfs', 'ni', 'nih', 'nntp', 'opaquelocktoken', 'pack', 'pkcs11', 'pop', 'pres', 'prospero', 'reload', 'rtsp', 'rtsps', 'rtspu', 'service', 'session', 'shttp', 'sieve', 'sip', 'sips', 'sms', 'snews', 'snmp', 'soap.beep', 'soap.beeps', 'stun', 'stuns', 'tag', 'tel', 'telnet', 'tftp', 'thismessage', 'tip', 'tn3270', 'turn', 'turns', 'tv', 'urn', 'vemmi', 'videotex', 'vnc', 'wais', 'ws', 'wss', 'xcon', 'xcon-userid', 'xmlrpc.beep', 'xmlrpc.beeps', 'xmpp', 'z39.50', 'z39.50r', 'z39.50s');
$found = FALSE;
$checkId = strtolower($id);
foreach($validSchemes as $scheme)
if (strrpos($checkId, $scheme . ':', -strlen($checkId)) !== FALSE)
{
$found = TRUE;
break;
}
if (!$found)
throw new \InvalidArgumentException("The ID must begin with an IANA-registered URI scheme.");
$this->addElement('id', $id, NULL, TRUE);
} else
throw new InvalidOperationException('A unique ID is not supported in RSS1 feeds.');
return $this;
}
} // end of class Item

42
module/blog/vendor/FeedWriter/README.md vendored Normal file
View File

@ -0,0 +1,42 @@
# Generate **RSS 1.0**, **RSS 2.0** or **ATOM** Formatted Feeds
This package can be used to generate feeds in either **RSS 1.0**, **RSS 2.0** or **ATOM** format.
Applications can create a feed object, several feed item objects, set several types of properties of either feed and feed items, and add items to the feed.
Once a feed is fully composed with its items, the feed class can generate the necessary XML structure to describe the feed in **RSS** or **ATOM** format. This structure can be directly sent to the browser, or just returned as string.
## Requirements
- PHP 5.3 or higher
If you don't have **PHP 5.3** available on your system there is a version supporting **PHP 5.0** and above. See the `legacy-php-5.0` branch.
## Documentation
The documentation can be found in the `gh-pages` branch, or on [GitHub Pages](https://mibe.github.io/FeedWriter/).
See the `/examples` directory for usage examples.
See the `CHANGELOG.md` file for changes between the different versions.
## Authors
In chronological order:
- [Anis uddin Ahmad](https://github.com/ajaxray)
- [Michael Bemmerl](https://github.com/mibe)
- Phil Freo
- Paul Ferrett
- Brennen Bearnes
- Michael Robinson
- Baptiste Fontaine
- Kristián Valentín
- Brandtley McMinn
- Julian Bogdani
- Cedric Gampert
- Yamek
- Thielj
- Pavel Khakhlou
- Daniel
- Tino Goratsch

37
module/blog/vendor/FeedWriter/RSS1.php vendored Normal file
View File

@ -0,0 +1,37 @@
<?php
namespace FeedWriter;
/*
* Copyright (C) 2012 Michael Bemmerl <mail@mx-server.de>
*
* This file is part of the "Universal Feed Writer" project.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/**
* Wrapper for creating RSS1 feeds
*
* @package UniversalFeedWriter
*/
class RSS1 extends Feed
{
/**
* {@inheritdoc}
*/
public function __construct()
{
parent::__construct(Feed::RSS1);
}
}

37
module/blog/vendor/FeedWriter/RSS2.php vendored Normal file
View File

@ -0,0 +1,37 @@
<?php
namespace FeedWriter;
/*
* Copyright (C) 2012 Michael Bemmerl <mail@mx-server.de>
*
* This file is part of the "Universal Feed Writer" project.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/**
* Wrapper for creating RSS2 feeds
*
* @package UniversalFeedWriter
*/
class RSS2 extends Feed
{
/**
* {@inheritdoc}
*/
public function __construct()
{
parent::__construct(Feed::RSS2);
}
}

View File

@ -56,7 +56,9 @@
</div> </div>
<div class="row"> <div class="row">
<div class="col12"> <div class="col12">
<?php echo template::checkbox('blogAddHidePicture', true, 'Masquer l\'image dans l\'article'); ?> <?php echo template::checkbox('blogAddHidePicture', true, 'Masquer l\'image dans l\'article', [
'checked' => $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(2), 'hidePicture'])
]); ?>
</div> </div>
</div> </div>
</div> </div>

View File

@ -50,4 +50,14 @@
.blogArticlePicture { .blogArticlePicture {
height:auto; height:auto;
max-width: 100%;} max-width: 100%;}
}
#rssFeed {
text-align: right;
float: right;
}
#rssFeed p {
display: inline;
vertical-align: top;
} }

View File

@ -3,12 +3,12 @@
<div class="col10"> <div class="col10">
<div class="blogDate"> <div class="blogDate">
<i class="far fa-calendar-alt"></i> <i class="far fa-calendar-alt"></i>
<?php $date = mb_detect_encoding(strftime('%d %B %Y', $this->getData(['module', $this->getUrl(0), $this->getUrl(1), 'publishedOn'])), 'UTF-8', true) <?php $date = mb_detect_encoding(strftime('%d %B %Y', $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'publishedOn'])), 'UTF-8', true)
? strftime('%d %B %Y', $this->getData(['module', $this->getUrl(0), $this->getUrl(1), 'publishedOn'])) ? strftime('%d %B %Y', $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'publishedOn']))
: utf8_encode(strftime('%d %B %Y', $this->getData(['module', $this->getUrl(0), $this->getUrl(1), 'publishedOn']))); : utf8_encode(strftime('%d %B %Y', $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'publishedOn'])));
$heure = mb_detect_encoding(strftime('%H:%M', $this->getData(['module', $this->getUrl(0), $this->getUrl(1), 'publishedOn'])), 'UTF-8', true) $heure = mb_detect_encoding(strftime('%H:%M', $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'publishedOn'])), 'UTF-8', true)
? strftime('%H:%M', $this->getData(['module', $this->getUrl(0), $this->getUrl(1), 'publishedOn'])) ? strftime('%H:%M', $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'publishedOn']))
: utf8_encode(strftime('%H:%M', $this->getData(['module', $this->getUrl(0), $this->getUrl(1), 'publishedOn']))); : utf8_encode(strftime('%H:%M', $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'publishedOn'])));
echo $date . ' à ' . $heure; echo $date . ' à ' . $heure;
?> ?>
</div> </div>
@ -19,19 +19,19 @@
AND AND
( // Propriétaire ( // Propriétaire
( (
$this->getData(['module', $this->getUrl(0), $this->getUrl(1),'editConsent']) === $module::EDIT_OWNER $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1),'editConsent']) === $module::EDIT_OWNER
AND ( $this->getData(['module', $this->getUrl(0), $this->getUrl(1),'userId']) === $this->getUser('id') AND ( $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1),'userId']) === $this->getUser('id')
OR $this->getUser('group') === self::GROUP_ADMIN ) OR $this->getUser('group') === self::GROUP_ADMIN )
) )
OR ( OR (
// Groupe // Groupe
( $this->getData(['module', $this->getUrl(0), $this->getUrl(1),'editConsent']) === self::GROUP_ADMIN ( $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1),'editConsent']) === self::GROUP_ADMIN
OR $this->getData(['module', $this->getUrl(0), $this->getUrl(1),'editConsent']) === self::GROUP_MODERATOR) OR $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1),'editConsent']) === self::GROUP_MODERATOR)
AND $this->getUser('group') >= $this->getData(['module',$this->getUrl(0), $this->getUrl(1),'editConsent']) AND $this->getUser('group') >= $this->getData(['module',$this->getUrl(0), 'posts', $this->getUrl(1),'editConsent'])
) )
OR ( OR (
// Tout le monde // Tout le monde
$this->getData(['module', $this->getUrl(0), $this->getUrl(1),'editConsent']) === $module::EDIT_ALL $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1),'editConsent']) === $module::EDIT_ALL
AND $this->getUser('group') >= $module::$actions['config'] AND $this->getUser('group') >= $module::$actions['config']
) )
) )
@ -43,15 +43,26 @@
<?php endif; ?> <?php endif; ?>
</div> </div>
</div> </div>
<?php $pictureSize = $this->getData(['module', $this->getUrl(0), $this->getUrl(1), 'pictureSize']) === null ? '100' : $this->getData(['module', $this->getUrl(0), $this->getUrl(1), 'pictureSize']); ?> <?php $pictureSize = $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'pictureSize']) === null ? '100' : $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'pictureSize']); ?>
<?php if ($this->getData(['module', $this->getUrl(0), $this->getUrl(1), 'hidePicture']) == false) { <?php if ($this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'hidePicture']) == false) {
echo '<img class="blogArticlePicture blogArticlePicture' . $this->getData(['module', $this->getUrl(0), $this->getUrl(1), 'picturePosition']) . echo '<img class="blogArticlePicture blogArticlePicture' . $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'picturePosition']) .
' pict' . $pictureSize . '" src="' . helper::baseUrl(false) . self::FILE_DIR.'source/' . $this->getData(['module', $this->getUrl(0), $this->getUrl(1), 'picture']) . ' pict' . $pictureSize . '" src="' . helper::baseUrl(false) . self::FILE_DIR.'source/' . $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'picture']) .
'" alt="' . $this->getData(['module', $this->getUrl(0), $this->getUrl(1), 'picture']) . '">'; '" alt="' . $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'picture']) . '">';
} ?> } ?>
<?php echo $this->getData(['module', $this->getUrl(0), $this->getUrl(1), 'content']); ?> <?php echo $this->getData(['module', $this->getUrl(0),'posts', $this->getUrl(1), 'content']); ?>
<p class="clearBoth signature"><?php echo $module::$articleSignature;?></p> <p class="clearBoth signature"><?php echo $module::$articleSignature;?></p>
<?php if($this->getData(['module', $this->getUrl(0), $this->getUrl(1), 'commentClose'])): ?> <!-- Bloc RSS-->
<?php if ($this->getData(['module',$this->getUrl(0), 'config', 'feeds'])): ?>
<div id="rssFeed">
<a type="application/rss+xml" href="<?php echo helper::baseUrl() . $this->getUrl(0) . '/rss'; ?> ">
<img src='module/news/ressource/feed-icon-16.gif' />
<?php
echo '<p>' . $this->getData(['module',$this->getUrl(0), 'config', 'feedsLabel']) . '</p>' ;
?>
</a>
</div>
<?php endif; ?>
<?php if($this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'commentClose'])): ?>
<p>Cet article ne reçoit pas de commentaire.</p> <p>Cet article ne reçoit pas de commentaire.</p>
<?php else: ?> <?php else: ?>
<h3 id="comment"> <h3 id="comment">
@ -94,10 +105,10 @@
</div> </div>
<?php endif; ?> <?php endif; ?>
<?php echo template::textarea('blogArticleContent', [ <?php echo template::textarea('blogArticleContent', [
'label' => 'Commentaire avec maximum '.$this->getData(['module', $this->getUrl(0), $this->getUrl(1), 'commentMaxlength']).' caractères', 'label' => 'Commentaire avec maximum '.$this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'commentMaxlength']).' caractères',
'class' => 'editorWysiwygComment', 'class' => 'editorWysiwygComment',
'noDirty' => true, 'noDirty' => true,
'maxlength' => $this->getData(['module', $this->getUrl(0), $this->getUrl(1), 'commentMaxlength']) 'maxlength' => $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'commentMaxlength'])
]); ?> ]); ?>
<div id="blogArticleContentAlarm"> </div> <div id="blogArticleContentAlarm"> </div>
<?php if($this->getUser('password') !== $this->getInput('ZWII_USER_PASSWORD')): ?> <?php if($this->getUser('password') !== $this->getInput('ZWII_USER_PASSWORD')): ?>
@ -124,9 +135,7 @@
</div> </div>
</div> </div>
</div> </div>
<?php echo template::formClose(); ?>
<?php endif;?> <?php endif;?>
<div class="row"> <div class="row">
<div class="col12"> <div class="col12">
<?php foreach($module::$comments as $commentId => $comment): ?> <?php foreach($module::$comments as $commentId => $comment): ?>

View File

@ -1,20 +1,45 @@
<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), 'posts',
'value' => 'Retour' 'ico' => 'left',
]); ?> 'value' => 'Retour'
]); ?>
</div>
<div class="col2 offset6">
<?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="col2 offset8"> <div class="row">
<?php echo template::button('blogConfigAdd', [ <div class="col12">
'href' => helper::baseUrl() . $this->getUrl(0) . '/add', <div class="block">
'ico' => 'plus', <h4>Paramètres du module</h4>
'value' => 'Article' <div class="row">
]); ?> <div class="col6">
<?php echo template::checkbox('blogConfigShowFeeds', true, 'Lien du flux RSS', [
'checked' => $this->getData(['module', $this->getUrl(0), 'config', 'feeds']),
]); ?>
</div>
<div class="col6">
<?php echo template::text('blogConfigFeedslabel', [
'label' => 'Texte de l\'étiquette',
'value' => $this->getData(['module', $this->getUrl(0), 'config', 'feedsLabel'])
]); ?>
</div>
</div>
</div>
</div>
</div> </div>
</div> <?php echo template::formClose(); ?>
<?php if($module::$articles): ?> <?php if($module::$articles): ?>
<?php echo template::table([4, 4, 1, 1, 1, 1], $module::$articles, ['Titre', 'Date de publication', 'État', 'Commentaires', '','']); ?> <?php echo template::table([4, 4, 1, 1, 1, 1], $module::$articles, ['Titre', 'Date de publication', 'État', 'Commentaires', '','']); ?>
<?php echo $module::$pages; ?> <?php echo $module::$pages; ?>
@ -24,3 +49,4 @@
<div class="moduleVersion">Version <div class="moduleVersion">Version
<?php echo $module::BLOG_VERSION; ?> <?php echo $module::BLOG_VERSION; ?>
</div> </div>

View File

@ -32,7 +32,7 @@
<div class="col12"> <div class="col12">
<?php echo template::text('blogEditTitle', [ <?php echo template::text('blogEditTitle', [
'label' => 'Titre', 'label' => 'Titre',
'value' => $this->getData(['module', $this->getUrl(0), $this->getUrl(2), 'title']) 'value' => $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(2), 'title'])
]); ?> ]); ?>
</div> </div>
</div> </div>
@ -42,19 +42,19 @@
'help' => 'Taille optimale de l\'image de couverture : ' . ((int) substr($this->getData(['theme', 'site', 'width']), 0, -2) - (20 * 2)) . ' x 350 pixels.', 'help' => 'Taille optimale de l\'image de couverture : ' . ((int) substr($this->getData(['theme', 'site', 'width']), 0, -2) - (20 * 2)) . ' x 350 pixels.',
'label' => 'Image de couverture', 'label' => 'Image de couverture',
'type' => 1, 'type' => 1,
'value' => $this->getData(['module', $this->getUrl(0), $this->getUrl(2), 'picture']) 'value' => $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(2), 'picture'])
]); ?> ]); ?>
</div> </div>
<div class="col3"> <div class="col3">
<?php echo template::select('blogEditPictureSize', $module::$pictureSizes, [ <?php echo template::select('blogEditPictureSize', $module::$pictureSizes, [
'label' => 'Largeur de l\'image', 'label' => 'Largeur de l\'image',
'selected' => $this->getData(['module', $this->getUrl(0), $this->getUrl(2), 'pictureSize']) 'selected' => $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(2), 'pictureSize'])
]); ?> ]); ?>
</div> </div>
<div class="col3"> <div class="col3">
<?php echo template::select('blogEditPicturePosition', $module::$picturePositions, [ <?php echo template::select('blogEditPicturePosition', $module::$picturePositions, [
'label' => 'Position', 'label' => 'Position',
'selected' => $this->getData(['module', $this->getUrl(0), $this->getUrl(2), 'picturePosition']), 'selected' => $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(2), 'picturePosition']),
'help' => 'Le texte de l\'article est adapté autour de l\'image' 'help' => 'Le texte de l\'article est adapté autour de l\'image'
]); ?> ]); ?>
</div> </div>
@ -62,7 +62,7 @@
<div class="row"> <div class="row">
<div class="col6"> <div class="col6">
<?php echo template::checkbox('blogEditHidePicture', true, 'Masquer l\'image dans l\'article', [ <?php echo template::checkbox('blogEditHidePicture', true, 'Masquer l\'image dans l\'article', [
'checked' => $this->getData(['module', $this->getUrl(0), $this->getUrl(2), 'hidePicture']) 'checked' => $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(2), 'hidePicture'])
]); ?> ]); ?>
</div> </div>
</div> </div>
@ -71,7 +71,7 @@
</div> </div>
<?php echo template::textarea('blogEditContent', [ <?php echo template::textarea('blogEditContent', [
'class' => 'editorWysiwyg', 'class' => 'editorWysiwyg',
'value' => $this->getData(['module', $this->getUrl(0), $this->getUrl(2), 'content']) 'value' => $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(2), 'content'])
]); ?> ]); ?>
<div class="row"> <div class="row">
<div class="col12"> <div class="col12">
@ -95,7 +95,7 @@
<div class="col4"> <div class="col4">
<?php echo template::select('blogEditConsent', $module::$articleConsent , [ <?php echo template::select('blogEditConsent', $module::$articleConsent , [
'label' => 'Edition / Suppression', 'label' => 'Edition / Suppression',
'selected' => is_numeric($this->getData(['module', $this->getUrl(0), $this->getUrl(2), 'editConsent'])) ? $module::EDIT_GROUP : $this->getData(['module', $this->getUrl(0), $this->getUrl(2), 'editConsent']), 'selected' => is_numeric($this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(2), 'editConsent'])) ? $module::EDIT_GROUP : $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(2), 'editConsent']),
'help' => 'Les utilisateurs des groupes supérieurs accèdent à l\'article sans restriction' 'help' => 'Les utilisateurs des groupes supérieurs accèdent à l\'article sans restriction'
]); ?> ]); ?>
</div> </div>
@ -110,12 +110,12 @@
<div class="row"> <div class="row">
<div class="col4 "> <div class="col4 ">
<?php echo template::checkbox('blogEditCommentClose', true, 'Fermer les commentaires', [ <?php echo template::checkbox('blogEditCommentClose', true, 'Fermer les commentaires', [
'checked' => $this->getData(['module', $this->getUrl(0), $this->getUrl(2), 'commentClose']) 'checked' => $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(2), 'commentClose'])
]); ?> ]); ?>
</div> </div>
<div class="col4 commentOptionsWrapper "> <div class="col4 commentOptionsWrapper ">
<?php echo template::checkbox('blogEditCommentApproved', true, 'Approbation par un modérateur', [ <?php echo template::checkbox('blogEditCommentApproved', true, 'Approbation par un modérateur', [
'checked' => $this->getData(['module', $this->getUrl(0), $this->getUrl(2), 'commentApproved']), 'checked' => $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(2), 'commentApproved']),
'' ''
]); ?> ]); ?>
</div> </div>
@ -123,7 +123,7 @@
<?php echo template::select('blogEditCommentMaxlength', $module::$commentLength,[ <?php echo template::select('blogEditCommentMaxlength', $module::$commentLength,[
'help' => 'Choix du nombre maximum de caractères pour chaque commentaire de l\'article, mise en forme html comprise.', 'help' => 'Choix du nombre maximum de caractères pour chaque commentaire de l\'article, mise en forme html comprise.',
'label' => 'Caractères par commentaire', 'label' => 'Caractères par commentaire',
'selected' => $this->getData(['module', $this->getUrl(0), $this->getUrl(2), 'commentMaxlength']) 'selected' => $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(2), 'commentMaxlength'])
]); ?> ]); ?>
</div> </div>
@ -131,12 +131,12 @@
<div class="row"> <div class="row">
<div class="col3 commentOptionsWrapper offset2"> <div class="col3 commentOptionsWrapper offset2">
<?php echo template::checkbox('blogEditCommentNotification', true, 'Notification par email', [ <?php echo template::checkbox('blogEditCommentNotification', true, 'Notification par email', [
'checked' => $this->getData(['module', $this->getUrl(0), $this->getUrl(2), 'commentNotification']), 'checked' => $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(2), 'commentNotification']),
]); ?> ]); ?>
</div> </div>
<div class="col4 commentOptionsWrapper"> <div class="col4 commentOptionsWrapper">
<?php echo template::select('blogEditCommentGroupNotification', $module::$groupNews, [ <?php echo template::select('blogEditCommentGroupNotification', $module::$groupNews, [
'selected' => $this->getData(['module', $this->getUrl(0), $this->getUrl(2), 'commentGroupNotification']), 'selected' => $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(2), 'commentGroupNotification']),
'help' => 'Editeurs = éditeurs + administrateurs<br/> Membres = membres + éditeurs + administrateurs' 'help' => 'Editeurs = éditeurs + administrateurs<br/> Membres = membres + éditeurs + administrateurs'
]); ?> ]); ?>
</div> </div>

View File

@ -46,4 +46,16 @@
.blogContent { .blogContent {
display: none; display: none;
} }
}
/*
* Flux RSS
*/
#rssFeed {
text-align: right;
float: right;
}
#rssFeed p {
display: inline;
vertical-align: top;
} }

View File

@ -52,6 +52,16 @@
</div> </div>
</div> </div>
<?php echo $module::$pages; ?> <?php echo $module::$pages; ?>
<?php if ($this->getData(['module',$this->getUrl(0), 'config', 'feeds'])): ?>
<div id="rssFeed">
<a type="application/rss+xml" href="<?php echo helper::baseUrl() . $this->getUrl(0) . '/rss'; ?> ">
<img src='module/news/ressource/feed-icon-16.gif' />
<?php
echo '<p>' . $this->getData(['module',$this->getUrl(0), 'config', 'feedsLabel']) . '</p>' ;
?>
</a>
</div>
<?php endif; ?>
<?php else: ?> <?php else: ?>
<?php echo template::speech('Aucun article.'); ?> <?php echo template::speech('Aucun article.'); ?>
<?php endif; ?> <?php endif; ?>

View File

@ -0,0 +1 @@
<!-- rien -->

View File

@ -19,7 +19,8 @@ class news extends common {
'config' => self::GROUP_MODERATOR, 'config' => self::GROUP_MODERATOR,
'delete' => self::GROUP_MODERATOR, 'delete' => self::GROUP_MODERATOR,
'edit' => self::GROUP_MODERATOR, 'edit' => self::GROUP_MODERATOR,
'index' => self::GROUP_VISITOR 'index' => self::GROUP_VISITOR,
'rss' => self::GROUP_VISITOR
]; ];
public static $news = []; public static $news = [];
@ -32,10 +33,57 @@ class news extends common {
false => 'Brouillon', false => 'Brouillon',
true => 'Publié' true => 'Publié'
]; ];
const NEWS_VERSION = '1.2'; const NEWS_VERSION = '1.3';
public static $users = []; public static $users = [];
/**
* Flux RSS
*/
public function rss() {
// Inclure les classes
include_once 'module/news/vendor/FeedWriter/Item.php';
include_once 'module/news/vendor/FeedWriter/Feed.php';
include_once 'module/news/vendor/FeedWriter/RSS2.php';
include_once 'module/news/vendor/FeedWriter/InvalidOperationException.php';
date_default_timezone_set('UTC');
$feeds = new \FeedWriter\RSS2();
// En-tête
$feeds->setTitle($this->getData (['page', $this->getUrl(0),'posts','title']));
$feeds->setLink(helper::baseUrl() . $this->getUrl(0));
$feeds->setDescription(html_entity_decode(strip_tags($this->getData (['page', $this->getUrl(0), 'metaDescription']))));
$feeds->setChannelElement('language', 'fr-FR');
$feeds->setDate(time());
$feeds->addGenerator();
// Corps des articles
$newsIdsPublishedOns = helper::arrayCollumn($this->getData(['module', $this->getUrl(0), 'posts']), 'publishedOn', 'SORT_DESC');
// Articles de la première page uniquement
$newsIdsPublishedOns = array_slice($newsIdsPublishedOns, 0, $this->getData(['config', 'itemsperPage']) );
$newsIdsStates = helper::arrayCollumn($this->getData(['module', $this->getUrl(0), 'posts']), 'state', 'SORT_DESC');
foreach($newsIdsPublishedOns as $newsId => $newsPublishedOn) {
if($newsPublishedOn <= time() AND $newsIdsStates[$newsId]) {
$newsArticle = $feeds->createNewItem();
$newsArticle->addElementArray([
'title' => strip_tags($this->getData(['module', $this->getUrl(0),'posts', $newsId, 'title']) ),
'link' => helper::baseUrl() . $this->getUrl(0),
'description' => html_entity_decode(strip_tags($this->getData(['module', $this->getUrl(0),'posts', $newsId, 'content'])))
]);
$feeds->addItem($newsArticle);
}
}
// Valeurs en sortie
$this->addOutput([
'display' => self::DISPLAY_RSS,
'content' => $feeds->generateFeed(),
'view' => 'rss'
]);
}
/** /**
* Édition * Édition
*/ */
@ -44,7 +92,7 @@ class news extends common {
if($this->isPost()) { if($this->isPost()) {
// Crée la news // Crée la news
$newsId = helper::increment($this->getInput('newsAddTitle', helper::FILTER_ID), (array) $this->getData(['module', $this->getUrl(0)])); $newsId = helper::increment($this->getInput('newsAddTitle', helper::FILTER_ID), (array) $this->getData(['module', $this->getUrl(0)]));
$this->setData(['module', $this->getUrl(0), $newsId, [ $this->setData(['module', $this->getUrl(0),'posts', $newsId, [
'content' => $this->getInput('newsAddContent', null), 'content' => $this->getInput('newsAddContent', null),
'publishedOn' => $this->getInput('newsAddPublishedOn', helper::FILTER_DATETIME, true), 'publishedOn' => $this->getInput('newsAddPublishedOn', helper::FILTER_DATETIME, true),
'state' => $this->getInput('newsAddState', helper::FILTER_BOOLEAN), 'state' => $this->getInput('newsAddState', helper::FILTER_BOOLEAN),
@ -80,41 +128,55 @@ class news extends common {
* Configuration * Configuration
*/ */
public function config() { public function config() {
// Ids des news par ordre de publication // Soumission du formulaire
$newsIds = 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($newsIds, $this->getUrl(),$this->getData(['config','itemsperPage'])); 'feeds' => $this->getInput('newsConfigShowFeeds',helper::FILTER_BOOLEAN),
// Liste des pages 'feedsLabel' => $this->getInput('newsConfigFeedslabel',helper::FILTER_STRING_SHORT)
self::$pages = $pagination['pages']; ]]);
// News 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), $newsIds[$i], 'publishedOn'])), 'UTF-8', true) 'notification' => 'Modifications enregistrées',
? strftime('%d %B %Y', $this->getData(['module', $this->getUrl(0), $newsIds[$i], 'publishedOn'])) 'state' => true
: utf8_encode(strftime('%d %B %Y', $this->getData(['module', $this->getUrl(0), $newsIds[$i], 'publishedOn']))); ]);
$heure = mb_detect_encoding(strftime('%H:%M', $this->getData(['module', $this->getUrl(0), $newsIds[$i], 'publishedOn'])), 'UTF-8', true) } else {
? strftime('%H:%M', $this->getData(['module', $this->getUrl(0), $newsIds[$i], 'publishedOn'])) // Ids des news par ordre de publication
: utf8_encode(strftime('%H:%M', $this->getData(['module', $this->getUrl(0), $newsIds[$i], 'publishedOn']))); $newsIds = array_keys(helper::arrayCollumn($this->getData(['module', $this->getUrl(0), 'posts']), 'publishedOn', 'SORT_DESC'));
self::$news[] = [ // Pagination
$this->getData(['module', $this->getUrl(0), $newsIds[$i], 'title']), $pagination = helper::pagination($newsIds, $this->getUrl(),$this->getData(['config','itemsperPage']));
$date .' à '. $heure, // Liste des pages
self::$states[$this->getData(['module', $this->getUrl(0), $newsIds[$i], 'state'])], self::$pages = $pagination['pages'];
template::button('newsConfigEdit' . $newsIds[$i], [ // News en fonction de la pagination
'href' => helper::baseUrl() . $this->getUrl(0) . '/edit/' . $newsIds[$i]. '/' . $_SESSION['csrf'], for($i = $pagination['first']; $i < $pagination['last']; $i++) {
'value' => template::ico('pencil') // Met en forme le tableau
]), $date = mb_detect_encoding(strftime('%d %B %Y', $this->getData(['module', $this->getUrl(0),'posts', $newsIds[$i], 'publishedOn'])), 'UTF-8', true)
template::button('newsConfigDelete' . $newsIds[$i], [ ? strftime('%d %B %Y', $this->getData(['module', $this->getUrl(0),'posts', $newsIds[$i], 'publishedOn']))
'class' => 'newsConfigDelete buttonRed', : utf8_encode(strftime('%d %B %Y', $this->getData(['module', $this->getUrl(0),'posts', $newsIds[$i], 'publishedOn'])));
'href' => helper::baseUrl() . $this->getUrl(0) . '/delete/' . $newsIds[$i] . '/' . $_SESSION['csrf'], $heure = mb_detect_encoding(strftime('%H:%M', $this->getData(['module', $this->getUrl(0),'posts', $newsIds[$i], 'publishedOn'])), 'UTF-8', true)
'value' => template::ico('cancel') ? strftime('%H:%M', $this->getData(['module', $this->getUrl(0),'posts', $newsIds[$i], 'publishedOn']))
]) : utf8_encode(strftime('%H:%M', $this->getData(['module', $this->getUrl(0),'posts', $newsIds[$i], 'publishedOn'])));
]; self::$news[] = [
$this->getData(['module', $this->getUrl(0),'posts', $newsIds[$i], 'title']),
$date .' à '. $heure,
self::$states[$this->getData(['module', $this->getUrl(0),'posts', $newsIds[$i], 'state'])],
template::button('newsConfigEdit' . $newsIds[$i], [
'href' => helper::baseUrl() . $this->getUrl(0) . '/edit/' . $newsIds[$i]. '/' . $_SESSION['csrf'],
'value' => template::ico('pencil')
]),
template::button('newsConfigDelete' . $newsIds[$i], [
'class' => 'newsConfigDelete buttonRed',
'href' => helper::baseUrl() . $this->getUrl(0) . '/delete/' . $newsIds[$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'
]);
} }
/** /**
@ -122,7 +184,7 @@ class news extends common {
*/ */
public function delete() { public function delete() {
// La news n'existe pas // La news n'existe pas
if($this->getData(['module', $this->getUrl(0), $this->getUrl(2)]) === null) { if($this->getData(['module', $this->getUrl(0),'posts', $this->getUrl(2)]) === null) {
// Valeurs en sortie // Valeurs en sortie
$this->addOutput([ $this->addOutput([
'access' => false 'access' => false
@ -138,7 +200,7 @@ class news extends common {
} }
// Suppression // Suppression
else { else {
$this->deleteData(['module', $this->getUrl(0), $this->getUrl(2)]); $this->deleteData(['module', $this->getUrl(0),'posts', $this->getUrl(2)]);
// Valeurs en sortie // Valeurs en sortie
$this->addOutput([ $this->addOutput([
'redirect' => helper::baseUrl() . $this->getUrl(0) . '/config', 'redirect' => helper::baseUrl() . $this->getUrl(0) . '/config',
@ -161,7 +223,7 @@ class news extends common {
]); ]);
} }
// La news n'existe pas // La news n'existe pas
if($this->getData(['module', $this->getUrl(0), $this->getUrl(2)]) === null) { if($this->getData(['module', $this->getUrl(0),'posts', $this->getUrl(2)]) === null) {
// Valeurs en sortie // Valeurs en sortie
$this->addOutput([ $this->addOutput([
'access' => false 'access' => false
@ -177,9 +239,9 @@ class news extends common {
// Incrémente le nouvel id de la news // Incrémente le nouvel id de la news
$newsId = helper::increment($newsId, $this->getData(['module', $this->getUrl(0)])); $newsId = helper::increment($newsId, $this->getData(['module', $this->getUrl(0)]));
// Supprime l'ancien news // Supprime l'ancien news
$this->deleteData(['module', $this->getUrl(0), $this->getUrl(2)]); $this->deleteData(['module', $this->getUrl(0),'posts', $this->getUrl(2)]);
} }
$this->setData(['module', $this->getUrl(0), $newsId, [ $this->setData(['module', $this->getUrl(0),'posts', $newsId, [
'content' => $this->getInput('newsEditContent', null), 'content' => $this->getInput('newsEditContent', null),
'publishedOn' => $this->getInput('newsEditPublishedOn', helper::FILTER_DATETIME, true), 'publishedOn' => $this->getInput('newsEditPublishedOn', helper::FILTER_DATETIME, true),
'state' => $this->getInput('newsEditState', helper::FILTER_BOOLEAN), 'state' => $this->getInput('newsEditState', helper::FILTER_BOOLEAN),
@ -202,7 +264,7 @@ class news extends common {
unset($userFirstname); unset($userFirstname);
// Valeurs en sortie // Valeurs en sortie
$this->addOutput([ $this->addOutput([
'title' => $this->getData(['module', $this->getUrl(0), $this->getUrl(2), 'title']), 'title' => $this->getData(['module', $this->getUrl(0),'posts', $this->getUrl(2), 'title']),
'vendor' => [ 'vendor' => [
'flatpickr', 'flatpickr',
'tinymce' 'tinymce'
@ -217,8 +279,8 @@ class news extends common {
*/ */
public function index() { public function index() {
// Ids des news par ordre de publication // Ids des news par ordre de publication
$newsIdsPublishedOns = helper::arrayCollumn($this->getData(['module', $this->getUrl(0)]), 'publishedOn', 'SORT_DESC'); $newsIdsPublishedOns = helper::arrayCollumn($this->getData(['module', $this->getUrl(0), 'posts']), 'publishedOn', 'SORT_DESC');
$newsIdsStates = helper::arrayCollumn($this->getData(['module', $this->getUrl(0)]), 'state', 'SORT_DESC'); $newsIdsStates = helper::arrayCollumn($this->getData(['module', $this->getUrl(0), 'posts']), 'state', 'SORT_DESC');
$newsIds = []; $newsIds = [];
foreach($newsIdsPublishedOns as $newsId => $newsPublishedOn) { foreach($newsIdsPublishedOns as $newsId => $newsPublishedOn) {
if($newsPublishedOn <= time() AND $newsIdsStates[$newsId]) { if($newsPublishedOn <= time() AND $newsIdsStates[$newsId]) {
@ -231,7 +293,7 @@ class news extends common {
self::$pages = $pagination['pages']; self::$pages = $pagination['pages'];
// News en fonction de la pagination // News en fonction de la pagination
for($i = $pagination['first']; $i < $pagination['last']; $i++) { for($i = $pagination['first']; $i < $pagination['last']; $i++) {
self::$news[$newsIds[$i]] = $this->getData(['module', $this->getUrl(0), $newsIds[$i]]); self::$news[$newsIds[$i]] = $this->getData(['module', $this->getUrl(0),'posts', $newsIds[$i]]);
} }
// Valeurs en sortie // Valeurs en sortie
$this->addOutput([ $this->addOutput([

Binary file not shown.

After

Width:  |  Height:  |  Size: 652 B

38
module/news/vendor/FeedWriter/ATOM.php vendored Normal file
View File

@ -0,0 +1,38 @@
<?php
namespace FeedWriter;
/*
* Copyright (C) 2012 Michael Bemmerl <mail@mx-server.de>
*
* This file is part of the "Universal Feed Writer" project.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/**
* Wrapper for creating ATOM feeds
*
* @package UniversalFeedWriter
*/
class ATOM extends Feed
{
/**
* {@inheritdoc}
*/
public function __construct()
{
parent::__construct(Feed::ATOM);
}
}

1017
module/news/vendor/FeedWriter/Feed.php vendored Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,33 @@
<?php
namespace FeedWriter;
use \LogicException;
/*
* Copyright (C) 2016 Michael Bemmerl <mail@mx-server.de>
*
* This file is part of the "Universal Feed Writer" project.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/**
* The exception that is thrown when an invalid operation is performed on
* the object.
*
* @package UniversalFeedWriter
*/
class InvalidOperationException extends LogicException
{
}

413
module/news/vendor/FeedWriter/Item.php vendored Normal file
View File

@ -0,0 +1,413 @@
<?php
namespace FeedWriter;
use \DateTime;
/*
* Copyright (C) 2008 Anis uddin Ahmad <anisniit@gmail.com>
* Copyright (C) 2010-2013, 2015-2016 Michael Bemmerl <mail@mx-server.de>
*
* This file is part of the "Universal Feed Writer" project.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/**
* Universal Feed Writer
*
* Item class - Used as feed element in Feed class
*
* @package UniversalFeedWriter
* @author Anis uddin Ahmad <anisniit@gmail.com>
* @link http://www.ajaxray.com/projects/rss
*/
class Item
{
/**
* Collection of feed item elements
*/
private $elements = array();
/**
* Contains the format of this feed.
*/
private $version;
/**
* Is used as a suffix when multiple elements have the same name.
**/
private $_cpt = 0;
/**
* Constructor
*
* @param string $version constant (RSS1/RSS2/ATOM) RSS2 is default.
*/
public function __construct($version = Feed::RSS2)
{
$this->version = $version;
}
/**
* Return an unique number
*
* @access private
* @return int
**/
private function cpt()
{
return $this->_cpt++;
}
/**
* Add an element to elements array
*
* @access public
* @param string $elementName The tag name of an element
* @param string $content The content of tag
* @param array $attributes Attributes (if any) in 'attrName' => 'attrValue' format
* @param boolean $overwrite Specifies if an already existing element is overwritten.
* @param boolean $allowMultiple Specifies if multiple elements of the same name are allowed.
* @return self
* @throws \InvalidArgumentException if the element name is not a string, empty or NULL.
*/
public function addElement($elementName, $content, array $attributes = null, $overwrite = FALSE, $allowMultiple = FALSE)
{
if (empty($elementName))
throw new \InvalidArgumentException('The element name may not be empty or NULL.');
if (!is_string($elementName))
throw new \InvalidArgumentException('The element name must be a string.');
$key = $elementName;
// return if element already exists & if overwriting is disabled
// & if multiple elements are not allowed.
if (isset($this->elements[$elementName]) && !$overwrite) {
if (!$allowMultiple)
return $this;
$key .= '-' . $this->cpt();
}
$this->elements[$key]['name'] = $elementName;
$this->elements[$key]['content'] = $content;
$this->elements[$key]['attributes'] = $attributes;
return $this;
}
/**
* Set multiple feed elements from an array.
* Elements which have attributes cannot be added by this method
*
* @access public
* @param array array of elements in 'tagName' => 'tagContent' format.
* @return self
*/
public function addElementArray(array $elementArray)
{
foreach ($elementArray as $elementName => $content) {
$this->addElement($elementName, $content);
}
return $this;
}
/**
* Return the collection of elements in this feed item
*
* @access public
* @return array All elements of this item.
* @throws InvalidOperationException on ATOM feeds if either a content or link element is missing.
* @throws InvalidOperationException on RSS1 feeds if a title or link element is missing.
*/
public function getElements()
{
// ATOM feeds have some specific requirements...
if ($this->version == Feed::ATOM)
{
// Add an 'id' element, if it was not added by calling the setLink method.
// Use the value of the title element as key, since no link element was specified.
if (!array_key_exists('id', $this->elements))
$this->setId(Feed::uuid($this->elements['title']['content'], 'urn:uuid:'));
// Either a 'link' or 'content' element is needed.
if (!array_key_exists('content', $this->elements) && !array_key_exists('link', $this->elements))
throw new InvalidOperationException('ATOM feed entries need a link or a content element. Call the setLink or setContent method.');
}
// ...same with RSS1 feeds.
else if ($this->version == Feed::RSS1)
{
if (!array_key_exists('title', $this->elements))
throw new InvalidOperationException('RSS1 feed entries need a title element. Call the setTitle method.');
if (!array_key_exists('link', $this->elements))
throw new InvalidOperationException('RSS1 feed entries need a link element. Call the setLink method.');
}
return $this->elements;
}
/**
* Return the type of this feed item
*
* @access public
* @return string The feed type, as defined in Feed.php
*/
public function getVersion()
{
return $this->version;
}
// Wrapper functions ------------------------------------------------------
/**
* Set the 'description' element of feed item
*
* @access public
* @param string $description The content of the 'description' or 'summary' element
* @return self
*/
public function setDescription($description)
{
$tag = ($this->version == Feed::ATOM) ? 'summary' : 'description';
return $this->addElement($tag, $description);
}
/**
* Set the 'content' element of the feed item
* For ATOM feeds only
*
* @access public
* @param string $content Content for the item (i.e., the body of a blog post).
* @return self
* @throws InvalidOperationException if this method is called on non-ATOM feeds.
*/
public function setContent($content)
{
if ($this->version != Feed::ATOM)
throw new InvalidOperationException('The content element is supported in ATOM feeds only.');
return $this->addElement('content', $content, array('type' => 'html'));
}
/**
* Set the 'title' element of feed item
*
* @access public
* @param string $title The content of 'title' element
* @return self
*/
public function setTitle($title)
{
return $this->addElement('title', $title);
}
/**
* Set the 'date' element of the feed item.
*
* The value of the date parameter can be either an instance of the
* DateTime class, an integer containing a UNIX timestamp or a string
* which is parseable by PHP's 'strtotime' function.
*
* @access public
* @param DateTime|int|string $date Date which should be used.
* @return self
* @throws \InvalidArgumentException if the given date was not parseable.
*/
public function setDate($date)
{
if (!is_numeric($date)) {
if ($date instanceof DateTime)
$date = $date->getTimestamp();
else {
$date = strtotime($date);
if ($date === FALSE)
throw new \InvalidArgumentException('The given date string was not parseable.');
}
} elseif ($date < 0)
throw new \InvalidArgumentException('The given date is not an UNIX timestamp.');
if ($this->version == Feed::ATOM) {
$tag = 'updated';
$value = date(\DATE_ATOM, $date);
} elseif ($this->version == Feed::RSS2) {
$tag = 'pubDate';
$value = date(\DATE_RSS, $date);
} else {
$tag = 'dc:date';
$value = date("Y-m-d", $date);
}
return $this->addElement($tag, $value);
}
/**
* Set the 'link' element of feed item
*
* @access public
* @param string $link The content of 'link' element
* @return self
*/
public function setLink($link)
{
if ($this->version == Feed::RSS2 || $this->version == Feed::RSS1) {
$this->addElement('link', $link);
} else {
$this->addElement('link','',array('href'=>$link));
$this->setId(Feed::uuid($link,'urn:uuid:'));
}
return $this;
}
/**
* Attach a external media to the feed item.
* Not supported in RSS 1.0 feeds.
*
* See RFC 4288 for syntactical correct MIME types.
*
* Note that you should avoid the use of more than one enclosure in one item,
* since some RSS aggregators don't support it.
*
* @access public
* @param string $url The URL of the media.
* @param integer $length The length of the media.
* @param string $type The MIME type attribute of the media.
* @param boolean $multiple Specifies if multiple enclosures are allowed
* @return self
* @link https://tools.ietf.org/html/rfc4288
* @throws \InvalidArgumentException if the length or type parameter is invalid.
* @throws InvalidOperationException if this method is called on RSS1 feeds.
*/
public function addEnclosure($url, $length, $type, $multiple = TRUE)
{
if ($this->version == Feed::RSS1)
throw new InvalidOperationException('Media attachment is not supported in RSS1 feeds.');
// the length parameter should be set to 0 if it can't be determined
// see http://www.rssboard.org/rss-profile#element-channel-item-enclosure
if (!is_numeric($length) || $length < 0)
throw new \InvalidArgumentException('The length parameter must be an integer and greater or equals to zero.');
// Regex used from RFC 4287, page 41
if (!is_string($type) || preg_match('/.+\/.+/', $type) != 1)
throw new \InvalidArgumentException('type parameter must be a string and a MIME type.');
$attributes = array('length' => $length, 'type' => $type);
if ($this->version == Feed::RSS2) {
$attributes['url'] = $url;
$this->addElement('enclosure', '', $attributes, FALSE, $multiple);
} else {
$attributes['href'] = $url;
$attributes['rel'] = 'enclosure';
$this->addElement('atom:link', '', $attributes, FALSE, $multiple);
}
return $this;
}
/**
* Set the 'author' element of feed item.
* Not supported in RSS 1.0 feeds.
*
* @access public
* @param string $author The author of this item
* @param string|null $email Optional email address of the author
* @param string|null $uri Optional URI related to the author
* @return self
* @throws \InvalidArgumentException if the provided email address is syntactically incorrect.
* @throws InvalidOperationException if this method is called on RSS1 feeds.
*/
public function setAuthor($author, $email = null, $uri = null)
{
if ($this->version == Feed::RSS1)
throw new InvalidOperationException('The author element is not supported in RSS1 feeds.');
// Regex from RFC 4287 page 41
if ($email != null && preg_match('/.+@.+/', $email) != 1)
throw new \InvalidArgumentException('The email address is syntactically incorrect.');
if ($this->version == Feed::RSS2)
{
if ($email != null)
$author = $email . ' (' . $author . ')';
$this->addElement('author', $author);
}
else
{
$elements = array('name' => $author);
if ($email != null)
$elements['email'] = $email;
if ($uri != null)
$elements['uri'] = $uri;
$this->addElement('author', $elements);
}
return $this;
}
/**
* Set the unique identifier of the feed item
*
* On ATOM feeds, the identifier must begin with an valid URI scheme.
*
* @access public
* @param string $id The unique identifier of this item
* @param boolean $permaLink The value of the 'isPermaLink' attribute in RSS 2 feeds.
* @return self
* @throws \InvalidArgumentException if the permaLink parameter is not boolean.
* @throws InvalidOperationException if this method is called on RSS1 feeds.
*/
public function setId($id, $permaLink = false)
{
if ($this->version == Feed::RSS2) {
if (!is_bool($permaLink))
throw new \InvalidArgumentException('The permaLink parameter must be boolean.');
$permaLink = $permaLink ? 'true' : 'false';
$this->addElement('guid', $id, array('isPermaLink' => $permaLink));
} elseif ($this->version == Feed::ATOM) {
// Check if the given ID is an valid URI scheme (see RFC 4287 4.2.6)
// The list of valid schemes was generated from http://www.iana.org/assignments/uri-schemes
// by using only permanent or historical schemes.
$validSchemes = array('aaa', 'aaas', 'about', 'acap', 'acct', 'cap', 'cid', 'coap', 'coaps', 'crid', 'data', 'dav', 'dict', 'dns', 'example', 'fax', 'file', 'filesystem', 'ftp', 'geo', 'go', 'gopher', 'h323', 'http', 'https', 'iax', 'icap', 'im', 'imap', 'info', 'ipp', 'ipps', 'iris', 'iris.beep', 'iris.lwz', 'iris.xpc', 'iris.xpcs', 'jabber', 'ldap', 'mailserver', 'mailto', 'mid', 'modem', 'msrp', 'msrps', 'mtqp', 'mupdate', 'news', 'nfs', 'ni', 'nih', 'nntp', 'opaquelocktoken', 'pack', 'pkcs11', 'pop', 'pres', 'prospero', 'reload', 'rtsp', 'rtsps', 'rtspu', 'service', 'session', 'shttp', 'sieve', 'sip', 'sips', 'sms', 'snews', 'snmp', 'soap.beep', 'soap.beeps', 'stun', 'stuns', 'tag', 'tel', 'telnet', 'tftp', 'thismessage', 'tip', 'tn3270', 'turn', 'turns', 'tv', 'urn', 'vemmi', 'videotex', 'vnc', 'wais', 'ws', 'wss', 'xcon', 'xcon-userid', 'xmlrpc.beep', 'xmlrpc.beeps', 'xmpp', 'z39.50', 'z39.50r', 'z39.50s');
$found = FALSE;
$checkId = strtolower($id);
foreach($validSchemes as $scheme)
if (strrpos($checkId, $scheme . ':', -strlen($checkId)) !== FALSE)
{
$found = TRUE;
break;
}
if (!$found)
throw new \InvalidArgumentException("The ID must begin with an IANA-registered URI scheme.");
$this->addElement('id', $id, NULL, TRUE);
} else
throw new InvalidOperationException('A unique ID is not supported in RSS1 feeds.');
return $this;
}
} // end of class Item

42
module/news/vendor/FeedWriter/README.md vendored Normal file
View File

@ -0,0 +1,42 @@
# Generate **RSS 1.0**, **RSS 2.0** or **ATOM** Formatted Feeds
This package can be used to generate feeds in either **RSS 1.0**, **RSS 2.0** or **ATOM** format.
Applications can create a feed object, several feed item objects, set several types of properties of either feed and feed items, and add items to the feed.
Once a feed is fully composed with its items, the feed class can generate the necessary XML structure to describe the feed in **RSS** or **ATOM** format. This structure can be directly sent to the browser, or just returned as string.
## Requirements
- PHP 5.3 or higher
If you don't have **PHP 5.3** available on your system there is a version supporting **PHP 5.0** and above. See the `legacy-php-5.0` branch.
## Documentation
The documentation can be found in the `gh-pages` branch, or on [GitHub Pages](https://mibe.github.io/FeedWriter/).
See the `/examples` directory for usage examples.
See the `CHANGELOG.md` file for changes between the different versions.
## Authors
In chronological order:
- [Anis uddin Ahmad](https://github.com/ajaxray)
- [Michael Bemmerl](https://github.com/mibe)
- Phil Freo
- Paul Ferrett
- Brennen Bearnes
- Michael Robinson
- Baptiste Fontaine
- Kristián Valentín
- Brandtley McMinn
- Julian Bogdani
- Cedric Gampert
- Yamek
- Thielj
- Pavel Khakhlou
- Daniel
- Tino Goratsch

37
module/news/vendor/FeedWriter/RSS1.php vendored Normal file
View File

@ -0,0 +1,37 @@
<?php
namespace FeedWriter;
/*
* Copyright (C) 2012 Michael Bemmerl <mail@mx-server.de>
*
* This file is part of the "Universal Feed Writer" project.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/**
* Wrapper for creating RSS1 feeds
*
* @package UniversalFeedWriter
*/
class RSS1 extends Feed
{
/**
* {@inheritdoc}
*/
public function __construct()
{
parent::__construct(Feed::RSS1);
}
}

37
module/news/vendor/FeedWriter/RSS2.php vendored Normal file
View File

@ -0,0 +1,37 @@
<?php
namespace FeedWriter;
/*
* Copyright (C) 2012 Michael Bemmerl <mail@mx-server.de>
*
* This file is part of the "Universal Feed Writer" project.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/**
* Wrapper for creating RSS2 feeds
*
* @package UniversalFeedWriter
*/
class RSS2 extends Feed
{
/**
* {@inheritdoc}
*/
public function __construct()
{
parent::__construct(Feed::RSS2);
}
}

View File

@ -1,26 +1,52 @@
<div class="row"> <?php echo template::formOpen('newsConfig'); ?>
<div class="col2"> <div class="row">
<?php echo template::button('newsConfigBack', [ <div class="col2">
'class' => 'buttonGrey', <?php echo template::button('newsConfigBack', [
'href' => helper::baseUrl() . 'page/edit/' . $this->getUrl(0), 'class' => 'buttonGrey',
'ico' => 'left', 'href' => helper::baseUrl() . 'page/edit/' . $this->getUrl(0),'posts',
'value' => 'Retour' 'ico' => 'left',
]); ?> 'value' => 'Retour'
]); ?>
</div>
<div class="col2 offset6">
<?php echo template::button('newsConfigAdd', [
'href' => helper::baseUrl() . $this->getUrl(0) . '/add',
'ico' => 'plus',
'value' => 'News'
]); ?>
</div>
<div class="col2">
<?php echo template::submit('newsConfigSubmit'); ?>
</div>
</div> </div>
<div class="col2 offset8"> <div class="row">
<?php echo template::button('newsConfigAdd', [ <div class="col12">
'href' => helper::baseUrl() . $this->getUrl(0) . '/add', <div class="block">
'ico' => 'plus', <h4>Paramètres du module</h4>
'value' => 'News' <div class="row">
]); ?> <div class="col6">
</div> <?php echo template::checkbox('newsConfigShowFeeds', true, 'Lien du flux RSS', [
</div> 'checked' => $this->getData(['module', $this->getUrl(0), 'config', 'feeds']),
<?php if($module::$news): ?> 'help' => 'Flux limité aux articles de la première page.'
<?php echo template::table([4, 4, 2, 1, 1], $module::$news, ['Titre', 'Date de publication', 'État', '', '']); ?> ]); ?>
<?php echo $module::$pages; ?> </div>
<?php else: ?> <div class="col6">
<?php echo template::speech('Aucune news.'); ?> <?php echo template::text('newsConfigFeedslabel', [
<?php endif; ?> 'label' => 'Texte de l\'étiquette',
'value' => $this->getData(['module', $this->getUrl(0), 'config', 'feedsLabel'])
]); ?>
</div>
</div>
</div>
</div>
</div>
<?php if($module::$news): ?>
<?php echo template::table([4, 4, 2, 1, 1], $module::$news, ['Titre', 'Date de publication', 'État', '', '']); ?>
<?php echo $module::$pages; ?>
<?php else: ?>
<?php echo template::speech('Aucune news.'); ?>
<?php endif; ?>
<?php echo template::formClose(); ?>
<div class="moduleVersion">Version <div class="moduleVersion">Version
<?php echo $module::NEWS_VERSION; ?> <?php echo $module::NEWS_VERSION; ?>
</div> </div>

View File

@ -29,14 +29,14 @@
<h4>Informations générales</h4> <h4>Informations générales</h4>
<?php echo template::text('newsEditTitle', [ <?php echo template::text('newsEditTitle', [
'label' => 'Titre', 'label' => 'Titre',
'value' => $this->getData(['module', $this->getUrl(0), $this->getUrl(2), 'title']) 'value' => $this->getData(['module', $this->getUrl(0),'posts', $this->getUrl(2), 'title'])
]); ?> ]); ?>
</div> </div>
</div> </div>
</div> </div>
<?php echo template::textarea('newsEditContent', [ <?php echo template::textarea('newsEditContent', [
'class' => 'editorWysiwyg', 'class' => 'editorWysiwyg',
'value' => $this->getData(['module', $this->getUrl(0), $this->getUrl(2), 'content']) 'value' => $this->getData(['module', $this->getUrl(0),'posts', $this->getUrl(2), 'content'])
]); ?> ]); ?>
<div class="row"> <div class="row">
<div class="col12"> <div class="col12">
@ -53,7 +53,7 @@
<?php echo template::date('newsEditPublishedOn', [ <?php echo template::date('newsEditPublishedOn', [
'help' => 'La news est consultable à partir du moment ou la date de publication est passée.', 'help' => 'La news est consultable à partir du moment ou la date de publication est passée.',
'label' => 'Date de publication', 'label' => 'Date de publication',
'value' => $this->getData(['module', $this->getUrl(0), $this->getUrl(2), 'publishedOn']) 'value' => $this->getData(['module', $this->getUrl(0),'posts', $this->getUrl(2), 'publishedOn'])
]); ?> ]); ?>
</div> </div>
</div> </div>

View File

@ -1 +1,25 @@
/* Volontairement vide */ /**
* 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-2020, Frédéric Tempez
* @license GNU General Public License, version 3
* @link http://zwiicms.fr/
*/
/*
* Flux RSS
*/
#rssFeed {
text-align: right;
float: right;
}
#rssFeed p {
display: inline;
vertical-align: top;
}

View File

@ -21,6 +21,16 @@
</div> </div>
</div> </div>
<?php echo $module::$pages; ?> <?php echo $module::$pages; ?>
<?php if ($this->getData(['module',$this->getUrl(0), 'config', 'feeds'])): ?>
<div id="rssFeed">
<a type="application/rss+xml" href="<?php echo helper::baseUrl() . $this->getUrl(0) . '/rss'; ?> ">
<img src='module/news/ressource/feed-icon-16.gif' />
<?php
echo '<p>' . $this->getData(['module',$this->getUrl(0), 'config', 'feedsLabel']) . '</p>' ;
?>
</a>
</div>
<?php endif; ?>
<?php else: ?> <?php else: ?>
<?php echo template::speech('Aucune news.'); ?> <?php echo template::speech('Aucune news.'); ?>
<?php endif; ?> <?php endif; ?>

View File

@ -0,0 +1 @@
<!-- Volontairement vide -->