Merge 10307
This commit is contained in:
parent
a9ee02d1bc
commit
9a26cf73d6
@ -425,6 +425,9 @@ class common {
|
|||||||
case 7:
|
case 7:
|
||||||
$tempData = $db->get($keys[0].'.'.$keys[1].'.'.$keys[2].'.'.$keys[3].'.'.$keys[4].'.'.$keys[5].'.'.$keys[6]);
|
$tempData = $db->get($keys[0].'.'.$keys[1].'.'.$keys[2].'.'.$keys[3].'.'.$keys[4].'.'.$keys[5].'.'.$keys[6]);
|
||||||
break;
|
break;
|
||||||
|
case 8:
|
||||||
|
$tempData = $db->get($keys[0].'.'.$keys[1].'.'.$keys[2].'.'.$keys[3].'.'.$keys[4].'.'.$keys[5].'.'.$keys[6].'.'.$keys[7]);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
return $tempData;
|
return $tempData;
|
||||||
}
|
}
|
||||||
@ -974,6 +977,10 @@ class common {
|
|||||||
$db->set($keys[0].'.'.$keys[1].'.'.$keys[2].'.'.$keys[3].'.'.$keys[4].'.'.$keys[5],$keys[6]);
|
$db->set($keys[0].'.'.$keys[1].'.'.$keys[2].'.'.$keys[3].'.'.$keys[4].'.'.$keys[5],$keys[6]);
|
||||||
$db->save();
|
$db->save();
|
||||||
break;
|
break;
|
||||||
|
case 8:
|
||||||
|
$db->set($keys[0].'.'.$keys[1].'.'.$keys[2].'.'.$keys[3].'.'.$keys[4].'.'.$keys[5].'.'.$keys[6],$keys[7] );
|
||||||
|
$db->save();
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -1480,11 +1487,16 @@ class common {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Parcourir pageList et rechercher les modules de blog
|
// Parcourir pageList et rechercher les modules de blog
|
||||||
|
|
||||||
foreach ($pageList as $parentKey => $parent) {
|
foreach ($pageList as $parentKey => $parent) {
|
||||||
//La page a une galerie
|
//La page est un blog
|
||||||
if ($this->getData(['page',$parent,'moduleId']) === 'blog' ) {
|
if ($this->getData(['page',$parent,'moduleId']) === 'blog' ) {
|
||||||
$articleIds = array_keys(helper::arrayCollumn($this->getData(['module',$parent], 'posts'), 'publishedOn', 'SORT_DESC'));
|
//echo "<pre>".$parent;
|
||||||
|
$articleIds = array_keys(helper::arrayCollumn($this->getData(['module', $parent, 'posts']), 'publishedOn', 'SORT_DESC'));
|
||||||
|
//var_dump($articleIds);
|
||||||
foreach ($articleIds as $key => $article) {
|
foreach ($articleIds as $key => $article) {
|
||||||
|
//echo $article;
|
||||||
|
//echo "<p>";
|
||||||
// Droits les deux groupes
|
// Droits les deux groupes
|
||||||
$this->setData(['module', $parent, 'posts', $article,'editConsent', 3]);
|
$this->setData(['module', $parent, 'posts', $article,'editConsent', 3]);
|
||||||
// Limite de taille 500
|
// Limite de taille 500
|
||||||
@ -1496,6 +1508,7 @@ class common {
|
|||||||
// groupe de notification
|
// groupe de notification
|
||||||
$this->setData(['module', $parent, 'posts', $article,'commentGroupNotification', 3 ]);
|
$this->setData(['module', $parent, 'posts', $article,'commentGroupNotification', 3 ]);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Traitement des commentaires
|
// Traitement des commentaires
|
||||||
if ( is_array($this->getData(['module', $parent, 'posts', $article,'comment'])) ) {
|
if ( is_array($this->getData(['module', $parent, 'posts', $article,'comment'])) ) {
|
||||||
foreach($this->getData(['module', $parent, 'posts', $article,'comment']) as $commentId => $comment) {
|
foreach($this->getData(['module', $parent, 'posts', $article,'comment']) as $commentId => $comment) {
|
||||||
@ -2092,7 +2105,7 @@ class core extends common {
|
|||||||
|
|
||||||
// Librairie googtrans ajouté dynamiquement
|
// Librairie googtrans ajouté dynamiquement
|
||||||
if ( substr($_SERVER['HTTP_ACCEPT_LANGUAGE'], 0, 2) !== 'fr'
|
if ( substr($_SERVER['HTTP_ACCEPT_LANGUAGE'], 0, 2) !== 'fr'
|
||||||
AND $this->getData(['translate','active']) === true
|
AND $this->getData(['translate','active']) === true
|
||||||
AND $this->getUser('password') !== $this->getInput('ZWII_USER_PASSWORD')) {
|
AND $this->getUser('password') !== $this->getInput('ZWII_USER_PASSWORD')) {
|
||||||
$this->addOutput([
|
$this->addOutput([
|
||||||
'vendor' => array_merge($this->output['vendor'], ['i18n'])
|
'vendor' => array_merge($this->output['vendor'], ['i18n'])
|
||||||
|
@ -96,9 +96,9 @@ class install extends common {
|
|||||||
if ($this->getInput('installDefaultData',helper::FILTER_BOOLEAN) === FALSE) {
|
if ($this->getInput('installDefaultData',helper::FILTER_BOOLEAN) === FALSE) {
|
||||||
$this->initData('page','fr',true);
|
$this->initData('page','fr',true);
|
||||||
$this->initData('module','fr',true);
|
$this->initData('module','fr',true);
|
||||||
$this->setData(['module', 'blog', 'mon-premier-article', 'userId', $userId]);
|
$this->setData(['module', 'blog', 'posts', 'mon-premier-article', 'userId', $userId]);
|
||||||
$this->setData(['module', 'blog', 'mon-deuxieme-article', 'userId', $userId]);
|
$this->setData(['module', 'blog', 'posts', 'mon-deuxieme-article', 'userId', $userId]);
|
||||||
$this->setData(['module', 'blog', 'mon-troisieme-article', 'userId', $userId]);
|
$this->setData(['module', 'blog', 'posts', 'mon-troisieme-article', 'userId', $userId]);
|
||||||
}
|
}
|
||||||
// Stocker le dossier d'installation
|
// Stocker le dossier d'installation
|
||||||
$this->setData(['core', 'baseUrl', helper::baseUrl(false,false) ]);
|
$this->setData(['core', 'baseUrl', helper::baseUrl(false,false) ]);
|
||||||
|
@ -89,6 +89,54 @@ class blog extends common {
|
|||||||
|
|
||||||
const BLOG_VERSION = '3.2';
|
const BLOG_VERSION = '3.2';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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
|
||||||
|
$articleIdsPublishedOns = helper::arrayCollumn($this->getData(['module', $this->getUrl(0), 'posts']), 'publishedOn', 'SORT_DESC');
|
||||||
|
$articleIdsStates = helper::arrayCollumn($this->getData(['module', $this->getUrl(0),'posts']), 'state', 'SORT_DESC');
|
||||||
|
foreach($articleIdsPublishedOns as $articleId => $articlePublishedOn) {
|
||||||
|
if($articlePublishedOn <= time() AND $articleIdsStates[$articleId]) {
|
||||||
|
// Miniature
|
||||||
|
$parts = explode('/',$this->getData(['module', $this->getUrl(0), 'posts', $articleId, 'picture']));
|
||||||
|
$thumb = str_replace ($parts[(count($parts)-1)],'mini_' . $parts[(count($parts)-1)], $this->getData(['module', $this->getUrl(0), 'posts', $articleId, 'picture']));
|
||||||
|
// Créer les articles du flux
|
||||||
|
$newsArticle = $feeds->createNewItem();
|
||||||
|
$newsArticle->addElementArray([
|
||||||
|
'title' => strip_tags($this->getData(['module', $this->getUrl(0), 'posts', $articleId, 'title']) ),
|
||||||
|
'link' => helper::baseUrl() .$this->getUrl(0) . '/' . $articleId,
|
||||||
|
'description' => html_entity_decode(strip_tags($this->getData(['module', $this->getUrl(0), 'posts', $articleId, 'content']))),
|
||||||
|
'addEnclosure' => helper::baseUrl() . self::FILE_DIR . $thumb
|
||||||
|
]);
|
||||||
|
$feeds->addItem($newsArticle);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Valeurs en sortie
|
||||||
|
$this->addOutput([
|
||||||
|
'display' => self::DISPLAY_RSS,
|
||||||
|
'content' => $feeds->generateFeed(),
|
||||||
|
'view' => 'rss'
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Édition
|
* Édition
|
||||||
*/
|
*/
|
||||||
@ -158,7 +206,7 @@ class blog extends common {
|
|||||||
* Liste des commentaires
|
* Liste des commentaires
|
||||||
*/
|
*/
|
||||||
public function comment() {
|
public function comment() {
|
||||||
$comments = $this->getData(['module', $this->getUrl(0), 'posts', $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'] ,
|
||||||
@ -319,7 +367,7 @@ class blog extends common {
|
|||||||
]);
|
]);
|
||||||
} else {
|
} else {
|
||||||
// Ids des articles par ordre de publication
|
// Ids des articles par ordre de publication
|
||||||
$articleIds = array_keys(helper::arrayCollumn($this->getData(['module', $this->getUrl(0)]), 'publishedOn', 'SORT_DESC'));
|
$articleIds = array_keys(helper::arrayCollumn($this->getData(['module', $this->getUrl(0), 'posts']), 'publishedOn', 'SORT_DESC'));
|
||||||
// Gestion des droits d'accès
|
// Gestion des droits d'accès
|
||||||
$filterData=[];
|
$filterData=[];
|
||||||
foreach ($articleIds as $key => $value) {
|
foreach ($articleIds as $key => $value) {
|
||||||
@ -333,7 +381,7 @@ class blog extends common {
|
|||||||
OR (
|
OR (
|
||||||
// Groupe
|
// Groupe
|
||||||
$this->getData(['module', $this->getUrl(0), 'posts', $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), 'posts', $value,'editConsent'])
|
AND $this->getUser('group') >= $this->getData(['module',$this->getUrl(0), 'posts', $value,'editConsent'])
|
||||||
)
|
)
|
||||||
OR (
|
OR (
|
||||||
// Tout le monde
|
// Tout le monde
|
||||||
@ -351,28 +399,28 @@ class blog extends common {
|
|||||||
// 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++) {
|
||||||
// Nombre de commentaires à approuver et approuvés
|
// Nombre de commentaires à approuver et approuvés
|
||||||
$approvals = helper::arrayCollumn($this->getData(['module', $this->getUrl(0), 'posts', $articleIds[$i], 'comment' ]),'approval', 'SORT_DESC');
|
$approvals = helper::arrayCollumn($this->getData(['module', $this->getUrl(0), 'posts', $articleIds[$i], 'comment' ]),'approval', 'SORT_DESC');
|
||||||
if ( is_array($approvals) ) {
|
if ( is_array($approvals) ) {
|
||||||
$a = array_values($approvals);
|
$a = array_values($approvals);
|
||||||
$toApprove = count(array_keys($a,false));
|
$toApprove = count(array_keys($a,false));
|
||||||
$approved = count(array_keys($a,true));
|
$approved = count(array_keys($a,true));
|
||||||
} else {
|
} else {
|
||||||
$toApprove = 0;
|
$toApprove = 0;
|
||||||
$approved = count($this->getData(['module', $this->getUrl(0), 'posts', $articleIds[$i],'comment']));
|
$approved = count($this->getData(['module', $this->getUrl(0), 'posts', $articleIds[$i],'comment']));
|
||||||
}
|
}
|
||||||
// Met en forme le tableau
|
// 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)
|
$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']))
|
? 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'])));
|
: 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)
|
$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']))
|
? 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'])));
|
: utf8_encode(strftime('%H:%M', $this->getData(['module', $this->getUrl(0), 'posts', $articleIds[$i], 'publishedOn'])));
|
||||||
self::$articles[] = [
|
self::$articles[] = [
|
||||||
'<a href="' . helper::baseurl() . $this->getUrl(0) . '/' . $articleIds[$i] . '" target="_blank" >' .
|
'<a href="' . helper::baseurl() . $this->getUrl(0) . '/' . $articleIds[$i] . '" target="_blank" >' .
|
||||||
$this->getData(['module', $this->getUrl(0), 'posts', $articleIds[$i], 'title']) .
|
$this->getData(['module', $this->getUrl(0), 'posts', $articleIds[$i], 'title']) .
|
||||||
'</a>',
|
'</a>',
|
||||||
$date .' à '. $heure,
|
$date .' à '. $heure,
|
||||||
self::$states[$this->getData(['module', $this->getUrl(0), 'posts', $articleIds[$i], 'state'])],
|
self::$states[$this->getData(['module', $this->getUrl(0), 'posts', $articleIds[$i], 'state'])],
|
||||||
// Bouton pour afficher les commentaires de l'article
|
// Bouton pour afficher les commentaires de l'article
|
||||||
template::button('blogConfigComment' . $articleIds[$i], [
|
template::button('blogConfigComment' . $articleIds[$i], [
|
||||||
'class' => ($toApprove || $approved ) > 0 ? 'buttonBlue' : 'buttonGrey' ,
|
'class' => ($toApprove || $approved ) > 0 ? 'buttonBlue' : 'buttonGrey' ,
|
||||||
@ -390,6 +438,11 @@ class blog extends common {
|
|||||||
])
|
])
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
// Valeurs en sortie
|
||||||
|
$this->addOutput([
|
||||||
|
'title' => 'Configuration du module',
|
||||||
|
'view' => 'config'
|
||||||
|
]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -552,7 +605,7 @@ class blog extends common {
|
|||||||
'content' => $content,
|
'content' => $content,
|
||||||
'createdOn' => time(),
|
'createdOn' => time(),
|
||||||
'userId' => $this->getInput('blogArticleUserId'),
|
'userId' => $this->getInput('blogArticleUserId'),
|
||||||
'approval' => !$this->getData(['module', $this->getUrl(0), 'posts', $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
|
||||||
@ -592,7 +645,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), 'posts', $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]);
|
||||||
@ -666,8 +719,8 @@ class blog extends common {
|
|||||||
self::$commentsSignature[$commentIds[$i]] = $this->getData(['module', $this->getUrl(0), 'posts', $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), 'posts', $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), 'posts', $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
|
||||||
|
Loading…
Reference in New Issue
Block a user