forked from ZwiiCMS-Team/ZwiiCMS
Modules de v11
This commit is contained in:
parent
fd8a15812b
commit
c2c67b55ff
@ -15,7 +15,7 @@
|
||||
|
||||
class blog extends common {
|
||||
|
||||
const VERSION = '4.5';
|
||||
const VERSION = '5.0';
|
||||
const REALNAME = 'Blog';
|
||||
const DELETE = true;
|
||||
const UPDATE = '0.0';
|
||||
@ -75,6 +75,15 @@ class blog extends common {
|
||||
'right' => 'À droite ',
|
||||
];
|
||||
|
||||
// Nombre d'objets par page
|
||||
public static $ItemsList = [
|
||||
4 => '4 articles',
|
||||
8 => '8 articles',
|
||||
12 => '12 articles',
|
||||
16 => '16 articles',
|
||||
22 => '22 articles'
|
||||
];
|
||||
|
||||
//Paramètre longueur maximale des commentaires en nb de caractères
|
||||
public static $commentLength = [
|
||||
'500' => '500',
|
||||
@ -94,7 +103,23 @@ class blog extends common {
|
||||
|
||||
public static $users = [];
|
||||
|
||||
/**
|
||||
|
||||
|
||||
/**
|
||||
* Mise à jour du module
|
||||
* Appelée par les fonctions index et config
|
||||
*/
|
||||
private function update() {
|
||||
// Version 5.0
|
||||
if (version_compare($this->getData(['module', $this->getUrl(0), 'config', 'versionData']), '5.0', '<') ) {
|
||||
$this->setData(['module', $this->getUrl(0), 'config', 'itemsperPage', 6]);
|
||||
$this->setData(['module', $this->getUrl(0), 'config', 'versionData','5.0']);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Flux RSS
|
||||
*/
|
||||
public function rss() {
|
||||
@ -192,7 +217,7 @@ class blog extends common {
|
||||
'commentApproved' => $this->getInput('blogAddCommentApproved', helper::FILTER_BOOLEAN),
|
||||
'commentClose' => $this->getInput('blogAddCommentClose', helper::FILTER_BOOLEAN),
|
||||
'commentNotification' => $this->getInput('blogAddCommentNotification', helper::FILTER_BOOLEAN),
|
||||
'commentGroupNotification' => $this->getInput('blogAddCommentGroupNotification', helper::FILTER_INT)
|
||||
'commentGroupNotification' => $this->getInput('blogAddCommentGroupNotification', helper::FILTER_INT),
|
||||
]
|
||||
]);
|
||||
// Valeurs en sortie
|
||||
@ -234,7 +259,7 @@ class blog extends common {
|
||||
// Ids des commentaires par ordre de création
|
||||
$commentIds = array_keys(helper::arrayCollumn($comments, 'createdOn', 'SORT_DESC'));
|
||||
// Pagination
|
||||
$pagination = helper::pagination($commentIds, $this->getUrl(),$this->getData(['config','itemsperPage']));
|
||||
$pagination = helper::pagination($commentIds, $this->getUrl(),$this->getData(['module', $this->getUrl(0), 'config', 'itemsperPage']) );
|
||||
// Liste des pages
|
||||
self::$pages = $pagination['pages'];
|
||||
// Commentaires en fonction de la pagination
|
||||
@ -371,11 +396,15 @@ class blog extends common {
|
||||
* Configuration
|
||||
*/
|
||||
public function config() {
|
||||
// Mise à jour des données de module
|
||||
$this->update();
|
||||
// Soumission du formulaire
|
||||
if($this->isPost()) {
|
||||
$this->setData(['module', $this->getUrl(0), 'config',[
|
||||
'feeds' => $this->getInput('blogConfigShowFeeds',helper::FILTER_BOOLEAN),
|
||||
'feedsLabel' => $this->getInput('blogConfigFeedslabel',helper::FILTER_STRING_SHORT)
|
||||
'feedsLabel' => $this->getInput('blogConfigFeedslabel',helper::FILTER_STRING_SHORT),
|
||||
'itemsperPage' => $this->getInput('blogConfigItemsperPage', helper::FILTER_INT,true),
|
||||
'versionData' => $this->getData(['module', $this->getUrl(0), 'config', 'versionData'])
|
||||
]]);
|
||||
// Valeurs en sortie
|
||||
$this->addOutput([
|
||||
@ -411,7 +440,7 @@ class blog extends common {
|
||||
}
|
||||
$articleIds = $filterData;
|
||||
// Pagination
|
||||
$pagination = helper::pagination($articleIds, $this->getUrl(),$this->getData(['config','itemsperPage']));
|
||||
$pagination = helper::pagination($articleIds, $this->getUrl(),$this->getData(['module', $this->getUrl(0),'config', 'itemsperPage']));
|
||||
// Liste des pages
|
||||
self::$pages = $pagination['pages'];
|
||||
// Articles en fonction de la pagination
|
||||
@ -590,6 +619,8 @@ class blog extends common {
|
||||
* Accueil (deux affichages en un pour éviter une url à rallonge)
|
||||
*/
|
||||
public function index() {
|
||||
// Mise à jour des données de module
|
||||
$this->update();
|
||||
// Affichage d'un article
|
||||
if(
|
||||
$this->getUrl(1)
|
||||
@ -678,7 +709,7 @@ class blog extends common {
|
||||
}
|
||||
$commentIds = array_keys(helper::arrayCollumn($commentsApproved, 'createdOn', 'SORT_DESC'));
|
||||
// Pagination
|
||||
$pagination = helper::pagination($commentIds, $this->getUrl(),$this->getData(['config','itemsperPage']),'#comment');
|
||||
$pagination = helper::pagination($commentIds, $this->getUrl(), $this->getData(['module', $this->getUrl(0),'config', 'itemsperPage']),'#comment');
|
||||
// Liste des pages
|
||||
self::$pages = $pagination['pages'];
|
||||
// Signature de l'article
|
||||
@ -725,7 +756,7 @@ class blog extends common {
|
||||
}
|
||||
}
|
||||
// Pagination
|
||||
$pagination = helper::pagination($articleIds, $this->getUrl(),$this->getData(['config','itemsperPage']));
|
||||
$pagination = helper::pagination($articleIds, $this->getUrl(), $this->getData(['module', $this->getUrl(0),'config', 'itemsperPage']));
|
||||
// Liste des pages
|
||||
self::$pages = $pagination['pages'];
|
||||
// Articles en fonction de la pagination
|
||||
|
@ -36,6 +36,14 @@
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col6 offset6">
|
||||
<?php echo template::select('blogConfigItemsperPage', $module::$ItemsList, [
|
||||
'label' => 'Articles par page',
|
||||
'selected' => $this->getData(['module', $this->getUrl(0),'config', 'itemsperPage'])
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
978
module/download/download.php
Normal file
978
module/download/download.php
Normal file
@ -0,0 +1,978 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* 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
|
||||
* @license GNU General Public License, version 3
|
||||
* @link http://zwiicms.fr/
|
||||
*/
|
||||
|
||||
class download extends common {
|
||||
|
||||
const VERSION = '1.2';
|
||||
const REALNAME = 'Téléchargement';
|
||||
const DELETE = true;
|
||||
const UPDATE = '0.0';
|
||||
const DATADIRECTORY = []; // Contenu localisé inclus par défaut (page.json et module.json)
|
||||
|
||||
// Constantes du module
|
||||
const EDIT_OWNER = 'owner';
|
||||
const EDIT_GROUP = 'group';
|
||||
const EDIT_ALL = 'all';
|
||||
|
||||
public static $actions = [
|
||||
'add' => self::GROUP_MODERATOR,
|
||||
'comment' => self::GROUP_MODERATOR,
|
||||
'commentApprove' => self::GROUP_MODERATOR,
|
||||
'commentDelete' => self::GROUP_MODERATOR,
|
||||
'commentDeleteAll' => self::GROUP_MODERATOR,
|
||||
'config' => self::GROUP_MODERATOR,
|
||||
'delete' => self::GROUP_MODERATOR,
|
||||
'edit' => self::GROUP_MODERATOR,
|
||||
'stats' => self::GROUP_MODERATOR,
|
||||
'statsDeleteAll' => self::GROUP_MODERATOR,
|
||||
'index' => self::GROUP_VISITOR,
|
||||
'rss' => self::GROUP_VISITOR,
|
||||
'downloadFile' => self::GROUP_VISITOR,
|
||||
'list' =>self::GROUP_VISITOR
|
||||
];
|
||||
|
||||
public static $items = [];
|
||||
|
||||
// Signature de l'item
|
||||
public static $itemSignature = '';
|
||||
|
||||
// Signature du commentaire
|
||||
public static $editCommentSignature = '';
|
||||
|
||||
public static $comments = [];
|
||||
|
||||
public static $nbCommentsApproved = 0;
|
||||
|
||||
public static $commentsDelete;
|
||||
|
||||
// Signatures des commentaires déjà saisis
|
||||
public static $commentsSignature = [];
|
||||
|
||||
public static $pages;
|
||||
|
||||
// Nombre de téléchargements
|
||||
public static $statSum = 0;
|
||||
|
||||
public static $states = [
|
||||
false => 'Brouillon',
|
||||
true => 'Publié'
|
||||
];
|
||||
|
||||
public static $pictureSizes = [
|
||||
'20' => 'Très petite',
|
||||
'30' => 'Petite',
|
||||
'40' => 'Grande',
|
||||
'50' => 'Très Grande',
|
||||
'100' => 'Pleine largeur',
|
||||
];
|
||||
|
||||
public static $picturePositions = [
|
||||
'left' => 'À gauche',
|
||||
'right' => 'À droite ',
|
||||
];
|
||||
|
||||
//Paramètre longueur maximale des commentaires en nb de caractères
|
||||
public static $commentLength = [
|
||||
'500' => '500',
|
||||
'1000' => '1000',
|
||||
'2000' => '2000',
|
||||
'5000' => '5000',
|
||||
'10000' => '10000'
|
||||
];
|
||||
|
||||
// Nombre d'objets par page
|
||||
public static $ItemsList = [
|
||||
4 => '4 articles',
|
||||
8 => '8 articles',
|
||||
12 => '12 articles',
|
||||
16 => '16 articles',
|
||||
22 => '22 articles'
|
||||
];
|
||||
|
||||
// Permissions d'un item
|
||||
public static $itemConsent = [
|
||||
self::EDIT_ALL => 'Tous les groupes',
|
||||
self::EDIT_GROUP => 'Groupe du propriétaire',
|
||||
self::EDIT_OWNER => 'Propriétaire'
|
||||
];
|
||||
|
||||
|
||||
public static $itemLicense = [
|
||||
'none'=> 'Non définie',
|
||||
'cc' => 'Licence libre Creative Common, partage autorisé',
|
||||
'gnu' => 'Licence libre GNU, partage autorisé',
|
||||
'mit' => 'Licence libre MIT, partage autorisé',
|
||||
'owner' => 'Licence Propriétaire'
|
||||
];
|
||||
|
||||
public static $users = [];
|
||||
|
||||
/**
|
||||
* Mise à jour du module
|
||||
* Appelée par les fonctions index et config
|
||||
*/
|
||||
private function update() {
|
||||
// Version 5.0
|
||||
if (version_compare($this->getData(['module', $this->getUrl(0), 'config', 'versionData']), '1.1', '<') ) {
|
||||
$this->setData(['module', $this->getUrl(0), 'config', 'itemsperPage', 6]);
|
||||
$this->setData(['module', $this->getUrl(0), 'config', 'versionData','1.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), 'title']));
|
||||
$feeds->setLink(helper::baseUrl() . $this->getUrl(0));
|
||||
$feeds->setDescription($this->getData (['page', $this->getUrl(0), 'metaDescription']));
|
||||
$feeds->setChannelElement('language', 'fr-FR');
|
||||
$feeds->setDate(date('r',time()));
|
||||
$feeds->addGenerator();
|
||||
// Corps des items
|
||||
$itemIdsPublishedOns = helper::arrayCollumn($this->getData(['module', $this->getUrl(0), 'items']), 'publishedOn', 'SORT_DESC');
|
||||
$itemIdsStates = helper::arrayCollumn($this->getData(['module', $this->getUrl(0),'items']), 'state', 'SORT_DESC');
|
||||
foreach($itemIdsPublishedOns as $itemId => $itemPublishedOn) {
|
||||
if($itemPublishedOn <= time() AND $itemIdsStates[$itemId]) {
|
||||
// Miniature
|
||||
$parts = explode('/',$this->getData(['module', $this->getUrl(0), 'items', $itemId, 'picture']));
|
||||
$thumb = str_replace ($parts[(count($parts)-1)],'mini_' . $parts[(count($parts)-1)], $this->getData(['module', $this->getUrl(0), 'items', $itemId, 'picture']));
|
||||
// Créer les items du flux
|
||||
$newsitem = $feeds->createNewItem();
|
||||
// Signature de l'item
|
||||
$author = $this->signature($this->getData(['module', $this->getUrl(0), 'items', $itemId, 'userId']));
|
||||
$newsitem->addElementArray([
|
||||
'title' => $this->getData(['module', $this->getUrl(0), 'items', $itemId, 'title']),
|
||||
'link' => helper::baseUrl() .$this->getUrl(0) . '/' . $itemId,
|
||||
'description' => '<img src="' . helper::baseUrl() . self::FILE_DIR . $thumb
|
||||
. '" alt="' . $this->getData(['module', $this->getUrl(0), 'items', $itemId, 'title'])
|
||||
. '" title="' . $this->getData(['module', $this->getUrl(0), 'items', $itemId, 'title'])
|
||||
. '" />' .
|
||||
$this->getData(['module', $this->getUrl(0), 'items', $itemId, 'content']),
|
||||
]);
|
||||
$newsitem->setAuthor($author,'no@mail.com');
|
||||
$newsitem->setId(helper::baseUrl() .$this->getUrl(0) . '/' . $itemId);
|
||||
$newsitem->setDate(date('r', $this->getData(['module', $this->getUrl(0), 'items', $itemId, 'publishedOn'])));
|
||||
$imageData = getimagesize(helper::baseUrl(false) . self::FILE_DIR . 'thumb/' . $thumb);
|
||||
$newsitem->addEnclosure( helper::baseUrl(false) . self::FILE_DIR . 'thumb/' . $thumb,
|
||||
$imageData[0] * $imageData[1],
|
||||
$imageData['mime']
|
||||
);
|
||||
$feeds->addItem($newsitem);
|
||||
}
|
||||
}
|
||||
|
||||
// Valeurs en sortie
|
||||
$this->addOutput([
|
||||
'display' => self::DISPLAY_RSS,
|
||||
'content' => $feeds->generateFeed(),
|
||||
'view' => 'rss'
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Édition
|
||||
*/
|
||||
public function add() {
|
||||
// Soumission du formulaire
|
||||
if($this->isPost()) {
|
||||
// Modification de l'userId
|
||||
if($this->getUser('group') === self::GROUP_ADMIN){
|
||||
$newuserid = $this->getInput('downloadAddUserId', helper::FILTER_STRING_SHORT, true);
|
||||
}
|
||||
else{
|
||||
$newuserid = $this->getUser('id');
|
||||
}
|
||||
// Incrémente l'id de l'item
|
||||
$itemId = helper::increment($this->getInput('downloadAddTitle', helper::FILTER_ID), $this->getData(['page']));
|
||||
$itemId = helper::increment($itemId, (array) $this->getData(['module', $this->getUrl(0)]));
|
||||
$itemId = helper::increment($itemId, array_keys(self::$actions));
|
||||
// Crée l'item
|
||||
$this->setData(['module',
|
||||
$this->getUrl(0),
|
||||
'items',
|
||||
$itemId, [
|
||||
'comment' => $this->getData(['module', $this->getUrl(0), 'items', $this->getUrl(2), 'comment']),
|
||||
'content' => $this->getInput('downloadAddContent', null),
|
||||
'picture' => $this->getInput('downloadAddPicture', helper::FILTER_STRING_SHORT, true),
|
||||
'file' => $this->getInput('downloadAddFile', helper::FILTER_STRING_SHORT, true),
|
||||
'fileVersion' => $this->getInput('downloadAddFileVersion', helper::FILTER_STRING_SHORT, true),
|
||||
'fileDate' => $this->getInput('downloadAddFileDate', helper::FILTER_DATETIME, true),
|
||||
'fileLicense' => $this->getInput('downloadAddFileLicense', helper::FILTER_STRING_SHORT, true),
|
||||
'fileAuthor' => $this->getInput('downloadAddFileAuthor', helper::FILTER_STRING_SHORT, true),
|
||||
'fileStats' => [],
|
||||
'publishedOn' => $this->getInput('downloadAddPublishedOn', helper::FILTER_DATETIME, true),
|
||||
'state' => $this->getInput('downloadAddState', helper::FILTER_BOOLEAN),
|
||||
'title' => $this->getInput('downloadAddTitle', helper::FILTER_STRING_SHORT, true),
|
||||
'userId' => $newuserid,
|
||||
'editConsent' => $this->getInput('downloadAddConsent') === self::EDIT_GROUP ? $this->getUser('group') : $this->getInput('downloadAddConsent'),
|
||||
'commentMaxlength' => $this->getInput('downloadAddCommentMaxlength'),
|
||||
'commentApproved' => $this->getInput('downloadAddCommentApproved', helper::FILTER_BOOLEAN),
|
||||
'commentClose' => $this->getInput('downloadAddCommentClose', helper::FILTER_BOOLEAN),
|
||||
'commentNotification' => $this->getInput('downloadAddCommentNotification', helper::FILTER_BOOLEAN),
|
||||
'commentGroupNotification' => $this->getInput('downloadAddCommentGroupNotification', helper::FILTER_INT)
|
||||
]
|
||||
]);
|
||||
// Valeurs en sortie
|
||||
$this->addOutput([
|
||||
'redirect' => helper::baseUrl() . $this->getUrl(0) . '/config',
|
||||
'notification' => 'Nouvel item créé',
|
||||
'state' => true
|
||||
]);
|
||||
}
|
||||
// Liste des utilisateurs
|
||||
self::$users = helper::arrayCollumn($this->getData(['user']), 'firstname');
|
||||
ksort(self::$users);
|
||||
foreach(self::$users as $userId => &$userFirstname) {
|
||||
$userFirstname = $userFirstname . ' ' . $this->getData(['user', $userId, 'lastname']);
|
||||
}
|
||||
unset($userFirstname);
|
||||
// Valeurs en sortie
|
||||
$this->addOutput([
|
||||
'title' => 'Nouvel item',
|
||||
'vendor' => [
|
||||
'flatpickr',
|
||||
'tinymce'
|
||||
],
|
||||
'view' => 'add'
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Liste des commentaires
|
||||
*/
|
||||
public function comment() {
|
||||
$comments = $this->getData(['module', $this->getUrl(0), 'items', $this->getUrl(2),'comment']);
|
||||
self::$commentsDelete = template::button('downloadCommentDeleteAll', [
|
||||
'class' => 'downloadCommentDeleteAll buttonRed',
|
||||
'href' => helper::baseUrl() . $this->getUrl(0) . '/commentDeleteAll/' . $this->getUrl(2).'/' . $_SESSION['csrf'] ,
|
||||
'ico' => 'cancel',
|
||||
'value' => 'Tout effacer'
|
||||
]);
|
||||
// Ids des commentaires par ordre de création
|
||||
$commentIds = array_keys(helper::arrayCollumn($comments, 'createdOn', 'SORT_DESC'));
|
||||
// Pagination
|
||||
$pagination = helper::pagination($commentIds, $this->getUrl(), $this->getData(['module', $this->getUrl(0),'config', 'itemsperPage']));
|
||||
// Liste des pages
|
||||
self::$pages = $pagination['pages'];
|
||||
// Commentaires en fonction de la pagination
|
||||
for($i = $pagination['first']; $i < $pagination['last']; $i++) {
|
||||
// Met en forme le tableau
|
||||
$comment = $comments[$commentIds[$i]];
|
||||
// Bouton d'approbation
|
||||
$buttonApproval = '';
|
||||
// Compatibilité avec les commentaires des versions précédentes, les valider
|
||||
$comment['approval'] = array_key_exists('approval', $comment) === false ? true : $comment['approval'] ;
|
||||
if ( $this->getData(['module', $this->getUrl(0), 'items', $this->getUrl(2),'commentApproved']) === true) {
|
||||
$buttonApproval = template::button('downloadCommentApproved' . $commentIds[$i], [
|
||||
'class' => $comment['approval'] === true ? 'downloadCommentRejected buttonGreen' : 'downloadCommentApproved buttonRed' ,
|
||||
'href' => helper::baseUrl() . $this->getUrl(0) . '/commentApprove/' . $this->getUrl(2) . '/' . $commentIds[$i] . '/' . $_SESSION['csrf'] ,
|
||||
'value' => $comment['approval'] === true ? 'A' : 'R'
|
||||
]);
|
||||
}
|
||||
self::$comments[] = [
|
||||
mb_detect_encoding(strftime('%d %B %Y - %H:%M', $comment['createdOn']), 'UTF-8', true)
|
||||
? strftime('%d %B %Y - %H:%M', $comment['createdOn'])
|
||||
: utf8_encode(strftime('%d %B %Y - %H:%M', $comment['createdOn'])),
|
||||
$comment['content'],
|
||||
$comment['userId'] ? $this->getData(['user', $comment['userId'], 'firstname']) . ' ' . $this->getData(['user', $comment['userId'], 'lastname']) : $comment['author'],
|
||||
$buttonApproval,
|
||||
template::button('downloadCommentDelete' . $commentIds[$i], [
|
||||
'class' => 'downloadCommentDelete buttonRed',
|
||||
'href' => helper::baseUrl() . $this->getUrl(0) . '/commentDelete/' . $this->getUrl(2) . '/' . $commentIds[$i] . '/' . $_SESSION['csrf'] ,
|
||||
'value' => template::ico('cancel')
|
||||
])
|
||||
];
|
||||
}
|
||||
// Valeurs en sortie
|
||||
$this->addOutput([
|
||||
'title' => 'Gestion des commentaires : '. $this->getData(['module', $this->getUrl(0), 'items', $this->getUrl(2), 'title']),
|
||||
'view' => 'comment'
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Suppression de commentaire
|
||||
*/
|
||||
public function commentDelete() {
|
||||
// Le commentaire n'existe pas
|
||||
if($this->getData(['module', $this->getUrl(0), 'items', $this->getUrl(2), 'comment', $this->getUrl(3)]) === null) {
|
||||
// Valeurs en sortie
|
||||
$this->addOutput([
|
||||
'access' => false
|
||||
]);
|
||||
}
|
||||
// Jeton incorrect
|
||||
elseif ($this->getUrl(4) !== $_SESSION['csrf']) {
|
||||
// Valeurs en sortie
|
||||
$this->addOutput([
|
||||
'redirect' => helper::baseUrl() . $this->getUrl(0) . '/config',
|
||||
'notification' => 'Action non autorisée'
|
||||
]);
|
||||
}
|
||||
// Suppression
|
||||
else {
|
||||
$this->deleteData(['module', $this->getUrl(0), 'items', $this->getUrl(2), 'comment', $this->getUrl(3)]);
|
||||
// Valeurs en sortie
|
||||
$this->addOutput([
|
||||
'redirect' => helper::baseUrl() . $this->getUrl(0) . '/comment/'.$this->getUrl(2),
|
||||
'notification' => 'Commentaire supprimé',
|
||||
'state' => true
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Suppression de tous les commentaires de l'item $this->getUrl(2)
|
||||
*/
|
||||
public function commentDeleteAll() {
|
||||
// Jeton incorrect
|
||||
if ($this->getUrl(3) !== $_SESSION['csrf']) {
|
||||
// Valeurs en sortie
|
||||
$this->addOutput([
|
||||
'redirect' => helper::baseUrl() . $this->getUrl(0) . '/config',
|
||||
'notification' => 'Action non autorisée'
|
||||
]);
|
||||
}
|
||||
// Suppression
|
||||
else {
|
||||
$this->setData(['module', $this->getUrl(0), 'items', $this->getUrl(2), 'comment',[] ]);
|
||||
// Valeurs en sortie
|
||||
$this->addOutput([
|
||||
'redirect' => helper::baseUrl() . $this->getUrl(0) . '/comment',
|
||||
'notification' => 'Commentaires supprimés',
|
||||
'state' => true
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Approbation oou désapprobation de commentaire
|
||||
*/
|
||||
public function commentApprove() {
|
||||
// Le commentaire n'existe pas
|
||||
if($this->getData(['module', $this->getUrl(0), 'items', $this->getUrl(2), 'comment', $this->getUrl(3)]) === null) {
|
||||
// Valeurs en sortie
|
||||
$this->addOutput([
|
||||
'access' => false
|
||||
]);
|
||||
}
|
||||
// Jeton incorrect
|
||||
elseif ($this->getUrl(4) !== $_SESSION['csrf']) {
|
||||
// Valeurs en sortie
|
||||
$this->addOutput([
|
||||
'redirect' => helper::baseUrl() . $this->getUrl(0) . '/config',
|
||||
'notification' => 'Action non autorisée'
|
||||
]);
|
||||
}
|
||||
// Inversion du statut
|
||||
else {
|
||||
$approved = !$this->getData(['module', $this->getUrl(0), 'items', $this->getUrl(2), 'comment', $this->getUrl(3), 'approval']) ;
|
||||
$this->setData(['module', $this->getUrl(0), 'items', $this->getUrl(2), 'comment', $this->getUrl(3), [
|
||||
'author' => $this->getData(['module', $this->getUrl(0), 'items', $this->getUrl(2), 'comment', $this->getUrl(3), 'author']),
|
||||
'content' => $this->getData(['module', $this->getUrl(0), 'items', $this->getUrl(2), 'comment', $this->getUrl(3), 'content']),
|
||||
'createdOn' => $this->getData(['module', $this->getUrl(0), 'items', $this->getUrl(2), 'comment', $this->getUrl(3), 'createdOn']),
|
||||
'userId' => $this->getData(['module', $this->getUrl(0), 'items', $this->getUrl(2), 'comment', $this->getUrl(3), 'userId']),
|
||||
'approval' => $approved
|
||||
]]);
|
||||
|
||||
// Valeurs en sortie
|
||||
$this->addOutput([
|
||||
'redirect' => helper::baseUrl() . $this->getUrl(0) . '/comment/'.$this->getUrl(2),
|
||||
'notification' => $approved ? 'Commentaire approuvé' : 'Commentaire rejeté',
|
||||
'state' => $approved
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Configuration
|
||||
*/
|
||||
public function config() {
|
||||
// Mise à jour des données de module
|
||||
$this->update();
|
||||
// Soumission du formulaire
|
||||
if($this->isPost()) {
|
||||
$this->setData(['module', $this->getUrl(0), 'config',[
|
||||
'feeds' => $this->getInput('downloadConfigShowFeeds',helper::FILTER_BOOLEAN),
|
||||
'feedsLabel' => $this->getInput('downloadConfigFeedslabel',helper::FILTER_STRING_SHORT),
|
||||
'itemsperPage' => $this->getInput('blogConfigItemsperPage', helper::FILTER_INT,true),
|
||||
'versionData' => $this->getData(['module', $this->getUrl(0), 'config', 'versionData'])
|
||||
]]);
|
||||
// Valeurs en sortie
|
||||
$this->addOutput([
|
||||
'redirect' => helper::baseUrl() . $this->getUrl(0) . '/config',
|
||||
'notification' => 'Modifications enregistrées',
|
||||
'state' => true
|
||||
]);
|
||||
} else {
|
||||
// Ids des items par ordre de publication
|
||||
$itemIds = array_keys(helper::arrayCollumn($this->getData(['module', $this->getUrl(0), 'items']), 'publishedOn', 'SORT_DESC'));
|
||||
// Gestion des droits d'accès
|
||||
$filterData=[];
|
||||
foreach ($itemIds as $key => $value) {
|
||||
if (
|
||||
( // Propriétaire
|
||||
$this->getData(['module', $this->getUrl(0), 'items', $value,'editConsent']) === self::EDIT_OWNER
|
||||
AND ( $this->getData(['module', $this->getUrl(0), 'items', $value,'userId']) === $this->getUser('id')
|
||||
OR $this->getUser('group') === self::GROUP_ADMIN )
|
||||
)
|
||||
|
||||
OR (
|
||||
// Groupe
|
||||
$this->getData(['module', $this->getUrl(0), 'items', $value,'editConsent']) !== self::EDIT_OWNER
|
||||
AND $this->getUser('group') >= $this->getData(['module',$this->getUrl(0), 'items', $value,'editConsent'])
|
||||
)
|
||||
OR (
|
||||
// Tout le monde
|
||||
$this->getData(['module', $this->getUrl(0), 'items', $value,'editConsent']) === self::EDIT_ALL
|
||||
)
|
||||
) {
|
||||
$filterData[] = $value;
|
||||
}
|
||||
}
|
||||
$itemIds = $filterData;
|
||||
// Pagination
|
||||
$pagination = helper::pagination($itemIds, $this->getUrl(), $this->getData(['module', $this->getUrl(0),'config', 'itemsperPage']));
|
||||
// Liste des pages
|
||||
self::$pages = $pagination['pages'];
|
||||
// items 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), 'items', $itemIds[$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), 'items', $itemIds[$i],'comment']));
|
||||
}
|
||||
// Met en forme le tableau
|
||||
$date = mb_detect_encoding(strftime('%d %B %Y', $this->getData(['module', $this->getUrl(0), 'items', $itemIds[$i], 'fileDate'])), 'UTF-8', true)
|
||||
? strftime('%d %B %Y', $this->getData(['module', $this->getUrl(0), 'items', $itemIds[$i], 'fileDate']))
|
||||
: utf8_encode(strftime('%d %B %Y', $this->getData(['module', $this->getUrl(0), 'items', $itemIds[$i], 'fileDate'])));
|
||||
$heure = mb_detect_encoding(strftime('%H:%M', $this->getData(['module', $this->getUrl(0), 'items', $itemIds[$i], 'fileDate'])), 'UTF-8', true)
|
||||
? strftime('%H:%M', $this->getData(['module', $this->getUrl(0), 'items', $itemIds[$i], 'fileDate']))
|
||||
: utf8_encode(strftime('%H:%M', $this->getData(['module', $this->getUrl(0), 'items', $itemIds[$i], 'fileDate'])));
|
||||
$stat = count(helper::arrayCollumn($this->getData(['module', $this->getUrl(0), 'items', $itemIds[$i],'fileStats']), 'time') ) === 0
|
||||
? '0'
|
||||
: '<a href="' . helper::baseurl() . $this->getUrl(0) . '/stats/' . $itemIds[$i] . '" >' .
|
||||
count(helper::arrayCollumn($this->getData(['module', $this->getUrl(0), 'items', $itemIds[$i],'fileStats']), 'time') ) .
|
||||
'</a>';
|
||||
self::$items[] = [
|
||||
'<a href="' . helper::baseurl() . $this->getUrl(0) . '/' . $itemIds[$i] . '" target="_blank" >' .
|
||||
$this->getData(['module', $this->getUrl(0), 'items', $itemIds[$i], 'title']) .
|
||||
'</a>',
|
||||
$this->getData(['module', $this->getUrl(0), 'items', $itemIds[$i], 'fileVersion']),
|
||||
$date .' à '. $heure,
|
||||
$stat,
|
||||
self::$states[$this->getData(['module', $this->getUrl(0), 'items', $itemIds[$i], 'state'])],
|
||||
// Bouton pour afficher les commentaires de l'item
|
||||
template::button('downloadConfigComment' . $itemIds[$i], [
|
||||
'class' => ($toApprove || $approved ) > 0 ? 'buttonBlue' : 'buttonGrey' ,
|
||||
'href' => ($toApprove || $approved ) > 0 ? helper::baseUrl() . $this->getUrl(0) . '/comment/' . $itemIds[$i] : '',
|
||||
'value' => $toApprove > 0 ? $toApprove . '/' . $approved : $approved
|
||||
]),
|
||||
template::button('downloadConfigEdit' . $itemIds[$i], [
|
||||
'href' => helper::baseUrl() . $this->getUrl(0) . '/edit/' . $itemIds[$i] . '/' . $_SESSION['csrf'],
|
||||
'value' => template::ico('pencil')
|
||||
]),
|
||||
template::button('downloadConfigDelete' . $itemIds[$i], [
|
||||
'class' => 'downloadConfigDelete buttonRed',
|
||||
'href' => helper::baseUrl() . $this->getUrl(0) . '/delete/' . $itemIds[$i] . '/' . $_SESSION['csrf'],
|
||||
'value' => template::ico('cancel')
|
||||
])
|
||||
];
|
||||
}
|
||||
// Valeurs en sortie
|
||||
$this->addOutput([
|
||||
'title' => 'Configuration du module',
|
||||
'view' => 'config'
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Suppression
|
||||
*/
|
||||
public function delete() {
|
||||
if($this->getData(['module', $this->getUrl(0), 'items', $this->getUrl(2)]) === null) {
|
||||
// Valeurs en sortie
|
||||
$this->addOutput([
|
||||
'access' => false
|
||||
]);
|
||||
}
|
||||
// Jeton incorrect
|
||||
elseif ($this->getUrl(3) !== $_SESSION['csrf']) {
|
||||
// Valeurs en sortie
|
||||
$this->addOutput([
|
||||
'redirect' => helper::baseUrl() . $this->getUrl(0) . '/config',
|
||||
'notification' => 'Action non autorisée'
|
||||
]);
|
||||
}
|
||||
// Suppression
|
||||
else {
|
||||
$this->deleteData(['module', $this->getUrl(0), 'items', $this->getUrl(2)]);
|
||||
// Valeurs en sortie
|
||||
$this->addOutput([
|
||||
'redirect' => helper::baseUrl() . $this->getUrl(0) . '/config',
|
||||
'notification' => 'Item supprimé',
|
||||
'state' => true
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Édition
|
||||
*/
|
||||
public function edit() {
|
||||
// Jeton incorrect
|
||||
if ($this->getUrl(3) !== $_SESSION['csrf']) {
|
||||
// Valeurs en sortie
|
||||
$this->addOutput([
|
||||
'redirect' => helper::baseUrl() . $this->getUrl(0) . '/config',
|
||||
'notification' => 'Action non autorisée'
|
||||
]);
|
||||
}
|
||||
// L'item n'existe pas
|
||||
if($this->getData(['module', $this->getUrl(0), 'items', $this->getUrl(2)]) === null) {
|
||||
// Valeurs en sortie
|
||||
$this->addOutput([
|
||||
'access' => false
|
||||
]);
|
||||
}
|
||||
// L'item existe
|
||||
else {
|
||||
// Soumission du formulaire
|
||||
if($this->isPost()) {
|
||||
if($this->getUser('group') === self::GROUP_ADMIN){
|
||||
$newuserid = $this->getInput('downloadEditUserId', helper::FILTER_STRING_SHORT, true);
|
||||
}
|
||||
else{
|
||||
$newuserid = $this->getUser('id');
|
||||
}
|
||||
$itemId = $this->getInput('downloadEditTitle', helper::FILTER_ID, true);
|
||||
// Incrémente le nouvel id de l'item
|
||||
if($itemId !== $this->getUrl(2)) {
|
||||
$itemId = helper::increment($itemId, $this->getData(['page']));
|
||||
$itemId = helper::increment($itemId, $this->getData(['module', $this->getUrl(0),'items']));
|
||||
$itemId = helper::increment($itemId, array_keys(self::$actions));
|
||||
}
|
||||
$this->setData(['module',
|
||||
$this->getUrl(0),
|
||||
'items',
|
||||
$itemId, [
|
||||
'comment' => $this->getData(['module', $this->getUrl(0), 'items', $this->getUrl(2), 'comment']),
|
||||
'content' => $this->getInput('downloadEditContent', null),
|
||||
'picture' => $this->getInput('downloadEditPicture', helper::FILTER_STRING_SHORT, true),
|
||||
'file' => $this->getInput('downloadEditFile', helper::FILTER_STRING_SHORT, true),
|
||||
'fileVersion' => $this->getInput('downloadEditFileVersion', helper::FILTER_STRING_SHORT, true),
|
||||
'fileDate' => $this->getInput('downloadEditFileDate', helper::FILTER_DATETIME, true),
|
||||
'fileStats' => $this->getData(['module',$this->getUrl(0), 'items', $this->getUrl(2), 'fileStats']),
|
||||
'fileLicense' => $this->getInput('downloadEditFileLicense', helper::FILTER_STRING_SHORT, true),
|
||||
'fileAuthor' => $this->getInput('downloadEditFileAuthor', helper::FILTER_STRING_SHORT, true),
|
||||
'publishedOn' => $this->getInput('downloadEditPublishedOn', helper::FILTER_DATETIME, true),
|
||||
'state' => $this->getInput('downloadEditState', helper::FILTER_BOOLEAN),
|
||||
'title' => $this->getInput('downloadEditTitle', helper::FILTER_STRING_SHORT, true),
|
||||
'userId' => $newuserid,
|
||||
'editConsent' => $this->getInput('downloadEditConsent') === self::EDIT_GROUP ? $this->getUser('group') : $this->getInput('downloadEditConsent'),
|
||||
'commentMaxlength' => $this->getInput('downloadEditCommentMaxlength'),
|
||||
'commentApproved' => $this->getInput('downloadEditCommentApproved', helper::FILTER_BOOLEAN),
|
||||
'commentClose' => $this->getInput('downloadEditCommentClose', helper::FILTER_BOOLEAN),
|
||||
'commentNotification' => $this->getInput('downloadEditCommentNotification', helper::FILTER_BOOLEAN),
|
||||
'commentGroupNotification' => $this->getInput('downloadEditCommentGroupNotification', helper::FILTER_INT)
|
||||
]
|
||||
]);
|
||||
// Supprime l'ancien item
|
||||
if($itemId !== $this->getUrl(2)) {
|
||||
$this->deleteData(['module', $this->getUrl(0), 'items', $this->getUrl(2)]);
|
||||
}
|
||||
// Valeurs en sortie
|
||||
$this->addOutput([
|
||||
'redirect' => helper::baseUrl() . $this->getUrl(0) . '/config',
|
||||
'notification' => 'Modifications enregistrées',
|
||||
'state' => true
|
||||
]);
|
||||
}
|
||||
// Liste des utilisateurs
|
||||
self::$users = helper::arrayCollumn($this->getData(['user']), 'firstname');
|
||||
ksort(self::$users);
|
||||
foreach(self::$users as $userId => &$userFirstname) {
|
||||
// Les membres ne sont pas éditeurs, les exclure de la liste
|
||||
if ( $this->getData(['user', $userId, 'group']) < self::GROUP_MODERATOR) {
|
||||
unset(self::$users[$userId]);
|
||||
}
|
||||
$userFirstname = $userFirstname . ' ' . $this->getData(['user', $userId, 'lastname']) . ' (' . self::$groupEdits[$this->getData(['user', $userId, 'group'])] . ')';
|
||||
}
|
||||
unset($userFirstname);
|
||||
// Valeurs en sortie
|
||||
$this->addOutput([
|
||||
'title' => $this->getData(['module', $this->getUrl(0), 'items', $this->getUrl(2), 'title']),
|
||||
'vendor' => [
|
||||
'flatpickr',
|
||||
'tinymce'
|
||||
],
|
||||
'view' => 'edit'
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Accueil (deux affichages en un pour éviter une url à rallonge)
|
||||
*/
|
||||
public function index() {
|
||||
// Mise à jour des données de module
|
||||
$this->update();
|
||||
// Affichage d'un item
|
||||
if(
|
||||
$this->getUrl(1)
|
||||
// Protection pour la pagination, un ID ne peut pas être un entier, une page oui
|
||||
AND intval($this->getUrl(1)) === 0
|
||||
) {
|
||||
// L'item n'existe pas
|
||||
if($this->getData(['module', $this->getUrl(0), 'items', $this->getUrl(1)]) === null) {
|
||||
// Valeurs en sortie
|
||||
$this->addOutput([
|
||||
'access' => false
|
||||
]);
|
||||
}
|
||||
// L'item existe
|
||||
else {
|
||||
// Soumission du formulaire
|
||||
if($this->isPost()) {
|
||||
// Check la captcha
|
||||
if(
|
||||
$this->getUser('password') !== $this->getInput('ZWII_USER_PASSWORD')
|
||||
//AND $this->getInput('downloaditemcaptcha', helper::FILTER_INT) !== $this->getInput('downloaditemcaptchaFirstNumber', helper::FILTER_INT) + $this->getInput('downloaditemcaptchaSecondNumber', helper::FILTER_INT))
|
||||
AND password_verify($this->getInput('downloadItemCaptcha', helper::FILTER_INT), $this->getInput('downloadItemCaptchaResult') ) === false )
|
||||
{
|
||||
self::$inputNotices['downloadItemCaptcha'] = 'Incorrect';
|
||||
}
|
||||
// Crée le commentaire
|
||||
$commentId = helper::increment(uniqid(), $this->getData(['module', $this->getUrl(0), 'items', $this->getUrl(1), 'comment']));
|
||||
$content = $this->getInput('downloadItemContent', false);
|
||||
$this->setData(['module', $this->getUrl(0), 'items', $this->getUrl(1), 'comment', $commentId, [
|
||||
'author' => $this->getInput('downloadItemAuthor', helper::FILTER_STRING_SHORT, empty($this->getInput('downloadItemUserId')) ? TRUE : FALSE),
|
||||
'content' => $content,
|
||||
'createdOn' => time(),
|
||||
'userId' => $this->getInput('downloadItemUserId'),
|
||||
'approval' => !$this->getData(['module', $this->getUrl(0), 'items', $this->getUrl(1), 'commentApproved']) // true commentaire publié false en attente de publication
|
||||
]]);
|
||||
// Envoi d'une notification aux administrateurs
|
||||
// Init tableau
|
||||
$to = [];
|
||||
// Liste des destinataires
|
||||
foreach($this->getData(['user']) as $userId => $user) {
|
||||
if ($user['group'] >= $this->getData(['module', $this->getUrl(0), 'items', $this->getUrl(1), 'commentGroupNotification']) ) {
|
||||
$to[] = $user['mail'];
|
||||
$firstname[] = $user['firstname'];
|
||||
$lastname[] = $user['lastname'];
|
||||
}
|
||||
}
|
||||
// Envoi du mail $sent code d'erreur ou de réussite
|
||||
$notification = $this->getData(['module', $this->getUrl(0), 'items', $this->getUrl(1), 'commentApproved']) === true ? 'Commentaire déposé en attente d\'approbation': 'Commentaire déposé';
|
||||
if ($this->getData(['module', $this->getUrl(0), 'items', $this->getUrl(1), 'commentNotification']) === true) {
|
||||
$error = 0;
|
||||
foreach($to as $key => $adress){
|
||||
$sent = $this->sendMail(
|
||||
$adress,
|
||||
'Nouveau commentaire déposé',
|
||||
'Bonjour' . ' <strong>' . $firstname[$key] . ' ' . $lastname[$key] . '</strong>,<br><br>' .
|
||||
'L\'item <a href="' . helper::baseUrl() . $this->getUrl(0) . '/ ' . $this->getUrl(1) . '">' . $this->getData(['module', $this->getUrl(0), 'items', $this->getUrl(1), 'title']) . '</a> a reçu un nouveau commentaire.<br><br>',
|
||||
''
|
||||
);
|
||||
if( $sent === false) $error++;
|
||||
}
|
||||
// Valeurs en sortie
|
||||
$this->addOutput([
|
||||
'redirect' => helper::baseUrl() . $this->getUrl() . '#comment',
|
||||
'notification' => ($error === 0 ? $notification . '<br/>Une notification a été envoyée.' : $notification . '<br/> Erreur de notification : ' . $sent),
|
||||
'state' => ($sent === true ? true : null)
|
||||
]);
|
||||
|
||||
} else {
|
||||
// Valeurs en sortie
|
||||
$this->addOutput([
|
||||
'redirect' => helper::baseUrl() . $this->getUrl() . '#comment',
|
||||
'notification' => $notification,
|
||||
'state' => true
|
||||
]);
|
||||
}
|
||||
|
||||
}
|
||||
// Ids des commentaires approuvés par ordre de publication
|
||||
$commentsApproved = $this->getData(['module', $this->getUrl(0), 'items', $this->getUrl(1), 'comment']);
|
||||
if ($commentsApproved) {
|
||||
foreach( $commentsApproved as $key => $value){
|
||||
if($value['approval']===false) unset($commentsApproved[$key]);
|
||||
}
|
||||
// Ligne suivante si affichage du nombre total de commentaires approuvés sous l'item
|
||||
self::$nbCommentsApproved = count($commentsApproved);
|
||||
}
|
||||
$commentIds = array_keys(helper::arrayCollumn($commentsApproved, 'createdOn', 'SORT_DESC'));
|
||||
// Pagination
|
||||
$pagination = helper::pagination($commentIds, $this->getUrl(), $this->getData(['module', $this->getUrl(0),'config', 'itemsperPage']),'#comment');
|
||||
// Nombre de téléchargements
|
||||
self::$statSum = count(helper::arrayCollumn($this->getData(['module', $this->getUrl(0), 'items',$this->getUrl(1),'fileStats']), 'time') ) === 0
|
||||
? '0'
|
||||
: count(helper::arrayCollumn($this->getData(['module', $this->getUrl(0), 'items', $this->getUrl(1),'fileStats']), 'time') ) ;
|
||||
// Liste des pages
|
||||
self::$pages = $pagination['pages'];
|
||||
// Signature de l'item
|
||||
self::$itemSignature = $this->signature($this->getData(['module', $this->getUrl(0), 'items', $this->getUrl(1), 'userId']));
|
||||
// Signature du commentaire édité
|
||||
if($this->getUser('password') === $this->getInput('ZWII_USER_PASSWORD')) {
|
||||
self::$editCommentSignature = $this->signature($this->getUser('id'));
|
||||
}
|
||||
// Commentaires en fonction de la pagination
|
||||
for($i = $pagination['first']; $i < $pagination['last']; $i++) {
|
||||
// Signatures des commentaires
|
||||
$e = $this->getData(['module', $this->getUrl(0), 'items', $this->getUrl(1), 'comment', $commentIds[$i],'userId']);
|
||||
if ($e) {
|
||||
self::$commentsSignature[$commentIds[$i]] = $this->signature($e);
|
||||
} else {
|
||||
self::$commentsSignature[$commentIds[$i]] = $this->getData(['module', $this->getUrl(0), 'items', $this->getUrl(1), 'comment', $commentIds[$i],'author']);
|
||||
}
|
||||
// Données du commentaire si approuvé
|
||||
if ($this->getData(['module', $this->getUrl(0), 'items', $this->getUrl(1), 'comment', $commentIds[$i],'approval']) === true ) {
|
||||
self::$comments[$commentIds[$i]] = $this->getData(['module', $this->getUrl(0), 'items', $this->getUrl(1), 'comment', $commentIds[$i]]);
|
||||
}
|
||||
}
|
||||
// Valeurs en sortie
|
||||
$this->addOutput([
|
||||
'showBarEditButton' => true,
|
||||
'title' => $this->getData(['module', $this->getUrl(0), 'items', $this->getUrl(1), 'title']),
|
||||
'vendor' => [
|
||||
'tinymce'
|
||||
],
|
||||
'view' => 'item'
|
||||
]);
|
||||
}
|
||||
|
||||
}
|
||||
// Liste des items
|
||||
else {
|
||||
// Ids des items par ordre de publication
|
||||
$itemIdsPublishedOns = helper::arrayCollumn($this->getData(['module', $this->getUrl(0),'items']), 'publishedOn', 'SORT_DESC');
|
||||
$itemIdsStates = helper::arrayCollumn($this->getData(['module', $this->getUrl(0), 'items']), 'state', 'SORT_DESC');
|
||||
$itemIds = [];
|
||||
foreach($itemIdsPublishedOns as $itemId => $itemPublishedOn) {
|
||||
if($itemPublishedOn <= time() AND $itemIdsStates[$itemId]) {
|
||||
$itemIds[] = $itemId;
|
||||
}
|
||||
}
|
||||
// Pagination
|
||||
$pagination = helper::pagination($itemIds, $this->getUrl(), $this->getData(['module', $this->getUrl(0),'config', 'itemsperPage']));
|
||||
// Liste des pages
|
||||
self::$pages = $pagination['pages'];
|
||||
// Items en fonction de la pagination
|
||||
for($i = $pagination['first']; $i < $pagination['last']; $i++) {
|
||||
self::$items[$itemIds[$i]] = $this->getData(['module', $this->getUrl(0), 'items', $itemIds[$i]]);
|
||||
}
|
||||
// Valeurs en sortie
|
||||
$this->addOutput([
|
||||
'showBarEditButton' => true,
|
||||
'showPageContent' => true,
|
||||
'view' => 'index'
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Retourne la signature d'un utilisateur
|
||||
*/
|
||||
private function signature($userId) {
|
||||
switch ($this->getData(['user', $userId, 'signature'])){
|
||||
case 1:
|
||||
return $userId;
|
||||
break;
|
||||
case 2:
|
||||
return $this->getData(['user', $userId, 'pseudo']);
|
||||
break;
|
||||
case 3:
|
||||
return $this->getData(['user', $userId, 'firstname']) . ' ' . $this->getData(['user', $userId, 'lastname']);
|
||||
break;
|
||||
case 4:
|
||||
return $this->getData(['user', $userId, 'lastname']) . ' ' . $this->getData(['user', $userId, 'firstname']);
|
||||
break;
|
||||
default:
|
||||
return $this->getData(['user', $userId, 'firstname']);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Initie un téléchargement protégé
|
||||
*/
|
||||
public function downloadFile() {
|
||||
|
||||
if($this->getData(['module', $this->getUrl(0), 'items', $this->getUrl(2)]) === null) {
|
||||
// Valeurs en sortie
|
||||
$this->addOutput([
|
||||
'access' => false
|
||||
]);
|
||||
}
|
||||
// Jeton incorrect
|
||||
elseif ($this->getUrl(3) !== $_SESSION['csrf']) {
|
||||
// Valeurs en sortie
|
||||
$this->addOutput([
|
||||
'redirect' => helper::baseUrl() . $this->getUrl(0),
|
||||
'notification' => 'Action non autorisée'
|
||||
]);
|
||||
}
|
||||
// Téléchargement
|
||||
else {
|
||||
$filePath = self::FILE_DIR . 'source/' . $this->getData(['module', $this->getUrl(0), 'items', $this->getUrl(2), 'file']);
|
||||
$fileName = $this->getData(['module', $this->getUrl(0), 'items', $this->getUrl(2), 'file']);
|
||||
if (file_exists($filePath)) {
|
||||
// Statistiques de téléchargement
|
||||
$statId = helper::increment(uniqid(), $this->getData(['module', $this->getUrl(0), 'items', $this->getUrl(2), 'fileStats']));
|
||||
$this->setData(['module',
|
||||
$this->getUrl(0),
|
||||
'items',
|
||||
$this->getUrl(2),
|
||||
'fileStats',
|
||||
$statId, [
|
||||
'time' => time(),
|
||||
'ip' => helper::getIp()
|
||||
]]);
|
||||
// Formatage http
|
||||
header('Content-Type: application/octet-stream');
|
||||
header('Content-Disposition: attachment; filename="' . $fileName . '"');
|
||||
header('Content-Length: ' . filesize($filePath));
|
||||
readfile( $filePath);
|
||||
// Valeurs en sortie
|
||||
$this->addOutput([
|
||||
'display' => self::DISPLAY_RAW
|
||||
]);
|
||||
// Valeurs en sortie
|
||||
$this->addOutput([
|
||||
'title' => 'Configuration',
|
||||
'view' => 'index'
|
||||
]);
|
||||
} else {
|
||||
// Valeurs en sortie
|
||||
$this->addOutput([
|
||||
'redirect' => helper::baseUrl() . $this->getUrl(0),
|
||||
'notification' => 'Le fichier n\'existe pas',
|
||||
'state' => false
|
||||
]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Ecran de consultation des données statistiques
|
||||
*/
|
||||
|
||||
public function stats() {
|
||||
|
||||
// Construction de la page des statistiques
|
||||
$itemIds = array_keys($this->getData(['module', $this->getUrl(0), 'items', $this->getUrl(2), 'fileStats']));
|
||||
// Total des téléchargements
|
||||
self::$statSum = count ($itemIds);
|
||||
// Pagination
|
||||
$pagination = helper::pagination($itemIds, $this->getUrl(), $this->getData(['module', $this->getUrl(0),'config', 'itemsperPage']));
|
||||
|
||||
// Liste des pages
|
||||
self::$pages = $pagination['pages'];
|
||||
|
||||
for($i = $pagination['first']; $i < $pagination['last']; $i++) {
|
||||
|
||||
// Format des variables
|
||||
$date = mb_detect_encoding(strftime('%d %B %Y - %H:%M', $this->getData(['module', $this->getUrl(0), 'items', $this->getUrl(2), 'fileStats', $itemIds[$i], 'time'])), 'UTF-8', true)
|
||||
? strftime('%d %B %Y - %H:%M',$this->getData(['module', $this->getUrl(0), 'items', $this->getUrl(2), 'fileStats', $itemIds[$i], 'time']))
|
||||
: utf8_encode(strftime('%d %B %Y - %H:%M', $this->getData(['module', $this->getUrl(0), 'items', $this->getUrl(2), 'fileStats', $itemIds[$i], 'time'])));
|
||||
|
||||
// Met en forme le tableau
|
||||
self::$items[] = [
|
||||
$date,
|
||||
$this->getData(['module', $this->getUrl(0), 'items', $this->getUrl(2), 'fileStats', $itemIds[$i], 'ip'])
|
||||
];
|
||||
|
||||
}
|
||||
$this->addOutput([
|
||||
'title' => 'Statistiques de téléchargement',
|
||||
'view' => 'stats'
|
||||
]);
|
||||
}
|
||||
|
||||
public function statsDeleteAll() {
|
||||
// Validité de la page demandée
|
||||
if($this->getData(['module', $this->getUrl(0), 'items']) === null) {
|
||||
// Valeurs en sortie
|
||||
$this->addOutput([
|
||||
'access' => false
|
||||
]);
|
||||
}
|
||||
// Jeton incorrect
|
||||
elseif ($this->getUrl(3) !== $_SESSION['csrf']) {
|
||||
// Valeurs en sortie
|
||||
$this->addOutput([
|
||||
'redirect' => helper::baseUrl() . $this->getUrl(0),
|
||||
'notification' => 'Action non autorisée'
|
||||
]);
|
||||
}
|
||||
// Téléchargement
|
||||
else {
|
||||
$this->setData(['module', $this->getUrl(0), 'items', $this->getUrl(2), 'fileStats', [] ]);
|
||||
// Valeurs en sortie
|
||||
$this->addOutput([
|
||||
'redirect' => helper::baseUrl() . $this->getUrl(0) . '/stats/' . $this->getUrl(2),
|
||||
'notification' => 'Purge des statistiques',
|
||||
'state' => true
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
/***
|
||||
* Retourne une chaîne json contenant la liste des téléchargements disponibles
|
||||
*/
|
||||
public function list() {
|
||||
$itemIdsPublishedOns = helper::arrayCollumn($this->getData(['module', $this->getUrl(0),'items']), 'publishedOn', 'SORT_DESC');
|
||||
$itemIdsStates = helper::arrayCollumn($this->getData(['module', $this->getUrl(0), 'items']), 'state', 'SORT_DESC');
|
||||
$itemIds = [];
|
||||
foreach($itemIdsPublishedOns as $itemId => $itemPublishedOn) {
|
||||
if($itemPublishedOn <= time() AND $itemIdsStates[$itemId]) {
|
||||
$itemIds[] = $itemId;
|
||||
}
|
||||
}
|
||||
foreach ($itemIds as $key) {
|
||||
self::$items[$key] = [
|
||||
'title' => $this->getData(['module', $this->getUrl(0), 'items', $key, 'title']),
|
||||
'content' => $this->getData(['module', $this->getUrl(0), 'items', $key, 'content']),
|
||||
'picture' => $this->getData(['module', $this->getUrl(0), 'items', $key, 'picture']),
|
||||
'file' =>$this->getData(['module', $this->getUrl(0), 'items', $key, 'file']),
|
||||
'fileVersion' => $this->getData(['module', $this->getUrl(0), 'items', $key, 'fileVersion']),
|
||||
'fileDate' =>$this->getData(['module', $this->getUrl(0), 'items', $key, 'fileDate']),
|
||||
'fileAuthor' =>$this->getData(['module', $this->getUrl(0), 'items', $key, 'fileAuthor']),
|
||||
'fileLicense' =>$this->getData(['module', $this->getUrl(0), 'items', $key, 'fileLicense']),
|
||||
];
|
||||
}
|
||||
$this->addOutput([
|
||||
'display' => self::DISPLAY_JSON,
|
||||
'content' => self::$items
|
||||
]);
|
||||
}
|
||||
}
|
BIN
module/download/ressource/feed-icon-16.gif
Normal file
BIN
module/download/ressource/feed-icon-16.gif
Normal file
Binary file not shown.
After Width: | Height: | Size: 652 B |
38
module/download/vendor/FeedWriter/ATOM.php
vendored
Normal file
38
module/download/vendor/FeedWriter/ATOM.php
vendored
Normal 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/download/vendor/FeedWriter/Feed.php
vendored
Normal file
1017
module/download/vendor/FeedWriter/Feed.php
vendored
Normal file
File diff suppressed because it is too large
Load Diff
33
module/download/vendor/FeedWriter/InvalidOperationException.php
vendored
Normal file
33
module/download/vendor/FeedWriter/InvalidOperationException.php
vendored
Normal 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/download/vendor/FeedWriter/Item.php
vendored
Normal file
413
module/download/vendor/FeedWriter/Item.php
vendored
Normal 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 download 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/download/vendor/FeedWriter/README.md
vendored
Normal file
42
module/download/vendor/FeedWriter/README.md
vendored
Normal 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/download/vendor/FeedWriter/RSS1.php
vendored
Normal file
37
module/download/vendor/FeedWriter/RSS1.php
vendored
Normal 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/download/vendor/FeedWriter/RSS2.php
vendored
Normal file
37
module/download/vendor/FeedWriter/RSS2.php
vendored
Normal 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);
|
||||
}
|
||||
}
|
18
module/download/view/add/add.css
Normal file
18
module/download/view/add/add.css
Normal file
@ -0,0 +1,18 @@
|
||||
/**
|
||||
* 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/
|
||||
*/
|
||||
|
||||
|
||||
/** NE PAS EFFACER
|
||||
* admin.css
|
||||
*/
|
54
module/download/view/add/add.js.php
Normal file
54
module/download/view/add/add.js.php
Normal file
@ -0,0 +1,54 @@
|
||||
/**
|
||||
* 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
|
||||
* @license GNU General Public License, version 3
|
||||
* @link http://zwiicms.fr/
|
||||
*/
|
||||
|
||||
/**
|
||||
* Soumission du formulaire pour enregistrer en brouillon
|
||||
*/
|
||||
$("#downloadAddDraft").on("click", function() {
|
||||
$("#downloadAddState").val(0);
|
||||
$("#downloadAddForm").trigger("submit");
|
||||
});
|
||||
|
||||
/**
|
||||
* Options de commentaires
|
||||
*/
|
||||
$("#downloadAddCommentClose").on("change", function() {
|
||||
if ($(this).is(':checked') ) {
|
||||
$(".commentOptionsWrapper").slideUp();
|
||||
} else {
|
||||
$(".commentOptionsWrapper").slideDown();
|
||||
}
|
||||
});
|
||||
|
||||
$("#downloadAddCommentNotification").on("change", function() {
|
||||
if ($(this).is(':checked') ) {
|
||||
$("#downloadAddCommentGroupNotification").slideDown();
|
||||
} else {
|
||||
$("#downloadAddCommentGroupNotification").slideUp();
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
$( document).ready(function() {
|
||||
|
||||
if ($("#downloadAddCloseComment").is(':checked') ) {
|
||||
$(".commentOptionsWrapper").slideUp();
|
||||
} else {
|
||||
$(".commentOptionsWrapper").slideDown();
|
||||
}
|
||||
|
||||
if ($("#downloadAddCommentNotification").is(':checked') ) {
|
||||
$("#downloadAddCommentGroupNotification").slideDown();
|
||||
} else {
|
||||
$("#downloadAddCommentGroupNotification").slideUp();
|
||||
}
|
||||
});
|
139
module/download/view/add/add.php
Normal file
139
module/download/view/add/add.php
Normal file
@ -0,0 +1,139 @@
|
||||
<?php echo template::formOpen('downloadAddForm'); ?>
|
||||
<div class="row">
|
||||
<div class="col2">
|
||||
<?php echo template::button('downloadAddBack', [
|
||||
'class' => 'buttonGrey',
|
||||
'href' => helper::baseUrl() . $this->getUrl(0) . '/config',
|
||||
'ico' => 'left',
|
||||
'value' => 'Retour'
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col3 offset5">
|
||||
<?php echo template::button('downloadAddDraft', [
|
||||
'uniqueSubmission' => true,
|
||||
'value' => 'Enregistrer en brouillon'
|
||||
]); ?>
|
||||
<?php echo template::hidden('downloadAddState', [
|
||||
'value' => true
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col2">
|
||||
<?php echo template::submit('downloadAddPublish', [
|
||||
'value' => 'Publier'
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col12">
|
||||
<div class="block">
|
||||
<h4>Informations générales</h4>
|
||||
<div class="row">
|
||||
<div class="col8">
|
||||
<?php echo template::text('downloadAddTitle', [
|
||||
'label' => 'Titre'
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col2">
|
||||
<?php echo template::text('downloadAddFileVersion', [
|
||||
'label' => 'Version'
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col2">
|
||||
<?php echo template::date('downloadAddFileDate', [
|
||||
'label' => 'Date'
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col6">
|
||||
<?php echo template::file('downloadAddFile', [
|
||||
'label' => 'Archive du fichier'
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col6">
|
||||
<?php echo template::file('downloadAddPicture', [
|
||||
'label' => 'Capture d\'écran',
|
||||
'type' => 1
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col6">
|
||||
<?php echo template::text('downloadAddFileAuthor', [
|
||||
'label' => 'Auteur',
|
||||
'value' => $this->getData(['module', $this->getUrl(0), 'items', $this->getUrl(2), 'fileAuthor'])
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col6">
|
||||
<?php echo template::select('downloadAddFileLicense', $module::$itemLicense, [
|
||||
'label' => 'Licence',
|
||||
'selected' => $this->getData(['module', $this->getUrl(0), 'items', $this->getUrl(2), 'fileLicense'])
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php echo template::textarea('downloadAddContent', [
|
||||
'class' => 'editorWysiwyg'
|
||||
]); ?>
|
||||
<div class="row">
|
||||
<div class="col12">
|
||||
<div class="block">
|
||||
<h4>Options de publication</h4>
|
||||
<div class="row">
|
||||
<div class="col4">
|
||||
<?php echo template::select('downloadAddUserId', $module::$users, [
|
||||
'label' => 'Auteur',
|
||||
'selected' => $this->getUser('id'),
|
||||
'disabled' => $this->getUser('group') !== self::GROUP_ADMIN ? true : false
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col4">
|
||||
<?php echo template::date('downloadAddPublishedOn', [
|
||||
'help' => 'L\'item n\'est visible qu\'après la date de publication prévue.',
|
||||
'label' => 'Date de publication',
|
||||
'value' => time()
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col4">
|
||||
<?php echo template::select('downloadAddConsent', $module::$itemConsent , [
|
||||
'label' => 'Edition / Suppression',
|
||||
'selected' => $module::EDIT_ALL,
|
||||
'help' => 'Les utilisateurs des groupes supérieurs accèdent à l\'item sans restriction'
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col12">
|
||||
<div class="block">
|
||||
<h4>Commentaires</h4>
|
||||
<div class="row">
|
||||
<div class="col4 ">
|
||||
<?php echo template::checkbox('downloadAddCommentClose', true, 'Fermer les commentaires'); ?>
|
||||
</div>
|
||||
<div class="col4 commentOptionsWrapper ">
|
||||
<?php echo template::checkbox('downloadAddCommentApproved', true, 'Approbation par un modérateur'); ?>
|
||||
</div>
|
||||
<div class="col4 commentOptionsWrapper">
|
||||
<?php echo template::select('downloadAddCommentMaxlength', $module::$commentLength,[
|
||||
'help' => 'Choix du nombre maximum de caractères pour chaque commentaire de l\'item, mise en forme html comprise.',
|
||||
'label' => 'Caractères par commentaire'
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col3 commentOptionsWrapper offset2">
|
||||
<?php echo template::checkbox('downloadAddCommentNotification', true, 'Notification par email'); ?>
|
||||
</div>
|
||||
<div class="col4 commentOptionsWrapper">
|
||||
<?php echo template::select('downloadAddCommentGroupNotification', $module::$groupNews); ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php echo template::formClose(); ?>
|
18
module/download/view/comment/comment.css
Normal file
18
module/download/view/comment/comment.css
Normal file
@ -0,0 +1,18 @@
|
||||
/**
|
||||
* 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/
|
||||
*/
|
||||
|
||||
|
||||
/** NE PAS EFFACER
|
||||
* admin.css
|
||||
*/
|
62
module/download/view/comment/comment.js.php
Normal file
62
module/download/view/comment/comment.js.php
Normal file
@ -0,0 +1,62 @@
|
||||
/**
|
||||
* 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
|
||||
* @license GNU General Public License, version 3
|
||||
* @link http://zwiicms.fr/
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* Confirmation de suppression
|
||||
*/
|
||||
$(".downloadCommentDelete").on("click", function() {
|
||||
var _this = $(this);
|
||||
var nom = "<?php echo $this->getData(['module', $this->getUrl(0), $this->getUrl(2), 'title' ]); ?>";
|
||||
return core.confirm("Supprimer le commentaire de l'item " + nom + " ?", function() {
|
||||
$(location).attr("href", _this.attr("href"));
|
||||
});
|
||||
});
|
||||
|
||||
/**
|
||||
* Confirmation d'approbation
|
||||
*/
|
||||
$(".downloadCommentApproved").on("click", function() {
|
||||
var _this = $(this);
|
||||
var nom = "<?php echo $this->getData(['module', $this->getUrl(0), $this->getUrl(2), 'title' ]); ?>";
|
||||
return core.confirm("Approuver le commentaire de l'item " + nom + " ?", function() {
|
||||
$(location).attr("href", _this.attr("href"));
|
||||
});
|
||||
});
|
||||
|
||||
/**
|
||||
* Confirmation de rejet
|
||||
*/
|
||||
$(".downloadCommentRejected").on("click", function() {
|
||||
var _this = $(this);
|
||||
var nom = "<?php echo $this->getData(['module', $this->getUrl(0), $this->getUrl(2), 'title' ]); ?>";
|
||||
return core.confirm("Rejeter le commentaire de l'item " + nom + " ?", function() {
|
||||
$(location).attr("href", _this.attr("href"));
|
||||
});
|
||||
});
|
||||
|
||||
/**
|
||||
* Confirmation de suppression en masse
|
||||
*/
|
||||
$(".downloadCommentDeleteAll").on("click", function() {
|
||||
var _this = $(this);
|
||||
var nombre = "<?php echo count($this->getData(['module', $this->getUrl(0), $this->getUrl(2), 'comment' ])); ?>";
|
||||
var nom = "<?php echo $this->getData(['module', $this->getUrl(0), $this->getUrl(2), 'title' ]); ?>";
|
||||
if( nombre === "1"){
|
||||
var message = "Supprimer le commentaire de l'item " + nom + " ?";
|
||||
} else{
|
||||
var message = "Supprimer les " + nombre + " commentaires de l'item " + nom + " ?";
|
||||
}
|
||||
return core.confirm(message, function() {
|
||||
$(location).attr("href", _this.attr("href"));
|
||||
});
|
||||
});
|
22
module/download/view/comment/comment.php
Normal file
22
module/download/view/comment/comment.php
Normal file
@ -0,0 +1,22 @@
|
||||
<div class="row">
|
||||
<div class="col2">
|
||||
<?php echo template::button('downloadCommentBack', [
|
||||
'class' => 'buttonGrey',
|
||||
'href' => helper::baseUrl() . $this->getUrl(0) . '/config',
|
||||
'ico' => 'left',
|
||||
'value' => 'Retour'
|
||||
]); ?>
|
||||
</div>
|
||||
|
||||
<?php if($module::$comments): ?>
|
||||
<div class="col2 offset8">
|
||||
<?php echo $module::$commentsDelete; ?>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<?php echo template::table([3, 5, 2, 1, 1], $module::$comments, ['Date', 'Contenu', 'Auteur', '', '']); ?>
|
||||
<?php echo $module::$pages.'<br/>'; ?>
|
||||
<?php else: ?>
|
||||
</div>
|
||||
<?php echo template::speech('Aucun commentaire.'); ?>
|
||||
<?php endif; ?>
|
18
module/download/view/config/config.css
Normal file
18
module/download/view/config/config.css
Normal file
@ -0,0 +1,18 @@
|
||||
/**
|
||||
* 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/
|
||||
*/
|
||||
|
||||
|
||||
/** NE PAS EFFACER
|
||||
* admin.css
|
||||
*/
|
21
module/download/view/config/config.js.php
Normal file
21
module/download/view/config/config.js.php
Normal file
@ -0,0 +1,21 @@
|
||||
/**
|
||||
* 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
|
||||
* @license GNU General Public License, version 3
|
||||
* @link http://zwiicms.fr/
|
||||
*/
|
||||
|
||||
/**
|
||||
* Confirmation de suppression
|
||||
*/
|
||||
$(".downloadConfigDelete").on("click", function() {
|
||||
var _this = $(this);
|
||||
return core.confirm("Êtes-vous sûr de vouloir supprimer cet item ?", function() {
|
||||
$(location).attr("href", _this.attr("href"));
|
||||
});
|
||||
});
|
60
module/download/view/config/config.php
Normal file
60
module/download/view/config/config.php
Normal file
@ -0,0 +1,60 @@
|
||||
<?php echo template::formOpen('downloadConfig'); ?>
|
||||
<div class="row">
|
||||
<div class="col2">
|
||||
<?php echo template::button('downloadConfigBack', [
|
||||
'class' => 'buttonGrey',
|
||||
'href' => helper::baseUrl() . 'page/edit/' . $this->getUrl(0), 'items',
|
||||
'ico' => 'left',
|
||||
'value' => 'Retour'
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col2 offset6">
|
||||
<?php echo template::button('downloadConfigAdd', [
|
||||
'href' => helper::baseUrl() . $this->getUrl(0) . '/add',
|
||||
'ico' => 'plus',
|
||||
'value' => 'Fichier'
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col2">
|
||||
<?php echo template::submit('downloadConfigSubmit'); ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col12">
|
||||
<div class="block">
|
||||
<h4>Paramètres du module</h4>
|
||||
<div class="row">
|
||||
<div class="col6">
|
||||
<?php echo template::checkbox('downloadConfigShowFeeds', true, 'Lien du flux RSS', [
|
||||
'checked' => $this->getData(['module', $this->getUrl(0), 'config', 'feeds']),
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col6">
|
||||
<?php echo template::text('downloadConfigFeedslabel', [
|
||||
'label' => 'Etiquette du flux',
|
||||
'value' => $this->getData(['module', $this->getUrl(0), 'config', 'feedsLabel'])
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col6 offset6">
|
||||
<?php echo template::select('blogConfigItemsperPage', $module::$ItemsList, [
|
||||
'label' => 'Articles par page',
|
||||
'selected' => $this->getData(['module', $this->getUrl(0),'config', 'itemsperPage'])
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php echo template::formClose(); ?>
|
||||
<?php if($module::$items): ?>
|
||||
<?php echo template::table([3, 1, 3, 1, 1, 1, 1, 1], $module::$items, ['Titre', 'Version', 'Du', 'Stats', 'État', 'Commentaires', '','']); ?>
|
||||
<?php echo $module::$pages; ?>
|
||||
<?php else: ?>
|
||||
<?php echo template::speech('Aucun item.'); ?>
|
||||
<?php endif; ?>
|
||||
<div class="moduleVersion">Version n°
|
||||
<?php echo $module::VERSION; ?>
|
||||
</div>
|
||||
|
18
module/download/view/edit/edit.css
Normal file
18
module/download/view/edit/edit.css
Normal file
@ -0,0 +1,18 @@
|
||||
/**
|
||||
* 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/
|
||||
*/
|
||||
|
||||
|
||||
/** NE PAS EFFACER
|
||||
* admin.css
|
||||
*/
|
66
module/download/view/edit/edit.js.php
Normal file
66
module/download/view/edit/edit.js.php
Normal file
@ -0,0 +1,66 @@
|
||||
/**
|
||||
* 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
|
||||
* @license GNU General Public License, version 3
|
||||
* @link http://zwiicms.fr/
|
||||
*/
|
||||
|
||||
|
||||
// Lien de connexion
|
||||
$("#downloadEditMailNotification").on("change", function() {
|
||||
if($(this).is(":checked")) {
|
||||
$("#formConfigGroup").show();
|
||||
}
|
||||
else {
|
||||
$("#formConfigGroup").hide();
|
||||
}
|
||||
}).trigger("change");
|
||||
|
||||
|
||||
/**
|
||||
* Soumission du formulaire pour enregistrer en brouillon
|
||||
*/
|
||||
$("#downloadEditDraft").on("click", function() {
|
||||
$("#downloadEditState").val(0);
|
||||
$("#downloadEditForm").trigger("submit");
|
||||
});
|
||||
|
||||
/**
|
||||
* Options de commentaires
|
||||
*/
|
||||
$("#downloadEditCommentClose").on("change", function() {
|
||||
if ($(this).is(':checked') ) {
|
||||
$(".commentOptionsWrapper").slideUp();
|
||||
} else {
|
||||
$(".commentOptionsWrapper").slideDown();
|
||||
}
|
||||
});
|
||||
|
||||
$("#downloadEditCommentNotification").on("change", function() {
|
||||
if ($(this).is(':checked') ) {
|
||||
$("#downloadEditCommentGroupNotification").slideDown();
|
||||
} else {
|
||||
$("#downloadEditCommentGroupNotification").slideUp();
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
$( document).ready(function() {
|
||||
|
||||
if ($("#downloadEditCloseComment").is(':checked') ) {
|
||||
$(".commentOptionsWrapper").slideUp();
|
||||
} else {
|
||||
$(".commentOptionsWrapper").slideDown();
|
||||
}
|
||||
|
||||
if ($("#downloadEditCommentNotification").is(':checked') ) {
|
||||
$("#downloadEditCommentGroupNotification").slideDown();
|
||||
} else {
|
||||
$("#downloadEditCommentGroupNotification").slideUp();
|
||||
}
|
||||
});
|
159
module/download/view/edit/edit.php
Normal file
159
module/download/view/edit/edit.php
Normal file
@ -0,0 +1,159 @@
|
||||
<?php echo template::formOpen('downloadEditForm'); ?>
|
||||
<div class="row">
|
||||
<div class="col2">
|
||||
<?php echo template::button('downloadEditBack', [
|
||||
'class' => 'buttonGrey',
|
||||
'href' => helper::baseUrl() . $this->getUrl(0) . '/config',
|
||||
'ico' => 'left',
|
||||
'value' => 'Retour'
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col3 offset5">
|
||||
<?php echo template::button('downloadEditDraft', [
|
||||
'uniqueSubmission' => true,
|
||||
'value' => 'Enregistrer en brouillon'
|
||||
]); ?>
|
||||
<?php echo template::hidden('downloadEditState', [
|
||||
'value' => true
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col2">
|
||||
<?php echo template::submit('downloadEditSubmit', [
|
||||
'value' => 'Publier'
|
||||
]); ?>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col12">
|
||||
<div class="block">
|
||||
<h4>Informations générales</h4>
|
||||
|
||||
<div class="row">
|
||||
<div class="col8">
|
||||
<?php echo template::text('downloadEditTitle', [
|
||||
'label' => 'Titre',
|
||||
'value' => $this->getData(['module', $this->getUrl(0), 'items', $this->getUrl(2), 'title'])
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col2">
|
||||
<?php echo template::text('downloadEditFileVersion', [
|
||||
'label' => 'Version',
|
||||
'value' => $this->getData(['module', $this->getUrl(0), 'items', $this->getUrl(2), 'fileVersion'])
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col2">
|
||||
<?php echo template::date('downloadEditFileDate', [
|
||||
'label' => 'Date',
|
||||
'value' => $this->getData(['module', $this->getUrl(0), 'items', $this->getUrl(2), 'fileDate'])
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col6">
|
||||
<?php echo template::file('downloadEditFile', [
|
||||
'label' => 'Archive du fichier',
|
||||
'value' => $this->getData(['module', $this->getUrl(0), 'items', $this->getUrl(2), 'file'])
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col6">
|
||||
<?php echo template::file('downloadEditPicture', [
|
||||
'label' => 'Capture d\'écran',
|
||||
'type' => 1,
|
||||
'value' => $this->getData(['module', $this->getUrl(0), 'items', $this->getUrl(2), 'picture'])
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col6">
|
||||
<?php echo template::text('downloadEditFileAuthor', [
|
||||
'label' => 'Auteur',
|
||||
'value' => $this->getData(['module', $this->getUrl(0), 'items', $this->getUrl(2), 'fileAuthor'])
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col6">
|
||||
<?php echo template::select('downloadEditFileLicense', $module::$itemLicense, [
|
||||
'label' => 'Licence',
|
||||
'selected' => $this->getData(['module', $this->getUrl(0), 'items', $this->getUrl(2), 'fileLicense'])
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php echo template::textarea('downloadEditContent', [
|
||||
'class' => 'editorWysiwyg',
|
||||
'value' => $this->getData(['module', $this->getUrl(0), 'items', $this->getUrl(2), 'content'])
|
||||
]); ?>
|
||||
<div class="row">
|
||||
<div class="col12">
|
||||
<div class="block">
|
||||
<h4>Options de publication</h4>
|
||||
<div class="row">
|
||||
<div class="col4">
|
||||
<?php echo template::select('downloadEditUserId', $module::$users, [
|
||||
'label' => 'Auteur',
|
||||
'selected' => $this->getUser('id'),
|
||||
'disabled' => $this->getUser('group') !== self::GROUP_ADMIN ? true : false
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col4">
|
||||
<?php echo template::date('downloadEditPublishedOn', [
|
||||
'help' => 'L\'item n\'est visible qu\'après la date de publication prévue.',
|
||||
'label' => 'Date de publication',
|
||||
'value' => time()
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col4">
|
||||
<?php echo template::select('downloadEditConsent', $module::$itemConsent , [
|
||||
'label' => 'Edition / Suppression',
|
||||
'selected' => is_numeric($this->getData(['module', $this->getUrl(0), 'items', $this->getUrl(2), 'editConsent'])) ? $module::EDIT_GROUP : $this->getData(['module', $this->getUrl(0), 'items', $this->getUrl(2), 'editConsent']),
|
||||
'help' => 'Les utilisateurs des groupes supérieurs accèdent à l\'item sans restriction'
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col12">
|
||||
<div class="block">
|
||||
<h4>Commentaires</h4>
|
||||
<div class="row">
|
||||
<div class="col4 ">
|
||||
<?php echo template::checkbox('downloadEditCommentClose', true, 'Fermer les commentaires', [
|
||||
'checked' => $this->getData(['module', $this->getUrl(0), 'items', $this->getUrl(2), 'commentClose'])
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col4 commentOptionsWrapper ">
|
||||
<?php echo template::checkbox('downloadEditCommentApproved', true, 'Approbation par un modérateur', [
|
||||
'checked' => $this->getData(['module', $this->getUrl(0), 'items', $this->getUrl(2), 'commentApproved']),
|
||||
''
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col4 commentOptionsWrapper">
|
||||
<?php echo template::select('downloadEditCommentMaxlength', $module::$commentLength,[
|
||||
'help' => 'Choix du nombre maximum de caractères pour chaque commentaire de l\'item, mise en forme html comprise.',
|
||||
'label' => 'Caractères par commentaire',
|
||||
'selected' => $this->getData(['module', $this->getUrl(0), 'items', $this->getUrl(2), 'commentMaxlength'])
|
||||
]); ?>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col3 commentOptionsWrapper offset2">
|
||||
<?php echo template::checkbox('downloadEditCommentNotification', true, 'Notification par email', [
|
||||
'checked' => $this->getData(['module', $this->getUrl(0), 'items', $this->getUrl(2), 'commentNotification']),
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col4 commentOptionsWrapper">
|
||||
<?php echo template::select('downloadEditCommentGroupNotification', $module::$groupNews, [
|
||||
'selected' => $this->getData(['module', $this->getUrl(0), 'items', $this->getUrl(2), 'commentGroupNotification']),
|
||||
'help' => 'Editeurs = éditeurs + administrateurs<br/> Membres = membres + éditeurs + administrateurs'
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php echo template::formClose(); ?>
|
69
module/download/view/index/index.css
Normal file
69
module/download/view/index/index.css
Normal file
@ -0,0 +1,69 @@
|
||||
.rowitem {
|
||||
margin-bottom: 10px !important;
|
||||
}
|
||||
.downloadPicture {
|
||||
float: none;
|
||||
border: 1px;
|
||||
}
|
||||
.downloadPicture img {
|
||||
width: 100%;
|
||||
height: auto;
|
||||
/*
|
||||
border:1px solid lightgray;
|
||||
box-shadow: 1px 1px 5px darkgray;
|
||||
*/
|
||||
}
|
||||
|
||||
.downloadPicture:hover {
|
||||
opacity: .7;
|
||||
}
|
||||
.row:after {
|
||||
content: " ";
|
||||
display: table;
|
||||
clear: both;
|
||||
}
|
||||
.downloadComment {
|
||||
padding-right: 10px;
|
||||
float: right;
|
||||
}
|
||||
h2{
|
||||
margin-bottom: 5px;
|
||||
margin-top: 0px;
|
||||
padding: 0px;
|
||||
|
||||
}
|
||||
.downloadContent {
|
||||
float: left;
|
||||
margin-top: 5px;
|
||||
}
|
||||
.downloadDate {
|
||||
font-size:0.8em;
|
||||
font-style: italic;
|
||||
/*
|
||||
color: grey;
|
||||
*/
|
||||
}
|
||||
@media (max-width: 768px) {
|
||||
.downloadContent {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.downloadPicture img {
|
||||
width: 50% ;
|
||||
display: block;
|
||||
margin-left: auto;
|
||||
margin-right: auto;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Flux RSS
|
||||
*/
|
||||
#rssFeed {
|
||||
text-align: right;
|
||||
float: right;
|
||||
}
|
||||
#rssFeed p {
|
||||
display: inline;
|
||||
vertical-align: top;
|
||||
}
|
63
module/download/view/item/item.css
Normal file
63
module/download/view/item/item.css
Normal file
@ -0,0 +1,63 @@
|
||||
|
||||
#sectionTitle {
|
||||
margin-top: 0;
|
||||
margin-bottom: 5px;
|
||||
}
|
||||
.downloaditemPicture {
|
||||
height: auto;
|
||||
border:1px solid lightgray;
|
||||
box-shadow: 1px 1px 5px;
|
||||
}
|
||||
.downloaditemPictureleft {
|
||||
float: left;
|
||||
margin: 15px 10px 5px 0 ;
|
||||
}
|
||||
.downloaditemPictureright {
|
||||
float: right;
|
||||
margin: 15px 0 5px 10px ;
|
||||
}
|
||||
|
||||
|
||||
.pict20{
|
||||
width: 20%;
|
||||
}
|
||||
.pict30{
|
||||
width: 30%;
|
||||
}
|
||||
.pict40{
|
||||
width: 40%;
|
||||
}
|
||||
.pict50{
|
||||
width: 50%;
|
||||
}
|
||||
.pict100{
|
||||
width: 100%;
|
||||
margin: 15px 0 20px 0 ;
|
||||
}
|
||||
|
||||
#downloaditemCommentShow {
|
||||
cursor: text;
|
||||
}
|
||||
#downloaditemOr {
|
||||
padding: 10px;
|
||||
}
|
||||
.downloadDate {
|
||||
font-size:0.8em;
|
||||
font-style: italic;
|
||||
color: grey;
|
||||
}
|
||||
@media (max-width: 767px) {
|
||||
.downloaditemPicture {
|
||||
height:auto;
|
||||
max-width: 100%;}
|
||||
}
|
||||
|
||||
|
||||
#rssFeed {
|
||||
text-align: right;
|
||||
float: right;
|
||||
}
|
||||
#rssFeed p {
|
||||
display: inline;
|
||||
vertical-align: top;
|
||||
}
|
43
module/download/view/item/item.js.php
Normal file
43
module/download/view/item/item.js.php
Normal file
@ -0,0 +1,43 @@
|
||||
/**
|
||||
* 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
|
||||
* @license GNU General Public License, version 3
|
||||
* @link http://zwiicms.fr/
|
||||
*/
|
||||
|
||||
/**
|
||||
* Affiche le bloc pour rédiger un commentaire
|
||||
*/
|
||||
var commentShowDOM = $("#downloadItemCommentShow");
|
||||
commentShowDOM.on("click focus", function() {
|
||||
$("#downloadItemCommentShowWrapper").fadeOut(function() {
|
||||
$("#downloadItemCommentWrapper").fadeIn();
|
||||
$("#downloadItemCommentContent").trigger("focus");
|
||||
});
|
||||
});
|
||||
if($("#downloadItemCommentWrapper").find("textarea.notice,input.notice").length) {
|
||||
commentShowDOM.trigger("click");
|
||||
}
|
||||
|
||||
/**
|
||||
* Cache le bloc pour rédiger un commentaire
|
||||
*/
|
||||
$("#downloadItemCommentHide").on("click focus", function() {
|
||||
$("#downloadItemCommentWrapper").fadeOut(function() {
|
||||
$("#downloadItemCommentShowWrapper").fadeIn();
|
||||
$("#downloadItemCommentContent").val("");
|
||||
$("#downloadItemCommentAuthor").val("");
|
||||
});
|
||||
});
|
||||
|
||||
/**
|
||||
* Force le scroll vers les commentaires en cas d'erreur
|
||||
*/
|
||||
$("#downloadItemCommentForm").on("submit", function() {
|
||||
$(location).attr("href", "#comment");
|
||||
});
|
1
module/download/view/list/list.php
Normal file
1
module/download/view/list/list.php
Normal file
@ -0,0 +1 @@
|
||||
<!-- rien -->
|
1
module/download/view/rss/rss.php
Normal file
1
module/download/view/rss/rss.php
Normal file
@ -0,0 +1 @@
|
||||
<!-- rien -->
|
18
module/download/view/stats/stats.css
Normal file
18
module/download/view/stats/stats.css
Normal file
@ -0,0 +1,18 @@
|
||||
/**
|
||||
* 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/
|
||||
*/
|
||||
|
||||
|
||||
/** NE PAS EFFACER
|
||||
* admin.css
|
||||
*/
|
22
module/download/view/stats/stats.js.php
Normal file
22
module/download/view/stats/stats.js.php
Normal file
@ -0,0 +1,22 @@
|
||||
/**
|
||||
* 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
|
||||
* @license GNU General Public License, version 3
|
||||
* @link http://zwiicms.fr/
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* Confirmation de suppression
|
||||
*/
|
||||
$(".statsDeleteAll").on("click", function() {
|
||||
var _this = $(this);
|
||||
return core.confirm("Êtes-vous sûr de vouloir purger les statistiques ?", function() {
|
||||
$(location).attr("href", _this.attr("href"));
|
||||
});
|
||||
});
|
36
module/download/view/stats/stats.php
Normal file
36
module/download/view/stats/stats.php
Normal file
@ -0,0 +1,36 @@
|
||||
<?php echo template::formOpen('statsConfig'); ?>
|
||||
<div class="row">
|
||||
<div class="col2">
|
||||
<?php echo template::button('statsConfigBack', [
|
||||
'class' => 'buttonGrey',
|
||||
'href' => helper::baseUrl() . $this->getUrl(0) . '/config',
|
||||
'ico' => 'left',
|
||||
'value' => 'Retour'
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col2 offset8">
|
||||
<?php echo template::button('statsConfigAdd', [
|
||||
'class' => 'statsDeleteAll buttonRed',
|
||||
'href' => helper::baseUrl() . $this->getUrl(0) . '/statsDeleteAll' . '/' . $this->getUrl(2) . '/'. $_SESSION['csrf'] ,
|
||||
'ico' => 'cancel',
|
||||
'value' => 'Purger'
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
<?php echo template::formClose(); ?>
|
||||
<div class="row">
|
||||
<div class="col12">
|
||||
<h3> Nombre de téléchargements :
|
||||
<?php echo $module::$statSum; ?>
|
||||
</h3>
|
||||
</div>
|
||||
</div>
|
||||
<?php if($module::$items): ?>
|
||||
<?php echo template::table([6, 6], $module::$items, ['Date', 'Adresse IP']); ?>
|
||||
<?php echo $module::$pages; ?>
|
||||
<?php else: ?>
|
||||
<?php echo template::speech('Aucun item.'); ?>
|
||||
<?php endif; ?>
|
||||
<div class="moduleVersion">Version n°
|
||||
<?php echo $module::VERSION; ?>
|
||||
</div>
|
@ -17,7 +17,7 @@
|
||||
class gallery extends common {
|
||||
|
||||
|
||||
const VERSION = '2.6';
|
||||
const VERSION = '3.0';
|
||||
const REALNAME = 'Galerie';
|
||||
const DELETE = true;
|
||||
const UPDATE = '0.0';
|
||||
@ -143,6 +143,75 @@ class gallery extends common {
|
||||
'1px 1px 50px' => 'Très importante'
|
||||
];
|
||||
|
||||
/**
|
||||
* Mise à jour du module
|
||||
* Appelée par les fonctions index et config
|
||||
*/
|
||||
private function update() {
|
||||
|
||||
// Installation des données par défaut
|
||||
$class = get_called_class();
|
||||
$moduleId = $this->getUrl(0);
|
||||
if ( $this->getData(['module', $this->getUrl(0), 'config',]) === null ) {
|
||||
require_once('module/gallery/ressource/defaultdata.php');
|
||||
$this->setData(['module', $this->getUrl(0), 'config', theme::$defaultData]);
|
||||
|
||||
// Dossier de l'instance
|
||||
if (!is_dir(self::DATA_DIR . 'modules/' . $class)) {
|
||||
mkdir (self::DATA_DIR . 'modules/' . $class, 0777, true);
|
||||
}
|
||||
|
||||
// Nom de la feuille de style
|
||||
$fileCSS = self::DATA_DIR . 'modules/' . $class . '/' . $moduleId . '.css' ;
|
||||
$this->setData(['module', $this->getUrl(0), 'config', 'style', $fileCSS]);
|
||||
}
|
||||
|
||||
// Générer la feuille de CSS
|
||||
if (!file_exists(self::DATA_DIR . 'modules/' . $class . '/' . $moduleId . '.css' )) {
|
||||
$content = file_get_contents('module/gallery/ressource/vartheme.css');
|
||||
$themeCss = file_get_contents('module/gallery/ressource/theme.css');
|
||||
// Injection des variables
|
||||
$content = str_replace('#thumbAlign#',$this->getData(['module', $this->getUrl(0), 'config', 'thumbAlign']),$content );
|
||||
$content = str_replace('#thumbWidth#',$this->getData(['module', $this->getUrl(0), 'config', 'thumbWidth']),$content );
|
||||
$content = str_replace('#thumbHeight#',$this->getData(['module', $this->getUrl(0), 'config', 'thumbHeight']),$content );
|
||||
$content = str_replace('#thumbMargin#',$this->getData(['module', $this->getUrl(0), 'config', 'thumbMargin']),$content );
|
||||
$content = str_replace('#thumbBorder#',$this->getData(['module', $this->getUrl(0), 'config', 'thumbBorder']),$content );
|
||||
$content = str_replace('#thumbBorderColor#',$this->getData(['module', $this->getUrl(0), 'config', 'thumbBorderColor']),$content );
|
||||
$content = str_replace('#thumbOpacity#',$this->getData(['module', $this->getUrl(0), 'config', 'thumbOpacity']),$content );
|
||||
$content = str_replace('#thumbShadows#',$this->getData(['module', $this->getUrl(0), 'config', 'thumbShadows']),$content );
|
||||
$content = str_replace('#thumbShadowsColor#',$this->getData(['module', $this->getUrl(0), 'config', 'thumbShadowsColor']),$content );
|
||||
$content = str_replace('#thumbRadius#',$this->getData(['module', $this->getUrl(0), 'config', 'thumbRadius']),$content );
|
||||
$content = str_replace('#legendAlign#',$this->getData(['module', $this->getUrl(0), 'config', 'legendAlign']),$content );
|
||||
$content = str_replace('#legendHeight#',$this->getData(['module', $this->getUrl(0), 'config', 'legendHeight']),$content );
|
||||
$content = str_replace('#legendTextColor#',$this->getData(['module', $this->getUrl(0), 'config', 'legendTextColor']),$content );
|
||||
$content = str_replace('#legendBgColor#',$this->getData(['module', $this->getUrl(0), 'config', 'legendBgColor']),$content );
|
||||
// Ecriture de la feuille de style
|
||||
$success = file_put_contents(self::DATA_DIR . 'modules/' . $class . '/' . $moduleId . '.css' , $content . $themeCss);
|
||||
}
|
||||
|
||||
// Mise à jour d'une version inférieure
|
||||
if (version_compare($this->getData(['module', $this->getUrl(0), 'config', 'versionData']), '3.0', '<') ) {
|
||||
// Changement de l'arborescence dans module.json
|
||||
$data = $this->getData(['module', $this->getUrl(0)]);
|
||||
$this->deleteData(['module', $this->getUrl(0)]);
|
||||
$this->setData(['module', $this->getUrl(0), 'content', $data]);
|
||||
// Effacer les fichiers CSS de l'ancienne version
|
||||
if (file_exists('module/gallery/view/index/index.css')) {
|
||||
unlink('module/gallery/view/index/index.css');
|
||||
}
|
||||
if (file_exists('module/gallery/view/gallery/gallery.css')) {
|
||||
unlink('module/gallery/view/gallery/gallery.css');
|
||||
}
|
||||
// Stockage des données du thème de la gallery
|
||||
$data = $this->getData(['theme','gallery']);
|
||||
$this->deleteData(['theme','gallery']);
|
||||
$this->setData(['module', $this->getUrl(0), 'config', $data]);
|
||||
// Nouvelle version
|
||||
$this->setData(['module', $this->getUrl(0), 'config', 'versionData', '3.0']);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Tri de la liste des galeries
|
||||
*
|
||||
@ -152,7 +221,7 @@ class gallery extends common {
|
||||
$data = explode('&',$_POST['response']);
|
||||
$data = str_replace('galleryTable%5B%5D=','',$data);
|
||||
for($i=0;$i<count($data);$i++) {
|
||||
$this->setData(['module', $this->getUrl(0), $data[$i], [
|
||||
$this->setData(['module', $this->getUrl(0), 'content', $data[$i], [
|
||||
'config' => [
|
||||
'name' => $this->getData(['module',$this->getUrl(0),$data[$i],'config','name']),
|
||||
'directory' => $this->getData(['module',$this->getUrl(0),$data[$i],'config','directory']),
|
||||
@ -179,7 +248,7 @@ class gallery extends common {
|
||||
$data = explode('&',$_POST['response']);
|
||||
$data = str_replace('galleryTable%5B%5D=','',$data);
|
||||
// Sauvegarder
|
||||
$this->setData(['module', $this->getUrl(0), $galleryName, [
|
||||
$this->setData(['module', $this->getUrl(0), 'content', $galleryName, [
|
||||
'config' => [
|
||||
'name' => $this->getData(['module',$this->getUrl(0),$galleryName,'config','name']),
|
||||
'directory' => $this->getData(['module',$this->getUrl(0),$galleryName,'config','directory']),
|
||||
@ -200,8 +269,11 @@ class gallery extends common {
|
||||
* Configuration
|
||||
*/
|
||||
public function config() {
|
||||
// Mise à jour des données de module
|
||||
$this->update();
|
||||
|
||||
//Affichage de la galerie triée
|
||||
$g = $this->getData(['module', $this->getUrl(0)]);
|
||||
$g = $this->getData(['module', $this->getUrl(0), 'content']);
|
||||
$p = helper::arrayCollumn(helper::arrayCollumn($g,'config'),'position');
|
||||
asort($p,SORT_NUMERIC);
|
||||
$galleries = [];
|
||||
@ -243,7 +315,7 @@ class gallery extends common {
|
||||
// Soumission du formulaire d'ajout d'une galerie
|
||||
if($this->isPost()) {
|
||||
if (!$this->getInput('galleryConfigFilterResponse')) {
|
||||
$galleryId = helper::increment($this->getInput('galleryConfigName', helper::FILTER_ID, true), (array) $this->getData(['module', $this->getUrl(0)]));
|
||||
$galleryId = helper::increment($this->getInput('galleryConfigName', helper::FILTER_ID, true), (array) $this->getData(['module', $this->getUrl(0), 'content']));
|
||||
// définir une vignette par défaut
|
||||
$directory = $this->getInput('galleryConfigDirectory', helper::FILTER_STRING_SHORT, true);
|
||||
$iterator = new DirectoryIterator($directory);
|
||||
@ -260,13 +332,13 @@ class gallery extends common {
|
||||
break;
|
||||
}
|
||||
}
|
||||
$this->setData(['module', $this->getUrl(0), $galleryId, [
|
||||
$this->setData(['module', $this->getUrl(0), 'content', $galleryId, [
|
||||
'config' => [
|
||||
'name' => $this->getInput('galleryConfigName'),
|
||||
'directory' => $this->getInput('galleryConfigDirectory', helper::FILTER_STRING_SHORT, true),
|
||||
'homePicture' => $homePicture,
|
||||
'sort' => self::SORT_ASC,
|
||||
'position' => $this->getData(['module', $this->getUrl(0), $galleryId,'config','position']),
|
||||
'position' => $this->getData(['module', $this->getUrl(0), 'content', $galleryId,'config','position']),
|
||||
'fullScreen' => false
|
||||
],
|
||||
'legend' => [],
|
||||
@ -296,7 +368,7 @@ class gallery extends common {
|
||||
public function delete() {
|
||||
// $url prend l'adresse sans le token
|
||||
// La galerie n'existe pas
|
||||
if($this->getData(['module', $this->getUrl(0), $this->getUrl(2)]) === null) {
|
||||
if($this->getData(['module', $this->getUrl(0), 'content', $this->getUrl(2)]) === null) {
|
||||
// Valeurs en sortie
|
||||
$this->addOutput([
|
||||
'access' => false
|
||||
@ -312,7 +384,7 @@ class gallery extends common {
|
||||
}
|
||||
// Suppression
|
||||
else {
|
||||
$this->deleteData(['module', $this->getUrl(0), $this->getUrl(2)]);
|
||||
$this->deleteData(['module', $this->getUrl(0), 'content', $this->getUrl(2)]);
|
||||
// Valeurs en sortie
|
||||
$this->addOutput([
|
||||
'redirect' => helper::baseUrl() . $this->getUrl(0) . '/config',
|
||||
@ -346,7 +418,7 @@ class gallery extends common {
|
||||
]);
|
||||
}
|
||||
// La galerie n'existe pas
|
||||
if($this->getData(['module', $this->getUrl(0), $this->getUrl(2)]) === null) {
|
||||
if($this->getData(['module', $this->getUrl(0), 'content', $this->getUrl(2)]) === null) {
|
||||
// Valeurs en sortie
|
||||
$this->addOutput([
|
||||
'access' => false
|
||||
@ -360,11 +432,11 @@ class gallery extends common {
|
||||
$galleryId = !empty($this->getInput('galleryEditName')) ? $this->getInput('galleryEditName', helper::FILTER_ID, true) : $this->getUrl(2);
|
||||
if($galleryId !== $this->getUrl(2)) {
|
||||
// Incrémente le nouvel id de la galerie
|
||||
$galleryId = helper::increment($galleryId, $this->getData(['module', $this->getUrl(0)]));
|
||||
$galleryId = helper::increment($galleryId, $this->getData(['module', $this->getUrl(0), 'content']));
|
||||
// Transférer la position des images
|
||||
$oldPositions = $this->getData(['module',$this->getUrl(0), $this->getUrl(2),'positions']);
|
||||
// Supprime l'ancienne galerie
|
||||
$this->deleteData(['module', $this->getUrl(0), $this->getUrl(2)]);
|
||||
$this->deleteData(['module', $this->getUrl(0), 'content', $this->getUrl(2)]);
|
||||
}
|
||||
// légendes
|
||||
$legends = [];
|
||||
@ -382,19 +454,19 @@ class gallery extends common {
|
||||
}
|
||||
// Sauvegarder
|
||||
if ($this->getInput('galleryEditName')) {
|
||||
$this->setData(['module', $this->getUrl(0), $galleryId, [
|
||||
$this->setData(['module', $this->getUrl(0), 'content', $galleryId, [
|
||||
'config' => [
|
||||
'name' => $this->getInput('galleryEditName', helper::FILTER_STRING_SHORT, true),
|
||||
'directory' => $this->getInput('galleryEditDirectory', helper::FILTER_STRING_SHORT, true),
|
||||
'homePicture' => $homePicture,
|
||||
// pas de positions, on active le tri alpha
|
||||
'sort' => $this->getInput('galleryEditSort'),
|
||||
'position' => $this->getData(['module', $this->getUrl(0), $galleryId,'config','position']),
|
||||
'position' => $this->getData(['module', $this->getUrl(0), 'content', $galleryId,'config','position']),
|
||||
'fullScreen' => $this->getInput('galleryEditFullscreen', helper::FILTER_BOOLEAN)
|
||||
|
||||
],
|
||||
'legend' => $legends,
|
||||
'positions' => empty($oldPositions) ? $this->getdata(['module', $this->getUrl(0), $galleryId, 'positions']) : $oldPositions
|
||||
'positions' => empty($oldPositions) ? $this->getdata(['module', $this->getUrl(0), 'content', $galleryId, 'positions']) : $oldPositions
|
||||
]]);
|
||||
}
|
||||
// Valeurs en sortie
|
||||
@ -405,7 +477,7 @@ class gallery extends common {
|
||||
]);
|
||||
}
|
||||
// Met en forme le tableau
|
||||
$directory = $this->getData(['module', $this->getUrl(0), $this->getUrl(2), 'config', 'directory']);
|
||||
$directory = $this->getData(['module', $this->getUrl(0), 'content', $this->getUrl(2), 'config', 'directory']);
|
||||
if(is_dir($directory)) {
|
||||
$iterator = new DirectoryIterator($directory);
|
||||
|
||||
@ -421,11 +493,11 @@ class gallery extends common {
|
||||
template::ico('sort'),
|
||||
$fileInfos->getFilename(),
|
||||
template::checkbox( 'homePicture[' . $fileInfos->getFilename() . ']', true, '', [
|
||||
'checked' => $this->getData(['module', $this->getUrl(0), $this->getUrl(2),'config', 'homePicture']) === $fileInfos->getFilename() ? true : false,
|
||||
'checked' => $this->getData(['module', $this->getUrl(0), 'content', $this->getUrl(2),'config', 'homePicture']) === $fileInfos->getFilename() ? true : false,
|
||||
'class' => 'homePicture'
|
||||
]),
|
||||
template::text('legend[' . $fileInfos->getFilename() . ']', [
|
||||
'value' => $this->getData(['module', $this->getUrl(0), $this->getUrl(2), 'legend', str_replace('.','',$fileInfos->getFilename())])
|
||||
'value' => $this->getData(['module', $this->getUrl(0), 'content', $this->getUrl(2), 'legend', str_replace('.','',$fileInfos->getFilename())])
|
||||
]),
|
||||
'<a href="' . str_replace('source','thumb',$directory) . '/' . self::THUMBS_SEPARATOR . $fileInfos->getFilename() .'" rel="data-lity" data-lity=""><img src="'. str_replace('source','thumb',$directory) . '/' . $fileInfos->getFilename() . '"></a>'
|
||||
];
|
||||
@ -433,7 +505,7 @@ class gallery extends common {
|
||||
}
|
||||
}
|
||||
// Tri des images
|
||||
switch ($this->getData(['module', $this->getUrl(0), $this->getUrl(2), 'config', 'sort'])) {
|
||||
switch ($this->getData(['module', $this->getUrl(0), 'content', $this->getUrl(2), 'config', 'sort'])) {
|
||||
case self::SORT_HAND:
|
||||
$positions = $this->getdata(['module',$this->getUrl(0), $this->getUrl(2),'positions']);
|
||||
if ($positions) {
|
||||
@ -466,7 +538,7 @@ class gallery extends common {
|
||||
}
|
||||
// Valeurs en sortie
|
||||
$this->addOutput([
|
||||
'title' => $this->getData(['module', $this->getUrl(0), $this->getUrl(2), 'config', 'name']),
|
||||
'title' => $this->getData(['module', $this->getUrl(0), 'content', $this->getUrl(2), 'config', 'name']),
|
||||
'view' => 'edit',
|
||||
'vendor' => [
|
||||
'tablednd'
|
||||
@ -479,10 +551,12 @@ class gallery extends common {
|
||||
* Accueil (deux affichages en un pour éviter une url à rallonge)
|
||||
*/
|
||||
public function index() {
|
||||
// Mise à jour des données de module
|
||||
$this->update();
|
||||
// Images d'une galerie
|
||||
if($this->getUrl(1)) {
|
||||
// La galerie n'existe pas
|
||||
if($this->getData(['module', $this->getUrl(0), $this->getUrl(1)]) === null) {
|
||||
if($this->getData(['module', $this->getUrl(0), 'content', $this->getUrl(1)]) === null) {
|
||||
// Valeurs en sortie
|
||||
$this->addOutput([
|
||||
'access' => false
|
||||
@ -491,13 +565,13 @@ class gallery extends common {
|
||||
// La galerie existe
|
||||
else {
|
||||
// Images de la galerie
|
||||
$directory = $this->getData(['module', $this->getUrl(0), $this->getUrl(1), 'config', 'directory']);
|
||||
$directory = $this->getData(['module', $this->getUrl(0), 'content', $this->getUrl(1), 'config', 'directory']);
|
||||
if(is_dir($directory)) {
|
||||
$iterator = new DirectoryIterator($directory);
|
||||
foreach($iterator as $fileInfos) {
|
||||
if($fileInfos->isDot() === false AND $fileInfos->isFile() AND @getimagesize($fileInfos->getPathname())) {
|
||||
self::$pictures[$directory . '/' . $fileInfos->getFilename()] = $this->getData(['module', $this->getUrl(0), $this->getUrl(1), 'legend', str_replace('.','',$fileInfos->getFilename())]);
|
||||
$picturesSort[$directory . '/' . $fileInfos->getFilename()] = $this->getData(['module', $this->getUrl(0), $this->getUrl(1), 'positions', str_replace('.','',$fileInfos->getFilename())]);
|
||||
self::$pictures[$directory . '/' . $fileInfos->getFilename()] = $this->getData(['module', $this->getUrl(0), 'content', $this->getUrl(1), 'legend', str_replace('.','',$fileInfos->getFilename())]);
|
||||
$picturesSort[$directory . '/' . $fileInfos->getFilename()] = $this->getData(['module', $this->getUrl(0), 'content', $this->getUrl(1), 'positions', str_replace('.','',$fileInfos->getFilename())]);
|
||||
// Créer la miniature si manquante
|
||||
if (!file_exists( str_replace('source','thumb',$fileInfos->getPath()) . '/' . self::THUMBS_SEPARATOR . strtolower($fileInfos->getFilename()))) {
|
||||
$this->makeThumb($fileInfos->getPathname(),
|
||||
@ -511,7 +585,7 @@ class gallery extends common {
|
||||
}
|
||||
}
|
||||
// Tri des images par ordre alphabétique
|
||||
switch ($this->getData(['module', $this->getUrl(0), $this->getUrl(1), 'config', 'sort'])) {
|
||||
switch ($this->getData(['module', $this->getUrl(0), 'content', $this->getUrl(1), 'config', 'sort'])) {
|
||||
case self::SORT_HAND:
|
||||
asort($picturesSort);
|
||||
if ($picturesSort) {
|
||||
@ -535,8 +609,9 @@ class gallery extends common {
|
||||
// Valeurs en sortie
|
||||
$this->addOutput([
|
||||
'showBarEditButton' => true,
|
||||
'title' => $this->getData(['module', $this->getUrl(0), $this->getUrl(1), 'config', 'name']),
|
||||
'view' => 'gallery'
|
||||
'title' => $this->getData(['module', $this->getUrl(0), 'content', $this->getUrl(1), 'config', 'name']),
|
||||
'view' => 'gallery',
|
||||
'style' => $this->getData(['module', $this->getUrl(0), 'config', 'style'])
|
||||
]);
|
||||
}
|
||||
// Pas d'image dans la galerie
|
||||
@ -552,7 +627,7 @@ class gallery extends common {
|
||||
// Liste des galeries
|
||||
else {
|
||||
// Tri des galeries suivant l'ordre défini
|
||||
$g = $this->getData(['module', $this->getUrl(0)]);
|
||||
$g = $this->getData(['module', $this->getUrl(0), 'content']);
|
||||
$p = helper::arrayCollumn(helper::arrayCollumn($g,'config'),'position');
|
||||
asort($p,SORT_NUMERIC);
|
||||
$galleries = [];
|
||||
@ -598,7 +673,8 @@ class gallery extends common {
|
||||
$this->addOutput([
|
||||
'showBarEditButton' => true,
|
||||
'showPageContent' => true,
|
||||
'view' => 'index'
|
||||
'view' => 'index',
|
||||
'style' => $this->getData(['module', $this->getUrl(0), 'config', 'style'])
|
||||
]);
|
||||
}
|
||||
}
|
||||
@ -615,16 +691,19 @@ class gallery extends common {
|
||||
'notification' => 'Action non autorisée'
|
||||
]);
|
||||
}
|
||||
// Initialisation des données de thème de la galerie dasn theme.json
|
||||
// Création des valeur par défaut absentes
|
||||
if ( $this->getData(['theme', 'gallery']) === null ) {
|
||||
require_once('module/gallery/ressource/defaultdata.php');
|
||||
$this->setData(['theme', 'gallery', theme::$defaultData]);
|
||||
}
|
||||
// Soumission du formulaire
|
||||
|
||||
if($this->isPost()) {
|
||||
$this->setData(['theme', 'gallery', [
|
||||
|
||||
// Générer la feuille de CSS
|
||||
$class = get_called_class();
|
||||
$moduleId = $this->getUrl(0);
|
||||
// Dossier de l'instance
|
||||
if (!is_dir(self::DATA_DIR . 'modules/' . $class)) {
|
||||
mkdir (self::DATA_DIR . 'modules/' . $class, 0777, true);
|
||||
}
|
||||
$fileCSS = self::DATA_DIR . 'modules/' . $class . '/' . $moduleId . '.css' ;
|
||||
// Fin feuille de style
|
||||
$this->getData(['module', $this->getUrl(0), 'config', [
|
||||
'thumbAlign' => $this->getinput('galleryThemeThumbAlign'),
|
||||
'thumbWidth' => $this->getinput('galleryThemeThumbWidth'),
|
||||
'thumbHeight' => $this->getinput('galleryThemeThumbHeight'),
|
||||
@ -638,7 +717,9 @@ class gallery extends common {
|
||||
'legendHeight' => $this->getinput('galleryThemeLegendHeight'),
|
||||
'legendAlign' => $this->getinput('galleryThemeLegendAlign'),
|
||||
'legendTextColor' => $this->getinput('galleryThemeLegendTextColor'),
|
||||
'legendBgColor' => $this->getinput('galleryThemeLegendBgColor')
|
||||
'legendBgColor' => $this->getinput('galleryThemeLegendBgColor'),
|
||||
'style' => $fileCSS,
|
||||
'version' => $this->getData(['module', $this->getUrl(0), 'config', 'version'])
|
||||
]
|
||||
]);
|
||||
// Création des fichiers CSS
|
||||
@ -659,12 +740,11 @@ class gallery extends common {
|
||||
$content = str_replace('#legendHeight#',$this->getinput('galleryThemeLegendHeight'),$content );
|
||||
$content = str_replace('#legendTextColor#',$this->getinput('galleryThemeLegendTextColor'),$content );
|
||||
$content = str_replace('#legendBgColor#',$this->getinput('galleryThemeLegendBgColor'),$content );
|
||||
$success = file_put_contents('module/gallery/view/index/index.css',$content . $themeCss);
|
||||
$success = $success && file_put_contents('module/gallery/view/gallery/gallery.css',$content . $themeCss);
|
||||
$success = file_put_contents($fileCSS, $content . $themeCss);
|
||||
// Valeurs en sortie
|
||||
$this->addOutput([
|
||||
'redirect' => helper::baseUrl() . $this->getUrl() . '/theme',
|
||||
'notification' => $success !== FALSE ? 'Modifications enregistrées' : 'Modifications non enregistées !',
|
||||
'notification' => $success !== FALSE ? 'Modifications enregistrées' : 'Modifications non enregistrées !',
|
||||
'state' => $success !== FALSE
|
||||
]);
|
||||
}
|
||||
|
@ -14,6 +14,7 @@ class theme extends gallery {
|
||||
'legendHeight' => '.375em',
|
||||
'legendAlign' => 'center',
|
||||
'legendTextColor' => 'rgba(255, 255, 255, 1)',
|
||||
'legendBgColor' => 'rgba(0, 0, 0, .6)'
|
||||
'legendBgColor' => 'rgba(0, 0, 0, .6)',
|
||||
'versionData' => '3.0'
|
||||
];
|
||||
}
|
||||
|
@ -20,12 +20,12 @@
|
||||
<div class="col5">
|
||||
<?php echo template::text('galleryEditName', [
|
||||
'label' => 'Nom',
|
||||
'value' => $this->getData(['module', $this->getUrl(0), $this->getUrl(2), 'config', 'name'])
|
||||
'value' => $this->getData(['module', $this->getUrl(0), 'content', $this->getUrl(2), 'config', 'name'])
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col4">
|
||||
<?php echo template::hidden('galleryEditDirectoryOld', [
|
||||
'value' => $this->getData(['module', $this->getUrl(0), $this->getUrl(2), 'config', 'directory']),
|
||||
'value' => $this->getData(['module', $this->getUrl(0), 'content', $this->getUrl(2), 'config', 'directory']),
|
||||
'noDirty' => true // Désactivé à cause des modifications en ajax
|
||||
]); ?>
|
||||
<?php echo template::select('galleryEditDirectory', [], [
|
||||
@ -35,7 +35,7 @@
|
||||
</div>
|
||||
<div class="col3">
|
||||
<?php echo template::select('galleryEditSort', $module::$sort, [
|
||||
'selected' => $this->getData(['module', $this->getUrl(0), $this->getUrl(2), 'config', 'sort']),
|
||||
'selected' => $this->getData(['module', $this->getUrl(0), 'content', $this->getUrl(2), 'config', 'sort']),
|
||||
'label' => 'Tri des images',
|
||||
'help' => 'Tri manuel : déplacez le images dans le tableau ci-dessous. L\'ordre est sauvegardé automatiquement.'
|
||||
]); ?>
|
||||
@ -43,7 +43,7 @@
|
||||
<div clas="row">
|
||||
<div class="col12">
|
||||
<?php echo template::checkbox('galleryEditFullscreen', true, 'Mode plein écran automatique' , [
|
||||
'checked' => $this->getData(['module', $this->getUrl(0), $this->getUrl(2), 'config', 'fullScreen']),
|
||||
'checked' => $this->getData(['module', $this->getUrl(0), 'content', $this->getUrl(2), 'config', 'fullScreen']),
|
||||
'help' => 'A l\'ouverture de la galerie, la première image est affichée en plein écran.'
|
||||
]); ?>
|
||||
</div>
|
||||
|
@ -25,25 +25,25 @@
|
||||
<div class="col3">
|
||||
<?php echo template::select('galleryThemeThumbWidth', $module::$galleryThemeSizeWidth, [
|
||||
'label' => 'Largeur',
|
||||
'selected' => $this->getData(['theme', 'gallery','thumbWidth'])
|
||||
'selected' => $this->getData(['module', $this->getUrl(0), 'config','thumbWidth'])
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col3">
|
||||
<?php echo template::select('galleryThemeThumbHeight', $module::$galleryThemeSizeHeight, [
|
||||
'label' => 'Hauteur',
|
||||
'selected' => $this->getData(['theme', 'gallery','thumbHeight'])
|
||||
'selected' => $this->getData(['module', $this->getUrl(0), 'config','thumbHeight'])
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col4">
|
||||
<?php echo template::select('galleryThemeThumbAlign', $module::$galleryThemeFlexAlign, [
|
||||
'label' => 'Alignement',
|
||||
'selected' => $this->getData(['theme', 'gallery','thumbAlign'])
|
||||
'selected' => $this->getData(['module', $this->getUrl(0), 'config','thumbAlign'])
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col2">
|
||||
<?php echo template::select('galleryThemeThumbMargin', $module::$galleryThemeMargin, [
|
||||
'label' => 'Marge',
|
||||
'selected' => $this->getData(['theme', 'gallery','thumbMargin'])
|
||||
'selected' => $this->getData(['module', $this->getUrl(0), 'config','thumbMargin'])
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
@ -51,7 +51,7 @@
|
||||
<div class="col4">
|
||||
<?php echo template::select('galleryThemeThumbBorder', $module::$galleryThemeBorder, [
|
||||
'label' => 'Bordure',
|
||||
'selected' => $this->getData(['theme', 'gallery','thumbBorder'])
|
||||
'selected' => $this->getData(['module', $this->getUrl(0), 'config','thumbBorder'])
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col4">
|
||||
@ -59,13 +59,13 @@
|
||||
'class' => 'colorPicker',
|
||||
'help' => 'Le curseur horizontal règle le niveau de transparence.',
|
||||
'label' => 'Couleur de la bordure',
|
||||
'value' => $this->getData(['theme', 'gallery','thumbBorderColor'])
|
||||
'value' => $this->getData(['module', $this->getUrl(0), 'config','thumbBorderColor'])
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col4">
|
||||
<?php echo template::select('galleryThemeThumbRadius', $module::$galleryThemeRadius, [
|
||||
'label' => 'Arrondi des angles',
|
||||
'selected' => $this->getData(['theme', 'gallery','thumbRadius'])
|
||||
'selected' => $this->getData(['module', $this->getUrl(0), 'config','thumbRadius'])
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
@ -73,7 +73,7 @@
|
||||
<div class="col4">
|
||||
<?php echo template::select('galleryThemeThumbShadows', $module::$galleryThemeShadows, [
|
||||
'label' => 'Ombre',
|
||||
'selected' => $this->getData(['theme', 'gallery','thumbShadows'])
|
||||
'selected' => $this->getData(['module', $this->getUrl(0), 'config','thumbShadows'])
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col4">
|
||||
@ -81,13 +81,13 @@
|
||||
'class' => 'colorPicker',
|
||||
'help' => 'Le curseur horizontal règle le niveau de transparence.',
|
||||
'label' => 'Couleur de l\'ombre',
|
||||
'value' => $this->getData(['theme', 'gallery','thumbShadowsColor'])
|
||||
'value' => $this->getData(['module', $this->getUrl(0), 'config','thumbShadowsColor'])
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col4">
|
||||
<?php echo template::select('galleryThemeThumbOpacity', $module::$galleryThemeOpacity, [
|
||||
'label' => 'Opacité au survol',
|
||||
'selected' => $this->getData(['theme', 'gallery','thumbOpacity'])
|
||||
'selected' => $this->getData(['module', $this->getUrl(0), 'config','thumbOpacity'])
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
@ -108,7 +108,7 @@
|
||||
'class' => 'colorPicker',
|
||||
'help' => 'Le curseur horizontal règle le niveau de transparence.',
|
||||
'label' => 'Texte',
|
||||
'value' => $this->getData(['theme', 'gallery','legendTextColor'])
|
||||
'value' => $this->getData(['module', $this->getUrl(0), 'config','legendTextColor'])
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col3">
|
||||
@ -116,19 +116,19 @@
|
||||
'class' => 'colorPicker',
|
||||
'help' => 'Le curseur horizontal règle le niveau de transparence.',
|
||||
'label' => 'Fond',
|
||||
'value' => $this->getData(['theme', 'gallery','legendBgColor'])
|
||||
'value' => $this->getData(['module', $this->getUrl(0), 'config','legendBgColor'])
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col3">
|
||||
<?php echo template::select('galleryThemeLegendHeight', $module::$galleryThemeLegendHeight, [
|
||||
'label' => 'Hauteur',
|
||||
'selected' => $this->getData(['theme', 'gallery','legendHeight'])
|
||||
'selected' => $this->getData(['module', $this->getUrl(0), 'config','legendHeight'])
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col3">
|
||||
<?php echo template::select('galleryThemeLegendAlign', $module::$galleryThemeAlign, [
|
||||
'label' => 'Alignement',
|
||||
'selected' => $this->getData(['theme', 'gallery','legendAlign'])
|
||||
'selected' => $this->getData(['module', $this->getUrl(0), 'config','legendAlign'])
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -15,7 +15,7 @@
|
||||
|
||||
class news extends common {
|
||||
|
||||
const VERSION = '2.3';
|
||||
const VERSION = '3.0';
|
||||
const REALNAME = 'Actualités';
|
||||
const DELETE = true;
|
||||
const UPDATE = '0.0';
|
||||
@ -43,11 +43,51 @@ class news extends common {
|
||||
|
||||
public static $users = [];
|
||||
|
||||
// Nombre d'objets par page
|
||||
public static $ItemsList = [
|
||||
4 => '4 articles',
|
||||
8 => '8 articles',
|
||||
12 => '12 articles',
|
||||
16 => '16 articles',
|
||||
22 => '22 articles'
|
||||
];
|
||||
// Nombre de colone par page
|
||||
public static $Columns = [
|
||||
12 => '1 Colonne',
|
||||
6 => '2 Colonnes',
|
||||
4 => '3 Colonnes',
|
||||
2 => '4 Colonnes'
|
||||
];
|
||||
public static $nbrCol = 1;
|
||||
|
||||
public static $ItemsHeight = [
|
||||
'200px' => 'Petit',
|
||||
'300px' => 'Moyen',
|
||||
'400px' => 'Grand'
|
||||
];
|
||||
|
||||
// Signature de l'article
|
||||
public static $articleSignature = '';
|
||||
|
||||
|
||||
/**
|
||||
* Mise à jour du module
|
||||
* Appelée par les fonctions index et config
|
||||
*/
|
||||
private function update() {
|
||||
// Version 3.0
|
||||
if (version_compare($this->getData(['module', $this->getUrl(0), 'config', 'versionData']), '3.0', '<') ) {
|
||||
$this->setData(['module', $this->getUrl(0), 'config', 'itemsperPage', 16]);
|
||||
$this->setData(['module', $this->getUrl(0), 'config', 'itemsperCol', 6]);
|
||||
$this->setData(['module', $this->getUrl(0), 'config', 'versionData','3.0']);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Flux RSS
|
||||
*/
|
||||
public function rss() {
|
||||
|
||||
// Inclure les classes
|
||||
include_once 'module/news/vendor/FeedWriter/Item.php';
|
||||
include_once 'module/news/vendor/FeedWriter/Feed.php';
|
||||
@ -68,7 +108,7 @@ class news extends common {
|
||||
// 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']) );
|
||||
$newsIdsPublishedOns = array_slice($newsIdsPublishedOns, 0, $this->getData(['module', $this->getUrl(0), '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]) {
|
||||
@ -95,7 +135,7 @@ class news extends common {
|
||||
}
|
||||
|
||||
/**
|
||||
* Édition
|
||||
* Ajout d'un article
|
||||
*/
|
||||
public function add() {
|
||||
// Soumission du formulaire
|
||||
@ -138,11 +178,32 @@ class news extends common {
|
||||
* Configuration
|
||||
*/
|
||||
public function config() {
|
||||
// Mise à jour des données de module
|
||||
$this->update();
|
||||
|
||||
// Soumission du formulaire
|
||||
if($this->isPost()) {
|
||||
|
||||
// Générer la feuille de CSS
|
||||
$class = get_called_class();
|
||||
$moduleId = $this->getUrl(0);
|
||||
$style = '.newsContent {height:' . $this->getInput('newsConfigItemsHeight',helper::FILTER_STRING_SHORT) . ';}';
|
||||
// Dossier de l'instance
|
||||
if (!is_dir(self::DATA_DIR . 'modules/' . $class)) {
|
||||
mkdir (self::DATA_DIR . 'modules/' . $class, 0777, true);
|
||||
}
|
||||
|
||||
$success = file_put_contents(self::DATA_DIR . 'modules/' . $class . '/' . $moduleId . '.css' , $style );
|
||||
// Fin feuille de style
|
||||
|
||||
$this->setData(['module', $this->getUrl(0), 'config',[
|
||||
'feeds' => $this->getInput('newsConfigShowFeeds',helper::FILTER_BOOLEAN),
|
||||
'feedsLabel' => $this->getInput('newsConfigFeedslabel',helper::FILTER_STRING_SHORT)
|
||||
'feedsLabel' => $this->getInput('newsConfigFeedslabel',helper::FILTER_STRING_SHORT),
|
||||
'itemsperPage' => $this->getInput('newsConfigItemsperPage', helper::FILTER_INT,true),
|
||||
'itemsperCol' => $this->getInput('newsConfigItemsperCol', helper::FILTER_INT,true),
|
||||
'itemsHeight' => $this->getInput('newsConfigItemsHeight',helper::FILTER_STRING_SHORT),
|
||||
'versionData' => $this->getData(['module', $this->getUrl(0), 'config', 'versionData']),
|
||||
'style' => $success ? self::DATA_DIR . 'modules/' . $class . '/' . $moduleId . '.css' : ''
|
||||
]]);
|
||||
// Valeurs en sortie
|
||||
$this->addOutput([
|
||||
@ -154,7 +215,7 @@ class news extends common {
|
||||
// Ids des news par ordre de publication
|
||||
$newsIds = array_keys(helper::arrayCollumn($this->getData(['module', $this->getUrl(0), 'posts']), 'publishedOn', 'SORT_DESC'));
|
||||
// Pagination
|
||||
$pagination = helper::pagination($newsIds, $this->getUrl(),$this->getData(['config','itemsperPage']));
|
||||
$pagination = helper::pagination($newsIds, $this->getUrl(),$this->getData(['module', $this->getUrl(0), 'config', 'itemsperPage']) );
|
||||
// Liste des pages
|
||||
self::$pages = $pagination['pages'];
|
||||
// News en fonction de la pagination
|
||||
@ -288,30 +349,64 @@ class news extends common {
|
||||
* Accueil
|
||||
*/
|
||||
public function index() {
|
||||
// Ids des news par ordre de publication
|
||||
$newsIdsPublishedOns = helper::arrayCollumn($this->getData(['module', $this->getUrl(0), 'posts']), 'publishedOn', 'SORT_DESC');
|
||||
$newsIdsStates = helper::arrayCollumn($this->getData(['module', $this->getUrl(0), 'posts']), 'state', 'SORT_DESC');
|
||||
$newsIds = [];
|
||||
foreach($newsIdsPublishedOns as $newsId => $newsPublishedOn) {
|
||||
if($newsPublishedOn <= time() AND $newsIdsStates[$newsId]) {
|
||||
$newsIds[] = $newsId;
|
||||
// Mise à jour des données de module
|
||||
$this->update();
|
||||
// Affichage d'un article
|
||||
if(
|
||||
$this->getUrl(1)
|
||||
// Protection pour la pagination, un ID ne peut pas être un entier, une page oui
|
||||
AND intval($this->getUrl(1)) === 0
|
||||
) {
|
||||
// L'article n'existe pas
|
||||
if($this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1)]) === null) {
|
||||
// Valeurs en sortie
|
||||
$this->addOutput([
|
||||
'access' => false
|
||||
]);
|
||||
}
|
||||
// L'article existe
|
||||
else {
|
||||
self::$articleSignature = $this->signature($this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'userId']));
|
||||
// Valeurs en sortie
|
||||
$this->addOutput([
|
||||
'showBarEditButton' => true,
|
||||
'title' => $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'title']),
|
||||
'view' => 'article'
|
||||
]);
|
||||
|
||||
}
|
||||
} else {
|
||||
// Affichage index
|
||||
// Ids des news par ordre de publication
|
||||
$newsIdsPublishedOns = helper::arrayCollumn($this->getData(['module', $this->getUrl(0), 'posts']), 'publishedOn', 'SORT_DESC');
|
||||
$newsIdsStates = helper::arrayCollumn($this->getData(['module', $this->getUrl(0), 'posts']), 'state', 'SORT_DESC');
|
||||
$newsIds = [];
|
||||
foreach($newsIdsPublishedOns as $newsId => $newsPublishedOn) {
|
||||
if($newsPublishedOn <= time() AND $newsIdsStates[$newsId]) {
|
||||
$newsIds[] = $newsId;
|
||||
}
|
||||
}
|
||||
// Pagination
|
||||
//$pagination = helper::pagination($newsIds, $this->getUrl(),$this->getData(['config','itemsperPage']));
|
||||
$pagination = helper::pagination($newsIds, $this->getUrl(),$this->getData(['module', $this->getUrl(0),'config', 'itemsperPage']));
|
||||
// Nombre de colonnes
|
||||
self::$nbrCol = $this->getData(['module', $this->getUrl(0),'config', 'itemsperCol']);
|
||||
// Liste des pages
|
||||
self::$pages = $pagination['pages'];
|
||||
// News en fonction de la pagination
|
||||
for($i = $pagination['first']; $i < $pagination['last']; $i++) {
|
||||
self::$news[$newsIds[$i]] = $this->getData(['module', $this->getUrl(0),'posts', $newsIds[$i]]);
|
||||
self::$news[$newsIds[$i]]['userId'] = $this->signature($this->getData(['module', $this->getUrl(0), 'posts', $newsIds[$i], 'userId']));
|
||||
}
|
||||
// Valeurs en sortie
|
||||
$this->addOutput([
|
||||
'showBarEditButton' => true,
|
||||
'showPageContent' => true,
|
||||
'view' => 'index',
|
||||
'style' => $this->getData(['module', $this->getUrl(0),'config', 'style'])
|
||||
]);
|
||||
|
||||
}
|
||||
// Pagination
|
||||
$pagination = helper::pagination($newsIds, $this->getUrl(),$this->getData(['config','itemsperPage']));
|
||||
// Liste des pages
|
||||
self::$pages = $pagination['pages'];
|
||||
// News en fonction de la pagination
|
||||
for($i = $pagination['first']; $i < $pagination['last']; $i++) {
|
||||
self::$news[$newsIds[$i]] = $this->getData(['module', $this->getUrl(0),'posts', $newsIds[$i]]);
|
||||
self::$news[$newsIds[$i]]['userId'] = $this->signature($this->getData(['module', $this->getUrl(0), 'posts', $newsIds[$i], 'userId']));
|
||||
}
|
||||
// Valeurs en sortie
|
||||
$this->addOutput([
|
||||
'showBarEditButton' => true,
|
||||
'showPageContent' => true,
|
||||
'view' => 'index'
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
|
20
module/news/view/article/article.css
Normal file
20
module/news/view/article/article.css
Normal file
@ -0,0 +1,20 @@
|
||||
|
||||
/**
|
||||
* @author Frédéric Tempez <frederic.tempez@outlook.com>
|
||||
* @copyright Copyright (C) 2018-2021, Frédéric Tempez
|
||||
* @license GNU General Public License, version 3
|
||||
* @link http://zwiicms.fr/
|
||||
*/
|
||||
|
||||
/*
|
||||
* Module news
|
||||
*/
|
||||
|
||||
#rssFeed {
|
||||
text-align: right;
|
||||
float: right;
|
||||
}
|
||||
#rssFeed p {
|
||||
display: inline;
|
||||
vertical-align: top;
|
||||
}
|
@ -20,26 +20,48 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col12">
|
||||
<div class="block">
|
||||
<h4>Paramètres du module</h4>
|
||||
<div class="row">
|
||||
<div class="col6">
|
||||
<?php echo template::checkbox('newsConfigShowFeeds', true, 'Lien du flux RSS', [
|
||||
'checked' => $this->getData(['module', $this->getUrl(0), 'config', 'feeds']),
|
||||
'help' => 'Flux limité aux articles de la première page.'
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col6">
|
||||
<?php echo template::text('newsConfigFeedslabel', [
|
||||
'label' => 'Texte de l\'étiquette',
|
||||
'value' => $this->getData(['module', $this->getUrl(0), 'config', 'feedsLabel'])
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col12">
|
||||
<div class="block">
|
||||
<h4>Paramètres du module</h4>
|
||||
<div class="row">
|
||||
<div class="col6">
|
||||
<?php echo template::checkbox('newsConfigShowFeeds', true, 'Lien du flux RSS', [
|
||||
'checked' => $this->getData(['module', $this->getUrl(0), 'config', 'feeds']),
|
||||
'help' => 'Flux limité aux articles de la première page.'
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col6">
|
||||
<?php echo template::text('newsConfigFeedslabel', [
|
||||
'label' => 'Etiquette RSS',
|
||||
'value' => $this->getData(['module', $this->getUrl(0), 'config', 'feedsLabel'])
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
<!-- Block ajouté pour le sélecteur -->
|
||||
<div class="row">
|
||||
<div class="col4">
|
||||
<?php echo template::select('newsConfigItemsperCol', $module::$Columns, [
|
||||
'label' => 'Pagination',
|
||||
'selected' => $this->getData(['module', $this->getUrl(0),'config', 'itemsperCol']),
|
||||
'help' => 'Nombre de colonnes par page'
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col4">
|
||||
<?php echo template::select('newsConfigItemsperPage', $module::$ItemsList, [
|
||||
'label' => 'Articles par page',
|
||||
'selected' => $this->getData(['module', $this->getUrl(0),'config', 'itemsperPage'])
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col4">
|
||||
<?php echo template::select('newsConfigItemsHeight', $module::$ItemsHeight, [
|
||||
'label' => 'Hauteur',
|
||||
'selected' => $this->getData(['module', $this->getUrl(0),'config', 'itemsHeight'])
|
||||
]); ?>
|
||||
</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; ?>
|
||||
|
@ -12,7 +12,7 @@
|
||||
* @link http://zwiicms.fr/
|
||||
*/
|
||||
|
||||
/*
|
||||
/*
|
||||
* Module news
|
||||
*/
|
||||
|
||||
@ -21,10 +21,26 @@
|
||||
background-color: #ECEFF1;
|
||||
padding:5px;
|
||||
}*/
|
||||
.newsContent {
|
||||
overflow: hidden; /* les dépassements seront masqués */
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.newsBlur {
|
||||
position: absolute;
|
||||
bottom: -5%;
|
||||
margin: -10px;
|
||||
height: 20%;
|
||||
width: 110%;
|
||||
backdrop-filter: blur(1px);
|
||||
-webkit-backdrop-filter: blur(1px);
|
||||
}
|
||||
|
||||
|
||||
.newsContent {
|
||||
clear: left;
|
||||
margin-left: 10px;
|
||||
margin-bottom: 5px;
|
||||
}
|
||||
|
||||
.newsSignature {
|
||||
@ -44,4 +60,26 @@
|
||||
#rssFeed p {
|
||||
display: inline;
|
||||
vertical-align: top;
|
||||
}
|
||||
}
|
||||
@media (min-width: 769px)
|
||||
{
|
||||
.col2 {width: 20%;}
|
||||
.col3 {width: 24%;}
|
||||
.col4 {width: 32%;}
|
||||
.col6 {width: 49%;}
|
||||
.col12 {width: 100%;}
|
||||
}
|
||||
|
||||
@media (max-width: 768px)
|
||||
{
|
||||
.col2 {width: 49%;}
|
||||
.col3 {width: 49%;}
|
||||
.col4 {width: 49%;}
|
||||
}
|
||||
@media (max-width: 480px)
|
||||
{
|
||||
.col2 {width: 100%;}
|
||||
.col3 {width: 100%;}
|
||||
.col4 {width: 100%;}
|
||||
}
|
||||
|
||||
|
@ -1,20 +1,19 @@
|
||||
<?php if($module::$news): ?>
|
||||
<div class="row">
|
||||
<div class="col12">
|
||||
<?php foreach($module::$news as $newsId => $news): ?>
|
||||
<div class="row ">
|
||||
<div class="col12">
|
||||
<h1 class="newsTitle" id="<?php echo $newsId;?>">
|
||||
<?php echo $news['title']; ?>
|
||||
</h1>
|
||||
<div class="newsContent">
|
||||
<?php echo $news['content']; ?>
|
||||
</div>
|
||||
<div class="newsSignature">
|
||||
<i class="far fa-calendar-alt"></i>
|
||||
<?php echo mb_detect_encoding(strftime('%d %B %Y', $news['publishedOn']), 'UTF-8', true)
|
||||
? strftime('%d %B %Y', $news['publishedOn'])
|
||||
: utf8_encode(strftime('%d %B %Y', $news['publishedOn'])); ?>
|
||||
<?php foreach($module::$news as $newsId => $news): ?>
|
||||
<div class="col<?php echo $module::$nbrCol ;?>" >
|
||||
<h1 class="newsTitle" id="<?php echo $newsId;?>">
|
||||
<?php echo '<a href="'. helper::baseUrl(true) . $this->getUrl(0) . '/' . $newsId . '">' . $news['title'] . '</a>'; ?>
|
||||
</h1>
|
||||
<div class="newsContent">
|
||||
<?php echo $news['content']; ?>
|
||||
<div class="newsBlur"></div>
|
||||
</div>
|
||||
<div class="newsSignature">
|
||||
<i class="far fa-calendar-alt"></i>
|
||||
<?php echo mb_detect_encoding(strftime('%d %B %Y', $news['publishedOn']), 'UTF-8', true)
|
||||
? strftime('%d %B %Y', $news['publishedOn'])
|
||||
: utf8_encode(strftime('%d %B %Y', $news['publishedOn'])); ?>
|
||||
- <?php echo $news['userId']; ?>
|
||||
<!-- Bloc edition -->
|
||||
<?php if (
|
||||
@ -29,18 +28,16 @@
|
||||
<?php echo template::ico('pencil');?> Editer
|
||||
</a>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
<?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'; ?>" target="_blank">
|
||||
<img src='module/news/ressource/feed-icon-16.gif' />
|
||||
<?php
|
||||
<?php
|
||||
echo '<p>' . $this->getData(['module',$this->getUrl(0), 'config', 'feedsLabel']) . '</p>' ;
|
||||
?>
|
||||
</a>
|
||||
|
@ -5,6 +5,7 @@ class init extends search {
|
||||
'resultHideContent' => false,
|
||||
'placeHolder' => 'Un ou plusieurs mots-clés séparés par un espace ou par +',
|
||||
'submitText' => 'Rechercher',
|
||||
'keywordColor' => 'rgba(229, 229, 1, 1)'
|
||||
'keywordColor' => 'rgba(229, 229, 1, 1)',
|
||||
'versionData' => '2.0'
|
||||
];
|
||||
}
|
@ -10,7 +10,8 @@
|
||||
* @copyright Copyright (C) 2008-2018, Rémi Jean
|
||||
* @author Frédéric Tempez <frederic.tempez@outlook.com>
|
||||
* @copyright Copyright (C) 2018-2021, Frédéric Tempez
|
||||
* @copyright Sylvain Lelièvre
|
||||
* @author Sylvain Lelièvre <lelievresylvain@free.fr>
|
||||
* @copyright Copyright (C) 2020-2021, Sylvain Lelièvre
|
||||
* @license GNU General Public License, version 3
|
||||
* @link http://zwiicms.fr/
|
||||
*
|
||||
@ -18,7 +19,7 @@
|
||||
|
||||
class search extends common {
|
||||
|
||||
const VERSION = '1.3';
|
||||
const VERSION = '2.0';
|
||||
const REALNAME = 'Recherche';
|
||||
const DELETE = true;
|
||||
const UPDATE = '0.0';
|
||||
@ -45,22 +46,66 @@ class search extends common {
|
||||
];
|
||||
|
||||
|
||||
/**
|
||||
* Mise à jour du module
|
||||
* Appelée par les fonctions index et config
|
||||
*/
|
||||
private function update() {
|
||||
// Création des valeurs de réglage par défaut
|
||||
if ( !is_array($this->getData(['module', $this->getUrl(0), 'config']) ) ) {
|
||||
require_once('module/search/ressource/defaultdata.php');
|
||||
$this->setData(['module', $this->getUrl(0), 'config', init::$defaultData]);
|
||||
}
|
||||
// Version 2.0
|
||||
if (version_compare($this->getData(['module', $this->getUrl(0), 'config', 'versionData']), '2.0', '<') ) {
|
||||
|
||||
// Distinguer la config des autres données
|
||||
$data = $this->getData(['module', $this->getUrl(0)]);
|
||||
$this->setData(['module', $this->getUrl(0), 'config', [
|
||||
'submitText' => $this->getData(['module', $this->getUrl(0), 'submitText']),
|
||||
'placeHolder' => $this->getData(['module', $this->getUrl(0), 'placeHolder']),
|
||||
'resultHideContent' => $this->getData(['module', $this->getUrl(0), 'resultHideContent']),
|
||||
'previewLength' => $this->getData(['module', $this->getUrl(0), 'previewLength']),
|
||||
'keywordColor' => $this->getData(['module', $this->getUrl(0), 'keywordColor'])
|
||||
]]);
|
||||
$this->deleteData(['module', $this->getUrl(0), 'submitText']);
|
||||
$this->deleteData(['module', $this->getUrl(0), 'placeHolder']);
|
||||
$this->deleteData(['module', $this->getUrl(0), 'resultHideContent']);
|
||||
$this->deleteData(['module', $this->getUrl(0), 'previewLength']);
|
||||
$this->deleteData(['module', $this->getUrl(0), 'keywordColor']);
|
||||
$this->setData(['module', $this->getUrl(0), 'config', 'versionData','2.0']);
|
||||
}
|
||||
}
|
||||
|
||||
// Configuration vide
|
||||
public function config() {
|
||||
// Création des valeurs de réglage par défaut
|
||||
if ( $this->getData(['module', $this->getUrl(0)]) === null ) {
|
||||
require_once('module/search/ressource/defaultdata.php');
|
||||
$this->setData(['module', $this->getUrl(0), init::$defaultData]);
|
||||
}
|
||||
|
||||
// Mise à jour des données de module
|
||||
$this->update();
|
||||
|
||||
if($this->isPost()) {
|
||||
|
||||
// Générer la feuille de CSS
|
||||
$class = get_called_class();
|
||||
$moduleId = $this->getUrl(0);
|
||||
$style = '.searchItem {background:' . $this->getInput('searchKeywordColor') . ';}';
|
||||
// Dossier de l'instance
|
||||
if (!is_dir(self::DATA_DIR . 'modules/' . $class)) {
|
||||
mkdir (self::DATA_DIR . 'modules/' . $class, 0777, true);
|
||||
}
|
||||
|
||||
$success = file_put_contents(self::DATA_DIR . 'modules/' . $class . '/' . $moduleId . '.css' , $style );
|
||||
// Fin feuille de style
|
||||
|
||||
// Soumission du formulaire
|
||||
$this->setData(['module', $this->getUrl(0), [
|
||||
$this->setData(['module', $this->getUrl(0), 'config',[
|
||||
'submitText' => $this->getInput('searchSubmitText'),
|
||||
'placeHolder' => $this->getInput('searchPlaceHolder'),
|
||||
'resultHideContent' => $this->getInput('searchResultHideContent',helper::FILTER_BOOLEAN),
|
||||
'previewLength' => $this->getInput('searchPreviewLength',helper::FILTER_INT),
|
||||
'keywordColor' => $this->getInput('searchKeywordColor')
|
||||
'keywordColor' => $this->getInput('searchKeywordColor'),
|
||||
'style' => $success ? self::DATA_DIR . 'modules/' . $class . '/' . $moduleId . '.css' : '',
|
||||
'versionData' => $this->getData(['module', $this->getUrl(0), 'config', 'versionData'])
|
||||
]]);
|
||||
|
||||
|
||||
@ -83,12 +128,8 @@ class search extends common {
|
||||
}
|
||||
|
||||
public function index() {
|
||||
|
||||
// Création des valeurs de réglage par défaut
|
||||
if ( $this->getData(['module', $this->getUrl(0)]) === null ) {
|
||||
require_once('module/search/ressource/defaultdata.php');
|
||||
$this->setData(['module', $this->getUrl(0), init::$defaultData]);
|
||||
}
|
||||
// Mise à jour des données de module
|
||||
$this->update();
|
||||
|
||||
if($this->isPost()) {
|
||||
//Initialisations variables
|
||||
@ -99,11 +140,59 @@ class search extends common {
|
||||
|
||||
// Récupération du mot clef passé par le formulaire de ...view/index.php, avec caractères accentués
|
||||
self::$motclef=$this->getInput('searchMotphraseclef');
|
||||
// Variable de travail, on conserve la variable globale pour l'affichage du résultat
|
||||
$motclef = self::$motclef;
|
||||
|
||||
// Traduction du mot clé si le script Google Trad est actif
|
||||
// Le multi langue est sélectionné
|
||||
if ( $this->getData(['config','translate','scriptGoogle']) === true
|
||||
AND
|
||||
// et la traduction de la langue courante est automatique
|
||||
( isset($_COOKIE['googtrans'])
|
||||
AND ( $this->getData(['config','translate', substr($_COOKIE['googtrans'],4,2)]) === 'script'
|
||||
// Ou traduction automatique
|
||||
OR $this->getData(['config','translate','autoDetect']) === true )
|
||||
)
|
||||
// Cas des pages d'administration
|
||||
// Pas connecté
|
||||
AND ( $this->getUser('password') !== $this->getInput('ZWII_USER_PASSWORD')
|
||||
// Ou connecté avec option active
|
||||
OR ($this->getUser('password') === $this->getInput('ZWII_USER_PASSWORD')
|
||||
AND $this->getData(['config','translate','admin']) === true
|
||||
)
|
||||
)
|
||||
AND !isset($_COOKIE['ZWII_I18N_SITE'])
|
||||
)
|
||||
{
|
||||
// Découper la chaîne
|
||||
$f = str_getcsv($motclef, ' ');
|
||||
// Supprimer les espaces et les guillemets
|
||||
$f = str_replace(' ','',$f);
|
||||
$f = str_replace('"','',$f);
|
||||
// Lire le cookie GoogTrans et déterminer les langues cibles
|
||||
$language['origin'] = substr($_COOKIE['googtrans'],4,2);
|
||||
$language['target'] = substr($_COOKIE['googtrans'],1,2);
|
||||
if ($language['target'] !== $language['origin']) {
|
||||
foreach ($f as $key => $value) {
|
||||
$e = $this->translate($language['origin'],$language['target'],$value);
|
||||
$motclef = str_replace($value,$e,$motclef);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Suppression des mots < 3 caractères et des articles > 2 caractères de la chaîne $motclef
|
||||
$arraymotclef = explode(' ', $motclef);
|
||||
$motclef = '';
|
||||
foreach($arraymotclef as $key=>$value){
|
||||
if( strlen($value)>2 && $value!=='les' && $value!=='des' && $value!=='une' && $value!=='aux') $motclef.=$value.' ';
|
||||
}
|
||||
// Suppression du dernier ' '
|
||||
if($motclef !== '') $motclef = substr($motclef,0, strlen($motclef)-1);
|
||||
|
||||
// Récupération de l'état de l'option mot entier passé par le même formulaire
|
||||
self::$motentier=$this->getInput('searchMotentier', helper::FILTER_BOOLEAN);
|
||||
|
||||
if (self::$motclef !== '' ) {
|
||||
if ($motclef !== '' ) {
|
||||
foreach($this->getHierarchy(null,false,null) as $parentId => $childIds) {
|
||||
if ($this->getData(['page', $parentId, 'disable']) === false &&
|
||||
$this->getUser('group') >= $this->getData(['page', $parentId, 'group']) &&
|
||||
@ -112,7 +201,7 @@ class search extends common {
|
||||
$titre = $this->getData(['page', $parentId, 'title']);
|
||||
$contenu = ' ' . $titre . ' ' . $this->getData(['page', $parentId, 'content']);
|
||||
// Pages sauf pages filles et articles de blog
|
||||
$tempData = $this->occurrence($url, $titre, $contenu, self::$motclef, self::$motentier);
|
||||
$tempData = $this->occurrence($url, $titre, $contenu, $motclef, self::$motentier);
|
||||
if (is_array($tempData) ) {
|
||||
$result [] = $tempData;
|
||||
}
|
||||
@ -127,14 +216,15 @@ class search extends common {
|
||||
$titre = $this->getData(['page', $childId, 'title']);
|
||||
$contenu = ' ' . $titre . ' ' . $this->getData(['page', $childId, 'content']);
|
||||
//Pages filles
|
||||
$tempData = $this->occurrence($url, $titre, $contenu, self::$motclef, self::$motentier);
|
||||
$tempData = $this->occurrence($url, $titre, $contenu, $motclef, self::$motentier);
|
||||
if (is_array($tempData) ) {
|
||||
$result [] = $tempData;
|
||||
}
|
||||
}
|
||||
|
||||
// Articles d'une sous-page blog
|
||||
if ($this->getData(['page', $childId, 'moduleId']) === 'blog')
|
||||
if ($this->getData(['page', $childId, 'moduleId']) === 'blog' &&
|
||||
$this->getData(['module',$parentId,'posts']) )
|
||||
{
|
||||
foreach($this->getData(['module',$childId,'posts']) as $articleId => $article) {
|
||||
if($this->getData(['module',$childId,'posts',$articleId,'state']) === true) {
|
||||
@ -142,7 +232,7 @@ class search extends common {
|
||||
$titre = $article['title'];
|
||||
$contenu = ' ' . $titre . ' ' . $article['content'];
|
||||
// Articles de sous-page de type blog
|
||||
$tempData = $this->occurrence($url, $titre, $contenu, self::$motclef, self::$motentier);
|
||||
$tempData = $this->occurrence($url, $titre, $contenu, $motclef, self::$motentier);
|
||||
if (is_array($tempData) ) {
|
||||
$result [] = $tempData;
|
||||
}
|
||||
@ -152,7 +242,8 @@ class search extends common {
|
||||
}
|
||||
|
||||
// Articles d'un blog
|
||||
if ($this->getData(['page', $parentId, 'moduleId']) === 'blog' ) {
|
||||
if ($this->getData(['page', $parentId, 'moduleId']) === 'blog' &&
|
||||
$this->getData(['module',$parentId,'posts']) ) {
|
||||
foreach($this->getData(['module',$parentId,'posts']) as $articleId => $article) {
|
||||
if($this->getData(['module',$parentId,'posts',$articleId,'state']) === true)
|
||||
{
|
||||
@ -160,7 +251,7 @@ class search extends common {
|
||||
$titre = $article['title'];
|
||||
$contenu = ' ' . $titre . ' ' . $article['content'];
|
||||
// Articles de Blog
|
||||
$tempData = $this->occurrence($url, $titre, $contenu, self::$motclef, self::$motentier);
|
||||
$tempData = $this->occurrence($url, $titre, $contenu, $motclef, self::$motentier);
|
||||
if (is_array($tempData) ) {
|
||||
$result [] = $tempData;
|
||||
}
|
||||
@ -189,7 +280,8 @@ class search extends common {
|
||||
$this->addOutput([
|
||||
'view' => 'index',
|
||||
'showBarEditButton' => true,
|
||||
'showPageContent' => !$this->getData(['module', $this->getUrl(0),'resultHideContent'])
|
||||
'showPageContent' => !$this->getData(['module', $this->getUrl(0), 'config', 'resultHideContent']),
|
||||
'style' => $this->getData(['module', $this->getUrl(0), 'config', 'style'])
|
||||
]);
|
||||
} else {
|
||||
// Valeurs en sortie, affichage du formulaire
|
||||
@ -216,7 +308,9 @@ class search extends common {
|
||||
|
||||
// Construire la clé de recherche selon options de recherche
|
||||
$keywords = '/(';
|
||||
|
||||
foreach ($a as $key => $value) {
|
||||
|
||||
$keywords .= $motentier === true ? $value . '|' : '\b' . $value . '\b|' ;
|
||||
}
|
||||
$keywords = substr($keywords,0,strlen($keywords) - 1);
|
||||
@ -234,9 +328,9 @@ class search extends common {
|
||||
// Rechercher l'espace le plus proche
|
||||
$d = $d >= 1 ? strpos($contenu,' ',$d) : $d;
|
||||
// Découper l'aperçu
|
||||
$t = substr($contenu, $d ,$this->getData(['module',$this->getUrl(0),'previewLength']));
|
||||
$t = substr($contenu, $d ,$this->getData(['module',$this->getUrl(0), 'config', 'previewLength']));
|
||||
// Applique une mise en évidence
|
||||
$t = preg_replace($keywords, '<span style="background:' . $this->getData(['module',$this->getUrl(0),'keywordColor']). ';">\1</span>',$t);
|
||||
$t = preg_replace($keywords, '<span class= "searchItem">\1</span>',$t);
|
||||
// Sauver résultat
|
||||
$resultat .= '<p class="searchResult">'.$t.'...</p>';
|
||||
$resultat .= '<p class="searchTitle">' . count($matches[0]) . (count($matches[0]) === 1 ? ' correspondance<p>' : ' correspondances<p>');
|
||||
@ -248,4 +342,10 @@ class search extends common {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Requête de traduction avec le script Google
|
||||
private function translate($from_lan, $to_lan, $text) {
|
||||
$arrayjson = json_decode(file_get_contents('https://translate.googleapis.com/translate_a/single?client=gtx&sl='.$from_lan.'&tl=fr&dt=t&q='.$text),true);
|
||||
return $arrayjson[0][0][0];
|
||||
}
|
||||
}
|
||||
|
@ -20,13 +20,13 @@
|
||||
<div class="col6">
|
||||
<?php echo template::text('searchSubmitText', [
|
||||
'label' => 'Texte du bouton',
|
||||
'value' => $this->getData(['module', $this->getUrl(0), 'submitText'])
|
||||
'value' => $this->getData(['module', $this->getUrl(0), 'config', 'submitText'])
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col6">
|
||||
<?php echo template::select('searchPreviewLength', $module::$previewLength, [
|
||||
'label' => 'Dimension de l\'aperçu',
|
||||
'selected' => $this->getData(['module', $this->getUrl(0),'previewLength'])
|
||||
'selected' => $this->getData(['module', $this->getUrl(0), 'config', 'previewLength'])
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
@ -34,12 +34,12 @@
|
||||
<div class="col12">
|
||||
<?php echo template::text('searchPlaceHolder', [
|
||||
'label' => 'Aide dans la zone de saisie',
|
||||
'value' => $this->getData(['module', $this->getUrl(0), 'placeHolder'])
|
||||
'value' => $this->getData(['module', $this->getUrl(0), 'config', 'placeHolder'])
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col12">
|
||||
<?php echo template::checkbox('searchResultHideContent', true, 'Masquer le contenu de la page dans les résultats', [
|
||||
'checked' => $this->getData(['module', $this->getUrl(0), 'resultHideContent']),
|
||||
'checked' => $this->getData(['module', $this->getUrl(0), 'config', 'resultHideContent']),
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
@ -59,7 +59,7 @@
|
||||
'class' => 'colorPicker',
|
||||
'help' => 'Le curseur horizontal règle le niveau de transparence, le placer tout à la gauche pour un surlignement invisible.',
|
||||
'label' => 'Surlignement',
|
||||
'value' => $this->getData(['module', $this->getUrl(0), 'keywordColor'])
|
||||
'value' => $this->getData(['module', $this->getUrl(0), 'config', 'keywordColor'])
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -4,7 +4,7 @@
|
||||
<div class="row">
|
||||
<div class="col9 verticalAlignMiddle">
|
||||
<?php echo template::text('searchMotphraseclef', [
|
||||
'placeholder' => $this->getData(['module', $this->getUrl(0), 'placeHolder']),
|
||||
'placeholder' => isset($_COOKIE['ZWII_I18N_SITE'] ) ? $this->getData(['module', $this->getUrl(0), 'placeHolder']):'Un ou plusieurs mots clef séparés par un espace',
|
||||
'value' => $module::$motclef
|
||||
]); ?>
|
||||
</div>
|
||||
|
Loading…
Reference in New Issue
Block a user