2018-04-02 08:29:19 +02:00
< ? 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
2020-09-01 20:48:40 +02:00
* @ link http :// zwiicms . fr /
2018-04-02 08:29:19 +02:00
*/
class blog extends common {
2020-10-11 18:36:20 +02:00
const EDIT_OWNER = 'owner' ;
const EDIT_GROUP = 'group' ;
2020-10-14 11:07:38 +02:00
const EDIT_ALL = 'all' ;
2020-07-12 18:05:33 +02:00
2018-04-02 08:29:19 +02:00
public static $actions = [
2020-10-14 19:17:13 +02:00
'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 ,
2020-11-15 18:39:03 +01:00
'index' => self :: GROUP_VISITOR ,
2020-11-20 19:52:44 +01:00
'rss' => self :: GROUP_VISITOR
2018-04-02 08:29:19 +02:00
];
public static $articles = [];
2020-07-02 19:48:47 +02:00
// Signature de l'article
public static $articleSignature = '' ;
// Signature du commentaire
public static $editCommentSignature = '' ;
2018-04-02 08:29:19 +02:00
public static $comments = [];
2020-10-11 18:36:20 +02:00
2020-10-07 19:06:40 +02:00
public static $nbCommentsApproved = 0 ;
2018-04-02 08:29:19 +02:00
2020-07-02 19:48:47 +02:00
public static $commentsDelete ;
// Signatures des commentaires déjà saisis
public static $commentsSignature = [];
2018-04-02 08:29:19 +02:00
public static $pages ;
public static $states = [
false => 'Brouillon' ,
true => 'Publié'
];
2020-04-23 19:55:47 +02:00
public static $pictureSizes = [
'20' => 'Très petite' ,
'30' => 'Petite' ,
'40' => 'Grande' ,
'50' => 'Très Grande' ,
'100' => 'Pleine largeur' ,
];
public static $picturePositions = [
2020-06-03 09:07:00 +02:00
'left' => 'À gauche' ,
2020-04-23 19:55:47 +02:00
'right' => 'À droite ' ,
];
2020-07-02 19:48:47 +02:00
//Paramètre longueur maximale des commentaires en nb de caractères
2020-07-16 10:33:37 +02:00
public static $commentLength = [
2020-07-02 19:48:47 +02:00
'500' => '500' ,
'1000' => '1000' ,
'2000' => '2000' ,
'5000' => '5000' ,
'10000' => '10000'
];
2020-04-23 19:55:47 +02:00
2020-07-16 18:50:57 +02:00
// Permissions d'un article
2020-10-11 18:36:20 +02:00
public static $articleConsent = [
2020-10-14 11:07:38 +02:00
self :: EDIT_ALL => 'Tous les groupes' ,
2020-10-11 18:36:20 +02:00
self :: EDIT_GROUP => 'Groupe du propriétaire' ,
2021-01-08 10:49:31 +01:00
self :: EDIT_OWNER => 'Propriétaire'
2020-07-12 18:05:33 +02:00
];
2020-10-11 18:36:20 +02:00
2018-04-02 08:29:19 +02:00
public static $users = [];
2021-02-17 08:50:04 +01:00
const VERSION = '4.3' ;
2021-02-09 18:04:24 +01:00
const REALNAME = 'Blog' ;
2019-02-14 15:17:03 +01:00
2020-11-18 21:45:36 +01:00
/**
* 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
2020-11-20 13:44:32 +01:00
$feeds -> setTitle ( $this -> getData ([ 'page' , $this -> getUrl ( 0 ), 'title' ]));
2020-11-18 21:45:36 +01:00
$feeds -> setLink ( helper :: baseUrl () . $this -> getUrl ( 0 ));
2020-11-20 13:44:32 +01:00
$feeds -> setDescription ( $this -> getData ([ 'page' , $this -> getUrl ( 0 ), 'metaDescription' ]));
2020-11-18 21:45:36 +01:00
$feeds -> setChannelElement ( 'language' , 'fr-FR' );
2020-11-20 13:44:32 +01:00
$feeds -> setDate ( date ( 'r' , time ()));
2020-11-18 21:45:36 +01:00
$feeds -> addGenerator ();
// Corps des articles
$articleIdsPublishedOns = helper :: arrayCollumn ( $this -> getData ([ 'module' , $this -> getUrl ( 0 ), 'posts' ]), 'publishedOn' , 'SORT_DESC' );
$articleIdsStates = helper :: arrayCollumn ( $this -> getData ([ 'module' , $this -> getUrl ( 0 ), 'posts' ]), 'state' , 'SORT_DESC' );
foreach ( $articleIdsPublishedOns as $articleId => $articlePublishedOn ) {
if ( $articlePublishedOn <= time () AND $articleIdsStates [ $articleId ]) {
// Miniature
$parts = explode ( '/' , $this -> getData ([ 'module' , $this -> getUrl ( 0 ), 'posts' , $articleId , 'picture' ]));
$thumb = str_replace ( $parts [( count ( $parts ) - 1 )], 'mini_' . $parts [( count ( $parts ) - 1 )], $this -> getData ([ 'module' , $this -> getUrl ( 0 ), 'posts' , $articleId , 'picture' ]));
// Créer les articles du flux
$newsArticle = $feeds -> createNewItem ();
2020-11-20 13:44:32 +01:00
// Signature de l'article
$author = $this -> signature ( $this -> getData ([ 'module' , $this -> getUrl ( 0 ), 'posts' , $articleId , 'userId' ]));
2020-11-18 21:45:36 +01:00
$newsArticle -> addElementArray ([
2020-11-20 13:44:32 +01:00
'title' => $this -> getData ([ 'module' , $this -> getUrl ( 0 ), 'posts' , $articleId , 'title' ]),
'link' => helper :: baseUrl () . $this -> getUrl ( 0 ) . '/' . $articleId ,
'description' => '<img src="' . helper :: baseUrl () . self :: FILE_DIR . $thumb
. '" alt="' . $this -> getData ([ 'module' , $this -> getUrl ( 0 ), 'posts' , $articleId , 'title' ])
. '" title="' . $this -> getData ([ 'module' , $this -> getUrl ( 0 ), 'posts' , $articleId , 'title' ])
. '" />' .
$this -> getData ([ 'module' , $this -> getUrl ( 0 ), 'posts' , $articleId , 'content' ]),
2020-11-18 21:45:36 +01:00
]);
2020-11-20 17:32:38 +01:00
$newsArticle -> setAuthor ( $author , 'no@mail.com' );
$newsArticle -> setId ( helper :: baseUrl () . $this -> getUrl ( 0 ) . '/' . $articleId );
$newsArticle -> setDate ( date ( 'r' , $this -> getData ([ 'module' , $this -> getUrl ( 0 ), 'posts' , $articleId , 'publishedOn' ])));
2020-11-20 20:14:19 +01:00
$imageData = getimagesize ( helper :: baseUrl ( false ) . self :: FILE_DIR . 'thumb/' . $thumb );
$newsArticle -> addEnclosure ( helper :: baseUrl ( false ) . self :: FILE_DIR . 'thumb/' . $thumb ,
$imageData [ 0 ] * $imageData [ 1 ],
$imageData [ 'mime' ]
);
2020-11-18 21:45:36 +01:00
$feeds -> addItem ( $newsArticle );
}
}
// Valeurs en sortie
$this -> addOutput ([
'display' => self :: DISPLAY_RSS ,
'content' => $feeds -> generateFeed (),
'view' => 'rss'
]);
}
2018-04-02 08:29:19 +02:00
/**
* Édition
*/
public function add () {
// Soumission du formulaire
if ( $this -> isPost ()) {
2020-07-02 19:48:47 +02:00
// Modification de l'userId
if ( $this -> getUser ( 'group' ) === self :: GROUP_ADMIN ){
$newuserid = $this -> getInput ( 'blogAddUserId' , helper :: FILTER_STRING_SHORT , true );
}
else {
$newuserid = $this -> getUser ( 'id' );
}
2018-04-02 08:29:19 +02:00
// Incrémente l'id de l'article
$articleId = helper :: increment ( $this -> getInput ( 'blogAddTitle' , helper :: FILTER_ID ), $this -> getData ([ 'page' ]));
$articleId = helper :: increment ( $articleId , ( array ) $this -> getData ([ 'module' , $this -> getUrl ( 0 )]));
$articleId = helper :: increment ( $articleId , array_keys ( self :: $actions ));
// Crée l'article
2020-10-11 18:36:20 +02:00
$this -> setData ([ 'module' ,
$this -> getUrl ( 0 ),
2020-11-18 21:45:14 +01:00
'posts' ,
2020-10-11 18:36:20 +02:00
$articleId , [
2020-11-18 21:45:14 +01:00
'comment' => $this -> getData ([ 'module' , $this -> getUrl ( 0 ), 'posts' , $this -> getUrl ( 2 ), 'comment' ]),
2020-10-11 18:36:20 +02:00
'content' => $this -> getInput ( 'blogAddContent' , null ),
'picture' => $this -> getInput ( 'blogAddPicture' , helper :: FILTER_STRING_SHORT , true ),
'hidePicture' => $this -> getInput ( 'blogAddHidePicture' , helper :: FILTER_BOOLEAN ),
'pictureSize' => $this -> getInput ( 'blogAddPictureSize' , helper :: FILTER_STRING_SHORT ),
'picturePosition' => $this -> getInput ( 'blogAddPicturePosition' , helper :: FILTER_STRING_SHORT ),
'publishedOn' => $this -> getInput ( 'blogAddPublishedOn' , helper :: FILTER_DATETIME , true ),
'state' => $this -> getInput ( 'blogAddState' , helper :: FILTER_BOOLEAN ),
'title' => $this -> getInput ( 'blogAddTitle' , helper :: FILTER_STRING_SHORT , true ),
'userId' => $newuserid ,
2020-10-17 16:45:30 +02:00
'editConsent' => $this -> getInput ( 'blogAddConsent' ) === self :: EDIT_GROUP ? $this -> getUser ( 'group' ) : $this -> getInput ( 'blogAddConsent' ),
2020-10-11 18:36:20 +02:00
'commentMaxlength' => $this -> getInput ( 'blogAddCommentMaxlength' ),
'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 )
]
]);
2018-04-02 08:29:19 +02:00
// Valeurs en sortie
$this -> addOutput ([
'redirect' => helper :: baseUrl () . $this -> getUrl ( 0 ) . '/config' ,
'notification' => 'Nouvel article 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 article' ,
'vendor' => [
'flatpickr' ,
'tinymce'
],
'view' => 'add'
]);
}
/**
* Liste des commentaires
*/
public function comment () {
2020-11-18 21:45:36 +01:00
$comments = $this -> getData ([ 'module' , $this -> getUrl ( 0 ), 'posts' , $this -> getUrl ( 2 ), 'comment' ]);
2020-07-02 19:48:47 +02:00
self :: $commentsDelete = template :: button ( 'blogCommentDeleteAll' , [
'class' => 'blogCommentDeleteAll buttonRed' ,
'href' => helper :: baseUrl () . $this -> getUrl ( 0 ) . '/commentDeleteAll/' . $this -> getUrl ( 2 ) . '/' . $_SESSION [ 'csrf' ] ,
'ico' => 'cancel' ,
'value' => 'Tout effacer'
]);
2018-04-02 08:29:19 +02:00
// Ids des commentaires par ordre de création
$commentIds = array_keys ( helper :: arrayCollumn ( $comments , 'createdOn' , 'SORT_DESC' ));
// Pagination
2018-12-09 00:52:05 +01:00
$pagination = helper :: pagination ( $commentIds , $this -> getUrl (), $this -> getData ([ 'config' , 'itemsperPage' ]));
2018-04-02 08:29:19 +02:00
// 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 ]];
2020-07-16 12:06:51 +02:00
// Bouton d'approbation
$buttonApproval = '' ;
2020-07-17 10:05:24 +02:00
// Compatibilité avec les commentaires des versions précédentes, les valider
$comment [ 'approval' ] = array_key_exists ( 'approval' , $comment ) === false ? true : $comment [ 'approval' ] ;
2020-11-18 21:45:14 +01:00
if ( $this -> getData ([ 'module' , $this -> getUrl ( 0 ), 'posts' , $this -> getUrl ( 2 ), 'commentApproved' ]) === true ) {
2020-10-15 21:13:48 +02:00
$buttonApproval = template :: button ( 'blogCommentApproved' . $commentIds [ $i ], [
2020-10-27 21:37:56 +01:00
'class' => $comment [ 'approval' ] === true ? 'blogCommentRejected buttonGreen' : 'blogCommentApproved buttonRed' ,
2020-07-16 12:06:51 +02:00
'href' => helper :: baseUrl () . $this -> getUrl ( 0 ) . '/commentApprove/' . $this -> getUrl ( 2 ) . '/' . $commentIds [ $i ] . '/' . $_SESSION [ 'csrf' ] ,
'value' => $comment [ 'approval' ] === true ? 'A' : 'R'
]);
}
2020-06-03 09:07:00 +02:00
self :: $comments [] = [
2020-11-01 13:38:25 +01:00
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' ])),
2018-04-02 08:29:19 +02:00
$comment [ 'content' ],
$comment [ 'userId' ] ? $this -> getData ([ 'user' , $comment [ 'userId' ], 'firstname' ]) . ' ' . $this -> getData ([ 'user' , $comment [ 'userId' ], 'lastname' ]) : $comment [ 'author' ],
2020-07-16 12:06:51 +02:00
$buttonApproval ,
2018-04-02 08:29:19 +02:00
template :: button ( 'blogCommentDelete' . $commentIds [ $i ], [
'class' => 'blogCommentDelete buttonRed' ,
2020-07-02 19:48:47 +02:00
'href' => helper :: baseUrl () . $this -> getUrl ( 0 ) . '/commentDelete/' . $this -> getUrl ( 2 ) . '/' . $commentIds [ $i ] . '/' . $_SESSION [ 'csrf' ] ,
2018-04-02 08:29:19 +02:00
'value' => template :: ico ( 'cancel' )
])
];
}
// Valeurs en sortie
$this -> addOutput ([
2020-11-18 21:45:14 +01:00
'title' => 'Gestion des commentaires : ' . $this -> getData ([ 'module' , $this -> getUrl ( 0 ), 'posts' , $this -> getUrl ( 2 ), 'title' ]),
2018-04-02 08:29:19 +02:00
'view' => 'comment'
]);
}
/**
* Suppression de commentaire
*/
public function commentDelete () {
// Le commentaire n'existe pas
2020-11-17 08:52:32 +01:00
if ( $this -> getData ([ 'module' , $this -> getUrl ( 0 ), 'posts' , $this -> getUrl ( 2 ), 'comment' , $this -> getUrl ( 3 )]) === null ) {
2018-04-02 08:29:19 +02:00
// Valeurs en sortie
$this -> addOutput ([
'access' => false
]);
}
2019-01-16 19:25:09 +01:00
// 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'
]);
2020-06-03 09:07:00 +02:00
}
2018-04-02 08:29:19 +02:00
// Suppression
else {
2020-11-17 08:52:32 +01:00
$this -> deleteData ([ 'module' , $this -> getUrl ( 0 ), 'posts' , $this -> getUrl ( 2 ), 'comment' , $this -> getUrl ( 3 )]);
2018-04-02 08:29:19 +02:00
// Valeurs en sortie
2020-07-02 19:35:51 +02:00
$this -> addOutput ([
2020-07-02 19:48:47 +02:00
'redirect' => helper :: baseUrl () . $this -> getUrl ( 0 ) . '/comment/' . $this -> getUrl ( 2 ),
2020-07-02 19:38:52 +02:00
'notification' => 'Commentaire supprimé' ,
2020-07-02 19:35:51 +02:00
'state' => true
]);
}
}
2020-07-02 19:48:47 +02:00
/**
* Suppression de tous les commentaires de l ' article $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 {
2020-11-18 21:45:14 +01:00
$this -> setData ([ 'module' , $this -> getUrl ( 0 ), 'posts' , $this -> getUrl ( 2 ), 'comment' ,[] ]);
2020-07-02 19:48:47 +02:00
// Valeurs en sortie
$this -> addOutput ([
'redirect' => helper :: baseUrl () . $this -> getUrl ( 0 ) . '/comment' ,
'notification' => 'Commentaires supprimés' ,
'state' => true
]);
}
}
2020-07-16 12:06:51 +02:00
/**
* Approbation oou désapprobation de commentaire
*/
public function commentApprove () {
// Le commentaire n'existe pas
2020-11-18 21:45:14 +01:00
if ( $this -> getData ([ 'module' , $this -> getUrl ( 0 ), 'posts' , $this -> getUrl ( 2 ), 'comment' , $this -> getUrl ( 3 )]) === null ) {
2020-07-16 12:06:51 +02:00
// 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 {
2020-11-18 21:45:14 +01:00
$approved = ! $this -> getData ([ 'module' , $this -> getUrl ( 0 ), 'posts' , $this -> getUrl ( 2 ), 'comment' , $this -> getUrl ( 3 ), 'approval' ]) ;
$this -> setData ([ 'module' , $this -> getUrl ( 0 ), 'posts' , $this -> getUrl ( 2 ), 'comment' , $this -> getUrl ( 3 ), [
'author' => $this -> getData ([ 'module' , $this -> getUrl ( 0 ), 'posts' , $this -> getUrl ( 2 ), 'comment' , $this -> getUrl ( 3 ), 'author' ]),
'content' => $this -> getData ([ 'module' , $this -> getUrl ( 0 ), 'posts' , $this -> getUrl ( 2 ), 'comment' , $this -> getUrl ( 3 ), 'content' ]),
'createdOn' => $this -> getData ([ 'module' , $this -> getUrl ( 0 ), 'posts' , $this -> getUrl ( 2 ), 'comment' , $this -> getUrl ( 3 ), 'createdOn' ]),
'userId' => $this -> getData ([ 'module' , $this -> getUrl ( 0 ), 'posts' , $this -> getUrl ( 2 ), 'comment' , $this -> getUrl ( 3 ), 'userId' ]),
2020-10-28 06:29:49 +01:00
'approval' => $approved
2020-07-16 12:06:51 +02:00
]]);
// Valeurs en sortie
$this -> addOutput ([
'redirect' => helper :: baseUrl () . $this -> getUrl ( 0 ) . '/comment/' . $this -> getUrl ( 2 ),
2020-10-28 06:29:49 +01:00
'notification' => $approved ? 'Commentaire approuvé' : 'Commentaire rejeté' ,
'state' => $approved
2020-07-16 12:06:51 +02:00
]);
}
}
2018-04-02 08:29:19 +02:00
/**
* Configuration
*/
public function config () {
2020-11-16 18:39:32 +01:00
// 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 )
]]);
// Valeurs en sortie
$this -> addOutput ([
'redirect' => helper :: baseUrl () . $this -> getUrl ( 0 ) . '/config' ,
'notification' => 'Modifications enregistrées' ,
'state' => true
]);
} else {
// Ids des articles par ordre de publication
2020-11-18 21:45:36 +01:00
$articleIds = array_keys ( helper :: arrayCollumn ( $this -> getData ([ 'module' , $this -> getUrl ( 0 ), 'posts' ]), 'publishedOn' , 'SORT_DESC' ));
2020-11-18 21:45:14 +01:00
// Gestion des droits d'accès
$filterData = [];
foreach ( $articleIds as $key => $value ) {
if (
( // Propriétaire
$this -> getData ([ 'module' , $this -> getUrl ( 0 ), 'posts' , $value , 'editConsent' ]) === self :: EDIT_OWNER
AND ( $this -> getData ([ 'module' , $this -> getUrl ( 0 ), 'posts' , $value , 'userId' ]) === $this -> getUser ( 'id' )
OR $this -> getUser ( 'group' ) === self :: GROUP_ADMIN )
)
OR (
// Groupe
$this -> getData ([ 'module' , $this -> getUrl ( 0 ), 'posts' , $value , 'editConsent' ]) !== self :: EDIT_OWNER
2020-11-18 21:45:36 +01:00
AND $this -> getUser ( 'group' ) >= $this -> getData ([ 'module' , $this -> getUrl ( 0 ), 'posts' , $value , 'editConsent' ])
2020-11-18 21:45:14 +01:00
)
OR (
// Tout le monde
$this -> getData ([ 'module' , $this -> getUrl ( 0 ), 'posts' , $value , 'editConsent' ]) === self :: EDIT_ALL
)
) {
$filterData [] = $value ;
}
2020-07-16 18:50:57 +02:00
}
2020-11-18 21:45:14 +01:00
$articleIds = $filterData ;
2020-11-16 18:39:32 +01:00
// Pagination
$pagination = helper :: pagination ( $articleIds , $this -> getUrl (), $this -> getData ([ 'config' , 'itemsperPage' ]));
// Liste des pages
self :: $pages = $pagination [ 'pages' ];
// Articles en fonction de la pagination
for ( $i = $pagination [ 'first' ]; $i < $pagination [ 'last' ]; $i ++ ) {
2020-11-18 21:45:14 +01:00
// Nombre de commentaires à approuver et approuvés
2020-11-18 21:45:36 +01:00
$approvals = helper :: arrayCollumn ( $this -> getData ([ 'module' , $this -> getUrl ( 0 ), 'posts' , $articleIds [ $i ], 'comment' ]), 'approval' , 'SORT_DESC' );
2020-11-18 21:45:14 +01:00
if ( is_array ( $approvals ) ) {
$a = array_values ( $approvals );
$toApprove = count ( array_keys ( $a , false ));
$approved = count ( array_keys ( $a , true ));
} else {
$toApprove = 0 ;
2020-11-18 21:45:36 +01:00
$approved = count ( $this -> getData ([ 'module' , $this -> getUrl ( 0 ), 'posts' , $articleIds [ $i ], 'comment' ]));
2020-11-18 21:45:14 +01:00
}
2020-11-16 18:39:32 +01:00
// Met en forme le tableau
2020-11-18 21:45:14 +01:00
$date = mb_detect_encoding ( strftime ( '%d %B %Y' , $this -> getData ([ 'module' , $this -> getUrl ( 0 ), 'posts' , $articleIds [ $i ], 'publishedOn' ])), 'UTF-8' , true )
2020-11-18 21:45:36 +01:00
? strftime ( '%d %B %Y' , $this -> getData ([ 'module' , $this -> getUrl ( 0 ), 'posts' , $articleIds [ $i ], 'publishedOn' ]))
: utf8_encode ( strftime ( '%d %B %Y' , $this -> getData ([ 'module' , $this -> getUrl ( 0 ), 'posts' , $articleIds [ $i ], 'publishedOn' ])));
$heure = mb_detect_encoding ( strftime ( '%H:%M' , $this -> getData ([ 'module' , $this -> getUrl ( 0 ), 'posts' , $articleIds [ $i ], 'publishedOn' ])), 'UTF-8' , true )
? strftime ( '%H:%M' , $this -> getData ([ 'module' , $this -> getUrl ( 0 ), 'posts' , $articleIds [ $i ], 'publishedOn' ]))
: utf8_encode ( strftime ( '%H:%M' , $this -> getData ([ 'module' , $this -> getUrl ( 0 ), 'posts' , $articleIds [ $i ], 'publishedOn' ])));
2020-11-16 18:39:32 +01:00
self :: $articles [] = [
2020-11-18 21:45:14 +01:00
'<a href="' . helper :: baseurl () . $this -> getUrl ( 0 ) . '/' . $articleIds [ $i ] . '" target="_blank" >' .
$this -> getData ([ 'module' , $this -> getUrl ( 0 ), 'posts' , $articleIds [ $i ], 'title' ]) .
'</a>' ,
2020-11-16 18:39:32 +01:00
$date . ' à ' . $heure ,
2020-11-18 21:45:36 +01:00
self :: $states [ $this -> getData ([ 'module' , $this -> getUrl ( 0 ), 'posts' , $articleIds [ $i ], 'state' ])],
2020-11-18 21:45:14 +01:00
// Bouton pour afficher les commentaires de l'article
template :: button ( 'blogConfigComment' . $articleIds [ $i ], [
'class' => ( $toApprove || $approved ) > 0 ? 'buttonBlue' : 'buttonGrey' ,
'href' => ( $toApprove || $approved ) > 0 ? helper :: baseUrl () . $this -> getUrl ( 0 ) . '/comment/' . $articleIds [ $i ] : '' ,
'value' => $toApprove > 0 ? $toApprove . '/' . $approved : $approved
]),
2020-11-16 18:39:32 +01:00
template :: button ( 'blogConfigEdit' . $articleIds [ $i ], [
'href' => helper :: baseUrl () . $this -> getUrl ( 0 ) . '/edit/' . $articleIds [ $i ] . '/' . $_SESSION [ 'csrf' ],
'value' => template :: ico ( 'pencil' )
]),
template :: button ( 'blogConfigDelete' . $articleIds [ $i ], [
'class' => 'blogConfigDelete buttonRed' ,
'href' => helper :: baseUrl () . $this -> getUrl ( 0 ) . '/delete/' . $articleIds [ $i ] . '/' . $_SESSION [ 'csrf' ],
'value' => template :: ico ( 'cancel' )
])
];
2020-07-16 10:33:37 +02:00
}
2020-11-18 21:45:36 +01:00
// Valeurs en sortie
$this -> addOutput ([
'title' => 'Configuration du module' ,
'view' => 'config'
]);
2018-04-02 08:29:19 +02:00
}
}
/**
* Suppression
*/
public function delete () {
2020-11-17 08:52:32 +01:00
if ( $this -> getData ([ 'module' , $this -> getUrl ( 0 ), 'posts' , $this -> getUrl ( 2 )]) === null ) {
2018-04-02 08:29:19 +02:00
// Valeurs en sortie
$this -> addOutput ([
'access' => false
]);
}
2019-01-08 17:55:18 +01:00
// Jeton incorrect
2019-01-16 19:25:09 +01:00
elseif ( $this -> getUrl ( 3 ) !== $_SESSION [ 'csrf' ]) {
2019-01-08 17:55:18 +01:00
// Valeurs en sortie
$this -> addOutput ([
2019-01-16 19:25:09 +01:00
'redirect' => helper :: baseUrl () . $this -> getUrl ( 0 ) . '/config' ,
'notification' => 'Action non autorisée'
2019-01-08 17:55:18 +01:00
]);
2020-06-03 09:07:00 +02:00
}
2018-04-02 08:29:19 +02:00
// Suppression
else {
2020-11-17 08:52:32 +01:00
$this -> deleteData ([ 'module' , $this -> getUrl ( 0 ), 'posts' , $this -> getUrl ( 2 )]);
2018-04-02 08:29:19 +02:00
// Valeurs en sortie
$this -> addOutput ([
'redirect' => helper :: baseUrl () . $this -> getUrl ( 0 ) . '/config' ,
'notification' => 'Article supprimé' ,
'state' => true
]);
}
}
/**
* Édition
*/
public function edit () {
2019-01-16 19:25:09 +01:00
// 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'
]);
2020-06-03 09:07:00 +02:00
}
2018-04-02 08:29:19 +02:00
// L'article n'existe pas
2020-11-17 08:52:32 +01:00
if ( $this -> getData ([ 'module' , $this -> getUrl ( 0 ), 'posts' , $this -> getUrl ( 2 )]) === null ) {
2018-04-02 08:29:19 +02:00
// Valeurs en sortie
$this -> addOutput ([
'access' => false
]);
}
// L'article existe
else {
// Soumission du formulaire
2020-06-03 09:07:00 +02:00
if ( $this -> isPost ()) {
2020-07-02 19:48:47 +02:00
if ( $this -> getUser ( 'group' ) === self :: GROUP_ADMIN ){
$newuserid = $this -> getInput ( 'blogEditUserId' , helper :: FILTER_STRING_SHORT , true );
}
else {
$newuserid = $this -> getUser ( 'id' );
}
2018-04-02 08:29:19 +02:00
$articleId = $this -> getInput ( 'blogEditTitle' , helper :: FILTER_ID , true );
// Incrémente le nouvel id de l'article
if ( $articleId !== $this -> getUrl ( 2 )) {
$articleId = helper :: increment ( $articleId , $this -> getData ([ 'page' ]));
2020-11-18 21:45:14 +01:00
$articleId = helper :: increment ( $articleId , $this -> getData ([ 'module' , $this -> getUrl ( 0 ), 'posts' ]));
2018-04-02 08:29:19 +02:00
$articleId = helper :: increment ( $articleId , array_keys ( self :: $actions ));
}
2020-10-11 18:36:20 +02:00
$this -> setData ([ 'module' ,
$this -> getUrl ( 0 ),
2020-11-18 21:45:14 +01:00
'posts' ,
2020-10-11 18:36:20 +02:00
$articleId , [
2020-11-18 21:45:14 +01:00
'comment' => $this -> getData ([ 'module' , $this -> getUrl ( 0 ), 'posts' , $this -> getUrl ( 2 ), 'comment' ]),
2020-10-11 18:36:20 +02:00
'content' => $this -> getInput ( 'blogEditContent' , null ),
'picture' => $this -> getInput ( 'blogEditPicture' , helper :: FILTER_STRING_SHORT , true ),
'hidePicture' => $this -> getInput ( 'blogEditHidePicture' , helper :: FILTER_BOOLEAN ),
'pictureSize' => $this -> getInput ( 'blogEditPictureSize' , helper :: FILTER_STRING_SHORT ),
'picturePosition' => $this -> getInput ( 'blogEditPicturePosition' , helper :: FILTER_STRING_SHORT ),
'publishedOn' => $this -> getInput ( 'blogEditPublishedOn' , helper :: FILTER_DATETIME , true ),
'state' => $this -> getInput ( 'blogEditState' , helper :: FILTER_BOOLEAN ),
'title' => $this -> getInput ( 'blogEditTitle' , helper :: FILTER_STRING_SHORT , true ),
'userId' => $newuserid ,
2020-10-15 21:13:48 +02:00
'editConsent' => $this -> getInput ( 'blogEditConsent' ) === self :: EDIT_GROUP ? $this -> getUser ( 'group' ) : $this -> getInput ( 'blogEditConsent' ),
2020-10-13 19:07:10 +02:00
'commentMaxlength' => $this -> getInput ( 'blogEditCommentMaxlength' ),
2020-10-11 18:36:20 +02:00
'commentApproved' => $this -> getInput ( 'blogEditCommentApproved' , helper :: FILTER_BOOLEAN ),
'commentClose' => $this -> getInput ( 'blogEditCommentClose' , helper :: FILTER_BOOLEAN ),
'commentNotification' => $this -> getInput ( 'blogEditCommentNotification' , helper :: FILTER_BOOLEAN ),
'commentGroupNotification' => $this -> getInput ( 'blogEditCommentGroupNotification' , helper :: FILTER_INT )
]
]);
2018-04-02 08:29:19 +02:00
// Supprime l'ancien article
if ( $articleId !== $this -> getUrl ( 2 )) {
2020-11-17 08:52:32 +01:00
$this -> deleteData ([ 'module' , $this -> getUrl ( 0 ), 'posts' , $this -> getUrl ( 2 )]);
2018-04-02 08:29:19 +02:00
}
// 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 ) {
2020-09-28 16:44:01 +02:00
// Les membres ne sont pas éditeurs, les exclure de la liste
2020-10-14 19:17:13 +02:00
if ( $this -> getData ([ 'user' , $userId , 'group' ]) < self :: GROUP_MODERATOR ) {
2020-09-28 16:44:01 +02:00
unset ( self :: $users [ $userId ]);
2020-10-11 18:36:20 +02:00
}
2020-07-16 18:50:57 +02:00
$userFirstname = $userFirstname . ' ' . $this -> getData ([ 'user' , $userId , 'lastname' ]) . ' (' . self :: $groupEdits [ $this -> getData ([ 'user' , $userId , 'group' ])] . ')' ;
2018-04-02 08:29:19 +02:00
}
unset ( $userFirstname );
// Valeurs en sortie
$this -> addOutput ([
2020-11-17 08:52:32 +01:00
'title' => $this -> getData ([ 'module' , $this -> getUrl ( 0 ), 'posts' , $this -> getUrl ( 2 ), 'title' ]),
2018-04-02 08:29:19 +02:00
'vendor' => [
'flatpickr' ,
'tinymce'
],
'view' => 'edit'
]);
}
}
/**
* Accueil ( deux affichages en un pour éviter une url à rallonge )
*/
public function index () {
// 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
2020-11-17 08:52:32 +01:00
if ( $this -> getData ([ 'module' , $this -> getUrl ( 0 ), 'posts' , $this -> getUrl ( 1 )]) === null ) {
2018-04-02 08:29:19 +02:00
// Valeurs en sortie
$this -> addOutput ([
'access' => false
]);
}
// L'article existe
else {
// Soumission du formulaire
if ( $this -> isPost ()) {
2020-08-10 19:07:17 +02:00
// Check la captcha
2018-04-02 08:29:19 +02:00
if (
$this -> getUser ( 'password' ) !== $this -> getInput ( 'ZWII_USER_PASSWORD' )
2020-10-01 15:50:19 +02:00
//AND $this->getInput('blogArticlecaptcha', helper::FILTER_INT) !== $this->getInput('blogArticlecaptchaFirstNumber', helper::FILTER_INT) + $this->getInput('blogArticlecaptchaSecondNumber', helper::FILTER_INT))
2020-10-04 12:16:37 +02:00
AND password_verify ( $this -> getInput ( 'blogArticleCaptcha' , helper :: FILTER_INT ), $this -> getInput ( 'blogArticleCaptchaResult' ) ) === false )
2018-04-02 08:29:19 +02:00
{
2020-10-04 12:16:37 +02:00
self :: $inputNotices [ 'blogArticleCaptcha' ] = 'Incorrect' ;
2018-04-02 08:29:19 +02:00
}
// Crée le commentaire
2020-11-18 21:45:14 +01:00
$commentId = helper :: increment ( uniqid (), $this -> getData ([ 'module' , $this -> getUrl ( 0 ), 'posts' , $this -> getUrl ( 1 ), 'comment' ]));
2020-10-03 14:48:00 +02:00
$content = $this -> getInput ( 'blogArticleContent' , false );
2020-11-18 21:45:14 +01:00
$this -> setData ([ 'module' , $this -> getUrl ( 0 ), 'posts' , $this -> getUrl ( 1 ), 'comment' , $commentId , [
2018-04-04 21:20:50 +02:00
'author' => $this -> getInput ( 'blogArticleAuthor' , helper :: FILTER_STRING_SHORT , empty ( $this -> getInput ( 'blogArticleUserId' )) ? TRUE : FALSE ),
2020-10-03 14:48:00 +02:00
'content' => $content ,
2018-04-02 08:29:19 +02:00
'createdOn' => time (),
'userId' => $this -> getInput ( 'blogArticleUserId' ),
2020-11-18 21:45:36 +01:00
'approval' => ! $this -> getData ([ 'module' , $this -> getUrl ( 0 ), 'posts' , $this -> getUrl ( 1 ), 'commentApproved' ]) // true commentaire publié false en attente de publication
2018-04-02 08:29:19 +02:00
]]);
2019-05-02 13:21:48 +02:00
// Envoi d'une notification aux administrateurs
// Init tableau
$to = [];
2020-06-03 09:07:00 +02:00
// Liste des destinataires
2019-05-02 13:21:48 +02:00
foreach ( $this -> getData ([ 'user' ]) as $userId => $user ) {
2020-11-18 21:45:14 +01:00
if ( $user [ 'group' ] >= $this -> getData ([ 'module' , $this -> getUrl ( 0 ), 'posts' , $this -> getUrl ( 1 ), 'commentGroupNotification' ]) ) {
2019-05-02 13:21:48 +02:00
$to [] = $user [ 'mail' ];
2021-01-08 10:49:31 +01:00
$firstname [] = $user [ 'firstname' ];
$lastname [] = $user [ 'lastname' ];
2019-05-02 13:21:48 +02:00
}
}
2020-06-03 09:07:00 +02:00
// Envoi du mail $sent code d'erreur ou de réussite
2020-11-18 21:45:14 +01:00
$notification = $this -> getData ([ 'module' , $this -> getUrl ( 0 ), 'posts' , $this -> getUrl ( 1 ), 'commentApproved' ]) === true ? 'Commentaire déposé en attente d\'approbation' : 'Commentaire déposé' ;
if ( $this -> getData ([ 'module' , $this -> getUrl ( 0 ), 'posts' , $this -> getUrl ( 1 ), 'commentNotification' ]) === true ) {
2021-01-08 10:49:31 +01:00
$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\'article <a href="' . helper :: baseUrl () . $this -> getUrl ( 0 ) . '/ ' . $this -> getUrl ( 1 ) . '">' . $this -> getData ([ 'module' , $this -> getUrl ( 0 ), 'posts' , $this -> getUrl ( 1 ), 'title' ]) . '</a> a reçu un nouveau commentaire.<br><br>' ,
''
);
if ( $sent === false ) $error ++ ;
}
2019-05-02 13:21:48 +02:00
// Valeurs en sortie
$this -> addOutput ([
'redirect' => helper :: baseUrl () . $this -> getUrl () . '#comment' ,
2021-01-08 10:49:31 +01:00
'notification' => ( $error === 0 ? $notification . '<br/>Une notification a été envoyée.' : $notification . '<br/> Erreur de notification : ' . $sent ),
2020-06-03 09:07:00 +02:00
'state' => ( $sent === true ? true : null )
2019-05-02 13:21:48 +02:00
]);
} else {
// Valeurs en sortie
$this -> addOutput ([
'redirect' => helper :: baseUrl () . $this -> getUrl () . '#comment' ,
2020-07-16 13:59:04 +02:00
'notification' => $notification ,
2020-06-03 09:07:00 +02:00
'state' => true
2019-05-02 13:21:48 +02:00
]);
}
2020-06-03 09:07:00 +02:00
2018-04-02 08:29:19 +02:00
}
2020-10-04 12:21:46 +02:00
// Ids des commentaires approuvés par ordre de publication
2020-11-18 21:45:36 +01:00
$commentsApproved = $this -> getData ([ 'module' , $this -> getUrl ( 0 ), 'posts' , $this -> getUrl ( 1 ), 'comment' ]);
2020-10-11 18:36:20 +02:00
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'article
self :: $nbCommentsApproved = count ( $commentsApproved );
2020-10-04 12:21:46 +02:00
}
$commentIds = array_keys ( helper :: arrayCollumn ( $commentsApproved , 'createdOn' , 'SORT_DESC' ));
2018-04-02 08:29:19 +02:00
// Pagination
2018-12-09 00:52:05 +01:00
$pagination = helper :: pagination ( $commentIds , $this -> getUrl (), $this -> getData ([ 'config' , 'itemsperPage' ]), '#comment' );
2018-04-02 08:29:19 +02:00
// Liste des pages
self :: $pages = $pagination [ 'pages' ];
2020-07-02 19:48:47 +02:00
// Signature de l'article
2020-11-20 13:44:32 +01:00
self :: $articleSignature = $this -> signature ( $this -> getData ([ 'module' , $this -> getUrl ( 0 ), 'posts' , $this -> getUrl ( 1 ), 'userId' ]));
2020-07-02 19:48:47 +02:00
// Signature du commentaire édité
if ( $this -> getUser ( 'password' ) === $this -> getInput ( 'ZWII_USER_PASSWORD' )) {
2020-11-20 13:44:32 +01:00
self :: $editCommentSignature = $this -> signature ( $this -> getUser ( 'id' ));
2020-07-02 19:48:47 +02:00
}
2018-04-02 08:29:19 +02:00
// Commentaires en fonction de la pagination
for ( $i = $pagination [ 'first' ]; $i < $pagination [ 'last' ]; $i ++ ) {
2020-07-02 19:48:47 +02:00
// Signatures des commentaires
2020-11-18 21:45:14 +01:00
$e = $this -> getData ([ 'module' , $this -> getUrl ( 0 ), 'posts' , $this -> getUrl ( 1 ), 'comment' , $commentIds [ $i ], 'userId' ]);
2020-07-02 19:48:47 +02:00
if ( $e ) {
2020-11-20 13:44:32 +01:00
self :: $commentsSignature [ $commentIds [ $i ]] = $this -> signature ( $e );
2020-07-02 19:48:47 +02:00
} else {
2020-11-18 21:45:14 +01:00
self :: $commentsSignature [ $commentIds [ $i ]] = $this -> getData ([ 'module' , $this -> getUrl ( 0 ), 'posts' , $this -> getUrl ( 1 ), 'comment' , $commentIds [ $i ], 'author' ]);
2020-07-02 19:48:47 +02:00
}
2020-07-16 13:59:04 +02:00
// Données du commentaire si approuvé
2020-11-18 21:45:36 +01:00
if ( $this -> getData ([ 'module' , $this -> getUrl ( 0 ), 'posts' , $this -> getUrl ( 1 ), 'comment' , $commentIds [ $i ], 'approval' ]) === true ) {
self :: $comments [ $commentIds [ $i ]] = $this -> getData ([ 'module' , $this -> getUrl ( 0 ), 'posts' , $this -> getUrl ( 1 ), 'comment' , $commentIds [ $i ]]);
2020-07-16 13:59:04 +02:00
}
2018-04-02 08:29:19 +02:00
}
// Valeurs en sortie
$this -> addOutput ([
'showBarEditButton' => true ,
2020-11-18 21:45:14 +01:00
'title' => $this -> getData ([ 'module' , $this -> getUrl ( 0 ), 'posts' , $this -> getUrl ( 1 ), 'title' ]),
2020-07-02 19:48:47 +02:00
'vendor' => [
'tinymce'
],
2018-04-02 08:29:19 +02:00
'view' => 'article'
]);
}
}
// Liste des articles
else {
// Ids des articles par ordre de publication
2020-11-17 08:52:32 +01:00
$articleIdsPublishedOns = helper :: arrayCollumn ( $this -> getData ([ 'module' , $this -> getUrl ( 0 ), 'posts' ]), 'publishedOn' , 'SORT_DESC' );
$articleIdsStates = helper :: arrayCollumn ( $this -> getData ([ 'module' , $this -> getUrl ( 0 ), 'posts' ]), 'state' , 'SORT_DESC' );
2018-04-02 08:29:19 +02:00
$articleIds = [];
foreach ( $articleIdsPublishedOns as $articleId => $articlePublishedOn ) {
if ( $articlePublishedOn <= time () AND $articleIdsStates [ $articleId ]) {
$articleIds [] = $articleId ;
}
}
// Pagination
2018-12-09 00:52:05 +01:00
$pagination = helper :: pagination ( $articleIds , $this -> getUrl (), $this -> getData ([ 'config' , 'itemsperPage' ]));
2018-04-02 08:29:19 +02:00
// Liste des pages
self :: $pages = $pagination [ 'pages' ];
// Articles en fonction de la pagination
for ( $i = $pagination [ 'first' ]; $i < $pagination [ 'last' ]; $i ++ ) {
2020-11-17 08:52:32 +01:00
self :: $articles [ $articleIds [ $i ]] = $this -> getData ([ 'module' , $this -> getUrl ( 0 ), 'posts' , $articleIds [ $i ]]);
2018-04-02 08:29:19 +02:00
}
// Valeurs en sortie
$this -> addOutput ([
'showBarEditButton' => true ,
'showPageContent' => true ,
'view' => 'index'
]);
}
}
2020-11-20 13:44:32 +01:00
/**
* 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' ]);
}
}
2020-07-02 19:48:47 +02:00
}
2020-10-14 11:07:38 +02:00