forked from ZwiiCMS-Team/ZwiiCMS
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) {
|
||||||
|
@ -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
|
||||||
*/
|
*/
|
||||||
@ -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) {
|
||||||
@ -390,6 +438,11 @@ class blog extends common {
|
|||||||
])
|
])
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
// Valeurs en sortie
|
||||||
|
$this->addOutput([
|
||||||
|
'title' => 'Configuration du module',
|
||||||
|
'view' => 'config'
|
||||||
|
]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user