commit
8a3d876e8f
@ -0,0 +1,291 @@
|
||||
<?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
|
||||
* @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/
|
||||
*/
|
||||
|
||||
class addon extends common {
|
||||
|
||||
public static $actions = [
|
||||
'index' => self::GROUP_ADMIN,
|
||||
'moduleDelete' => self::GROUP_ADMIN
|
||||
];
|
||||
|
||||
// Gestion des modules
|
||||
public static $modInstal = [];
|
||||
|
||||
// pour tests
|
||||
public static $valeur = [];
|
||||
|
||||
/*
|
||||
* Effacement d'un module installé et non utilisé
|
||||
*/
|
||||
public function moduleDelete() {
|
||||
|
||||
// Jeton incorrect
|
||||
if ($this->getUrl(3) !== $_SESSION['csrf']) {
|
||||
// Valeurs en sortie
|
||||
$this->addOutput([
|
||||
'redirect' => helper::baseUrl() . 'addon',
|
||||
'state' => false,
|
||||
'notification' => 'Action non autorisée'
|
||||
]);
|
||||
}
|
||||
else{
|
||||
// Suppression des dossiers
|
||||
if( $this->removeDir('./module/'.$this->getUrl(2) ) === true){
|
||||
$success = true;
|
||||
$notification = 'Module '.$this->getUrl(2) .' effacé du dossier /module/, il peut rester des données dans d\'autres dossiers';
|
||||
}
|
||||
else{
|
||||
$success = false;
|
||||
$notification = 'La suppression a échouée';
|
||||
}
|
||||
// Valeurs en sortie
|
||||
$this->addOutput([
|
||||
'redirect' => helper::baseUrl() . 'addon',
|
||||
'notification' => $notification,
|
||||
'state' => $success
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gestion des modules
|
||||
*/
|
||||
public function index() {
|
||||
|
||||
// Lister les modules
|
||||
// $infoModules[nom_module]['realName'], ['version'], ['update'], ['delete'], ['dataDirectory']
|
||||
$infoModules = helper::getModules();
|
||||
|
||||
// Clés moduleIds dans les pages
|
||||
$inPages = helper::arrayCollumn($this->getData(['page']),'moduleId', 'SORT_DESC');
|
||||
foreach( $inPages as $key=>$value){
|
||||
$inPagesTitle[ $this->getData(['page', $key, 'title' ]) ] = $value;
|
||||
}
|
||||
|
||||
// Parcourir les données des modules
|
||||
foreach ($infoModules as $key=>$value) {
|
||||
// Construire le tableau de sortie
|
||||
self::$modInstal[] = [
|
||||
$key,
|
||||
$infoModules[$key]['realName'],
|
||||
$infoModules[$key]['version'],
|
||||
implode(', ', array_keys($inPagesTitle,$key)),
|
||||
array_key_exists('delete',$infoModules[$key]) && $infoModules[$key]['delete'] === true && implode(', ',array_keys($inPages,$key)) ===''
|
||||
? template::button('moduleDelete' . $key, [
|
||||
'class' => 'moduleDelete buttonRed',
|
||||
'href' => helper::baseUrl() . $this->getUrl(0) . '/moduleDelete/' . $key . '/' . $_SESSION['csrf'],
|
||||
'value' => template::ico('cancel')
|
||||
])
|
||||
: '',
|
||||
array_key_exists('dataDirectory',$infoModules[$key]) && $infoModules[$key]['dataDirectory'] !== ''
|
||||
? template::button('moduleExport' . $key, [
|
||||
'class' => 'buttonBlue',
|
||||
'href' => helper::baseUrl(false).$this->exportZip( $key ),
|
||||
'value' => template::ico('upload')
|
||||
])
|
||||
: ''
|
||||
];
|
||||
}
|
||||
|
||||
// Retour du formulaire ?
|
||||
if($this->isPost()) {
|
||||
// Installation d'un module
|
||||
$success = true;
|
||||
$checkValidMaj = $this->getInput('configModulesCheck', helper::FILTER_BOOLEAN);
|
||||
$zipFilename = $this->getInput('configModulesInstallation', helper::FILTER_STRING_SHORT);
|
||||
if( $zipFilename !== ''){
|
||||
$tempFolder = 'datamodules';//uniqid();
|
||||
$zip = new ZipArchive();
|
||||
if ($zip->open(self::FILE_DIR.'source/'.$zipFilename) === TRUE) {
|
||||
$notification = 'Archive ouverte';
|
||||
mkdir (self::TEMP_DIR . $tempFolder);
|
||||
$zip->extractTo(self::TEMP_DIR . $tempFolder );
|
||||
// Archive de module ?
|
||||
$success = false;
|
||||
$notification = 'Ce n\'est pas l\'archive d\'un module !';
|
||||
$moduleDir = self::TEMP_DIR . $tempFolder . '/module';
|
||||
$moduleName = '';
|
||||
if ( is_dir( $moduleDir )) {
|
||||
// Lire le nom du module
|
||||
if ($dh = opendir( $moduleDir )) {
|
||||
while (($file = readdir($dh)) !== false) {
|
||||
$moduleName = $file;
|
||||
}
|
||||
closedir($dh);
|
||||
}
|
||||
// Module normalisé ?
|
||||
if( is_file( $moduleDir.'/'.$moduleName.'/'.$moduleName.'.php' ) AND is_file( $moduleDir.'/'.$moduleName.'/view/index/index.php' ) ){
|
||||
|
||||
// Lecture de la version du module pour validation de la mise à jour
|
||||
// Pour une version <= version installée l'utilisateur doit cocher 'Mise à jour forcée'
|
||||
$version = '0.0';
|
||||
$file = file_get_contents( $moduleDir.'/'.$moduleName.'/'.$moduleName.'.php');
|
||||
$file = str_replace(' ','',$file);
|
||||
$file = str_replace("\t",'',$file);
|
||||
$pos1 = strpos($file, 'constVERSION');
|
||||
if( $pos1 !== false){
|
||||
$posdeb = strpos($file, "'", $pos1);
|
||||
$posend = strpos($file, "'", $posdeb + 1);
|
||||
$version = substr($file, $posdeb + 1, $posend - $posdeb - 1);
|
||||
}
|
||||
|
||||
// Module déjà installé ?
|
||||
$moduleInstal = false;
|
||||
foreach( self::$modInstal as $key=>$value){
|
||||
if($moduleName === $value[0]){
|
||||
$moduleInstal = true;
|
||||
}
|
||||
}
|
||||
|
||||
// Validation de la maj si autorisation du concepteur du module ET
|
||||
// ( Version plus récente OU Check de forçage )
|
||||
$valNewVersion = floatval($version);
|
||||
$valInstalVersion = floatval( $infoModules[$moduleName]['version'] );
|
||||
$newVersion = false;
|
||||
if( $valNewVersion > $valInstalVersion ) $newVersion = true;
|
||||
$validMaj = $infoModules[$moduleName]['update'] && ( $newVersion || $checkValidMaj);
|
||||
|
||||
// Nouvelle installation ou mise à jour du module
|
||||
if( ! $moduleInstal || $validMaj ){
|
||||
// Copie récursive des dossiers
|
||||
$this -> custom_copy( self::TEMP_DIR . $tempFolder, './' );
|
||||
$success = true;
|
||||
if( ! $moduleInstal ){
|
||||
$notification = 'Module '.$moduleName.' installé';
|
||||
}
|
||||
else{
|
||||
$notification = 'Module '.$moduleName.' mis à jour';
|
||||
}
|
||||
}
|
||||
else{
|
||||
$success = false;
|
||||
if( $valNewVersion == $valInstalVersion){
|
||||
$notification = ' Version détectée '.$version.' = à celle installée '.$infoModules[$moduleName]['version'];
|
||||
}
|
||||
else{
|
||||
$notification = ' Version détectée '.$version.' < à celle installée '.$infoModules[$moduleName]['version'];
|
||||
}
|
||||
if( $infoModules[$moduleName]['update'] === false){
|
||||
$notification = ' Mise à jour par ce procédé interdite par le concepteur du module';
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// Supprimer le dossier temporaire même si le module est invalide
|
||||
$this->removeDir(self::TEMP_DIR . $tempFolder);
|
||||
$zip->close();
|
||||
} else {
|
||||
// erreur à l'ouverture
|
||||
$success = false;
|
||||
$notification = 'Impossible d\'ouvrir l\'archive';
|
||||
}
|
||||
}
|
||||
|
||||
$this->addOutput([
|
||||
'redirect' => helper::baseUrl() . $this->getUrl(),
|
||||
'notification' => $notification,
|
||||
'state' => $success
|
||||
]);
|
||||
}
|
||||
|
||||
// Valeurs en sortie
|
||||
$this->addOutput([
|
||||
'title' => 'Gestion des modules',
|
||||
'view' => 'index'
|
||||
]);
|
||||
}
|
||||
|
||||
/*
|
||||
* Copie récursive de dossiers
|
||||
*
|
||||
*/
|
||||
private function custom_copy($src, $dst) {
|
||||
// open the source directory
|
||||
$dir = opendir($src);
|
||||
// Make the destination directory if not exist
|
||||
if (!is_dir($dst)) {
|
||||
mkdir($dst);
|
||||
}
|
||||
// Loop through the files in source directory
|
||||
while( $file = readdir($dir) ) {
|
||||
if (( $file != '.' ) && ( $file != '..' )) {
|
||||
if ( is_dir($src . '/' . $file) ){
|
||||
// Recursively calling custom copy function
|
||||
// for sub directory
|
||||
$this -> custom_copy($src . '/' . $file, $dst . '/' . $file);
|
||||
}
|
||||
else {
|
||||
copy($src . '/' . $file, $dst . '/' . $file);
|
||||
}
|
||||
}
|
||||
}
|
||||
closedir($dir);
|
||||
}
|
||||
|
||||
/*
|
||||
* Création récursive d'un zip
|
||||
* https://makitweb.com/how-to-create-and-download-a-zip-file-with-php/
|
||||
*/
|
||||
private function createZip($zip,$dir){
|
||||
if (is_dir($dir)){
|
||||
if ($dh = opendir($dir)){
|
||||
while (($file = readdir($dh)) !== false){
|
||||
// If file
|
||||
if (is_file($dir.$file)) {
|
||||
if($file != '' && $file != '.' && $file != '..'){
|
||||
$zip->addFile($dir.$file);
|
||||
}
|
||||
}
|
||||
else{
|
||||
// If directory
|
||||
if(is_dir($dir.$file) ){
|
||||
if($file != '' && $file != '.' && $file != '..'){
|
||||
// Add empty directory
|
||||
$zip->addEmptyDir($dir.$file);
|
||||
$folder = $dir.$file.'/';
|
||||
// Read data of the folder
|
||||
$this->createZip($zip,$folder);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
closedir($dh);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Export des données d'un module externes à module.json
|
||||
*/
|
||||
private function exportZip( $exportModule ){
|
||||
$infoModules = helper::getModules();
|
||||
// création du zip
|
||||
$zip = new ZipArchive();
|
||||
if( ! is_dir('tmp/exportDataModules')) mkdir('tmp/exportDataModules',0777, true);
|
||||
$filename = 'tmp/exportDataModules/'.$exportModule.'dataExport.zip';
|
||||
if( is_file( $filename )) unlink( $filename);
|
||||
$directory = $infoModules[$exportModule]['dataDirectory'].'/';
|
||||
if($zip->open( $filename, ZipArchive::CREATE) !== TRUE){
|
||||
exit;
|
||||
}
|
||||
else{
|
||||
$this->createZip($zip,$directory);
|
||||
$zip->close();
|
||||
}
|
||||
return( $filename );
|
||||
}
|
||||
}
|
@ -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
|
||||
*/
|
@ -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
|
||||
*/
|
||||
$(".moduleDelete").on("click", function() {
|
||||
var _this = $(this);
|
||||
return core.confirm("Êtes-vous sûr de vouloir supprimer, effacer ce module ?", function() {
|
||||
$(location).attr("href", _this.attr("href"));
|
||||
});
|
||||
});
|
@ -0,0 +1,46 @@
|
||||
<?php echo template::formOpen('configModulesGestion'); ?>
|
||||
<div class="row">
|
||||
<div class="col2">
|
||||
<?php echo template::button('configModulesBack', [
|
||||
'class' => 'buttonGrey',
|
||||
'href' => helper::baseUrl(),
|
||||
'ico' => 'left',
|
||||
'value' => 'Retour'
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col2 offset8">
|
||||
<?php echo template::submit('configModulesSubmit',[
|
||||
'value' => 'Valider',
|
||||
'ico' => 'check'
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col12">
|
||||
<div class="block">
|
||||
<h4>Installer ou mettre à jour un module </h4>
|
||||
<div class="row">
|
||||
<div class="col6 offset3">
|
||||
<?php echo template::file('configModulesInstallation', [
|
||||
'label' => 'Archive ZIP :',
|
||||
'type' => 2
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col6">
|
||||
<?php echo template::checkbox('configModulesCheck', true, 'Mise à jour forcée', [
|
||||
'checked' => false,
|
||||
'help' => 'Permet de forcer une mise à jour même si la version du module est inférieure ou égale à celle du module installé.',
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php echo template::formClose(); ?>
|
||||
<?php if($module::$modInstal): ?>
|
||||
<?php echo template::table([2, 3, 2, 3, 1, 1], $module::$modInstal, ['Module installé', 'Alias', 'Version', 'Page(s)', 'Supprimer', 'Exporter']); ?>
|
||||
<?php else: ?>
|
||||
<?php echo template::speech('Aucun module installé.'); ?>
|
||||
<?php endif; ?>
|
File diff suppressed because one or more lines are too long
Binary file not shown.
Before Width: | Height: | Size: 23 KiB After Width: | Height: | Size: 24 KiB |
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -1,154 +1,152 @@
|
||||
<article>
|
||||
<div class="row">
|
||||
<div class="col10">
|
||||
<div class="blogDate">
|
||||
<i class="far fa-calendar-alt"></i>
|
||||
<?php $date = mb_detect_encoding(strftime('%d %B %Y', $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'publishedOn'])), 'UTF-8', true)
|
||||
? strftime('%d %B %Y', $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'publishedOn']))
|
||||
: utf8_encode(strftime('%d %B %Y', $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'publishedOn'])));
|
||||
$heure = mb_detect_encoding(strftime('%H:%M', $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'publishedOn'])), 'UTF-8', true)
|
||||
? strftime('%H:%M', $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'publishedOn']))
|
||||
: utf8_encode(strftime('%H:%M', $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'publishedOn'])));
|
||||
echo $date . ' à ' . $heure;
|
||||
?>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col10">
|
||||
<div class="blogDate">
|
||||
<i class="far fa-calendar-alt"></i>
|
||||
<?php $date = mb_detect_encoding(strftime('%d %B %Y', $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'publishedOn'])), 'UTF-8', true)
|
||||
? strftime('%d %B %Y', $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'publishedOn']))
|
||||
: utf8_encode(strftime('%d %B %Y', $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'publishedOn'])));
|
||||
$heure = mb_detect_encoding(strftime('%H:%M', $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'publishedOn'])), 'UTF-8', true)
|
||||
? strftime('%H:%M', $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'publishedOn']))
|
||||
: utf8_encode(strftime('%H:%M', $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'publishedOn'])));
|
||||
echo $date . ' à ' . $heure;
|
||||
?>
|
||||
</div>
|
||||
<div class="col2">
|
||||
<?php if (
|
||||
$this->getUser('password') === $this->getInput('ZWII_USER_PASSWORD')
|
||||
AND
|
||||
( // Propriétaire
|
||||
(
|
||||
$this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1),'editConsent']) === $module::EDIT_OWNER
|
||||
AND ( $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1),'userId']) === $this->getUser('id')
|
||||
OR $this->getUser('group') === self::GROUP_ADMIN )
|
||||
)
|
||||
OR (
|
||||
// Groupe
|
||||
( $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1),'editConsent']) === self::GROUP_ADMIN
|
||||
OR $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1),'editConsent']) === self::GROUP_MODERATOR)
|
||||
AND $this->getUser('group') >= $this->getData(['module',$this->getUrl(0), 'posts', $this->getUrl(1),'editConsent'])
|
||||
)
|
||||
OR (
|
||||
// Tout le monde
|
||||
$this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1),'editConsent']) === $module::EDIT_ALL
|
||||
AND $this->getUser('group') >= $module::$actions['config']
|
||||
)
|
||||
</div>
|
||||
<div class="col2">
|
||||
<?php if (
|
||||
$this->getUser('password') === $this->getInput('ZWII_USER_PASSWORD')
|
||||
AND
|
||||
( // Propriétaire
|
||||
(
|
||||
$this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1),'editConsent']) === $module::EDIT_OWNER
|
||||
AND ( $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1),'userId']) === $this->getUser('id')
|
||||
OR $this->getUser('group') === self::GROUP_ADMIN )
|
||||
)
|
||||
OR (
|
||||
// Groupe
|
||||
( $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1),'editConsent']) === self::GROUP_ADMIN
|
||||
OR $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1),'editConsent']) === self::GROUP_MODERATOR)
|
||||
AND $this->getUser('group') >= $this->getData(['module',$this->getUrl(0), 'posts', $this->getUrl(1),'editConsent'])
|
||||
)
|
||||
OR (
|
||||
// Tout le monde
|
||||
$this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1),'editConsent']) === $module::EDIT_ALL
|
||||
AND $this->getUser('group') >= $module::$actions['config']
|
||||
)
|
||||
): ?>
|
||||
<?php echo template::button('blogEdit', [
|
||||
'href' => helper::baseUrl() . $this->getUrl(0) . '/edit/' . $this->getUrl(1) . '/' . $_SESSION['csrf'],
|
||||
'value' => 'Editer'
|
||||
]); ?>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
)
|
||||
): ?>
|
||||
<?php echo template::button('blogEdit', [
|
||||
'href' => helper::baseUrl() . $this->getUrl(0) . '/edit/' . $this->getUrl(1) . '/' . $_SESSION['csrf'],
|
||||
'value' => 'Editer'
|
||||
]); ?>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<?php $pictureSize = $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'pictureSize']) === null ? '100' : $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'pictureSize']); ?>
|
||||
<?php if ($this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'hidePicture']) == false) {
|
||||
echo '<img class="blogArticlePicture blogArticlePicture' . $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'picturePosition']) .
|
||||
' pict' . $pictureSize . '" src="' . helper::baseUrl(false) . self::FILE_DIR.'source/' . $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'picture']) .
|
||||
'" alt="' . $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'picture']) . '">';
|
||||
} ?>
|
||||
<?php echo $this->getData(['module', $this->getUrl(0),'posts', $this->getUrl(1), 'content']); ?>
|
||||
<p class="clearBoth signature"><?php echo $module::$articleSignature;?></p>
|
||||
<!-- Bloc RSS-->
|
||||
<?php if ($this->getData(['module',$this->getUrl(0), 'config', 'feeds'])): ?>
|
||||
<div id="rssFeed">
|
||||
<a type="application/rss+xml" href="<?php echo helper::baseUrl() . $this->getUrl(0) . '/rss'; ?> ">
|
||||
<img src='module/news/ressource/feed-icon-16.gif' />
|
||||
<?php
|
||||
echo '<p>' . $this->getData(['module',$this->getUrl(0), 'config', 'feedsLabel']) . '</p>' ;
|
||||
?>
|
||||
</a>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<?php if($this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'commentClose'])): ?>
|
||||
<p>Cet article ne reçoit pas de commentaire.</p>
|
||||
<?php else: ?>
|
||||
<h3 id="comment">
|
||||
<?php //$commentsNb = count($module::$comments); ?>
|
||||
<?php $commentsNb = $module::$nbCommentsApproved; ?>
|
||||
<?php $s = $commentsNb === 1 ? '': 's' ?>
|
||||
<?php echo $commentsNb > 0 ? $commentsNb . ' ' . 'commentaire' . $s : 'Pas encore de commentaire'; ?>
|
||||
</h3>
|
||||
<?php echo template::formOpen('blogArticleForm'); ?>
|
||||
<?php echo template::text('blogArticleCommentShow', [
|
||||
'placeholder' => 'Rédiger un commentaire...',
|
||||
'readonly' => true
|
||||
]); ?>
|
||||
<div id="blogArticleCommentWrapper" class="displayNone">
|
||||
<?php if($this->getUser('password') === $this->getInput('ZWII_USER_PASSWORD')): ?>
|
||||
<?php echo template::text('blogArticleUserName', [
|
||||
'label' => 'Nom',
|
||||
'readonly' => true,
|
||||
'value' => $module::$editCommentSignature
|
||||
]); ?>
|
||||
<?php echo template::hidden('blogArticleUserId', [
|
||||
'value' => $this->getUser('id')
|
||||
]); ?>
|
||||
<?php else: ?>
|
||||
<div class="row">
|
||||
<div class="col9">
|
||||
<?php echo template::text('blogArticleAuthor', [
|
||||
'label' => 'Nom'
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col1 textAlignCenter verticalAlignBottom">
|
||||
<div id="blogArticleOr">Ou</div>
|
||||
</div>
|
||||
<div class="col2 verticalAlignBottom">
|
||||
<?php echo template::button('blogArticleLogin', [
|
||||
'href' => helper::baseUrl() . 'user/login/' . str_replace('/', '_', $this->getUrl()) . '__comment',
|
||||
'value' => 'Connexion'
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<?php echo template::textarea('blogArticleContent', [
|
||||
'label' => 'Commentaire avec maximum '.$this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'commentMaxlength']).' caractères',
|
||||
'class' => 'editorWysiwygComment',
|
||||
'noDirty' => true,
|
||||
'maxlength' => $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'commentMaxlength'])
|
||||
</div>
|
||||
<?php $pictureSize = $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'pictureSize']) === null ? '100' : $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'pictureSize']); ?>
|
||||
<?php if ($this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'hidePicture']) == false) {
|
||||
echo '<img class="blogArticlePicture blogArticlePicture' . $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'picturePosition']) .
|
||||
' pict' . $pictureSize . '" src="' . helper::baseUrl(false) . self::FILE_DIR.'source/' . $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'picture']) .
|
||||
'" alt="' . $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'picture']) . '">';
|
||||
} ?>
|
||||
<?php echo $this->getData(['module', $this->getUrl(0),'posts', $this->getUrl(1), 'content']); ?>
|
||||
<p class="clearBoth signature"><?php echo $module::$articleSignature;?></p>
|
||||
<!-- Bloc RSS-->
|
||||
<?php if ($this->getData(['module',$this->getUrl(0), 'config', 'feeds'])): ?>
|
||||
<div id="rssFeed">
|
||||
<a type="application/rss+xml" href="<?php echo helper::baseUrl() . $this->getUrl(0) . '/rss'; ?> ">
|
||||
<img src='module/news/ressource/feed-icon-16.gif' />
|
||||
<?php
|
||||
echo '<p>' . $this->getData(['module',$this->getUrl(0), 'config', 'feedsLabel']) . '</p>' ;
|
||||
?>
|
||||
</a>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<?php if($this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'commentClose'])): ?>
|
||||
<p>Cet article ne reçoit pas de commentaire.</p>
|
||||
<?php else: ?>
|
||||
<h3 id="comment">
|
||||
<?php //$commentsNb = count($module::$comments); ?>
|
||||
<?php $commentsNb = $module::$nbCommentsApproved; ?>
|
||||
<?php $s = $commentsNb === 1 ? '': 's' ?>
|
||||
<?php echo $commentsNb > 0 ? $commentsNb . ' ' . 'commentaire' . $s : 'Pas encore de commentaire'; ?>
|
||||
</h3>
|
||||
<?php echo template::formOpen('blogArticleForm'); ?>
|
||||
<?php echo template::text('blogArticleCommentShow', [
|
||||
'placeholder' => 'Rédiger un commentaire...',
|
||||
'readonly' => true
|
||||
]); ?>
|
||||
<div id="blogArticleCommentWrapper" class="displayNone">
|
||||
<?php if($this->getUser('password') === $this->getInput('ZWII_USER_PASSWORD')): ?>
|
||||
<?php echo template::text('blogArticleUserName', [
|
||||
'label' => 'Nom',
|
||||
'readonly' => true,
|
||||
'value' => $module::$editCommentSignature
|
||||
]); ?>
|
||||
<div id="blogArticleContentAlarm"> </div>
|
||||
<?php if($this->getUser('password') !== $this->getInput('ZWII_USER_PASSWORD')): ?>
|
||||
<div class="row">
|
||||
<div class="col12">
|
||||
<?php echo template::captcha('blogArticleCaptcha', [
|
||||
'limit' => $this->getData(['config','captchaStrong'])
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<?php echo template::hidden('blogArticleUserId', [
|
||||
'value' => $this->getUser('id')
|
||||
]); ?>
|
||||
<?php else: ?>
|
||||
<div class="row">
|
||||
<div class="col2 offset8">
|
||||
<?php echo template::button('blogArticleCommentHide', [
|
||||
'class' => 'buttonGrey',
|
||||
'value' => 'Annuler'
|
||||
<div class="col9">
|
||||
<?php echo template::text('blogArticleAuthor', [
|
||||
'label' => 'Nom'
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col2">
|
||||
<?php echo template::submit('blogArticleSubmit', [
|
||||
'value' => 'Envoyer',
|
||||
'ico |