diff --git a/core/class/autoload.php b/core/class/autoload.php index 12f275ae..6dc44a2c 100644 --- a/core/class/autoload.php +++ b/core/class/autoload.php @@ -12,6 +12,5 @@ class autoload { 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/strftime/php-8.1-strftime.class.php'; } } \ No newline at end of file diff --git a/core/class/helper.class.php b/core/class/helper.class.php index 8156bd4c..134c9583 100644 --- a/core/class/helper.class.php +++ b/core/class/helper.class.php @@ -39,6 +39,7 @@ class helper */ public static function dateUTF8($format, $date) { + require_once 'core/class/strftime/php-8.1-strftime.class.php'; return mb_detect_encoding(\PHP81_BC\strftime($format, $date), 'UTF-8', true) ? \PHP81_BC\strftime($format, $date) : utf8_encode(\PHP81_BC\strftime($format, $date)); diff --git a/core/core.php b/core/core.php index 2d929dae..9c2aef60 100644 --- a/core/core.php +++ b/core/core.php @@ -1024,7 +1024,7 @@ class common case 'gif': $source_image = imagecreatefromgif($src); break; - case 'webp' : + case 'webp': $source_image = imagecreatefromwebp($src); break; } @@ -1049,7 +1049,7 @@ class common case 'image/gif': return (imagegif($virtual_image, $dest)); break; - case 'webp' : + case 'webp': $source_image = imagecreatefromwebp($src); break; } @@ -1260,7 +1260,7 @@ class common ) { $item .= '
'; } else { - $item .= ''; + $item .= ''; } $item .= '

'; $item .= ''; @@ -1283,7 +1283,7 @@ class common { echo '
'; // Récupérer la config de la page courante - $blocks = is_null($this->getData(['page',$this->getUrl(0),'block'])) ? '12' : $this->getData(['page',$this->getUrl(0),'block']); + $blocks = is_null($this->getData(['page', $this->getUrl(0), 'block'])) ? '12' : $this->getData(['page', $this->getUrl(0), 'block']); $blocks = explode('-', $blocks); // Initialiser $blockleft = ''; @@ -2126,10 +2126,9 @@ class common // Sur une page sans module or $this->getData(['page', $this->getUrl(0), 'moduleId']) === '' // Sur une page avec un module invalide - OR ( - !is_null($this->getData(['page', $this->getUrl(2), 'moduleId'])) && + or (!is_null($this->getData(['page', $this->getUrl(2), 'moduleId'])) && !class_exists($this->getData(['page', $this->getUrl(2), 'moduleId'])) - ) + ) // Sur une page d'accueil or $this->getUrl(0) === '' ) { @@ -2783,9 +2782,7 @@ 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 = helper::dateUTF8('%Y %m %d', time()) . ' - ' . helper::dateUTF8('%H:%M', time()); $dataLog .= helper::getIp($this->getData(['config', 'connect', 'anonymousIp'])) . ';'; $dataLog .= $this->getUser('id') ? $this->getUser('id') . ';' : 'anonyme' . ';'; $dataLog .= $this->getUrl(); @@ -2863,8 +2860,8 @@ class core extends common $accessInfo['userName'] = ''; $accessInfo['pageId'] = ''; foreach ($this->getData(['user']) as $userId => $userIds) { - if (!is_null($this->getData(['user', $userId, 'accessUrl'])) ) { - $t = explode('/',$this->getData(['user', $userId, 'accessUrl'])); + if (!is_null($this->getData(['user', $userId, 'accessUrl']))) { + $t = explode('/', $this->getData(['user', $userId, 'accessUrl'])); } if ( $this->getUser('id') && @@ -2964,12 +2961,11 @@ class core extends common $action = ''; $ignore = true; if (!is_null($this->getUrl(1))) { - foreach(explode('-', $this->getUrl(1)) as $actionPart) { - if($ignore) { + foreach (explode('-', $this->getUrl(1)) as $actionPart) { + if ($ignore) { $action .= $actionPart; $ignore = false; - } - else { + } else { $action .= ucfirst($actionPart); } } diff --git a/core/module/config/config.php b/core/module/config/config.php index 983be0dc..07edff69 100644 --- a/core/module/config/config.php +++ b/core/module/config/config.php @@ -696,9 +696,7 @@ 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 .= helper::dateUTF8('%Y %m %d', $item['lastFail']) . ' - ' . helper::dateUTF8('%H:%M', time()); $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 bef56a96..47aad0fe 100644 --- a/core/module/plugin/plugin.php +++ b/core/module/plugin/plugin.php @@ -369,9 +369,7 @@ 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'])), + helper::dateUTF8('%d %B %Y', $store[$key]['versionDate']), implode(', ', array_keys($pagesInfos, $key)), template::button('moduleExport' . $key, [ 'class' => $class, @@ -397,9 +395,7 @@ 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'] = helper::dateUTF8('%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 9e97c5c9..db10a194 100644 --- a/core/module/user/user.php +++ b/core/module/user/user.php @@ -495,9 +495,7 @@ 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 = helper::dateUTF8('%Y %m %d', time()) . ' - ' . helper::dateUTF8('%H:%M', time()); $dataLog .= helper::getIp($this->getData(['config', 'connect', 'anonymousIp'])) . ';'; $dataLog .= empty($this->getInput('userLoginId')) ? ';' : $this->getInput('userLoginId', helper::FILTER_ID) . ';'; $dataLog .= $this->getUrl() . ';';