Compare commits
29 Commits
Author | SHA1 | Date |
---|---|---|
Fred Tempez | 4d37279518 | |
Fred Tempez | 28f8aa94ec | |
Fred Tempez | fc4900c66b | |
Fred Tempez | 98ab381b0e | |
Fred Tempez | 62a42e4a8e | |
Fred Tempez | a3c3bd5842 | |
Fred Tempez | 1cf62d4140 | |
Fred Tempez | b0fec2951a | |
Fred Tempez | 0afefae7d9 | |
Fred Tempez | 8bfbeabfa2 | |
Fred Tempez | 34ddb487cd | |
Fred Tempez | 672e4dc453 | |
Fred Tempez | 1cd9b9fec1 | |
Fred Tempez | f421952fc6 | |
Fred Tempez | 60358ef4be | |
Fred Tempez | 81c4a5cfb3 | |
Fred Tempez | dd73d7ac45 | |
Fred Tempez | e0c6af322a | |
Fred Tempez | d1d76aaf81 | |
Fred Tempez | 5da6f3e646 | |
Fred Tempez | fd85a595be | |
Fred Tempez | 2cd7ec458c | |
Fred Tempez | 1b80f4ecb0 | |
Fred Tempez | 731a5f0d69 | |
Fred Tempez | 2ada476d40 | |
Fred Tempez | db2c4620bf | |
Fred Tempez | 90b860eb83 | |
Fred Tempez | dacc074455 | |
Fred Tempez | 54cd7c5a7e |
14
CHANGES.md
14
CHANGES.md
|
@ -1,5 +1,19 @@
|
||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
|
## Version 11.5.10
|
||||||
|
### Correction :
|
||||||
|
- Dysfonctionnement de la classe strftime, setlocale mal défini.
|
||||||
|
|
||||||
|
## Version 11.5.09
|
||||||
|
### Corrections :
|
||||||
|
- Problème de génération de l'exemple du site.
|
||||||
|
- Dépréciations de fonctions PHP 8.1
|
||||||
|
|
||||||
|
## Version 11.5.08
|
||||||
|
### Corrections :
|
||||||
|
- Bugs divers et dépréciations PHP 8.1
|
||||||
|
- Ajout d'une classe spécifique strftime suite à sa dépréciation.
|
||||||
|
|
||||||
## Version 11.5.07
|
## Version 11.5.07
|
||||||
### Correction :
|
### Correction :
|
||||||
- Création du dossier des fontes personnalisées en cas d'absence.
|
- Création du dossier des fontes personnalisées en cas d'absence.
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
# ZwiiCMS 11.5.07
|
# ZwiiCMS 11.5.10
|
||||||
|
|
||||||
Zwii 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.
|
Zwii 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.
|
||||||
|
|
||||||
|
|
|
@ -12,5 +12,6 @@ class autoload {
|
||||||
require_once 'core/class/phpmailer/SMTP.class.php';
|
require_once 'core/class/phpmailer/SMTP.class.php';
|
||||||
require_once "core/class/jsondb/Dot.class.php";
|
require_once "core/class/jsondb/Dot.class.php";
|
||||||
require_once "core/class/jsondb/JsonDb.class.php";
|
require_once "core/class/jsondb/JsonDb.class.php";
|
||||||
|
require_once "core/class/strftime/php-8.1-strftime.class.php";
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -333,7 +333,7 @@ class helper {
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public static function filter($text, $filter) {
|
public static function filter($text, $filter) {
|
||||||
$text = trim($text);
|
$text = is_null($text) ? $text : trim($text);
|
||||||
switch($filter) {
|
switch($filter) {
|
||||||
case self::FILTER_BOOLEAN:
|
case self::FILTER_BOOLEAN:
|
||||||
$text = (bool) $text;
|
$text = (bool) $text;
|
||||||
|
@ -379,10 +379,10 @@ class helper {
|
||||||
$text = password_hash($text, PASSWORD_BCRYPT);
|
$text = password_hash($text, PASSWORD_BCRYPT);
|
||||||
break;
|
break;
|
||||||
case self::FILTER_STRING_LONG:
|
case self::FILTER_STRING_LONG:
|
||||||
$text = mb_substr(filter_var($text, FILTER_SANITIZE_STRING), 0, 500000);
|
$text = mb_substr(filter_var($text, FILTER_SANITIZE_FULL_SPECIAL_CHARS), 0, 500000);
|
||||||
break;
|
break;
|
||||||
case self::FILTER_STRING_SHORT:
|
case self::FILTER_STRING_SHORT:
|
||||||
$text = mb_substr(filter_var($text, FILTER_SANITIZE_STRING), 0, 500);
|
$text = mb_substr(filter_var($text, FILTER_SANITIZE_FULL_SPECIAL_CHARS), 0, 500);
|
||||||
break;
|
break;
|
||||||
case self::FILTER_TIMESTAMP:
|
case self::FILTER_TIMESTAMP:
|
||||||
$text = date('Y-m-d H:i:s', $text);
|
$text = date('Y-m-d H:i:s', $text);
|
||||||
|
|
|
@ -10,7 +10,7 @@ use ArrayAccess;
|
||||||
* This class provides dot notation access to arrays, so it's easy to handle
|
* This class provides dot notation access to arrays, so it's easy to handle
|
||||||
* multidimensional data in a clean way.
|
* multidimensional data in a clean way.
|
||||||
*/
|
*/
|
||||||
class Dot implements ArrayAccess
|
class Dot implements \ArrayAccess, \Iterator, \Countable
|
||||||
{
|
{
|
||||||
|
|
||||||
/** @var array Data */
|
/** @var array Data */
|
||||||
|
@ -94,9 +94,14 @@ class Dot implements ArrayAccess
|
||||||
*/
|
*/
|
||||||
public static function addValue(&$array, $key, $value = null, $pop = false)
|
public static function addValue(&$array, $key, $value = null, $pop = false)
|
||||||
{
|
{
|
||||||
if (is_string($key)) {
|
if (is_array($key)) {
|
||||||
|
// Iterate array of paths and values
|
||||||
|
foreach ($key as $k => $v) {
|
||||||
|
self::addValue($array, $k, $v);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
// Iterate path
|
// Iterate path
|
||||||
$keys = explode('.', $key);
|
$keys = explode('.', (string)$key);
|
||||||
if ($pop === true) {
|
if ($pop === true) {
|
||||||
array_pop($keys);
|
array_pop($keys);
|
||||||
}
|
}
|
||||||
|
@ -108,11 +113,6 @@ class Dot implements ArrayAccess
|
||||||
}
|
}
|
||||||
// Add value to path
|
// Add value to path
|
||||||
$array[] = $value;
|
$array[] = $value;
|
||||||
} elseif (is_array($key)) {
|
|
||||||
// Iterate array of paths and values
|
|
||||||
foreach ($key as $k => $v) {
|
|
||||||
self::addValue($array, $k, $v);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -154,9 +154,14 @@ class Dot implements ArrayAccess
|
||||||
* @param mixed|null $default Default value
|
* @param mixed|null $default Default value
|
||||||
* @return mixed Value of path
|
* @return mixed Value of path
|
||||||
*/
|
*/
|
||||||
public function get($key = null, $default = null)
|
public function get($key, $default = null, $asObject = false)
|
||||||
{
|
{
|
||||||
return self::getValue($this->data, $key, $default);
|
$value = self::getValue($this->data, $key, $default);
|
||||||
|
if ($asObject && is_array($value)) {
|
||||||
|
return new self($value);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $value;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -164,10 +169,12 @@ class Dot implements ArrayAccess
|
||||||
*
|
*
|
||||||
* @param mixed $key Path or array of paths and values
|
* @param mixed $key Path or array of paths and values
|
||||||
* @param mixed|null $value Value to set if path is not an array
|
* @param mixed|null $value Value to set if path is not an array
|
||||||
|
* @return $this
|
||||||
*/
|
*/
|
||||||
public function set($key, $value = null)
|
public function set($key, $value = null)
|
||||||
{
|
{
|
||||||
return self::setValue($this->data, $key, $value);
|
self::setValue($this->data, $key, $value);
|
||||||
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -176,10 +183,12 @@ class Dot implements ArrayAccess
|
||||||
* @param mixed $key Path or array of paths and values
|
* @param mixed $key Path or array of paths and values
|
||||||
* @param mixed|null $value Value to set if path is not an array
|
* @param mixed|null $value Value to set if path is not an array
|
||||||
* @param boolean $pop Helper to pop out last key if value is an array
|
* @param boolean $pop Helper to pop out last key if value is an array
|
||||||
|
* @return $this
|
||||||
*/
|
*/
|
||||||
public function add($key, $value = null, $pop = false)
|
public function add($key, $value = null, $pop = false)
|
||||||
{
|
{
|
||||||
return self::addValue($this->data, $key, $value, $pop);
|
self::addValue($this->data, $key, $value);
|
||||||
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -206,10 +215,42 @@ class Dot implements ArrayAccess
|
||||||
* Delete path or array of paths
|
* Delete path or array of paths
|
||||||
*
|
*
|
||||||
* @param mixed $key Path or array of paths to delete
|
* @param mixed $key Path or array of paths to delete
|
||||||
|
* @return $this
|
||||||
*/
|
*/
|
||||||
public function delete($key)
|
public function delete($key)
|
||||||
{
|
{
|
||||||
return self::deleteValue($this->data, $key);
|
self::deleteValue($this->data, $key);
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Increase numeric value
|
||||||
|
*
|
||||||
|
* @param string $key
|
||||||
|
* @param float $number
|
||||||
|
* @return float
|
||||||
|
*/
|
||||||
|
public function plus(string $key, float $number): float
|
||||||
|
{
|
||||||
|
$newAmount = $this->get($key, 0) + $number;
|
||||||
|
$this->set($key, $newAmount);
|
||||||
|
|
||||||
|
return $newAmount;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reduce numeric value
|
||||||
|
*
|
||||||
|
* @param string $key
|
||||||
|
* @param float $number
|
||||||
|
* @return float
|
||||||
|
*/
|
||||||
|
public function minus(string $key, float $number): float
|
||||||
|
{
|
||||||
|
$newAmount = $this->get($key, 0) - $number;
|
||||||
|
$this->set($key, $newAmount);
|
||||||
|
|
||||||
|
return $newAmount;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -269,24 +310,33 @@ class Dot implements ArrayAccess
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ArrayAccess abstract methods
|
* @inheritDoc
|
||||||
*/
|
*/
|
||||||
public function offsetSet($offset, $value)
|
public function offsetSet($offset, $value): void
|
||||||
{
|
{
|
||||||
$this->set($offset, $value);
|
$this->set($offset, $value);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function offsetExists($offset)
|
/**
|
||||||
|
* @inheritDoc
|
||||||
|
*/
|
||||||
|
public function offsetExists($offset): bool
|
||||||
{
|
{
|
||||||
return $this->has($offset);
|
return $this->has($offset);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function offsetGet($offset)
|
/**
|
||||||
|
* @inheritDoc
|
||||||
|
*/
|
||||||
|
public function offsetGet($offset): mixed
|
||||||
{
|
{
|
||||||
return $this->get($offset);
|
return $this->get($offset);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function offsetUnset($offset)
|
/**
|
||||||
|
* @inheritDoc
|
||||||
|
*/
|
||||||
|
public function offsetUnset($offset): void
|
||||||
{
|
{
|
||||||
$this->delete($offset);
|
$this->delete($offset);
|
||||||
}
|
}
|
||||||
|
@ -313,4 +363,115 @@ class Dot implements ArrayAccess
|
||||||
{
|
{
|
||||||
$this->delete($key);
|
$this->delete($key);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check for emptiness
|
||||||
|
*
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
public function isEmpty(): bool
|
||||||
|
{
|
||||||
|
return !(bool)count($this->data);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return all data as array
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function toArray(): array
|
||||||
|
{
|
||||||
|
return $this->data;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return as json string
|
||||||
|
*
|
||||||
|
* @return false|string
|
||||||
|
*/
|
||||||
|
public function toJson()
|
||||||
|
{
|
||||||
|
return json_encode($this->data, JSON_UNESCAPED_UNICODE|JSON_PRETTY_PRINT);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function __toString(): string
|
||||||
|
{
|
||||||
|
return $this->toJson();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function __toArray(): array
|
||||||
|
{
|
||||||
|
return $this->toArray();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the current element
|
||||||
|
* @link https://php.net/manual/en/iterator.current.php
|
||||||
|
* @return mixed Can return any type.
|
||||||
|
* @since 5.0.0
|
||||||
|
*/
|
||||||
|
public function current(): mixed
|
||||||
|
{
|
||||||
|
return current($this->data);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Move forward to next element
|
||||||
|
* @link https://php.net/manual/en/iterator.next.php
|
||||||
|
* @return void Any returned value is ignored.
|
||||||
|
* @since 5.0.0
|
||||||
|
*/
|
||||||
|
public function next(): void
|
||||||
|
{
|
||||||
|
next($this->data);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the key of the current element
|
||||||
|
* @link https://php.net/manual/en/iterator.key.php
|
||||||
|
* @return mixed scalar on success, or null on failure.
|
||||||
|
* @since 5.0.0
|
||||||
|
*/
|
||||||
|
public function key(): mixed
|
||||||
|
{
|
||||||
|
return key($this->data);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks if current position is valid
|
||||||
|
* @link https://php.net/manual/en/iterator.valid.php
|
||||||
|
* @return bool The return value will be casted to boolean and then evaluated.
|
||||||
|
* Returns true on success or false on failure.
|
||||||
|
* @since 5.0.0
|
||||||
|
*/
|
||||||
|
public function valid(): bool
|
||||||
|
{
|
||||||
|
$key = key($this->data);
|
||||||
|
return ($key !== NULL && $key !== FALSE);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Rewind the Iterator to the first element
|
||||||
|
* @link https://php.net/manual/en/iterator.rewind.php
|
||||||
|
* @return void Any returned value is ignored.
|
||||||
|
* @since 5.0.0
|
||||||
|
*/
|
||||||
|
public function rewind(): void
|
||||||
|
{
|
||||||
|
reset($this->data);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @inheritDoc
|
||||||
|
*/
|
||||||
|
public function count(): int
|
||||||
|
{
|
||||||
|
return count($this->data);
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -0,0 +1,217 @@
|
||||||
|
<?php
|
||||||
|
namespace PHP81_BC;
|
||||||
|
|
||||||
|
use DateTime;
|
||||||
|
use DateTimeZone;
|
||||||
|
use DateTimeInterface;
|
||||||
|
use Exception;
|
||||||
|
use IntlDateFormatter;
|
||||||
|
use IntlGregorianCalendar;
|
||||||
|
use InvalidArgumentException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Locale-formatted PHP81_BC\strftime using IntlDateFormatter (PHP 8.1 compatible)
|
||||||
|
* This provides a cross-platform alternative to PHP81_BC\strftime() for when it will be removed from PHP.
|
||||||
|
* Note that output can be slightly different between libc sprintf and this function as it is using ICU.
|
||||||
|
*
|
||||||
|
* Usage:
|
||||||
|
* use function \PHP81_BC\PHP81_BC\strftime;
|
||||||
|
* echo PHP81_BC\strftime('%A %e %B %Y %X', new \DateTime('2021-09-28 00:00:00'), 'fr_FR');
|
||||||
|
*
|
||||||
|
* Original use:
|
||||||
|
* \setlocale(LC_TIME, 'fr_FR.UTF-8');
|
||||||
|
* echo \PHP81_BC\strftime('%A %e %B %Y %X', strtotime('2021-09-28 00:00:00'));
|
||||||
|
*
|
||||||
|
* @param string $format Date format
|
||||||
|
* @param integer|string|DateTime $timestamp Timestamp
|
||||||
|
* @return string
|
||||||
|
* @author BohwaZ <https://bohwaz.net/>
|
||||||
|
*/
|
||||||
|
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\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\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('/(?<!%)%([_#-]?)([a-zA-Z])/', function ($match) use ($translation_table, $timestamp) {
|
||||||
|
$prefix = $match[1];
|
||||||
|
$char = $match[2];
|
||||||
|
$pattern = '%'.$char;
|
||||||
|
if ($pattern == '%n') {
|
||||||
|
return "\n";
|
||||||
|
} elseif ($pattern == '%t') {
|
||||||
|
return "\t";
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!isset($translation_table[$pattern])) {
|
||||||
|
throw new InvalidArgumentException(sprintf('Format "%s" is unknown in time format', $pattern));
|
||||||
|
}
|
||||||
|
|
||||||
|
$replace = $translation_table[$pattern];
|
||||||
|
|
||||||
|
if (is_string($replace)) {
|
||||||
|
$result = $timestamp->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;
|
||||||
|
}
|
1621
core/core.php
1621
core/core.php
File diff suppressed because it is too large
Load Diff
|
@ -316,9 +316,9 @@ class addon extends common {
|
||||||
$store[$key]['category'],
|
$store[$key]['category'],
|
||||||
'<a href="' . self::BASEURL_STORE . self::MODULE_STORE . $key . '" target="_blank" >'.$store[$key]['title'].'</a>',
|
'<a href="' . self::BASEURL_STORE . self::MODULE_STORE . $key . '" target="_blank" >'.$store[$key]['title'].'</a>',
|
||||||
$store[$key]['version'],
|
$store[$key]['version'],
|
||||||
mb_detect_encoding(strftime('%d %B %Y', $store[$key]['versionDate']), 'UTF-8', true)
|
mb_detect_encoding(\PHP81_BC\strftime('%d %B %Y', $store[$key]['versionDate']), 'UTF-8', true)
|
||||||
? strftime('%d %B %Y', $store[$key]['versionDate'])
|
? \PHP81_BC\strftime('%d %B %Y', $store[$key]['versionDate'])
|
||||||
: utf8_encode(strftime('%d %B %Y', $store[$key]['versionDate'])),
|
: utf8_encode(\PHP81_BC\strftime('%d %B %Y', $store[$key]['versionDate'])),
|
||||||
implode(', ', array_keys($inPagesTitle,$key)),
|
implode(', ', array_keys($inPagesTitle,$key)),
|
||||||
template::button('moduleExport' . $key, [
|
template::button('moduleExport' . $key, [
|
||||||
'class' => $class,
|
'class' => $class,
|
||||||
|
@ -342,9 +342,9 @@ class addon extends common {
|
||||||
public function item() {
|
public function item() {
|
||||||
$store = json_decode(helper::getUrlContents(self::BASEURL_STORE . self::MODULE_STORE . 'list'), true);
|
$store = json_decode(helper::getUrlContents(self::BASEURL_STORE . self::MODULE_STORE . 'list'), true);
|
||||||
self::$storeItem = $store [$this->getUrl(2)] ;
|
self::$storeItem = $store [$this->getUrl(2)] ;
|
||||||
self::$storeItem ['fileDate'] = mb_detect_encoding(strftime('%d %B %Y',self::$storeItem ['fileDate']), 'UTF-8', true)
|
self::$storeItem ['fileDate'] = mb_detect_encoding(\PHP81_BC\strftime('%d %B %Y',self::$storeItem ['fileDate']), 'UTF-8', true)
|
||||||
? strftime('%d %B %Y', self::$storeItem ['fileDate'])
|
? \PHP81_BC\strftime('%d %B %Y', self::$storeItem ['fileDate'])
|
||||||
: utf8_encode(strftime('%d %B %Y', self::$storeItem ['fileDate']));
|
: utf8_encode(\PHP81_BC\strftime('%d %B %Y', self::$storeItem ['fileDate']));
|
||||||
// Valeurs en sortie
|
// Valeurs en sortie
|
||||||
$this->addOutput([
|
$this->addOutput([
|
||||||
'title' =>'Module ' . self::$storeItem['title'],
|
'title' =>'Module ' . self::$storeItem['title'],
|
||||||
|
|
|
@ -734,9 +734,9 @@ class config extends common {
|
||||||
$d = $this->getData(['blacklist']);
|
$d = $this->getData(['blacklist']);
|
||||||
$data = '';
|
$data = '';
|
||||||
foreach ($d as $key => $item) {
|
foreach ($d as $key => $item) {
|
||||||
$data .= mb_detect_encoding(strftime('%d/%m/%y',$item['lastFail']), 'UTF-8', true)
|
$data .= mb_detect_encoding(\PHP81_BC\strftime('%d/%m/%y',$item['lastFail']), 'UTF-8', true)
|
||||||
? strftime('%d/%m/%y',$item['lastFail']) . ';' . utf8_encode(strftime('%R',$item['lastFail'])) . ';'
|
? \PHP81_BC\strftime('%d/%m/%y',$item['lastFail']) . ';' . utf8_encode(\PHP81_BC\strftime('%R',$item['lastFail'])) . ';'
|
||||||
: utf8_encode(strftime('%d/%m/%y',$item['lastFail'])) . ';' . utf8_encode(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;
|
$data .= $key . ';' . $item['ip'] . ';' . $item['connectFail'] . PHP_EOL;
|
||||||
}
|
}
|
||||||
file_put_contents($fileName,$data,FILE_APPEND);
|
file_put_contents($fileName,$data,FILE_APPEND);
|
||||||
|
|
|
@ -45,7 +45,7 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col12">
|
<div class="col12">
|
||||||
<?php echo template::checkbox('installDefaultData',true , 'Ne pas charger l\'exemple de site (utilisateurs avancés)', [
|
<?php echo template::checkbox('installDefaultData', true, 'Ne pas charger l\'exemple de site (utilisateurs avancés)', [
|
||||||
'checked' => false
|
'checked' => false
|
||||||
]);
|
]);
|
||||||
?>
|
?>
|
||||||
|
|
|
@ -13,7 +13,8 @@
|
||||||
* @link http://zwiicms.fr/
|
* @link http://zwiicms.fr/
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class user extends common {
|
class user extends common
|
||||||
|
{
|
||||||
|
|
||||||
public static $actions = [
|
public static $actions = [
|
||||||
'add' => self::GROUP_ADMIN,
|
'add' => self::GROUP_ADMIN,
|
||||||
|
@ -50,18 +51,19 @@ class user extends common {
|
||||||
/**
|
/**
|
||||||
* Ajout
|
* Ajout
|
||||||
*/
|
*/
|
||||||
public function add() {
|
public function add()
|
||||||
|
{
|
||||||
// Soumission du formulaire
|
// Soumission du formulaire
|
||||||
if($this->isPost()) {
|
if ($this->isPost()) {
|
||||||
$check=true;
|
$check = true;
|
||||||
// L'identifiant d'utilisateur est indisponible
|
// L'identifiant d'utilisateur est indisponible
|
||||||
$userId = $this->getInput('userAddId', helper::FILTER_ID, true);
|
$userId = $this->getInput('userAddId', helper::FILTER_ID, true);
|
||||||
if($this->getData(['user', $userId])) {
|
if ($this->getData(['user', $userId])) {
|
||||||
self::$inputNotices['userAddId'] = 'Identifiant déjà utilisé';
|
self::$inputNotices['userAddId'] = 'Identifiant déjà utilisé';
|
||||||
$check=false;
|
$check = false;
|
||||||
}
|
}
|
||||||
// Double vérification pour le mot de passe
|
// Double vérification pour le mot de passe
|
||||||
if($this->getInput('userAddPassword', helper::FILTER_STRING_SHORT, true) !== $this->getInput('userAddConfirmPassword', helper::FILTER_STRING_SHORT, true)) {
|
if ($this->getInput('userAddPassword', helper::FILTER_STRING_SHORT, true) !== $this->getInput('userAddConfirmPassword', helper::FILTER_STRING_SHORT, true)) {
|
||||||
self::$inputNotices['userAddConfirmPassword'] = 'Incorrect';
|
self::$inputNotices['userAddConfirmPassword'] = 'Incorrect';
|
||||||
$check = false;
|
$check = false;
|
||||||
}
|
}
|
||||||
|
@ -94,7 +96,7 @@ class user extends common {
|
||||||
|
|
||||||
// Envoie le mail
|
// Envoie le mail
|
||||||
$sent = true;
|
$sent = true;
|
||||||
if($this->getInput('userAddSendMail', helper::FILTER_BOOLEAN) && $check === true) {
|
if ($this->getInput('userAddSendMail', helper::FILTER_BOOLEAN) && $check === true) {
|
||||||
$sent = $this->sendMail(
|
$sent = $this->sendMail(
|
||||||
$userMail,
|
$userMail,
|
||||||
'Compte créé sur ' . $this->getData(['locale', 'title']),
|
'Compte créé sur ' . $this->getData(['locale', 'title']),
|
||||||
|
@ -122,13 +124,14 @@ class user extends common {
|
||||||
/**
|
/**
|
||||||
* Suppression
|
* Suppression
|
||||||
*/
|
*/
|
||||||
public function delete() {
|
public function delete()
|
||||||
|
{
|
||||||
// Accès refusé
|
// Accès refusé
|
||||||
if(
|
if (
|
||||||
// L'utilisateur n'existe pas
|
// L'utilisateur n'existe pas
|
||||||
$this->getData(['user', $this->getUrl(2)]) === null
|
$this->getData(['user', $this->getUrl(2)]) === null
|
||||||
// Groupe insuffisant
|
// Groupe insuffisant
|
||||||
AND ($this->getUrl('group') < self::GROUP_MODERATOR)
|
and ($this->getUrl('group') < self::GROUP_MODERATOR)
|
||||||
) {
|
) {
|
||||||
// Valeurs en sortie
|
// Valeurs en sortie
|
||||||
$this->addOutput([
|
$this->addOutput([
|
||||||
|
@ -144,7 +147,7 @@ class user extends common {
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
// Bloque la suppression de son propre compte
|
// Bloque la suppression de son propre compte
|
||||||
elseif($this->getUser('id') === $this->getUrl(2)) {
|
elseif ($this->getUser('id') === $this->getUrl(2)) {
|
||||||
// Valeurs en sortie
|
// Valeurs en sortie
|
||||||
$this->addOutput([
|
$this->addOutput([
|
||||||
'redirect' => helper::baseUrl() . 'user',
|
'redirect' => helper::baseUrl() . 'user',
|
||||||
|
@ -166,9 +169,12 @@ class user extends common {
|
||||||
/**
|
/**
|
||||||
* Édition
|
* Édition
|
||||||
*/
|
*/
|
||||||
public function edit() {
|
public function edit()
|
||||||
if ($this->getUrl(3) !== $_SESSION['csrf'] &&
|
{
|
||||||
$this->getUrl(4) !== $_SESSION['csrf']) {
|
if (
|
||||||
|
$this->getUrl(3) !== $_SESSION['csrf'] &&
|
||||||
|
$this->getUrl(4) !== $_SESSION['csrf']
|
||||||
|
) {
|
||||||
// Valeurs en sortie
|
// Valeurs en sortie
|
||||||
$this->addOutput([
|
$this->addOutput([
|
||||||
'redirect' => helper::baseUrl() . 'user',
|
'redirect' => helper::baseUrl() . 'user',
|
||||||
|
@ -176,18 +182,17 @@ class user extends common {
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
// Accès refusé
|
// Accès refusé
|
||||||
if(
|
if (
|
||||||
// L'utilisateur n'existe pas
|
// L'utilisateur n'existe pas
|
||||||
$this->getData(['user', $this->getUrl(2)]) === null
|
$this->getData(['user', $this->getUrl(2)]) === null
|
||||||
// Droit d'édition
|
// Droit d'édition
|
||||||
AND (
|
and (
|
||||||
// Impossible de s'auto-éditer
|
// Impossible de s'auto-éditer
|
||||||
(
|
($this->getUser('id') === $this->getUrl(2)
|
||||||
$this->getUser('id') === $this->getUrl(2)
|
and $this->getUrl('group') <= self::GROUP_VISITOR
|
||||||
AND $this->getUrl('group') <= self::GROUP_VISITOR
|
|
||||||
)
|
)
|
||||||
// Impossible d'éditer un autre utilisateur
|
// Impossible d'éditer un autre utilisateur
|
||||||
OR ($this->getUrl('group') < self::GROUP_MODERATOR)
|
or ($this->getUrl('group') < self::GROUP_MODERATOR)
|
||||||
)
|
)
|
||||||
) {
|
) {
|
||||||
// Valeurs en sortie
|
// Valeurs en sortie
|
||||||
|
@ -198,45 +203,41 @@ class user extends common {
|
||||||
// Accès autorisé
|
// Accès autorisé
|
||||||
else {
|
else {
|
||||||
// Soumission du formulaire
|
// Soumission du formulaire
|
||||||
if($this->isPost()) {
|
if ($this->isPost()) {
|
||||||
// Double vérification pour le mot de passe
|
// Double vérification pour le mot de passe
|
||||||
$newPassword = $this->getData(['user', $this->getUrl(2), 'password']);
|
$newPassword = $this->getData(['user', $this->getUrl(2), 'password']);
|
||||||
if($this->getInput('userEditNewPassword')) {
|
if ($this->getInput('userEditNewPassword')) {
|
||||||
// L'ancien mot de passe est correct
|
// L'ancien mot de passe est correct
|
||||||
if(password_verify($this->getInput('userEditOldPassword'), $this->getData(['user', $this->getUrl(2), 'password']))) {
|
if (password_verify($this->getInput('userEditOldPassword'), $this->getData(['user', $this->getUrl(2), 'password']))) {
|
||||||
// La confirmation correspond au mot de passe
|
// La confirmation correspond au mot de passe
|
||||||
if($this->getInput('userEditNewPassword') === $this->getInput('userEditConfirmPassword')) {
|
if ($this->getInput('userEditNewPassword') === $this->getInput('userEditConfirmPassword')) {
|
||||||
$newPassword = $this->getInput('userEditNewPassword', helper::FILTER_PASSWORD, true);
|
$newPassword = $this->getInput('userEditNewPassword', helper::FILTER_PASSWORD, true);
|
||||||
// Déconnexion de l'utilisateur si il change le mot de passe de son propre compte
|
// Déconnexion de l'utilisateur si il change le mot de passe de son propre compte
|
||||||
if($this->getUser('id') === $this->getUrl(2)) {
|
if ($this->getUser('id') === $this->getUrl(2)) {
|
||||||
helper::deleteCookie('ZWII_USER_ID');
|
helper::deleteCookie('ZWII_USER_ID');
|
||||||
helper::deleteCookie('ZWII_USER_PASSWORD');
|
helper::deleteCookie('ZWII_USER_PASSWORD');
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
self::$inputNotices['userEditConfirmPassword'] = 'Incorrect';
|
self::$inputNotices['userEditConfirmPassword'] = 'Incorrect';
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
self::$inputNotices['userEditOldPassword'] = 'Incorrect';
|
self::$inputNotices['userEditOldPassword'] = 'Incorrect';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Modification du groupe
|
// Modification du groupe
|
||||||
if(
|
if (
|
||||||
$this->getUser('group') === self::GROUP_ADMIN
|
$this->getUser('group') === self::GROUP_ADMIN
|
||||||
AND $this->getUrl(2) !== $this->getUser('id')
|
and $this->getUrl(2) !== $this->getUser('id')
|
||||||
) {
|
) {
|
||||||
$newGroup = $this->getInput('userEditGroup', helper::FILTER_INT, true);
|
$newGroup = $this->getInput('userEditGroup', helper::FILTER_INT, true);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
$newGroup = $this->getData(['user', $this->getUrl(2), 'group']);
|
$newGroup = $this->getData(['user', $this->getUrl(2), 'group']);
|
||||||
}
|
}
|
||||||
// Modification de nom Prénom
|
// Modification de nom Prénom
|
||||||
if($this->getUser('group') === self::GROUP_ADMIN){
|
if ($this->getUser('group') === self::GROUP_ADMIN) {
|
||||||
$newfirstname = $this->getInput('userEditFirstname', helper::FILTER_STRING_SHORT, true);
|
$newfirstname = $this->getInput('userEditFirstname', helper::FILTER_STRING_SHORT, true);
|
||||||
$newlastname = $this->getInput('userEditLastname', helper::FILTER_STRING_SHORT, true);
|
$newlastname = $this->getInput('userEditLastname', helper::FILTER_STRING_SHORT, true);
|
||||||
}
|
} else {
|
||||||
else{
|
|
||||||
$newfirstname = $this->getData(['user', $this->getUrl(2), 'firstname']);
|
$newfirstname = $this->getData(['user', $this->getUrl(2), 'firstname']);
|
||||||
$newlastname = $this->getData(['user', $this->getUrl(2), 'lastname']);
|
$newlastname = $this->getData(['user', $this->getUrl(2), 'lastname']);
|
||||||
}
|
}
|
||||||
|
@ -253,20 +254,20 @@ class user extends common {
|
||||||
'signature' => $this->getInput('userEditSignature', helper::FILTER_INT, true),
|
'signature' => $this->getInput('userEditSignature', helper::FILTER_INT, true),
|
||||||
'mail' => $this->getInput('userEditMail', helper::FILTER_MAIL, true),
|
'mail' => $this->getInput('userEditMail', helper::FILTER_MAIL, true),
|
||||||
'password' => $newPassword,
|
'password' => $newPassword,
|
||||||
'connectFail' => $this->getData(['user',$this->getUrl(2),'connectFail']),
|
'connectFail' => $this->getData(['user', $this->getUrl(2), 'connectFail']),
|
||||||
'connectTimeout' => $this->getData(['user',$this->getUrl(2),'connectTimeout']),
|
'connectTimeout' => $this->getData(['user', $this->getUrl(2), 'connectTimeout']),
|
||||||
'accessUrl' => $this->getData(['user',$this->getUrl(2),'accessUrl']),
|
'accessUrl' => $this->getData(['user', $this->getUrl(2), 'accessUrl']),
|
||||||
'accessTimer' => $this->getData(['user',$this->getUrl(2),'accessTimer']),
|
'accessTimer' => $this->getData(['user', $this->getUrl(2), 'accessTimer']),
|
||||||
'accessCsrf' => $this->getData(['user',$this->getUrl(2),'accessCsrf']),
|
'accessCsrf' => $this->getData(['user', $this->getUrl(2), 'accessCsrf']),
|
||||||
'files' => $this->getInput('userEditFiles', helper::FILTER_BOOLEAN)
|
'files' => $this->getInput('userEditFiles', helper::FILTER_BOOLEAN)
|
||||||
]
|
]
|
||||||
]);
|
]);
|
||||||
// Redirection spécifique si l'utilisateur change son mot de passe
|
// Redirection spécifique si l'utilisateur change son mot de passe
|
||||||
if($this->getUser('id') === $this->getUrl(2) AND $this->getInput('userEditNewPassword')) {
|
if ($this->getUser('id') === $this->getUrl(2) and $this->getInput('userEditNewPassword')) {
|
||||||
$redirect = helper::baseUrl() . 'user/login/' . str_replace('/', '_', $this->getUrl());
|
$redirect = helper::baseUrl() . 'user/login/' . str_replace('/', '_', $this->getUrl());
|
||||||
}
|
}
|
||||||
// Redirection si retour en arrière possible
|
// Redirection si retour en arrière possible
|
||||||
elseif($this->getUser('group') === 3) {
|
elseif ($this->getUser('group') === 3) {
|
||||||
$redirect = helper::baseUrl() . 'user';
|
$redirect = helper::baseUrl() . 'user';
|
||||||
}
|
}
|
||||||
// Redirection normale
|
// Redirection normale
|
||||||
|
@ -291,11 +292,12 @@ class user extends common {
|
||||||
/**
|
/**
|
||||||
* Mot de passe perdu
|
* Mot de passe perdu
|
||||||
*/
|
*/
|
||||||
public function forgot() {
|
public function forgot()
|
||||||
|
{
|
||||||
// Soumission du formulaire
|
// Soumission du formulaire
|
||||||
if($this->isPost()) {
|
if ($this->isPost()) {
|
||||||
$userId = $this->getInput('userForgotId', helper::FILTER_ID, true);
|
$userId = $this->getInput('userForgotId', helper::FILTER_ID, true);
|
||||||
if($this->getData(['user', $userId])) {
|
if ($this->getData(['user', $userId])) {
|
||||||
// Enregistre la date de la demande dans le compte utilisateur
|
// Enregistre la date de la demande dans le compte utilisateur
|
||||||
$this->setData(['user', $userId, 'forgot', time()]);
|
$this->setData(['user', $userId, 'forgot', time()]);
|
||||||
// Crée un id unique pour la réinitialisation
|
// Crée un id unique pour la réinitialisation
|
||||||
|
@ -335,22 +337,23 @@ class user extends common {
|
||||||
/**
|
/**
|
||||||
* Liste des utilisateurs
|
* Liste des utilisateurs
|
||||||
*/
|
*/
|
||||||
public function index() {
|
public function index()
|
||||||
|
{
|
||||||
$userIdsFirstnames = helper::arrayColumn($this->getData(['user']), 'firstname');
|
$userIdsFirstnames = helper::arrayColumn($this->getData(['user']), 'firstname');
|
||||||
ksort($userIdsFirstnames);
|
ksort($userIdsFirstnames);
|
||||||
foreach($userIdsFirstnames as $userId => $userFirstname) {
|
foreach ($userIdsFirstnames as $userId => $userFirstname) {
|
||||||
if ($this->getData(['user', $userId, 'group'])) {
|
if ($this->getData(['user', $userId, 'group'])) {
|
||||||
self::$users[] = [
|
self::$users[] = [
|
||||||
$userId,
|
$userId,
|
||||||
$userFirstname . ' ' . $this->getData(['user', $userId, 'lastname']),
|
$userFirstname . ' ' . $this->getData(['user', $userId, 'lastname']),
|
||||||
self::$groups[$this->getData(['user', $userId, 'group'])],
|
self::$groups[$this->getData(['user', $userId, 'group'])],
|
||||||
template::button('userEdit' . $userId, [
|
template::button('userEdit' . $userId, [
|
||||||
'href' => helper::baseUrl() . 'user/edit/' . $userId . '/back/'. $_SESSION['csrf'],
|
'href' => helper::baseUrl() . 'user/edit/' . $userId . '/back/' . $_SESSION['csrf'],
|
||||||
'value' => template::ico('pencil')
|
'value' => template::ico('pencil')
|
||||||
]),
|
]),
|
||||||
template::button('userDelete' . $userId, [
|
template::button('userDelete' . $userId, [
|
||||||
'class' => 'userDelete buttonRed',
|
'class' => 'userDelete buttonRed',
|
||||||
'href' => helper::baseUrl() . 'user/delete/' . $userId. '/' . $_SESSION['csrf'],
|
'href' => helper::baseUrl() . 'user/delete/' . $userId . '/' . $_SESSION['csrf'],
|
||||||
'value' => template::ico('cancel')
|
'value' => template::ico('cancel')
|
||||||
])
|
])
|
||||||
];
|
];
|
||||||
|
@ -366,17 +369,18 @@ class user extends common {
|
||||||
/**
|
/**
|
||||||
* Connexion
|
* Connexion
|
||||||
*/
|
*/
|
||||||
public function login() {
|
public function login()
|
||||||
|
{
|
||||||
// Soumission du formulaire
|
// Soumission du formulaire
|
||||||
$logStatus = '';
|
$logStatus = '';
|
||||||
if($this->isPost()) {
|
if ($this->isPost()) {
|
||||||
// Lire Id du compte
|
// Lire Id du compte
|
||||||
$userId = $this->getInput('userLoginId', helper::FILTER_ID, true);
|
$userId = $this->getInput('userLoginId', helper::FILTER_ID, true);
|
||||||
// Check le captcha
|
// Check le captcha
|
||||||
if(
|
if (
|
||||||
$this->getData(['config','connect','captcha'])
|
$this->getData(['config', 'connect', 'captcha'])
|
||||||
AND password_verify($this->getInput('userLoginCaptcha', helper::FILTER_INT), $this->getInput('userLoginCaptchaResult') ) === false )
|
and password_verify($this->getInput('userLoginCaptcha', helper::FILTER_INT), $this->getInput('userLoginCaptchaResult')) === false
|
||||||
{
|
) {
|
||||||
$captcha = false;
|
$captcha = false;
|
||||||
} else {
|
} else {
|
||||||
$captcha = true;
|
$captcha = true;
|
||||||
|
@ -384,22 +388,24 @@ class user extends common {
|
||||||
/**
|
/**
|
||||||
* Aucun compte existant
|
* Aucun compte existant
|
||||||
*/
|
*/
|
||||||
if ( !$this->getData(['user', $userId])) {
|
if (!$this->getData(['user', $userId])) {
|
||||||
$logStatus = 'Compte inconnu';
|
$logStatus = 'Compte inconnu';
|
||||||
//Stockage de l'IP
|
//Stockage de l'IP
|
||||||
$this->setData([
|
$this->setData([
|
||||||
'blacklist',
|
'blacklist',
|
||||||
$userId,
|
$userId,
|
||||||
[
|
[
|
||||||
'connectFail' => $this->getData(['blacklist',$userId,'connectFail']) + 1,
|
'connectFail' => $this->getData(['blacklist', $userId, 'connectFail']) + 1,
|
||||||
'lastFail' => time(),
|
'lastFail' => time(),
|
||||||
'ip' => helper::getIp()
|
'ip' => helper::getIp()
|
||||||
]
|
]
|
||||||
]);
|
]);
|
||||||
// Verrouillage des IP
|
// Verrouillage des IP
|
||||||
$ipBlackList = helper::arrayColumn($this->getData(['blacklist']), 'ip');
|
$ipBlackList = helper::arrayColumn($this->getData(['blacklist']), 'ip');
|
||||||
if ( $this->getData(['blacklist',$userId,'connectFail']) >= $this->getData(['config', 'connect', 'attempt'])
|
if (
|
||||||
AND in_array($this->getData(['blacklist',$userId,'ip']),$ipBlackList) ) {
|
$this->getData(['blacklist', $userId, 'connectFail']) >= $this->getData(['config', 'connect', 'attempt'])
|
||||||
|
and in_array($this->getData(['blacklist', $userId, 'ip']), $ipBlackList)
|
||||||
|
) {
|
||||||
$logStatus = 'Compte inconnu verrouillé';
|
$logStatus = 'Compte inconnu verrouillé';
|
||||||
// Valeurs en sortie
|
// Valeurs en sortie
|
||||||
$this->addOutput([
|
$this->addOutput([
|
||||||
|
@ -418,35 +424,37 @@ class user extends common {
|
||||||
*/
|
*/
|
||||||
} else {
|
} else {
|
||||||
// Cas 4 : le délai de blocage est dépassé et le compte est au max - Réinitialiser
|
// Cas 4 : le délai de blocage est dépassé et le compte est au max - Réinitialiser
|
||||||
if ($this->getData(['user',$userId,'connectTimeout']) + $this->getData(['config', 'connect', 'timeout']) < time()
|
if (
|
||||||
AND $this->getData(['user',$userId,'connectFail']) === $this->getData(['config', 'connect', 'attempt']) ) {
|
$this->getData(['user', $userId, 'connectTimeout']) + $this->getData(['config', 'connect', 'timeout']) < time()
|
||||||
$this->setData(['user',$userId,'connectFail',0 ]);
|
and $this->getData(['user', $userId, 'connectFail']) === $this->getData(['config', 'connect', 'attempt'])
|
||||||
$this->setData(['user',$userId,'connectTimeout',0 ]);
|
) {
|
||||||
|
$this->setData(['user', $userId, 'connectFail', 0]);
|
||||||
|
$this->setData(['user', $userId, 'connectTimeout', 0]);
|
||||||
}
|
}
|
||||||
// Check la présence des variables et contrôle du blocage du compte si valeurs dépassées
|
// Check la présence des variables et contrôle du blocage du compte si valeurs dépassées
|
||||||
// Vérification du mot de passe et du groupe
|
// Vérification du mot de passe et du groupe
|
||||||
if (
|
if (
|
||||||
( $this->getData(['user',$userId,'connectTimeout']) + $this->getData(['config', 'connect', 'timeout']) ) < time()
|
($this->getData(['user', $userId, 'connectTimeout']) + $this->getData(['config', 'connect', 'timeout'])) < time()
|
||||||
AND $this->getData(['user',$userId,'connectFail']) < $this->getData(['config', 'connect', 'attempt'])
|
and $this->getData(['user', $userId, 'connectFail']) < $this->getData(['config', 'connect', 'attempt'])
|
||||||
AND password_verify($this->getInput('userLoginPassword', helper::FILTER_STRING_SHORT, true), $this->getData(['user', $userId, 'password']))
|
and password_verify($this->getInput('userLoginPassword', helper::FILTER_STRING_SHORT, true), $this->getData(['user', $userId, 'password']))
|
||||||
AND $this->getData(['user', $userId, 'group']) >= self::GROUP_MEMBER
|
and $this->getData(['user', $userId, 'group']) >= self::GROUP_MEMBER
|
||||||
AND $captcha === true
|
and $captcha === true
|
||||||
) {
|
) {
|
||||||
// RAZ
|
// RAZ
|
||||||
$this->setData(['user',$userId,'connectFail',0 ]);
|
$this->setData(['user', $userId, 'connectFail', 0]);
|
||||||
$this->setData(['user',$userId,'connectTimeout',0 ]);
|
$this->setData(['user', $userId, 'connectTimeout', 0]);
|
||||||
// Expiration
|
// Expiration
|
||||||
$expire = $this->getInput('userLoginLongTime') ? strtotime("+1 year") : 0;
|
$expire = $this->getInput('userLoginLongTime') ? strtotime("+1 year") : 0;
|
||||||
$c = $this->getInput('userLoginLongTime', helper::FILTER_BOOLEAN) === true ? 'true' : 'false';
|
$c = $this->getInput('userLoginLongTime', helper::FILTER_BOOLEAN) === true ? 'true' : 'false';
|
||||||
setcookie('ZWII_USER_ID', $userId, $expire, helper::baseUrl(false, false) , '', helper::isHttps(), true);
|
setcookie('ZWII_USER_ID', $userId, $expire, helper::baseUrl(false, false), '', helper::isHttps(), true);
|
||||||
setcookie('ZWII_USER_PASSWORD', $this->getData(['user', $userId, 'password']), $expire, helper::baseUrl(false, false), '', helper::isHttps(), true);
|
setcookie('ZWII_USER_PASSWORD', $this->getData(['user', $userId, 'password']), $expire, helper::baseUrl(false, false), '', helper::isHttps(), true);
|
||||||
setcookie('ZWII_USER_LONGTIME', $c, $expire, helper::baseUrl(false, false), '', helper::isHttps(), true);
|
setcookie('ZWII_USER_LONGTIME', $c, $expire, helper::baseUrl(false, false), '', helper::isHttps(), true);
|
||||||
// Accès multiples avec le même compte
|
// Accès multiples avec le même compte
|
||||||
$this->setData(['user',$userId,'accessCsrf',$_SESSION['csrf']]);
|
$this->setData(['user', $userId, 'accessCsrf', $_SESSION['csrf']]);
|
||||||
// Valeurs en sortie lorsque le site est en maintenance et que l'utilisateur n'est pas administrateur
|
// Valeurs en sortie lorsque le site est en maintenance et que l'utilisateur n'est pas administrateur
|
||||||
if(
|
if (
|
||||||
$this->getData(['config', 'maintenance'])
|
$this->getData(['config', 'maintenance'])
|
||||||
AND $this->getData(['user', $userId, 'group']) < self::GROUP_ADMIN
|
and $this->getData(['user', $userId, 'group']) < self::GROUP_ADMIN
|
||||||
) {
|
) {
|
||||||
$this->addOutput([
|
$this->addOutput([
|
||||||
'notification' => 'Seul un administrateur peut se connecter lors d\'une maintenance',
|
'notification' => 'Seul un administrateur peut se connecter lors d\'une maintenance',
|
||||||
|
@ -457,7 +465,7 @@ class user extends common {
|
||||||
$logStatus = 'Connexion réussie';
|
$logStatus = 'Connexion réussie';
|
||||||
// Valeurs en sortie
|
// Valeurs en sortie
|
||||||
$this->addOutput([
|
$this->addOutput([
|
||||||
'notification' => 'Bienvenue ' . $this->getData(['user',$userId,'firstname']) . ' ' . $this->getData(['user',$userId,'lastname']) ,
|
'notification' => 'Bienvenue ' . $this->getData(['user', $userId, 'firstname']) . ' ' . $this->getData(['user', $userId, 'lastname']),
|
||||||
'redirect' => helper::baseUrl() . str_replace('_', '/', str_replace('__', '#', $this->getUrl(2))),
|
'redirect' => helper::baseUrl() . str_replace('_', '/', str_replace('__', '#', $this->getUrl(2))),
|
||||||
'state' => true
|
'state' => true
|
||||||
]);
|
]);
|
||||||
|
@ -467,15 +475,15 @@ class user extends common {
|
||||||
$notification = 'Captcha, identifiant ou mot de passe incorrects';
|
$notification = 'Captcha, identifiant ou mot de passe incorrects';
|
||||||
$logStatus = $captcha === true ? 'Erreur de mot de passe' : 'Erreur de captcha';
|
$logStatus = $captcha === true ? 'Erreur de mot de passe' : 'Erreur de captcha';
|
||||||
// Cas 1 le nombre de connexions est inférieur aux tentatives autorisées : incrément compteur d'échec
|
// Cas 1 le nombre de connexions est inférieur aux tentatives autorisées : incrément compteur d'échec
|
||||||
if ($this->getData(['user',$userId,'connectFail']) < $this->getData(['config', 'connect', 'attempt'])) {
|
if ($this->getData(['user', $userId, 'connectFail']) < $this->getData(['config', 'connect', 'attempt'])) {
|
||||||
$this->setData(['user',$userId,'connectFail',$this->getdata(['user',$userId,'connectFail']) + 1 ]);
|
$this->setData(['user', $userId, 'connectFail', $this->getdata(['user', $userId, 'connectFail']) + 1]);
|
||||||
}
|
}
|
||||||
// Cas 2 la limite du nombre de connexion est atteinte : placer le timer
|
// Cas 2 la limite du nombre de connexion est atteinte : placer le timer
|
||||||
if ( $this->getdata(['user',$userId,'connectFail']) == $this->getData(['config', 'connect', 'attempt']) ) {
|
if ($this->getdata(['user', $userId, 'connectFail']) == $this->getData(['config', 'connect', 'attempt'])) {
|
||||||
$this->setData(['user',$userId,'connectTimeout', time()]);
|
$this->setData(['user', $userId, 'connectTimeout', time()]);
|
||||||
}
|
}
|
||||||
// Cas 3 le délai de bloquage court
|
// Cas 3 le délai de bloquage court
|
||||||
if ($this->getData(['user',$userId,'connectTimeout']) + $this->getData(['config', 'connect', 'timeout']) > time() ) {
|
if ($this->getData(['user', $userId, 'connectTimeout']) + $this->getData(['config', 'connect', 'timeout']) > time()) {
|
||||||
$notification = 'Accès bloqué ' . ($this->getData(['config', 'connect', 'timeout']) / 60) . ' minutes.';
|
$notification = 'Accès bloqué ' . ($this->getData(['config', 'connect', 'timeout']) / 60) . ' minutes.';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -486,18 +494,20 @@ class user extends common {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Journalisation
|
// Journalisation
|
||||||
$dataLog = mb_detect_encoding(strftime('%d/%m/%y',time()), 'UTF-8', true)
|
$dataLog = mb_detect_encoding(\PHP81_BC\strftime('%d/%m/%y', time()), 'UTF-8', true)
|
||||||
? strftime('%d/%m/%y',time()) . ';' . strftime('%R',time()) . ';'
|
? \PHP81_BC\strftime('%d/%m/%y', time()) . ';' . \PHP81_BC\strftime('%R', time()) . ';'
|
||||||
: utf8_encode(strftime('%d/%m/%y',time())) . ';' . utf8_encode(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 .= helper::getIp($this->getData(['config', 'connect', 'anonymousIp'])) . ';';
|
||||||
$dataLog .= $this->getInput('userLoginId', helper::FILTER_ID) . ';' ;
|
$dataLog .= empty($this->getInput('userLoginId')) ? ';' : $this->getInput('userLoginId', helper::FILTER_ID) . ';';
|
||||||
$dataLog .= $this->getUrl() .';' ;
|
$dataLog .= $this->getUrl() . ';';
|
||||||
$dataLog .= $logStatus ;
|
$dataLog .= $logStatus;
|
||||||
$dataLog .= PHP_EOL;
|
$dataLog .= PHP_EOL;
|
||||||
if ($this->getData(['config','connect','log'])) {
|
if ($this->getData(['config', 'connect', 'log'])) {
|
||||||
file_put_contents(self::DATA_DIR . 'journal.log', $dataLog, FILE_APPEND);
|
file_put_contents(self::DATA_DIR . 'journal.log', $dataLog, FILE_APPEND);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Stockage des cookies
|
// Stockage des cookies
|
||||||
if (!empty($_COOKIE['ZWII_USER_ID'])) {
|
if (!empty($_COOKIE['ZWII_USER_ID'])) {
|
||||||
self::$userId = $_COOKIE['ZWII_USER_ID'];
|
self::$userId = $_COOKIE['ZWII_USER_ID'];
|
||||||
|
@ -516,10 +526,13 @@ class user extends common {
|
||||||
/**
|
/**
|
||||||
* Déconnexion
|
* Déconnexion
|
||||||
*/
|
*/
|
||||||
public function logout() {
|
public function logout()
|
||||||
|
{
|
||||||
// Ne pas effacer l'identifiant mais seulement le mot de passe
|
// Ne pas effacer l'identifiant mais seulement le mot de passe
|
||||||
if (array_key_exists('ZWII_USER_LONGTIME',$_COOKIE)
|
if (
|
||||||
AND $_COOKIE['ZWII_USER_LONGTIME'] !== 'true' ) {
|
array_key_exists('ZWII_USER_LONGTIME', $_COOKIE)
|
||||||
|
and $_COOKIE['ZWII_USER_LONGTIME'] !== 'true'
|
||||||
|
) {
|
||||||
helper::deleteCookie('ZWII_USER_ID');
|
helper::deleteCookie('ZWII_USER_ID');
|
||||||
helper::deleteCookie('ZWII_USER_LONGTIME');
|
helper::deleteCookie('ZWII_USER_LONGTIME');
|
||||||
}
|
}
|
||||||
|
@ -536,15 +549,16 @@ class user extends common {
|
||||||
/**
|
/**
|
||||||
* Réinitialisation du mot de passe
|
* Réinitialisation du mot de passe
|
||||||
*/
|
*/
|
||||||
public function reset() {
|
public function reset()
|
||||||
|
{
|
||||||
// Accès refusé
|
// Accès refusé
|
||||||
if(
|
if (
|
||||||
// L'utilisateur n'existe pas
|
// L'utilisateur n'existe pas
|
||||||
$this->getData(['user', $this->getUrl(2)]) === null
|
$this->getData(['user', $this->getUrl(2)]) === null
|
||||||
// Lien de réinitialisation trop vieux
|
// Lien de réinitialisation trop vieux
|
||||||
OR $this->getData(['user', $this->getUrl(2), 'forgot']) + 86400 < time()
|
or $this->getData(['user', $this->getUrl(2), 'forgot']) + 86400 < time()
|
||||||
// Id unique incorrecte
|
// Id unique incorrecte
|
||||||
OR $this->getUrl(3) !== md5(json_encode($this->getData(['user', $this->getUrl(2)])))
|
or $this->getUrl(3) !== md5(json_encode($this->getData(['user', $this->getUrl(2)])))
|
||||||
) {
|
) {
|
||||||
// Valeurs en sortie
|
// Valeurs en sortie
|
||||||
$this->addOutput([
|
$this->addOutput([
|
||||||
|
@ -554,15 +568,14 @@ class user extends common {
|
||||||
// Accès autorisé
|
// Accès autorisé
|
||||||
else {
|
else {
|
||||||
// Soumission du formulaire
|
// Soumission du formulaire
|
||||||
if($this->isPost()) {
|
if ($this->isPost()) {
|
||||||
// Double vérification pour le mot de passe
|
// Double vérification pour le mot de passe
|
||||||
if($this->getInput('userResetNewPassword')) {
|
if ($this->getInput('userResetNewPassword')) {
|
||||||
// La confirmation ne correspond pas au mot de passe
|
// La confirmation ne correspond pas au mot de passe
|
||||||
if($this->getInput('userResetNewPassword', helper::FILTER_STRING_SHORT, true) !== $this->getInput('userResetConfirmPassword', helper::FILTER_STRING_SHORT, true)) {
|
if ($this->getInput('userResetNewPassword', helper::FILTER_STRING_SHORT, true) !== $this->getInput('userResetConfirmPassword', helper::FILTER_STRING_SHORT, true)) {
|
||||||
$newPassword = $this->getData(['user', $this->getUrl(2), 'password']);
|
$newPassword = $this->getData(['user', $this->getUrl(2), 'password']);
|
||||||
self::$inputNotices['userResetConfirmPassword'] = 'Incorrect';
|
self::$inputNotices['userResetConfirmPassword'] = 'Incorrect';
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
$newPassword = $this->getInput('userResetNewPassword', helper::FILTER_PASSWORD, true);
|
$newPassword = $this->getInput('userResetNewPassword', helper::FILTER_PASSWORD, true);
|
||||||
}
|
}
|
||||||
// Modifie le mot de passe
|
// Modifie le mot de passe
|
||||||
|
@ -570,8 +583,8 @@ class user extends common {
|
||||||
// Réinitialise la date de la demande
|
// Réinitialise la date de la demande
|
||||||
$this->setData(['user', $this->getUrl(2), 'forgot', 0]);
|
$this->setData(['user', $this->getUrl(2), 'forgot', 0]);
|
||||||
// Réinitialise le blocage
|
// Réinitialise le blocage
|
||||||
$this->setData(['user', $this->getUrl(2),'connectFail',0 ]);
|
$this->setData(['user', $this->getUrl(2), 'connectFail', 0]);
|
||||||
$this->setData(['user', $this->getUrl(2),'connectTimeout',0 ]);
|
$this->setData(['user', $this->getUrl(2), 'connectTimeout', 0]);
|
||||||
// Valeurs en sortie
|
// Valeurs en sortie
|
||||||
$this->addOutput([
|
$this->addOutput([
|
||||||
'notification' => 'Nouveau mot de passe enregistré',
|
'notification' => 'Nouveau mot de passe enregistré',
|
||||||
|
@ -593,66 +606,69 @@ class user extends common {
|
||||||
/**
|
/**
|
||||||
* Importation CSV d'utilisateurs
|
* Importation CSV d'utilisateurs
|
||||||
*/
|
*/
|
||||||
public function import() {
|
public function import()
|
||||||
|
{
|
||||||
// Soumission du formulaire
|
// Soumission du formulaire
|
||||||
$notification = '';
|
$notification = '';
|
||||||
$success = true;
|
$success = true;
|
||||||
if($this->isPost()) {
|
if ($this->isPost()) {
|
||||||
// Lecture du CSV et construction du tableau
|
// Lecture du CSV et construction du tableau
|
||||||
$file = $this->getInput('userImportCSVFile',helper::FILTER_STRING_SHORT, true);
|
$file = $this->getInput('userImportCSVFile', helper::FILTER_STRING_SHORT, true);
|
||||||
$filePath = self::FILE_DIR . 'source/' . $file;
|
$filePath = self::FILE_DIR . 'source/' . $file;
|
||||||
if ($file AND file_exists($filePath)) {
|
if ($file and file_exists($filePath)) {
|
||||||
// Analyse et extraction du CSV
|
// Analyse et extraction du CSV
|
||||||
$rows = array_map(function($row) { return str_getcsv($row, $this->getInput('userImportSeparator') ); }, file($filePath));
|
$rows = array_map(function ($row) {
|
||||||
|
return str_getcsv($row, $this->getInput('userImportSeparator'));
|
||||||
|
}, file($filePath));
|
||||||
$header = array_shift($rows);
|
$header = array_shift($rows);
|
||||||
$csv = array();
|
$csv = array();
|
||||||
foreach($rows as $row) {
|
foreach ($rows as $row) {
|
||||||
$csv[] = array_combine($header, $row);
|
$csv[] = array_combine($header, $row);
|
||||||
}
|
}
|
||||||
// Traitement des données
|
// Traitement des données
|
||||||
foreach($csv as $item ) {
|
foreach ($csv as $item) {
|
||||||
// Données valides
|
// Données valides
|
||||||
if( array_key_exists('id', $item)
|
if (
|
||||||
AND array_key_exists('prenom',$item)
|
array_key_exists('id', $item)
|
||||||
AND array_key_exists('nom',$item)
|
and array_key_exists('prenom', $item)
|
||||||
AND array_key_exists('groupe',$item)
|
and array_key_exists('nom', $item)
|
||||||
AND array_key_exists('email',$item)
|
and array_key_exists('groupe', $item)
|
||||||
AND $item['nom']
|
and array_key_exists('email', $item)
|
||||||
AND $item['prenom']
|
and $item['nom']
|
||||||
AND $item['id']
|
and $item['prenom']
|
||||||
AND $item['email']
|
and $item['id']
|
||||||
AND $item['groupe']
|
and $item['email']
|
||||||
|
and $item['groupe']
|
||||||
) {
|
) {
|
||||||
// Validation du groupe
|
// Validation du groupe
|
||||||
$item['groupe'] = (int) $item['groupe'];
|
$item['groupe'] = (int) $item['groupe'];
|
||||||
$item['groupe'] = ( $item['groupe'] >= self::GROUP_BANNED AND $item['groupe'] <= self::GROUP_ADMIN )
|
$item['groupe'] = ($item['groupe'] >= self::GROUP_BANNED and $item['groupe'] <= self::GROUP_ADMIN)
|
||||||
? $item['groupe'] : 1;
|
? $item['groupe'] : 1;
|
||||||
// L'utilisateur existe
|
// L'utilisateur existe
|
||||||
if ( $this->getData(['user',helper::filter($item['id'] , helper::FILTER_ID)]))
|
if ($this->getData(['user', helper::filter($item['id'], helper::FILTER_ID)])) {
|
||||||
{
|
|
||||||
// Notification du doublon
|
// Notification du doublon
|
||||||
$item['notification'] = template::ico('cancel');
|
$item['notification'] = template::ico('cancel');
|
||||||
// Création du tableau de confirmation
|
// Création du tableau de confirmation
|
||||||
self::$users[] = [
|
self::$users[] = [
|
||||||
helper::filter($item['id'] , helper::FILTER_ID),
|
helper::filter($item['id'], helper::FILTER_ID),
|
||||||
$item['nom'],
|
$item['nom'],
|
||||||
$item['prenom'],
|
$item['prenom'],
|
||||||
self::$groups[$item['groupe']],
|
self::$groups[$item['groupe']],
|
||||||
$item['prenom'],
|
$item['prenom'],
|
||||||
helper::filter($item['email'] , helper::FILTER_MAIL),
|
helper::filter($item['email'], helper::FILTER_MAIL),
|
||||||
$item['notification']
|
$item['notification']
|
||||||
];
|
];
|
||||||
// L'utilisateur n'existe pas
|
// L'utilisateur n'existe pas
|
||||||
} else {
|
} else {
|
||||||
// Nettoyage de l'identifiant
|
// Nettoyage de l'identifiant
|
||||||
$userId = helper::filter($item['id'] , helper::FILTER_ID);
|
$userId = helper::filter($item['id'], helper::FILTER_ID);
|
||||||
// Enregistre le user
|
// Enregistre le user
|
||||||
$create = $this->setData([
|
$create = $this->setData([
|
||||||
'user',
|
'user',
|
||||||
$userId, [
|
$userId, [
|
||||||
'firstname' => $item['prenom'],
|
'firstname' => $item['prenom'],
|
||||||
'forgot' => 0,
|
'forgot' => 0,
|
||||||
'group' => $item['groupe'] ,
|
'group' => $item['groupe'],
|
||||||
'lastname' => $item['nom'],
|
'lastname' => $item['nom'],
|
||||||
'mail' => $item['email'],
|
'mail' => $item['email'],
|
||||||
'pseudo' => $item['prenom'],
|
'pseudo' => $item['prenom'],
|
||||||
|
@ -663,12 +679,15 @@ class user extends common {
|
||||||
"accessUrl" => null,
|
"accessUrl" => null,
|
||||||
"accessTimer" => null,
|
"accessTimer" => null,
|
||||||
"accessCsrf" => null
|
"accessCsrf" => null
|
||||||
]]);
|
]
|
||||||
|
]);
|
||||||
// Icône de notification
|
// Icône de notification
|
||||||
$item['notification'] = $create ? template::ico('check') : template::ico('cancel');
|
$item['notification'] = $create ? template::ico('check') : template::ico('cancel');
|
||||||
// Envoi du mail
|
// Envoi du mail
|
||||||
if ($create
|
if (
|
||||||
AND $this->getInput('userImportNotification',helper::FILTER_BOOLEAN) === true) {
|
$create
|
||||||
|
and $this->getInput('userImportNotification', helper::FILTER_BOOLEAN) === true
|
||||||
|
) {
|
||||||
$sent = $this->sendMail(
|
$sent = $this->sendMail(
|
||||||
$item['email'],
|
$item['email'],
|
||||||
'Compte créé sur ' . $this->getData(['locale', 'title']),
|
'Compte créé sur ' . $this->getData(['locale', 'title']),
|
||||||
|
@ -679,7 +698,7 @@ class user extends common {
|
||||||
);
|
);
|
||||||
if ($sent === true) {
|
if ($sent === true) {
|
||||||
// Mail envoyé changement de l'icône
|
// Mail envoyé changement de l'icône
|
||||||
$item['notification'] = template::ico('mail') ;
|
$item['notification'] = template::ico('mail');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Création du tableau de confirmation
|
// Création du tableau de confirmation
|
||||||
|
@ -696,10 +715,10 @@ class user extends common {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (empty(self::$users)) {
|
if (empty(self::$users)) {
|
||||||
$notification = 'Rien à importer, erreur de format ou fichier incorrect' ;
|
$notification = 'Rien à importer, erreur de format ou fichier incorrect';
|
||||||
$success = false;
|
$success = false;
|
||||||
} else {
|
} else {
|
||||||
$notification = 'Importation effectuée' ;
|
$notification = 'Importation effectuée';
|
||||||
$success = true;
|
$success = true;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -715,5 +734,4 @@ class user extends common {
|
||||||
'state' => $success
|
'state' => $success
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -15,7 +15,7 @@
|
||||||
|
|
||||||
class blog extends common {
|
class blog extends common {
|
||||||
|
|
||||||
const VERSION = '5.3';
|
const VERSION = '5.4';
|
||||||
const REALNAME = 'Blog';
|
const REALNAME = 'Blog';
|
||||||
const DATADIRECTORY = ''; // Contenu localisé inclus par défaut (page.json et module.json)
|
const DATADIRECTORY = ''; // Contenu localisé inclus par défaut (page.json et module.json)
|
||||||
|
|
||||||
|
@ -109,7 +109,8 @@ class blog extends common {
|
||||||
*/
|
*/
|
||||||
private function update() {
|
private function update() {
|
||||||
// Version 5.0
|
// Version 5.0
|
||||||
if (version_compare($this->getData(['module', $this->getUrl(0), 'config', 'versionData']), '5.0', '<') ) {
|
if (is_null($this->getData(['module', $this->getUrl(0), 'config', 'versionData'])) ||
|
||||||
|
version_compare($this->getData(['module', $this->getUrl(0), 'config', 'versionData']), '5.0', '<') ) {
|
||||||
$this->setData(['module', $this->getUrl(0), 'config', 'itemsperPage', 6]);
|
$this->setData(['module', $this->getUrl(0), 'config', 'itemsperPage', 6]);
|
||||||
$this->setData(['module', $this->getUrl(0), 'config', 'versionData','5.0']);
|
$this->setData(['module', $this->getUrl(0), 'config', 'versionData','5.0']);
|
||||||
}
|
}
|
||||||
|
@ -202,7 +203,7 @@ class blog extends common {
|
||||||
$this->getUrl(0),
|
$this->getUrl(0),
|
||||||
'posts',
|
'posts',
|
||||||
$articleId, [
|
$articleId, [
|
||||||
'comment' => $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(2), 'comment']),
|
'comment' => [],
|
||||||
'content' => $this->getInput('blogAddContent', null),
|
'content' => $this->getInput('blogAddContent', null),
|
||||||
'picture' => $this->getInput('blogAddPicture', helper::FILTER_STRING_SHORT, true),
|
'picture' => $this->getInput('blogAddPicture', helper::FILTER_STRING_SHORT, true),
|
||||||
'hidePicture' => $this->getInput('blogAddHidePicture', helper::FILTER_BOOLEAN),
|
'hidePicture' => $this->getInput('blogAddHidePicture', helper::FILTER_BOOLEAN),
|
||||||
|
@ -277,10 +278,16 @@ class blog extends common {
|
||||||
'value' => $comment['approval'] === true ? 'A' : 'R'
|
'value' => $comment['approval'] === true ? 'A' : 'R'
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
//Date et heure
|
||||||
|
$gdh = mb_detect_encoding(\PHP81_BC\strftime('%d %B %Y', $comment['createdOn']), 'UTF-8', true)
|
||||||
|
? \PHP81_BC\strftime('%d %B %Y ', $comment['createdOn'])
|
||||||
|
: utf8_encode(\PHP81_BC\strftime('%d %B %Y', $comment['createdOn']));
|
||||||
|
$gdh .= ' - ';
|
||||||
|
$gdh .= mb_detect_encoding(\PHP81_BC\strftime('%H:%M', $comment['createdOn']), 'UTF-8', true)
|
||||||
|
? \PHP81_BC\strftime('%H:%M', $comment['createdOn'])
|
||||||
|
: utf8_encode(\PHP81_BC\strftime('%H:%M', $comment['createdOn']));
|
||||||
self::$comments[] = [
|
self::$comments[] = [
|
||||||
mb_detect_encoding(strftime('%d %B %Y - %H:%M', $comment['createdOn']), 'UTF-8', true)
|
$gdh,
|
||||||
? strftime('%d %B %Y - %H:%M', $comment['createdOn'])
|
|
||||||
: utf8_encode(strftime('%d %B %Y - %H:%M', $comment['createdOn'])),
|
|
||||||
$comment['content'],
|
$comment['content'],
|
||||||
$comment['userId'] ? $this->getData(['user', $comment['userId'], 'firstname']) . ' ' . $this->getData(['user', $comment['userId'], 'lastname']) : $comment['author'],
|
$comment['userId'] ? $this->getData(['user', $comment['userId'], 'firstname']) . ' ' . $this->getData(['user', $comment['userId'], 'lastname']) : $comment['author'],
|
||||||
$buttonApproval,
|
$buttonApproval,
|
||||||
|
@ -456,12 +463,12 @@ class blog extends common {
|
||||||
$approved = count($this->getData(['module', $this->getUrl(0), 'posts', $articleIds[$i],'comment']));
|
$approved = count($this->getData(['module', $this->getUrl(0), 'posts', $articleIds[$i],'comment']));
|
||||||
}
|
}
|
||||||
// Met en forme le tableau
|
// 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)
|
$date = mb_detect_encoding(\PHP81_BC\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']))
|
? \PHP81_BC\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'])));
|
: utf8_encode(\PHP81_BC\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)
|
$heure = mb_detect_encoding(\PHP81_BC\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']))
|
? \PHP81_BC\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'])));
|
: utf8_encode(\PHP81_BC\strftime('%H:%M', $this->getData(['module', $this->getUrl(0), 'posts', $articleIds[$i], 'publishedOn'])));
|
||||||
self::$articles[] = [
|
self::$articles[] = [
|
||||||
'<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']) .
|
||||||
|
|
|
@ -14,12 +14,12 @@
|
||||||
<!-- bloc signature et date -->
|
<!-- bloc signature et date -->
|
||||||
<?php echo $module::$articleSignature . ' - ';?>
|
<?php echo $module::$articleSignature . ' - ';?>
|
||||||
<?php echo template::ico('calendar-empty'); ?>
|
<?php echo template::ico('calendar-empty'); ?>
|
||||||
<?php $date = mb_detect_encoding(strftime('%d %B %Y', $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'publishedOn'])), 'UTF-8', true)
|
<?php $date = mb_detect_encoding(\PHP81_BC\strftime('%d %B %Y', $this->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']))
|
? \PHP81_BC\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'])));
|
: utf8_encode(\PHP81_BC\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)
|
$heure = mb_detect_encoding(\PHP81_BC\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']))
|
? \PHP81_BC\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'])));
|
: utf8_encode(\PHP81_BC\strftime('%H:%M', $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'publishedOn'])));
|
||||||
echo $date . ' à ' . $heure;
|
echo $date . ' à ' . $heure;
|
||||||
?>
|
?>
|
||||||
<!-- Bloc edition -->
|
<!-- Bloc edition -->
|
||||||
|
@ -143,9 +143,9 @@
|
||||||
<?php foreach($module::$comments as $commentId => $comment): ?>
|
<?php foreach($module::$comments as $commentId => $comment): ?>
|
||||||
<div class="block">
|
<div class="block">
|
||||||
<h4><?php echo $module::$commentsSignature[$commentId]; ?>
|
<h4><?php echo $module::$commentsSignature[$commentId]; ?>
|
||||||
le <?php echo mb_detect_encoding(strftime('%d %B %Y - %H:%M', $comment['createdOn']), 'UTF-8', true)
|
le <?php echo mb_detect_encoding(\PHP81_BC\strftime('%d %B %Y - %H:%M', $comment['createdOn']), 'UTF-8', true)
|
||||||
? strftime('%d %B %Y - %H:%M', $comment['createdOn'])
|
? \PHP81_BC\strftime('%d %B %Y - %H:%M', $comment['createdOn'])
|
||||||
: utf8_encode(strftime('%d %B %Y - %H:%M', $comment['createdOn']));
|
: utf8_encode(\PHP81_BC\strftime('%d %B %Y - %H:%M', $comment['createdOn']));
|
||||||
?>
|
?>
|
||||||
</h4>
|
</h4>
|
||||||
<?php echo $comment['content']; ?>
|
<?php echo $comment['content']; ?>
|
||||||
|
|
|
@ -36,9 +36,16 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="blogDate">
|
<div class="blogDate">
|
||||||
<?php echo template::ico('calendar-empty'); ?>
|
<?php echo template::ico('calendar-empty'); ?>
|
||||||
<?php echo mb_detect_encoding(strftime('%d %B %Y - %H:%M', $article['publishedOn']), 'UTF-8', true)
|
<?php
|
||||||
? strftime('%d %B %Y', $article['publishedOn'])
|
// Date et heure
|
||||||
: utf8_encode(strftime('%d %B %Y', $article['publishedOn'])); ?>
|
echo mb_detect_encoding(\PHP81_BC\strftime('%d %B %Y', $article['publishedOn']), 'UTF-8', true)
|
||||||
|
? \PHP81_BC\strftime('%d %B %Y', $article['publishedOn'])
|
||||||
|
: utf8_encode(\PHP81_BC\strftime('%d %B %Y', $article['publishedOn']));
|
||||||
|
echo ' - ';
|
||||||
|
echo mb_detect_encoding(\PHP81_BC\strftime('%H:%M',$article['publishedOn']), 'UTF-8', true)
|
||||||
|
? \PHP81_BC\strftime('%H:%M', $article['publishedOn'])
|
||||||
|
: utf8_encode(\PHP81_BC\strftime('%H:%M', $article['publishedOn']));
|
||||||
|
?>
|
||||||
</div>
|
</div>
|
||||||
<p class="blogContent">
|
<p class="blogContent">
|
||||||
<?php echo helper::subword(strip_tags($article['content'],'<br><p>'), 0, 400); ?>...
|
<?php echo helper::subword(strip_tags($article['content'],'<br><p>'), 0, 400); ?>...
|
||||||
|
|
|
@ -367,6 +367,7 @@ class gallery extends common {
|
||||||
// définir une vignette par défaut
|
// définir une vignette par défaut
|
||||||
$directory = $this->getInput('galleryConfigDirectory', helper::FILTER_STRING_SHORT, true);
|
$directory = $this->getInput('galleryConfigDirectory', helper::FILTER_STRING_SHORT, true);
|
||||||
$iterator = new DirectoryIterator($directory);
|
$iterator = new DirectoryIterator($directory);
|
||||||
|
$homePicture = '';
|
||||||
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())) {
|
||||||
// Créer la miniature si manquante
|
// Créer la miniature si manquante
|
||||||
|
@ -422,6 +423,7 @@ class gallery extends common {
|
||||||
// définir une vignette par défaut
|
// définir une vignette par défaut
|
||||||
$directory = $this->getInput('galleryAddDirectory', helper::FILTER_STRING_SHORT, true);
|
$directory = $this->getInput('galleryAddDirectory', helper::FILTER_STRING_SHORT, true);
|
||||||
$iterator = new DirectoryIterator($directory);
|
$iterator = new DirectoryIterator($directory);
|
||||||
|
$homePicture = '';
|
||||||
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())) {
|
||||||
// Créer la miniature si manquante
|
// Créer la miniature si manquante
|
||||||
|
|
|
@ -240,21 +240,21 @@ class news extends common {
|
||||||
// News en fonction de la pagination
|
// News en fonction de la pagination
|
||||||
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(\PHP81_BC\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']))
|
? \PHP81_BC\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(\PHP81_BC\strftime('%d %B %Y', $this->getData(['module', $this->getUrl(0),'posts', $newsIds[$i], 'publishedOn'])));
|
||||||
$dateOn .= ' à ';
|
$dateOn .= ' à ';
|
||||||
$dateOn .= mb_detect_encoding(strftime('%H:%M', $this->getData(['module', $this->getUrl(0),'posts', $newsIds[$i], 'publishedOn'])), 'UTF-8', true)
|
$dateOn .= mb_detect_encoding(\PHP81_BC\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']))
|
? \PHP81_BC\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(\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'])) {
|
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(\PHP81_BC\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']))
|
? \PHP81_BC\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(\PHP81_BC\strftime('%d %B %Y', $this->getData(['module', $this->getUrl(0),'posts', $newsIds[$i], 'publishedOff'])));
|
||||||
$dateOff .= ' à ';
|
$dateOff .= ' à ';
|
||||||
$dateOff .= mb_detect_encoding(strftime('%H:%M', $this->getData(['module', $this->getUrl(0),'posts', $newsIds[$i], 'publishedOff'])), 'UTF-8', true)
|
$dateOff .= mb_detect_encoding(\PHP81_BC\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']))
|
? \PHP81_BC\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(\PHP81_BC\strftime('%H:%M', $this->getData(['module', $this->getUrl(0),'posts', $newsIds[$i], 'publishedOff'])));
|
||||||
} else {
|
} else {
|
||||||
$dateOff = 'Permanent';
|
$dateOff = 'Permanent';
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,12 +8,12 @@
|
||||||
<!-- bloc signature et date -->
|
<!-- bloc signature et date -->
|
||||||
<?php echo $module::$articleSignature . ' - ';?>
|
<?php echo $module::$articleSignature . ' - ';?>
|
||||||
<?php echo template::ico('calendar-empty'); ?>
|
<?php echo template::ico('calendar-empty'); ?>
|
||||||
<?php $date = mb_detect_encoding(strftime('%d %B %Y', $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'publishedOn'])), 'UTF-8', true)
|
<?php $date = mb_detect_encoding(\PHP81_BC\strftime('%d %B %Y', $this->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']))
|
? \PHP81_BC\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'])));
|
: utf8_encode(\PHP81_BC\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)
|
$heure = mb_detect_encoding(\PHP81_BC\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']))
|
? \PHP81_BC\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'])));
|
: utf8_encode(\PHP81_BC\strftime('%H:%M', $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'publishedOn'])));
|
||||||
echo $date . ' à ' . $heure;
|
echo $date . ' à ' . $heure;
|
||||||
?>
|
?>
|
||||||
<!-- Bloc edition -->
|
<!-- Bloc edition -->
|
||||||
|
|
|
@ -14,9 +14,9 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="newsSignature">
|
<div class="newsSignature">
|
||||||
<?php echo template::ico('calendar-empty'); ?>
|
<?php echo template::ico('calendar-empty'); ?>
|
||||||
<?php echo mb_detect_encoding(strftime('%d %B %Y', $news['publishedOn']), 'UTF-8', true)
|
<?php echo mb_detect_encoding(\PHP81_BC\strftime('%d %B %Y', $news['publishedOn']), 'UTF-8', true)
|
||||||
? strftime('%d %B %Y', $news['publishedOn'])
|
? \PHP81_BC\strftime('%d %B %Y', $news['publishedOn'])
|
||||||
: utf8_encode(strftime('%d %B %Y', $news['publishedOn'])); ?>
|
: utf8_encode(\PHP81_BC\strftime('%d %B %Y', $news['publishedOn'])); ?>
|
||||||
- <?php echo $news['userId']; ?>
|
- <?php echo $news['userId']; ?>
|
||||||
<!-- Bloc edition -->
|
<!-- Bloc edition -->
|
||||||
<?php if (
|
<?php if (
|
||||||
|
|
Loading…
Reference in New Issue