From db41e8f060e2a9cec84e080bca029932af7de7d3 Mon Sep 17 00:00:00 2001 From: Fred Tempez Date: Wed, 5 Oct 2022 15:19:19 +0200 Subject: [PATCH] Slash devant la classe strftime --- core/core.php | 6 +- core/module/addon/addon.php | 594 ---------- core/module/config/config.php | 6 +- core/module/plugin/plugin.php | 12 +- core/module/user/user.php | 6 +- module/blog/blog.php | 30 +- module/blog/view/article/article.php | 18 +- module/blog/view/index/index.php | 18 +- module/forum/forum.php | 908 --------------- module/forum/ressource/feed-icon-16.gif | Bin 652 -> 0 bytes module/forum/vendor/FeedWriter/ATOM.php | 38 - module/forum/vendor/FeedWriter/Feed.php | 1017 ----------------- .../FeedWriter/InvalidOperationException.php | 33 - module/forum/vendor/FeedWriter/Item.php | 413 ------- module/forum/vendor/FeedWriter/README.md | 42 - module/forum/vendor/FeedWriter/RSS1.php | 37 - module/forum/vendor/FeedWriter/RSS2.php | 37 - module/forum/vendor/furl/LICENSE | 21 - module/forum/vendor/furl/README.md | 4 - module/forum/vendor/furl/inc.json | 3 - module/forum/vendor/furl/jquery.furl.js | 76 -- module/forum/view/add/add.css | 18 - module/forum/view/add/add.js.php | 58 - module/forum/view/add/add.php | 109 -- module/forum/view/article/article.css | 63 - module/forum/view/article/article.js.php | 44 - module/forum/view/article/article.php | 164 --- module/forum/view/comment/comment.css | 18 - module/forum/view/comment/comment.js.php | 63 - module/forum/view/comment/comment.php | 22 - module/forum/view/config/config.css | 18 - module/forum/view/config/config.js.php | 22 - module/forum/view/config/config.php | 37 - module/forum/view/edit/edit.css | 18 - module/forum/view/edit/edit.js.php | 71 -- module/forum/view/edit/edit.php | 152 --- module/forum/view/index/index.css | 104 -- module/forum/view/index/index.php | 155 --- module/forum/view/option/option.css | 18 - module/forum/view/option/option.php | 60 - module/forum/view/rss/rss.php | 1 - module/news/news.php | 48 +- module/news/view/article/article.php | 12 +- module/news/view/index/index.php | 6 +- 44 files changed, 81 insertions(+), 4519 deletions(-) delete mode 100644 core/module/addon/addon.php delete mode 100644 module/forum/forum.php delete mode 100644 module/forum/ressource/feed-icon-16.gif delete mode 100644 module/forum/vendor/FeedWriter/ATOM.php delete mode 100644 module/forum/vendor/FeedWriter/Feed.php delete mode 100644 module/forum/vendor/FeedWriter/InvalidOperationException.php delete mode 100644 module/forum/vendor/FeedWriter/Item.php delete mode 100644 module/forum/vendor/FeedWriter/README.md delete mode 100644 module/forum/vendor/FeedWriter/RSS1.php delete mode 100644 module/forum/vendor/FeedWriter/RSS2.php delete mode 100644 module/forum/vendor/furl/LICENSE delete mode 100644 module/forum/vendor/furl/README.md delete mode 100644 module/forum/vendor/furl/inc.json delete mode 100644 module/forum/vendor/furl/jquery.furl.js delete mode 100644 module/forum/view/add/add.css delete mode 100644 module/forum/view/add/add.js.php delete mode 100644 module/forum/view/add/add.php delete mode 100644 module/forum/view/article/article.css delete mode 100644 module/forum/view/article/article.js.php delete mode 100644 module/forum/view/article/article.php delete mode 100644 module/forum/view/comment/comment.css delete mode 100644 module/forum/view/comment/comment.js.php delete mode 100644 module/forum/view/comment/comment.php delete mode 100644 module/forum/view/config/config.css delete mode 100644 module/forum/view/config/config.js.php delete mode 100644 module/forum/view/config/config.php delete mode 100644 module/forum/view/edit/edit.css delete mode 100644 module/forum/view/edit/edit.js.php delete mode 100644 module/forum/view/edit/edit.php delete mode 100644 module/forum/view/index/index.css delete mode 100644 module/forum/view/index/index.php delete mode 100644 module/forum/view/option/option.css delete mode 100644 module/forum/view/option/option.php delete mode 100644 module/forum/view/rss/rss.php diff --git a/core/core.php b/core/core.php index ca458eb5..4cb304b2 100644 --- a/core/core.php +++ b/core/core.php @@ -2769,9 +2769,9 @@ class core extends common exit(); } // Journalisation - $dataLog = mb_detect_encoding(PHP81_BC\strftime('%d/%m/%y', time()), 'UTF-8', true) - ? PHP81_BC\strftime('%d/%m/%y', time()) . ';' . PHP81_BC\strftime('%R', time()) . ';' - : utf8_encode(PHP81_BC\strftime('%d/%m/%y', time())) . ';' . utf8_encode(PHP81_BC\strftime('%R', time())) . ';'; + $dataLog = mb_detect_encoding(\PHP81_BC\strftime('%d/%m/%y', time()), 'UTF-8', true) + ? \PHP81_BC\strftime('%d/%m/%y', time()) . ';' . \PHP81_BC\strftime('%R', time()) . ';' + : utf8_encode(\PHP81_BC\strftime('%d/%m/%y', time())) . ';' . utf8_encode(\PHP81_BC\strftime('%R', time())) . ';'; $dataLog .= helper::getIp($this->getData(['config', 'connect', 'anonymousIp'])) . ';'; $dataLog .= $this->getUser('id') ? $this->getUser('id') . ';' : 'anonyme' . ';'; $dataLog .= $this->getUrl(); diff --git a/core/module/addon/addon.php b/core/module/addon/addon.php deleted file mode 100644 index de5db8a5..00000000 --- a/core/module/addon/addon.php +++ /dev/null @@ -1,594 +0,0 @@ - - * @copyright Copyright (C) 2008-2018, Rémi Jean - * @author Frédéric Tempez - * @copyright Copyright (C) 2018-2022, Frédéric Tempez - * @author Sylvain Lelièvre - * @copyright Copyright (C) 2020-2021, Sylvain Lelièvre - * @license GNU General Public License, version 3 - * @link http://zwiicms.fr/ - */ - -class addon extends common { - - public static $actions = [ - 'index' => self::GROUP_ADMIN, - 'delete' => self::GROUP_ADMIN, - 'export' => self::GROUP_ADMIN, - 'import' => self::GROUP_ADMIN, - 'store' => self::GROUP_ADMIN, - 'item' => self::GROUP_ADMIN, - 'upload' => self::GROUP_ADMIN, - 'uploadItem'=> self::GROUP_ADMIN - ]; - - // URL des modules - const BASEURL_STORE = 'https://store.zwiicms.fr/'; - const MODULE_STORE = '?modules/'; - - // Gestion des modules - public static $modInstal = []; - - // pour tests - public static $valeur = []; - - // le catalogue - public static $storeList = []; - public static $storeItem = []; - - - /* - * Effacement d'un module installé et non utilisé - */ - public function delete() { - - // 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 - $infoModules = helper::getModules(); - $module = $this->getUrl(2); - //Liste des dossiers associés au module non effacés - if( $this->removeDir('./module/'.$module ) === true ){ - $success = true; - $notification = 'Module '. $module .' désinstallé'; - if(($infoModules[$this->getUrl(2)]['dataDirectory']) ) { - if ( - is_dir($infoModules[$this->getUrl(2)]['dataDirectory']) - && !$this->removeDir($infoModules[$this->getUrl(2)]['dataDirectory']) - ){ - $notification = 'Module '.$module .' désinstallé, il reste des données dans ' . $infoModules[$this->getUrl(2)]['dataDirectory']; - } - } - } - else{ - $success = false; - $notification = 'La suppression a échouée'; - } - // Valeurs en sortie - $this->addOutput([ - 'redirect' => helper::baseUrl() . 'addon', - 'notification' => $notification, - 'state' => $success - ]); - } - } - - /*** - * Installation d'un module - * Fonction utilisée par upload et storeUpload - */ - private function install ($moduleName, $checkValid){ - $tempFolder = 'datamodules';//uniqid(); - $zip = new ZipArchive(); - if ($zip->open($moduleName) === TRUE) { - $notification = 'Archive ouverte'; - mkdir (self::TEMP_DIR . $tempFolder, 0755); - $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 ( false !== ($file = readdir($dh)) ) { - if ($file != "." && $file != "..") { - $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 et de la validation d'update 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'; - $update = '0.0'; - $valUpdate = false; - $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); - } - $pos1 = strpos($file, 'constUPDATE'); - if( $pos1 !== false){ - $posdeb = strpos($file, "'", $pos1); - $posend = strpos($file, "'", $posdeb + 1); - $update = substr($file, $posdeb + 1, $posend - $posdeb - 1); - } - // Si version actuelle >= version indiquée dans UPDATE la mise à jour est validée - $infoModules = helper::getModules(); - if( $infoModules[$moduleName]['update'] >= $update ) $valUpdate = true; - - // Module déjà installé ? - $moduleInstal = false; - foreach($infoModules as $key=>$value ){ - if($moduleName === $key){ - $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 = $valUpdate && ( $newVersion || $checkValid); - - // Nouvelle installation ou mise à jour du module - if( ! $moduleInstal || $validMaj ){ - // Copie récursive des dossiers - $this->copyDir( 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( $valUpdate === false){ - if( $infoModules[$moduleName]['update'] === $update ){ - $notification = ' Mise à jour par ce procédé interdite par le concepteur du module'; - } - else{ - $notification = ' Mise à jour par ce procédé interdite, votre version est trop ancienne'; - } - } - } - } - } - // 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'; - } - return(['success' => $success, - 'notification'=> $notification - ]); - } - - /*** - * Installation d'un module à partir du gestionnaire de fichier - */ - public function upload() { - // Soumission du formulaire - if($this->isPost()) { - // Installation d'un module - $checkValidMaj = $this->getInput('configModulesCheck', helper::FILTER_BOOLEAN); - $zipFilename = $this->getInput('configModulesInstallation', helper::FILTER_STRING_SHORT); - if( $zipFilename !== ''){ - $success = [ - 'success' => false, - 'notification'=> '' - ]; - $state = $this->install(self::FILE_DIR.'source/'.$zipFilename, $checkValidMaj); - } - $this->addOutput([ - 'redirect' => helper::baseUrl() . $this->getUrl(), - 'notification' => $state['notification'], - 'state' => $state['success'] - ]); - } - // Valeurs en sortie - $this->addOutput([ - 'title' => 'Téléverser un module', - 'view' => 'upload' - ]); - } - - /*** - * Installation d'un module par le catalogue - */ - public function uploadItem() { - // Jeton incorrect - if ($this->getUrl(3) !== $_SESSION['csrf']) { - // Valeurs en sortie - $this->addOutput([ - 'redirect' => helper::baseUrl() . 'store', - 'state' => false, - 'notification' => 'Action non autorisée' - ]); - } else { - // Récupérer le module en ligne - $moduleName = $this->getUrl(2); - // Informations sur les module en ligne - $store = json_decode(helper::getUrlContents(self::BASEURL_STORE . self::MODULE_STORE . 'list'), true); - // Url du module à télécharger - $moduleFilePath = $store[$moduleName]['file']; - // Télécharger le fichier - $moduleData = helper::getUrlContents(self::BASEURL_STORE . self::FILE_DIR . 'source/' . $moduleFilePath); - // Extraire de l'arborescence - $d = explode('/',$moduleFilePath); - $moduleFile = $d[count($d)-1]; - // Créer le dossier modules - if (!is_dir(self::FILE_DIR . 'source/modules')) { - mkdir (self::FILE_DIR . 'source/modules', 0755); - } - // Sauver les données du fichiers - file_put_contents(self::FILE_DIR . 'source/modules/' . $moduleFile, $moduleData); - - /** - * $if( $moduleFile !== ''){ - * $success = [ - * 'success' => false, - * 'notification'=> '' - * ]; - * $state = $this->install(self::FILE_DIR.'source/modules/'.$moduleFile, false); - *} - */ - $this->addOutput([ - 'redirect' => helper::baseUrl() . 'addon/store', - 'notification' => $moduleFile . ' téléchargé dans le dossier modules du gestionnaire de fichiers', - 'state' => true - ]); - - } - // Valeurs en sortie - $this->addOutput([ - 'title' => 'Catalogue de modules', - 'view' => 'store' - ]); - } - - /** - * Catalogue des modules sur le site ZwiiCMS.fr - */ - public function store() { - $store = json_decode(helper::getUrlContents(self::BASEURL_STORE . self::MODULE_STORE . 'list'), true); - if ($store) { - // Modules installés - $infoModules = helper::getModules(); - // Clés moduleIds dans les pages - $inPages = helper::arrayColumn($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 ($store as $key=>$value) { - // Module non installé - $ico = template::ico('download'); - $class = ''; - // Le module est installé - if (array_key_exists($key,$infoModules) === true) { - $class = 'buttonGreen'; - $ico = template::ico('update'); - } - // Le module est installé et utilisé - if (in_array($key,$inPages) === true) { - $class = 'buttonRed'; - $ico = template::ico('update'); - } - self::$storeList [] = [ - $store[$key]['category'], - ''.$store[$key]['title'].'', - $store[$key]['version'], - mb_detect_encoding(PHP81_BC\PHP81_BC\strftime('%d %B %Y', $store[$key]['versionDate']), 'UTF-8', true) - ? PHP81_BC\PHP81_BC\strftime('%d %B %Y', $store[$key]['versionDate']) - : utf8_encode(PHP81_BC\PHP81_BC\strftime('%d %B %Y', $store[$key]['versionDate'])), - implode(', ', array_keys($inPagesTitle,$key)), - template::button('moduleExport' . $key, [ - 'class' => $class, - 'href' => helper::baseUrl(). $this->getUrl(0) . '/uploadItem/' . $key.'/' . $_SESSION['csrf'],// appel de fonction vaut exécution, utiliser un paramètre - 'value' => $ico - ]) - ]; - } - } - - // Valeurs en sortie - $this->addOutput([ - 'title' => 'Catalogue de modules en ligne', - 'view' => 'store' - ]); - } - - /** - * Détail d'un objet du catalogue - */ - public function item() { - $store = json_decode(helper::getUrlContents(self::BASEURL_STORE . self::MODULE_STORE . 'list'), true); - self::$storeItem = $store [$this->getUrl(2)] ; - self::$storeItem ['fileDate'] = mb_detect_encoding(PHP81_BC\PHP81_BC\strftime('%d %B %Y',self::$storeItem ['fileDate']), 'UTF-8', true) - ? PHP81_BC\PHP81_BC\strftime('%d %B %Y', self::$storeItem ['fileDate']) - : utf8_encode(PHP81_BC\PHP81_BC\strftime('%d %B %Y', self::$storeItem ['fileDate'])); - // Valeurs en sortie - $this->addOutput([ - 'title' =>'Module ' . self::$storeItem['title'], - 'view' => 'item' - ]); - } - - /** - * 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::arrayColumn($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)), - //|| ('delete',$infoModules[$key]) && $infoModules[$key]['delete'] === true && implode(', ',array_keys($inPages,$key)) === '' - $infoModules[$key]['delete'] === true && implode(', ',array_keys($inPages,$key)) === '' - ? template::button('moduleDelete' . $key, [ - 'class' => 'moduleDelete buttonRed', - 'href' => helper::baseUrl() . $this->getUrl(0) . '/delete/' . $key . '/' . $_SESSION['csrf'], - 'value' => template::ico('cancel') - ]) - : '', - implode(', ',array_keys($inPages,$key)) !== '' - ? template::button('moduleExport' . $key, [ - 'href' => helper::baseUrl(). $this->getUrl(0) . '/export/' . $key . '/' . $_SESSION['csrf'],// appel de fonction vaut exécution, utiliser un paramètre - 'value' => template::ico('download') - ]) - : '', - implode(', ',array_keys($inPages,$key)) === '' - ? template::button('moduleExport' . $key, [ - 'href' => helper::baseUrl(). $this->getUrl(0) . '/import/' . $key . '/' . $_SESSION['csrf'],// appel de fonction vaut exécution, utiliser un paramètre - 'value' => template::ico('upload') - ]) - : '' - ]; - } - - // Valeurs en sortie - $this->addOutput([ - 'title' => 'Gestion des modules', - 'view' => 'index' - ]); - } - - /* - * Export des données d'un module externes ou interne à module.json - */ - public function export(){ - // 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 { - // Lire les données du module - $infoModules = helper::getModules(); - // Créer un dossier par défaut - $tmpFolder = self::TEMP_DIR . uniqid(); - //$tmpFolder = self::TEMP_DIR . 'test'; - if (!is_dir($tmpFolder)) { - mkdir($tmpFolder, 0755); - } - // Clés moduleIds dans les pages - $inPages = helper::arrayColumn($this->getData(['page']),'moduleId', 'SORT_DESC'); - // Parcourir les pages utilisant le module - foreach (array_keys($inPages,$this->getUrl(2)) as $pageId) { - // Export des pages hébergeant le module - $pageParam[$pageId] = $this->getData(['page',$pageId]); - // Export du contenu de la page - //$pageContent[$pageId] = file_get_contents(self::DATA_DIR . self::$i18n . '/content/' . $this->getData(['page', $pageId, 'content'])); - $pageContent[$pageId] = $this->getPage($pageId, self::$i18n); - // Export de fr/module.json - $moduleId = 'fr/module.json'; - $moduleDir = str_replace('site/data/','',$infoModules[$this->getUrl(2)]['dataDirectory']); - // Création de l'arborescence des langues - // Pas de nom dossier de langue - dossier par défaut - $t = explode ('/',$moduleId); - if ( is_array($t)) { - $lang = 'fr'; - } else { - $lang = $t[0]; - } - // Créer le dossier temporaire si inexistant sinon le nettoie et le créer - if (!is_dir($tmpFolder . '/' . $lang)) { - mkdir ($tmpFolder . '/' . $lang, 0755, true); - } else { - $this->removeDir($tmpFolder . '/' . $lang); - mkdir ($tmpFolder . '/' . $lang, 0755, true); - } - // Créer le dossier temporaire des données du module - if ($infoModules[$this->getUrl(2)]['dataDirectory']) { - if (!is_dir($tmpFolder . '/' . $moduleDir)) { - mkdir ($tmpFolder . '/' . $moduleDir, 0755, true) ; - } - } - // Sauvegarde si données non vides - $tmpData [$pageId] = $this->getData(['module',$pageId ]); - if ($tmpData [$pageId] !== null) { - file_put_contents($tmpFolder . '/' . $moduleId, json_encode($tmpData)); - } - // Export des données localisées dans le dossier de données du module - if ($infoModules[$this->getUrl(2)]['dataDirectory'] && - is_dir($infoModules[$this->getUrl(2)]['dataDirectory'])) { - $this->copyDir ($infoModules[$this->getUrl(2)]['dataDirectory'], $tmpFolder . '/' . $moduleDir); - } - } - // Enregistrement des pages dans le dossier de langue identique à module - if (!file_exists($tmpFolder . '/' . $lang . '/page.json')) { - file_put_contents($tmpFolder . '/' . $lang . '/page.json', json_encode($pageParam)); - mkdir ($tmpFolder . '/' . $lang . '/content', 0755); - file_put_contents($tmpFolder . '/' . $lang . '/content/' . $this->getData(['page', $pageId, 'content']), $pageContent); - } - // création du zip - $fileName = $this->getUrl(2) . '.zip'; - $this->makeZip ($fileName, $tmpFolder, []); - if (file_exists($fileName)) { - ob_start(); - header('Content-Type: application/octet-stream'); - header('Content-Disposition: attachment; filename="' . $fileName . '"'); - header('Content-Length: ' . filesize($fileName)); - ob_clean(); - ob_end_flush(); - readfile( $fileName); - unlink($fileName); - $this->removeDir($tmpFolder); - exit(); - } else { - // Valeurs en sortie - $this->addOutput([ - 'redirect' => helper::baseUrl() . 'addon', - 'notification' => 'Quelque chose s\'est mal passé', - 'state' => false - ]); - } - } - } - - /* - * Importer des données d'un module externes ou interne à module.json - */ - public function import(){ - // 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 { - // Soumission du formulaire - if($this->isPost()) { - // Récupérer le fichier et le décompacter - $zipFilename = $this->getInput('addonImportFile', helper::FILTER_STRING_SHORT, true); - $tempFolder = uniqid(); - mkdir (self::TEMP_DIR . $tempFolder, 0755); - $zip = new ZipArchive(); - if ($zip->open(self::FILE_DIR . 'source/' . $zipFilename) === TRUE) { - $zip->extractTo(self::TEMP_DIR . $tempFolder ); - } - // Import des données localisées page.json et module.json - // Pour chaque dossier localisé - $dataTarget = array(); - $dataSource = array(); - // Liste des pages de même nom dans l'archive et le site - $list = ''; - foreach (self::$i18nList as $key=>$value) { - // Les Pages et les modules - foreach (['page','module'] as $fileTarget){ - if (file_exists(self::TEMP_DIR . $tempFolder . '/' .$key . '/' . $fileTarget . '.json')) { - // Le dossier de langue existe - // faire la fusion - $dataSource = json_decode(file_get_contents(self::TEMP_DIR . $tempFolder . '/' .$key . '/' . $fileTarget . '.json'), true); - // Des pages de même nom que celles de l'archive existent - if( $fileTarget === 'page' ){ - foreach( $dataSource as $keydataSource=>$valuedataSource ){ - foreach( $this->getData(['page']) as $keypage=>$valuepage ){ - if( $keydataSource === $keypage){ - $list === '' ? $list .= ' '.$this->getData(['page', $keypage, 'title']) : $list .= ', '.$this->getData(['page', $keypage, 'title']); - } - } - } - } - $dataTarget = json_decode(file_get_contents(self::DATA_DIR . $key . '/' . $fileTarget . '.json'), true); - $data [$fileTarget] = array_merge($dataTarget[$fileTarget], $dataSource); - if( $list === ''){ - file_put_contents(self::DATA_DIR . '/' .$key . '/' . $fileTarget . '.json', json_encode( $data ,JSON_UNESCAPED_UNICODE|JSON_PRETTY_PRINT|LOCK_EX) ); - } - // copie du contenu de la page - $this->copyDir (self::TEMP_DIR . $tempFolder . '/' .$key . '/content', self::DATA_DIR . '/' .$key . '/content'); - // Supprimer les fichiers importés - unlink (self::TEMP_DIR . $tempFolder . '/' .$key . '/' . $fileTarget . '.json'); - } - } - } - - // Import des fichiers placés ailleurs que dans les dossiers localisés. - $this->copyDir (self::TEMP_DIR . $tempFolder,self::DATA_DIR ); - - // Supprimer le dossier temporaire - $this->removeDir(self::TEMP_DIR . $tempFolder); - $zip->close(); - if( $list !== '' ){ - $success = false; - strpos( $list, ',') === false ? $notification = 'Import impossible la page suivante doit être renommée :'.$list : $notification = 'Import impossible les pages suivantes doivent être renommées :'.$list; - } - else{ - $success = true; - $notification = 'Import réussi'; - } - // Valeurs en sortie - $this->addOutput([ - 'redirect' => helper::baseUrl() . 'addon', - 'state' => $success, - 'notification' => $notification - ]); - } - // Valeurs en sortie - $this->addOutput([ - 'title' => 'Importer des données de module', - 'view' => 'import' - ]); - } - } - -} diff --git a/core/module/config/config.php b/core/module/config/config.php index b1556768..d01db473 100644 --- a/core/module/config/config.php +++ b/core/module/config/config.php @@ -693,9 +693,9 @@ class config extends common $d = $this->getData(['blacklist']); $data = ''; foreach ($d as $key => $item) { - $data .= mb_detect_encoding(PHP81_BC\strftime('%d/%m/%y', $item['lastFail']), 'UTF-8', true) - ? PHP81_BC\strftime('%d/%m/%y', $item['lastFail']) . ';' . utf8_encode(PHP81_BC\strftime('%R', $item['lastFail'])) . ';' - : utf8_encode(PHP81_BC\strftime('%d/%m/%y', $item['lastFail'])) . ';' . utf8_encode(PHP81_BC\strftime('%R', $item['lastFail'])) . ';'; + $data .= mb_detect_encoding(\PHP81_BC\strftime('%d/%m/%y', $item['lastFail']), 'UTF-8', true) + ? \PHP81_BC\strftime('%d/%m/%y', $item['lastFail']) . ';' . utf8_encode(\PHP81_BC\strftime('%R', $item['lastFail'])) . ';' + : utf8_encode(\PHP81_BC\strftime('%d/%m/%y', $item['lastFail'])) . ';' . utf8_encode(\PHP81_BC\strftime('%R', $item['lastFail'])) . ';'; $data .= $key . ';' . $item['ip'] . ';' . $item['connectFail'] . PHP_EOL; } file_put_contents($fileName, $data, FILE_APPEND); diff --git a/core/module/plugin/plugin.php b/core/module/plugin/plugin.php index 06e9964e..bef56a96 100644 --- a/core/module/plugin/plugin.php +++ b/core/module/plugin/plugin.php @@ -369,9 +369,9 @@ class plugin extends common $store[$key]['category'], '' . $store[$key]['title'] . '', $store[$key]['version'], - mb_detect_encoding(PHP81_BC\strftime('%d %B %Y', $store[$key]['versionDate']), 'UTF-8', true) - ? PHP81_BC\strftime('%d %B %Y', $store[$key]['versionDate']) - : utf8_encode(PHP81_BC\strftime('%d %B %Y', $store[$key]['versionDate'])), + mb_detect_encoding(\PHP81_BC\strftime('%d %B %Y', $store[$key]['versionDate']), 'UTF-8', true) + ? \PHP81_BC\strftime('%d %B %Y', $store[$key]['versionDate']) + : utf8_encode(\PHP81_BC\strftime('%d %B %Y', $store[$key]['versionDate'])), implode(', ', array_keys($pagesInfos, $key)), template::button('moduleExport' . $key, [ 'class' => $class, @@ -397,9 +397,9 @@ class plugin extends common { $store = json_decode(helper::getUrlContents(self::BASEURL_STORE . self::MODULE_STORE . 'list'), true); self::$storeItem = $store[$this->getUrl(2)]; - self::$storeItem['fileDate'] = mb_detect_encoding(PHP81_BC\strftime('%d %B %Y', self::$storeItem['fileDate']), 'UTF-8', true) - ? PHP81_BC\strftime('%d %B %Y', self::$storeItem['fileDate']) - : utf8_encode(PHP81_BC\strftime('%d %B %Y', self::$storeItem['fileDate'])); + self::$storeItem['fileDate'] = mb_detect_encoding(\PHP81_BC\strftime('%d %B %Y', self::$storeItem['fileDate']), 'UTF-8', true) + ? \PHP81_BC\strftime('%d %B %Y', self::$storeItem['fileDate']) + : utf8_encode(\PHP81_BC\strftime('%d %B %Y', self::$storeItem['fileDate'])); // Valeurs en sortie $this->addOutput([ 'title' => helper::translate('Module ' . self::$storeItem['title']), diff --git a/core/module/user/user.php b/core/module/user/user.php index e9f31e0b..0a372525 100644 --- a/core/module/user/user.php +++ b/core/module/user/user.php @@ -495,9 +495,9 @@ class user extends common } } // Journalisation - $dataLog = mb_detect_encoding(PHP81_BC\strftime('%d/%m/%y', time()), 'UTF-8', true) - ? PHP81_BC\strftime('%d/%m/%y', time()) . ';' . PHP81_BC\strftime('%R', time()) . ';' - : utf8_encode(PHP81_BC\strftime('%d/%m/%y', time())) . ';' . utf8_encode(PHP81_BC\strftime('%R', time())) . ';'; + $dataLog = mb_detect_encoding(\PHP81_BC\strftime('%d/%m/%y', time()), 'UTF-8', true) + ? \PHP81_BC\strftime('%d/%m/%y', time()) . ';' . \PHP81_BC\strftime('%R', time()) . ';' + : utf8_encode(\PHP81_BC\strftime('%d/%m/%y', time())) . ';' . utf8_encode(\PHP81_BC\strftime('%R', time())) . ';'; $dataLog .= helper::getIp($this->getData(['config', 'connect', 'anonymousIp'])) . ';'; $dataLog .= $this->getInput('userLoginId', helper::FILTER_ID) . ';'; $dataLog .= $this->getUrl() . ';'; diff --git a/module/blog/blog.php b/module/blog/blog.php index 9ea92df5..ffe6a4fa 100755 --- a/module/blog/blog.php +++ b/module/blog/blog.php @@ -308,9 +308,9 @@ class blog extends common { ]); } self::$comments[] = [ - mb_detect_encoding(PHP81_BC\strftime('%d %B %Y - %H:%M', $comment['createdOn']), 'UTF-8', true) - ? PHP81_BC\strftime('%d %B %Y - %H:%M', $comment['createdOn']) - : utf8_encode(PHP81_BC\strftime('%d %B %Y - %H:%M', $comment['createdOn'])), + mb_detect_encoding(\PHP81_BC\strftime('%d %B %Y - %H:%M', $comment['createdOn']), 'UTF-8', true) + ? \PHP81_BC\strftime('%d %B %Y - %H:%M', $comment['createdOn']) + : utf8_encode(\PHP81_BC\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, @@ -470,12 +470,12 @@ class blog extends common { $approved = count($this->getData(['module', $this->getUrl(0), 'posts', $articleIds[$i],'comment'])); } // Met en forme le tableau - $date = mb_detect_encoding(PHP81_BC\strftime('%d %B %Y', $this->getData(['module', $this->getUrl(0), 'posts', $articleIds[$i], 'publishedOn'])), 'UTF-8', true) - ? PHP81_BC\strftime('%d %B %Y', $this->getData(['module', $this->getUrl(0), 'posts', $articleIds[$i], 'publishedOn'])) - : utf8_encode(PHP81_BC\strftime('%d %B %Y', $this->getData(['module', $this->getUrl(0), 'posts', $articleIds[$i], 'publishedOn']))); - $heure = mb_detect_encoding(PHP81_BC\strftime('%H:%M', $this->getData(['module', $this->getUrl(0), 'posts', $articleIds[$i], 'publishedOn'])), 'UTF-8', true) - ? PHP81_BC\strftime('%H:%M', $this->getData(['module', $this->getUrl(0), 'posts', $articleIds[$i], 'publishedOn'])) - : utf8_encode(PHP81_BC\strftime('%H:%M', $this->getData(['module', $this->getUrl(0), 'posts', $articleIds[$i], 'publishedOn']))); + $date = mb_detect_encoding(\PHP81_BC\strftime('%d %B %Y', $this->getData(['module', $this->getUrl(0), 'posts', $articleIds[$i], 'publishedOn'])), 'UTF-8', true) + ? \PHP81_BC\strftime('%d %B %Y', $this->getData(['module', $this->getUrl(0), 'posts', $articleIds[$i], 'publishedOn'])) + : utf8_encode(\PHP81_BC\strftime('%d %B %Y', $this->getData(['module', $this->getUrl(0), 'posts', $articleIds[$i], 'publishedOn']))); + $heure = mb_detect_encoding(\PHP81_BC\strftime('%H:%M', $this->getData(['module', $this->getUrl(0), 'posts', $articleIds[$i], 'publishedOn'])), 'UTF-8', true) + ? \PHP81_BC\strftime('%H:%M', $this->getData(['module', $this->getUrl(0), 'posts', $articleIds[$i], 'publishedOn'])) + : utf8_encode(\PHP81_BC\strftime('%H:%M', $this->getData(['module', $this->getUrl(0), 'posts', $articleIds[$i], 'publishedOn']))); self::$articles[] = [ '' . $this->getData(['module', $this->getUrl(0), 'posts', $articleIds[$i], 'title']) . @@ -571,12 +571,12 @@ class blog extends common { $approved = count($this->getData(['module', $this->getUrl(0), 'posts', $articleIds[$i],'comment'])); } // Met en forme le tableau - $date = mb_detect_encoding(PHP81_BC\strftime('%d %B %Y', $this->getData(['module', $this->getUrl(0), 'posts', $articleIds[$i], 'publishedOn'])), 'UTF-8', true) - ? PHP81_BC\strftime('%d %B %Y', $this->getData(['module', $this->getUrl(0), 'posts', $articleIds[$i], 'publishedOn'])) - : utf8_encode(PHP81_BC\strftime('%d %B %Y', $this->getData(['module', $this->getUrl(0), 'posts', $articleIds[$i], 'publishedOn']))); - $heure = mb_detect_encoding(PHP81_BC\strftime('%H:%M', $this->getData(['module', $this->getUrl(0), 'posts', $articleIds[$i], 'publishedOn'])), 'UTF-8', true) - ? PHP81_BC\strftime('%H:%M', $this->getData(['module', $this->getUrl(0), 'posts', $articleIds[$i], 'publishedOn'])) - : utf8_encode(PHP81_BC\strftime('%H:%M', $this->getData(['module', $this->getUrl(0), 'posts', $articleIds[$i], 'publishedOn']))); + $date = mb_detect_encoding(\PHP81_BC\strftime('%d %B %Y', $this->getData(['module', $this->getUrl(0), 'posts', $articleIds[$i], 'publishedOn'])), 'UTF-8', true) + ? \PHP81_BC\strftime('%d %B %Y', $this->getData(['module', $this->getUrl(0), 'posts', $articleIds[$i], 'publishedOn'])) + : utf8_encode(\PHP81_BC\strftime('%d %B %Y', $this->getData(['module', $this->getUrl(0), 'posts', $articleIds[$i], 'publishedOn']))); + $heure = mb_detect_encoding(\PHP81_BC\strftime('%H:%M', $this->getData(['module', $this->getUrl(0), 'posts', $articleIds[$i], 'publishedOn'])), 'UTF-8', true) + ? \PHP81_BC\strftime('%H:%M', $this->getData(['module', $this->getUrl(0), 'posts', $articleIds[$i], 'publishedOn'])) + : utf8_encode(\PHP81_BC\strftime('%H:%M', $this->getData(['module', $this->getUrl(0), 'posts', $articleIds[$i], 'publishedOn']))); self::$articles[] = [ '' . $this->getData(['module', $this->getUrl(0), 'posts', $articleIds[$i], 'title']) . diff --git a/module/blog/view/article/article.php b/module/blog/view/article/article.php index 55fc40ba..cc83625f 100755 --- a/module/blog/view/article/article.php +++ b/module/blog/view/article/article.php @@ -14,12 +14,12 @@ - getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'publishedOn'])), 'UTF-8', true) - ? PHP81_BC\strftime('%d %B %Y', $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'publishedOn'])) - : utf8_encode(PHP81_BC\strftime('%d %B %Y', $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'publishedOn']))); - $heure = mb_detect_encoding(PHP81_BC\strftime('%H:%M', $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'publishedOn'])), 'UTF-8', true) - ? PHP81_BC\strftime('%H:%M', $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'publishedOn'])) - : utf8_encode(PHP81_BC\strftime('%H:%M', $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'publishedOn']))); + getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'publishedOn'])), 'UTF-8', true) + ? \PHP81_BC\strftime('%d %B %Y', $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'publishedOn'])) + : utf8_encode(\PHP81_BC\strftime('%d %B %Y', $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'publishedOn']))); + $heure = mb_detect_encoding(\PHP81_BC\strftime('%H:%M', $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'publishedOn'])), 'UTF-8', true) + ? \PHP81_BC\strftime('%H:%M', $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'publishedOn'])) + : utf8_encode(\PHP81_BC\strftime('%H:%M', $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'publishedOn']))); echo $date . ' à ' . $heure; ?> @@ -151,9 +151,9 @@ $comment): ?>

- le

diff --git a/module/blog/view/index/index.php b/module/blog/view/index/index.php index d1996ae6..12324458 100755 --- a/module/blog/view/index/index.php +++ b/module/blog/view/index/index.php @@ -31,12 +31,12 @@ signature($this->getData(['module', $this->getUrl(0), 'posts', $articleId, 'userId']));?> - getData(['module', $this->getUrl(0), 'posts', $articleId, 'publishedOn'])), 'UTF-8', true) - ? PHP81_BC\strftime('%d %B %Y', $this->getData(['module', $this->getUrl(0), 'posts', $articleId, 'publishedOn'])) - : utf8_encode(PHP81_BC\strftime('%d %B %Y', $this->getData(['module', $this->getUrl(0), 'posts', $articleId, 'publishedOn']))); - $heure = mb_detect_encoding(PHP81_BC\strftime('%H:%M', $this->getData(['module', $this->getUrl(0), 'posts', $articleId, 'publishedOn'])), 'UTF-8', true) - ? PHP81_BC\strftime('%H:%M', $this->getData(['module', $this->getUrl(0), 'posts', $articleId, 'publishedOn'])) - : utf8_encode(PHP81_BC\strftime('%H:%M', $this->getData(['module', $this->getUrl(0), 'posts', $articleId, 'publishedOn']))); + getData(['module', $this->getUrl(0), 'posts', $articleId, 'publishedOn'])), 'UTF-8', true) + ? \PHP81_BC\strftime('%d %B %Y', $this->getData(['module', $this->getUrl(0), 'posts', $articleId, 'publishedOn'])) + : utf8_encode(\PHP81_BC\strftime('%d %B %Y', $this->getData(['module', $this->getUrl(0), 'posts', $articleId, 'publishedOn']))); + $heure = mb_detect_encoding(\PHP81_BC\strftime('%H:%M', $this->getData(['module', $this->getUrl(0), 'posts', $articleId, 'publishedOn'])), 'UTF-8', true) + ? \PHP81_BC\strftime('%H:%M', $this->getData(['module', $this->getUrl(0), 'posts', $articleId, 'publishedOn'])) + : utf8_encode(\PHP81_BC\strftime('%H:%M', $this->getData(['module', $this->getUrl(0), 'posts', $articleId, 'publishedOn']))); echo $date . ' à ' . $heure; ?> @@ -125,9 +125,9 @@
- +

getData(['module',$this->getUrl(0), 'config', 'articlesLenght']) !== 0 ? $this->getData(['module',$this->getUrl(0), 'config', 'articlesLenght']) : 500 ?> diff --git a/module/forum/forum.php b/module/forum/forum.php deleted file mode 100644 index f0426a83..00000000 --- a/module/forum/forum.php +++ /dev/null @@ -1,908 +0,0 @@ - - * @copyright Copyright (C) 2008-2018, Rémi Jean - * @author Frédéric Tempez - * @copyright Copyright (C) 2018-2022, Frédéric Tempez - * @license GNU General Public License, version 3 - * @link http://zwiicms.fr/ - */ - -class forum extends common { - - const VERSION = '0.1'; - const REALNAME = 'Forum'; - const DATADIRECTORY = ''; // Contenu localisé inclus par défaut (page.json et module.json) - - 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, - 'option' => self::GROUP_MODERATOR, - 'delete' => self::GROUP_MODERATOR, - 'edit' => self::GROUP_MODERATOR, - 'index' => self::GROUP_VISITOR, - 'rss' => self::GROUP_VISITOR - ]; - - public static $sujets = []; - - // Signature de l'sujet - public static $sujetSignature = ''; - - // Signature du Réponse - public static $editCommentSignature = ''; - - public static $comments = []; - - public static $nbCommentsApproved = 0; - - public static $commentsDelete; - - // Signatures des réponses déjà saisis - public static $commentsSignature = []; - - public static $pages; - - 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 ', - ]; - - // Nombre d'objets par page - public static $SujetsListed = [ - 1 => '1 sujet', - 2 => '2 sujets', - 4 => '4 sujets', - 6 => '6 sujets', - 8 => '8 sujets', - 10 => '10 sujets', - 12 => '12 sujets' - ]; - - //Paramètre longueur maximale des réponses en nb de caractères - public static $commentLength = [ - 100 => '100 signes', - 250 => '250 signes', - 500 => '500 signes', - 750 => '750 signes' - ]; - - public static $sujetsLenght = [ - 0 => 'Intégralité des sujets, disposition moderne', - 200 => '200 signes', - 400 => '400 signes', - 600 => '600 signes', - 800 => '800 signes' - ]; - - // Permissions d'un sujet - public static $sujetConsent = [ - self::EDIT_ALL => 'Tous les groupes', - self::EDIT_GROUP => 'Groupe du propriétaire', - self::EDIT_OWNER => 'Propriétaire' - ]; - - - // Nombre d'sujets dans la page de config: - public static $itemsperPage = 8; - - - public static $users = []; - - - - /** - * Mise à jour du module - * Appelée par les fonctions index et config - */ - private function update() { - // Initialisation - if (version_compare($this->getData(['module', $this->getUrl(0), 'config', 'versionData']), '0.0', '<') ) { - $this->setData(['module', $this->getUrl(0), 'config', 'feeds', true]); - $this->setData(['module', $this->getUrl(0), 'config', 'feedsLabel', 'Flux RSS']); - $this->setData(['module', $this->getUrl(0), 'config', 'versionData','4.0']); - } - // 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']); - } - // Version 6.0 - if (version_compare($this->getData(['module', $this->getUrl(0), 'config', 'versionData']), '6.0', '<') ) { - $this->setData(['module', $this->getUrl(0), 'config', 'sujetsLenght', 0]); - $this->setData(['module', $this->getUrl(0), 'config', 'commentMaxlength', 250]); - $this->setData(['module', $this->getUrl(0), 'config', 'versionData','6.0']); - } - } - - - - /** - * Flux RSS - */ - public function rss() { - // Inclure les classes - include_once 'module/blog/vendor/FeedWriter/Item.php'; - include_once 'module/blog/vendor/FeedWriter/Feed.php'; - include_once 'module/blog/vendor/FeedWriter/RSS2.php'; - include_once 'module/blog/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 sujets - $sujetIdsPublishedOns = helper::arrayColumn($this->getData(['module', $this->getUrl(0), 'posts']), 'publishedOn', 'SORT_DESC'); - $sujetIdsStates = helper::arrayColumn($this->getData(['module', $this->getUrl(0),'posts']), 'state', 'SORT_DESC'); - foreach( $sujetIdsPublishedOns as $sujetId => $sujetPublishedOn ) { - if( $sujetPublishedOn <= time() AND $sujetIdsStates[$sujetId] ) { - // Miniature - $parts = explode('/',$this->getData(['module', $this->getUrl(0), 'posts', $sujetId, 'picture'])); - $thumb = str_replace ($parts[(count($parts)-1)],'mini_' . $parts[(count($parts)-1)], $this->getData(['module', $this->getUrl(0), 'posts', $sujetId, 'picture'])); - // Créer les sujets du flux - $newsSujet = $feeds->createNewItem(); - // Signature de l'sujet - $author = $this->signature($this->getData(['module', $this->getUrl(0), 'posts', $sujetId, 'userId'])); - $newsSujet->addElementArray([ - 'title' => $this->getData(['module', $this->getUrl(0), 'posts', $sujetId, 'title']), - 'link' => helper::baseUrl() .$this->getUrl(0) . '/' . $sujetId, - 'description' => '' . $this->getData(['module', $this->getUrl(0), 'posts', $sujetId, 'title'])
-									 . '' . - $this->getData(['module', $this->getUrl(0), 'posts', $sujetId, 'content']), - ]); - $newsSujet->setAuthor($author,'no@mail.com'); - $newsSujet->setId(helper::baseUrl() .$this->getUrl(0) . '/' . $sujetId); - $newsSujet->setDate(date('r', $this->getData(['module', $this->getUrl(0), 'posts', $sujetId, 'publishedOn']))); - if ( file_exists($this->getData(['module', $this->getUrl(0), 'posts', $sujetId, 'picture'])) ) { - $imageData = getimagesize(helper::baseUrl(false) . self::FILE_DIR . 'thumb/' . $thumb); - $newsSujet->addEnclosure( helper::baseUrl(false) . self::FILE_DIR . 'thumb/' . $thumb, - $imageData[0] * $imageData[1], - $imageData['mime'] - ); - } - $feeds->addItem($newsSujet); - } - } - - // 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('blogAddUserId', helper::FILTER_STRING_SHORT, true); - } - else{ - $newuserid = $this->getUser('id'); - } - // Incrémente l'id de l'sujet - $sujetId = helper::increment($this->getInput('blogAddPermalink'), $this->getData(['page'])); - $sujetId = helper::increment($sujetId, (array) $this->getData(['module', $this->getUrl(0)])); - $sujetId = helper::increment($sujetId, array_keys(self::$actions)); - // Crée l'sujet - $this->setData(['module', - $this->getUrl(0), - 'posts', - $sujetId, [ - 'content' => $this->getInput('blogAddContent', null), - '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, - 'editConsent' => $this->getInput('blogAddConsent') === self::EDIT_GROUP ? $this->getUser('group') : $this->getInput('blogAddConsent'), - '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), - 'comment' => [] - ] - ]); - // Valeurs en sortie - $this->addOutput([ - 'redirect' => helper::baseUrl() . $this->getUrl(0) . '/config', - 'notification' => 'Nouvel sujet créé', - 'state' => true - ]); - } - // Liste des utilisateurs - self::$users = helper::arrayColumn($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' => 'Nouveau sujet', - 'vendor' => [ - 'flatpickr', - 'tinymce', - 'furl' - ], - 'view' => 'add' - ]); - } - - /** - * Liste des réponses - */ - public function comment() { - $comments = $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(2),'comment']); - self::$commentsDelete = template::button('blogCommentDeleteAll', [ - 'class' => 'blogCommentDeleteAll buttonRed', - 'href' => helper::baseUrl() . $this->getUrl(0) . '/commentDeleteAll/' . $this->getUrl(2).'/' . $_SESSION['csrf'] , - 'ico' => 'trash', - 'value' => 'Tout effacer' - ]); - // Ids des réponses par ordre de création - $commentIds = array_keys(helper::arrayColumn($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']; - // Réponses 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 réponses 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), 'posts', $this->getUrl(2),'commentApproved']) === true) { - $buttonApproval = template::button('blogCommentApproved' . $commentIds[$i], [ - 'class' => $comment['approval'] === true ? 'blogCommentRejected buttonGreen' : 'blogCommentApproved 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(PHP81_BC\strftime('%d %B %Y - %H:%M', $comment['createdOn']), 'UTF-8', true) - ? PHP81_BC\strftime('%d %B %Y - %H:%M', $comment['createdOn']) - : utf8_encode(PHP81_BC\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('blogCommentDelete' . $commentIds[$i], [ - 'class' => 'blogCommentDelete buttonRed', - 'href' => helper::baseUrl() . $this->getUrl(0) . '/commentDelete/' . $this->getUrl(2) . '/' . $commentIds[$i] . '/' . $_SESSION['csrf'] , - 'value' => template::ico('trash') - ]) - ]; - } - // Valeurs en sortie - $this->addOutput([ - 'title' => 'Gestion des réponses : '. $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(2), 'title']), - 'view' => 'comment' - ]); - } - - /** - * Suppression de Réponse - */ - public function commentDelete() { - // Le Réponse n'existe pas - if($this->getData(['module', $this->getUrl(0), 'posts', $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), 'posts', $this->getUrl(2), 'comment', $this->getUrl(3)]); - // Valeurs en sortie - $this->addOutput([ - 'redirect' => helper::baseUrl() . $this->getUrl(0) . '/comment/'.$this->getUrl(2), - 'notification' => 'Réponse supprimé', - 'state' => true - ]); - } - } - - /** - * Suppression de tous les réponses de l'sujet $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), 'posts', $this->getUrl(2), 'comment',[] ]); - // Valeurs en sortie - $this->addOutput([ - 'redirect' => helper::baseUrl() . $this->getUrl(0) . '/comment', - 'notification' => 'Réponses supprimés', - 'state' => true - ]); - } - } - - /** - * Approbation oou désapprobation de Réponse - */ - public function commentApprove() { - // Le Réponse n'existe pas - if($this->getData(['module', $this->getUrl(0), 'posts', $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), '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']), - 'approval' => $approved - ]]); - - // Valeurs en sortie - $this->addOutput([ - 'redirect' => helper::baseUrl() . $this->getUrl(0) . '/comment/'.$this->getUrl(2), - 'notification' => $approved ? 'Réponse approuvé' : 'Réponse rejeté', - 'state' => $approved - ]); - } - } - - /** - * Configuration - */ - public function config() { - - // Ids des sujets par ordre de publication - $sujetIds = array_keys(helper::arrayColumn($this->getData(['module', $this->getUrl(0), 'posts']), 'publishedOn', 'SORT_DESC')); - // Gestion des droits d'accès - $filterData=[]; - foreach ($sujetIds 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 - AND $this->getUser('group') >= $this->getData(['module',$this->getUrl(0), 'posts', $value,'editConsent']) - ) - OR ( - // Tout le monde - $this->getData(['module', $this->getUrl(0), 'posts', $value,'editConsent']) === self::EDIT_ALL - ) - ) { - $filterData[] = $value; - } - } - $sujetIds = $filterData; - // Pagination - $pagination = helper::pagination($sujetIds, $this->getUrl(),self::$itemsperPage); - // Liste des pages - self::$pages = $pagination['pages']; - // Sujets en fonction de la pagination - for($i = $pagination['first']; $i < $pagination['last']; $i++) { - // Nombre de réponses à approuver et approuvés - $approvals = helper::arrayColumn($this->getData(['module', $this->getUrl(0), 'posts', $sujetIds[$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), 'posts', $sujetIds[$i],'comment'])); - } - // Met en forme le tableau - $date = mb_detect_encoding(PHP81_BC\strftime('%d %B %Y', $this->getData(['module', $this->getUrl(0), 'posts', $sujetIds[$i], 'publishedOn'])), 'UTF-8', true) - ? PHP81_BC\strftime('%d %B %Y', $this->getData(['module', $this->getUrl(0), 'posts', $sujetIds[$i], 'publishedOn'])) - : utf8_encode(PHP81_BC\strftime('%d %B %Y', $this->getData(['module', $this->getUrl(0), 'posts', $sujetIds[$i], 'publishedOn']))); - $heure = mb_detect_encoding(PHP81_BC\strftime('%H:%M', $this->getData(['module', $this->getUrl(0), 'posts', $sujetIds[$i], 'publishedOn'])), 'UTF-8', true) - ? PHP81_BC\strftime('%H:%M', $this->getData(['module', $this->getUrl(0), 'posts', $sujetIds[$i], 'publishedOn'])) - : utf8_encode(PHP81_BC\strftime('%H:%M', $this->getData(['module', $this->getUrl(0), 'posts', $sujetIds[$i], 'publishedOn']))); - self::$sujets[] = [ - '' . - $this->getData(['module', $this->getUrl(0), 'posts', $sujetIds[$i], 'title']) . - '', - $date .' à '. $heure, - self::$states[$this->getData(['module', $this->getUrl(0), 'posts', $sujetIds[$i], 'state'])], - // Bouton pour afficher les réponses de l'sujet - template::button('blogConfigComment' . $sujetIds[$i], [ - 'class' => ($toApprove || $approved ) > 0 ? '' : 'buttonGrey' , - 'href' => ($toApprove || $approved ) > 0 ? helper::baseUrl() . $this->getUrl(0) . '/comment/' . $sujetIds[$i] : '', - 'value' => $toApprove > 0 ? $toApprove . '/' . $approved : $approved, - 'help' => ($toApprove || $approved ) > 0 ? 'Éditer / Approuver les réponses' : '' - ]), - template::button('blogConfigEdit' . $sujetIds[$i], [ - 'href' => helper::baseUrl() . $this->getUrl(0) . '/edit/' . $sujetIds[$i] . '/' . $_SESSION['csrf'], - 'value' => template::ico('pencil'), - 'help' => 'Éditer l\'sujet' - ]), - template::button('blogConfigDelete' . $sujetIds[$i], [ - 'class' => 'blogConfigDelete buttonRed', - 'href' => helper::baseUrl() . $this->getUrl(0) . '/delete/' . $sujetIds[$i] . '/' . $_SESSION['csrf'], - 'value' => template::ico('trash'), - 'help' => 'Effacer l\'sujet' - ]) - ]; - } - // Valeurs en sortie - $this->addOutput([ - 'title' => 'Configuration du module', - 'view' => 'config' - ]); - } - - public function option() { - // 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('blogOptionShowFeeds',helper::FILTER_BOOLEAN), - 'feedsLabel' => $this->getInput('blogOptionFeedslabel',helper::FILTER_STRING_SHORT), - 'itemsperPage' => $this->getInput('blogOptionItemsperPage', helper::FILTER_INT,true), - 'sujetsLenght'=> $this->getInput('blogOptionSujetsLenght', helper::FILTER_INT), - 'versionData' => $this->getData(['module', $this->getUrl(0), 'config', 'versionData']), - ]]); - // Valeurs en sortie - $this->addOutput([ - 'redirect' => helper::baseUrl() . $this->getUrl(0) . '/option', - 'notification' => 'Modifications enregistrées', - 'state' => true - ]); - } else { - // Ids des sujets par ordre de publication - $sujetIds = array_keys(helper::arrayColumn($this->getData(['module', $this->getUrl(0), 'posts']), 'publishedOn', 'SORT_DESC')); - // Gestion des droits d'accès - $filterData=[]; - foreach ($sujetIds 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 - AND $this->getUser('group') >= $this->getData(['module',$this->getUrl(0), 'posts', $value,'editConsent']) - ) - OR ( - // Tout le monde - $this->getData(['module', $this->getUrl(0), 'posts', $value,'editConsent']) === self::EDIT_ALL - ) - ) { - $filterData[] = $value; - } - } - $sujetIds = $filterData; - // Pagination - $pagination = helper::pagination($sujetIds, $this->getUrl(),$this->getData(['module', $this->getUrl(0),'config', 'itemsperPage'])); - // Liste des pages - self::$pages = $pagination['pages']; - // Sujets en fonction de la pagination - for($i = $pagination['first']; $i < $pagination['last']; $i++) { - // Nombre de réponses à approuver et approuvés - $approvals = helper::arrayColumn($this->getData(['module', $this->getUrl(0), 'posts', $sujetIds[$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), 'posts', $sujetIds[$i],'comment'])); - } - // Met en forme le tableau - $date = mb_detect_encoding(PHP81_BC\strftime('%d %B %Y', $this->getData(['module', $this->getUrl(0), 'posts', $sujetIds[$i], 'publishedOn'])), 'UTF-8', true) - ? PHP81_BC\strftime('%d %B %Y', $this->getData(['module', $this->getUrl(0), 'posts', $sujetIds[$i], 'publishedOn'])) - : utf8_encode(PHP81_BC\strftime('%d %B %Y', $this->getData(['module', $this->getUrl(0), 'posts', $sujetIds[$i], 'publishedOn']))); - $heure = mb_detect_encoding(PHP81_BC\strftime('%H:%M', $this->getData(['module', $this->getUrl(0), 'posts', $sujetIds[$i], 'publishedOn'])), 'UTF-8', true) - ? PHP81_BC\strftime('%H:%M', $this->getData(['module', $this->getUrl(0), 'posts', $sujetIds[$i], 'publishedOn'])) - : utf8_encode(PHP81_BC\strftime('%H:%M', $this->getData(['module', $this->getUrl(0), 'posts', $sujetIds[$i], 'publishedOn']))); - self::$sujets[] = [ - '' . - $this->getData(['module', $this->getUrl(0), 'posts', $sujetIds[$i], 'title']) . - '', - $date .' à '. $heure, - self::$states[$this->getData(['module', $this->getUrl(0), 'posts', $sujetIds[$i], 'state'])], - // Bouton pour afficher les réponses de l'sujet - template::button('blogConfigComment' . $sujetIds[$i], [ - 'class' => ($toApprove || $approved ) > 0 ? '' : 'buttonGrey' , - 'href' => ($toApprove || $approved ) > 0 ? helper::baseUrl() . $this->getUrl(0) . '/comment/' . $sujetIds[$i] : '', - 'value' => $toApprove > 0 ? $toApprove . '/' . $approved : $approved - ]), - template::button('blogConfigEdit' . $sujetIds[$i], [ - 'href' => helper::baseUrl() . $this->getUrl(0) . '/edit/' . $sujetIds[$i] . '/' . $_SESSION['csrf'], - 'value' => template::ico('pencil') - ]), - template::button('blogConfigDelete' . $sujetIds[$i], [ - 'class' => 'blogConfigDelete buttonRed', - 'href' => helper::baseUrl() . $this->getUrl(0) . '/delete/' . $sujetIds[$i] . '/' . $_SESSION['csrf'], - 'value' => template::ico('cancel') - ]) - ]; - } - // Valeurs en sortie - $this->addOutput([ - 'title' => 'Options de configuration', - 'view' => 'option' - ]); - } - } - - - /** - * Suppression - */ - public function delete() { - if($this->getData(['module', $this->getUrl(0), 'posts', $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), 'posts', $this->getUrl(2)]); - // Valeurs en sortie - $this->addOutput([ - 'redirect' => helper::baseUrl() . $this->getUrl(0) . '/config', - 'notification' => 'Sujet 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'sujet n'existe pas - if($this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(2)]) === null) { - // Valeurs en sortie - $this->addOutput([ - 'access' => false - ]); - } - // L'sujet existe - else { - // Soumission du formulaire - if($this->isPost()) { - if($this->getUser('group') === self::GROUP_ADMIN){ - $newuserid = $this->getInput('blogEditUserId', helper::FILTER_STRING_SHORT, true); - } - else{ - $newuserid = $this->getUser('id'); - } - $sujetId = $this->getInput('blogEditPermalink', null, true); - // Incrémente le nouvel id de l'sujet - if($sujetId !== $this->getUrl(2)) { - $sujetId = helper::increment($sujetId, $this->getData(['page'])); - $sujetId = helper::increment($sujetId, $this->getData(['module', $this->getUrl(0),'posts'])); - $sujetId = helper::increment($sujetId, array_keys(self::$actions)); - } - $this->setData(['module', - $this->getUrl(0), - 'posts', - $sujetId, [ - 'title' => $this->getInput('blogEditTitle', helper::FILTER_STRING_SHORT, true), - 'comment' => $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(2), 'comment']), - 'content' => $this->getInput('blogEditContent', null), - 'picture' => $this->getInput('blogEditPicture', helper::FILTER_STRING_SHORT), - '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), - 'userId' => $newuserid, - 'editConsent' => $this->getInput('blogEditConsent') === self::EDIT_GROUP ? $this->getUser('group') : $this->getInput('blogEditConsent'), - 'commentMaxlength' => $this->getInput('blogEditCommentMaxlength'), - '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) - ] - ]); - // Supprime l'ancien sujet - if($sujetId !== $this->getUrl(2)) { - $this->deleteData(['module', $this->getUrl(0), 'posts', $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::arrayColumn($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), 'posts', $this->getUrl(2), 'title']), - 'vendor' => [ - 'flatpickr', - 'tinymce', - 'furl' - ], - '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 sujet - 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'sujet n'existe pas - if($this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1)]) === null) { - // Valeurs en sortie - $this->addOutput([ - 'access' => false - ]); - } - // L'sujet existe - else { - // Soumission du formulaire - if($this->isPost()) { - // Check la captcha - if( - $this->getUser('password') !== $this->getInput('ZWII_USER_PASSWORD') - //AND $this->getInput('blogSujetcaptcha', helper::FILTER_INT) !== $this->getInput('blogSujetcaptchaFirstNumber', helper::FILTER_INT) + $this->getInput('blogSujetcaptchaSecondNumber', helper::FILTER_INT)) - AND password_verify($this->getInput('blogSujetCaptcha', helper::FILTER_INT), $this->getInput('blogSujetCaptchaResult') ) === false ) - { - self::$inputNotices['blogSujetCaptcha'] = 'Incorrect'; - } - // Crée le Réponse - $commentId = helper::increment(uniqid(), $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'comment'])); - $content = $this->getInput('blogSujetContent', false); - $this->setData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'comment', $commentId, [ - 'author' => $this->getInput('blogSujetAuthor', helper::FILTER_STRING_SHORT, empty($this->getInput('blogSujetUserId')) ? TRUE : FALSE), - 'content' => $content, - 'createdOn' => time(), - 'userId' => $this->getInput('blogSujetUserId'), - 'approval' => !$this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'commentApproved']) // true Réponse 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), 'posts', $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), 'posts', $this->getUrl(1), 'commentApproved']) === true ? 'Réponse déposé en attente d\'approbation': 'Réponse déposé'; - if ($this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'commentNotification']) === true) { - $error = 0; - foreach($to as $key => $adress){ - $sent = $this->sendMail( - $adress, - 'Nouveau Réponse déposé', - 'Bonjour' . ' ' . $firstname[$key] . ' ' . $lastname[$key] . ',

' . - 'L\'sujet ' . $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'title']) . ' a reçu un nouveau Réponse.

', - '' - ); - if( $sent === false) $error++; - } - // Valeurs en sortie - $this->addOutput([ - 'redirect' => helper::baseUrl() . $this->getUrl() . '#comment', - 'notification' => ($error === 0 ? $notification . '
Une notification a été envoyée.' : $notification . '
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 réponses approuvés par ordre de publication - $commentsApproved = $this->getData(['module', $this->getUrl(0), 'posts', $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 réponses approuvés sous l'sujet - self::$nbCommentsApproved = count($commentsApproved); - } - $commentIds = array_keys(helper::arrayColumn($commentsApproved, 'createdOn', 'SORT_DESC')); - // Pagination - $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'sujet - self::$sujetSignature = $this->signature($this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'userId'])); - // Signature du Réponse édité - if($this->getUser('password') === $this->getInput('ZWII_USER_PASSWORD')) { - self::$editCommentSignature = $this->signature($this->getUser('id')); - } - // Réponses en fonction de la pagination - for($i = $pagination['first']; $i < $pagination['last']; $i++) { - // Signatures des réponses - $e = $this->getData(['module', $this->getUrl(0), 'posts', $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), 'posts', $this->getUrl(1), 'comment', $commentIds[$i],'author']); - } - // Données du Réponse si approuvé - 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]]); - } - } - // Valeurs en sortie - $this->addOutput([ - 'showBarEditButton' => true, - 'title' => $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'title']), - 'vendor' => [ - 'tinymce' - ], - 'view' => 'sujet' - ]); - } - - } - // Liste des sujets - else { - // Ids des sujets par ordre de publication - $sujetIdsPublishedOns = helper::arrayColumn($this->getData(['module', $this->getUrl(0),'posts']), 'publishedOn', 'SORT_DESC'); - $sujetIdsStates = helper::arrayColumn($this->getData(['module', $this->getUrl(0), 'posts']), 'state', 'SORT_DESC'); - $sujetIds = []; - foreach($sujetIdsPublishedOns as $sujetId => $sujetPublishedOn) { - if($sujetPublishedOn <= time() AND $sujetIdsStates[$sujetId]) { - $sujetIds[] = $sujetId; - // Nombre de réponses approuvés par sujet - self::$comments [$sujetId] = count ( $this->getData(['module', $this->getUrl(0), 'posts', $sujetId, 'comment'])); - } - } - // Pagination - $pagination = helper::pagination($sujetIds, $this->getUrl(), $this->getData(['module', $this->getUrl(0),'config', 'itemsperPage'])); - // Liste des pages - self::$pages = $pagination['pages']; - // Sujets en fonction de la pagination - for($i = $pagination['first']; $i < $pagination['last']; $i++) { - self::$sujets[$sujetIds[$i]] = $this->getData(['module', $this->getUrl(0), 'posts', $sujetIds[$i]]); - } - // Valeurs en sortie - $this->addOutput([ - 'showBarEditButton' => true, - 'showPageContent' => true, - 'view' => 'index' - ]); - } - } - - /** - * Retourne la signature d'un utilisateur - */ - public 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']); - } - } -} diff --git a/module/forum/ressource/feed-icon-16.gif b/module/forum/ressource/feed-icon-16.gif deleted file mode 100644 index 26fa274454d016fdafa1b371e6d172030b61ac7d..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 652 zcmZ?wbhEHb6krfwI9AB;Wun>ZdZS-+EPv0n`Z3e;&({zCe|~<~YVxAe@L9d_w<+eI zdQG2|=)Y_={m^OhuGRS8k57;D^!|N%b}LTnd4>L)F0+RfhHn~;9%Sjhsx^FEY4o_# z@aJ5|7tJR3Qg!}*e0DEi|9+vtokZ=wx3)ekF?ii+`l8kJ-}g^XOY|O<89r|`zE@!I zw8rQ~lgXb$Ew9>5@8;=0sWy6AYxJ_i?AMyOU+0$pSfBZBqR*FQ>F;Kx{5&!HWu4`h zy)%Byb9vwE_-=LQzc;sjE)9COY3j%A(|_+Qe^BcBc}e>FxhY@P6#u!o_50e)zxNOR z`}pkB;X?tj(k`Srkzulr~IeR}rieAnO4Zv4Ey|51V2uYJwG*T+4nasRbB>(}MY z-=|yroMriSlKIDO(^nhX|C0g~f3h%gG1N2YFaQB4P8irutD!|K07BTzlA_-oNcc1hVb)@I$C@&8w%Mnm^}*x>=-$uWM@XE3q3K( z+n30}qshBGH{_PjB8AT4CPx+_eKXyakCM*VXfpa8x!9!W!fBS3&{_Cd#ZQtY`q7^c z42zs*YqCAMQjx5}C&}jgh(nMu*=?1A*RH1rgcN%xD+z}kc=+HAgLSinO~;G`HX#{d V-YAuXg^H}50tyKne}y?1tN}38S(N|) diff --git a/module/forum/vendor/FeedWriter/ATOM.php b/module/forum/vendor/FeedWriter/ATOM.php deleted file mode 100644 index 28494501..00000000 --- a/module/forum/vendor/FeedWriter/ATOM.php +++ /dev/null @@ -1,38 +0,0 @@ - - * - * 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 . - */ - -/** - * Wrapper for creating ATOM feeds - * - * @package UniversalFeedWriter - */ -class ATOM extends Feed -{ - /** - * {@inheritdoc} - */ - public function __construct() - { - parent::__construct(Feed::ATOM); - } - -} diff --git a/module/forum/vendor/FeedWriter/Feed.php b/module/forum/vendor/FeedWriter/Feed.php deleted file mode 100644 index 9e0650a8..00000000 --- a/module/forum/vendor/FeedWriter/Feed.php +++ /dev/null @@ -1,1017 +0,0 @@ - - * Copyright (C) 2010-2016 Michael Bemmerl - * - * 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 . - */ - -/** - * Universal Feed Writer class - * - * Generate RSS 1.0, RSS2.0 and ATOM Feeds - * - * @package UniversalFeedWriter - * @author Anis uddin Ahmad - * @link http://www.ajaxray.com/projects/rss - */ -abstract class Feed -{ - // RSS 0.90 Officially obsoleted by 1.0 - // RSS 0.91, 0.92, 0.93 and 0.94 Officially obsoleted by 2.0 - // So, define constants for RSS 1.0, RSS 2.0 and ATOM - - const RSS1 = 'RSS 1.0'; - const RSS2 = 'RSS 2.0'; - const ATOM = 'ATOM'; - - const VERSION = '1.1.0'; - - /** - * Collection of all channel elements - */ - private $channels = array(); - - /** - * Collection of items as object of \FeedWriter\Item class. - */ - private $items = array(); - - /** - * Collection of other version wise data. - * - * Currently used to store the 'rdf:about' attribute and image element of the channel (both RSS1 only). - */ - private $data = array(); - - /** - * The tag names which have to encoded as CDATA - */ - private $CDATAEncoding = array(); - - /** - * Collection of XML namespaces - */ - private $namespaces = array(); - - /** - * Contains the format of this feed. - */ - private $version = null; - - /** - * Constructor - * - * If no version is given, a feed in RSS 2.0 format will be generated. - * - * @param string $version the version constant (RSS1/RSS2/ATOM). - */ - protected function __construct($version = Feed::RSS2) - { - $this->version = $version; - - // Setting default encoding - $this->encoding = 'utf-8'; - - // Setting default value for essential channel element - $this->setTitle($version . ' Feed'); - - // Add some default XML namespaces - $this->namespaces['content'] = 'http://purl.org/rss/1.0/modules/content/'; - $this->namespaces['wfw'] = 'http://wellformedweb.org/CommentAPI/'; - $this->namespaces['atom'] = 'http://www.w3.org/2005/Atom'; - $this->namespaces['rdf'] = 'http://www.w3.org/1999/02/22-rdf-syntax-ns#'; - $this->namespaces['rss1'] = 'http://purl.org/rss/1.0/'; - $this->namespaces['dc'] = 'http://purl.org/dc/elements/1.1/'; - $this->namespaces['sy'] = 'http://purl.org/rss/1.0/modules/syndication/'; - - // Tag names to encode in CDATA - $this->addCDATAEncoding(array('description', 'content:encoded', 'summary')); - } - - // Start # public functions --------------------------------------------- - - /** - * Set the URLs for feed pagination. - * - * See RFC 5005, chapter 3. At least one page URL must be specified. - * - * @param string $nextURL The URL to the next page of this feed. Optional. - * @param string $previousURL The URL to the previous page of this feed. Optional. - * @param string $firstURL The URL to the first page of this feed. Optional. - * @param string $lastURL The URL to the last page of this feed. Optional. - * @link http://tools.ietf.org/html/rfc5005#section-3 - * @return self - * @throws \LogicException if none of the parameters are set. - */ - public function setPagination($nextURL = null, $previousURL = null, $firstURL = null, $lastURL = null) - { - if (empty($nextURL) && empty($previousURL) && empty($firstURL) && empty($lastURL)) - throw new \LogicException('At least one URL must be specified for pagination to work.'); - - if (!empty($nextURL)) - $this->setAtomLink($nextURL, 'next'); - - if (!empty($previousURL)) - $this->setAtomLink($previousURL, 'previous'); - - if (!empty($firstURL)) - $this->setAtomLink($firstURL, 'first'); - - if (!empty($lastURL)) - $this->setAtomLink($lastURL, 'last'); - - return $this; - } - - /** - * Add a channel element indicating the program used to generate the feed. - * - * @return self - * @throws InvalidOperationException if this method is called on an RSS1 feed. - */ - public function addGenerator() - { - if ($this->version == Feed::ATOM) - $this->setChannelElement('atom:generator', 'FeedWriter', array('uri' => 'https://github.com/mibe/FeedWriter')); - else if ($this->version == Feed::RSS2) - $this->setChannelElement('generator', 'FeedWriter'); - else - throw new InvalidOperationException('The generator element is not supported in RSS1 feeds.'); - - return $this; - } - - /** - * Add a XML namespace to the internal list of namespaces. After that, - * custom channel elements can be used properly to generate a valid feed. - * - * @access public - * @param string $prefix namespace prefix - * @param string $uri namespace name (URI) - * @return self - * @link http://www.w3.org/TR/REC-xml-names/ - * @throws \InvalidArgumentException if the prefix or uri is empty or NULL. - */ - public function addNamespace($prefix, $uri) - { - if (empty($prefix)) - throw new \InvalidArgumentException('The prefix may not be emtpy or NULL.'); - if (empty($uri)) - throw new \InvalidArgumentException('The uri may not be empty or NULL.'); - - $this->namespaces[$prefix] = $uri; - - return $this; - } - - /** - * Add a channel element to the feed. - * - * @access public - * @param string $elementName name of the channel tag - * @param string $content content of the channel tag - * @param array array of element attributes with attribute name as array key - * @param bool TRUE if this element can appear multiple times - * @return self - * @throws \InvalidArgumentException if the element name is not a string, empty or NULL. - */ - public function setChannelElement($elementName, $content, array $attributes = null, $multiple = 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.'); - - $entity['content'] = $content; - $entity['attributes'] = $attributes; - - if ($multiple === TRUE) - $this->channels[$elementName][] = $entity; - else - $this->channels[$elementName] = $entity; - - return $this; - } - - /** - * Set multiple channel elements from an array. Array elements - * should be 'channelName' => 'channelContent' format. - * - * @access public - * @param array array of channels - * @return self - */ - public function setChannelElementsFromArray(array $elementArray) - { - foreach ($elementArray as $elementName => $content) { - $this->setChannelElement($elementName, $content); - } - - return $this; - } - - /** - * Get the appropriate MIME type string for the current feed. - * - * @access public - * @return string The MIME type string. - */ - public function getMIMEType() - { - switch ($this->version) { - case Feed::RSS2 : $mimeType = "application/rss+xml"; - break; - case Feed::RSS1 : $mimeType = "application/rdf+xml"; - break; - case Feed::ATOM : $mimeType = "application/atom+xml"; - break; - default : $mimeType = "text/xml"; - } - - return $mimeType; - } - - /** - * Print the actual RSS/ATOM file - * - * Sets a Content-Type header and echoes the contents of the feed. - * Should only be used in situations where direct output is desired; - * if you need to pass a string around, use generateFeed() instead. - * - * @access public - * @param bool FALSE if the specific feed media type should be sent. - * @return void - * @throws \InvalidArgumentException if the useGenericContentType parameter is not boolean. - */ - public function printFeed($useGenericContentType = false) - { - if (!is_bool($useGenericContentType)) - throw new \InvalidArgumentException('The useGenericContentType parameter must be boolean.'); - - $contentType = "text/xml"; - - if (!$useGenericContentType) { - $contentType = $this->getMIMEType(); - } - - // Generate the feed before setting the header, so Exceptions will be nicely visible. - $feed = $this->generateFeed(); - header("Content-Type: " . $contentType . "; charset=" . $this->encoding); - echo $feed; - } - - /** - * Generate the feed. - * - * @access public - * @return string The complete feed XML. - * @throws InvalidOperationException if the link element of the feed is not set. - */ - public function generateFeed() - { - if ($this->version != Feed::ATOM && !array_key_exists('link', $this->channels)) - throw new InvalidOperationException('RSS1 & RSS2 feeds need a link element. Call the setLink method before this method.'); - - return $this->makeHeader() - . $this->makeChannels() - . $this->makeItems() - . $this->makeFooter(); - } - - /** - * Create a new Item. - * - * @access public - * @return Item instance of Item class - */ - public function createNewItem() - { - $Item = new Item($this->version); - - return $Item; - } - - /** - * Add one or more tags to the list of CDATA encoded tags - * - * @access public - * @param array $tags An array of tag names that are merged into the list of tags which should be encoded as CDATA - * @return self - */ - public function addCDATAEncoding(array $tags) - { - $this->CDATAEncoding = array_merge($this->CDATAEncoding, $tags); - - return $this; - } - - /** - * Get list of CDATA encoded properties - * - * @access public - * @return array Return an array of CDATA properties that are to be encoded as CDATA - */ - public function getCDATAEncoding() - { - return $this->CDATAEncoding; - } - - /** - * Remove tags from the list of CDATA encoded tags - * - * @access public - * @param array $tags An array of tag names that should be removed. - * @return void - */ - public function removeCDATAEncoding(array $tags) - { - // Call array_values to re-index the array. - $this->CDATAEncoding = array_values(array_diff($this->CDATAEncoding, $tags)); - } - - /** - * Add a FeedItem to the main class - * - * @access public - * @param Item $feedItem instance of Item class - * @return self - * @throws \InvalidArgumentException if the given item version mismatches. - */ - public function addItem(Item $feedItem) - { - if ($feedItem->getVersion() != $this->version) - { - $msg = sprintf('Feed type mismatch: This instance can handle %s feeds only, but item for %s feeds given.', $this->version, $feedItem->getVersion()); - throw new \InvalidArgumentException($msg); - } - - $this->items[] = $feedItem; - - return $this; - } - - // Wrapper functions ------------------------------------------------------------------- - - /** - * Set the 'encoding' attribute in the XML prolog. - * - * @access public - * @param string $encoding value of 'encoding' attribute - * @return self - * @throws \InvalidArgumentException if the encoding is not a string, empty or NULL. - */ - public function setEncoding($encoding) - { - if (empty($encoding)) - throw new \InvalidArgumentException('The encoding may not be empty or NULL.'); - if (!is_string($encoding)) - throw new \InvalidArgumentException('The encoding must be a string.'); - - $this->encoding = $encoding; - - return $this; - } - - /** - * Set the 'title' channel element - * - * @access public - * @param string $title value of 'title' channel tag - * @return self - */ - public function setTitle($title) - { - return $this->setChannelElement('title', $title); - } - - /** - * Set the date when the feed was lastly updated. - * - * This adds the 'updated' element to the feed. 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. - * - * Not supported in RSS1 feeds. - * - * @access public - * @param DateTime|int|string Date which should be used. - * @return self - * @throws \InvalidArgumentException if the given date is not an instance of DateTime, a UNIX timestamp or a date string. - * @throws InvalidOperationException if this method is called on an RSS1 feed. - */ - public function setDate($date) - { - if ($this->version == Feed::RSS1) - throw new InvalidOperationException('The publication date is not supported in RSS1 feeds.'); - - // The feeds have different date formats. - $format = $this->version == Feed::ATOM ? \DATE_ATOM : \DATE_RSS; - - if ($date instanceof DateTime) - $date = $date->format($format); - else if(is_numeric($date) && $date >= 0) - $date = date($format, $date); - else if (is_string($date)) - { - $timestamp = strtotime($date); - if ($timestamp === FALSE) - throw new \InvalidArgumentException('The given date was not parseable.'); - - $date = date($format, $timestamp); - } - else - throw new \InvalidArgumentException('The given date is not an instance of DateTime, a UNIX timestamp or a date string.'); - - if ($this->version == Feed::ATOM) - $this->setChannelElement('updated', $date); - else - $this->setChannelElement('lastBuildDate', $date); - - return $this; - } - - /** - * Set a phrase or sentence describing the feed. - * - * @access public - * @param string $description Description of the feed. - * @return self - */ - public function setDescription($description) - { - if ($this->version != Feed::ATOM) - $this->setChannelElement('description', $description); - else - $this->setChannelElement('subtitle', $description); - - return $this; - } - - /** - * Set the 'link' channel element - * - * @access public - * @param string $link value of 'link' channel tag - * @return self - */ - public function setLink($link) - { - if ($this->version == Feed::ATOM) - $this->setAtomLink($link); - else - $this->setChannelElement('link', $link); - - return $this; - } - - /** - * Set custom 'link' channel elements. - * - * In ATOM feeds, only one link with alternate relation and the same combination of - * type and hreflang values. - * - * @access public - * @param string $href URI of this link - * @param string $rel relation type of the resource - * @param string $type MIME type of the target resource - * @param string $hreflang language of the resource - * @param string $title human-readable information about the resource - * @param int $length length of the resource in bytes - * @link https://www.iana.org/assignments/link-relations/link-relations.xml - * @link https://tools.ietf.org/html/rfc4287#section-4.2.7 - * @return self - * @throws \InvalidArgumentException on multiple occasions. - * @throws InvalidOperationException if the same link with the same attributes was already added to the feed. - */ - public function setAtomLink($href, $rel = null, $type = null, $hreflang = null, $title = null, $length = null) - { - $data = array('href' => $href); - - if ($rel != null) { - if (!is_string($rel) || empty($rel)) - throw new \InvalidArgumentException('rel parameter must be a string and a valid relation identifier.'); - - $data['rel'] = $rel; - } - if ($type != null) { - // 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.'); - - $data['type'] = $type; - } - if ($hreflang != null) { - // Regex used from RFC 4287, page 41 - if (!is_string($hreflang) || preg_match('/[A-Za-z]{1,8}(-[A-Za-z0-9]{1,8})*/', $hreflang) != 1) - throw new \InvalidArgumentException('hreflang parameter must be a string and a valid language code.'); - - $data['hreflang'] = $hreflang; - } - if ($title != null) { - if (!is_string($title) || empty($title)) - throw new \InvalidArgumentException('title parameter must be a string and not empty.'); - - $data['title'] = $title; - } - if ($length != null) { - if (!is_int($length) || $length < 0) - throw new \InvalidArgumentException('length parameter must be a positive integer.'); - - $data['length'] = (string) $length; - } - - // ATOM spec. has some restrictions on atom:link usage - // See RFC 4287, page 12 (4.1.1) - if ($this->version == Feed::ATOM) { - foreach ($this->channels as $key => $value) { - if ($key != 'atom:link') - continue; - - // $value is an array , so check every element - foreach ($value as $linkItem) { - $attrib = $linkItem['attributes']; - // Only one link with relation alternate and same hreflang & type is allowed. - if (@$attrib['rel'] == 'alternate' && @$attrib['hreflang'] == $hreflang && @$attrib['type'] == $type) - throw new InvalidOperationException('The feed must not contain more than one link element with a' - . ' relation of "alternate" that has the same combination of type and hreflang attribute values.'); - } - } - } - - return $this->setChannelElement('atom:link', '', $data, true); - } - - /** - * Set an 'atom:link' channel element with relation=self attribute. - * Needs the full URL to this feed. - * - * @link http://www.rssboard.org/rss-profile#namespace-elements-atom-link - * @access public - * @param string $url URL to this feed - * @return self - */ - public function setSelfLink($url) - { - return $this->setAtomLink($url, 'self', $this->getMIMEType()); - } - - /** - * Set the 'image' channel element - * - * @access public - * @param string $url URL of the image - * @param string $title Title of the image. RSS only. - * @param string $link Link target URL of the image. RSS only. - * @return self - * @throws \InvalidArgumentException if the url is invalid. - * @throws \InvalidArgumentException if the title and link parameter are not a string or empty. - */ - public function setImage($url, $title = null, $link = null) - { - if (!is_string($url) || empty($url)) - throw new \InvalidArgumentException('url parameter must be a string and may not be empty or NULL.'); - - // RSS feeds have support for a title & link element. - if ($this->version != Feed::ATOM) - { - if (!is_string($title) || empty($title)) - throw new \InvalidArgumentException('title parameter must be a string and may not be empty or NULL.'); - if (!is_string($link) || empty($link)) - throw new \InvalidArgumentException('link parameter must be a string and may not be empty or NULL.'); - - $data = array('title'=>$title, 'link'=>$link, 'url'=>$url); - $name = 'image'; - } - else - { - $name = 'logo'; - $data = $url; - } - - // Special handling for RSS1 again (since RSS1 is a bit strange...) - if ($this->version == Feed::RSS1) - { - $this->data['Image'] = $data; - return $this->setChannelElement($name, '', array('rdf:resource' => $url), false); - } - else - return $this->setChannelElement($name, $data); - } - - /** - * Set the channel 'rdf:about' attribute, which is used in RSS1 feeds only. - * - * @access public - * @param string $url value of 'rdf:about' attribute of the channel element - * @return self - * @throws InvalidOperationException if this method is called and the feed is not of type RSS1. - * @throws \InvalidArgumentException if the given URL is invalid. - */ - public function setChannelAbout($url) - { - if ($this->version != Feed::RSS1) - throw new InvalidOperationException("This method is only supported in RSS1 feeds."); - if (empty($url)) - throw new \InvalidArgumentException('The about URL may not be empty or NULL.'); - if (!is_string($url)) - throw new \InvalidArgumentException('The about URL must be a string.'); - - $this->data['ChannelAbout'] = $url; - - return $this; - } - - /** - * Generate an UUID. - * - * The UUID is based on an MD5 hash. If no key is given, a unique ID as the input - * for the MD5 hash is generated. - * - * @author Anis uddin Ahmad - * @access public - * @param string $key optional key on which the UUID is generated - * @param string $prefix an optional prefix - * @return string the formatted UUID - */ - public static function uuid($key = null, $prefix = '') - { - $key = ($key == null) ? uniqid(rand()) : $key; - $chars = md5($key); - $uuid = substr($chars,0,8) . '-'; - $uuid .= substr($chars,8,4) . '-'; - $uuid .= substr($chars,12,4) . '-'; - $uuid .= substr($chars,16,4) . '-'; - $uuid .= substr($chars,20,12); - - return $prefix . $uuid; - } - - /** - * Replace invalid XML characters. - * - * @link http://www.phpwact.org/php/i18n/charsets#xml See utf8_for_xml() function - * @link http://www.w3.org/TR/REC-xml/#charsets - * @link https://github.com/mibe/FeedWriter/issues/30 - * - * @access public - * @param string $string string which should be filtered - * @param string $replacement replace invalid characters with this string - * @return string the filtered string - */ - public static function filterInvalidXMLChars($string, $replacement = '_') // default to '\x{FFFD}' ??? - { - $result = preg_replace('/[^\x{0009}\x{000a}\x{000d}\x{0020}-\x{D7FF}\x{E000}-\x{FFFD}\x{10000}-\x{10FFFF}]+/u', $replacement, $string); - - // Did the PCRE replace failed because of bad UTF-8 data? - // If yes, try a non-multibyte regex and without the UTF-8 mode enabled. - if ($result == NULL && preg_last_error() == PREG_BAD_UTF8_ERROR) - $result = preg_replace('/[^\x09\x0a\x0d\x20-\xFF]+/', $replacement, $string); - - // In case the regex replacing failed completely, return the whole unfiltered string. - if ($result == NULL) - $result = $string; - - return $result; - } - // End # public functions ---------------------------------------------- - - // Start # private functions ---------------------------------------------- - - /** - * Returns all used XML namespace prefixes in this instance. - * This includes all channel elements and feed items. - * Unfortunately some namespace prefixes are not included, - * because they are hardcoded, e.g. rdf. - * - * @access private - * @return array Array with namespace prefix as value. - */ - private function getNamespacePrefixes() - { - $prefixes = array(); - - // Get all tag names from channel elements... - $tags = array_keys($this->channels); - - // ... and now all names from feed items - foreach ($this->items as $item) { - foreach (array_keys($item->getElements()) as $key) { - if (!in_array($key, $tags)) { - $tags[] = $key; - } - } - } - - // Look for prefixes in those tag names - foreach ($tags as $tag) { - $elements = explode(':', $tag); - - if (count($elements) != 2) - continue; - - $prefixes[] = $elements[0]; - } - - return array_unique($prefixes); - } - - /** - * Returns the XML header and root element, depending on the feed type. - * - * @access private - * @return string The XML header of the feed. - * @throws InvalidOperationException if an unknown XML namespace prefix is encountered. - */ - private function makeHeader() - { - $out = 'encoding.'" ?>' . PHP_EOL; - - $prefixes = $this->getNamespacePrefixes(); - $attributes = array(); - $tagName = ''; - $defaultNamespace = ''; - - if ($this->version == Feed::RSS2) { - $tagName = 'rss'; - $attributes['version'] = '2.0'; - } elseif ($this->version == Feed::RSS1) { - $tagName = 'rdf:RDF'; - $prefixes[] = 'rdf'; - $defaultNamespace = $this->namespaces['rss1']; - } elseif ($this->version == Feed::ATOM) { - $tagName = 'feed'; - $defaultNamespace = $this->namespaces['atom']; - - // Ugly hack to remove the 'atom' value from the prefixes array. - $prefixes = array_flip($prefixes); - unset($prefixes['atom']); - $prefixes = array_flip($prefixes); - } - - // Iterate through every namespace prefix and add it to the element attributes. - foreach ($prefixes as $prefix) { - if (!isset($this->namespaces[$prefix])) - throw new InvalidOperationException('Unknown XML namespace prefix: \'' . $prefix . '\'.' - . ' Use the addNamespace method to add support for this prefix.'); - else - $attributes['xmlns:' . $prefix] = $this->namespaces[$prefix]; - } - - // Include default namepsace, if required - if (!empty($defaultNamespace)) - $attributes['xmlns'] = $defaultNamespace; - - $out .= $this->makeNode($tagName, '', $attributes, true); - - return $out; - } - - /** - * Closes the open tags at the end of file - * - * @access private - * @return string The XML footer of the feed. - */ - private function makeFooter() - { - if ($this->version == Feed::RSS2) { - return '' . PHP_EOL . ''; - } elseif ($this->version == Feed::RSS1) { - return ''; - } elseif ($this->version == Feed::ATOM) { - return ''; - } - } - - /** - * Creates a single node in XML format - * - * @access private - * @param string $tagName name of the tag - * @param mixed $tagContent tag value as string or array of nested tags in 'tagName' => 'tagValue' format - * @param array $attributes Attributes (if any) in 'attrName' => 'attrValue' format - * @param bool $omitEndTag True if the end tag should be omitted. Defaults to false. - * @return string formatted xml tag - * @throws \InvalidArgumentException if the tagContent is not an array and not a string. - */ - private function makeNode($tagName, $tagContent, array $attributes = null, $omitEndTag = false) - { - $nodeText = ''; - $attrText = ''; - - if ($attributes != null) { - foreach ($attributes as $key => $value) { - $value = self::filterInvalidXMLChars($value); - $value = htmlspecialchars($value); - $attrText .= " $key=\"$value\""; - } - } - - $attrText .= (in_array($tagName, $this->CDATAEncoding) && $this->version == Feed::ATOM) ? ' type="html"' : ''; - $nodeText .= "<{$tagName}{$attrText}>"; - $nodeText .= (in_array($tagName, $this->CDATAEncoding)) ? ' $value) { - if (is_array($value)) { - $nodeText .= PHP_EOL; - foreach ($value as $subValue) { - $nodeText .= $this->makeNode($key, $subValue); - } - } else if (is_string($value)) { - $nodeText .= $this->makeNode($key, $value); - } else { - throw new \InvalidArgumentException("Unknown node-value type for $key"); - } - } - } else { - $tagContent = self::filterInvalidXMLChars($tagContent); - $nodeText .= (in_array($tagName, $this->CDATAEncoding)) ? $this->sanitizeCDATA($tagContent) : htmlspecialchars($tagContent); - } - - $nodeText .= (in_array($tagName, $this->CDATAEncoding)) ? ']]>' : ''; - - if (!$omitEndTag) - $nodeText .= ""; - - $nodeText .= PHP_EOL; - - return $nodeText; - } - - /** - * Make the channels. - * - * @access private - * @return string The feed header as XML containing all the feed metadata. - */ - private function makeChannels() - { - $out = ''; - - //Start channel tag - switch ($this->version) { - case Feed::RSS2: - $out .= '' . PHP_EOL; - break; - case Feed::RSS1: - $out .= (isset($this->data['ChannelAbout']))? "data['ChannelAbout']}\">" : "channels['link']['content']}\">"; - break; - } - - //Print Items of channel - foreach ($this->channels as $key => $value) { - // In ATOM feeds, strip all ATOM namespace prefixes from the tag name. They are not needed here, - // because the ATOM namespace name is set as default namespace. - if ($this->version == Feed::ATOM && strncmp($key, 'atom', 4) == 0) { - $key = substr($key, 5); - } - - // The channel element can occur multiple times, when the key 'content' is not in the array. - if (!array_key_exists('content', $value)) { - // If this is the case, iterate through the array with the multiple elements. - foreach ($value as $singleElement) { - $out .= $this->makeNode($key, $singleElement['content'], $singleElement['attributes']); - } - } else { - $out .= $this->makeNode($key, $value['content'], $value['attributes']); - } - } - - if ($this->version == Feed::RSS1) { - //RSS 1.0 have special tag with channel - $out .= "" . PHP_EOL . "" . PHP_EOL; - foreach ($this->items as $item) { - $thisItems = $item->getElements(); - $out .= "" . PHP_EOL; - } - $out .= "" . PHP_EOL . "" . PHP_EOL . "" . PHP_EOL; - - // An image has its own element after the channel elements. - if (array_key_exists('image', $this->data)) - $out .= $this->makeNode('image', $this->data['Image'], array('rdf:about' => $this->data['Image']['url'])); - } else if ($this->version == Feed::ATOM) { - // ATOM feeds have a unique feed ID. Use the title channel element as key. - $out .= $this->makeNode('id', Feed::uuid($this->channels['title']['content'], 'urn:uuid:')); - } - - return $out; - } - - /** - * Prints formatted feed items - * - * @access private - * @return string The XML of every feed item. - */ - private function makeItems() - { - $out = ''; - - foreach ($this->items as $item) { - $thisItems = $item->getElements(); - - // The argument is printed as rdf:about attribute of item in RSS 1.0 - // We're using the link set in the item (which is mandatory) as the about attribute. - if ($this->version == Feed::RSS1) - $out .= $this->startItem($thisItems['link']['content']); - else - $out .= $this->startItem(); - - foreach ($thisItems as $feedItem) { - $name = $feedItem['name']; - - // Strip all ATOM namespace prefixes from tags when feed is an ATOM feed. - // Not needed here, because the ATOM namespace name is used as default namespace. - if ($this->version == Feed::ATOM && strncmp($name, 'atom', 4) == 0) - $name = substr($name, 5); - - $out .= $this->makeNode($name, $feedItem['content'], $feedItem['attributes']); - } - $out .= $this->endItem(); - } - - return $out; - } - - /** - * Make the starting tag of channels - * - * @access private - * @param string $about The value of about attribute which is used for RSS 1.0 only. - * @return string The starting XML tag of an feed item. - * @throws InvalidOperationException if this object misses the data for the about attribute. - */ - private function startItem($about = false) - { - $out = ''; - - if ($this->version == Feed::RSS2) { - $out .= '' . PHP_EOL; - } elseif ($this->version == Feed::RSS1) { - if ($about) { - $out .= "" . PHP_EOL; - } else { - throw new InvalidOperationException("Missing data for about attribute. Call setChannelAbout method."); - } - } elseif ($this->version == Feed::ATOM) { - $out .= "" . PHP_EOL; - } - - return $out; - } - - /** - * Closes feed item tag - * - * @access private - * @return string The ending XML tag of an feed item. - */ - private function endItem() - { - if ($this->version == Feed::RSS2 || $this->version == Feed::RSS1) { - return '' . PHP_EOL; - } elseif ($this->version == Feed::ATOM) { - return '' . PHP_EOL; - } - } - - /** - * Sanitizes data which will be later on returned as CDATA in the feed. - * - * A "]]>" respectively "", "]]>", $text); - $text = str_replace(" - * - * 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 . - */ - -/** - * The exception that is thrown when an invalid operation is performed on - * the object. - * - * @package UniversalFeedWriter - */ -class InvalidOperationException extends LogicException -{ -} diff --git a/module/forum/vendor/FeedWriter/Item.php b/module/forum/vendor/FeedWriter/Item.php deleted file mode 100644 index 695afe41..00000000 --- a/module/forum/vendor/FeedWriter/Item.php +++ /dev/null @@ -1,413 +0,0 @@ - - * Copyright (C) 2010-2013, 2015-2016 Michael Bemmerl - * - * 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 . - */ - -/** - * Universal Feed Writer - * - * Item class - Used as feed element in Feed class - * - * @package UniversalFeedWriter - * @author Anis uddin Ahmad - * @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 blog 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 diff --git a/module/forum/vendor/FeedWriter/README.md b/module/forum/vendor/FeedWriter/README.md deleted file mode 100644 index f630af99..00000000 --- a/module/forum/vendor/FeedWriter/README.md +++ /dev/null @@ -1,42 +0,0 @@ -# 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 diff --git a/module/forum/vendor/FeedWriter/RSS1.php b/module/forum/vendor/FeedWriter/RSS1.php deleted file mode 100644 index a0465cf5..00000000 --- a/module/forum/vendor/FeedWriter/RSS1.php +++ /dev/null @@ -1,37 +0,0 @@ - - * - * 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 . - */ - -/** - * Wrapper for creating RSS1 feeds - * - * @package UniversalFeedWriter - */ -class RSS1 extends Feed -{ - /** - * {@inheritdoc} - */ - public function __construct() - { - parent::__construct(Feed::RSS1); - } -} diff --git a/module/forum/vendor/FeedWriter/RSS2.php b/module/forum/vendor/FeedWriter/RSS2.php deleted file mode 100644 index 9e36a728..00000000 --- a/module/forum/vendor/FeedWriter/RSS2.php +++ /dev/null @@ -1,37 +0,0 @@ - - * - * 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 . - */ - -/** - * Wrapper for creating RSS2 feeds - * - * @package UniversalFeedWriter - */ -class RSS2 extends Feed -{ - /** - * {@inheritdoc} - */ - public function __construct() - { - parent::__construct(Feed::RSS2); - } -} diff --git a/module/forum/vendor/furl/LICENSE b/module/forum/vendor/furl/LICENSE deleted file mode 100644 index 5f86a4d6..00000000 --- a/module/forum/vendor/furl/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -MIT License - -Copyright (c) 2019 Vedat Taylan - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/module/forum/vendor/furl/README.md b/module/forum/vendor/furl/README.md deleted file mode 100644 index 2386a5ff..00000000 --- a/module/forum/vendor/furl/README.md +++ /dev/null @@ -1,4 +0,0 @@ -# furl -jQuery Furl (Friendly URL) Plugin 1.0.0 - -Usage : $('#InputID').furl({id:'ReplaceInputID', seperate (optional) : '_' }); diff --git a/module/forum/vendor/furl/inc.json b/module/forum/vendor/furl/inc.json deleted file mode 100644 index 7ef795a0..00000000 --- a/module/forum/vendor/furl/inc.json +++ /dev/null @@ -1,3 +0,0 @@ -[ - "jquery.furl.js" -] \ No newline at end of file diff --git a/module/forum/vendor/furl/jquery.furl.js b/module/forum/vendor/furl/jquery.furl.js deleted file mode 100644 index 58a13808..00000000 --- a/module/forum/vendor/furl/jquery.furl.js +++ /dev/null @@ -1,76 +0,0 @@ -/* - * jQuery Furl (Friendly URL) Plugin 1.0.0 - * - * Author : Vedat Taylan - * - * Year : 2018 - * Usage : $('#InputID').furl({id:'ReplaceInputID', seperate (optional) : '_' }); - */ -(function ($, undefined) { - function Furl() { - this.defaults = { - seperate: '-' - }; - } - Furl.prototype = { - init: function (target, options) { - var $this = this; - options = $.extend({}, $this.defaults, options); - - $(target).keyup(function () { - var url = urlReplace($(this).val(), options); - var $element = $('#' + options.id); - - if ($element.length > 0) { - var tagName = $element.get(0).tagName; - switch (tagName) { - case 'INPUT': - $element.val(url); - break; - default: - $element.text(url); - } - } - }); - } - }; - function urlReplace(url, options) { - return url.toLowerCase() - .replace(/ä/g, 'ae') - .replace(/Ä/g, 'ae') - .replace(/ğ/g, 'g') - .replace(/ü/g, 'u') - .replace(/ş/g, 's') - .replace(/ı/g, 'i') - .replace(/ö/g, 'o') - .replace(/ç/g, 'c') - .replace(/Ğ/g, 'g') - .replace(/Ü/g, 'u') - .replace(/Ş/g, 's') - .replace(/I/g, 'i') - .replace(/İ/g, 'i') - .replace(/Ö/g, 'o') - .replace(/Ç/g, 'c') - - .replace(/[^a-z0-9\s-]/g, "") - .replace(/[\s-]+/g, " ") - .replace(/^\s+|\s+$/g, "") - .replace(/\s/g, "-") - - .replace(/^\s+|\s+$/g, "") - .replace(/[_|\s]+/g, "-") - .replace(/[^a-z\u0400-\u04FF0-9-]+/g, "") - .replace(/[-]+/g, "-") - .replace(/^-+|-+$/g, "") - .replace(/[-]+/g, options.seperate); - } - - $.furl = new Furl(); - $.furl.version = "1.0.0"; - - $.fn.furl = function (options) { - return this.each(function () { - $.furl.init(this, options); - }); - }; -})(jQuery); diff --git a/module/forum/view/add/add.css b/module/forum/view/add/add.css deleted file mode 100644 index 52709ea6..00000000 --- a/module/forum/view/add/add.css +++ /dev/null @@ -1,18 +0,0 @@ -/** - * 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 - * @copyright Copyright (C) 2008-2018, Rémi Jean - * @author Frédéric Tempez - * @copyright Copyright (C) 2018-2022, Frédéric Tempez - * @license GNU General Public License, version 3 - * @link http://zwiicms.fr/ - */ - - -/** NE PAS EFFACER -* admin.css -*/ \ No newline at end of file diff --git a/module/forum/view/add/add.js.php b/module/forum/view/add/add.js.php deleted file mode 100644 index 7a0c0d08..00000000 --- a/module/forum/view/add/add.js.php +++ /dev/null @@ -1,58 +0,0 @@ -/** - * 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 - * @copyright Copyright (C) 2008-2018, Rémi Jean - * @author Frédéric Tempez - * @copyright Copyright (C) 2018-2022, Frédéric Tempez - * @license GNU General Public License, version 3 - * @link http://zwiicms.fr/ - */ - -/** - * Soumission du formulaire pour enregistrer en brouillon - */ -$("#blogAddDraft").on("click", function() { - $("#blogAddState").val(0); - $("#blogAddForm").trigger("submit"); -}); - -/** - * Options de réponses - */ -$("#blogAddCommentClose").on("change", function() { - if ($(this).is(':checked') ) { - $(".commentOptionsWrapper").slideUp(); - } else { - $(".commentOptionsWrapper").slideDown(); - } -}); - -$("#blogAddCommentNotification").on("change", function() { - if ($(this).is(':checked') ) { - $("#blogAddCommentGroupNotification").slideDown(); - } else { - $("#blogAddCommentGroupNotification").slideUp(); - } -}); - - -$( document).ready(function() { - - if ($("#blogAddCloseComment").is(':checked') ) { - $(".commentOptionsWrapper").slideUp(); - } else { - $(".commentOptionsWrapper").slideDown(); - } - - if ($("#blogAddCommentNotification").is(':checked') ) { - $("#blogAddCommentGroupNotification").slideDown(); - } else { - $("#blogAddCommentGroupNotification").slideUp(); - } - - // Permalink - $('#blogAddTitle').furl({id:'blogAddPermalink', seperate: '_' }); -}); \ No newline at end of file diff --git a/module/forum/view/add/add.php b/module/forum/view/add/add.php deleted file mode 100644 index 102afb39..00000000 --- a/module/forum/view/add/add.php +++ /dev/null @@ -1,109 +0,0 @@ - -

-
- 'buttonGrey', - 'href' => helper::baseUrl() . $this->getUrl(0) . '/config', - 'value' => template::ico('left') - ]); ?> -
-
- true, - 'value' => 'Brouillon' - ]); ?> - true - ]); ?> -
-
- 'Publier', - 'uniqueSubmission' => true - ]); ?> -
-
-
-
-
-

Informations générales

-
-
- 'Titre' - ]); ?> -
-
-
-
- 'Permalink' - ]); ?> -
-
-
-
-
- 'editorWysiwyg' - ]); ?> -
-
-
-

Options de publication

-
-
- 'Auteur', - 'selected' => $this->getUser('id'), - 'disabled' => $this->getUser('group') !== self::GROUP_ADMIN ? true : false - ]); ?> -
-
- 'L\'sujet n\'est visible qu\'après la date de publication prévue.', - 'label' => 'Date de publication', - 'value' => time() - ]); ?> -
-
- 'Edition - Suppression', - 'selected' => $module::EDIT_ALL, - 'help' => 'Les utilisateurs des groupes supérieurs accèdent à l\'sujet sans restriction' - ]); ?> -
-
-
-
-
-
-
-
-

Réponses

-
-
- -
-
- -
-
- 'Choix du nombre maximum de caractères pour chaque Réponse de l\'sujet, mise en forme html comprise.', - 'label' => 'Caractères par Réponse' - ]); ?> -
-
-
-
- -
-
- -
-
-
-
-
- diff --git a/module/forum/view/article/article.css b/module/forum/view/article/article.css deleted file mode 100644 index 180cb004..00000000 --- a/module/forum/view/article/article.css +++ /dev/null @@ -1,63 +0,0 @@ - -#sectionTitle { - margin-top: 0; - margin-bottom: 5px; -} -.blogSujetPicture { - height: auto; - border:1px solid lightgray; - box-shadow: 1px 1px 5px; -} -.blogSujetPictureleft { - float: left; - margin: 15px 10px 5px 0 ; -} -.blogSujetPictureright { - 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 ; -} - -#blogSujetCommentShow { - cursor: text; -} -#blogSujetOr { - padding: 10px; -} -.blogDate { - font-style: italic; - color: grey; - height: 100%; -} -@media (max-width: 767px) { - .blogSujetPicture { - height:auto; - max-width: 100%;} - } - - -#rssFeed { - text-align: right; - float: right; -} -#rssFeed p { - display: inline; - vertical-align: top; -} diff --git a/module/forum/view/article/article.js.php b/module/forum/view/article/article.js.php deleted file mode 100644 index 0c16f8e4..00000000 --- a/module/forum/view/article/article.js.php +++ /dev/null @@ -1,44 +0,0 @@ -/** - * 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 - * @copyright Copyright (C) 2008-2018, Rémi Jean - * @author Frédéric Tempez - * @copyright Copyright (C) 2018-2022, Frédéric Tempez - * @license GNU General Public License, version 3 - * @link http://zwiicms.fr/ - */ - -/** - * Affiche le bloc pour rédiger un Réponse - */ -var commentShowDOM = $("#blogSujetCommentShow"); -commentShowDOM.on("click focus", function() { - $("#blogSujetCommentShowWrapper").fadeOut(function() { - $("#blogSujetCommentWrapper").fadeIn(); - $("#blogSujetCommentContent").trigger("focus"); - }); -}); -if($("#blogSujetCommentWrapper").find("textarea.notice,input.notice").length) { - commentShowDOM.trigger("click"); -} - -/** - * Cache le bloc pour rédiger un Réponse - */ -$("#blogSujetCommentHide").on("click focus", function() { - $("#blogSujetCommentWrapper").fadeOut(function() { - $("#blogSujetCommentShowWrapper").fadeIn(); - $("#blogSujetCommentContent").val(""); - $("#blogSujetCommentAuthor").val(""); - }); -}); - -/** - * Force le scroll vers les réponses en cas d'erreur - */ -$("#blogSujetCommentForm").on("submit", function() { - $(location).attr("href", "#comment"); -}); \ No newline at end of file diff --git a/module/forum/view/article/article.php b/module/forum/view/article/article.php deleted file mode 100644 index 51f381e5..00000000 --- a/module/forum/view/article/article.php +++ /dev/null @@ -1,164 +0,0 @@ -
-
- getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'pictureSize']) === null ? '100' : $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'pictureSize']); ?> - getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'hidePicture']) == false) { - echo '' . $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'picture']) . ''; - } ?> - getData(['module', $this->getUrl(0),'posts', $this->getUrl(1), 'content']); ?> -
-
-
-
- - - - getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'publishedOn'])), 'UTF-8', true) - ? PHP81_BC\strftime('%d %B %Y', $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'publishedOn'])) - : utf8_encode(PHP81_BC\strftime('%d %B %Y', $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'publishedOn']))); - $heure = mb_detect_encoding(PHP81_BC\strftime('%H:%M', $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'publishedOn'])), 'UTF-8', true) - ? PHP81_BC\strftime('%H:%M', $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'publishedOn'])) - : utf8_encode(PHP81_BC\strftime('%H:%M', $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'publishedOn']))); - echo $date . ' à ' . $heure; - ?> - - 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'] - ) - ) - ): ?> - - Éditer - - - - getData(['module',$this->getUrl(0), 'config', 'feeds'])): ?> - - -
-
-getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'commentClose'])): ?> -

Cet sujet ne reçoit pas de Réponse.

- -
-
-

- 'right']); - if ($module::$nbCommentsApproved > 0) { - echo $module::$nbCommentsApproved . ' Réponse' . ($module::$nbCommentsApproved > 1 ? 's' : ''); - } else { - echo 'Pas encore de Réponse'; - } - ?> -

-
-
- - 'Rédiger un Réponse...', - 'readonly' => true - ]); ?> -
- getUser('password') === $this->getInput('ZWII_USER_PASSWORD')): ?> - 'Nom', - 'readonly' => true, - 'value' => $module::$editCommentSignature - ]); ?> - $this->getUser('id') - ]); ?> - -
-
- 'Nom' - ]); ?> -
-
-
Ou
-
-
- helper::baseUrl() . 'user/login/' . str_replace('/', '_', $this->getUrl()) . '__comment', - 'value' => 'Connexion' - ]); ?> -
-
- - 'Réponse 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']) - ]); ?> -
- getUser('password') !== $this->getInput('ZWII_USER_PASSWORD')): ?> -
-
- $this->getData(['config','connect', 'captchaStrong']), - 'type' => $this->getData(['config','connect', 'captchaType']) - ]); ?> -
-
- -
-
- 'buttonGrey', - 'value' => 'Annuler' - ]); ?> -
-
- 'Envoyer', - 'ico' => '' - ]); ?> -
-
-
- -
-
- $comment): ?> -
-

- le -

- -
- -
-
- \ No newline at end of file diff --git a/module/forum/view/comment/comment.css b/module/forum/view/comment/comment.css deleted file mode 100644 index 52709ea6..00000000 --- a/module/forum/view/comment/comment.css +++ /dev/null @@ -1,18 +0,0 @@ -/** - * 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 - * @copyright Copyright (C) 2008-2018, Rémi Jean - * @author Frédéric Tempez - * @copyright Copyright (C) 2018-2022, Frédéric Tempez - * @license GNU General Public License, version 3 - * @link http://zwiicms.fr/ - */ - - -/** NE PAS EFFACER -* admin.css -*/ \ No newline at end of file diff --git a/module/forum/view/comment/comment.js.php b/module/forum/view/comment/comment.js.php deleted file mode 100644 index 3b6b135c..00000000 --- a/module/forum/view/comment/comment.js.php +++ /dev/null @@ -1,63 +0,0 @@ -/** - * 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 - * @copyright Copyright (C) 2008-2018, Rémi Jean - * @author Frédéric Tempez - * @copyright Copyright (C) 2018-2022, Frédéric Tempez - * @license GNU General Public License, version 3 - * @link http://zwiicms.fr/ - */ - - -/** - * Confirmation de suppression - */ -$(".blogCommentDelete").on("click", function() { - var _this = $(this); - var nom = "getData(['module', $this->getUrl(0), 'posts', $this->getUrl(2), 'title' ]); ?>"; - return core.confirm("Supprimer le Réponse de l'sujet " + nom + " ?", function() { - $(location).attr("href", _this.attr("href")); - }); -}); - -/** - * Confirmation d'approbation - */ -$(".blogCommentApproved").on("click", function() { - var _this = $(this); - var nom = "getData(['module', $this->getUrl(0), 'posts', $this->getUrl(2), 'title' ]); ?>"; - return core.confirm("Approuver le Réponse de l'sujet " + nom + " ?", function() { - $(location).attr("href", _this.attr("href")); - }); -}); - -/** - * Confirmation de rejet - */ -$(".blogCommentRejected").on("click", function() { - var _this = $(this); - var nom = "getData(['module', $this->getUrl(0), 'posts', $this->getUrl(2), 'title' ]); ?>"; - return core.confirm("Rejeter le Réponse de l'sujet " + nom + " ?", function() { - $(location).attr("href", _this.attr("href")); - }); -}); - -/** - * Confirmation de suppression en masse - */ -$(".blogCommentDeleteAll").on("click", function() { - var _this = $(this); - var nombre = "getData(['module', $this->getUrl(0), 'posts', $this->getUrl(2), 'comment' ])); ?>"; - var nom = "getData(['module', $this->getUrl(0), $this->getUrl(2), 'title' ]); ?>"; - if( nombre === "1"){ - var message = "Supprimer le Réponse de l'sujet " + nom + " ?"; - } else { - var message = "Supprimer les " + nombre + " réponses de l'sujet " + nom + " ?"; - } - return core.confirm(message, function() { - $(location).attr("href", _this.attr("href")); - }); -}); diff --git a/module/forum/view/comment/comment.php b/module/forum/view/comment/comment.php deleted file mode 100644 index b3b18dcc..00000000 --- a/module/forum/view/comment/comment.php +++ /dev/null @@ -1,22 +0,0 @@ -
-
- 'buttonGrey', - 'href' => helper::baseUrl() . $this->getUrl(0) . '/config', - 'ico' => 'left', - 'value' => 'Retour' - ]); ?> -
- - -
- -
- -
- - '; ?> - - - - diff --git a/module/forum/view/config/config.css b/module/forum/view/config/config.css deleted file mode 100644 index 52709ea6..00000000 --- a/module/forum/view/config/config.css +++ /dev/null @@ -1,18 +0,0 @@ -/** - * 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 - * @copyright Copyright (C) 2008-2018, Rémi Jean - * @author Frédéric Tempez - * @copyright Copyright (C) 2018-2022, Frédéric Tempez - * @license GNU General Public License, version 3 - * @link http://zwiicms.fr/ - */ - - -/** NE PAS EFFACER -* admin.css -*/ \ No newline at end of file diff --git a/module/forum/view/config/config.js.php b/module/forum/view/config/config.js.php deleted file mode 100644 index ad446bf7..00000000 --- a/module/forum/view/config/config.js.php +++ /dev/null @@ -1,22 +0,0 @@ -/** - * 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 - * @copyright Copyright (C) 2008-2018, Rémi Jean - * @author Frédéric Tempez - * @copyright Copyright (C) 2018-2022, Frédéric Tempez - * @license GNU General Public License, version 3 - * @link http://zwiicms.fr/ - */ - -/** - * Confirmation de suppression - */ -$(".blogConfigDelete").on("click", function() { - var _this = $(this); - return core.confirm("Êtes-vous sûr de vouloir supprimer cet sujet ?", function() { - $(location).attr("href", _this.attr("href")); - }); -}); \ No newline at end of file diff --git a/module/forum/view/config/config.php b/module/forum/view/config/config.php deleted file mode 100644 index 3a175ea6..00000000 --- a/module/forum/view/config/config.php +++ /dev/null @@ -1,37 +0,0 @@ - -
-
- 'buttonGrey', - 'href' => helper::baseUrl() . 'page/edit/' . $this->getUrl(0), 'posts', - 'value' => template::ico('left') - ]); ?> -
-
- helper::baseUrl() . $this->getUrl(0) . '/option', - 'value' => template::ico('sliders'), - 'help' => 'Options de configuration' - ]); ?> - -
-
- helper::baseUrl() . $this->getUrl(0) . '/add', - 'value' => template::ico('plus'), - 'class' => 'buttonGreen', - 'help' => 'Rédiger un sujet' - ]); ?> -
-
- - - - - - - -
Version n° - -
- diff --git a/module/forum/view/edit/edit.css b/module/forum/view/edit/edit.css deleted file mode 100644 index 52709ea6..00000000 --- a/module/forum/view/edit/edit.css +++ /dev/null @@ -1,18 +0,0 @@ -/** - * 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 - * @copyright Copyright (C) 2008-2018, Rémi Jean - * @author Frédéric Tempez - * @copyright Copyright (C) 2018-2022, Frédéric Tempez - * @license GNU General Public License, version 3 - * @link http://zwiicms.fr/ - */ - - -/** NE PAS EFFACER -* admin.css -*/ \ No newline at end of file diff --git a/module/forum/view/edit/edit.js.php b/module/forum/view/edit/edit.js.php deleted file mode 100644 index d7c2fe40..00000000 --- a/module/forum/view/edit/edit.js.php +++ /dev/null @@ -1,71 +0,0 @@ -/** - * 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 - * @copyright Copyright (C) 2008-2018, Rémi Jean - * @author Frédéric Tempez - * @copyright Copyright (C) 2018-2022, Frédéric Tempez - * @license GNU General Public License, version 3 - * @link http://zwiicms.fr/ - */ - - -// Lien de connexion -$("#blogEditMailNotification").on("change", function() { - if($(this).is(":checked")) { - $("#formConfigGroup").show(); - } - else { - $("#formConfigGroup").hide(); - } -}).trigger("change"); - - -/** - * Soumission du formulaire pour enregistrer en brouillon - */ -$("#blogEditDraft").on("click", function() { - $("#blogEditState").val(0); - $("#blogEditForm").trigger("submit"); -}); - -/** - * Options de réponses - */ -$("#blogEditCommentClose").on("change", function() { - if ($(this).is(':checked') ) { - $(".commentOptionsWrapper").slideUp(); - } else { - $(".commentOptionsWrapper").slideDown(); - } -}); - -$("#blogEditCommentNotification").on("change", function() { - if ($(this).is(':checked') ) { - $("#blogEditCommentGroupNotification").slideDown(); - } else { - $("#blogEditCommentGroupNotification").slideUp(); - } -}); - - -$( document).ready(function() { - - if ($("#blogEditCloseComment").is(':checked') ) { - $(".commentOptionsWrapper").slideUp(); - } else { - $(".commentOptionsWrapper").slideDown(); - } - - if ($("#blogEditCommentNotification").is(':checked') ) { - $("#blogEditCommentGroupNotification").slideDown(); - } else { - $("#blogEditCommentGroupNotification").slideUp(); - } - - // Permalink - $('#blogEditTitle').furl({id:'blogEditPermalink', seperate: '_' }); - -}); \ No newline at end of file diff --git a/module/forum/view/edit/edit.php b/module/forum/view/edit/edit.php deleted file mode 100644 index b517fd16..00000000 --- a/module/forum/view/edit/edit.php +++ /dev/null @@ -1,152 +0,0 @@ - -
-
- 'buttonGrey', - 'href' => helper::baseUrl() . $this->getUrl(0) . '/config', - 'value' => template::ico('left') - ]); ?> -
-
- true, - 'value' => 'Brouillon' - ]); ?> - true - ]); ?> -
-
- 'Publier', - 'uniqueSubmission' => true - ]); ?> -
-
-
-
-
-

Informations générales

-
-
- 'Titre', - 'value' => $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(2), 'title']) - ]); ?> -
-
- 'Permalink', - 'value' => $this->getUrl(2) - ]); ?> -
-
-
-
- $this->getData(['theme', 'site', 'width']) !== '100%' ? 'Taille optimale de l\'image de couverture : ' . ((int) substr($this->getData(['theme', 'site', 'width']), 0, -2) - (20 * 2)) . ' x 350 pixels.' : '', - 'label' => 'Image de couverture', - 'type' => 1, - 'value' => $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(2), 'picture']) - ]); ?> -
-
- 'Largeur de l\'image', - 'selected' => $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(2), 'pictureSize']) - ]); ?> -
-
- 'Position', - 'selected' => $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(2), 'picturePosition']), - 'help' => 'Le texte de l\'sujet est adapté autour de l\'image' - ]); ?> -
-
-
-
- $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(2), 'hidePicture']) - ]); ?> -
-
-
-
-
- 'editorWysiwyg', - 'value' => $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(2), 'content']) - ]); ?> -
-
-
-

Options de publication

-
-
- 'Auteur', - 'selected' => $this->getUser('id'), - 'disabled' => $this->getUser('group') !== self::GROUP_ADMIN ? true : false - ]); ?> -
-
- 'L\'sujet n\'est visible qu\'après la date de publication prévue.', - 'label' => 'Date de publication', - 'value' => $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(2), 'publishedOn']) - ]); ?> -
-
- 'Edition - Suppression', - 'selected' => is_numeric($this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(2), 'editConsent'])) ? $module::EDIT_GROUP : $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(2), 'editConsent']), - 'help' => 'Les utilisateurs des groupes supérieurs accèdent à l\'sujet sans restriction' - ]); ?> -
-
-
-
-
-
-
-
-

Réponses

-
-
- $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(2), 'commentClose']) - ]); ?> -
-
- $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(2), 'commentApproved']), - '' - ]); ?> -
-
- 'Choix du nombre maximum de caractères pour chaque Réponse de l\'sujet, mise en forme html comprise.', - 'label' => 'Caractères par Réponse', - 'selected' => $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(2), 'commentMaxlength']) - ]); ?> -
- -
-
-
- $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(2), 'commentNotification']), - ]); ?> -
-
- $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(2), 'commentGroupNotification']), - 'help' => 'Éditeurs = éditeurs + administrateurs
Membres = membres + éditeurs + administrateurs' - ]); ?> -
-
-
-
-
- diff --git a/module/forum/view/index/index.css b/module/forum/view/index/index.css deleted file mode 100644 index 386f61a2..00000000 --- a/module/forum/view/index/index.css +++ /dev/null @@ -1,104 +0,0 @@ -.rowSujet { - margin-bottom: 10px !important; -} -.blogPicture { - float: none; - border: 1px; -} -.blogPicture img { - width: 100%; - height: auto; - /* - border:1px solid lightgray; - box-shadow: 1px 1px 5px darkgray; - */ -} - -#sectionTitle { - margin-top: 0; - margin-bottom: 5px; -} -.blogSujetPicture { - height: auto; - border:1px solid lightgray; - box-shadow: 1px 1px 5px; -} -.blogSujetPictureleft { - float: left; - margin: 15px 10px 5px 0 ; -} -.blogSujetPictureright { - float: right; - margin: 15px 0 5px 10px ; -} - -.blogPicture:hover { - opacity: .7; -} -.row:after { - content: " "; - display: table; - clear: both; -} -.blogComment { - padding-right: 10px; - float: right; -} -.blogTitle { - /*background-color: #ECEFF1;*/ - padding: 0px; - margin-bottom: 5px; -} -.blogContent { - float: left; - margin-top: 5px; -} -.blogDate { - font-size:0.8em; - font-style: italic; - /* - color: grey; - */ -} -@media (max-width: 768px) { - .blogContent { - display: none; - } - - .blogPicture img { - width: 50% ; - display: block; - margin-left: auto; - margin-right: auto; - } -} - -.pict20{ - width: 20%; -} -.pict30{ - width: 30%; -} -.pict40{ - width: 40%; -} -.pict50{ - width: 50%; -} -.pict100{ - width: 100%; - margin: 15px 0 20px 0 ; -} - - -/* -* Flux RSS -*/ -#rssFeed { - text-align: right; - float: right; -} -#rssFeed p { - display: inline; - vertical-align: top; -} \ No newline at end of file diff --git a/module/forum/view/index/index.php b/module/forum/view/index/index.php deleted file mode 100644 index a685bf9f..00000000 --- a/module/forum/view/index/index.php +++ /dev/null @@ -1,155 +0,0 @@ - - - $sujet): ?> - getData(['module', $this->getUrl(0), 'config', 'sujetsLenght']) === 0): ?> -
-
-

- - - -

-
-
-
-
- getData(['module', $this->getUrl(0), 'posts', $sujetId, 'picture']) && - file_exists( self::FILE_DIR.'source/' . $this->getData(['module', $this->getUrl(0), 'posts', $sujetId, 'picture'])) ): ?> - getData(['module', $this->getUrl(0), 'posts', $sujetId, 'pictureSize']) === null ? '100' : $this->getData(['module', $this->getUrl(0), 'posts', $sujetId, 'pictureSize']); ?> - getData(['module', $this->getUrl(0), 'posts', $sujetId, 'hidePicture']) == false) { - echo '' . $this->getData(['module', $this->getUrl(0), 'posts', $sujetId, 'picture']) . ''; - } ?> - - getData(['module', $this->getUrl(0),'posts', $sujetId, 'content']); ?> -
-
-
-
- - signature($this->getData(['module', $this->getUrl(0), 'posts', $sujetId, 'userId']));?> - - - getData(['module', $this->getUrl(0), 'posts', $sujetId, 'publishedOn'])), 'UTF-8', true) - ? PHP81_BC\strftime('%d %B %Y', $this->getData(['module', $this->getUrl(0), 'posts', $sujetId, 'publishedOn'])) - : utf8_encode(PHP81_BC\strftime('%d %B %Y', $this->getData(['module', $this->getUrl(0), 'posts', $sujetId, 'publishedOn']))); - $heure = mb_detect_encoding(PHP81_BC\strftime('%H:%M', $this->getData(['module', $this->getUrl(0), 'posts', $sujetId, 'publishedOn'])), 'UTF-8', true) - ? PHP81_BC\strftime('%H:%M', $this->getData(['module', $this->getUrl(0), 'posts', $sujetId, 'publishedOn'])) - : utf8_encode(PHP81_BC\strftime('%H:%M', $this->getData(['module', $this->getUrl(0), 'posts', $sujetId, 'publishedOn']))); - echo $date . ' à ' . $heure; - ?> - - getUser('password') === $this->getInput('ZWII_USER_PASSWORD') - AND - ( // Propriétaire - ( - $this->getData(['module', $this->getUrl(0), 'posts', $sujetId,'editConsent']) === $module::EDIT_OWNER - AND ( $this->getData(['module', $this->getUrl(0), 'posts', $sujetId,'userId']) === $this->getUser('id') - OR $this->getUser('group') === self::GROUP_ADMIN ) - ) - OR ( - // Groupe - ( $this->getData(['module', $this->getUrl(0), 'posts', $sujetId,'editConsent']) === self::GROUP_ADMIN - OR $this->getData(['module', $this->getUrl(0), 'posts', $sujetId,'editConsent']) === self::GROUP_MODERATOR) - AND $this->getUser('group') >= $this->getData(['module',$this->getUrl(0), 'posts', $sujetId,'editConsent']) - ) - OR ( - // Tout le monde - $this->getData(['module', $this->getUrl(0), 'posts', $sujetId,'editConsent']) === $module::EDIT_ALL - AND $this->getUser('group') >= $module::$actions['config'] - ) - ) - ): ?> - - Éditer - - -
-
- getData(['module', $this->getUrl(0), 'posts', $sujetId, 'commentClose'])): ?> -

Cet sujet ne reçoit pas de Réponse.

- -

- 'right']); ?> - 0) { - echo ''; - echo $module::$comments[$sujetId] . ' Réponse' . ($module::$comments[$sujetId] > 1 ? 's' : ''); - echo ''; - } else { - echo 'Pas encore de Réponse'; - } - ?> -

- -
-
- -
- -
- makeThumb( self::FILE_DIR . 'source/' . $sujet['picture'], - self::FILE_DIR . 'thumb/' . $thumb, - self::THUMBS_WIDTH); - } - ?> - - <?php echo $sujet['picture']; ?> - -
-
- -
- -

- - - -

-
- - - - - - 'left']); ?> -
-
- - -
-

- getData(['module',$this->getUrl(0), 'config', 'sujetsLenght']) !== 0 ? $this->getData(['module',$this->getUrl(0), 'config', 'sujetsLenght']) : 500 ?> -

'), 0, $lenght); ?>... - Lire la suite -

-
-
- - - - - getData(['module',$this->getUrl(0), 'config', 'feeds'])): ?> - - - - - diff --git a/module/forum/view/option/option.css b/module/forum/view/option/option.css deleted file mode 100644 index 52709ea6..00000000 --- a/module/forum/view/option/option.css +++ /dev/null @@ -1,18 +0,0 @@ -/** - * 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 - * @copyright Copyright (C) 2008-2018, Rémi Jean - * @author Frédéric Tempez - * @copyright Copyright (C) 2018-2022, Frédéric Tempez - * @license GNU General Public License, version 3 - * @link http://zwiicms.fr/ - */ - - -/** NE PAS EFFACER -* admin.css -*/ \ No newline at end of file diff --git a/module/forum/view/option/option.php b/module/forum/view/option/option.php deleted file mode 100644 index dc7f7777..00000000 --- a/module/forum/view/option/option.php +++ /dev/null @@ -1,60 +0,0 @@ - -
-
- 'buttonGrey', - 'href' => helper::baseUrl() . $this->getUrl(0) . '/config', - 'value' => template::ico('left') - ]); ?> -
-
- -
-
-
-
-
-

Disposition de la liste des sujets

-
-
- 'Longueur des sujets', - 'selected' => $this->getData(['module', $this->getUrl(0), 'config', 'sujetsLenght']) - ]); ?> -
-
- 'Sujets par page', - 'selected' => $this->getData(['module', $this->getUrl(0), 'config', 'itemsperPage']) - ]); ?> -
- -
-
-
-
-
-
-
-

Flux RSS

-
-
- $this->getData(['module', $this->getUrl(0), 'config', 'feeds']), - ]); ?> -
-
- 'Texte de l\'étiquette', - 'value' => $this->getData(['module', $this->getUrl(0), 'config', 'feedsLabel']) - ]); ?> -
-
-
-
-
- -
Version n° - -
- diff --git a/module/forum/view/rss/rss.php b/module/forum/view/rss/rss.php deleted file mode 100644 index 3a7a5780..00000000 --- a/module/forum/view/rss/rss.php +++ /dev/null @@ -1 +0,0 @@ -Le flux RSS est vide ou indisponible ! \ No newline at end of file diff --git a/module/news/news.php b/module/news/news.php index 030c03e6..24fde050 100644 --- a/module/news/news.php +++ b/module/news/news.php @@ -194,21 +194,21 @@ class news extends common { // News en fonction de la pagination for($i = $pagination['first']; $i < $pagination['last']; $i++) { // Met en forme le tableau - $dateOn = mb_detect_encoding(PHP81_BC\strftime('%d %B %Y', $this->getData(['module', $this->getUrl(0),'posts', $newsIds[$i], 'publishedOn'])), 'UTF-8', true) - ? PHP81_BC\strftime('%d %B %Y', $this->getData(['module', $this->getUrl(0),'posts', $newsIds[$i], 'publishedOn'])) - : utf8_encode(PHP81_BC\strftime('%d %B %Y', $this->getData(['module', $this->getUrl(0),'posts', $newsIds[$i], 'publishedOn']))); + $dateOn = mb_detect_encoding(\PHP81_BC\strftime('%d %B %Y', $this->getData(['module', $this->getUrl(0),'posts', $newsIds[$i], 'publishedOn'])), 'UTF-8', true) + ? \PHP81_BC\strftime('%d %B %Y', $this->getData(['module', $this->getUrl(0),'posts', $newsIds[$i], 'publishedOn'])) + : utf8_encode(\PHP81_BC\strftime('%d %B %Y', $this->getData(['module', $this->getUrl(0),'posts', $newsIds[$i], 'publishedOn']))); $dateOn .= ' à '; - $dateOn .= mb_detect_encoding(PHP81_BC\strftime('%H:%M', $this->getData(['module', $this->getUrl(0),'posts', $newsIds[$i], 'publishedOn'])), 'UTF-8', true) - ? PHP81_BC\strftime('%H:%M', $this->getData(['module', $this->getUrl(0),'posts', $newsIds[$i], 'publishedOn'])) - : utf8_encode(PHP81_BC\strftime('%H:%M', $this->getData(['module', $this->getUrl(0),'posts', $newsIds[$i], 'publishedOn']))); + $dateOn .= mb_detect_encoding(\PHP81_BC\strftime('%H:%M', $this->getData(['module', $this->getUrl(0),'posts', $newsIds[$i], 'publishedOn'])), 'UTF-8', true) + ? \PHP81_BC\strftime('%H:%M', $this->getData(['module', $this->getUrl(0),'posts', $newsIds[$i], 'publishedOn'])) + : utf8_encode(\PHP81_BC\strftime('%H:%M', $this->getData(['module', $this->getUrl(0),'posts', $newsIds[$i], 'publishedOn']))); if ($this->getData(['module', $this->getUrl(0),'posts', $newsIds[$i], 'publishedOff'])) { - $dateOff = mb_detect_encoding(PHP81_BC\strftime('%d %B %Y', $this->getData(['module', $this->getUrl(0),'posts', $newsIds[$i], 'publishedOff'])), 'UTF-8', true) - ? PHP81_BC\strftime('%d %B %Y', $this->getData(['module', $this->getUrl(0),'posts', $newsIds[$i], 'publishedOff'])) - : utf8_encode(PHP81_BC\strftime('%d %B %Y', $this->getData(['module', $this->getUrl(0),'posts', $newsIds[$i], 'publishedOff']))); + $dateOff = mb_detect_encoding(\PHP81_BC\strftime('%d %B %Y', $this->getData(['module', $this->getUrl(0),'posts', $newsIds[$i], 'publishedOff'])), 'UTF-8', true) + ? \PHP81_BC\strftime('%d %B %Y', $this->getData(['module', $this->getUrl(0),'posts', $newsIds[$i], 'publishedOff'])) + : utf8_encode(\PHP81_BC\strftime('%d %B %Y', $this->getData(['module', $this->getUrl(0),'posts', $newsIds[$i], 'publishedOff']))); $dateOff .= ' à '; - $dateOff .= mb_detect_encoding(PHP81_BC\strftime('%H:%M', $this->getData(['module', $this->getUrl(0),'posts', $newsIds[$i], 'publishedOff'])), 'UTF-8', true) - ? PHP81_BC\strftime('%H:%M', $this->getData(['module', $this->getUrl(0),'posts', $newsIds[$i], 'publishedOff'])) - : utf8_encode(PHP81_BC\strftime('%H:%M', $this->getData(['module', $this->getUrl(0),'posts', $newsIds[$i], 'publishedOff']))); + $dateOff .= mb_detect_encoding(\PHP81_BC\strftime('%H:%M', $this->getData(['module', $this->getUrl(0),'posts', $newsIds[$i], 'publishedOff'])), 'UTF-8', true) + ? \PHP81_BC\strftime('%H:%M', $this->getData(['module', $this->getUrl(0),'posts', $newsIds[$i], 'publishedOff'])) + : utf8_encode(\PHP81_BC\strftime('%H:%M', $this->getData(['module', $this->getUrl(0),'posts', $newsIds[$i], 'publishedOff']))); } else { $dateOff = 'Permanent'; } @@ -294,21 +294,21 @@ class news extends common { // News en fonction de la pagination for($i = $pagination['first']; $i < $pagination['last']; $i++) { // Met en forme le tableau - $dateOn = mb_detect_encoding(PHP81_BC\strftime('%d %B %Y', $this->getData(['module', $this->getUrl(0),'posts', $newsIds[$i], 'publishedOn'])), 'UTF-8', true) - ? PHP81_BC\strftime('%d %B %Y', $this->getData(['module', $this->getUrl(0),'posts', $newsIds[$i], 'publishedOn'])) - : utf8_encode(PHP81_BC\strftime('%d %B %Y', $this->getData(['module', $this->getUrl(0),'posts', $newsIds[$i], 'publishedOn']))); + $dateOn = mb_detect_encoding(\PHP81_BC\strftime('%d %B %Y', $this->getData(['module', $this->getUrl(0),'posts', $newsIds[$i], 'publishedOn'])), 'UTF-8', true) + ? \PHP81_BC\strftime('%d %B %Y', $this->getData(['module', $this->getUrl(0),'posts', $newsIds[$i], 'publishedOn'])) + : utf8_encode(\PHP81_BC\strftime('%d %B %Y', $this->getData(['module', $this->getUrl(0),'posts', $newsIds[$i], 'publishedOn']))); $dateOn .= ' à '; - $dateOn .= mb_detect_encoding(PHP81_BC\strftime('%H:%M', $this->getData(['module', $this->getUrl(0),'posts', $newsIds[$i], 'publishedOn'])), 'UTF-8', true) - ? PHP81_BC\strftime('%H:%M', $this->getData(['module', $this->getUrl(0),'posts', $newsIds[$i], 'publishedOn'])) - : utf8_encode(PHP81_BC\strftime('%H:%M', $this->getData(['module', $this->getUrl(0),'posts', $newsIds[$i], 'publishedOn']))); + $dateOn .= mb_detect_encoding(\PHP81_BC\strftime('%H:%M', $this->getData(['module', $this->getUrl(0),'posts', $newsIds[$i], 'publishedOn'])), 'UTF-8', true) + ? \PHP81_BC\strftime('%H:%M', $this->getData(['module', $this->getUrl(0),'posts', $newsIds[$i], 'publishedOn'])) + : utf8_encode(\PHP81_BC\strftime('%H:%M', $this->getData(['module', $this->getUrl(0),'posts', $newsIds[$i], 'publishedOn']))); if ($this->getData(['module', $this->getUrl(0),'posts', $newsIds[$i], 'publishedOff'])) { - $dateOff = mb_detect_encoding(PHP81_BC\strftime('%d %B %Y', $this->getData(['module', $this->getUrl(0),'posts', $newsIds[$i], 'publishedOff'])), 'UTF-8', true) - ? PHP81_BC\strftime('%d %B %Y', $this->getData(['module', $this->getUrl(0),'posts', $newsIds[$i], 'publishedOff'])) - : utf8_encode(PHP81_BC\strftime('%d %B %Y', $this->getData(['module', $this->getUrl(0),'posts', $newsIds[$i], 'publishedOff']))); + $dateOff = mb_detect_encoding(\PHP81_BC\strftime('%d %B %Y', $this->getData(['module', $this->getUrl(0),'posts', $newsIds[$i], 'publishedOff'])), 'UTF-8', true) + ? \PHP81_BC\strftime('%d %B %Y', $this->getData(['module', $this->getUrl(0),'posts', $newsIds[$i], 'publishedOff'])) + : utf8_encode(\PHP81_BC\strftime('%d %B %Y', $this->getData(['module', $this->getUrl(0),'posts', $newsIds[$i], 'publishedOff']))); $dateOff .= ' à '; - $dateOff .= mb_detect_encoding(PHP81_BC\strftime('%H:%M', $this->getData(['module', $this->getUrl(0),'posts', $newsIds[$i], 'publishedOff'])), 'UTF-8', true) - ? PHP81_BC\strftime('%H:%M', $this->getData(['module', $this->getUrl(0),'posts', $newsIds[$i], 'publishedOff'])) - : utf8_encode(PHP81_BC\strftime('%H:%M', $this->getData(['module', $this->getUrl(0),'posts', $newsIds[$i], 'publishedOff']))); + $dateOff .= mb_detect_encoding(\PHP81_BC\strftime('%H:%M', $this->getData(['module', $this->getUrl(0),'posts', $newsIds[$i], 'publishedOff'])), 'UTF-8', true) + ? \PHP81_BC\strftime('%H:%M', $this->getData(['module', $this->getUrl(0),'posts', $newsIds[$i], 'publishedOff'])) + : utf8_encode(\PHP81_BC\strftime('%H:%M', $this->getData(['module', $this->getUrl(0),'posts', $newsIds[$i], 'publishedOff']))); } else { $dateOff = 'Permanent'; } diff --git a/module/news/view/article/article.php b/module/news/view/article/article.php index 0858448a..c68fe8ff 100644 --- a/module/news/view/article/article.php +++ b/module/news/view/article/article.php @@ -8,12 +8,12 @@ - getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'publishedOn'])), 'UTF-8', true) - ? PHP81_BC\strftime('%d %B %Y', $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'publishedOn'])) - : utf8_encode(PHP81_BC\strftime('%d %B %Y', $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'publishedOn']))); - $heure = mb_detect_encoding(PHP81_BC\strftime('%H:%M', $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'publishedOn'])), 'UTF-8', true) - ? PHP81_BC\strftime('%H:%M', $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'publishedOn'])) - : utf8_encode(PHP81_BC\strftime('%H:%M', $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'publishedOn']))); + getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'publishedOn'])), 'UTF-8', true) + ? \PHP81_BC\strftime('%d %B %Y', $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'publishedOn'])) + : utf8_encode(\PHP81_BC\strftime('%d %B %Y', $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'publishedOn']))); + $heure = mb_detect_encoding(\PHP81_BC\strftime('%H:%M', $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'publishedOn'])), 'UTF-8', true) + ? \PHP81_BC\strftime('%H:%M', $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'publishedOn'])) + : utf8_encode(\PHP81_BC\strftime('%H:%M', $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'publishedOn']))); echo $date . ' à ' . $heure; ?> diff --git a/module/news/view/index/index.php b/module/news/view/index/index.php index ca58aa51..58b019bc 100644 --- a/module/news/view/index/index.php +++ b/module/news/view/index/index.php @@ -15,9 +15,9 @@
- + -