modifications 4105
This commit is contained in:
parent
5550accd83
commit
1a2f789209
|
@ -1,5 +1,10 @@
|
|||
# Changelog
|
||||
|
||||
## Version 4.1.05 de Deltacms
|
||||
- Modifications :
|
||||
- Langues : RFM bilingue anglais / français et quelques compléments de traduction,
|
||||
- Formulaire : avec le module Form possibilité de placer une pièce jointe dans le mail (jpg, jpeg, png ou gif)
|
||||
|
||||
## Version 4.1.04 de Deltacms
|
||||
- Modifications :
|
||||
- Langues : ajout de 4 langues régionales, corse, breton, catalan, basque.
|
||||
|
@ -9,7 +14,7 @@
|
|||
- Statislite : amèioration de l'affichage de la date initiale,
|
||||
- Agenda : si la langue originale du site n'est pas reconnue, la langue d'administration est utilisée,
|
||||
- Blog : dans les labels de Tinymce si la langue originale du site n'est pas reconnue, la langue d'administration est utilisée,
|
||||
- Langues : si le dapeau correspondant au langage du site n'existe pas un drapeau paer défaut est affiché dans les pages de localisation.
|
||||
- Langues : si le dapeau correspondant au langage du site n'existe pas un drapeau par défaut est affiché dans les pages de localisation.
|
||||
- Correction :
|
||||
- Statislite : modification de l'initialisation du filtrage primaire.
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
|
||||
# DeltaCMS 4.1.04
|
||||
# DeltaCMS 4.1.05
|
||||
|
||||
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.
|
||||
|
|
|
@ -321,7 +321,11 @@ class helper {
|
|||
* @return string
|
||||
*/
|
||||
public static function filter($text, $filter) {
|
||||
$text = trim($text);
|
||||
if( isset($text)){
|
||||
$text = trim( $text);
|
||||
} else {
|
||||
$text = '';
|
||||
}
|
||||
switch($filter) {
|
||||
case self::FILTER_BOOLEAN:
|
||||
$text = (bool) $text;
|
||||
|
@ -367,10 +371,12 @@ class helper {
|
|||
$text = password_hash($text, PASSWORD_BCRYPT);
|
||||
break;
|
||||
case self::FILTER_STRING_LONG:
|
||||
$text = mb_substr(filter_var($text, FILTER_SANITIZE_STRING), 0, 500000);
|
||||
// $text = mb_substr(filter_var($text, FILTER_SANITIZE_STRING), 0, 500000);
|
||||
$text = mb_substr( strip_tags($text) , 0, 500000);
|
||||
break;
|
||||
case self::FILTER_STRING_SHORT:
|
||||
$text = mb_substr(filter_var($text, FILTER_SANITIZE_STRING), 0, 500);
|
||||
// $text = mb_substr(filter_var($text, FILTER_SANITIZE_STRING), 0, 500);
|
||||
$text = mb_substr( strip_tags($text) , 0, 500);
|
||||
break;
|
||||
case self::FILTER_TIMESTAMP:
|
||||
$text = date('Y-m-d H:i:s', $text);
|
||||
|
|
|
@ -12,8 +12,6 @@ use ArrayAccess;
|
|||
*/
|
||||
class Dot implements ArrayAccess
|
||||
{
|
||||
|
||||
/** @var array Data */
|
||||
protected $data = [];
|
||||
|
||||
/**
|
||||
|
@ -271,21 +269,22 @@ class Dot implements ArrayAccess
|
|||
/**
|
||||
* ArrayAccess abstract methods
|
||||
*/
|
||||
#[\ReturnTypeWillChange]
|
||||
public function offsetSet($offset, $value)
|
||||
{
|
||||
$this->set($offset, $value);
|
||||
}
|
||||
|
||||
#[\ReturnTypeWillChange]
|
||||
public function offsetExists($offset)
|
||||
{
|
||||
return $this->has($offset);
|
||||
}
|
||||
|
||||
#[\ReturnTypeWillChange]
|
||||
public function offsetGet($offset)
|
||||
{
|
||||
return $this->get($offset);
|
||||
}
|
||||
|
||||
#[\ReturnTypeWillChange]
|
||||
public function offsetUnset($offset)
|
||||
{
|
||||
$this->delete($offset);
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* PHPMailer Exception class.
|
||||
* PHP Version 5.5.
|
||||
|
@ -9,7 +10,7 @@
|
|||
* @author Jim Jagielski (jimjag) <jimjag@gmail.com>
|
||||
* @author Andy Prevost (codeworxtech) <codeworxtech@users.sourceforge.net>
|
||||
* @author Brent R. Matzelle (original founder)
|
||||
* @copyright 2012 - 2017 Marcus Bointon
|
||||
* @copyright 2012 - 2020 Marcus Bointon
|
||||
* @copyright 2010 - 2012 Jim Jagielski
|
||||
* @copyright 2004 - 2009 Andy Prevost
|
||||
* @license http://www.gnu.org/copyleft/lesser.html GNU Lesser General Public License
|
||||
|
@ -34,6 +35,6 @@ class Exception extends \Exception
|
|||
*/
|
||||
public function errorMessage()
|
||||
{
|
||||
return '<strong>' . htmlspecialchars($this->getMessage()) . "</strong><br />\n";
|
||||
return '<strong>' . htmlspecialchars($this->getMessage(), ENT_COMPAT | ENT_HTML401) . "</strong><br />\n";
|
||||
}
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,4 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* PHPMailer RFC821 SMTP email transport class.
|
||||
* PHP Version 5.5.
|
||||
|
@ -9,7 +10,7 @@
|
|||
* @author Jim Jagielski (jimjag) <jimjag@gmail.com>
|
||||
* @author Andy Prevost (codeworxtech) <codeworxtech@users.sourceforge.net>
|
||||
* @author Brent R. Matzelle (original founder)
|
||||
* @copyright 2012 - 2019 Marcus Bointon
|
||||
* @copyright 2012 - 2020 Marcus Bointon
|
||||
* @copyright 2010 - 2012 Jim Jagielski
|
||||
* @copyright 2004 - 2009 Andy Prevost
|
||||
* @license http://www.gnu.org/copyleft/lesser.html GNU Lesser General Public License
|
||||
|
@ -34,7 +35,7 @@ class SMTP
|
|||
*
|
||||
* @var string
|
||||
*/
|
||||
const VERSION = '6.1.5';
|
||||
const VERSION = '6.6.0';
|
||||
|
||||
/**
|
||||
* SMTP line break constant.
|
||||
|
@ -185,6 +186,8 @@ class SMTP
|
|||
'Amazon_SES' => '/[\d]{3} Ok (.*)/',
|
||||
'SendGrid' => '/[\d]{3} Ok: queued as (.*)/',
|
||||
'CampaignMonitor' => '/[\d]{3} 2.0.0 OK:([a-zA-Z\d]{48})/',
|
||||
'Haraka' => '/[\d]{3} Message Queued \((.*)\)/',
|
||||
'Mailjet' => '/[\d]{3} OK queued as (.*)/',
|
||||
];
|
||||
|
||||
/**
|
||||
|
@ -311,17 +314,11 @@ class SMTP
|
|||
*/
|
||||
public function connect($host, $port = null, $timeout = 30, $options = [])
|
||||
{
|
||||
static $streamok;
|
||||
//This is enabled by default since 5.0.0 but some providers disable it
|
||||
//Check this once and cache the result
|
||||
if (null === $streamok) {
|
||||
$streamok = function_exists('stream_socket_client');
|
||||
}
|
||||
// Clear errors to avoid confusion
|
||||
//Clear errors to avoid confusion
|
||||
$this->setError('');
|
||||
// Make sure we are __not__ connected
|
||||
//Make sure we are __not__ connected
|
||||
if ($this->connected()) {
|
||||
// Already connected, generate error
|
||||
//Already connected, generate error
|
||||
$this->setError('Already connected to a server');
|
||||
|
||||
return false;
|
||||
|
@ -329,18 +326,66 @@ class SMTP
|
|||
if (empty($port)) {
|
||||
$port = self::DEFAULT_PORT;
|
||||
}
|
||||
// Connect to the SMTP server
|
||||
//Connect to the SMTP server
|
||||
$this->edebug(
|
||||
"Connection: opening to $host:$port, timeout=$timeout, options=" .
|
||||
(count($options) > 0 ? var_export($options, true) : 'array()'),
|
||||
self::DEBUG_CONNECTION
|
||||
);
|
||||
|
||||
$this->smtp_conn = $this->getSMTPConnection($host, $port, $timeout, $options);
|
||||
|
||||
if ($this->smtp_conn === false) {
|
||||
//Error info already set inside `getSMTPConnection()`
|
||||
return false;
|
||||
}
|
||||
|
||||
$this->edebug('Connection: opened', self::DEBUG_CONNECTION);
|
||||
|
||||
//Get any announcement
|
||||
$this->last_reply = $this->get_lines();
|
||||
$this->edebug('SERVER -> CLIENT: ' . $this->last_reply, self::DEBUG_SERVER);
|
||||
$responseCode = (int)substr($this->last_reply, 0, 3);
|
||||
if ($responseCode === 220) {
|
||||
return true;
|
||||
}
|
||||
//Anything other than a 220 response means something went wrong
|
||||
//RFC 5321 says the server will wait for us to send a QUIT in response to a 554 error
|
||||
//https://tools.ietf.org/html/rfc5321#section-3.1
|
||||
if ($responseCode === 554) {
|
||||
$this->quit();
|
||||
}
|
||||
//This will handle 421 responses which may not wait for a QUIT (e.g. if the server is being shut down)
|
||||
$this->edebug('Connection: closing due to error', self::DEBUG_CONNECTION);
|
||||
$this->close();
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create connection to the SMTP server.
|
||||
*
|
||||
* @param string $host SMTP server IP or host name
|
||||
* @param int $port The port number to connect to
|
||||
* @param int $timeout How long to wait for the connection to open
|
||||
* @param array $options An array of options for stream_context_create()
|
||||
*
|
||||
* @return false|resource
|
||||
*/
|
||||
protected function getSMTPConnection($host, $port = null, $timeout = 30, $options = [])
|
||||
{
|
||||
static $streamok;
|
||||
//This is enabled by default since 5.0.0 but some providers disable it
|
||||
//Check this once and cache the result
|
||||
if (null === $streamok) {
|
||||
$streamok = function_exists('stream_socket_client');
|
||||
}
|
||||
|
||||
$errno = 0;
|
||||
$errstr = '';
|
||||
if ($streamok) {
|
||||
$socket_context = stream_context_create($options);
|
||||
set_error_handler([$this, 'errorHandler']);
|
||||
$this->smtp_conn = stream_socket_client(
|
||||
$connection = stream_socket_client(
|
||||
$host . ':' . $port,
|
||||
$errno,
|
||||
$errstr,
|
||||
|
@ -348,7 +393,6 @@ class SMTP
|
|||
STREAM_CLIENT_CONNECT,
|
||||
$socket_context
|
||||
);
|
||||
restore_error_handler();
|
||||
} else {
|
||||
//Fall back to fsockopen which should work in more places, but is missing some features
|
||||
$this->edebug(
|
||||
|
@ -356,17 +400,18 @@ class SMTP
|
|||
self::DEBUG_CONNECTION
|
||||
);
|
||||
set_error_handler([$this, 'errorHandler']);
|
||||
$this->smtp_conn = fsockopen(
|
||||
$connection = fsockopen(
|
||||
$host,
|
||||
$port,
|
||||
$errno,
|
||||
$errstr,
|
||||
$timeout
|
||||
);
|
||||
restore_error_handler();
|
||||
}
|
||||
// Verify we connected properly
|
||||
if (!is_resource($this->smtp_conn)) {
|
||||
restore_error_handler();
|
||||
|
||||
//Verify we connected properly
|
||||
if (!is_resource($connection)) {
|
||||
$this->setError(
|
||||
'Failed to connect to server',
|
||||
'',
|
||||
|
@ -381,22 +426,19 @@ class SMTP
|
|||
|
||||
return false;
|
||||
}
|
||||
$this->edebug('Connection: opened', self::DEBUG_CONNECTION);
|
||||
// SMTP server can take longer to respond, give longer timeout for first read
|
||||
// Windows does not have support for this timeout function
|
||||
|
||||
//SMTP server can take longer to respond, give longer timeout for first read
|
||||
//Windows does not have support for this timeout function
|
||||
if (strpos(PHP_OS, 'WIN') !== 0) {
|
||||
$max = (int) ini_get('max_execution_time');
|
||||
// Don't bother if unlimited
|
||||
if (0 !== $max && $timeout > $max) {
|
||||
$max = (int)ini_get('max_execution_time');
|
||||
//Don't bother if unlimited, or if set_time_limit is disabled
|
||||
if (0 !== $max && $timeout > $max && strpos(ini_get('disable_functions'), 'set_time_limit') === false) {
|
||||
@set_time_limit($timeout);
|
||||
}
|
||||
stream_set_timeout($this->smtp_conn, $timeout, 0);
|
||||
stream_set_timeout($connection, $timeout, 0);
|
||||
}
|
||||
// Get any announcement
|
||||
$announce = $this->get_lines();
|
||||
$this->edebug('SERVER -> CLIENT: ' . $announce, self::DEBUG_SERVER);
|
||||
|
||||
return true;
|
||||
return $connection;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -420,7 +462,7 @@ class SMTP
|
|||
$crypto_method |= STREAM_CRYPTO_METHOD_TLSv1_1_CLIENT;
|
||||
}
|
||||
|
||||
// Begin encrypted connection
|
||||
//Begin encrypted connection
|
||||
set_error_handler([$this, 'errorHandler']);
|
||||
$crypto_ok = stream_socket_enable_crypto(
|
||||
$this->smtp_conn,
|
||||
|
@ -441,7 +483,7 @@ class SMTP
|
|||
* @param string $username The user name
|
||||
* @param string $password The password
|
||||
* @param string $authtype The auth type (CRAM-MD5, PLAIN, LOGIN, XOAUTH2)
|
||||
* @param OAuth $OAuth An optional OAuth instance for XOAUTH2 authentication
|
||||
* @param OAuthTokenProvider $OAuth An optional OAuthTokenProvider instance for XOAUTH2 authentication
|
||||
*
|
||||
* @return bool True if successfully authenticated
|
||||
*/
|
||||
|
@ -458,11 +500,11 @@ class SMTP
|
|||
}
|
||||
|
||||
if (array_key_exists('EHLO', $this->server_caps)) {
|
||||
// SMTP extensions are available; try to find a proper authentication method
|
||||
//SMTP extensions are available; try to find a proper authentication method
|
||||
if (!array_key_exists('AUTH', $this->server_caps)) {
|
||||
$this->setError('Authentication is not allowed at this stage');
|
||||
// 'at this stage' means that auth may be allowed after the stage changes
|
||||
// e.g. after STARTTLS
|
||||
//'at this stage' means that auth may be allowed after the stage changes
|
||||
//e.g. after STARTTLS
|
||||
|
||||
return false;
|
||||
}
|
||||
|
@ -506,22 +548,25 @@ class SMTP
|
|||
}
|
||||
switch ($authtype) {
|
||||
case 'PLAIN':
|
||||
// Start authentication
|
||||
//Start authentication
|
||||
if (!$this->sendCommand('AUTH', 'AUTH PLAIN', 334)) {
|
||||
return false;
|
||||
}
|
||||
// Send encoded username and password
|
||||
if (!$this->sendCommand(
|
||||
'User & Password',
|
||||
base64_encode("\0" . $username . "\0" . $password),
|
||||
235
|
||||
)
|
||||
//Send encoded username and password
|
||||
if (
|
||||
//Format from https://tools.ietf.org/html/rfc4616#section-2
|
||||
//We skip the first field (it's forgery), so the string starts with a null byte
|
||||
!$this->sendCommand(
|
||||
'User & Password',
|
||||
base64_encode("\0" . $username . "\0" . $password),
|
||||
235
|
||||
)
|
||||
) {
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
case 'LOGIN':
|
||||
// Start authentication
|
||||
//Start authentication
|
||||
if (!$this->sendCommand('AUTH', 'AUTH LOGIN', 334)) {
|
||||
return false;
|
||||
}
|
||||
|
@ -533,17 +578,17 @@ class SMTP
|
|||
}
|
||||
break;
|
||||
case 'CRAM-MD5':
|
||||
// Start authentication
|
||||
//Start authentication
|
||||
if (!$this->sendCommand('AUTH CRAM-MD5', 'AUTH CRAM-MD5', 334)) {
|
||||
return false;
|
||||
}
|
||||
// Get the challenge
|
||||
//Get the challenge
|
||||
$challenge = base64_decode(substr($this->last_reply, 4));
|
||||
|
||||
// Build the response
|
||||
//Build the response
|
||||
$response = $username . ' ' . $this->hmac($challenge, $password);
|
||||
|
||||
// send encoded credentials
|
||||
//send encoded credentials
|
||||
return $this->sendCommand('Username', base64_encode($response), 235);
|
||||
case 'XOAUTH2':
|
||||
//The OAuth instance must be set up prior to requesting auth.
|
||||
|
@ -552,7 +597,7 @@ class SMTP
|
|||
}
|
||||
$oauth = $OAuth->getOauth64();
|
||||
|
||||
// Start authentication
|
||||
//Start authentication
|
||||
if (!$this->sendCommand('AUTH', 'AUTH XOAUTH2 ' . $oauth, 235)) {
|
||||
return false;
|
||||
}
|
||||
|
@ -582,15 +627,15 @@ class SMTP
|
|||
return hash_hmac('md5', $data, $key);
|
||||
}
|
||||
|
||||
// The following borrowed from
|
||||
// http://php.net/manual/en/function.mhash.php#27225
|
||||
//The following borrowed from
|
||||
//http://php.net/manual/en/function.mhash.php#27225
|
||||
|
||||
// RFC 2104 HMAC implementation for php.
|
||||
// Creates an md5 HMAC.
|
||||
// Eliminates the need to install mhash to compute a HMAC
|
||||
// by Lance Rushing
|
||||
//RFC 2104 HMAC implementation for php.
|
||||
//Creates an md5 HMAC.
|
||||
//Eliminates the need to install mhash to compute a HMAC
|
||||
//by Lance Rushing
|
||||
|
||||
$bytelen = 64; // byte length for md5
|
||||
$bytelen = 64; //byte length for md5
|
||||
if (strlen($key) > $bytelen) {
|
||||
$key = pack('H*', md5($key));
|
||||
}
|
||||
|
@ -613,7 +658,7 @@ class SMTP
|
|||
if (is_resource($this->smtp_conn)) {
|
||||
$sock_status = stream_get_meta_data($this->smtp_conn);
|
||||
if ($sock_status['eof']) {
|
||||
// The socket is valid but we are not connected
|
||||
//The socket is valid but we are not connected
|
||||
$this->edebug(
|
||||
'SMTP NOTICE: EOF caught while checking if connected',
|
||||
self::DEBUG_CLIENT
|
||||
|
@ -623,7 +668,7 @@ class SMTP
|
|||
return false;
|
||||
}
|
||||
|
||||
return true; // everything looks good
|
||||
return true; //everything looks good
|
||||
}
|
||||
|
||||
return false;
|
||||
|
@ -641,7 +686,7 @@ class SMTP
|
|||
$this->server_caps = null;
|
||||
$this->helo_rply = null;
|
||||
if (is_resource($this->smtp_conn)) {
|
||||
// close the connection and cleanup
|
||||
//Close the connection and cleanup
|
||||
fclose($this->smtp_conn);
|
||||
$this->smtp_conn = null; //Makes for cleaner serialization
|
||||
$this->edebug('Connection: closed', self::DEBUG_CONNECTION);
|
||||
|
@ -651,7 +696,7 @@ class SMTP
|
|||
/**
|
||||
* Send an SMTP DATA command.
|
||||
* Issues a data command and sends the msg_data to the server,
|
||||
* finializing the mail transaction. $msg_data is the message
|
||||
* finalizing the mail transaction. $msg_data is the message
|
||||
* that is to be send with the headers. Each header needs to be
|
||||
* on a single line followed by a <CRLF> with the message headers
|
||||
* and the message body being separated by an additional <CRLF>.
|
||||
|
@ -676,7 +721,7 @@ class SMTP
|
|||
* NOTE: this does not count towards line-length limit.
|
||||
*/
|
||||
|
||||
// Normalize line breaks before exploding
|
||||
//Normalize line breaks before exploding
|
||||
$lines = explode("\n", str_replace(["\r\n", "\r"], "\n", $msg_data));
|
||||
|
||||
/* To distinguish between a complete RFC822 message and a plain message body, we check if the first field
|
||||
|
@ -722,7 +767,8 @@ class SMTP
|
|||
|
||||
//Send the lines to the server
|
||||
foreach ($lines_out as $line_out) {
|
||||
//RFC2821 section 4.5.2
|
||||
//Dot-stuffing as per RFC5321 section 4.5.2
|
||||
//https://tools.ietf.org/html/rfc5321#section-4.5.2
|
||||
if (!empty($line_out) && $line_out[0] === '.') {
|
||||
$line_out = '.' . $line_out;
|
||||
}
|
||||
|
@ -756,7 +802,16 @@ class SMTP
|
|||
public function hello($host = '')
|
||||
{
|
||||
//Try extended hello first (RFC 2821)
|
||||
return $this->sendHello('EHLO', $host) or $this->sendHello('HELO', $host);
|
||||
if ($this->sendHello('EHLO', $host)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
//Some servers shut down the SMTP service here (RFC 5321)
|
||||
if (substr($this->helo_rply, 0, 3) == '421') {
|
||||
return false;
|
||||
}
|
||||
|
||||
return $this->sendHello('HELO', $host);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -946,12 +1001,12 @@ class SMTP
|
|||
$this->client_send($commandstring . static::LE, $command);
|
||||
|
||||
$this->last_reply = $this->get_lines();
|
||||
// Fetch SMTP code and possible error code explanation
|
||||
//Fetch SMTP code and possible error code explanation
|
||||
$matches = [];
|
||||
if (preg_match('/^([\d]{3})[ -](?:([\d]\\.[\d]\\.[\d]{1,2}) )?/', $this->last_reply, $matches)) {
|
||||
$code = (int) $matches[1];
|
||||
$code_ex = (count($matches) > 2 ? $matches[2] : null);
|
||||
// Cut off error code from each response line
|
||||
//Cut off error code from each response line
|
||||
$detail = preg_replace(
|
||||
"/{$code}[ -]" .
|
||||
($code_ex ? str_replace('.', '\\.', $code_ex) . ' ' : '') . '/m',
|
||||
|
@ -959,7 +1014,7 @@ class SMTP
|
|||
$this->last_reply
|
||||
);
|
||||
} else {
|
||||
// Fall back to simple parsing if regex fails
|
||||
//Fall back to simple parsing if regex fails
|
||||
$code = (int) substr($this->last_reply, 0, 3);
|
||||
$code_ex = null;
|
||||
$detail = substr($this->last_reply, 4);
|
||||
|
@ -1058,8 +1113,10 @@ class SMTP
|
|||
{
|
||||
//If SMTP transcripts are left enabled, or debug output is posted online
|
||||
//it can leak credentials, so hide credentials in all but lowest level
|
||||
if (self::DEBUG_LOWLEVEL > $this->do_debug &&
|
||||
in_array($command, ['User & Password', 'Username', 'Password'], true)) {
|
||||
if (
|
||||
self::DEBUG_LOWLEVEL > $this->do_debug &&
|
||||
in_array($command, ['User & Password', 'Username', 'Password'], true)
|
||||
) {
|
||||
$this->edebug('CLIENT -> SERVER: [credentials hidden]', self::DEBUG_CLIENT);
|
||||
} else {
|
||||
$this->edebug('CLIENT -> SERVER: ' . $data, self::DEBUG_CLIENT);
|
||||
|
@ -1113,7 +1170,7 @@ class SMTP
|
|||
if (!$this->server_caps) {
|
||||
$this->setError('No HELO/EHLO was sent');
|
||||
|
||||
return;
|
||||
return null;
|
||||
}
|
||||
|
||||
if (!array_key_exists($name, $this->server_caps)) {
|
||||
|
@ -1125,7 +1182,7 @@ class SMTP
|
|||
}
|
||||
$this->setError('HELO handshake was used; No information about server extensions available');
|
||||
|
||||
return;
|
||||
return null;
|
||||
}
|
||||
|
||||
return $this->server_caps[$name];
|
||||
|
@ -1152,7 +1209,7 @@ class SMTP
|
|||
*/
|
||||
protected function get_lines()
|
||||
{
|
||||
// If the connection is bad, give up straight away
|
||||
//If the connection is bad, give up straight away
|
||||
if (!is_resource($this->smtp_conn)) {
|
||||
return '';
|
||||
}
|
||||
|
@ -1166,24 +1223,52 @@ class SMTP
|
|||
$selW = null;
|
||||
while (is_resource($this->smtp_conn) && !feof($this->smtp_conn)) {
|
||||
//Must pass vars in here as params are by reference
|
||||
if (!stream_select($selR, $selW, $selW, $this->Timelimit)) {
|
||||
//solution for signals inspired by https://github.com/symfony/symfony/pull/6540
|
||||
set_error_handler([$this, 'errorHandler']);
|
||||
$n = stream_select($selR, $selW, $selW, $this->Timelimit);
|
||||
restore_error_handler();
|
||||
|
||||
if ($n === false) {
|
||||
$message = $this->getError()['detail'];
|
||||
|
||||
$this->edebug(
|
||||
'SMTP -> get_lines(): select failed (' . $message . ')',
|
||||
self::DEBUG_LOWLEVEL
|
||||
);
|
||||
|
||||
//stream_select returns false when the `select` system call is interrupted
|
||||
//by an incoming signal, try the select again
|
||||
if (stripos($message, 'interrupted system call') !== false) {
|
||||
$this->edebug(
|
||||
'SMTP -> get_lines(): retrying stream_select',
|
||||
self::DEBUG_LOWLEVEL
|
||||
);
|
||||
$this->setError('');
|
||||
continue;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
if (!$n) {
|
||||
$this->edebug(
|
||||
'SMTP -> get_lines(): select timed-out in (' . $this->Timelimit . ' sec)',
|
||||
self::DEBUG_LOWLEVEL
|
||||
);
|
||||
break;
|
||||
}
|
||||
|
||||
//Deliberate noise suppression - errors are handled afterwards
|
||||
$str = @fgets($this->smtp_conn, self::MAX_REPLY_LENGTH);
|
||||
$this->edebug('SMTP INBOUND: "' . trim($str) . '"', self::DEBUG_LOWLEVEL);
|
||||
$data .= $str;
|
||||
// If response is only 3 chars (not valid, but RFC5321 S4.2 says it must be handled),
|
||||
// or 4th character is a space or a line break char, we are done reading, break the loop.
|
||||
// String array access is a significant micro-optimisation over strlen
|
||||
//If response is only 3 chars (not valid, but RFC5321 S4.2 says it must be handled),
|
||||
//or 4th character is a space or a line break char, we are done reading, break the loop.
|
||||
//String array access is a significant micro-optimisation over strlen
|
||||
if (!isset($str[3]) || $str[3] === ' ' || $str[3] === "\r" || $str[3] === "\n") {
|
||||
break;
|
||||
}
|
||||
// Timed-out? Log and break
|
||||
//Timed-out? Log and break
|
||||
$info = stream_get_meta_data($this->smtp_conn);
|
||||
if ($info['timed_out']) {
|
||||
$this->edebug(
|
||||
|
@ -1192,7 +1277,7 @@ class SMTP
|
|||
);
|
||||
break;
|
||||
}
|
||||
// Now check if reads took too long
|
||||
//Now check if reads took too long
|
||||
if ($endtime && time() > $endtime) {
|
||||
$this->edebug(
|
||||
'SMTP -> get_lines(): timelimit reached (' .
|
||||
|
|
|
@ -0,0 +1,38 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* French PHPMailer language file: refer to English translation for definitive list
|
||||
* @package PHPMailer
|
||||
* Some French punctuation requires a thin non-breaking space (U+202F) character before it,
|
||||
* for example before a colon or exclamation mark.
|
||||
* There is one of these characters between these quotes: " "
|
||||
* @see http://unicode.org/udhr/n/notes_fra.html
|
||||
*/
|
||||
|
||||
$PHPMAILER_LANG['authenticate'] = 'Erreur SMTP : échec de l’authentification.';
|
||||
$PHPMAILER_LANG['buggy_php'] = 'Votre version de PHP est affectée par un bug qui peut entraîner des messages corrompus. Pour résoudre ce problème, passez à l’envoi par SMTP, désactivez l’option mail.add_x_header dans le fichier php.ini, passez à MacOS ou Linux, ou passez PHP à la version 7.0.17+ ou 7.1.3+.';
|
||||
$PHPMAILER_LANG['connect_host'] = 'Erreur SMTP : impossible de se connecter au serveur SMTP.';
|
||||
$PHPMAILER_LANG['data_not_accepted'] = 'Erreur SMTP : données incorrectes.';
|
||||
$PHPMAILER_LANG['empty_message'] = 'Corps du message vide.';
|
||||
$PHPMAILER_LANG['encoding'] = 'Encodage inconnu : ';
|
||||
$PHPMAILER_LANG['execute'] = 'Impossible de lancer l’exécution : ';
|
||||
$PHPMAILER_LANG['extension_missing'] = 'Extension manquante : ';
|
||||
$PHPMAILER_LANG['file_access'] = 'Impossible d’accéder au fichier : ';
|
||||
$PHPMAILER_LANG['file_open'] = 'Ouverture du fichier impossible : ';
|
||||
$PHPMAILER_LANG['from_failed'] = 'L’adresse d’expéditeur suivante a échoué : ';
|
||||
$PHPMAILER_LANG['instantiate'] = 'Impossible d’instancier la fonction mail.';
|
||||
$PHPMAILER_LANG['invalid_address'] = 'Adresse courriel non valide : ';
|
||||
$PHPMAILER_LANG['invalid_header'] = 'Nom ou valeur de l’en-tête non valide';
|
||||
$PHPMAILER_LANG['invalid_hostentry'] = 'Entrée d’hôte non valide : ';
|
||||
$PHPMAILER_LANG['invalid_host'] = 'Hôte non valide : ';
|
||||
$PHPMAILER_LANG['mailer_not_supported'] = ' client de messagerie non supporté.';
|
||||
$PHPMAILER_LANG['provide_address'] = 'Vous devez fournir au moins une adresse de destinataire.';
|
||||
$PHPMAILER_LANG['recipients_failed'] = 'Erreur SMTP : les destinataires suivants ont échoué : ';
|
||||
$PHPMAILER_LANG['signing'] = 'Erreur de signature : ';
|
||||
$PHPMAILER_LANG['smtp_code'] = 'Code SMTP : ';
|
||||
$PHPMAILER_LANG['smtp_code_ex'] = 'Informations supplémentaires SMTP : ';
|
||||
$PHPMAILER_LANG['smtp_connect_failed'] = 'La fonction SMTP connect() a échouée.';
|
||||
$PHPMAILER_LANG['smtp_detail'] = 'Détails : ';
|
||||
$PHPMAILER_LANG['smtp_error'] = 'Erreur du serveur SMTP : ';
|
||||
$PHPMAILER_LANG['variable_set'] = 'Impossible d’initialiser ou de réinitialiser une variable : ';
|
||||
$PHPMAILER_LANG['extension_missing'] = 'Extension manquante : ';
|
|
@ -349,7 +349,7 @@ class template {
|
|||
// Retourne le html
|
||||
return $html;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Ferme un formulaire
|
||||
* @return string
|
||||
|
@ -374,6 +374,21 @@ class template {
|
|||
return $html;
|
||||
}
|
||||
|
||||
/**
|
||||
* Ouvre un formulaire avec pièce jointe protégé par CSRF
|
||||
* @param string $id Id du formulaire
|
||||
* @return string
|
||||
*/
|
||||
public static function formOpenFile($id) {
|
||||
// Ouverture formulaire
|
||||
$html = '<form id="' . $id . '" enctype="multipart/form-data" method="post">';
|
||||
// Stock le token CSRF
|
||||
$html .= self::hidden('csrf', [
|
||||
'value' => $_SESSION['csrf']
|
||||
]);
|
||||
// Retourne le html
|
||||
return $html;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
|
|
|
@ -227,8 +227,7 @@ core.start = function() {
|
|||
var samesite = "samesite=lax";
|
||||
var getUrl = window.location;
|
||||
var domain = "domain=" + getUrl.host;
|
||||
var path = "path=" + getUrl.pathname.split('/')[1];
|
||||
var samesite = "samesite=lax";
|
||||
// var path = "path=" + getUrl.pathname.split('/')[1];
|
||||
var e = new Date();
|
||||
e.setFullYear(e.getFullYear() + 1);
|
||||
var expires = "expires=" + e.toUTCString();
|
||||
|
@ -240,15 +239,18 @@ core.start = function() {
|
|||
// Traitement du retour de la checkbox
|
||||
if ($("#cookiesExt").is(":checked")) {
|
||||
// L'URL du serveur faut TRUE
|
||||
document.cookie = "DELTA_COOKIE_EXT_CONSENT=true;" + domain + ";" + path + ";" + samesite + ";" + expires;
|
||||
//document.cookie = "DELTA_COOKIE_EXT_CONSENT=true;" + domain + ";" + path + ";" + samesite + ";" + expires;
|
||||
document.cookie = "DELTA_COOKIE_EXT_CONSENT=true;" + domain + ";" + samesite + ";" + expires;
|
||||
} else {
|
||||
document.cookie = "DELTA_COOKIE_EXT_CONSENT=false;" + domain + ";" + path + ";" + samesite + ";" + expires;
|
||||
//document.cookie = "DELTA_COOKIE_EXT_CONSENT=false;" + domain + ";" + path + ";" + samesite + ";" + expires;
|
||||
document.cookie = "DELTA_COOKIE_EXT_CONSENT=false;" + domain + ";" + samesite + ";" + expires;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Stocke le cookie d'acceptation
|
||||
document.cookie = "DELTA_COOKIE_CONSENT=true;" + domain + ";" + path + ";" + samesite + ";" + expires;
|
||||
//document.cookie = "DELTA_COOKIE_CONSENT=true;" + domain + ";" + path + ";" + samesite + ";" + expires;
|
||||
document.cookie = "DELTA_COOKIE_CONSENT=true;" + domain + ";" + samesite + ";" + expires;
|
||||
});
|
||||
|
||||
|
||||
|
@ -362,13 +364,20 @@ core.start = function() {
|
|||
* Check adresse email
|
||||
*/
|
||||
$("[type=email]").on("change", function() {
|
||||
var text = "";
|
||||
<?php if( $this->getData(['config', 'i18n', 'langAdmin' ]) === 'fr'){
|
||||
echo 'text = "Format incorrect";' ;
|
||||
}
|
||||
else{
|
||||
echo 'text = "Incorrect format";' ;
|
||||
} ?>
|
||||
var _this = $(this);
|
||||
var pattern = /^([a-z\d!#$%&'*+\-\/=?^_`{|}~\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]+(\.[a-z\d!#$%&'*+\-\/=?^_`{|}~\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]+)*|"((([ \t]*\r\n)?[ \t]+)?([\x01-\x08\x0b\x0c\x0e-\x1f\x7f\x21\x23-\x5b\x5d-\x7e\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]|\\[\x01-\x09\x0b\x0c\x0d-\x7f\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))*(([ \t]*\r\n)?[ \t]+)?")@(([a-z\d\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]|[a-z\d\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF][a-z\d\-._~\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]*[a-z\d\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])\.)+([a-z\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]|[a-z\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF][a-z\d\-._~\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]*[a-z\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])\.?$/i;
|
||||
if(pattern.test(_this.val())) {
|
||||
core.noticeRemove(_this.attr("id"));
|
||||
}
|
||||
else {
|
||||
core.noticeAdd(_this.attr("id"), "Format incorrect");
|
||||
core.noticeAdd(_this.attr("id"), text);
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
@ -48,7 +48,7 @@ class common {
|
|||
|
||||
// Numéro de version
|
||||
const DELTA_UPDATE_URL = 'https://update.deltacms.fr/master/';
|
||||
const DELTA_VERSION = '4.1.04';
|
||||
const DELTA_VERSION = '4.1.05';
|
||||
const DELTA_UPDATE_CHANNEL = "v4";
|
||||
|
||||
public static $actions = [];
|
||||
|
@ -182,7 +182,7 @@ class common {
|
|||
'ca' => 'Catalan (ca)',
|
||||
'co' => 'Corse (co)',
|
||||
'eu' => 'Basque (eu)',
|
||||
'none' => 'Autre langue'
|
||||
'none' => 'Autre langue'
|
||||
];
|
||||
public static $i18nList_en = [
|
||||
'en' => 'English (en)',
|
||||
|
@ -322,7 +322,7 @@ class common {
|
|||
/**
|
||||
* Le cookie est prioritaire sur le navigateur
|
||||
* la traduction est celle de la langue du drapeau
|
||||
* */
|
||||
**/
|
||||
if ( $this->getInput('DELTA_I18N_SCRIPT') !== substr($_SERVER["HTTP_ACCEPT_LANGUAGE"],0,2 ) ) {
|
||||
setrawcookie('googtrans', '/'.$this->getData(['config', 'i18n', 'langBase']).'/'.substr( $_SERVER["HTTP_ACCEPT_LANGUAGE"],0,2 ), time() + 3600, helper::baseUrl(false, false));
|
||||
} else {
|
||||
|
@ -435,17 +435,28 @@ class common {
|
|||
* @param string $key Clef du champ
|
||||
*/
|
||||
public function addRequiredInputNotices($key) {
|
||||
// Lexique
|
||||
$text = [];
|
||||
$val = $this->getData(['config', 'i18n', 'langAdmin']);
|
||||
switch ($val) {
|
||||
case 'fr' :
|
||||
$text[0] = 'Obligatoire';
|
||||
break;
|
||||
case 'en' :
|
||||
$text[0] = 'Mandatory';
|
||||
break;
|
||||
}
|
||||
// La clef est un tableau
|
||||
if(preg_match('#\[(.*)\]#', $key, $secondKey)) {
|
||||
$firstKey = explode('[', $key)[0];
|
||||
$secondKey = $secondKey[1];
|
||||
if(empty($this->input['_POST'][$firstKey][$secondKey])) {
|
||||
common::$inputNotices[$firstKey . '_' . $secondKey] = 'Obligatoire';
|
||||
common::$inputNotices[$firstKey . '_' . $secondKey] = $text[0];
|
||||
}
|
||||
}
|
||||
// La clef est une chaine
|
||||
elseif(empty($this->input['_POST'][$key])) {
|
||||
common::$inputNotices[$key] = 'Obligatoire';
|
||||
common::$inputNotices[$key] = $text[0];
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1046,13 +1057,14 @@ class common {
|
|||
* @param string $content Contenu
|
||||
* @return bool
|
||||
*/
|
||||
public function sendMail($to, $subject, $content, $replyTo = null) {
|
||||
public function sendMail($to, $subject, $content, $replyTo = null, $file_name = '') {
|
||||
// Layout
|
||||
ob_start();
|
||||
include 'core/layout/mail.php';
|
||||
$layout = ob_get_clean();
|
||||
$mail = new PHPMailer\PHPMailer\PHPMailer;
|
||||
$mail->CharSet = 'UTF-8';
|
||||
if( $this->getData(['config', 'i18n', 'langAdmin']) === 'fr')$mail->setLanguage('fr', 'core/class/phpmailer/phpmailer.lang-fr.php');
|
||||
// Mail
|
||||
try{
|
||||
// Paramètres SMTP
|
||||
|
@ -1096,16 +1108,18 @@ class common {
|
|||
$mail->Subject = $subject;
|
||||
$mail->Body = $layout;
|
||||
$mail->AltBody = strip_tags($content);
|
||||
if($file_name !== '') $mail->addAttachment( self::FILE_DIR.'uploads/'.$file_name);
|
||||
|
||||
if($mail->send()) {
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
return $mail->ErrorInfo;
|
||||
}
|
||||
} catch (phpmailerException $e) {
|
||||
return $e->errorMessage();
|
||||
} catch (Exception $e) {
|
||||
return $e->getMessage();
|
||||
echo $e->errorMessage();
|
||||
} catch (\Exception $e) {
|
||||
echo $e->getMessage();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1238,7 +1252,8 @@ class common {
|
|||
public function showSection() {
|
||||
echo '<section>';
|
||||
// Récupérer la config de la page courante
|
||||
$blocks = explode('-',$this->getData(['page',$this->getUrl(0),'block']));
|
||||
$blocks = [];
|
||||
if( null !== $this->getData(['page',$this->getUrl(0),'block'])) $blocks = explode('-',$this->getData(['page',$this->getUrl(0),'block']));
|
||||
// Initialiser
|
||||
$blockleft=$blockright="";
|
||||
switch (sizeof($blocks)) {
|
||||
|
@ -2662,9 +2677,9 @@ class core extends common {
|
|||
exit();
|
||||
}
|
||||
// Journalisation
|
||||
$dataLog = mb_detect_encoding(strftime('%d/%m/%y',time()), 'UTF-8', true)
|
||||
? strftime('%d/%m/%y',time()) . ';' . strftime('%R',time()) . ';'
|
||||
: utf8_encode(strftime('%d/%m/%y',time())) . ';' . utf8_encode(strftime('%R',time())) . ';' ;
|
||||
$dataLog = mb_detect_encoding(date('d\/m\/y',time()), 'UTF-8', true)
|
||||
? date('d\/m\/y',time()) . ';' . date('H\:i',time()) . ';'
|
||||
: utf8_encode(date('d\/m\/y',time())) . ';' . utf8_encode(date('H\:i',time())) . ';' ;
|
||||
$dataLog .= helper::getIp($this->getData(['config','connect','anonymousIp'])) . ';';
|
||||
$dataLog .= $this->getUser('id') ? $this->getUser('id') . ';' : 'anonyme' . ';';
|
||||
$dataLog .= $this->getUrl();
|
||||
|
@ -2748,7 +2763,8 @@ class core extends common {
|
|||
* - L'édition est ouverte depuis un temps dépassé, on considère que la page est restée ouverte et qu'elle ne sera pas validée
|
||||
*/
|
||||
foreach($this->getData(['user']) as $userId => $userIds){
|
||||
$t = explode('/',$this->getData(['user', $userId, 'accessUrl']));
|
||||
$t = [];
|
||||
if( null !== $this->getData(['user', $userId, 'accessUrl'])) $t = explode('/',$this->getData(['user', $userId, 'accessUrl']));
|
||||
if ( $this->getUser('id') &&
|
||||
$userId !== $this->getUser('id') &&
|
||||
$this->getData(['user', $userId,'accessUrl']) === $this->getUrl() &&
|
||||
|
@ -2809,11 +2825,16 @@ class core extends common {
|
|||
|
||||
if($access AND $this->getData(['page', $this->getUrl(0), 'moduleId'])) {
|
||||
$moduleId = $this->getData(['page', $this->getUrl(0), 'moduleId']);
|
||||
if( null === $this->getData(['module',$this->getUrl(0),'posts',$this->getUrl(1),'content'])){
|
||||
$sub = '';
|
||||
} else {
|
||||
$sub = substr($this->getData(['module',$this->getUrl(0),'posts',$this->getUrl(1),'content']) ,0,159);
|
||||
}
|
||||
$this->addOutput([
|
||||
'title' => $title,
|
||||
// Meta description = 160 premiers caractères de l'article
|
||||
'metaDescription' => $this->getData(['page',$this->getUrl(0),'moduleId']) === 'blog' && !empty($this->getUrl(1))
|
||||
? strip_tags(substr($this->getData(['module',$this->getUrl(0),'posts',$this->getUrl(1),'content']) ,0,159))
|
||||
? strip_tags($sub)
|
||||
: $this->getData(['page', $this->getUrl(0), 'metaDescription']),
|
||||
'metaTitle' => $this->getData(['page', $this->getUrl(0), 'metaTitle']),
|
||||
'typeMenu' => $this->getData(['page', $this->getUrl(0), 'typeMenu']),
|
||||
|
@ -2844,13 +2865,15 @@ class core extends common {
|
|||
// Check l'existence de l'action
|
||||
$action = '';
|
||||
$ignore = true;
|
||||
foreach(explode('-', $this->getUrl(1)) as $actionPart) {
|
||||
if($ignore) {
|
||||
$action .= $actionPart;
|
||||
$ignore = false;
|
||||
}
|
||||
else {
|
||||
$action .= ucfirst($actionPart);
|
||||
if( null !== $this->getUrl(1)){
|
||||
foreach(explode('-', $this->getUrl(1)) as $actionPart) {
|
||||
if($ignore) {
|
||||
$action .= $actionPart;
|
||||
$ignore = false;
|
||||
}
|
||||
else {
|
||||
$action .= ucfirst($actionPart);
|
||||
}
|
||||
}
|
||||
}
|
||||
$action = array_key_exists($action, $module::$actions) ? $action : 'index';
|
||||
|
|
|
@ -53,5 +53,9 @@ if ($this->getData(['core', 'dataVersion']) < 4104) {
|
|||
$this->setData(['core', 'dataVersion', 4104]);
|
||||
}
|
||||
|
||||
if ($this->getData(['core', 'dataVersion']) < 4105) {
|
||||
|
||||
// Mise à jour
|
||||
$this->setData(['core', 'dataVersion', 4105]);
|
||||
}
|
||||
?>
|
||||
|
|
|
@ -1354,6 +1354,11 @@ input[type='checkbox']:disabled+label:before {
|
|||
margin: 5px 0 5px;
|
||||
}
|
||||
|
||||
/* Paramètres de Input File dans form */
|
||||
.formInputFile {
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Grille
|
||||
|
|
|
@ -26,9 +26,11 @@ if( $this->getInput('DELTA_I18N_SITE') !== '' && $this->getInput('DELTA_I18N_SIT
|
|||
<?php if (file_exists(self::DATA_DIR .'head.inc.html')) {
|
||||
include(self::DATA_DIR .'head.inc.html');
|
||||
}?>
|
||||
<?php if( $_SESSION['screenshot'] === 'on'){ ?>
|
||||
<script src="./core/vendor/screenshot/html2canvas.min.js"></script>
|
||||
<?php } ?>
|
||||
<?php
|
||||
if( isset ($_SESSION['screenshot'] )){
|
||||
if( $_SESSION['screenshot'] === 'on'){ ?>
|
||||
<script src="./core/vendor/screenshot/html2canvas.min.js"></script>
|
||||
<?php } }?>
|
||||
</head>
|
||||
<body>
|
||||
<!-- Barre d'administration -->
|
||||
|
@ -64,9 +66,10 @@ if( $this->getInput('DELTA_I18N_SITE') !== '' && $this->getInput('DELTA_I18N_SIT
|
|||
} ?>
|
||||
|
||||
<!-- div screenshot -->
|
||||
<?php if( $_SESSION['screenshot'] === 'on'){ ?>
|
||||
<div id="main_screenshot">
|
||||
<?php } ?>
|
||||
<?php if( isset ($_SESSION['screenshot'] )){
|
||||
if( $_SESSION['screenshot'] === 'on'){ ?>
|
||||
<div id="main_screenshot">
|
||||
<?php }} ?>
|
||||
|
||||
<!-- Menu dans le fond du site avant la bannière -->
|
||||
<?php if($this->getData(['theme', 'menu', 'position']) === 'body-first' || $this->getData(['theme', 'menu', 'position']) === 'top' ): ?>
|
||||
|
@ -217,10 +220,11 @@ if( $this->getInput('DELTA_I18N_SITE') !== '' && $this->getInput('DELTA_I18N_SIT
|
|||
<?php echo $this->getData(['theme', 'footer', 'position']) === 'site'? '</div>' : '';?>
|
||||
|
||||
<!-- fin de la div main_screenshot et bouton screenshot -->
|
||||
<?php if( $_SESSION['screenshot'] === 'on'){ ?>
|
||||
</div>
|
||||
<div><button id="screenshot" class="buttonScreenshot" type="button" ><img src="<?php echo helper::baseUrl(false); ?>core/vendor/screenshot/appareil_photo.png" width="100px"/></button></div>
|
||||
<?php } ?>
|
||||
<?php if( isset ($_SESSION['screenshot'] )){
|
||||
if( $_SESSION['screenshot'] === 'on'){ ?>
|
||||
</div>
|
||||
<div><button id="screenshot" class="buttonScreenshot" type="button" ><img src="<?php echo helper::baseUrl(false); ?>core/vendor/screenshot/appareil_photo.png" width="100px"/></button></div>
|
||||
<?php }}?>
|
||||
|
||||
<!-- Lien remonter en haut -->
|
||||
<div id="backToTop"><?php echo template::ico('up'); ?></div>
|
||||
|
|
|
@ -25,7 +25,6 @@ class config extends common {
|
|||
'generateFiles' => self::GROUP_ADMIN,
|
||||
'index' => self::GROUP_ADMIN,
|
||||
'restore' => self::GROUP_ADMIN,
|
||||
'updateBaseUrl' => self::GROUP_ADMIN,
|
||||
'script' => self::GROUP_ADMIN,
|
||||
'logReset' => self::GROUP_ADMIN,
|
||||
'logDownload'=> self::GROUP_ADMIN,
|
||||
|
@ -405,62 +404,19 @@ class config extends common {
|
|||
$files [] = ( basename( $stat['name'] ));
|
||||
}
|
||||
|
||||
// Lire la dataversion
|
||||
$tmpDir = uniqid(4);
|
||||
$success = $zip->extractTo( self::TEMP_DIR . $tmpDir );
|
||||
$data = file_get_contents( self::TEMP_DIR . $tmpDir . '/data/core.json');
|
||||
$obj = json_decode($data);
|
||||
$dataVersion = strval ($obj->core->dataVersion);
|
||||
switch (strlen($dataVersion)) {
|
||||
case 4:
|
||||
if (substr($dataVersion,0,1) === '9' ) {
|
||||
$version = 9;
|
||||
} else {
|
||||
$version = 0;
|
||||
}
|
||||
break;
|
||||
case 5:
|
||||
$version = substr($dataVersion,0,2);
|
||||
break;
|
||||
default:
|
||||
$version = 0;
|
||||
break;
|
||||
}
|
||||
$this->removeDir(self::TEMP_DIR . $tmpDir );
|
||||
// Option active, les users sont stockées
|
||||
if ($this->getInput('configRestoreImportUser', helper::FILTER_BOOLEAN) === true ) $users = $this->getData(['user']);
|
||||
|
||||
if ($version >= 10 ) {
|
||||
// Option active, les users sont stockées
|
||||
if ($this->getInput('configRestoreImportUser', helper::FILTER_BOOLEAN) === true ) {
|
||||
$users = $this->getData(['user']);
|
||||
}
|
||||
} elseif ($version === 0) { // Version invalide
|
||||
// Valeurs en sortie erreur
|
||||
$this->addOutput([
|
||||
'title' => $text[0],
|
||||
'view' => 'restore',
|
||||
'notification' => $text[3],
|
||||
'state' => false
|
||||
]);
|
||||
}
|
||||
// Préserver les comptes des utilisateurs d'une version 9 si option cochée
|
||||
// Positionnement d'une variable de session lue au constructeurs
|
||||
if ($version === 9) {
|
||||
$_SESSION['KEEP_USERS'] = $this->getInput('configRestoreImportUser', helper::FILTER_BOOLEAN);
|
||||
}
|
||||
// Extraire le zip ou 'site/'
|
||||
$this->removeDir(self::DATA_DIR);
|
||||
$success = $zip->extractTo( 'site/' );
|
||||
// Fermer l'archive
|
||||
$zip->close();
|
||||
|
||||
|
||||
// Restaurer les users originaux d'une v10 si option cochée
|
||||
if (!empty($users) &&
|
||||
$version >= 10 &&
|
||||
$this->getInput('configRestoreImportUser', helper::FILTER_BOOLEAN) === true) {
|
||||
$this->setData(['user',$users]);
|
||||
}
|
||||
if (!empty($users) && $this->getInput('configRestoreImportUser', helper::FILTER_BOOLEAN) === true) $this->setData(['user',$users]);
|
||||
}
|
||||
|
||||
// Message de notification
|
||||
$notification = $success === true ? $text[4] : $text[5] ;
|
||||
$redirect = $this->getInput('configRestoreImportUser', helper::FILTER_BOOLEAN) === true ? helper::baseUrl() . 'config/restore' : helper::baseUrl() . 'user/login/';
|
||||
|
@ -757,75 +713,6 @@ class config extends common {
|
|||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Met à jour les données de site avec l'adresse transmise
|
||||
*/
|
||||
public function updateBaseUrl () {
|
||||
// Lexique
|
||||
$text = [];
|
||||
$val = $this->getData(['config', 'i18n', 'langAdmin']);
|
||||
switch ($val) {
|
||||
case 'fr' :
|
||||
$text[0] = 'Restaurer';
|
||||
$text[1] = ' conversion';
|
||||
$text[2] = ' effectuée';
|
||||
$text[3] = 'Aucune conversion';
|
||||
break;
|
||||
case 'en' :
|
||||
$text[0] = 'Restore';
|
||||
$text[1] = ' conversion';
|
||||
$text[2] = ' performed';
|
||||
$text[3] = 'No conversion';
|
||||
break;
|
||||
}
|
||||
// Supprimer l'information de redirection
|
||||
$old = str_replace('?','',$this->getData(['core', 'baseUrl']));
|
||||
$new = helper::baseUrl(false,false);
|
||||
$c3 = 0;
|
||||
$success = false ;
|
||||
// Boucler sur les pages
|
||||
foreach($this->getHierarchy(null,null,null) as $parentId => $childIds) {
|
||||
$content = $this->getPage($parentId, self::$i18n);
|
||||
$content = $titre . ' ' . $content ;
|
||||
$replace = str_replace( 'href="' . $old , 'href="'. $new , stripslashes($content),$c1) ;
|
||||
$replace = str_replace( 'src="' . $old , 'src="'. $new , stripslashes($replace),$c2) ;
|
||||
|
||||
if ($c1 > 0 || $c2 > 0) {
|
||||
$success = true;
|
||||
$this->setPage($parentId, $replace, self::$i18n);
|
||||
$c3 += $c1 + $c2;
|
||||
}
|
||||
foreach($childIds as $childId) {
|
||||
$content = $this->getPage($childId, self::$i18n);
|
||||
$content = $titre . ' ' . $content ;
|
||||
$replace = str_replace( 'href="' . $old , 'href="'. $new , stripslashes($content),$c1) ;
|
||||
$replace = str_replace( 'src="' . $old , 'src="'. $new , stripslashes($replace),$c2) ;
|
||||
if ($c1 > 0 || $c2 > 0) {
|
||||
$success = true;
|
||||
$this->setPage($childId, $replace, self::$i18n);
|
||||
$c3 += $c1 + $c2;
|
||||
}
|
||||
}
|
||||
}
|
||||
// Traiter les modules dont la redirection
|
||||
$content = $this->getdata(['module']);
|
||||
$replace = $this->recursive_array_replace('href="' . $old , 'href="'. $new, $content, $c1);
|
||||
$replace = $this->recursive_array_replace('src="' . $old , 'src="'. $new, $replace, $c2);
|
||||
if ($content !== $replace) {
|
||||
$this->setdata(['module',$replace]);
|
||||
$c3 += $c1 + $c2;
|
||||
$success = true;
|
||||
}
|
||||
// Mettre à jour la base URl
|
||||
$this->setData(['core','baseUrl',helper::baseUrl(true,false)]);
|
||||
// Valeurs en sortie
|
||||
$this->addOutput([
|
||||
'title' => $text[0],
|
||||
'view' => 'restore',
|
||||
'notification' => $success ? $c3. $text[1] . ($c3 > 1 ? 's' : '') . $text[2] . ($c3 > 1 ? 's' : '') : $text[3],
|
||||
'state' => $success ? true : false
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Vider le fichier de log
|
||||
|
|
|
@ -10,13 +10,6 @@ switch ($val) {
|
|||
$text[3] = 'Sélectionnez une archive au format ZIP';
|
||||
$text[4] = 'L\'archive a été déposée dans le gestionnaire de fichiers.';
|
||||
$text[5] = 'Préserver les comptes des utilisateurs déjà installés';
|
||||
$text[6] = 'Conversion après la restauration';
|
||||
$text[7] = 'Conversion des URL des ressources multimédia entre deux sites aux arborescences différentes.';
|
||||
$text[8] = 'Pas de donnée dans la sauvegarde';
|
||||
$text[9] = 'Dossier de l\'archive';
|
||||
$text[10] = 'Le dossier de base du site est stockée dans la sauvegarde.';
|
||||
$text[11] = 'Dossier du site actuel';
|
||||
$text[12] = 'Convertir';
|
||||
break;
|
||||
case 'en' :
|
||||
$text[0] = 'Return';
|
||||
|
@ -25,13 +18,6 @@ switch ($val) {
|
|||
$text[3] = 'Select an archive in ZIP format';
|
||||
$text[4] = 'The archive has been dropped into the file manager.';
|
||||
$text[5] = 'Preserve user accounts already installed';
|
||||
$text[6] = 'Convert after restore';
|
||||
$text[7] = 'Conversion of media URLs between two sites with different trees';
|
||||
$text[8] = 'No data in backup';
|
||||
$text[9] = 'Archive folder';
|
||||
$text[10] = 'The site\'s base folder is stored in the backup';
|
||||
$text[11] = 'Current site folder';
|
||||
$text[12] = 'Convert';
|
||||
break;
|
||||
}
|
||||
?>
|
||||
|
@ -75,46 +61,4 @@ switch ($val) {
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col12">
|
||||
<div class="block">
|
||||
<h4><?php echo $text[6]; echo template::help($text[7]);?></h4>
|
||||
<div class="row">
|
||||
<div class="col4 offset1">
|
||||
<?php
|
||||
if (is_null($this->getData(['core', 'baseUrl'])) ) {
|
||||
$baseUrlValue = $text[8];
|
||||
$buttonClass = 'disabled';
|
||||
} elseif ($this->getData(['core', 'baseUrl']) === '') {
|
||||
$baseUrlValue = '/';
|
||||
$buttonClass = helper::baseUrl(false,false) !== $this->getData(['core', 'baseUrl']) ? '' : 'disabled';
|
||||
} else {
|
||||
$baseUrlValue = str_replace('?','',$this->getData(['core', 'baseUrl']));
|
||||
$buttonClass = helper::baseUrl(false,false) !== $baseUrlValue ? '' : 'disabled';
|
||||
}
|
||||
echo template::text('configRestoreBaseURLToConvert', [
|
||||
'label' => $text[9] ,
|
||||
'value' => $baseUrlValue,
|
||||
'readonly' => true,
|
||||
'help' => $text[10]
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col4">
|
||||
<?php echo template::text('configRestoreCurrentURL', [
|
||||
'label' => $text[11],
|
||||
'value' => helper::baseUrl(false,false),
|
||||
'readonly' => true
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col2 verticalAlignMiddle">
|
||||
<?php echo template::button('configRestoreUpdateBaseURLButton', [
|
||||
'href' => helper::baseUrl() . 'config/updateBaseUrl',
|
||||
'class' => $buttonClass,
|
||||
'value' => $text[12]
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php echo template::formClose(); ?>
|
||||
|
|
|
@ -70,7 +70,7 @@ class init extends common {
|
|||
]
|
||||
],
|
||||
'core' => [
|
||||
'dataVersion' => 4104,
|
||||
'dataVersion' => 4105,
|
||||
'lastBackup' => 0,
|
||||
'lastClearTmp' => 0,
|
||||
'lastAutoUpdate' => 0,
|
||||
|
@ -805,7 +805,8 @@ class init extends common {
|
|||
'config' => [
|
||||
'feeds' => true,
|
||||
'feedsLabel' => 'Syndication RSS',
|
||||
'itemsperPage' => 4
|
||||
'itemsperPage' => 4,
|
||||
'versionData' => '6.0'
|
||||
],
|
||||
'texts' => [
|
||||
'NoComment' => 'Pas encore de commentaire',
|
||||
|
|
|
@ -207,7 +207,7 @@ class page extends common {
|
|||
'group' => self::GROUP_VISITOR,
|
||||
'targetBlank' => false,
|
||||
'title' => $pageTitle,
|
||||
'shortTitle' => $pageTitle,
|
||||
'shortTitle' => '',
|
||||
'block' => '12',
|
||||
'barLeft' => '',
|
||||
'barRight' => '',
|
||||
|
|
|
@ -526,7 +526,12 @@ pageTypeMenuDOM.on("change", function() {
|
|||
}
|
||||
});
|
||||
|
||||
|
||||
/**
|
||||
* Duplication du champ Title dans Short title
|
||||
*/
|
||||
$("#pageEditTitle").on("input", function() {
|
||||
$("#pageEditShortTitle").val($(this).val());
|
||||
});
|
||||
|
||||
|
||||
/**
|
||||
|
|
|
@ -657,9 +657,9 @@ class user extends common {
|
|||
}
|
||||
}
|
||||
// Journalisation
|
||||
$dataLog = mb_detect_encoding(strftime('%d/%m/%y',time()), 'UTF-8', true)
|
||||
? strftime('%d/%m/%y',time()) . ';' . strftime('%R',time()) . ';'
|
||||
: utf8_encode(strftime('%d/%m/%y',time())) . ';' . utf8_encode(strftime('%R',time())) . ';' ;
|
||||
$dataLog = mb_detect_encoding(date('d\/m\/y',time()), 'UTF-8', true)
|
||||
? date('d\/m\/y',time()) . ';' . date('H\:i',time()) . ';'
|
||||
: utf8_encode(date('d\/m\/y',time())) . ';' . utf8_encode(date('H\:i',time())) . ';' ;
|
||||
$dataLog .= helper::getIp($this->getData(['config','connect','anonymousIp'])) . ';';
|
||||
$dataLog .= $this->getInput('userLoginId', helper::FILTER_ID) . ';' ;
|
||||
$dataLog .= $this->getUrl() .';' ;
|
||||
|
|
|
@ -3,15 +3,27 @@ $version = "9.14.0";
|
|||
if (session_id() == '') session_start();
|
||||
|
||||
mb_internal_encoding('UTF-8');
|
||||
mb_http_output('UTF-8');
|
||||
mb_http_input('UTF-8');
|
||||
mb_http_output();
|
||||
mb_http_input();
|
||||
mb_language('uni');
|
||||
if (function_exists('mb_regex_encoding')) {
|
||||
mb_regex_encoding('UTF-8');
|
||||
}
|
||||
ob_start('mb_output_handler');
|
||||
date_default_timezone_set('Europe/Paris');
|
||||
setlocale(LC_CTYPE, 'fr_FR'); //correct transliteration
|
||||
|
||||
// Langage et locales fonction de la langue d'administration
|
||||
$json = file_get_contents('../../../site/data/config.json');
|
||||
$tab = json_decode($json, true);
|
||||
$langAdmin = $tab['config']['i18n']['langAdmin'];
|
||||
if($langAdmin === 'fr'){
|
||||
date_default_timezone_set('Europe/Paris');
|
||||
setlocale(LC_CTYPE, 'fr_FR', 'fr'); //correct transliteration
|
||||
$_SESSION['RF']['language']= 'fr_FR';
|
||||
} else {
|
||||
date_default_timezone_set('Europe/London');
|
||||
setlocale(LC_CTYPE, 'en_GB', 'en'); //correct transliteration
|
||||
$_SESSION['RF']['language']= 'en_EN';
|
||||
}
|
||||
|
||||
/* Lecture du groupe de l'utilisateur connecté pour attribuer les droits et les dossiers */
|
||||
$userId = $_COOKIE['DELTA_USER_ID'];
|
||||
|
|
|
@ -438,9 +438,9 @@ class blog extends common {
|
|||
]);
|
||||
}
|
||||
self::$comments[] = [
|
||||
mb_detect_encoding(strftime('%d %B %Y - %H:%M', $comment['createdOn']), 'UTF-8', true)
|
||||
? strftime('%d %B %Y - %H:%M', $comment['createdOn'])
|
||||
: utf8_encode(strftime('%d %B %Y - %H:%M', $comment['createdOn'])),
|
||||
mb_detect_encoding(date('d\/m\/Y\ \-\ H\:i', $comment['createdOn']), 'UTF-8', true)
|
||||
? date('d\/m\/Y\ \-\ H\:i', $comment['createdOn'])
|
||||
: utf8_encode(date('d\/m\/Y\ \-\ H\:i', $comment['createdOn'])),
|
||||
$comment['content'],
|
||||
$comment['userId'] ? $this->getData(['user', $comment['userId'], 'firstname']) . ' ' . $this->getData(['user', $comment['userId'], 'lastname']) : $comment['author'],
|
||||
$buttonApproval,
|
||||
|
@ -675,12 +675,12 @@ class blog extends common {
|
|||
$approved = count($this->getData(['module', $this->getUrl(0), 'posts', $articleIds[$i],'comment']));
|
||||
}
|
||||
// Met en forme le tableau
|
||||
$date = mb_detect_encoding(strftime('%d %B %Y', $this->getData(['module', $this->getUrl(0), 'posts', $articleIds[$i], 'publishedOn'])), 'UTF-8', true)
|
||||
? strftime('%d %B %Y', $this->getData(['module', $this->getUrl(0), 'posts', $articleIds[$i], 'publishedOn']))
|
||||
: utf8_encode(strftime('%d %B %Y', $this->getData(['module', $this->getUrl(0), 'posts', $articleIds[$i], 'publishedOn'])));
|
||||
$heure = mb_detect_encoding(strftime('%H:%M', $this->getData(['module', $this->getUrl(0), 'posts', $articleIds[$i], 'publishedOn'])), 'UTF-8', true)
|
||||
? strftime('%H:%M', $this->getData(['module', $this->getUrl(0), 'posts', $articleIds[$i], 'publishedOn']))
|
||||
: utf8_encode(strftime('%H:%M', $this->getData(['module', $this->getUrl(0), 'posts', $articleIds[$i], 'publishedOn'])));
|
||||
$date = mb_detect_encoding(date('d\/m\/Y', $this->getData(['module', $this->getUrl(0), 'posts', $articleIds[$i], 'publishedOn'])), 'UTF-8', true)
|
||||
? date('d\/m\/Y', $this->getData(['module', $this->getUrl(0), 'posts', $articleIds[$i], 'publishedOn']))
|
||||
: utf8_encode(date('d\/m\/Y', $this->getData(['module', $this->getUrl(0), 'posts', $articleIds[$i], 'publishedOn'])));
|
||||
$heure = mb_detect_encoding(date('H\:i', $this->getData(['module', $this->getUrl(0), 'posts', $articleIds[$i], 'publishedOn'])), 'UTF-8', true)
|
||||
? date('H\:i', $this->getData(['module', $this->getUrl(0), 'posts', $articleIds[$i], 'publishedOn']))
|
||||
: utf8_encode(date('H\:i', $this->getData(['module', $this->getUrl(0), 'posts', $articleIds[$i], 'publishedOn'])));
|
||||
self::$articles[] = [
|
||||
'<a href="' . helper::baseurl() . $this->getUrl(0) . '/' . $articleIds[$i] . '" target="_blank" >' .
|
||||
$this->getData(['module', $this->getUrl(0), 'posts', $articleIds[$i], 'title']) .
|
||||
|
|
|
@ -36,8 +36,19 @@ echo '<script src="'. helper::baseUrl(false).'core/vendor/tinymce/init.js"></scr
|
|||
echo '<script src="'. helper::baseUrl(false).'core/vendor/tinymce/init.css"></script>';
|
||||
|
||||
// Pour les dates suivant la langue d'administration
|
||||
setlocale(LC_TIME, 'fr_FR');
|
||||
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
|
||||
);
|
||||
?>
|
||||
|
||||
<div class="row">
|
||||
|
@ -56,14 +67,7 @@ if( $this->getData(['config', 'i18n', 'langAdmin']) === 'en') setlocale(LC_TIME,
|
|||
<!-- bloc signature et date -->
|
||||
<?php echo $module::$articleSignature . ' - ';?>
|
||||
<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)
|
||||
? 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;
|
||||
?>
|
||||
<?php echo datefmt_format($fmt, strtotime( date('Y/m/d H:i:s',$this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'publishedOn'])))); ?>
|
||||
<!-- Bloc edition -->
|
||||
<?php if (
|
||||
|
||||
|
@ -190,9 +194,9 @@ if( $this->getData(['config', 'i18n', 'langAdmin']) === 'en') setlocale(LC_TIME,
|
|||
<?php foreach($module::$comments as $commentId => $comment): ?>
|
||||
<div class="block">
|
||||
<h4><?php echo $module::$commentsSignature[$commentId]; ?>
|
||||
<?php echo ' - '; echo mb_detect_encoding(strftime('%d %B %Y - %H:%M', $comment['createdOn']), 'UTF-8', true)
|
||||
? strftime('%d %B %Y - %H:%M', $comment['createdOn'])
|
||||
: utf8_encode(strftime('%d %B %Y - %H:%M', $comment['createdOn']));
|
||||
<?php echo ' - '; echo mb_detect_encoding(date('d\/m\/Y\ \-\ H\:i', $comment['createdOn']), 'UTF-8', true)
|
||||
? date('d\/m\/Y\ \-\ H\:i', $comment['createdOn'])
|
||||
: utf8_encode(date('d\/m\/Y\ \-\ H\:i', $comment['createdOn']));
|
||||
?>
|
||||
</h4>
|
||||
<?php echo $comment['content']; ?>
|
||||
|
|
|
@ -10,10 +10,21 @@ switch ($val) {
|
|||
$text[0] = 'Read more';
|
||||
break;
|
||||
}
|
||||
?>
|
||||
<?php setlocale(LC_TIME, 'fr_FR');
|
||||
if( $this->getData(['config', 'i18n', 'langAdmin']) === 'en') setlocale(LC_TIME, 'en_GB'); ?>
|
||||
<?php if($module::$articles): ?>
|
||||
// Pour les dates suivant la langue d'administration
|
||||
$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
|
||||
);
|
||||
if($module::$articles): ?>
|
||||
<div class="row">
|
||||
<div class="col12">
|
||||
<?php foreach($module::$articles as $articleId => $article): ?>
|
||||
|
@ -51,9 +62,7 @@ if( $this->getData(['config', 'i18n', 'langAdmin']) === 'en') setlocale(LC_TIME,
|
|||
</div>
|
||||
<div class="blogDate">
|
||||
<i class="far fa-calendar-alt"></i>
|
||||
<?php echo mb_detect_encoding(strftime('%d %B %Y - %H:%M', $article['publishedOn']), 'UTF-8', true)
|
||||
? strftime('%d %B %Y', $article['publishedOn'])
|
||||
: utf8_encode(strftime('%d %B %Y', $article['publishedOn'])); ?>
|
||||
<?php echo datefmt_format($fmt, strtotime( date('Y/m/d H:i:s',$article['publishedOn']))); ?>
|
||||
</div>
|
||||
<p class="blogContent">
|
||||
<?php echo helper::subword(strip_tags($article['content']), 0, 400); ?>...
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
|
||||
class form extends common {
|
||||
|
||||
const VERSION = '3.0';
|
||||
const VERSION = '4.0';
|
||||
const REALNAME = 'Formulaire';
|
||||
const DELETE = true;
|
||||
const UPDATE = '0.0';
|
||||
|
@ -26,6 +26,7 @@ class form extends common {
|
|||
|
||||
public static $actions = [
|
||||
'config' => self::GROUP_MODERATOR,
|
||||
'update' => self::GROUP_MODERATOR,
|
||||
'data' => self::GROUP_MODERATOR,
|
||||
'delete' => self::GROUP_MODERATOR,
|
||||
'deleteall' => self::GROUP_MODERATOR,
|
||||
|
@ -49,6 +50,7 @@ class form extends common {
|
|||
const TYPE_DATETIME = 'date';
|
||||
const TYPE_CHECKBOX = 'checkbox';
|
||||
const TYPE_LABEL = 'label';
|
||||
const TYPE_FILE = 'file';
|
||||
const ITEMSPAGE = 10;
|
||||
|
||||
|
||||
|
@ -59,7 +61,8 @@ class form extends common {
|
|||
self::TYPE_MAIL => 'Champ mail',
|
||||
self::TYPE_SELECT => 'Sélection',
|
||||
self::TYPE_CHECKBOX => 'Case à cocher',
|
||||
self::TYPE_DATETIME => 'Date'
|
||||
self::TYPE_DATETIME => 'Date',
|
||||
self::TYPE_FILE => 'fichier'
|
||||
];
|
||||
public static $types_en = [
|
||||
self::TYPE_LABEL => 'Label',
|
||||
|
@ -68,12 +71,13 @@ class form extends common {
|
|||
self::TYPE_MAIL => 'Mail field',
|
||||
self::TYPE_SELECT => 'Selection',
|
||||
self::TYPE_CHECKBOX => 'Check box',
|
||||
self::TYPE_DATETIME => 'Date'
|
||||
self::TYPE_DATETIME => 'Date',
|
||||
self::TYPE_FILE => 'file'
|
||||
];
|
||||
|
||||
public static $listUsers = [
|
||||
];
|
||||
|
||||
|
||||
public static $signature = [
|
||||
'text' => 'Nom du site',
|
||||
'logo' => 'Logo du site'
|
||||
|
@ -88,7 +92,23 @@ class form extends common {
|
|||
'80' => '80%',
|
||||
'100' => '100%'
|
||||
];
|
||||
|
||||
public static $maxSizeUpload = [
|
||||
'100000' => '100Ko',
|
||||
'200000' => '200Ko',
|
||||
'500000' => '500Ko',
|
||||
'1000000' => '1Mo',
|
||||
'2000000' => '2Mo',
|
||||
'5000000' => '5Mo'
|
||||
];
|
||||
|
||||
/**
|
||||
* Mise à jour du module
|
||||
*/
|
||||
public function update() {
|
||||
if( null === $this->getData(['module', $this->getUrl(0), 'config', 'maxSizeUpload'])) $this->setData(['module', $this->getUrl(0), 'config', 'maxSizeUpload', '500000']);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Configuration
|
||||
*/
|
||||
|
@ -131,7 +151,8 @@ class form extends common {
|
|||
'replyto' => $this->getInput('formConfigMailReplyTo', helper::FILTER_BOOLEAN),
|
||||
'signature' => $this->getInput('formConfigSignature'),
|
||||
'logoUrl' => $this->getInput('formConfigLogo'),
|
||||
'logoWidth' => $this->getInput('formConfigLogoWidth')
|
||||
'logoWidth' => $this->getInput('formConfigLogoWidth'),
|
||||
'maxSizeUpload' => $this->getInput('formConfigMaxSize')
|
||||
]
|
||||
]);
|
||||
// Génération des données vides
|
||||
|
@ -381,6 +402,8 @@ class form extends common {
|
|||
* Accueil
|
||||
*/
|
||||
public function index() {
|
||||
// Mise à jour du module
|
||||
$this->update();
|
||||
// Lexique
|
||||
$text = [];
|
||||
$val = $this->getData(['config', 'i18n', 'langAdmin']);
|
||||
|
@ -390,12 +413,24 @@ class form extends common {
|
|||
$text[1] = 'Nouveau message en provenance de votre site';
|
||||
$text[2] = 'Nouveau message en provenance de la page "';
|
||||
$text[3] = 'Formulaire soumis';
|
||||
$text[4] = 'La pièce jointe n\'est pas une image';
|
||||
$text[5] = '?';
|
||||
$text[6] = 'La taille du fichier excède ';
|
||||
$text[7] = 'L\'extension du fichier doit être jpg, jpeg, png ou gif';
|
||||
$text[8] = 'Erreur pendant le téléversement du fichier';
|
||||
$text[9] = 'échec le message n\'est pas envoyé car ';
|
||||
break;
|
||||
case 'en' :
|
||||
$text[0] = 'Incorrect';
|
||||
$text[1] = 'New message from your site';
|
||||
$text[2] = 'New message from the page "';
|
||||
$text[3] = 'Form submitted';
|
||||
$text[4] = 'File is not an image';
|
||||
$text[5] = '?';
|
||||
$text[6] = 'File size exceeds ';
|
||||
$text[7] = 'The file extension must be jpg, jpeg, png or gif';
|
||||
$text[8] = 'Error while uploading file' ;
|
||||
$text[9] = 'failure, the message is not sent because ';
|
||||
break;
|
||||
}
|
||||
// Soumission du formulaire
|
||||
|
@ -413,20 +448,32 @@ class form extends common {
|
|||
$data = [];
|
||||
$replyTo = null;
|
||||
$content = '';
|
||||
// $notice concerne la pièce jointe
|
||||
$notice = '';
|
||||
foreach($this->getData(['module', $this->getUrl(0), 'input']) as $index => $input) {
|
||||
// Filtre la valeur
|
||||
switch($input['type']) {
|
||||
case self::TYPE_MAIL:
|
||||
$filter = helper::FILTER_MAIL;
|
||||
$this->setData(['module', $this->getUrl(0), 'draft', 'mail', $this->getInput('formInput[' . $index . ']')]);
|
||||
break;
|
||||
case self::TYPE_TEXTAREA:
|
||||
$filter = helper::FILTER_STRING_LONG;
|
||||
$this->setData(['module', $this->getUrl(0), 'draft', 'textarea', $this->getInput('formInput[' . $index . ']')]);
|
||||
break;
|
||||
case self::TYPE_DATETIME:
|
||||
$filter = helper::FILTER_STRING_SHORT; // Mettre TYPE_DATETIME pour récupérer un TIMESTAMP
|
||||
$this->setData(['module', $this->getUrl(0), 'draft', 'datetime', $this->getInput('formInput[' . $index . ']')]);
|
||||
break;
|
||||
case self::TYPE_CHECKBOX:
|
||||
$filter = helper::FILTER_BOOLEAN;
|
||||
$this->setData(['module', $this->getUrl(0), 'draft', 'checkbox', $this->getInput('formInput[' . $index . ']')]);
|
||||
break;
|
||||
case self::TYPE_SELECT:
|
||||
$this->setData(['module', $this->getUrl(0), 'draft', 'select', $this->getInput('formInput[' . $index . ']')]);
|
||||
break;
|
||||
case self::TYPE_TEXT:
|
||||
$this->setData(['module', $this->getUrl(0), 'draft', 'text', $this->getInput('formInput[' . $index . ']')]);
|
||||
break;
|
||||
default:
|
||||
$filter = helper::FILTER_STRING_SHORT;
|
||||
|
@ -437,63 +484,129 @@ class form extends common {
|
|||
$input['type'] === 'mail') {
|
||||
$replyTo = $value;
|
||||
}
|
||||
|
||||
// Traitement de la pièce jointe, fichier avec extension valide de taille maximum $sizeMax
|
||||
// Fichier chargé dans site/file/uploads/ et effacé après l'envoi du mail
|
||||
if( $input['type'] === 'file'){
|
||||
$target_dir = self::FILE_DIR.'uploads';
|
||||
$sizeMax = $this->getData(['module', $this->getUrl(0), 'config', 'maxSizeUpload']);
|
||||
$extensions_valides = array( 'jpg' , 'jpeg' , 'gif' , 'png');
|
||||
$extensions_images = array( 'jpg' , 'jpeg' , 'gif' , 'png' );
|
||||
$file_name = basename($_FILES["fileToUpload"]["name"]);
|
||||
if( $_FILES["fileToUpload"]["error"] === 0){
|
||||
if($file_name !== '' && $file_name !== null){
|
||||
if( ! is_dir( $target_dir )) mkdir( $target_dir, 0744);
|
||||
// Copie du fichier .htaccess depuis module/form/ressource
|
||||
copy('./module/form/ressource/.htaccess', $target_dir.'/.htaccess');
|
||||
$target_file = $target_dir .'/'. $file_name;
|
||||
$imageFileType = strtolower(pathinfo($target_file,PATHINFO_EXTENSION));
|
||||
|
||||
// Vérification que la pièce jointe est une image quand son extension est celle d'une image
|
||||
if( $_FILES["fileToUpload"]["tmp_name"] !== '' && $_FILES["fileToUpload"]["tmp_name"] !== null
|
||||
&& in_array($imageFileType,$extensions_images)){
|
||||
$check = getimagesize($_FILES["fileToUpload"]["tmp_name"]);
|
||||
if($check === false) $notice = $text[4];
|
||||
}
|
||||
|
||||
// Vérification de la taille du fichier
|
||||
if ($_FILES["fileToUpload"]["size"] > $sizeMax) $notice = $text[6].intval($sizeMax/1000).' Ko';
|
||||
|
||||
// Vérification des types de fichiers autorisés
|
||||
if( ! in_array($imageFileType,$extensions_valides) ) $notice = $text[7];
|
||||
|
||||
// Upload du fichier
|
||||
if ($notice === '') {
|
||||
if (move_uploaded_file($_FILES["fileToUpload"]["tmp_name"], $target_file)) {
|
||||
$value = $file_name;
|
||||
} else {
|
||||
$notice = $text[8];
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
switch($_FILES["fileToUpload"]["error"]) {
|
||||
case 2 :
|
||||
$notice = $text[6].' MAX_FILE_SIZE : 5Mo';
|
||||
break;
|
||||
default:
|
||||
$notice = $text[8];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Préparation des données pour la création dans la base
|
||||
$data[$this->getData(['module', $this->getUrl(0), 'input', $index, 'name'])] = $value;
|
||||
// Préparation des données pour le mail
|
||||
$content .= '<strong>' . $this->getData(['module', $this->getUrl(0), 'input', $index, 'name']) . ' :</strong> ' . $value . '<br>';
|
||||
}
|
||||
// Crée les données
|
||||
$this->setData(['module', $this->getUrl(0), 'data', helper::increment(1, $this->getData(['module', $this->getUrl(0), 'data'])), $data]);
|
||||
// Envoi du mail
|
||||
// Rechercher l'adresse en fonction du mail
|
||||
$sent = true;
|
||||
$singleuser = $this->getData(['user',
|
||||
$this->getData(['module', $this->getUrl(0), 'config', 'user']),
|
||||
'mail']);
|
||||
$singlemail = $this->getData(['module', $this->getUrl(0), 'config', 'mail']);
|
||||
$group = $this->getData(['module', $this->getUrl(0), 'config', 'group']);
|
||||
// Verification si le mail peut être envoyé
|
||||
if(
|
||||
self::$inputNotices === [] && (
|
||||
$group > 0 ||
|
||||
$singleuser !== '' ||
|
||||
$singlemail !== '' )
|
||||
) {
|
||||
// Utilisateurs dans le groupe
|
||||
$to = [];
|
||||
if ($group > 0){
|
||||
foreach($this->getData(['user']) as $userId => $user) {
|
||||
if($user['group'] >= $group) {
|
||||
$to[] = $user['mail'];
|
||||
// Si absence d'erreur sur la pièce jointe
|
||||
if( $notice === ''){
|
||||
// Crée les données
|
||||
$this->setData(['module', $this->getUrl(0), 'data', helper::increment(1, $this->getData(['module', $this->getUrl(0), 'data'])), $data]);
|
||||
$sent = true;
|
||||
// Emission du mail
|
||||
// Rechercher l'adresse en fonction du mail
|
||||
$singleuser = $this->getData(['user',
|
||||
$this->getData(['module', $this->getUrl(0), 'config', 'user']),
|
||||
'mail']);
|
||||
$singlemail = $this->getData(['module', $this->getUrl(0), 'config', 'mail']);
|
||||
$group = $this->getData(['module', $this->getUrl(0), 'config', 'group']);
|
||||
// Verification si le mail peut être envoyé
|
||||
if(
|
||||
self::$inputNotices === [] && (
|
||||
$group > 0 ||
|
||||
$singleuser !== '' ||
|
||||
$singlemail !== '' )
|
||||
) {
|
||||
// Utilisateurs dans le groupe
|
||||
$to = [];
|
||||
if ($group > 0){
|
||||
foreach($this->getData(['user']) as $userId => $user) {
|
||||
if($user['group'] >= $group) {
|
||||
$to[] = $user['mail'];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// Utilisateur désigné
|
||||
if (!empty($singleuser)) {
|
||||
$to[] = $singleuser;
|
||||
}
|
||||
// Mail désigné
|
||||
if (!empty($singlemail)) {
|
||||
$to[] = $singlemail;
|
||||
}
|
||||
if($to) {
|
||||
// Sujet du mail
|
||||
$subject = $this->getData(['module', $this->getUrl(0), 'config', 'subject']);
|
||||
if($subject === '') {
|
||||
$subject = $text[1];
|
||||
// Utilisateur désigné
|
||||
if (!empty($singleuser)) {
|
||||
$to[] = $singleuser;
|
||||
}
|
||||
// Mail désigné
|
||||
if (!empty($singlemail)) {
|
||||
$to[] = $singlemail;
|
||||
}
|
||||
if($to) {
|
||||
// Sujet du mail
|
||||
$subject = $this->getData(['module', $this->getUrl(0), 'config', 'subject']);
|
||||
if($subject === '') {
|
||||
$subject = $text[1];
|
||||
}
|
||||
// Envoi le mail
|
||||
$sent = $this->sendMail(
|
||||
$to,
|
||||
$subject,
|
||||
$text[2] . $this->getData(['page', $this->getUrl(0), 'title']) . '" :<br><br>' .
|
||||
$content,
|
||||
$replyTo,
|
||||
$file_name
|
||||
);
|
||||
}
|
||||
// Envoi le mail
|
||||
$sent = $this->sendMail(
|
||||
$to,
|
||||
$subject,
|
||||
$text[2] . $this->getData(['page', $this->getUrl(0), 'title']) . '" :<br><br>' .
|
||||
$content,
|
||||
$replyTo
|
||||
);
|
||||
}
|
||||
// Nettoyage du dossier self::FILE_DIR.uploads
|
||||
$FilesUpload = glob( self::FILE_DIR.'uploads/*');
|
||||
foreach($FilesUpload as $file) {
|
||||
if(is_file($file)) unlink($file);
|
||||
}
|
||||
// Redirection
|
||||
$redirect = helper::baseUrl() . $this->getUrl(0);
|
||||
if ( $this->getData(['module', $this->getUrl(0), 'config', 'pageId']) !== '') $redirect = helper::baseUrl() . $this->getData(['module', $this->getUrl(0), 'config', 'pageId']);
|
||||
// Effacement des données provisoires
|
||||
$this->setData(['module', $this->getUrl(0), 'draft', '']);
|
||||
} else {
|
||||
$sent = false;
|
||||
$redirect = helper::baseUrl() . $this->getUrl(0);
|
||||
}
|
||||
// Redirection
|
||||
$redirect = $this->getData(['module', $this->getUrl(0), 'config', 'pageId']);
|
||||
// Passage de la langue d'administration à flatpickr
|
||||
$lang_flatpickr = 'fr';
|
||||
if( $this->getData(['config', 'i18n', 'langAdmin']) ==='en'){
|
||||
|
@ -506,9 +619,9 @@ class form extends common {
|
|||
<?php
|
||||
// Valeurs en sortie
|
||||
$this->addOutput([
|
||||
'notification' => ($sent === true ? $text[3] : $sent),
|
||||
'redirect' => $redirect ? helper::baseUrl() . $redirect : '',
|
||||
'state' => ($sent === true ? true : null),
|
||||
'notification' => ($sent === true ? $text[3] : $notice),
|
||||
'redirect' => $redirect,
|
||||
'state' => ($sent === true ? true : false),
|
||||
'vendor' => [
|
||||
'flatpickr'
|
||||
],
|
||||
|
|
|
@ -0,0 +1,4 @@
|
|||
# Interdire l'exécution de fichiers
|
||||
<FilesMatch "\.(php|phtml|php3|php4|php5|pl|py|jsp|asp|html|htm|shtml|sh|cgi|suspected)$">
|
||||
deny from all
|
||||
</FilesMatch>
|
|
@ -23,7 +23,7 @@ switch ($val) {
|
|||
$text[16] = 'A une adresse email';
|
||||
$text[17] = 'Un email ou une liste de diffusion';
|
||||
$text[18] = 'Répondre à l\'expéditeur depuis le mail de notification';
|
||||
$text[19] = 'Cette option permet de réponse drectement à l\'expéditeur du message si celui-ci a indiqué un email valide.';
|
||||
$text[19] = 'Cette option permet de répondre directement à l\'expéditeur du message si celui-ci a indiqué un email valide.';
|
||||
$text[20] = 'Sélectionner le type de signature';
|
||||
$text[21] = 'Sélectionnez le logo du site';
|
||||
$text[22] = 'Logo';
|
||||
|
@ -35,6 +35,7 @@ switch ($val) {
|
|||
$text[28] = 'Le formulaire ne contient aucun champ.';
|
||||
$text[29] = 'Version n°';
|
||||
$text[30] = 'Enregistrer';
|
||||
$text[31] = 'Taille maximale de la pièce jointe';
|
||||
$types = $module::$types;
|
||||
$signature = $module::$signature;
|
||||
break;
|
||||
|
@ -70,6 +71,7 @@ switch ($val) {
|
|||
$text[28] = 'The form contains no fields';
|
||||
$text[29] = 'Version no.';
|
||||
$text[30] = 'Register';
|
||||
$text[31] = 'Maximum size of the attachment';
|
||||
$types = $module::$types_en;
|
||||
$signature = $module::$signature_en;
|
||||
break;
|
||||
|
@ -242,9 +244,20 @@ switch ($val) {
|
|||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
<?php echo template::checkbox('formConfigCaptcha', true, $text[26], [
|
||||
'checked' => $this->getData(['module', $this->getUrl(0), 'config', 'captcha'])
|
||||
]); ?>
|
||||
<div class="row">
|
||||
<div class="col6">
|
||||
<?php echo template::checkbox('formConfigCaptcha', true, $text[26], [
|
||||
'checked' => $this->getData(['module', $this->getUrl(0), 'config', 'captcha'])
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col6">
|
||||
<?php echo template::select('formConfigMaxSize', $module::$maxSizeUpload, [
|
||||
'label' => $text[31],
|
||||
'selected' => $this->getData(['module', $this->getUrl(0), 'config', 'maxSizeUpload'])
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="block">
|
||||
<h4><?php echo $text[27]; ?></h4>
|
||||
|
|
|
@ -0,0 +1,39 @@
|
|||
/**
|
||||
* This file is part of DeltaCMS.
|
||||
* For full copyright and license information, please see the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
* @author Sylvain Lelièvre <lelievresylvain@free.fr>
|
||||
* @copyright Copyright (C) 2021-2022, Sylvain Lelièvre
|
||||
* @license GNU General Public License, version 3
|
||||
* @link https://deltacms.fr/
|
||||
*
|
||||
* Delta was created from version 11.2.00.24 of ZwiiCMS
|
||||
* @author Rémi Jean <remi.jean@outlook.com>
|
||||
* @copyright Copyright (C) 2008-2018, Rémi Jean
|
||||
* @author Frédéric Tempez <frederic.tempez@outlook.com>
|
||||
* @copyright Copyright (C) 2018-2021, Frédéric Tempez
|
||||
*/
|
||||
|
||||
|
||||
#formFileReset {
|
||||
background-color: red;
|
||||
border-width:1px;
|
||||
border-color: orange;
|
||||
font-size: 1.15em;
|
||||
font-style: bold;
|
||||
color: yellow;
|
||||
}
|
||||
|
||||
#formFileReset:hover {
|
||||
background-color: orange;
|
||||
border-color: orange;
|
||||
font-style: normal;
|
||||
color:black;
|
||||
}
|
||||
|
||||
.formInputFile {
|
||||
padding: 9px;
|
||||
border-radius: 2px;
|
||||
border: 1px solid #D8DFE3;
|
||||
backgroung-color: rgba(255,255,255,1);
|
||||
}
|
|
@ -15,3 +15,6 @@
|
|||
*/
|
||||
|
||||
|
||||
$( "#formFileReset" ).click(function() {
|
||||
$( "#fileToUpload" ).val('');
|
||||
});
|
||||
|
|
|
@ -14,12 +14,13 @@ switch ($val) {
|
|||
}
|
||||
?>
|
||||
<?php if($this->getData(['module', $this->getUrl(0), 'input'])): ?>
|
||||
<?php echo template::formOpen('formForm'); ?>
|
||||
<?php echo template::formOpenFile('formForm'); ?>
|
||||
<?php foreach($this->getData(['module', $this->getUrl(0), 'input']) as $index => $input): ?>
|
||||
<?php if($input['type'] === $module::TYPE_MAIL): ?>
|
||||
<?php echo template::mail('formInput[' . $index . ']', [
|
||||
'id' => 'formInput_' . $index,
|
||||
'label' => $input['name']
|
||||
'label' => $input['name'],
|
||||
'value' => $this->getData([ 'module', $this->getUrl(0), 'draft', 'mail'])
|
||||
]); ?>
|
||||
<?php elseif($input['type'] === $module::TYPE_SELECT): ?>
|
||||
<?php
|
||||
|
@ -30,32 +31,44 @@ switch ($val) {
|
|||
?>
|
||||
<?php echo template::select('formInput[' . $index . ']', $values, [
|
||||
'id' => 'formInput_' . $index,
|
||||
'label' => $input['name']
|
||||
'label' => $input['name'],
|
||||
'value' => $this->getData([ 'module', $this->getUrl(0), 'draft', 'select'])
|
||||
]); ?>
|
||||
<?php elseif($input['type'] === $module::TYPE_TEXT): ?>
|
||||
<?php echo template::text('formInput[' . $index . ']', [
|
||||
'id' => 'formInput_' . $index,
|
||||
'label' => $input['name']
|
||||
'label' => $input['name'],
|
||||
'value' => $this->getData([ 'module', $this->getUrl(0), 'draft', 'text'])
|
||||
]); ?>
|
||||
<?php elseif($input['type'] === $module::TYPE_TEXTAREA): ?>
|
||||
<?php echo template::textarea('formInput[' . $index . ']', [
|
||||
'id' => 'formInput_' . $index,
|
||||
'label' => $input['name']
|
||||
'label' => $input['name'],
|
||||
'value' => $this->getData([ 'module', $this->getUrl(0), 'draft', 'textarea'])
|
||||
]); ?>
|
||||
<?php elseif($input['type'] === $module::TYPE_DATETIME): ?>
|
||||
<?php echo template::date('formInput[' . $index . ']', [
|
||||
'id' => 'formInput_' . $index,
|
||||
'label' => $input['name'],
|
||||
'vendor' => 'flatpickr'
|
||||
'vendor' => 'flatpickr',
|
||||
'value' => $this->getData([ 'module', $this->getUrl(0), 'draft', 'datetime'])
|
||||
]); ?>
|
||||
<?php elseif($input['type'] === $module::TYPE_CHECKBOX): ?>
|
||||
<?php echo template::checkbox('formInput[' . $index . ']', true, $input['name']
|
||||
); ?>
|
||||
<?php echo template::checkbox('formInput[' . $index . ']', true, $input['name'], [
|
||||
'checked' => $this->getData([ 'module', $this->getUrl(0), 'draft', 'checkbox'])
|
||||
]); ?>
|
||||
|
||||
|
||||
|
||||
<?php elseif($input['type'] === $module::TYPE_FILE): ?>
|
||||
<label class='formLabel'> <?php echo $input['name']; ?> </label>
|
||||
<div class="formInputFile">
|
||||
<input type="hidden" name="MAX_FILE_SIZE" value="5000000">
|
||||
<input type="file" name="fileToUpload" id="fileToUpload">
|
||||
<input type="button" id="formFileReset" value="X">
|
||||
</div><br>
|
||||
<?php elseif($input['type'] === $module::TYPE_LABEL): ?>
|
||||
<h3 class='formLabel'>
|
||||
<?php echo $input['name']; ?>
|
||||
<hr class="formLabel">
|
||||
</h3>
|
||||
<p class='formLabel'> <?php echo $input['name']; ?> </p>
|
||||
<?php endif; ?>
|
||||
<?php endforeach; ?>
|
||||
<?php if($this->getData(['module', $this->getUrl(0), 'config', 'captcha'])): ?>
|
||||
|
|
|
@ -675,7 +675,7 @@ class gallery extends common {
|
|||
// Tri des images
|
||||
switch ($this->getData(['module', $this->getUrl(0), 'content', $this->getUrl(2), 'config', 'sort'])) {
|
||||
case self::SORT_HAND:
|
||||
$positions = $this->getdata(['module',$this->getUrl(0), $this->getUrl(2),'positions']);
|
||||
$positions = $this->getdata(['module',$this->getUrl(0),'content', $this->getUrl(2),'positions']);
|
||||
if ($positions) {
|
||||
foreach ($positions as $key => $value) {
|
||||
if (array_key_exists($key,self::$pictures)) {
|
||||
|
|
|
@ -68,11 +68,7 @@ $( document ).ready(function() {
|
|||
$("#galleryTable").tableDnD({
|
||||
onDrop: function(table, row) {
|
||||
$("#galleryEditFormResponse").val($.tableDnD.serialize());
|
||||
},
|
||||
onDragStop : function(table, row) {
|
||||
// Sauvegarde le tri
|
||||
sortPictures();
|
||||
$("#galleryEditFormResponse").val("");
|
||||
},
|
||||
serializeRegexp: ""
|
||||
});
|
||||
|
|
|
@ -146,7 +146,9 @@ if( file_exists($fichiers_json.'filtre_primaire.json')){
|
|||
|
||||
//Initialisation si c'est un nouvel indice
|
||||
if(!isset($log[$indice])){
|
||||
$log[$indice] = array('ip' => $ip, 'user_id'=> $delta_user_id, 'userAgent' => $_SERVER['HTTP_USER_AGENT'], 'langage' => $_SERVER['HTTP_ACCEPT_LANGUAGE'], 'referer' => $_SERVER['HTTP_REFERER'], 'vues' => array(), 'client' => array() );
|
||||
$referer = '';
|
||||
if( isset( $_SERVER['HTTP_REFERER'] )) $referer = $_SERVER['HTTP_REFERER'];
|
||||
$log[$indice] = array('ip' => $ip, 'user_id'=> $delta_user_id, 'userAgent' => $_SERVER['HTTP_USER_AGENT'], 'langage' => $_SERVER['HTTP_ACCEPT_LANGUAGE'], 'referer' => $referer, 'vues' => array(), 'client' => array() );
|
||||
}
|
||||
// Ajout de la vue sous la forme date et page vue
|
||||
$indice2 = count($log[$indice]['vues']);
|
||||
|
|
|
@ -605,12 +605,12 @@ class statislite extends common {
|
|||
// Sauvegarde de sécurité des fichiers json
|
||||
$this->sauvegardeJson();
|
||||
// Réinitialisation des fichiers json
|
||||
$this -> initcumul();
|
||||
$this -> initchrono();
|
||||
file_put_contents( self::$fichiers_json.'robots.json', '{}');
|
||||
file_put_contents( self::$fichiers_json.'sessionInvalide.json', '{}');
|
||||
file_put_contents( self::$fichiers_json.'affitampon.json', '{}');
|
||||
file_put_contents( self::$fichiers_json.'sessionLog.json', '{}');
|
||||
$this -> initcumul();
|
||||
$this -> initchrono();
|
||||
file_put_contents( self::$fichiers_json.'robots.json', '{}');
|
||||
file_put_contents( self::$fichiers_json.'sessionInvalide.json', '{}');
|
||||
file_put_contents( self::$fichiers_json.'affitampon.json', '{}');
|
||||
file_put_contents( self::$fichiers_json.'sessionLog.json', '{}');
|
||||
// Valeurs en sortie
|
||||
$this->addOutput([
|
||||
'redirect' => helper::baseUrl() . $this->getUrl(0) . '/config',
|
||||
|
@ -846,7 +846,9 @@ class statislite extends common {
|
|||
$log[$numSession]['vues'] = $tableau[$numSession]['vues'];
|
||||
$nbpageparsession = count($log[$numSession]['vues']);
|
||||
}
|
||||
$ip = $log[$numSession]['ip'];
|
||||
if(isset($log[$numSession]['ip'])){
|
||||
$ip = $log[$numSession]['ip'];
|
||||
}
|
||||
$datetimei = strtotime(substr($log[$numSession]['vues'][0], 0 , 19));
|
||||
// Si $nbpageparsession <=1 on force la valeur de $datetimef
|
||||
if($nbpageparsession <= 1){
|
||||
|
@ -884,10 +886,10 @@ class statislite extends common {
|
|||
$log[$numSession]['client'][2] = $this->systeme($log[$numSession]['userAgent']);
|
||||
// Geolocalisation si elle n'a pas été faite et si l'IP n'est pas déjà détruite
|
||||
if(isset($log[$numSession]['ip'])){
|
||||
if($geolocalisation && ! isset($log[$numSession]['geolocalisation'])){
|
||||
/*if($geolocalisation && ! isset($log[$numSession]['geolocalisation'])){
|
||||
$geo = $this->geolocalise($log[$numSession]['ip']);
|
||||
$log[$numSession]['geolocalisation'] = $geo['country_name'].' - '.$geo['city'];
|
||||
}
|
||||
}*/
|
||||
// CNIL : ne pas mémoriser d'adresse IP
|
||||
unset($log[$numSession]['ip']);
|
||||
}
|
||||
|
@ -998,8 +1000,10 @@ class statislite extends common {
|
|||
$nom = substr($value, 22 , strlen($value));
|
||||
//$date = strtotime(substr($value, 0 , 19)); ajouter dans le if && ( strtotime(substr($tab[$numSession]['vues'][$i], 0 , 19)) - $date) < 60)
|
||||
for($i=$key + 1 ; $i < $nbpageparsession; $i++){
|
||||
if( substr($tab[$numSession]['vues'][$i], 22 , strlen($tab[$numSession]['vues'][$i])) == $nom){
|
||||
unset($tab[$numSession]['vues'][$i]);
|
||||
if( isset ($tab[$numSession]['vues'][$i])){
|
||||
if( substr($tab[$numSession]['vues'][$i], 22 , strlen($tab[$numSession]['vues'][$i])) == $nom){
|
||||
unset($tab[$numSession]['vues'][$i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1063,7 +1067,7 @@ class statislite extends common {
|
|||
}
|
||||
|
||||
// Geolocalisation
|
||||
if($log[$numSession]['geolocalisation'] != 'Fichier - clef_ipapi_com.txt - absent , .'){
|
||||
/*if($log[$numSession]['geolocalisation'] != 'Fichier - clef_ipapi_com.txt - absent , .'){
|
||||
// Extraction du pays
|
||||
$postiret = strpos($log[$numSession]['geolocalisation'], '-');
|
||||
$pays = substr($log[$numSession]['geolocalisation'], 0, $postiret - 1);
|
||||
|
@ -1080,6 +1084,7 @@ class statislite extends common {
|
|||
$cumul['clients']['localisation'][$pays] = 1;
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
// Mise à jour des variables liées au fichier sessionLog.json
|
||||
self::$comptepages = self::$comptepages - $nbpageparsession;
|
||||
|
@ -1311,9 +1316,11 @@ class statislite extends common {
|
|||
}
|
||||
$tampon = $tableau;
|
||||
$nbsessiontampon = count($tampon);
|
||||
for($i=0; $i < $nbEnregSession; $i++){
|
||||
self::$affidetaille[$i] = $tampon[$nbsessiontampon - 1 - $i];
|
||||
if($nbsessiontampon - 1 - $i == 0){ break;}
|
||||
if( $nbsessiontampon > 0 ){
|
||||
for($i=0; $i < $nbEnregSession; $i++){
|
||||
self::$affidetaille[$i] = $tampon[$nbsessiontampon - 1 - $i];
|
||||
if($nbsessiontampon - 1 - $i === 0) break;
|
||||
}
|
||||
}
|
||||
|
||||
// Valeurs en sortie
|
||||
|
@ -1402,7 +1409,7 @@ class statislite extends common {
|
|||
|
||||
/* Geolocalisation */
|
||||
/* Utilisation de cette fonction supprimée */
|
||||
private function geolocalise($ip){
|
||||
/*private function geolocalise($ip){
|
||||
// Géolocalisation avec le site www.ipapi.com qui offre 10000 requêtes / mois
|
||||
if( is_file(self::$base.'clef_ipapi_com.txt')){
|
||||
$access_key = file_get_contents(self::$base.'clef_ipapi_com.txt');
|
||||
|
@ -1420,6 +1427,7 @@ class statislite extends common {
|
|||
}
|
||||
return $api_result;
|
||||
}
|
||||
*/
|
||||
|
||||
/* Initialisation de cumul.json */
|
||||
private function initcumul(){
|
||||
|
|
Loading…
Reference in New Issue