From 317d2fc9349786c9c0435a3f5e28cbefceb3d81f Mon Sep 17 00:00:00 2001 From: Fred Tempez Date: Tue, 4 Oct 2022 10:13:57 +0200 Subject: [PATCH] =?UTF-8?q?Calsse=20strftime=20cause=20d=C3=A9pr=C3=A9ciat?= =?UTF-8?q?ion?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGES.md | 3 +- core/class/autoload.php | 5 +- .../class/strftime/php-8.1-strftime.class.php | 217 +++++++ 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 +- .../codemirror/codemirror/mode/php/php.js | 2 +- module/blog/blog.php | 30 +- module/blog/view/article/article.php | 18 +- module/blog/view/index/index.php | 18 +- module/forum/forum.php | 30 +- module/forum/view/article/article.php | 18 +- module/forum/view/index/index.php | 18 +- module/news/news.php | 48 +- module/news/view/article/article.php | 12 +- module/news/view/index/index.php | 6 +- 18 files changed, 931 insertions(+), 118 deletions(-) create mode 100644 core/class/strftime/php-8.1-strftime.class.php create mode 100644 core/module/addon/addon.php diff --git a/CHANGES.md b/CHANGES.md index f2f81a4c..11915c53 100755 --- a/CHANGES.md +++ b/CHANGES.md @@ -24,7 +24,8 @@ ## Version 11.5.08 ### Corrections : -- Bugs divers et dépréciation PHP 8.1 +- Bugs divers et dépréciations PHP 8.1 +- Ajout d'une classe spécifique PHP81_BC\strftime suite à sa dépréciation. ## Version 11.5.07 ### Correction : diff --git a/core/class/autoload.php b/core/class/autoload.php index ac507c05..12f275ae 100644 --- a/core/class/autoload.php +++ b/core/class/autoload.php @@ -10,7 +10,8 @@ class autoload { require_once 'core/class/phpmailer/PHPMailer.class.php'; require_once 'core/class/phpmailer/Exception.class.php'; require_once 'core/class/phpmailer/SMTP.class.php'; - require_once "core/class/jsondb/Dot.class.php"; - require_once "core/class/jsondb/JsonDb.class.php"; + require_once 'core/class/jsondb/Dot.class.php'; + require_once 'core/class/jsondb/JsonDb.class.php'; + require_once 'core/class/strftime/php-8.1-strftime.class.php'; } } \ No newline at end of file diff --git a/core/class/strftime/php-8.1-strftime.class.php b/core/class/strftime/php-8.1-strftime.class.php new file mode 100644 index 00000000..184eaded --- /dev/null +++ b/core/class/strftime/php-8.1-strftime.class.php @@ -0,0 +1,217 @@ + + */ + function strftime (string $format, $timestamp = null, ?string $locale = null) : string { + if (!($timestamp instanceof DateTimeInterface)) { + $timestamp = is_int($timestamp) ? '@' . $timestamp : (string) $timestamp; + + try { + $timestamp = new DateTime($timestamp); + } catch (Exception $e) { + throw new InvalidArgumentException('$timestamp argument is neither a valid UNIX timestamp, a valid date-time string or a DateTime object.', 0, $e); + } + } + + $timestamp->setTimezone(new DateTimeZone(date_default_timezone_get())); + + if (empty($locale)) { + // get current locale + $locale = setlocale(LC_TIME, '0'); + } + // remove trailing part not supported by ext-intl locale + $locale = preg_replace('/[^\w-].*$/', '', $locale); + + $intl_formats = [ + '%a' => 'EEE', // An abbreviated textual representation of the day Sun through Sat + '%A' => 'EEEE', // A full textual representation of the day Sunday through Saturday + '%b' => 'MMM', // Abbreviated month name, based on the locale Jan through Dec + '%B' => 'MMMM', // Full month name, based on the locale January through December + '%h' => 'MMM', // Abbreviated month name, based on the locale (an alias of %b) Jan through Dec + ]; + + $intl_formatter = function (DateTimeInterface $timestamp, string $format) use ($intl_formats, $locale) { + $tz = $timestamp->getTimezone(); + $date_type = IntlDateFormatter::FULL; + $time_type = IntlDateFormatter::FULL; + $pattern = ''; + + switch ($format) { + // %c = Preferred date and time stamp based on locale + // Example: Tue Feb 5 00:45:10 2009 for February 5, 2009 at 12:45:10 AM + case '%c': + $date_type = IntlDateFormatter::LONG; + $time_type = IntlDateFormatter::SHORT; + break; + + // %x = Preferred date representation based on locale, without the time + // Example: 02/05/09 for February 5, 2009 + case '%x': + $date_type = IntlDateFormatter::SHORT; + $time_type = IntlDateFormatter::NONE; + break; + + // Localized time format + case '%X': + $date_type = IntlDateFormatter::NONE; + $time_type = IntlDateFormatter::MEDIUM; + break; + + default: + $pattern = $intl_formats[$format]; + } + + // In October 1582, the Gregorian calendar replaced the Julian in much of Europe, and + // the 4th October was followed by the 15th October. + // ICU (including IntlDateFormattter) interprets and formats dates based on this cutover. + // Posix (including PHP81_BC\PHP81_BC\strftime) and timelib (including DateTimeImmutable) instead use + // a "proleptic Gregorian calendar" - they pretend the Gregorian calendar has existed forever. + // This leads to the same instants in time, as expressed in Unix time, having different representations + // in formatted strings. + // To adjust for this, a custom calendar can be supplied with a cutover date arbitrarily far in the past. + $calendar = IntlGregorianCalendar::createInstance(); + $calendar->setGregorianChange(PHP_INT_MIN); + + return (new IntlDateFormatter($locale, $date_type, $time_type, $tz, $calendar, $pattern))->format($timestamp); + }; + + // Same order as https://www.php.net/manual/en/function.PHP81_BC\PHP81_BC\strftime.php + $translation_table = [ + // Day + '%a' => $intl_formatter, + '%A' => $intl_formatter, + '%d' => 'd', + '%e' => function ($timestamp) { + return sprintf('% 2u', $timestamp->format('j')); + }, + '%j' => function ($timestamp) { + // Day number in year, 001 to 366 + return sprintf('%03d', $timestamp->format('z')+1); + }, + '%u' => 'N', + '%w' => 'w', + + // Week + '%U' => function ($timestamp) { + // Number of weeks between date and first Sunday of year + $day = new DateTime(sprintf('%d-01 Sunday', $timestamp->format('Y'))); + return sprintf('%02u', 1 + ($timestamp->format('z') - $day->format('z')) / 7); + }, + '%V' => 'W', + '%W' => function ($timestamp) { + // Number of weeks between date and first Monday of year + $day = new DateTime(sprintf('%d-01 Monday', $timestamp->format('Y'))); + return sprintf('%02u', 1 + ($timestamp->format('z') - $day->format('z')) / 7); + }, + + // Month + '%b' => $intl_formatter, + '%B' => $intl_formatter, + '%h' => $intl_formatter, + '%m' => 'm', + + // Year + '%C' => function ($timestamp) { + // Century (-1): 19 for 20th century + return floor($timestamp->format('Y') / 100); + }, + '%g' => function ($timestamp) { + return substr($timestamp->format('o'), -2); + }, + '%G' => 'o', + '%y' => 'y', + '%Y' => 'Y', + + // Time + '%H' => 'H', + '%k' => function ($timestamp) { + return sprintf('% 2u', $timestamp->format('G')); + }, + '%I' => 'h', + '%l' => function ($timestamp) { + return sprintf('% 2u', $timestamp->format('g')); + }, + '%M' => 'i', + '%p' => 'A', // AM PM (this is reversed on purpose!) + '%P' => 'a', // am pm + '%r' => 'h:i:s A', // %I:%M:%S %p + '%R' => 'H:i', // %H:%M + '%S' => 's', + '%T' => 'H:i:s', // %H:%M:%S + '%X' => $intl_formatter, // Preferred time representation based on locale, without the date + + // Timezone + '%z' => 'O', + '%Z' => 'T', + + // Time and Date Stamps + '%c' => $intl_formatter, + '%D' => 'm/d/Y', + '%F' => 'Y-m-d', + '%s' => 'U', + '%x' => $intl_formatter, + ]; + + $out = preg_replace_callback('/(?format($replace); + } else { + $result = $replace($timestamp, $pattern); + } + + switch ($prefix) { + case '_': + // replace leading zeros with spaces but keep last char if also zero + return preg_replace('/\G0(?=.)/', ' ', $result); + case '#': + case '-': + // remove leading zeros but keep last char if also zero + return preg_replace('/^0+(?=.)/', '', $result); + } + + return $result; + }, $format); + + $out = str_replace('%%', '%', $out); + return $out; + } diff --git a/core/core.php b/core/core.php index b0f4c300..18030d31 100644 --- a/core/core.php +++ b/core/core.php @@ -2766,9 +2766,9 @@ class core extends common exit(); } // Journalisation - $dataLog = mb_detect_encoding(strftime('%d/%m/%y', time()), 'UTF-8', true) - ? strftime('%d/%m/%y', time()) . ';' . strftime('%R', time()) . ';' - : utf8_encode(strftime('%d/%m/%y', time())) . ';' . utf8_encode(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 new file mode 100644 index 00000000..de5db8a5 --- /dev/null +++ b/core/module/addon/addon.php @@ -0,0 +1,594 @@ + + * @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 c6a7926d..b1556768 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(strftime('%d/%m/%y', $item['lastFail']), 'UTF-8', true) - ? strftime('%d/%m/%y', $item['lastFail']) . ';' . utf8_encode(strftime('%R', $item['lastFail'])) . ';' - : utf8_encode(strftime('%d/%m/%y', $item['lastFail'])) . ';' . utf8_encode(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 b4606294..06e9964e 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(strftime('%d %B %Y', $store[$key]['versionDate']), 'UTF-8', true) - ? strftime('%d %B %Y', $store[$key]['versionDate']) - : utf8_encode(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(strftime('%d %B %Y', self::$storeItem['fileDate']), 'UTF-8', true) - ? strftime('%d %B %Y', self::$storeItem['fileDate']) - : utf8_encode(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 f07a9e4d..e9f31e0b 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(strftime('%d/%m/%y', time()), 'UTF-8', true) - ? strftime('%d/%m/%y', time()) . ';' . strftime('%R', time()) . ';' - : utf8_encode(strftime('%d/%m/%y', time())) . ';' . utf8_encode(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/core/vendor/tinymce/plugins/codemirror/codemirror/mode/php/php.js b/core/vendor/tinymce/plugins/codemirror/codemirror/mode/php/php.js index 5f3a1439..cd41f7f3 100644 --- a/core/vendor/tinymce/plugins/codemirror/codemirror/mode/php/php.js +++ b/core/vendor/tinymce/plugins/codemirror/codemirror/mode/php/php.js @@ -86,7 +86,7 @@ "die echo empty exit eval include include_once isset list require require_once return " + "print unset __halt_compiler self static parent yield insteadof finally"; var phpAtoms = "true false null TRUE FALSE NULL __CLASS__ __DIR__ __FILE__ __LINE__ __METHOD__ __FUNCTION__ __NAMESPACE__ __TRAIT__"; - var phpBuiltin = "func_num_args func_get_arg func_get_args strlen strcmp strncmp strcasecmp strncasecmp each error_reporting define defined trigger_error user_error set_error_handler restore_error_handler get_declared_classes get_loaded_extensions extension_loaded get_extension_funcs debug_backtrace constant bin2hex hex2bin sleep usleep time mktime gmmktime strftime gmstrftime strtotime date gmdate getdate localtime checkdate flush wordwrap htmlspecialchars htmlentities html_entity_decode md5 md5_file crc32 getimagesize image_type_to_mime_type phpinfo phpversion phpcredits strnatcmp strnatcasecmp substr_count strspn strcspn strtok strtoupper strtolower strpos strrpos strrev hebrev hebrevc nl2br basename dirname pathinfo stripslashes stripcslashes strstr stristr strrchr str_shuffle str_word_count strcoll substr substr_replace quotemeta ucfirst ucwords strtr addslashes addcslashes rtrim str_replace str_repeat count_chars chunk_split trim ltrim strip_tags similar_text explode implode setlocale localeconv parse_str str_pad chop strchr sprintf printf vprintf vsprintf sscanf fscanf parse_url urlencode urldecode rawurlencode rawurldecode readlink linkinfo link unlink exec system escapeshellcmd escapeshellarg passthru shell_exec proc_open proc_close rand srand getrandmax mt_rand mt_srand mt_getrandmax base64_decode base64_encode abs ceil floor round is_finite is_nan is_infinite bindec hexdec octdec decbin decoct dechex base_convert number_format fmod ip2long long2ip getenv putenv getopt microtime gettimeofday getrusage uniqid quoted_printable_decode set_time_limit get_cfg_var magic_quotes_runtime set_magic_quotes_runtime get_magic_quotes_gpc get_magic_quotes_runtime import_request_variables error_log serialize unserialize memory_get_usage var_dump var_export debug_zval_dump print_r highlight_file show_source highlight_string ini_get ini_get_all ini_set ini_alter ini_restore get_include_path set_include_path restore_include_path setcookie header headers_sent connection_aborted connection_status ignore_user_abort parse_ini_file is_uploaded_file move_uploaded_file intval floatval doubleval strval gettype settype is_null is_resource is_bool is_long is_float is_int is_integer is_double is_real is_numeric is_string is_array is_object is_scalar ereg ereg_replace eregi eregi_replace split spliti join sql_regcase dl pclose popen readfile rewind rmdir umask fclose feof fgetc fgets fgetss fread fopen fpassthru ftruncate fstat fseek ftell fflush fwrite fputs mkdir rename copy tempnam tmpfile file file_get_contents file_put_contents stream_select stream_context_create stream_context_set_params stream_context_set_option stream_context_get_options stream_filter_prepend stream_filter_append fgetcsv flock get_meta_tags stream_set_write_buffer set_file_buffer set_socket_blocking stream_set_blocking socket_set_blocking stream_get_meta_data stream_register_wrapper stream_wrapper_register stream_set_timeout socket_set_timeout socket_get_status realpath fnmatch fsockopen pfsockopen pack unpack get_browser crypt opendir closedir chdir getcwd rewinddir readdir dir glob fileatime filectime filegroup fileinode filemtime fileowner fileperms filesize filetype file_exists is_writable is_writeable is_readable is_executable is_file is_dir is_link stat lstat chown touch clearstatcache mail ob_start ob_flush ob_clean ob_end_flush ob_end_clean ob_get_flush ob_get_clean ob_get_length ob_get_level ob_get_status ob_get_contents ob_implicit_flush ob_list_handlers ksort krsort natsort natcasesort asort arsort sort rsort usort uasort uksort shuffle array_walk count end prev next reset current key min max in_array array_search extract compact array_fill range array_multisort array_push array_pop array_shift array_unshift array_splice array_slice array_merge array_merge_recursive array_keys array_values array_count_values array_reverse array_reduce array_pad array_flip array_change_key_case array_rand array_unique array_intersect array_intersect_assoc array_diff array_diff_assoc array_sum array_filter array_map array_chunk array_key_exists array_intersect_key array_combine array_column pos sizeof key_exists assert assert_options version_compare ftok str_rot13 aggregate session_name session_module_name session_save_path session_id session_regenerate_id session_decode session_register session_unregister session_is_registered session_encode session_start session_destroy session_unset session_set_save_handler session_cache_limiter session_cache_expire session_set_cookie_params session_get_cookie_params session_write_close preg_match preg_match_all preg_replace preg_replace_callback preg_split preg_quote preg_grep overload ctype_alnum ctype_alpha ctype_cntrl ctype_digit ctype_lower ctype_graph ctype_print ctype_punct ctype_space ctype_upper ctype_xdigit virtual apache_request_headers apache_note apache_lookup_uri apache_child_terminate apache_setenv apache_response_headers apache_get_version getallheaders mysql_connect mysql_pconnect mysql_close mysql_select_db mysql_create_db mysql_drop_db mysql_query mysql_unbuffered_query mysql_db_query mysql_list_dbs mysql_list_tables mysql_list_fields mysql_list_processes mysql_error mysql_errno mysql_affected_rows mysql_insert_id mysql_result mysql_num_rows mysql_num_fields mysql_fetch_row mysql_fetch_array mysql_fetch_assoc mysql_fetch_object mysql_data_seek mysql_fetch_lengths mysql_fetch_field mysql_field_seek mysql_free_result mysql_field_name mysql_field_table mysql_field_len mysql_field_type mysql_field_flags mysql_escape_string mysql_real_escape_string mysql_stat mysql_thread_id mysql_client_encoding mysql_get_client_info mysql_get_host_info mysql_get_proto_info mysql_get_server_info mysql_info mysql mysql_fieldname mysql_fieldtable mysql_fieldlen mysql_fieldtype mysql_fieldflags mysql_selectdb mysql_createdb mysql_dropdb mysql_freeresult mysql_numfields mysql_numrows mysql_listdbs mysql_listtables mysql_listfields mysql_db_name mysql_dbname mysql_tablename mysql_table_name pg_connect pg_pconnect pg_close pg_connection_status pg_connection_busy pg_connection_reset pg_host pg_dbname pg_port pg_tty pg_options pg_ping pg_query pg_send_query pg_cancel_query pg_fetch_result pg_fetch_row pg_fetch_assoc pg_fetch_array pg_fetch_object pg_fetch_all pg_affected_rows pg_get_result pg_result_seek pg_result_status pg_free_result pg_last_oid pg_num_rows pg_num_fields pg_field_name pg_field_num pg_field_size pg_field_type pg_field_prtlen pg_field_is_null pg_get_notify pg_get_pid pg_result_error pg_last_error pg_last_notice pg_put_line pg_end_copy pg_copy_to pg_copy_from pg_trace pg_untrace pg_lo_create pg_lo_unlink pg_lo_open pg_lo_close pg_lo_read pg_lo_write pg_lo_read_all pg_lo_import pg_lo_export pg_lo_seek pg_lo_tell pg_escape_string pg_escape_bytea pg_unescape_bytea pg_client_encoding pg_set_client_encoding pg_meta_data pg_convert pg_insert pg_update pg_delete pg_select pg_exec pg_getlastoid pg_cmdtuples pg_errormessage pg_numrows pg_numfields pg_fieldname pg_fieldsize pg_fieldtype pg_fieldnum pg_fieldprtlen pg_fieldisnull pg_freeresult pg_result pg_loreadall pg_locreate pg_lounlink pg_loopen pg_loclose pg_loread pg_lowrite pg_loimport pg_loexport http_response_code get_declared_traits getimagesizefromstring socket_import_stream stream_set_chunk_size trait_exists header_register_callback class_uses session_status session_register_shutdown echo print global static exit array empty eval isset unset die include require include_once require_once json_decode json_encode json_last_error json_last_error_msg curl_close curl_copy_handle curl_errno curl_error curl_escape curl_exec curl_file_create curl_getinfo curl_init curl_multi_add_handle curl_multi_close curl_multi_exec curl_multi_getcontent curl_multi_info_read curl_multi_init curl_multi_remove_handle curl_multi_select curl_multi_setopt curl_multi_strerror curl_pause curl_reset curl_setopt_array curl_setopt curl_share_close curl_share_init curl_share_setopt curl_strerror curl_unescape curl_version mysqli_affected_rows mysqli_autocommit mysqli_change_user mysqli_character_set_name mysqli_close mysqli_commit mysqli_connect_errno mysqli_connect_error mysqli_connect mysqli_data_seek mysqli_debug mysqli_dump_debug_info mysqli_errno mysqli_error_list mysqli_error mysqli_fetch_all mysqli_fetch_array mysqli_fetch_assoc mysqli_fetch_field_direct mysqli_fetch_field mysqli_fetch_fields mysqli_fetch_lengths mysqli_fetch_object mysqli_fetch_row mysqli_field_count mysqli_field_seek mysqli_field_tell mysqli_free_result mysqli_get_charset mysqli_get_client_info mysqli_get_client_stats mysqli_get_client_version mysqli_get_connection_stats mysqli_get_host_info mysqli_get_proto_info mysqli_get_server_info mysqli_get_server_version mysqli_info mysqli_init mysqli_insert_id mysqli_kill mysqli_more_results mysqli_multi_query mysqli_next_result mysqli_num_fields mysqli_num_rows mysqli_options mysqli_ping mysqli_prepare mysqli_query mysqli_real_connect mysqli_real_escape_string mysqli_real_query mysqli_reap_async_query mysqli_refresh mysqli_rollback mysqli_select_db mysqli_set_charset mysqli_set_local_infile_default mysqli_set_local_infile_handler mysqli_sqlstate mysqli_ssl_set mysqli_stat mysqli_stmt_init mysqli_store_result mysqli_thread_id mysqli_thread_safe mysqli_use_result mysqli_warning_count"; + var phpBuiltin = "func_num_args func_get_arg func_get_args strlen strcmp strncmp strcasecmp strncasecmp each error_reporting define defined trigger_error user_error set_error_handler restore_error_handler get_declared_classes get_loaded_extensions extension_loaded get_extension_funcs debug_backtrace constant bin2hex hex2bin sleep usleep time mktime gmmktime PHP81_BC\strftime gmPHP81_BC\strftime strtotime date gmdate getdate localtime checkdate flush wordwrap htmlspecialchars htmlentities html_entity_decode md5 md5_file crc32 getimagesize image_type_to_mime_type phpinfo phpversion phpcredits strnatcmp strnatcasecmp substr_count strspn strcspn strtok strtoupper strtolower strpos strrpos strrev hebrev hebrevc nl2br basename dirname pathinfo stripslashes stripcslashes strstr stristr strrchr str_shuffle str_word_count strcoll substr substr_replace quotemeta ucfirst ucwords strtr addslashes addcslashes rtrim str_replace str_repeat count_chars chunk_split trim ltrim strip_tags similar_text explode implode setlocale localeconv parse_str str_pad chop strchr sprintf printf vprintf vsprintf sscanf fscanf parse_url urlencode urldecode rawurlencode rawurldecode readlink linkinfo link unlink exec system escapeshellcmd escapeshellarg passthru shell_exec proc_open proc_close rand srand getrandmax mt_rand mt_srand mt_getrandmax base64_decode base64_encode abs ceil floor round is_finite is_nan is_infinite bindec hexdec octdec decbin decoct dechex base_convert number_format fmod ip2long long2ip getenv putenv getopt microtime gettimeofday getrusage uniqid quoted_printable_decode set_time_limit get_cfg_var magic_quotes_runtime set_magic_quotes_runtime get_magic_quotes_gpc get_magic_quotes_runtime import_request_variables error_log serialize unserialize memory_get_usage var_dump var_export debug_zval_dump print_r highlight_file show_source highlight_string ini_get ini_get_all ini_set ini_alter ini_restore get_include_path set_include_path restore_include_path setcookie header headers_sent connection_aborted connection_status ignore_user_abort parse_ini_file is_uploaded_file move_uploaded_file intval floatval doubleval strval gettype settype is_null is_resource is_bool is_long is_float is_int is_integer is_double is_real is_numeric is_string is_array is_object is_scalar ereg ereg_replace eregi eregi_replace split spliti join sql_regcase dl pclose popen readfile rewind rmdir umask fclose feof fgetc fgets fgetss fread fopen fpassthru ftruncate fstat fseek ftell fflush fwrite fputs mkdir rename copy tempnam tmpfile file file_get_contents file_put_contents stream_select stream_context_create stream_context_set_params stream_context_set_option stream_context_get_options stream_filter_prepend stream_filter_append fgetcsv flock get_meta_tags stream_set_write_buffer set_file_buffer set_socket_blocking stream_set_blocking socket_set_blocking stream_get_meta_data stream_register_wrapper stream_wrapper_register stream_set_timeout socket_set_timeout socket_get_status realpath fnmatch fsockopen pfsockopen pack unpack get_browser crypt opendir closedir chdir getcwd rewinddir readdir dir glob fileatime filectime filegroup fileinode filemtime fileowner fileperms filesize filetype file_exists is_writable is_writeable is_readable is_executable is_file is_dir is_link stat lstat chown touch clearstatcache mail ob_start ob_flush ob_clean ob_end_flush ob_end_clean ob_get_flush ob_get_clean ob_get_length ob_get_level ob_get_status ob_get_contents ob_implicit_flush ob_list_handlers ksort krsort natsort natcasesort asort arsort sort rsort usort uasort uksort shuffle array_walk count end prev next reset current key min max in_array array_search extract compact array_fill range array_multisort array_push array_pop array_shift array_unshift array_splice array_slice array_merge array_merge_recursive array_keys array_values array_count_values array_reverse array_reduce array_pad array_flip array_change_key_case array_rand array_unique array_intersect array_intersect_assoc array_diff array_diff_assoc array_sum array_filter array_map array_chunk array_key_exists array_intersect_key array_combine array_column pos sizeof key_exists assert assert_options version_compare ftok str_rot13 aggregate session_name session_module_name session_save_path session_id session_regenerate_id session_decode session_register session_unregister session_is_registered session_encode session_start session_destroy session_unset session_set_save_handler session_cache_limiter session_cache_expire session_set_cookie_params session_get_cookie_params session_write_close preg_match preg_match_all preg_replace preg_replace_callback preg_split preg_quote preg_grep overload ctype_alnum ctype_alpha ctype_cntrl ctype_digit ctype_lower ctype_graph ctype_print ctype_punct ctype_space ctype_upper ctype_xdigit virtual apache_request_headers apache_note apache_lookup_uri apache_child_terminate apache_setenv apache_response_headers apache_get_version getallheaders mysql_connect mysql_pconnect mysql_close mysql_select_db mysql_create_db mysql_drop_db mysql_query mysql_unbuffered_query mysql_db_query mysql_list_dbs mysql_list_tables mysql_list_fields mysql_list_processes mysql_error mysql_errno mysql_affected_rows mysql_insert_id mysql_result mysql_num_rows mysql_num_fields mysql_fetch_row mysql_fetch_array mysql_fetch_assoc mysql_fetch_object mysql_data_seek mysql_fetch_lengths mysql_fetch_field mysql_field_seek mysql_free_result mysql_field_name mysql_field_table mysql_field_len mysql_field_type mysql_field_flags mysql_escape_string mysql_real_escape_string mysql_stat mysql_thread_id mysql_client_encoding mysql_get_client_info mysql_get_host_info mysql_get_proto_info mysql_get_server_info mysql_info mysql mysql_fieldname mysql_fieldtable mysql_fieldlen mysql_fieldtype mysql_fieldflags mysql_selectdb mysql_createdb mysql_dropdb mysql_freeresult mysql_numfields mysql_numrows mysql_listdbs mysql_listtables mysql_listfields mysql_db_name mysql_dbname mysql_tablename mysql_table_name pg_connect pg_pconnect pg_close pg_connection_status pg_connection_busy pg_connection_reset pg_host pg_dbname pg_port pg_tty pg_options pg_ping pg_query pg_send_query pg_cancel_query pg_fetch_result pg_fetch_row pg_fetch_assoc pg_fetch_array pg_fetch_object pg_fetch_all pg_affected_rows pg_get_result pg_result_seek pg_result_status pg_free_result pg_last_oid pg_num_rows pg_num_fields pg_field_name pg_field_num pg_field_size pg_field_type pg_field_prtlen pg_field_is_null pg_get_notify pg_get_pid pg_result_error pg_last_error pg_last_notice pg_put_line pg_end_copy pg_copy_to pg_copy_from pg_trace pg_untrace pg_lo_create pg_lo_unlink pg_lo_open pg_lo_close pg_lo_read pg_lo_write pg_lo_read_all pg_lo_import pg_lo_export pg_lo_seek pg_lo_tell pg_escape_string pg_escape_bytea pg_unescape_bytea pg_client_encoding pg_set_client_encoding pg_meta_data pg_convert pg_insert pg_update pg_delete pg_select pg_exec pg_getlastoid pg_cmdtuples pg_errormessage pg_numrows pg_numfields pg_fieldname pg_fieldsize pg_fieldtype pg_fieldnum pg_fieldprtlen pg_fieldisnull pg_freeresult pg_result pg_loreadall pg_locreate pg_lounlink pg_loopen pg_loclose pg_loread pg_lowrite pg_loimport pg_loexport http_response_code get_declared_traits getimagesizefromstring socket_import_stream stream_set_chunk_size trait_exists header_register_callback class_uses session_status session_register_shutdown echo print global static exit array empty eval isset unset die include require include_once require_once json_decode json_encode json_last_error json_last_error_msg curl_close curl_copy_handle curl_errno curl_error curl_escape curl_exec curl_file_create curl_getinfo curl_init curl_multi_add_handle curl_multi_close curl_multi_exec curl_multi_getcontent curl_multi_info_read curl_multi_init curl_multi_remove_handle curl_multi_select curl_multi_setopt curl_multi_strerror curl_pause curl_reset curl_setopt_array curl_setopt curl_share_close curl_share_init curl_share_setopt curl_strerror curl_unescape curl_version mysqli_affected_rows mysqli_autocommit mysqli_change_user mysqli_character_set_name mysqli_close mysqli_commit mysqli_connect_errno mysqli_connect_error mysqli_connect mysqli_data_seek mysqli_debug mysqli_dump_debug_info mysqli_errno mysqli_error_list mysqli_error mysqli_fetch_all mysqli_fetch_array mysqli_fetch_assoc mysqli_fetch_field_direct mysqli_fetch_field mysqli_fetch_fields mysqli_fetch_lengths mysqli_fetch_object mysqli_fetch_row mysqli_field_count mysqli_field_seek mysqli_field_tell mysqli_free_result mysqli_get_charset mysqli_get_client_info mysqli_get_client_stats mysqli_get_client_version mysqli_get_connection_stats mysqli_get_host_info mysqli_get_proto_info mysqli_get_server_info mysqli_get_server_version mysqli_info mysqli_init mysqli_insert_id mysqli_kill mysqli_more_results mysqli_multi_query mysqli_next_result mysqli_num_fields mysqli_num_rows mysqli_options mysqli_ping mysqli_prepare mysqli_query mysqli_real_connect mysqli_real_escape_string mysqli_real_query mysqli_reap_async_query mysqli_refresh mysqli_rollback mysqli_select_db mysqli_set_charset mysqli_set_local_infile_default mysqli_set_local_infile_handler mysqli_sqlstate mysqli_ssl_set mysqli_stat mysqli_stmt_init mysqli_store_result mysqli_thread_id mysqli_thread_safe mysqli_use_result mysqli_warning_count"; CodeMirror.registerHelper("hintWords", "php", [phpKeywords, phpAtoms, phpBuiltin].join(" ").split(" ")); CodeMirror.registerHelper("wordChars", "php", /[\w$]/); diff --git a/module/blog/blog.php b/module/blog/blog.php index aaf1bf9f..0ec6a99f 100755 --- a/module/blog/blog.php +++ b/module/blog/blog.php @@ -307,9 +307,9 @@ class blog extends common { ]); } self::$comments[] = [ - mb_detect_encoding(strftime('%d %B %Y - %H:%M', $comment['createdOn']), 'UTF-8', true) - ? strftime('%d %B %Y - %H:%M', $comment['createdOn']) - : utf8_encode(strftime('%d %B %Y - %H:%M', $comment['createdOn'])), + 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, @@ -469,12 +469,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(strftime('%d %B %Y', $this->getData(['module', $this->getUrl(0), 'posts', $articleIds[$i], 'publishedOn'])), 'UTF-8', true) - ? strftime('%d %B %Y', $this->getData(['module', $this->getUrl(0), 'posts', $articleIds[$i], 'publishedOn'])) - : utf8_encode(strftime('%d %B %Y', $this->getData(['module', $this->getUrl(0), 'posts', $articleIds[$i], 'publishedOn']))); - $heure = mb_detect_encoding(strftime('%H:%M', $this->getData(['module', $this->getUrl(0), 'posts', $articleIds[$i], 'publishedOn'])), 'UTF-8', true) - ? strftime('%H:%M', $this->getData(['module', $this->getUrl(0), 'posts', $articleIds[$i], 'publishedOn'])) - : utf8_encode(strftime('%H:%M', $this->getData(['module', $this->getUrl(0), 'posts', $articleIds[$i], 'publishedOn']))); + $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']) . @@ -570,12 +570,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(strftime('%d %B %Y', $this->getData(['module', $this->getUrl(0), 'posts', $articleIds[$i], 'publishedOn'])), 'UTF-8', true) - ? strftime('%d %B %Y', $this->getData(['module', $this->getUrl(0), 'posts', $articleIds[$i], 'publishedOn'])) - : utf8_encode(strftime('%d %B %Y', $this->getData(['module', $this->getUrl(0), 'posts', $articleIds[$i], 'publishedOn']))); - $heure = mb_detect_encoding(strftime('%H:%M', $this->getData(['module', $this->getUrl(0), 'posts', $articleIds[$i], 'publishedOn'])), 'UTF-8', true) - ? strftime('%H:%M', $this->getData(['module', $this->getUrl(0), 'posts', $articleIds[$i], 'publishedOn'])) - : utf8_encode(strftime('%H:%M', $this->getData(['module', $this->getUrl(0), 'posts', $articleIds[$i], 'publishedOn']))); + $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 e4437f74..55fc40ba 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) - ? strftime('%d %B %Y', $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'publishedOn'])) - : utf8_encode(strftime('%d %B %Y', $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'publishedOn']))); - $heure = mb_detect_encoding(strftime('%H:%M', $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'publishedOn'])), 'UTF-8', true) - ? strftime('%H:%M', $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'publishedOn'])) - : utf8_encode(strftime('%H:%M', $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'publishedOn']))); + 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 97f4bc00..d1996ae6 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) - ? strftime('%d %B %Y', $this->getData(['module', $this->getUrl(0), 'posts', $articleId, 'publishedOn'])) - : utf8_encode(strftime('%d %B %Y', $this->getData(['module', $this->getUrl(0), 'posts', $articleId, 'publishedOn']))); - $heure = mb_detect_encoding(strftime('%H:%M', $this->getData(['module', $this->getUrl(0), 'posts', $articleId, 'publishedOn'])), 'UTF-8', true) - ? strftime('%H:%M', $this->getData(['module', $this->getUrl(0), 'posts', $articleId, 'publishedOn'])) - : utf8_encode(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 index 988a2c0f..f0426a83 100644 --- a/module/forum/forum.php +++ b/module/forum/forum.php @@ -301,9 +301,9 @@ class forum extends common { ]); } self::$comments[] = [ - mb_detect_encoding(strftime('%d %B %Y - %H:%M', $comment['createdOn']), 'UTF-8', true) - ? strftime('%d %B %Y - %H:%M', $comment['createdOn']) - : utf8_encode(strftime('%d %B %Y - %H:%M', $comment['createdOn'])), + 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, @@ -463,12 +463,12 @@ class forum extends common { $approved = count($this->getData(['module', $this->getUrl(0), 'posts', $sujetIds[$i],'comment'])); } // Met en forme le tableau - $date = mb_detect_encoding(strftime('%d %B %Y', $this->getData(['module', $this->getUrl(0), 'posts', $sujetIds[$i], 'publishedOn'])), 'UTF-8', true) - ? strftime('%d %B %Y', $this->getData(['module', $this->getUrl(0), 'posts', $sujetIds[$i], 'publishedOn'])) - : utf8_encode(strftime('%d %B %Y', $this->getData(['module', $this->getUrl(0), 'posts', $sujetIds[$i], 'publishedOn']))); - $heure = mb_detect_encoding(strftime('%H:%M', $this->getData(['module', $this->getUrl(0), 'posts', $sujetIds[$i], 'publishedOn'])), 'UTF-8', true) - ? strftime('%H:%M', $this->getData(['module', $this->getUrl(0), 'posts', $sujetIds[$i], 'publishedOn'])) - : utf8_encode(strftime('%H:%M', $this->getData(['module', $this->getUrl(0), 'posts', $sujetIds[$i], 'publishedOn']))); + $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']) . @@ -564,12 +564,12 @@ class forum extends common { $approved = count($this->getData(['module', $this->getUrl(0), 'posts', $sujetIds[$i],'comment'])); } // Met en forme le tableau - $date = mb_detect_encoding(strftime('%d %B %Y', $this->getData(['module', $this->getUrl(0), 'posts', $sujetIds[$i], 'publishedOn'])), 'UTF-8', true) - ? strftime('%d %B %Y', $this->getData(['module', $this->getUrl(0), 'posts', $sujetIds[$i], 'publishedOn'])) - : utf8_encode(strftime('%d %B %Y', $this->getData(['module', $this->getUrl(0), 'posts', $sujetIds[$i], 'publishedOn']))); - $heure = mb_detect_encoding(strftime('%H:%M', $this->getData(['module', $this->getUrl(0), 'posts', $sujetIds[$i], 'publishedOn'])), 'UTF-8', true) - ? strftime('%H:%M', $this->getData(['module', $this->getUrl(0), 'posts', $sujetIds[$i], 'publishedOn'])) - : utf8_encode(strftime('%H:%M', $this->getData(['module', $this->getUrl(0), 'posts', $sujetIds[$i], 'publishedOn']))); + $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']) . diff --git a/module/forum/view/article/article.php b/module/forum/view/article/article.php index 677ff07a..51f381e5 100644 --- a/module/forum/view/article/article.php +++ b/module/forum/view/article/article.php @@ -14,12 +14,12 @@ - getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'publishedOn'])), 'UTF-8', true) - ? strftime('%d %B %Y', $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'publishedOn'])) - : utf8_encode(strftime('%d %B %Y', $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'publishedOn']))); - $heure = mb_detect_encoding(strftime('%H:%M', $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'publishedOn'])), 'UTF-8', true) - ? strftime('%H:%M', $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'publishedOn'])) - : utf8_encode(strftime('%H:%M', $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'publishedOn']))); + 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/forum/view/index/index.php b/module/forum/view/index/index.php index 0d7cd63a..a685bf9f 100644 --- a/module/forum/view/index/index.php +++ b/module/forum/view/index/index.php @@ -31,12 +31,12 @@ signature($this->getData(['module', $this->getUrl(0), 'posts', $sujetId, 'userId']));?> - getData(['module', $this->getUrl(0), 'posts', $sujetId, 'publishedOn'])), 'UTF-8', true) - ? strftime('%d %B %Y', $this->getData(['module', $this->getUrl(0), 'posts', $sujetId, 'publishedOn'])) - : utf8_encode(strftime('%d %B %Y', $this->getData(['module', $this->getUrl(0), 'posts', $sujetId, 'publishedOn']))); - $heure = mb_detect_encoding(strftime('%H:%M', $this->getData(['module', $this->getUrl(0), 'posts', $sujetId, 'publishedOn'])), 'UTF-8', true) - ? strftime('%H:%M', $this->getData(['module', $this->getUrl(0), 'posts', $sujetId, 'publishedOn'])) - : utf8_encode(strftime('%H:%M', $this->getData(['module', $this->getUrl(0), 'posts', $sujetId, 'publishedOn']))); + 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; ?> @@ -125,9 +125,9 @@
- +

getData(['module',$this->getUrl(0), 'config', 'sujetsLenght']) !== 0 ? $this->getData(['module',$this->getUrl(0), 'config', 'sujetsLenght']) : 500 ?> diff --git a/module/news/news.php b/module/news/news.php index 5d704435..030c03e6 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(strftime('%d %B %Y', $this->getData(['module', $this->getUrl(0),'posts', $newsIds[$i], 'publishedOn'])), 'UTF-8', true) - ? strftime('%d %B %Y', $this->getData(['module', $this->getUrl(0),'posts', $newsIds[$i], 'publishedOn'])) - : utf8_encode(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(strftime('%H:%M', $this->getData(['module', $this->getUrl(0),'posts', $newsIds[$i], 'publishedOn'])), 'UTF-8', true) - ? strftime('%H:%M', $this->getData(['module', $this->getUrl(0),'posts', $newsIds[$i], 'publishedOn'])) - : utf8_encode(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(strftime('%d %B %Y', $this->getData(['module', $this->getUrl(0),'posts', $newsIds[$i], 'publishedOff'])), 'UTF-8', true) - ? strftime('%d %B %Y', $this->getData(['module', $this->getUrl(0),'posts', $newsIds[$i], 'publishedOff'])) - : utf8_encode(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(strftime('%H:%M', $this->getData(['module', $this->getUrl(0),'posts', $newsIds[$i], 'publishedOff'])), 'UTF-8', true) - ? strftime('%H:%M', $this->getData(['module', $this->getUrl(0),'posts', $newsIds[$i], 'publishedOff'])) - : utf8_encode(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(strftime('%d %B %Y', $this->getData(['module', $this->getUrl(0),'posts', $newsIds[$i], 'publishedOn'])), 'UTF-8', true) - ? strftime('%d %B %Y', $this->getData(['module', $this->getUrl(0),'posts', $newsIds[$i], 'publishedOn'])) - : utf8_encode(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(strftime('%H:%M', $this->getData(['module', $this->getUrl(0),'posts', $newsIds[$i], 'publishedOn'])), 'UTF-8', true) - ? strftime('%H:%M', $this->getData(['module', $this->getUrl(0),'posts', $newsIds[$i], 'publishedOn'])) - : utf8_encode(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(strftime('%d %B %Y', $this->getData(['module', $this->getUrl(0),'posts', $newsIds[$i], 'publishedOff'])), 'UTF-8', true) - ? strftime('%d %B %Y', $this->getData(['module', $this->getUrl(0),'posts', $newsIds[$i], 'publishedOff'])) - : utf8_encode(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(strftime('%H:%M', $this->getData(['module', $this->getUrl(0),'posts', $newsIds[$i], 'publishedOff'])), 'UTF-8', true) - ? strftime('%H:%M', $this->getData(['module', $this->getUrl(0),'posts', $newsIds[$i], 'publishedOff'])) - : utf8_encode(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 c02328d6..0858448a 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) - ? strftime('%d %B %Y', $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'publishedOn'])) - : utf8_encode(strftime('%d %B %Y', $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'publishedOn']))); - $heure = mb_detect_encoding(strftime('%H:%M', $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'publishedOn'])), 'UTF-8', true) - ? strftime('%H:%M', $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'publishedOn'])) - : utf8_encode(strftime('%H:%M', $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'publishedOn']))); + 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 44a45004..ca58aa51 100644 --- a/module/news/view/index/index.php +++ b/module/news/view/index/index.php @@ -15,9 +15,9 @@

- + -