Modifications 4201

This commit is contained in:
Deltacms 2022-05-11 08:58:38 +02:00
parent 1a2f789209
commit 596ac5e53d
22 changed files with 149 additions and 109 deletions

View File

@ -1,5 +1,13 @@
# Changelog # Changelog
## Version 4.2.01 de Deltacms
- Modifications :
- Gestionnaire de fichiers : compatibilité PHP 8.1,
- News : compatibilité PHP 8.1,
- Slider : compatibilité PHP 8.1,
- Configuration / langues : compatibilité PHP 8.1,
- Configuration / connexion : compatibilité PHP 8.1.
## Version 4.1.05 de Deltacms ## Version 4.1.05 de Deltacms
- Modifications : - Modifications :
- Langues : RFM bilingue anglais / français et quelques compléments de traduction, - Langues : RFM bilingue anglais / français et quelques compléments de traduction,

View File

@ -1,5 +1,5 @@
# DeltaCMS 4.1.05 # DeltaCMS 4.2.01
DeltaCMS est un CMS sans base de données (flat-file) qui permet de créer et gérer facilement un site web sans aucune connaissance en programmation. DeltaCMS est un CMS sans base de données (flat-file) qui permet de créer et gérer facilement un site web sans aucune connaissance en programmation.
L'administration du site est bilingue anglais ou français, le site peut être rédigé dans une des principales langues européennes. L'administration du site est bilingue anglais ou français, le site peut être rédigé dans une des principales langues européennes.

View File

@ -58,7 +58,7 @@ class template {
$limit = $attributes['limit'] ? count($letters)-1 : 10; $limit = $attributes['limit'] ? count($letters)-1 : 10;
// Tirage de l'opération // Tirage de l'opération
mt_srand((float) microtime()*1000000); mt_srand((int)(microtime(true)*1000000));
// Captcha simple limité à l'addition // Captcha simple limité à l'addition
$operator = $attributes['limit'] ? mt_rand (1, 4) : 1; $operator = $attributes['limit'] ? mt_rand (1, 4) : 1;
@ -68,9 +68,9 @@ class template {
} }
// Tirage des nombres // Tirage des nombres
mt_srand((float) microtime()*1000000); mt_srand((int)(microtime(true)*1000000));
$firstNumber = mt_rand (1, $limit); $firstNumber = mt_rand (1, $limit);
mt_srand((float) microtime()*1000000); mt_srand((int)(microtime(true)*1000000));
$secondNumber = mt_rand (1, $limit); $secondNumber = mt_rand (1, $limit);
// Permutation si addition ou soustraction // Permutation si addition ou soustraction
@ -100,7 +100,7 @@ class template {
for ($i = 1; $i <= $firstNumber; $i++) { for ($i = 1; $i <= $firstNumber; $i++) {
$limit = $limit2[$i-1]; $limit = $limit2[$i-1];
} }
mt_srand((float) microtime()*1000000); mt_srand((int)(microtime(true)*1000000));
$secondNumber = mt_rand(1, $limit); $secondNumber = mt_rand(1, $limit);
$firstNumber = $firstNumber * $secondNumber; $firstNumber = $firstNumber * $secondNumber;
$result = $firstNumber / $secondNumber; $result = $firstNumber / $secondNumber;

View File

@ -48,7 +48,7 @@ class common {
// Numéro de version // Numéro de version
const DELTA_UPDATE_URL = 'https://update.deltacms.fr/master/'; const DELTA_UPDATE_URL = 'https://update.deltacms.fr/master/';
const DELTA_VERSION = '4.1.05'; const DELTA_VERSION = '4.2.01';
const DELTA_UPDATE_CHANNEL = "v4"; const DELTA_UPDATE_CHANNEL = "v4";
public static $actions = []; public static $actions = [];

View File

@ -53,9 +53,9 @@ if ($this->getData(['core', 'dataVersion']) < 4104) {
$this->setData(['core', 'dataVersion', 4104]); $this->setData(['core', 'dataVersion', 4104]);
} }
if ($this->getData(['core', 'dataVersion']) < 4105) { if ($this->getData(['core', 'dataVersion']) < 4201) {
// Mise à jour // Mise à jour
$this->setData(['core', 'dataVersion', 4105]); $this->setData(['core', 'dataVersion', 4201]);
} }
?> ?>

View File

@ -56,7 +56,9 @@ switch ($val) {
<div class="col4 offset1"> <div class="col4 offset1">
<div class="row"> <div class="row">
<div class="col12" id="take_screenshoot"> <div class="col12" id="take_screenshoot">
<?php $texte = $_SESSION['screenshot'] === 'on' ? $text[1]: $text[2]; <?php
$texte = $text[2];
if( isset($_SESSION['screenshot'])) $texte = $_SESSION['screenshot'] === 'on' ? $text[1]: $text[2];
echo template::button('socialMetaImage', [ echo template::button('socialMetaImage', [
'href' => helper::baseUrl() . 'config/configOpenGraph', 'href' => helper::baseUrl() . 'config/configOpenGraph',
'value' => $texte 'value' => $texte

View File

@ -70,7 +70,7 @@ class init extends common {
] ]
], ],
'core' => [ 'core' => [
'dataVersion' => 4105, 'dataVersion' => 4201,
'lastBackup' => 0, 'lastBackup' => 0,
'lastClearTmp' => 0, 'lastClearTmp' => 0,
'lastAutoUpdate' => 0, 'lastAutoUpdate' => 0,

View File

@ -82,7 +82,8 @@ class translate extends common {
// Enregistrer la langue // Enregistrer la langue
if ($success) { if ($success) {
$this->setData(['config', 'i18n', $toCreate, 'site' ]); $this->setData(['config', 'i18n', $toCreate, 'site' ]);
$notification = $text[3] . self::$i18nList[$copyFrom] . $text[4] . self::$i18nList[$toCreate]; $i18nListBase = array_merge(['base' => $text[5] ],self::$i18nList);
$notification = $text[3] . $i18nListBase[$copyFrom] . $text[4] . self::$i18nList[$toCreate];
} else { } else {
$notification = $text[0]; $notification = $text[0];
} }

View File

@ -493,7 +493,7 @@ class UploadHandler
$name = $this->upcount_name($name); $name = $this->upcount_name($name);
} }
// Keep an existing filename if this is part of a chunked upload: // Keep an existing filename if this is part of a chunked upload:
$uploaded_bytes = $this->fix_integer_overflow((int)$content_range[1]); $uploaded_bytes =!empty($content_range[1]) ? $this->fix_integer_overflow((int)$content_range[1]) : 0;
while (is_file($this->get_upload_path($name))) { while (is_file($this->get_upload_path($name))) {
if ($uploaded_bytes === $this->get_file_size( if ($uploaded_bytes === $this->get_file_size(
$this->get_upload_path($name))) { $this->get_upload_path($name))) {
@ -1426,7 +1426,7 @@ class UploadHandler
$name = $file_name ? $file_name : $upload['name'][0]; $name = $file_name ? $file_name : $upload['name'][0];
$res = $this->generate_response($response, $print_response); $res = $this->generate_response($response, $print_response);
if(is_file($this->get_upload_path($name))){ if(is_file($this->get_upload_path($name))){
$uploaded_bytes = $this->fix_integer_overflow((int)$content_range[1]); $uploaded_bytes =!empty($content_range[1]) ? $this->fix_integer_overflow((int)$content_range[1]) : 0;
$totalSize = $this->get_file_size($this->get_upload_path($name)); $totalSize = $this->get_file_size($this->get_upload_path($name));
if ($totalSize - $uploaded_bytes - $this->options['readfile_chunk_size'] < 0) { if ($totalSize - $uploaded_bytes - $this->options['readfile_chunk_size'] < 0) {
$this->onUploadEnd($res); $this->onUploadEnd($res);
@ -1589,6 +1589,7 @@ class UploadHandler
} }
protected function basename($filepath, $suffix = null) { protected function basename($filepath, $suffix = null) {
$suffix = $suffix === null ? '':$suffix;
$splited = preg_split('/\//', rtrim ($filepath, '/ ')); $splited = preg_split('/\//', rtrim ($filepath, '/ '));
return substr(basename('X'.$splited[count($splited)-1], $suffix), 1); return substr(basename('X'.$splited[count($splited)-1], $suffix), 1);
} }

View File

@ -3,8 +3,8 @@ $version = "9.14.0";
if (session_id() == '') session_start(); if (session_id() == '') session_start();
mb_internal_encoding('UTF-8'); mb_internal_encoding('UTF-8');
mb_http_output(); mb_http_output('UTF-8');
mb_http_input(); //mb_http_input();
mb_language('uni'); mb_language('uni');
if (function_exists('mb_regex_encoding')) { if (function_exists('mb_regex_encoding')) {
mb_regex_encoding('UTF-8'); mb_regex_encoding('UTF-8');

View File

@ -693,12 +693,13 @@ function filenameSort($x, $y)
global $descending; global $descending;
if ($x['is_dir'] !== $y['is_dir']) { if ($x['is_dir'] !== $y['is_dir']) {
return $y['is_dir']; $greater = $y['is_dir'];
} else { } else {
return ($descending) $greater = ($descending)
? $x['file_lcase'] < $y['file_lcase'] ? $x['file_lcase'] < $y['file_lcase']
: $x['file_lcase'] >= $y['file_lcase']; : $x['file_lcase'] >= $y['file_lcase'];
} }
return $greater ? 1 : -1;
} }
function dateSort($x, $y) function dateSort($x, $y)
@ -706,12 +707,13 @@ function dateSort($x, $y)
global $descending; global $descending;
if ($x['is_dir'] !== $y['is_dir']) { if ($x['is_dir'] !== $y['is_dir']) {
return $y['is_dir']; $greater = $y['is_dir'];
} else { } else {
return ($descending) $greater = ($descending)
? $x['date'] < $y['date'] ? $x['date'] < $y['date']
: $x['date'] >= $y['date']; : $x['date'] >= $y['date'];
} }
return $greater ? 1 : -1;
} }
function sizeSort($x, $y) function sizeSort($x, $y)
@ -719,12 +721,13 @@ function sizeSort($x, $y)
global $descending; global $descending;
if ($x['is_dir'] !== $y['is_dir']) { if ($x['is_dir'] !== $y['is_dir']) {
return $y['is_dir']; $greater = $y['is_dir'];
} else { } else {
return ($descending) $greater = ($descending)
? $x['size'] < $y['size'] ? $x['size'] < $y['size']
: $x['size'] >= $y['size']; : $x['size'] >= $y['size'];
} }
return $greater ? 1 : -1;
} }
function extensionSort($x, $y) function extensionSort($x, $y)
@ -732,12 +735,13 @@ function extensionSort($x, $y)
global $descending; global $descending;
if ($x['is_dir'] !== $y['is_dir']) { if ($x['is_dir'] !== $y['is_dir']) {
return $y['is_dir']; $greater = $y['is_dir'];
} else { } else {
return ($descending) $greater = ($descending)
? $x['extension'] < $y['extension'] ? $x['extension'] < $y['extension']
: $x['extension'] >= $y['extension']; : $x['extension'] >= $y['extension'];
} }
return $greater ? 1 : -1;
} }
switch ($sort_by) { switch ($sort_by) {

View File

@ -196,7 +196,7 @@ class Response {
{ {
$this->headers['Content-Type'] = array('application/json'); $this->headers['Content-Type'] = array('application/json');
$content = json_encode($content); $content = json_encode(utf8_encode($content));
} }
$this->content = $content; $this->content = $content;

View File

@ -358,9 +358,9 @@ class imageLib {
$optimalHeight = $dimensionsArray['optimalHeight']; $optimalHeight = $dimensionsArray['optimalHeight'];
// *** Resample - create image canvas of x, y size // *** Resample - create image canvas of x, y size
$this->imageResized = imagecreatetruecolor($optimalWidth, $optimalHeight); $this->imageResized = imagecreatetruecolor((int)$optimalWidth, (int)$optimalHeight);
$this->keepTransparancy($optimalWidth, $optimalHeight, $this->imageResized); $this->keepTransparancy($optimalWidth, $optimalHeight, $this->imageResized);
imagecopyresampled($this->imageResized, $this->image, 0, 0, 0, 0, $optimalWidth, $optimalHeight, $this->width, $this->height); imagecopyresampled($this->imageResized, $this->image, 0, 0, 0, 0, (int)$optimalWidth, (int)$optimalHeight, (int)$this->width, (int)$this->height);
// *** If '4', then crop too // *** If '4', then crop too
@ -459,12 +459,12 @@ class imageLib {
imagealphablending($im, false); imagealphablending($im, false);
imagesavealpha($im, true); imagesavealpha($im, true);
$transparent = imagecolorallocatealpha($im, 255, 255, 255, 127); $transparent = imagecolorallocatealpha($im, 255, 255, 255, 127);
imagefilledrectangle($im, 0, 0, $width, $height, $transparent); imagefilledrectangle($im, 0, 0, (int)$width, (int)$height, (int)$transparent);
} }
else else
{ {
$color = imagecolorallocate($im, $this->fillColorArray['r'], $this->fillColorArray['g'], $this->fillColorArray['b']); $color = imagecolorallocate($im, $this->fillColorArray['r'], $this->fillColorArray['g'], $this->fillColorArray['b']);
imagefilledrectangle($im, 0, 0, $width, $height, $color); imagefilledrectangle($im, 0, 0, (int)$width, (int)$height, (int)$color);
} }
} }
@ -490,7 +490,7 @@ class imageLib {
// *** Crop this bad boy // *** Crop this bad boy
$crop = imagecreatetruecolor($newWidth, $newHeight); $crop = imagecreatetruecolor($newWidth, $newHeight);
$this->keepTransparancy($optimalWidth, $optimalHeight, $crop); $this->keepTransparancy($optimalWidth, $optimalHeight, $crop);
imagecopyresampled($crop, $this->imageResized, 0, 0, $cropStartX, $cropStartY, $newWidth, $newHeight, $newWidth, $newHeight); imagecopyresampled($crop, $this->imageResized, 0, 0, (int) $cropStartX,(int) $cropStartY, (int) $newWidth, (int) $newHeight, (int) $newWidth, (int) $newHeight);
$this->imageResized = $crop; $this->imageResized = $crop;
@ -2788,7 +2788,7 @@ class imageLib {
{ {
// *** Perform a check or two. // *** Perform a check or two.
if ( ! is_resource($this->imageResized)) if ( ! is_resource($this->imageResized) && !($this->imageResized instanceof \GdImage))
{ {
if ($this->debug) if ($this->debug)
{ {
@ -2899,7 +2899,7 @@ class imageLib {
# #
{ {
if ( ! is_resource($this->imageResized)) if ( ! is_resource($this->imageResized) && ! $this->imageResized instanceof \GdImage)
{ {
if ($this->debug) if ($this->debug)
{ {
@ -3469,7 +3469,7 @@ class imageLib {
# Notes: # Notes:
# #
{ {
if ( ! is_resource($img)) if ( ! is_resource($img) && ! $img instanceof \GdImage)
{ {
return false; return false;
} }
@ -3718,7 +3718,7 @@ class imageLib {
public function __destruct() public function __destruct()
{ {
if (is_resource($this->imageResized)) if (is_resource($this->imageResized) || $this->imageResized instanceof \GdImage)
{ {
imagedestroy($this->imageResized); imagedestroy($this->imageResized);
} }

View File

@ -879,8 +879,13 @@ function image_check_memory_usage($img, $max_breedte, $max_hoogte)
if (strpos($mem, 'G') !== false) $memory_limit = abs(intval(str_replace(array('G'), '', $mem) * 1024 * 1024 * 1024)); if (strpos($mem, 'G') !== false) $memory_limit = abs(intval(str_replace(array('G'), '', $mem) * 1024 * 1024 * 1024));
$image_properties = getimagesize($img); $image_properties = getimagesize($img);
$image_width = $image_properties[0]; if( is_array($image_properties)){
$image_height = $image_properties[1]; $image_width = $image_properties[0];
$image_height = $image_properties[1];
} else {
$image_width = 0;
$image_height = 0;
}
if (isset($image_properties['bits'])) if (isset($image_properties['bits']))
$image_bits = $image_properties['bits']; $image_bits = $image_properties['bits'];
else else

View File

@ -604,11 +604,13 @@ class blog extends common {
case 'fr' : case 'fr' :
$text[0] = 'Modifications enregistrées'; $text[0] = 'Modifications enregistrées';
$text[1] = 'Configuration du module'; $text[1] = 'Configuration du module';
$text[2] = ' à ';
$states = self::$states; $states = self::$states;
break; break;
case 'en' : case 'en' :
$text[0] = 'Saved changes'; $text[0] = 'Saved changes';
$text[1] = 'Module configuration'; $text[1] = 'Module configuration';
$text[2] = ' at ';
$states = self::$states_en; $states = self::$states_en;
break; break;
} }
@ -685,7 +687,7 @@ class blog extends common {
'<a href="' . helper::baseurl() . $this->getUrl(0) . '/' . $articleIds[$i] . '" target="_blank" >' . '<a href="' . helper::baseurl() . $this->getUrl(0) . '/' . $articleIds[$i] . '" target="_blank" >' .
$this->getData(['module', $this->getUrl(0), 'posts', $articleIds[$i], 'title']) . $this->getData(['module', $this->getUrl(0), 'posts', $articleIds[$i], 'title']) .
'</a>', '</a>',
$date .' à '. $heure, $date .$text[2]. $heure,
$states[$this->getData(['module', $this->getUrl(0), 'posts', $articleIds[$i], 'state'])], $states[$this->getData(['module', $this->getUrl(0), 'posts', $articleIds[$i], 'state'])],
// Bouton pour afficher les commentaires de l'article // Bouton pour afficher les commentaires de l'article
template::button('blogConfigComment' . $articleIds[$i], [ template::button('blogConfigComment' . $articleIds[$i], [

View File

@ -35,15 +35,10 @@ echo '<script src="'. helper::baseUrl(false).'core/vendor/tinymce/tinymce.min.js
echo '<script src="'. helper::baseUrl(false).'core/vendor/tinymce/init.js"></script>'; echo '<script src="'. helper::baseUrl(false).'core/vendor/tinymce/init.js"></script>';
echo '<script src="'. helper::baseUrl(false).'core/vendor/tinymce/init.css"></script>'; echo '<script src="'. helper::baseUrl(false).'core/vendor/tinymce/init.css"></script>';
// Pour les dates suivant la langue d'administration // Pour les dates suivant la langue de rédaction du site
$lang = 'fr_FR';
$zone = 'Europe/Paris'; $zone = 'Europe/Paris';
if ( $this->getData(['config', 'i18n', 'langAdmin']) === 'en'){
$lang = 'en_GB';
$zone = 'Europe/London';
}
$fmt = datefmt_create( $fmt = datefmt_create(
$lang, $this->getData(['config', 'i18n', 'langBase']),
IntlDateFormatter::LONG, IntlDateFormatter::LONG,
IntlDateFormatter::SHORT, IntlDateFormatter::SHORT,
$zone, $zone,

View File

@ -10,15 +10,10 @@ switch ($val) {
$text[0] = 'Read more'; $text[0] = 'Read more';
break; break;
} }
// Pour les dates suivant la langue d'administration // Pour les dates suivant la langue de rédaction du site
$lang = 'fr_FR';
$zone = 'Europe/Paris'; $zone = 'Europe/Paris';
if ( $this->getData(['config', 'i18n', 'langAdmin']) === 'en'){
$lang = 'en_GB';
$zone = 'Europe/London';
}
$fmt = datefmt_create( $fmt = datefmt_create(
$lang, $this->getData(['config', 'i18n', 'langBase']),
IntlDateFormatter::LONG, IntlDateFormatter::LONG,
IntlDateFormatter::SHORT, IntlDateFormatter::SHORT,
$zone, $zone,

View File

@ -316,18 +316,33 @@ class news extends common {
// Liste des pages // Liste des pages
self::$pages = $pagination['pages']; self::$pages = $pagination['pages'];
// News en fonction de la pagination // News en fonction de la pagination
setlocale(LC_TIME, 'fr_FR'); // Pour les dates suivant la langue d'administration
if( $this->getData(['config', 'i18n', 'langAdmin']) === 'en') setlocale(LC_TIME, 'en_GB'); $lang = 'fr_FR';
$zone = 'Europe/Paris';
if ( $this->getData(['config', 'i18n', 'langAdmin']) === 'en'){
$lang = 'en_GB';
$zone = 'Europe/London';
}
$fmt = datefmt_create(
$lang,
IntlDateFormatter::LONG,
IntlDateFormatter::SHORT,
$zone,
IntlDateFormatter::GREGORIAN
);
for($i = $pagination['first']; $i < $pagination['last']; $i++) { for($i = $pagination['first']; $i < $pagination['last']; $i++) {
// Met en forme le tableau // 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) /*$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'])) ? 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']))); : utf8_encode(strftime('%d %B %Y', $this->getData(['module', $this->getUrl(0),'posts', $newsIds[$i], 'publishedOn'])));
$dateOn .= $text[3]; $dateOn .= $text[3];
$dateOn .= mb_detect_encoding(strftime('%H:%M', $this->getData(['module', $this->getUrl(0),'posts', $newsIds[$i], 'publishedOn'])), 'UTF-8', true) $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'])) ? 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']))); : utf8_encode(strftime('%H:%M', $this->getData(['module', $this->getUrl(0),'posts', $newsIds[$i], 'publishedOn'])));
*/
$dateOn = datefmt_format($fmt, strtotime( date('Y/m/d H:i:s',$this->getData(['module', $this->getUrl(0),'posts', $newsIds[$i], 'publishedOn']))));
if ($this->getData(['module', $this->getUrl(0),'posts', $newsIds[$i], 'publishedOff'])) { 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) $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'])) ? 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']))); : utf8_encode(strftime('%d %B %Y', $this->getData(['module', $this->getUrl(0),'posts', $newsIds[$i], 'publishedOff'])));
@ -335,6 +350,8 @@ class news extends common {
$dateOff .= mb_detect_encoding(strftime('%H:%M', $this->getData(['module', $this->getUrl(0),'posts', $newsIds[$i], 'publishedOff'])), 'UTF-8', true) $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'])) ? 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']))); : utf8_encode(strftime('%H:%M', $this->getData(['module', $this->getUrl(0),'posts', $newsIds[$i], 'publishedOff'])));
*/
$dateOff = datefmt_format($fmt, strtotime( date('Y/m/d H:i:s',$this->getData(['module', $this->getUrl(0),'posts', $newsIds[$i], 'publishedOff']))));
} else { } else {
$dateOff = $text[1]; $dateOff = $text[1];
} }
@ -618,10 +635,11 @@ class news extends common {
$versionData = $this->getData(['module',$this->getUrl(0),'config', 'versionData' ]); $versionData = $this->getData(['module',$this->getUrl(0),'config', 'versionData' ]);
// le module n'est pas initialisé // le module n'est pas initialisé
if ($versionData === NULL) { if ($versionData === null) {
$this->init(); $this->init();
} }
$versionData = $this->getData(['module',$this->getUrl(0),'config', 'versionData' ]);
// Mise à jour 4.0 // Mise à jour 4.0
if (version_compare($versionData, '4.0', '<') ) { if (version_compare($versionData, '4.0', '<') ) {
// Mettre à jour la version // Mettre à jour la version

View File

@ -1,5 +1,5 @@
<?php <?php
class init extends search { class init extends news {
public static $defaultData = [ public static $defaultData = [
'feeds' => false, 'feeds' => false,
'feedsLabel' => '', 'feedsLabel' => '',

View File

@ -6,16 +6,19 @@
<div class="row verticalAlignMiddle"> <div class="row verticalAlignMiddle">
<div class="col12 newsDate"> <div class="col12 newsDate">
<!-- bloc signature et date --> <!-- bloc signature et date -->
<?php echo $module::$articleSignature . ' - ';?> <?php
// Pour les dates suivant la langue de rédaction du site
$zone = 'Europe/Paris';
$fmt = datefmt_create(
$this->getData(['config', 'i18n', 'langBase']),
IntlDateFormatter::LONG,
IntlDateFormatter::SHORT,
$zone,
IntlDateFormatter::GREGORIAN
);
echo $module::$articleSignature . ' - ';?>
<i class="far fa-calendar-alt"></i> <i class="far fa-calendar-alt"></i>
<?php $date = mb_detect_encoding(strftime('%d %B %Y', $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'publishedOn'])), 'UTF-8', true) <?php echo datefmt_format($fmt, strtotime( date('Y/m/d H:i:s',$this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'publishedOn'])))); ?>
? strftime('%d %B %Y', $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'publishedOn']))
: utf8_encode(strftime('%d %B %Y', $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'publishedOn'])));
$heure = mb_detect_encoding(strftime('%H:%M', $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'publishedOn'])), 'UTF-8', true)
? strftime('%H:%M', $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'publishedOn']))
: utf8_encode(strftime('%H:%M', $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'publishedOn'])));
echo $date . ' à ' . $heure;
?>
<!-- Bloc edition --> <!-- Bloc edition -->
<?php if ( <?php if (
$this->getUser('password') === $this->getInput('DELTA_USER_PASSWORD') $this->getUser('password') === $this->getInput('DELTA_USER_PASSWORD')

View File

@ -15,7 +15,15 @@ switch ($val) {
break; break;
} }
?> ?>
<?php if($module::$news): ?> <?php if($module::$news):
// Pour les dates suivant la langue de rédaction du site
$fmt = datefmt_create(
$this->getData(['config', 'i18n', 'langBase']),
IntlDateFormatter::LONG,
IntlDateFormatter::SHORT,
'Europe/Paris',
IntlDateFormatter::GREGORIAN
); ?>
<div class="row"> <div class="row">
<?php foreach($module::$news as $newsId => $news): ?> <?php foreach($module::$news as $newsId => $news): ?>
<div class="col<?php echo $module::$nbrCol ;?>" > <div class="col<?php echo $module::$nbrCol ;?>" >
@ -31,9 +39,7 @@ switch ($val) {
<?php endif; ?> <?php endif; ?>
<div class="newsSignature"> <div class="newsSignature">
<i class="far fa-calendar-alt"></i> <i class="far fa-calendar-alt"></i>
<?php echo mb_detect_encoding(strftime('%d %B %Y', $news['publishedOn']), 'UTF-8', true) <?php echo datefmt_format($fmt, strtotime( date('Y/m/d H:i:s',$news['publishedOn']))); ?>
? strftime('%d %B %Y', $news['publishedOn'])
: utf8_encode(strftime('%d %B %Y', $news['publishedOn'])); ?>
- <?php echo $news['userId']; ?> - <?php echo $news['userId']; ?>
<!-- Bloc edition --> <!-- Bloc edition -->
<?php if ( <?php if (

View File

@ -458,49 +458,49 @@ class slider extends common {
} }
} }
if( isset($gallery['config']['directory'])){
$directory = $gallery['config']['directory']; $directory = $gallery['config']['directory'];
// Images de la galerie // Images de la galerie
if(is_dir($directory)) { if(is_dir($directory)) {
$iterator = new DirectoryIterator($directory); $iterator = new DirectoryIterator($directory);
foreach($iterator as $fileInfos) { foreach($iterator as $fileInfos) {
if($fileInfos->isDot() === false AND $fileInfos->isFile() AND @getimagesize($fileInfos->getPathname())) { if($fileInfos->isDot() === false AND $fileInfos->isFile() AND @getimagesize($fileInfos->getPathname())) {
self::$pictures[$directory . '/' . $fileInfos->getFilename()] = $this->getData(['module', $this->getUrl(0), $galleryId,'legend', str_replace('.','',$fileInfos->getFilename())]); self::$pictures[$directory . '/' . $fileInfos->getFilename()] = $this->getData(['module', $this->getUrl(0), $galleryId,'legend', str_replace('.','',$fileInfos->getFilename())]);
}
} }
} // Tri des images par ordre alphabétique, alphabétique inverse, aléatoire ou pas
// Tri des images par ordre alphabétique, alphabétique inverse, aléatoire ou pas switch ($this->getData(['module', $this->getUrl(0), $galleryId, 'config', 'tri'])) {
switch ($this->getData(['module', $this->getUrl(0), $galleryId, 'config', 'tri'])) { case 'SORT_DSC':
case 'SORT_DSC': krsort(self::$pictures,SORT_NATURAL | SORT_FLAG_CASE);
krsort(self::$pictures,SORT_NATURAL | SORT_FLAG_CASE); break;
break; case 'SORT_ASC':
case 'SORT_ASC': ksort(self::$pictures,SORT_NATURAL | SORT_FLAG_CASE);
ksort(self::$pictures,SORT_NATURAL | SORT_FLAG_CASE); break;
break; case 'RAND':
case 'RAND': $tab1 = self::$pictures;
$tab1 = self::$pictures; // si absence de légende on en place une provisoire
// si absence de légende on en place une provisoire foreach($tab1 as $key1=>$value1){
foreach($tab1 as $key1=>$value1){ if($value1 == ''){
if($value1 == ''){ $tab1[$key1] = $key1;
$tab1[$key1] = $key1; }
} }
} $tab2 = array_flip($tab1);
$tab2 = array_flip($tab1); shuffle($tab2);
shuffle($tab2); $tab1 = array_flip($tab2);
$tab1 = array_flip($tab2); foreach($tab1 as $key1=>$value1){
foreach($tab1 as $key1=>$value1){ $tab1[$key1] = self::$pictures[$key1];
$tab1[$key1] = self::$pictures[$key1]; }
} self::$pictures = $tab1;
self::$pictures = $tab1; break;
break; case 'NONE':
case 'NONE': break;
break; default:
default: break;
break; }
// Information sur la visibilité des boutons
self::$view_boutons = $this->getData(['module', $this->getUrl(0), $galleryId, 'config','boutonsVisibles']);
} }
// Information sur la visibilité des boutons
self::$view_boutons = $this->getData(['module', $this->getUrl(0), $galleryId, 'config','boutonsVisibles']);
} }
// Valeurs en sortie // Valeurs en sortie
$this->addOutput([ $this->addOutput([
'showBarEditButton' => true, 'showBarEditButton' => true,