- Add RGPD folder
This commit is contained in:
parent
1f4dab1385
commit
dd8a84056b
27 changed files with 21373 additions and 0 deletions
103
rgpd/consommateurs/css/style.css
Normal file
103
rgpd/consommateurs/css/style.css
Normal file
|
|
@ -0,0 +1,103 @@
|
|||
html, body {
|
||||
width: 100%;
|
||||
height:100%;
|
||||
overflow:hidden;
|
||||
margin: 0;
|
||||
}
|
||||
body {
|
||||
background-color: #fff;
|
||||
background-image: url(../img/bg-page-big.jpg);
|
||||
background-size: auto 100%;
|
||||
background-repeat: no-repeat;
|
||||
background-position: left top;
|
||||
font-family: "helvetica_neue_lt_std75_bold", Helvetica, Arial, sans-serif;
|
||||
font-size: .8em;
|
||||
font-weight: bold;
|
||||
color: #7d7c7c;
|
||||
}
|
||||
|
||||
.container, .return {
|
||||
background-color: #f0f0f0;
|
||||
width: 40%;
|
||||
min-width: 300px;
|
||||
}
|
||||
.container {
|
||||
margin: 25px 25px 0;
|
||||
padding: 10px 5px 0;
|
||||
}
|
||||
fieldset span {
|
||||
font-size: .8em;
|
||||
font-weight: normal;
|
||||
font-style: italic;
|
||||
}
|
||||
fieldset p {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
input, select, textarea {
|
||||
padding: 10px 5px;
|
||||
font-family: "helvetica_neue_lt_std75_bold", Helvetica, Arial, sans-serif;
|
||||
font-size: .9em;
|
||||
font-weight: normal;
|
||||
color: #a7a7a7;
|
||||
font-style: italic;
|
||||
border: none;
|
||||
}
|
||||
/* select {
|
||||
min-width: 215px;
|
||||
} */
|
||||
textarea {
|
||||
width: 80%;
|
||||
resize: none;
|
||||
}
|
||||
fieldset {
|
||||
border: none;
|
||||
}
|
||||
fieldset legend {
|
||||
font-size: 1.5em;
|
||||
}
|
||||
input[type=text] {
|
||||
margin-left: 10px;
|
||||
}
|
||||
input[type=submit] {
|
||||
background-color: #e00d23;
|
||||
color: white;
|
||||
width: 200px;
|
||||
font-weight: bold;
|
||||
font-style: normal;
|
||||
font-size: 1.5em;
|
||||
}
|
||||
.return {
|
||||
margin: 0 25px 0;
|
||||
padding: 1px 5px 1px;
|
||||
}
|
||||
.return a {
|
||||
text-decoration: none;
|
||||
font-weight: bolder;
|
||||
color: #7d7c7c;
|
||||
}
|
||||
/* .return p, #charte p {
|
||||
display: inline-block;
|
||||
} */
|
||||
|
||||
#charte h2 {
|
||||
color: red;
|
||||
}
|
||||
|
||||
input:focus, select:focus, textarea:focus {
|
||||
outline: none;
|
||||
}
|
||||
select:active, select:hover {
|
||||
outline-color: red
|
||||
}
|
||||
input[type=submit]:hover {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.return a:hover, #charte a:hover {
|
||||
color: red;
|
||||
}
|
||||
.return a:visited, #charte a:visited {
|
||||
color: #7d7c7c;
|
||||
}
|
||||
31
rgpd/consommateurs/functions.php
Normal file
31
rgpd/consommateurs/functions.php
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
<?php
|
||||
|
||||
function configure_smtp(PHPMailer\PHPMailer\PHPMailer $phpmailer){
|
||||
$phpmailer->IsHTML(true);
|
||||
//Pour ne pas avoir de soucis par la suite il est conseillé de donner l' encodage
|
||||
$phpmailer->CharSet = "utf-8";
|
||||
$phpmailer->isSMTP(); //switch to smtp
|
||||
// A MODIFIER SELON L'ENV ******************
|
||||
//$phpmailer->Host = '192.168.34.254'; // DEV
|
||||
$phpmailer->Host = '192.168.31.254'; // PRD
|
||||
// FIN DE MODIF. ***************************
|
||||
$phpmailer->SMTPAuth = false;
|
||||
$phpmailer->Port = '25';
|
||||
$phpmailer->Username = '';
|
||||
$phpmailer->Password = '';
|
||||
$phpmailer->SMTPSecure = false;
|
||||
//$phpmailer->AddAddress('sebastien.hattry@ldc.fr'); // A MODIFIER
|
||||
$phpmailer->AddAddress('rgpd@ldc.fr'); // A MODIFIER
|
||||
$phpmailer->AddBCC('sylvain.gouet@ldc.fr'); // A MODIFIER
|
||||
$phpmailer->AddBCC('sebastien.hattry@ldc.fr'); // A MODIFIER
|
||||
$phpmailer->SMTPAutoTLS = false;
|
||||
$phpmailer->SMTPOptions = array(
|
||||
'ssl' => array(
|
||||
'verify_peer' => false,
|
||||
'verify_peer_name' => false,
|
||||
'allow_self_signed' => true
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
?>
|
||||
BIN
rgpd/consommateurs/img/bg-page-big.jpg
Normal file
BIN
rgpd/consommateurs/img/bg-page-big.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 685 KiB |
39
rgpd/consommateurs/inc/Exception.php
Normal file
39
rgpd/consommateurs/inc/Exception.php
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
<?php
|
||||
/**
|
||||
* PHPMailer Exception class.
|
||||
* PHP Version 5.5.
|
||||
*
|
||||
* @see https://github.com/PHPMailer/PHPMailer/ The PHPMailer GitHub project
|
||||
*
|
||||
* @author Marcus Bointon (Synchro/coolbru) <phpmailer@synchromedia.co.uk>
|
||||
* @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 2010 - 2012 Jim Jagielski
|
||||
* @copyright 2004 - 2009 Andy Prevost
|
||||
* @license http://www.gnu.org/copyleft/lesser.html GNU Lesser General Public License
|
||||
* @note This program is distributed in the hope that it will be useful - WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*/
|
||||
|
||||
namespace PHPMailer\PHPMailer;
|
||||
|
||||
/**
|
||||
* PHPMailer exception handler.
|
||||
*
|
||||
* @author Marcus Bointon <phpmailer@synchromedia.co.uk>
|
||||
*/
|
||||
class Exception extends \Exception
|
||||
{
|
||||
/**
|
||||
* Prettify error message output.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function errorMessage()
|
||||
{
|
||||
return '<strong>' . htmlspecialchars($this->getMessage()) . "</strong><br />\n";
|
||||
}
|
||||
}
|
||||
138
rgpd/consommateurs/inc/OAuth.php
Normal file
138
rgpd/consommateurs/inc/OAuth.php
Normal file
|
|
@ -0,0 +1,138 @@
|
|||
<?php
|
||||
/**
|
||||
* PHPMailer - PHP email creation and transport class.
|
||||
* PHP Version 5.5.
|
||||
*
|
||||
* @see https://github.com/PHPMailer/PHPMailer/ The PHPMailer GitHub project
|
||||
*
|
||||
* @author Marcus Bointon (Synchro/coolbru) <phpmailer@synchromedia.co.uk>
|
||||
* @author Jim Jagielski (jimjag) <jimjag@gmail.com>
|
||||
* @author Andy Prevost (codeworxtech) <codeworxtech@users.sourceforge.net>
|
||||
* @author Brent R. Matzelle (original founder)
|
||||
* @copyright 2012 - 2015 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
|
||||
* @note This program is distributed in the hope that it will be useful - WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*/
|
||||
|
||||
namespace PHPMailer\PHPMailer;
|
||||
|
||||
use League\OAuth2\Client\Grant\RefreshToken;
|
||||
use League\OAuth2\Client\Provider\AbstractProvider;
|
||||
use League\OAuth2\Client\Token\AccessToken;
|
||||
|
||||
/**
|
||||
* OAuth - OAuth2 authentication wrapper class.
|
||||
* Uses the oauth2-client package from the League of Extraordinary Packages.
|
||||
*
|
||||
* @see http://oauth2-client.thephpleague.com
|
||||
*
|
||||
* @author Marcus Bointon (Synchro/coolbru) <phpmailer@synchromedia.co.uk>
|
||||
*/
|
||||
class OAuth
|
||||
{
|
||||
/**
|
||||
* An instance of the League OAuth Client Provider.
|
||||
*
|
||||
* @var AbstractProvider
|
||||
*/
|
||||
protected $provider;
|
||||
|
||||
/**
|
||||
* The current OAuth access token.
|
||||
*
|
||||
* @var AccessToken
|
||||
*/
|
||||
protected $oauthToken;
|
||||
|
||||
/**
|
||||
* The user's email address, usually used as the login ID
|
||||
* and also the from address when sending email.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $oauthUserEmail = '';
|
||||
|
||||
/**
|
||||
* The client secret, generated in the app definition of the service you're connecting to.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $oauthClientSecret = '';
|
||||
|
||||
/**
|
||||
* The client ID, generated in the app definition of the service you're connecting to.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $oauthClientId = '';
|
||||
|
||||
/**
|
||||
* The refresh token, used to obtain new AccessTokens.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $oauthRefreshToken = '';
|
||||
|
||||
/**
|
||||
* OAuth constructor.
|
||||
*
|
||||
* @param array $options Associative array containing
|
||||
* `provider`, `userName`, `clientSecret`, `clientId` and `refreshToken` elements
|
||||
*/
|
||||
public function __construct($options)
|
||||
{
|
||||
$this->provider = $options['provider'];
|
||||
$this->oauthUserEmail = $options['userName'];
|
||||
$this->oauthClientSecret = $options['clientSecret'];
|
||||
$this->oauthClientId = $options['clientId'];
|
||||
$this->oauthRefreshToken = $options['refreshToken'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a new RefreshToken.
|
||||
*
|
||||
* @return RefreshToken
|
||||
*/
|
||||
protected function getGrant()
|
||||
{
|
||||
return new RefreshToken();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a new AccessToken.
|
||||
*
|
||||
* @return AccessToken
|
||||
*/
|
||||
protected function getToken()
|
||||
{
|
||||
return $this->provider->getAccessToken(
|
||||
$this->getGrant(),
|
||||
['refresh_token' => $this->oauthRefreshToken]
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate a base64-encoded OAuth token.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getOauth64()
|
||||
{
|
||||
// Get a new token if it's not available or has expired
|
||||
if (null === $this->oauthToken || $this->oauthToken->hasExpired()) {
|
||||
$this->oauthToken = $this->getToken();
|
||||
}
|
||||
|
||||
return base64_encode(
|
||||
'user=' .
|
||||
$this->oauthUserEmail .
|
||||
"\001auth=Bearer " .
|
||||
$this->oauthToken .
|
||||
"\001\001"
|
||||
);
|
||||
}
|
||||
}
|
||||
4778
rgpd/consommateurs/inc/PHPMailer.php
Normal file
4778
rgpd/consommateurs/inc/PHPMailer.php
Normal file
File diff suppressed because it is too large
Load diff
419
rgpd/consommateurs/inc/POP3.php
Normal file
419
rgpd/consommateurs/inc/POP3.php
Normal file
|
|
@ -0,0 +1,419 @@
|
|||
<?php
|
||||
/**
|
||||
* PHPMailer POP-Before-SMTP Authentication Class.
|
||||
* PHP Version 5.5.
|
||||
*
|
||||
* @see https://github.com/PHPMailer/PHPMailer/ The PHPMailer GitHub project
|
||||
*
|
||||
* @author Marcus Bointon (Synchro/coolbru) <phpmailer@synchromedia.co.uk>
|
||||
* @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 2010 - 2012 Jim Jagielski
|
||||
* @copyright 2004 - 2009 Andy Prevost
|
||||
* @license http://www.gnu.org/copyleft/lesser.html GNU Lesser General Public License
|
||||
* @note This program is distributed in the hope that it will be useful - WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*/
|
||||
|
||||
namespace PHPMailer\PHPMailer;
|
||||
|
||||
/**
|
||||
* PHPMailer POP-Before-SMTP Authentication Class.
|
||||
* Specifically for PHPMailer to use for RFC1939 POP-before-SMTP authentication.
|
||||
* 1) This class does not support APOP authentication.
|
||||
* 2) Opening and closing lots of POP3 connections can be quite slow. If you need
|
||||
* to send a batch of emails then just perform the authentication once at the start,
|
||||
* and then loop through your mail sending script. Providing this process doesn't
|
||||
* take longer than the verification period lasts on your POP3 server, you should be fine.
|
||||
* 3) This is really ancient technology; you should only need to use it to talk to very old systems.
|
||||
* 4) This POP3 class is deliberately lightweight and incomplete, implementing just
|
||||
* enough to do authentication.
|
||||
* If you want a more complete class there are other POP3 classes for PHP available.
|
||||
*
|
||||
* @author Richard Davey (original author) <rich@corephp.co.uk>
|
||||
* @author Marcus Bointon (Synchro/coolbru) <phpmailer@synchromedia.co.uk>
|
||||
* @author Jim Jagielski (jimjag) <jimjag@gmail.com>
|
||||
* @author Andy Prevost (codeworxtech) <codeworxtech@users.sourceforge.net>
|
||||
*/
|
||||
class POP3
|
||||
{
|
||||
/**
|
||||
* The POP3 PHPMailer Version number.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
const VERSION = '6.1.4';
|
||||
|
||||
/**
|
||||
* Default POP3 port number.
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
const DEFAULT_PORT = 110;
|
||||
|
||||
/**
|
||||
* Default timeout in seconds.
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
const DEFAULT_TIMEOUT = 30;
|
||||
|
||||
/**
|
||||
* Debug display level.
|
||||
* Options: 0 = no, 1+ = yes.
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
public $do_debug = 0;
|
||||
|
||||
/**
|
||||
* POP3 mail server hostname.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $host;
|
||||
|
||||
/**
|
||||
* POP3 port number.
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
public $port;
|
||||
|
||||
/**
|
||||
* POP3 Timeout Value in seconds.
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
public $tval;
|
||||
|
||||
/**
|
||||
* POP3 username.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $username;
|
||||
|
||||
/**
|
||||
* POP3 password.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $password;
|
||||
|
||||
/**
|
||||
* Resource handle for the POP3 connection socket.
|
||||
*
|
||||
* @var resource
|
||||
*/
|
||||
protected $pop_conn;
|
||||
|
||||
/**
|
||||
* Are we connected?
|
||||
*
|
||||
* @var bool
|
||||
*/
|
||||
protected $connected = false;
|
||||
|
||||
/**
|
||||
* Error container.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $errors = [];
|
||||
|
||||
/**
|
||||
* Line break constant.
|
||||
*/
|
||||
const LE = "\r\n";
|
||||
|
||||
/**
|
||||
* Simple static wrapper for all-in-one POP before SMTP.
|
||||
*
|
||||
* @param string $host The hostname to connect to
|
||||
* @param int|bool $port The port number to connect to
|
||||
* @param int|bool $timeout The timeout value
|
||||
* @param string $username
|
||||
* @param string $password
|
||||
* @param int $debug_level
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public static function popBeforeSmtp(
|
||||
$host,
|
||||
$port = false,
|
||||
$timeout = false,
|
||||
$username = '',
|
||||
$password = '',
|
||||
$debug_level = 0
|
||||
) {
|
||||
$pop = new self();
|
||||
|
||||
return $pop->authorise($host, $port, $timeout, $username, $password, $debug_level);
|
||||
}
|
||||
|
||||
/**
|
||||
* Authenticate with a POP3 server.
|
||||
* A connect, login, disconnect sequence
|
||||
* appropriate for POP-before SMTP authorisation.
|
||||
*
|
||||
* @param string $host The hostname to connect to
|
||||
* @param int|bool $port The port number to connect to
|
||||
* @param int|bool $timeout The timeout value
|
||||
* @param string $username
|
||||
* @param string $password
|
||||
* @param int $debug_level
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function authorise($host, $port = false, $timeout = false, $username = '', $password = '', $debug_level = 0)
|
||||
{
|
||||
$this->host = $host;
|
||||
// If no port value provided, use default
|
||||
if (false === $port) {
|
||||
$this->port = static::DEFAULT_PORT;
|
||||
} else {
|
||||
$this->port = (int) $port;
|
||||
}
|
||||
// If no timeout value provided, use default
|
||||
if (false === $timeout) {
|
||||
$this->tval = static::DEFAULT_TIMEOUT;
|
||||
} else {
|
||||
$this->tval = (int) $timeout;
|
||||
}
|
||||
$this->do_debug = $debug_level;
|
||||
$this->username = $username;
|
||||
$this->password = $password;
|
||||
// Reset the error log
|
||||
$this->errors = [];
|
||||
// connect
|
||||
$result = $this->connect($this->host, $this->port, $this->tval);
|
||||
if ($result) {
|
||||
$login_result = $this->login($this->username, $this->password);
|
||||
if ($login_result) {
|
||||
$this->disconnect();
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
// We need to disconnect regardless of whether the login succeeded
|
||||
$this->disconnect();
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Connect to a POP3 server.
|
||||
*
|
||||
* @param string $host
|
||||
* @param int|bool $port
|
||||
* @param int $tval
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function connect($host, $port = false, $tval = 30)
|
||||
{
|
||||
// Are we already connected?
|
||||
if ($this->connected) {
|
||||
return true;
|
||||
}
|
||||
|
||||
//On Windows this will raise a PHP Warning error if the hostname doesn't exist.
|
||||
//Rather than suppress it with @fsockopen, capture it cleanly instead
|
||||
set_error_handler([$this, 'catchWarning']);
|
||||
|
||||
if (false === $port) {
|
||||
$port = static::DEFAULT_PORT;
|
||||
}
|
||||
|
||||
// connect to the POP3 server
|
||||
$this->pop_conn = fsockopen(
|
||||
$host, // POP3 Host
|
||||
$port, // Port #
|
||||
$errno, // Error Number
|
||||
$errstr, // Error Message
|
||||
$tval
|
||||
); // Timeout (seconds)
|
||||
// Restore the error handler
|
||||
restore_error_handler();
|
||||
|
||||
// Did we connect?
|
||||
if (false === $this->pop_conn) {
|
||||
// It would appear not...
|
||||
$this->setError(
|
||||
"Failed to connect to server $host on port $port. errno: $errno; errstr: $errstr"
|
||||
);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
// Increase the stream time-out
|
||||
stream_set_timeout($this->pop_conn, $tval, 0);
|
||||
|
||||
// Get the POP3 server response
|
||||
$pop3_response = $this->getResponse();
|
||||
// Check for the +OK
|
||||
if ($this->checkResponse($pop3_response)) {
|
||||
// The connection is established and the POP3 server is talking
|
||||
$this->connected = true;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Log in to the POP3 server.
|
||||
* Does not support APOP (RFC 2828, 4949).
|
||||
*
|
||||
* @param string $username
|
||||
* @param string $password
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function login($username = '', $password = '')
|
||||
{
|
||||
if (!$this->connected) {
|
||||
$this->setError('Not connected to POP3 server');
|
||||
}
|
||||
if (empty($username)) {
|
||||
$username = $this->username;
|
||||
}
|
||||
if (empty($password)) {
|
||||
$password = $this->password;
|
||||
}
|
||||
|
||||
// Send the Username
|
||||
$this->sendString("USER $username" . static::LE);
|
||||
$pop3_response = $this->getResponse();
|
||||
if ($this->checkResponse($pop3_response)) {
|
||||
// Send the Password
|
||||
$this->sendString("PASS $password" . static::LE);
|
||||
$pop3_response = $this->getResponse();
|
||||
if ($this->checkResponse($pop3_response)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Disconnect from the POP3 server.
|
||||
*/
|
||||
public function disconnect()
|
||||
{
|
||||
$this->sendString('QUIT');
|
||||
//The QUIT command may cause the daemon to exit, which will kill our connection
|
||||
//So ignore errors here
|
||||
try {
|
||||
@fclose($this->pop_conn);
|
||||
} catch (Exception $e) {
|
||||
//Do nothing
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a response from the POP3 server.
|
||||
*
|
||||
* @param int $size The maximum number of bytes to retrieve
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected function getResponse($size = 128)
|
||||
{
|
||||
$response = fgets($this->pop_conn, $size);
|
||||
if ($this->do_debug >= 1) {
|
||||
echo 'Server -> Client: ', $response;
|
||||
}
|
||||
|
||||
return $response;
|
||||
}
|
||||
|
||||
/**
|
||||
* Send raw data to the POP3 server.
|
||||
*
|
||||
* @param string $string
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
protected function sendString($string)
|
||||
{
|
||||
if ($this->pop_conn) {
|
||||
if ($this->do_debug >= 2) { //Show client messages when debug >= 2
|
||||
echo 'Client -> Server: ', $string;
|
||||
}
|
||||
|
||||
return fwrite($this->pop_conn, $string, strlen($string));
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks the POP3 server response.
|
||||
* Looks for for +OK or -ERR.
|
||||
*
|
||||
* @param string $string
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
protected function checkResponse($string)
|
||||
{
|
||||
if (strpos($string, '+OK') !== 0) {
|
||||
$this->setError("Server reported an error: $string");
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add an error to the internal error store.
|
||||
* Also display debug output if it's enabled.
|
||||
*
|
||||
* @param string $error
|
||||
*/
|
||||
protected function setError($error)
|
||||
{
|
||||
$this->errors[] = $error;
|
||||
if ($this->do_debug >= 1) {
|
||||
echo '<pre>';
|
||||
foreach ($this->errors as $e) {
|
||||
print_r($e);
|
||||
}
|
||||
echo '</pre>';
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get an array of error messages, if any.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getErrors()
|
||||
{
|
||||
return $this->errors;
|
||||
}
|
||||
|
||||
/**
|
||||
* POP3 connection error handler.
|
||||
*
|
||||
* @param int $errno
|
||||
* @param string $errstr
|
||||
* @param string $errfile
|
||||
* @param int $errline
|
||||
*/
|
||||
protected function catchWarning($errno, $errstr, $errfile, $errline)
|
||||
{
|
||||
$this->setError(
|
||||
'Connecting to the POP3 server raised a PHP warning:' .
|
||||
"errno: $errno errstr: $errstr; errfile: $errfile; errline: $errline"
|
||||
);
|
||||
}
|
||||
}
|
||||
1370
rgpd/consommateurs/inc/SMTP.php
Normal file
1370
rgpd/consommateurs/inc/SMTP.php
Normal file
File diff suppressed because it is too large
Load diff
271
rgpd/consommateurs/index.php
Normal file
271
rgpd/consommateurs/index.php
Normal file
|
|
@ -0,0 +1,271 @@
|
|||
<?php
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
// ********* !! A LIRE AVANT TOUTE DIFFUSION EN DEV ET/OU PRD !! *********
|
||||
//
|
||||
// 1. Fichier index commun à CONSOMMATEURS et PROFESSIONNELS
|
||||
// Pour passer de l'un à l'autre, il faut modifier la value de "name="source""
|
||||
//
|
||||
// 2. Certaines lignes sont à commenter / décommenter selon l'environnement de mise en place
|
||||
// Pour passer de DEV à PRD (ou inversement), il faut modifier "MODIFIER SELON L'ENV"
|
||||
//
|
||||
// ************************************************************************
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
use PHPMailer\PHPMailer\PHPMailer;
|
||||
use PHPMailer\PHPMailer\Exception;
|
||||
|
||||
require("inc/PHPMailer.php");
|
||||
require("inc/SMTP.php");
|
||||
require("inc/Exception.php");
|
||||
require("functions.php");
|
||||
|
||||
// Tableau de tous les sites pointant sur le formulaire RGPD Groupe LDC
|
||||
$tSitesweb = array ('acb', 'agis-sa', 'boutique-vol', 'corico', 'espri', 'foods', 'idhalal', 'jx-argoat', 'jx-reghalal', 'ldc', 'ldc-rest', 'lmdb', 'lpt', 'lta', 'mairet', 'marie', 'mdn-loue', 'ner', 'pet', 'sbv', 'tda', 'regalette');
|
||||
$sDebug="";
|
||||
|
||||
// Connexion à la Bdd LDC pour récupération de la charte LDC de WP
|
||||
// A MODIFIER SELON L'ENV ************
|
||||
// $db = new \PDO('mysql:host=192.168.34.2;dbname=ldc2014;charset=UTF8', 'ldc2014adm', 'M86Am6Bz', array(\PDO::ATTR_ERRMODE => \PDO::ERRMODE_EXCEPTION)); // DEV
|
||||
$db = new \PDO('mysql:host=192.168.31.101;dbname=ldc2014;charset=UTF8', 'ldc2014adm', 'M86Am6Bz', array(\PDO::ATTR_ERRMODE => \PDO::ERRMODE_EXCEPTION)); // PRD
|
||||
// FIN DE MODIF. *********************
|
||||
|
||||
// Si j'ai des POST et que j'ai le POST du recaptcha
|
||||
if(isset($_POST) && isset($_POST['g-recaptcha-response'])){
|
||||
$secret = "6LcPodQUAAAAANOJ3SMyXVidfktbHFesx5VIAxsO";
|
||||
$response = $_POST['g-recaptcha-response'];
|
||||
|
||||
if(isset($_SERVER["HTTP_X_FORWARDED_FOR"]) && $_SERVER["HTTP_X_FORWARDED_FOR"] != ""){
|
||||
if (strpos($_SERVER['HTTP_X_FORWARDED_FOR'], ',')) {
|
||||
$explode = explode(',', $_SERVER['HTTP_X_FORWARDED_FOR']);
|
||||
$remoteip = trim($explode[0]);
|
||||
}else{
|
||||
$remoteip = $_SERVER['HTTP_X_FORWARDED_FOR'];
|
||||
}
|
||||
}else{
|
||||
$remoteip = $_SERVER["REMOTE_ADDR"];
|
||||
}
|
||||
|
||||
$api_url = "https://www.google.com/recaptcha/api/siteverify?secret=". $secret. "&response=" . $response. "&remoteip=" . $remoteip ;
|
||||
$decode = json_decode(file_get_contents($api_url), true);
|
||||
|
||||
// Si le recaptcha et OK
|
||||
if ($decode['success'] == true){
|
||||
|
||||
session_start();
|
||||
|
||||
// Déclaration d'un PHPMailer
|
||||
$mail = new PHPMailer();
|
||||
// Valorisation des variables pour dialoguer avec le serveur mail
|
||||
configure_smtp($mail);
|
||||
$bPass=false;
|
||||
$sErreur="";
|
||||
$sSiteweb="";
|
||||
|
||||
// Vérification que toutes les informations demandées ont été renseignées
|
||||
if (isset($_POST['lastname']) && isset($_POST['firstname']) && isset($_POST['email'])) {
|
||||
$sSource=htmlspecialchars($_POST['source']);
|
||||
$sLastName=htmlspecialchars($_POST['lastname']);
|
||||
$sFirstName=htmlspecialchars($_POST['firstname']);
|
||||
$sMail=htmlspecialchars($_POST['email']);
|
||||
$sChoice=htmlspecialchars($_POST['droits']);
|
||||
$sMsg=htmlspecialchars($_POST['commentaires']);
|
||||
// Vérification de la structure de l'adresse mail (la gestion d'erreur n'est pas prise en compte)
|
||||
if (!preg_match("#^[a-z0-9._-]+@[a-z0-9._-]{2,}\.[a-z]{2,4}$#", $sMail)) {
|
||||
$sErreur="La structure de l'email n'est pas correcte !";
|
||||
}
|
||||
// Dès qu'il y a un GET website, on ctrl selon le tab déclaré en début de code.
|
||||
if (isset($_GET['website'])) {
|
||||
$sSiteweb=htmlspecialchars($_GET['website']);
|
||||
$bSiteOK=false;
|
||||
foreach($tSitesweb as $site) {
|
||||
if ($sSiteweb == $site) {
|
||||
$bSiteOK=true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
// On construit le mail si pas de GET siteweb ou si le GET est OK.
|
||||
if ($sSiteweb == "" || $bSiteOK == true) {
|
||||
//Objet du mail
|
||||
$mail->Subject = 'Nouvelles dispositions RGPD - ' . $sSource;
|
||||
// Email de l'expéditeur affiché dans le mail envoyé.
|
||||
$mail->From =$sMail;
|
||||
// Email de l'expéditeur
|
||||
$mail->Sender= $sMail;
|
||||
// Nom de l'expéditeur affiché dans le mail envoyé
|
||||
$mail->FromName= $sFirstName . ' ' . $sLastName;
|
||||
|
||||
switch ($sChoice) {
|
||||
case 'check':
|
||||
$right='Vérifier mes données';
|
||||
break;
|
||||
case 'modify':
|
||||
$right='Rectifier mes données';
|
||||
break;
|
||||
case 'delete':
|
||||
$right='Effacer mes données';
|
||||
break;
|
||||
case 'freeze':
|
||||
$right='Geler l\'utilisation de mes données';
|
||||
break;
|
||||
case 'import':
|
||||
$right='Emporter mes données';
|
||||
break;
|
||||
case 'refuse':
|
||||
$right='M\'opposer à l\'utilisation de mes données';
|
||||
break;
|
||||
default:
|
||||
$right='Aucun choix.';
|
||||
break;
|
||||
}
|
||||
//Le contenu du mail.
|
||||
if ($sSiteweb != "") {
|
||||
$sBody="<b>Source : </b>" . $sSource . " (via le site web " . $sSiteweb . ")<br><br>";
|
||||
} else {
|
||||
$sBody="<b>Source : </b>" . $sSource . "<br><br>";
|
||||
}
|
||||
$sBody=$sBody . "<b>Nom : </b>" . $sLastName . "<br>";
|
||||
$sBody=$sBody . "<b>Prénom : </b>" . $sFirstName . "<br>";
|
||||
$sBody=$sBody . "<b>Email : </b>" . $sMail . "<br><br>";
|
||||
$sBody=$sBody . "<b>L'utilisateur souhaite exercer le droit suivant :</b> " . $right . "<br><br>";
|
||||
$sBody=$sBody . "<b>Message : </b>" . $sMsg;
|
||||
|
||||
$mail->Body = $sBody;
|
||||
|
||||
$bSendOK=false;
|
||||
$bPass=true;
|
||||
if ($mail->send()){
|
||||
$bSendOK=true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
||||
<!DOCTYPE html>
|
||||
<html lang="fr">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<meta http-equiv="X-UA-Compatible" content="ie=edge">
|
||||
<link rel="stylesheet" href="css/style.css"/>
|
||||
<script src="https://cdn.jsdelivr.net/npm/jquery@3.4.1/dist/jquery.min.js"></script>
|
||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/fancyapps/fancybox@3.5.7/dist/jquery.fancybox.min.css" />
|
||||
<script src="https://cdn.jsdelivr.net/gh/fancyapps/fancybox@3.5.7/dist/jquery.fancybox.min.js"></script>
|
||||
<script src='https://www.google.com/recaptcha/api.js' async defer></script>
|
||||
<title>Formulaire RGPD</title>
|
||||
</head>
|
||||
<body>
|
||||
<div class="container">
|
||||
<form method="POST">
|
||||
<fieldset>
|
||||
<legend>Maîtriser mes données personnelles<?php echo($sDebug);?></legend>
|
||||
<p>
|
||||
<label for="nom">Nom*</label>
|
||||
<input type="text" name="lastname" id="nom" style="width:196px;" autofocus required>
|
||||
|
||||
</p>
|
||||
<p>
|
||||
<label for="prenom">Prénom*</label>
|
||||
<input type="text" name="firstname" id="prenom" style="width:177px;" required>
|
||||
</p>
|
||||
<p>
|
||||
<label for="courriel">Email*</label>
|
||||
<input type="text" name="email" id="mail" style="width:191px;" required>
|
||||
</p>
|
||||
<p>
|
||||
<select name="droits" id="selDroits" style="width:250px;">
|
||||
<option value="ask" selected>Quel droit souhaitez-vous exercer ?</option>
|
||||
<option value="check">Vérifier mes données</option>
|
||||
<option value="modify">Rectifier mes données</option>
|
||||
<option value="delete">Effacer mes données</option>
|
||||
<option value="freeze">Geler l'utilisation de mes données</option>
|
||||
<option value="import">Emporter mes données</option>
|
||||
<option value="refuse">M'opposer à l'utilisation de mes données</option>
|
||||
</select>
|
||||
</p>
|
||||
<p>
|
||||
<textarea name="commentaires" id="comment" maxlength="1900" rows="10" placeholder="Informations complémentaires notamment si vous souhaitez nous expliquer les raisons de votre demande (et nous permettre d'améliorer nos services)"></textarea>
|
||||
</p>
|
||||
<div class="g-recaptcha" data-sitekey="6LcPodQUAAAAAEOYHMF7Et6qvzu_F3jZ3HhOlV7Q"></div>
|
||||
<p class="button">
|
||||
<span>
|
||||
<input type="hidden" name="source" value="consommateurs">
|
||||
<!-- <input type="hidden" name="source" value="professionnels"> -->
|
||||
<input type="submit" value="Envoyer">
|
||||
</span>
|
||||
<span> </span>
|
||||
<span>*champs obligatoires</span>
|
||||
</p>
|
||||
</fieldset>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<?php
|
||||
if ($bSendOK) {
|
||||
?>
|
||||
<div class="return">
|
||||
<p>Votre demande a été transmise à nos services. Vous recevrez une réponse à l'adresse mail renseignée dans le formulaire dans les plus brefs délais. Pour plus d'informations, merci de consulter notre <a data-fancybox data-src="#charte" href="javascript:;">charte de confidentialité</a>.<br>
|
||||
A bientôt <?php echo($sFirstName); ?> sur notre site !</p>
|
||||
</div>
|
||||
<?php
|
||||
try {
|
||||
$query = $db->prepare("select post_content from ldc_posts where ID = :id");
|
||||
// A MODIFIER SELON L'ENVIRONNEMENT ******************
|
||||
// $query->execute(['id' => 24453]); // DEV *
|
||||
$query->execute(['id' => 33584]); // PRD *
|
||||
// FIN DE MODIF. *************************************
|
||||
} catch (\PDOException $e) {
|
||||
die($e->getMessage());
|
||||
}
|
||||
$query->setFetchMode(\PDO::FETCH_ASSOC);
|
||||
$result = $query->fetch();
|
||||
$query->closeCursor();
|
||||
?>
|
||||
<div id="charte" style="display:none; width:80%; height:80%;">
|
||||
<?= $result['post_content']; ?>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
else {
|
||||
if ($bPass) {
|
||||
?>
|
||||
<div class="return">
|
||||
<p>La demande n'a pas été envoyée car un des champs n'a pas été correctement renseigné !</p>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
103
rgpd/professionnels/css/style.css
Normal file
103
rgpd/professionnels/css/style.css
Normal file
|
|
@ -0,0 +1,103 @@
|
|||
html, body {
|
||||
width: 100%;
|
||||
height:100%;
|
||||
overflow:hidden;
|
||||
margin: 0;
|
||||
}
|
||||
body {
|
||||
background-color: #fff;
|
||||
background-image: url(../img/bg-page-big.jpg);
|
||||
background-size: auto 100%;
|
||||
background-repeat: no-repeat;
|
||||
background-position: left top;
|
||||
font-family: "helvetica_neue_lt_std75_bold", Helvetica, Arial, sans-serif;
|
||||
font-size: .8em;
|
||||
font-weight: bold;
|
||||
color: #7d7c7c;
|
||||
}
|
||||
|
||||
.container, .return {
|
||||
background-color: #f0f0f0;
|
||||
width: 40%;
|
||||
min-width: 300px;
|
||||
}
|
||||
.container {
|
||||
margin: 25px 25px 0;
|
||||
padding: 10px 5px 0;
|
||||
}
|
||||
fieldset span {
|
||||
font-size: .8em;
|
||||
font-weight: normal;
|
||||
font-style: italic;
|
||||
}
|
||||
fieldset p {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
input, select, textarea {
|
||||
padding: 10px 5px;
|
||||
font-family: "helvetica_neue_lt_std75_bold", Helvetica, Arial, sans-serif;
|
||||
font-size: .9em;
|
||||
font-weight: normal;
|
||||
color: #a7a7a7;
|
||||
font-style: italic;
|
||||
border: none;
|
||||
}
|
||||
/* select {
|
||||
min-width: 215px;
|
||||
} */
|
||||
textarea {
|
||||
width: 80%;
|
||||
resize: none;
|
||||
}
|
||||
fieldset {
|
||||
border: none;
|
||||
}
|
||||
fieldset legend {
|
||||
font-size: 1.5em;
|
||||
}
|
||||
input[type=text] {
|
||||
margin-left: 10px;
|
||||
}
|
||||
input[type=submit] {
|
||||
background-color: #e00d23;
|
||||
color: white;
|
||||
width: 200px;
|
||||
font-weight: bold;
|
||||
font-style: normal;
|
||||
font-size: 1.5em;
|
||||
}
|
||||
.return {
|
||||
margin: 0 25px 0;
|
||||
padding: 1px 5px 1px;
|
||||
}
|
||||
.return a {
|
||||
text-decoration: none;
|
||||
font-weight: bolder;
|
||||
color: #7d7c7c;
|
||||
}
|
||||
/* .return p, #charte p {
|
||||
display: inline-block;
|
||||
} */
|
||||
|
||||
#charte h2 {
|
||||
color: red;
|
||||
}
|
||||
|
||||
input:focus, select:focus, textarea:focus {
|
||||
outline: none;
|
||||
}
|
||||
select:active, select:hover {
|
||||
outline-color: red
|
||||
}
|
||||
input[type=submit]:hover {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.return a:hover, #charte a:hover {
|
||||
color: red;
|
||||
}
|
||||
.return a:visited, #charte a:visited {
|
||||
color: #7d7c7c;
|
||||
}
|
||||
27
rgpd/professionnels/functions.php
Normal file
27
rgpd/professionnels/functions.php
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
<?php
|
||||
|
||||
function configure_smtp(PHPMailer\PHPMailer\PHPMailer $phpmailer){
|
||||
$phpmailer->IsHTML(true);
|
||||
//Pour ne pas avoir de soucis par la suite il est conseillé de donner l' encodage
|
||||
$phpmailer->CharSet = "utf-8";
|
||||
$phpmailer->isSMTP(); //switch to smtp
|
||||
$phpmailer->Host = '192.168.31.254'; // A MODIFIER SELON L'ENV
|
||||
$phpmailer->SMTPAuth = false;
|
||||
$phpmailer->Port = '25';
|
||||
$phpmailer->Username = '';
|
||||
$phpmailer->Password = '';
|
||||
$phpmailer->SMTPSecure = false;
|
||||
// $phpmailer->AddAddress('sebastien.hattry@ldc.fr'); // A MODIFIER
|
||||
$phpmailer->AddAddress('rgpd@ldc.fr'); // A MODIFIER
|
||||
$phpmailer->AddBCC('sylvain.gouet@ldc.fr'); // A MODIFIER
|
||||
$phpmailer->SMTPAutoTLS = false;
|
||||
$phpmailer->SMTPOptions = array(
|
||||
'ssl' => array(
|
||||
'verify_peer' => false,
|
||||
'verify_peer_name' => false,
|
||||
'allow_self_signed' => true
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
?>
|
||||
BIN
rgpd/professionnels/img/bg-page-big.jpg
Normal file
BIN
rgpd/professionnels/img/bg-page-big.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 685 KiB |
39
rgpd/professionnels/inc/Exception.php
Normal file
39
rgpd/professionnels/inc/Exception.php
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
<?php
|
||||
/**
|
||||
* PHPMailer Exception class.
|
||||
* PHP Version 5.5.
|
||||
*
|
||||
* @see https://github.com/PHPMailer/PHPMailer/ The PHPMailer GitHub project
|
||||
*
|
||||
* @author Marcus Bointon (Synchro/coolbru) <phpmailer@synchromedia.co.uk>
|
||||
* @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 2010 - 2012 Jim Jagielski
|
||||
* @copyright 2004 - 2009 Andy Prevost
|
||||
* @license http://www.gnu.org/copyleft/lesser.html GNU Lesser General Public License
|
||||
* @note This program is distributed in the hope that it will be useful - WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*/
|
||||
|
||||
namespace PHPMailer\PHPMailer;
|
||||
|
||||
/**
|
||||
* PHPMailer exception handler.
|
||||
*
|
||||
* @author Marcus Bointon <phpmailer@synchromedia.co.uk>
|
||||
*/
|
||||
class Exception extends \Exception
|
||||
{
|
||||
/**
|
||||
* Prettify error message output.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function errorMessage()
|
||||
{
|
||||
return '<strong>' . htmlspecialchars($this->getMessage()) . "</strong><br />\n";
|
||||
}
|
||||
}
|
||||
138
rgpd/professionnels/inc/OAuth.php
Normal file
138
rgpd/professionnels/inc/OAuth.php
Normal file
|
|
@ -0,0 +1,138 @@
|
|||
<?php
|
||||
/**
|
||||
* PHPMailer - PHP email creation and transport class.
|
||||
* PHP Version 5.5.
|
||||
*
|
||||
* @see https://github.com/PHPMailer/PHPMailer/ The PHPMailer GitHub project
|
||||
*
|
||||
* @author Marcus Bointon (Synchro/coolbru) <phpmailer@synchromedia.co.uk>
|
||||
* @author Jim Jagielski (jimjag) <jimjag@gmail.com>
|
||||
* @author Andy Prevost (codeworxtech) <codeworxtech@users.sourceforge.net>
|
||||
* @author Brent R. Matzelle (original founder)
|
||||
* @copyright 2012 - 2015 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
|
||||
* @note This program is distributed in the hope that it will be useful - WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*/
|
||||
|
||||
namespace PHPMailer\PHPMailer;
|
||||
|
||||
use League\OAuth2\Client\Grant\RefreshToken;
|
||||
use League\OAuth2\Client\Provider\AbstractProvider;
|
||||
use League\OAuth2\Client\Token\AccessToken;
|
||||
|
||||
/**
|
||||
* OAuth - OAuth2 authentication wrapper class.
|
||||
* Uses the oauth2-client package from the League of Extraordinary Packages.
|
||||
*
|
||||
* @see http://oauth2-client.thephpleague.com
|
||||
*
|
||||
* @author Marcus Bointon (Synchro/coolbru) <phpmailer@synchromedia.co.uk>
|
||||
*/
|
||||
class OAuth
|
||||
{
|
||||
/**
|
||||
* An instance of the League OAuth Client Provider.
|
||||
*
|
||||
* @var AbstractProvider
|
||||
*/
|
||||
protected $provider;
|
||||
|
||||
/**
|
||||
* The current OAuth access token.
|
||||
*
|
||||
* @var AccessToken
|
||||
*/
|
||||
protected $oauthToken;
|
||||
|
||||
/**
|
||||
* The user's email address, usually used as the login ID
|
||||
* and also the from address when sending email.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $oauthUserEmail = '';
|
||||
|
||||
/**
|
||||
* The client secret, generated in the app definition of the service you're connecting to.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $oauthClientSecret = '';
|
||||
|
||||
/**
|
||||
* The client ID, generated in the app definition of the service you're connecting to.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $oauthClientId = '';
|
||||
|
||||
/**
|
||||
* The refresh token, used to obtain new AccessTokens.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $oauthRefreshToken = '';
|
||||
|
||||
/**
|
||||
* OAuth constructor.
|
||||
*
|
||||
* @param array $options Associative array containing
|
||||
* `provider`, `userName`, `clientSecret`, `clientId` and `refreshToken` elements
|
||||
*/
|
||||
public function __construct($options)
|
||||
{
|
||||
$this->provider = $options['provider'];
|
||||
$this->oauthUserEmail = $options['userName'];
|
||||
$this->oauthClientSecret = $options['clientSecret'];
|
||||
$this->oauthClientId = $options['clientId'];
|
||||
$this->oauthRefreshToken = $options['refreshToken'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a new RefreshToken.
|
||||
*
|
||||
* @return RefreshToken
|
||||
*/
|
||||
protected function getGrant()
|
||||
{
|
||||
return new RefreshToken();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a new AccessToken.
|
||||
*
|
||||
* @return AccessToken
|
||||
*/
|
||||
protected function getToken()
|
||||
{
|
||||
return $this->provider->getAccessToken(
|
||||
$this->getGrant(),
|
||||
['refresh_token' => $this->oauthRefreshToken]
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate a base64-encoded OAuth token.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getOauth64()
|
||||
{
|
||||
// Get a new token if it's not available or has expired
|
||||
if (null === $this->oauthToken || $this->oauthToken->hasExpired()) {
|
||||
$this->oauthToken = $this->getToken();
|
||||
}
|
||||
|
||||
return base64_encode(
|
||||
'user=' .
|
||||
$this->oauthUserEmail .
|
||||
"\001auth=Bearer " .
|
||||
$this->oauthToken .
|
||||
"\001\001"
|
||||
);
|
||||
}
|
||||
}
|
||||
4778
rgpd/professionnels/inc/PHPMailer.php
Normal file
4778
rgpd/professionnels/inc/PHPMailer.php
Normal file
File diff suppressed because it is too large
Load diff
419
rgpd/professionnels/inc/POP3.php
Normal file
419
rgpd/professionnels/inc/POP3.php
Normal file
|
|
@ -0,0 +1,419 @@
|
|||
<?php
|
||||
/**
|
||||
* PHPMailer POP-Before-SMTP Authentication Class.
|
||||
* PHP Version 5.5.
|
||||
*
|
||||
* @see https://github.com/PHPMailer/PHPMailer/ The PHPMailer GitHub project
|
||||
*
|
||||
* @author Marcus Bointon (Synchro/coolbru) <phpmailer@synchromedia.co.uk>
|
||||
* @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 2010 - 2012 Jim Jagielski
|
||||
* @copyright 2004 - 2009 Andy Prevost
|
||||
* @license http://www.gnu.org/copyleft/lesser.html GNU Lesser General Public License
|
||||
* @note This program is distributed in the hope that it will be useful - WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*/
|
||||
|
||||
namespace PHPMailer\PHPMailer;
|
||||
|
||||
/**
|
||||
* PHPMailer POP-Before-SMTP Authentication Class.
|
||||
* Specifically for PHPMailer to use for RFC1939 POP-before-SMTP authentication.
|
||||
* 1) This class does not support APOP authentication.
|
||||
* 2) Opening and closing lots of POP3 connections can be quite slow. If you need
|
||||
* to send a batch of emails then just perform the authentication once at the start,
|
||||
* and then loop through your mail sending script. Providing this process doesn't
|
||||
* take longer than the verification period lasts on your POP3 server, you should be fine.
|
||||
* 3) This is really ancient technology; you should only need to use it to talk to very old systems.
|
||||
* 4) This POP3 class is deliberately lightweight and incomplete, implementing just
|
||||
* enough to do authentication.
|
||||
* If you want a more complete class there are other POP3 classes for PHP available.
|
||||
*
|
||||
* @author Richard Davey (original author) <rich@corephp.co.uk>
|
||||
* @author Marcus Bointon (Synchro/coolbru) <phpmailer@synchromedia.co.uk>
|
||||
* @author Jim Jagielski (jimjag) <jimjag@gmail.com>
|
||||
* @author Andy Prevost (codeworxtech) <codeworxtech@users.sourceforge.net>
|
||||
*/
|
||||
class POP3
|
||||
{
|
||||
/**
|
||||
* The POP3 PHPMailer Version number.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
const VERSION = '6.1.4';
|
||||
|
||||
/**
|
||||
* Default POP3 port number.
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
const DEFAULT_PORT = 110;
|
||||
|
||||
/**
|
||||
* Default timeout in seconds.
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
const DEFAULT_TIMEOUT = 30;
|
||||
|
||||
/**
|
||||
* Debug display level.
|
||||
* Options: 0 = no, 1+ = yes.
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
public $do_debug = 0;
|
||||
|
||||
/**
|
||||
* POP3 mail server hostname.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $host;
|
||||
|
||||
/**
|
||||
* POP3 port number.
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
public $port;
|
||||
|
||||
/**
|
||||
* POP3 Timeout Value in seconds.
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
public $tval;
|
||||
|
||||
/**
|
||||
* POP3 username.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $username;
|
||||
|
||||
/**
|
||||
* POP3 password.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $password;
|
||||
|
||||
/**
|
||||
* Resource handle for the POP3 connection socket.
|
||||
*
|
||||
* @var resource
|
||||
*/
|
||||
protected $pop_conn;
|
||||
|
||||
/**
|
||||
* Are we connected?
|
||||
*
|
||||
* @var bool
|
||||
*/
|
||||
protected $connected = false;
|
||||
|
||||
/**
|
||||
* Error container.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $errors = [];
|
||||
|
||||
/**
|
||||
* Line break constant.
|
||||
*/
|
||||
const LE = "\r\n";
|
||||
|
||||
/**
|
||||
* Simple static wrapper for all-in-one POP before SMTP.
|
||||
*
|
||||
* @param string $host The hostname to connect to
|
||||
* @param int|bool $port The port number to connect to
|
||||
* @param int|bool $timeout The timeout value
|
||||
* @param string $username
|
||||
* @param string $password
|
||||
* @param int $debug_level
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public static function popBeforeSmtp(
|
||||
$host,
|
||||
$port = false,
|
||||
$timeout = false,
|
||||
$username = '',
|
||||
$password = '',
|
||||
$debug_level = 0
|
||||
) {
|
||||
$pop = new self();
|
||||
|
||||
return $pop->authorise($host, $port, $timeout, $username, $password, $debug_level);
|
||||
}
|
||||
|
||||
/**
|
||||
* Authenticate with a POP3 server.
|
||||
* A connect, login, disconnect sequence
|
||||
* appropriate for POP-before SMTP authorisation.
|
||||
*
|
||||
* @param string $host The hostname to connect to
|
||||
* @param int|bool $port The port number to connect to
|
||||
* @param int|bool $timeout The timeout value
|
||||
* @param string $username
|
||||
* @param string $password
|
||||
* @param int $debug_level
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function authorise($host, $port = false, $timeout = false, $username = '', $password = '', $debug_level = 0)
|
||||
{
|
||||
$this->host = $host;
|
||||
// If no port value provided, use default
|
||||
if (false === $port) {
|
||||
$this->port = static::DEFAULT_PORT;
|
||||
} else {
|
||||
$this->port = (int) $port;
|
||||
}
|
||||
// If no timeout value provided, use default
|
||||
if (false === $timeout) {
|
||||
$this->tval = static::DEFAULT_TIMEOUT;
|
||||
} else {
|
||||
$this->tval = (int) $timeout;
|
||||
}
|
||||
$this->do_debug = $debug_level;
|
||||
$this->username = $username;
|
||||
$this->password = $password;
|
||||
// Reset the error log
|
||||
$this->errors = [];
|
||||
// connect
|
||||
$result = $this->connect($this->host, $this->port, $this->tval);
|
||||
if ($result) {
|
||||
$login_result = $this->login($this->username, $this->password);
|
||||
if ($login_result) {
|
||||
$this->disconnect();
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
// We need to disconnect regardless of whether the login succeeded
|
||||
$this->disconnect();
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Connect to a POP3 server.
|
||||
*
|
||||
* @param string $host
|
||||
* @param int|bool $port
|
||||
* @param int $tval
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function connect($host, $port = false, $tval = 30)
|
||||
{
|
||||
// Are we already connected?
|
||||
if ($this->connected) {
|
||||
return true;
|
||||
}
|
||||
|
||||
//On Windows this will raise a PHP Warning error if the hostname doesn't exist.
|
||||
//Rather than suppress it with @fsockopen, capture it cleanly instead
|
||||
set_error_handler([$this, 'catchWarning']);
|
||||
|
||||
if (false === $port) {
|
||||
$port = static::DEFAULT_PORT;
|
||||
}
|
||||
|
||||
// connect to the POP3 server
|
||||
$this->pop_conn = fsockopen(
|
||||
$host, // POP3 Host
|
||||
$port, // Port #
|
||||
$errno, // Error Number
|
||||
$errstr, // Error Message
|
||||
$tval
|
||||
); // Timeout (seconds)
|
||||
// Restore the error handler
|
||||
restore_error_handler();
|
||||
|
||||
// Did we connect?
|
||||
if (false === $this->pop_conn) {
|
||||
// It would appear not...
|
||||
$this->setError(
|
||||
"Failed to connect to server $host on port $port. errno: $errno; errstr: $errstr"
|
||||
);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
// Increase the stream time-out
|
||||
stream_set_timeout($this->pop_conn, $tval, 0);
|
||||
|
||||
// Get the POP3 server response
|
||||
$pop3_response = $this->getResponse();
|
||||
// Check for the +OK
|
||||
if ($this->checkResponse($pop3_response)) {
|
||||
// The connection is established and the POP3 server is talking
|
||||
$this->connected = true;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Log in to the POP3 server.
|
||||
* Does not support APOP (RFC 2828, 4949).
|
||||
*
|
||||
* @param string $username
|
||||
* @param string $password
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function login($username = '', $password = '')
|
||||
{
|
||||
if (!$this->connected) {
|
||||
$this->setError('Not connected to POP3 server');
|
||||
}
|
||||
if (empty($username)) {
|
||||
$username = $this->username;
|
||||
}
|
||||
if (empty($password)) {
|
||||
$password = $this->password;
|
||||
}
|
||||
|
||||
// Send the Username
|
||||
$this->sendString("USER $username" . static::LE);
|
||||
$pop3_response = $this->getResponse();
|
||||
if ($this->checkResponse($pop3_response)) {
|
||||
// Send the Password
|
||||
$this->sendString("PASS $password" . static::LE);
|
||||
$pop3_response = $this->getResponse();
|
||||
if ($this->checkResponse($pop3_response)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Disconnect from the POP3 server.
|
||||
*/
|
||||
public function disconnect()
|
||||
{
|
||||
$this->sendString('QUIT');
|
||||
//The QUIT command may cause the daemon to exit, which will kill our connection
|
||||
//So ignore errors here
|
||||
try {
|
||||
@fclose($this->pop_conn);
|
||||
} catch (Exception $e) {
|
||||
//Do nothing
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a response from the POP3 server.
|
||||
*
|
||||
* @param int $size The maximum number of bytes to retrieve
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected function getResponse($size = 128)
|
||||
{
|
||||
$response = fgets($this->pop_conn, $size);
|
||||
if ($this->do_debug >= 1) {
|
||||
echo 'Server -> Client: ', $response;
|
||||
}
|
||||
|
||||
return $response;
|
||||
}
|
||||
|
||||
/**
|
||||
* Send raw data to the POP3 server.
|
||||
*
|
||||
* @param string $string
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
protected function sendString($string)
|
||||
{
|
||||
if ($this->pop_conn) {
|
||||
if ($this->do_debug >= 2) { //Show client messages when debug >= 2
|
||||
echo 'Client -> Server: ', $string;
|
||||
}
|
||||
|
||||
return fwrite($this->pop_conn, $string, strlen($string));
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks the POP3 server response.
|
||||
* Looks for for +OK or -ERR.
|
||||
*
|
||||
* @param string $string
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
protected function checkResponse($string)
|
||||
{
|
||||
if (strpos($string, '+OK') !== 0) {
|
||||
$this->setError("Server reported an error: $string");
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add an error to the internal error store.
|
||||
* Also display debug output if it's enabled.
|
||||
*
|
||||
* @param string $error
|
||||
*/
|
||||
protected function setError($error)
|
||||
{
|
||||
$this->errors[] = $error;
|
||||
if ($this->do_debug >= 1) {
|
||||
echo '<pre>';
|
||||
foreach ($this->errors as $e) {
|
||||
print_r($e);
|
||||
}
|
||||
echo '</pre>';
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get an array of error messages, if any.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getErrors()
|
||||
{
|
||||
return $this->errors;
|
||||
}
|
||||
|
||||
/**
|
||||
* POP3 connection error handler.
|
||||
*
|
||||
* @param int $errno
|
||||
* @param string $errstr
|
||||
* @param string $errfile
|
||||
* @param int $errline
|
||||
*/
|
||||
protected function catchWarning($errno, $errstr, $errfile, $errline)
|
||||
{
|
||||
$this->setError(
|
||||
'Connecting to the POP3 server raised a PHP warning:' .
|
||||
"errno: $errno errstr: $errstr; errfile: $errfile; errline: $errline"
|
||||
);
|
||||
}
|
||||
}
|
||||
1370
rgpd/professionnels/inc/SMTP.php
Normal file
1370
rgpd/professionnels/inc/SMTP.php
Normal file
File diff suppressed because it is too large
Load diff
271
rgpd/professionnels/index.php
Normal file
271
rgpd/professionnels/index.php
Normal file
|
|
@ -0,0 +1,271 @@
|
|||
<?php
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
// ********* !! A LIRE AVANT TOUTE DIFFUSION EN DEV ET/OU PRD !! *********
|
||||
//
|
||||
// 1. Fichier index commun à CONSOMMATEURS et PROFESSIONNELS
|
||||
// Pour passer de l'un à l'autre, il faut modifier la value de "name="source""
|
||||
//
|
||||
// 2. Certaines lignes sont à commenter / décommenter selon l'environnement de mise en place
|
||||
// Pour passer de DEV à PRD (ou inversement), il faut modifier "MODIFIER SELON L'ENV"
|
||||
//
|
||||
// ************************************************************************
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
use PHPMailer\PHPMailer\PHPMailer;
|
||||
use PHPMailer\PHPMailer\Exception;
|
||||
|
||||
require("inc/PHPMailer.php");
|
||||
require("inc/SMTP.php");
|
||||
require("inc/Exception.php");
|
||||
require("functions.php");
|
||||
|
||||
// Tableau de tous les sites pointant sur le formulaire RGPD Groupe LDC
|
||||
$tSitesweb = array ('idhalal', 'tda', 'ldc', 'agis-sa', 'sbv');
|
||||
$sDebug="";
|
||||
|
||||
// Connexion à la Bdd LDC pour récupération de la charte LDC de WP
|
||||
// A MODIFIER SELON L'ENV ************
|
||||
//$db = new \PDO('mysql:host=192.168.34.2;dbname=ldc2014;charset=UTF8', 'ldc2014adm', 'M86Am6Bz', array(\PDO::ATTR_ERRMODE => \PDO::ERRMODE_EXCEPTION)); // DEV
|
||||
$db = new \PDO('mysql:host=192.168.31.101;dbname=ldc2014;charset=UTF8', 'ldc2014adm', 'M86Am6Bz', array(\PDO::ATTR_ERRMODE => \PDO::ERRMODE_EXCEPTION)); // PRD
|
||||
// FIN DE MODIF. *********************
|
||||
|
||||
// Si j'ai des POST et que j'ai le POST du recaptcha
|
||||
if(isset($_POST) && isset($_POST['g-recaptcha-response'])){
|
||||
$secret = "6LcPodQUAAAAANOJ3SMyXVidfktbHFesx5VIAxsO";
|
||||
$response = $_POST['g-recaptcha-response'];
|
||||
|
||||
if(isset($_SERVER["HTTP_X_FORWARDED_FOR"]) && $_SERVER["HTTP_X_FORWARDED_FOR"] != ""){
|
||||
if (strpos($_SERVER['HTTP_X_FORWARDED_FOR'], ',')) {
|
||||
$explode = explode(',', $_SERVER['HTTP_X_FORWARDED_FOR']);
|
||||
$remoteip = trim($explode[0]);
|
||||
}else{
|
||||
$remoteip = $_SERVER['HTTP_X_FORWARDED_FOR'];
|
||||
}
|
||||
}else{
|
||||
$remoteip = $_SERVER["REMOTE_ADDR"];
|
||||
}
|
||||
|
||||
$api_url = "https://www.google.com/recaptcha/api/siteverify?secret=". $secret. "&response=" . $response. "&remoteip=" . $remoteip ;
|
||||
$decode = json_decode(file_get_contents($api_url), true);
|
||||
|
||||
// Si le recaptcha et OK
|
||||
if ($decode['success'] == true){
|
||||
|
||||
session_start();
|
||||
|
||||
// Déclaration d'un PHPMailer
|
||||
$mail = new PHPMailer();
|
||||
// Valorisation des variables pour dialoguer avec le serveur mail
|
||||
configure_smtp($mail);
|
||||
$bPass=false;
|
||||
$sErreur="";
|
||||
$sSiteweb="";
|
||||
|
||||
// Vérification que toutes les informations demandées ont été renseignées
|
||||
if (isset($_POST['lastname']) && isset($_POST['firstname']) && isset($_POST['email'])) {
|
||||
$sSource=htmlspecialchars($_POST['source']);
|
||||
$sLastName=htmlspecialchars($_POST['lastname']);
|
||||
$sFirstName=htmlspecialchars($_POST['firstname']);
|
||||
$sMail=htmlspecialchars($_POST['email']);
|
||||
$sChoice=htmlspecialchars($_POST['droits']);
|
||||
$sMsg=htmlspecialchars($_POST['commentaires']);
|
||||
// Vérification de la structure de l'adresse mail (la gestion d'erreur n'est pas prise en compte)
|
||||
if (!preg_match("#^[a-z0-9._-]+@[a-z0-9._-]{2,}\.[a-z]{2,4}$#", $sMail)) {
|
||||
$sErreur="La structure de l'email n'est pas correcte !";
|
||||
}
|
||||
// Dès qu'il y a un GET website, on ctrl selon le tab déclaré en début de code.
|
||||
if (isset($_GET['website'])) {
|
||||
$sSiteweb=htmlspecialchars($_GET['website']);
|
||||
$bSiteOK=false;
|
||||
foreach($tSitesweb as $site) {
|
||||
if ($sSiteweb == $site) {
|
||||
$bSiteOK=true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
// On construit le mail si pas de GET siteweb ou si le GET est OK.
|
||||
if ($sSiteweb == "" || $bSiteOK == true) {
|
||||
//Objet du mail
|
||||
$mail->Subject = 'Nouvelles dispositions RGPD - ' . $sSource;
|
||||
// Email de l'expéditeur affiché dans le mail envoyé.
|
||||
$mail->From =$sMail;
|
||||
// Email de l'expéditeur
|
||||
$mail->Sender= $sMail;
|
||||
// Nom de l'expéditeur affiché dans le mail envoyé
|
||||
$mail->FromName= $sFirstName . ' ' . $sLastName;
|
||||
|
||||
switch ($sChoice) {
|
||||
case 'check':
|
||||
$right='Vérifier mes données';
|
||||
break;
|
||||
case 'modify':
|
||||
$right='Rectifier mes données';
|
||||
break;
|
||||
case 'delete':
|
||||
$right='Effacer mes données';
|
||||
break;
|
||||
case 'freeze':
|
||||
$right='Geler l\'utilisation de mes données';
|
||||
break;
|
||||
case 'import':
|
||||
$right='Emporter mes données';
|
||||
break;
|
||||
case 'refuse':
|
||||
$right='M\'opposer à l\'utilisation de mes données';
|
||||
break;
|
||||
default:
|
||||
$right='Aucun choix.';
|
||||
break;
|
||||
}
|
||||
//Le contenu du mail.
|
||||
if ($sSiteweb != "") {
|
||||
$sBody="<b>Source : </b>" . $sSource . " (via le site web " . $sSiteweb . ")<br><br>";
|
||||
} else {
|
||||
$sBody="<b>Source : </b>" . $sSource . "<br><br>";
|
||||
}
|
||||
$sBody=$sBody . "<b>Nom : </b>" . $sLastName . "<br>";
|
||||
$sBody=$sBody . "<b>Prénom : </b>" . $sFirstName . "<br>";
|
||||
$sBody=$sBody . "<b>Email : </b>" . $sMail . "<br><br>";
|
||||
$sBody=$sBody . "<b>L'utilisateur souhaite exercer le droit suivant :</b> " . $right . "<br><br>";
|
||||
$sBody=$sBody . "<b>Message : </b>" . $sMsg;
|
||||
|
||||
$mail->Body = $sBody;
|
||||
|
||||
$bSendOK=false;
|
||||
$bPass=true;
|
||||
if ($mail->send()){
|
||||
$bSendOK=true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
||||
<!DOCTYPE html>
|
||||
<html lang="fr">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<meta http-equiv="X-UA-Compatible" content="ie=edge">
|
||||
<link rel="stylesheet" href="css/style.css"/>
|
||||
<script src="https://cdn.jsdelivr.net/npm/jquery@3.4.1/dist/jquery.min.js"></script>
|
||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/fancyapps/fancybox@3.5.7/dist/jquery.fancybox.min.css" />
|
||||
<script src="https://cdn.jsdelivr.net/gh/fancyapps/fancybox@3.5.7/dist/jquery.fancybox.min.js"></script>
|
||||
<script src='https://www.google.com/recaptcha/api.js' async defer></script>
|
||||
<title>Formulaire RGPD</title>
|
||||
</head>
|
||||
<body>
|
||||
<div class="container">
|
||||
<form method="POST">
|
||||
<fieldset>
|
||||
<legend>Maîtriser mes données personnelles<?php echo($sDebug);?></legend>
|
||||
<p>
|
||||
<label for="nom">Nom*</label>
|
||||
<input type="text" name="lastname" id="nom" style="width:196px;" autofocus required>
|
||||
|
||||
</p>
|
||||
<p>
|
||||
<label for="prenom">Prénom*</label>
|
||||
<input type="text" name="firstname" id="prenom" style="width:177px;" required>
|
||||
</p>
|
||||
<p>
|
||||
<label for="courriel">Email*</label>
|
||||
<input type="text" name="email" id="mail" style="width:191px;" required>
|
||||
</p>
|
||||
<p>
|
||||
<select name="droits" id="selDroits" style="width:250px;">
|
||||
<option value="ask" selected>Quel droit souhaitez-vous exercer ?</option>
|
||||
<option value="check">Vérifier mes données</option>
|
||||
<option value="modify">Rectifier mes données</option>
|
||||
<option value="delete">Effacer mes données</option>
|
||||
<option value="freeze">Geler l'utilisation de mes données</option>
|
||||
<option value="import">Emporter mes données</option>
|
||||
<option value="refuse">M'opposer à l'utilisation de mes données</option>
|
||||
</select>
|
||||
</p>
|
||||
<p>
|
||||
<textarea name="commentaires" id="comment" maxlength="1900" rows="10" placeholder="Informations complémentaires notamment si vous souhaitez nous expliquer les raisons de votre demande (et nous permettre d'améliorer nos services)"></textarea>
|
||||
</p>
|
||||
<div class="g-recaptcha" data-sitekey="6LcPodQUAAAAAEOYHMF7Et6qvzu_F3jZ3HhOlV7Q"></div>
|
||||
<p class="button">
|
||||
<span>
|
||||
<!-- <input type="hidden" name="source" value="consommateurs"> -->
|
||||
<input type="hidden" name="source" value="professionnels">
|
||||
<input type="submit" value="Envoyer">
|
||||
</span>
|
||||
<span> </span>
|
||||
<span>*champs obligatoires</span>
|
||||
</p>
|
||||
</fieldset>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<?php
|
||||
if ($bSendOK) {
|
||||
?>
|
||||
<div class="return">
|
||||
<p>Votre demande a été transmise à nos services. Vous recevrez une réponse à l'adresse mail renseignée dans le formulaire dans les plus brefs délais. Pour plus d'informations, merci de consulter notre <a data-fancybox data-src="#charte" href="javascript:;">charte de confidentialité</a>.<br>
|
||||
A bientôt <?php echo($sFirstName); ?> sur notre site !</p>
|
||||
</div>
|
||||
<?php
|
||||
try {
|
||||
$query = $db->prepare("select post_content from ldc_posts where ID = :id");
|
||||
// A MODIFIER SELON L'ENVIRONNEMENT ******************
|
||||
// $query->execute(['id' => 24453]); // DEV *
|
||||
$query->execute(['id' => 33584]); // PRD *
|
||||
// FIN DE MODIF. *************************************
|
||||
} catch (\PDOException $e) {
|
||||
die($e->getMessage());
|
||||
}
|
||||
$query->setFetchMode(\PDO::FETCH_ASSOC);
|
||||
$result = $query->fetch();
|
||||
$query->closeCursor();
|
||||
?>
|
||||
<div id="charte" style="display:none; width:80%; height:80%;">
|
||||
<?= $result['post_content']; ?>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
else {
|
||||
if ($bPass) {
|
||||
?>
|
||||
<div class="return">
|
||||
<p>La demande n'a pas été envoyée car un des champs n'a pas été correctement renseigné !</p>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
106
rgpd/salaries/css/style.css
Normal file
106
rgpd/salaries/css/style.css
Normal file
|
|
@ -0,0 +1,106 @@
|
|||
html, body {
|
||||
width: 100%;
|
||||
height:100%;
|
||||
overflow:hidden;
|
||||
margin: 0;
|
||||
}
|
||||
body {
|
||||
background-color: #fff;
|
||||
background-image: url(../img/bg-page-big.jpg);
|
||||
background-size: auto 100%;
|
||||
background-repeat: no-repeat;
|
||||
background-position: left top;
|
||||
font-family: "helvetica_neue_lt_std75_bold", Helvetica, Arial, sans-serif;
|
||||
font-size: .8em;
|
||||
font-weight: bold;
|
||||
color: #7d7c7c;
|
||||
}
|
||||
|
||||
.container, .return {
|
||||
background-color: #f0f0f0;
|
||||
width: 40%;
|
||||
min-width: 325px;
|
||||
}
|
||||
.container {
|
||||
margin: 25px 25px 0;
|
||||
padding: 10px 5px 0;
|
||||
}
|
||||
fieldset span {
|
||||
font-size: .8em;
|
||||
font-weight: normal;
|
||||
font-style: italic;
|
||||
}
|
||||
fieldset p {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
input, select, textarea {
|
||||
padding: 10px 5px;
|
||||
font-family: "helvetica_neue_lt_std75_bold", Helvetica, Arial, sans-serif;
|
||||
font-size: .9em;
|
||||
font-weight: normal;
|
||||
color: #a7a7a7;
|
||||
font-style: italic;
|
||||
border: none;
|
||||
}
|
||||
/* select {
|
||||
min-width: 215px;
|
||||
} */
|
||||
textarea {
|
||||
width: 80%;
|
||||
resize: none;
|
||||
}
|
||||
fieldset {
|
||||
border: none;
|
||||
}
|
||||
fieldset legend {
|
||||
font-size: 1.5em;
|
||||
}
|
||||
input[type=text] {
|
||||
margin-left: 10px;
|
||||
}
|
||||
input#siteprod {
|
||||
margin-left: 0;
|
||||
}
|
||||
input[type=submit] {
|
||||
background-color: #e00d23;
|
||||
color: white;
|
||||
width: 200px;
|
||||
font-weight: bold;
|
||||
font-style: normal;
|
||||
font-size: 1.5em;
|
||||
}
|
||||
.return {
|
||||
margin: 0 25px 0;
|
||||
padding: 1px 5px 1px;
|
||||
}
|
||||
.return a {
|
||||
text-decoration: none;
|
||||
font-weight: bolder;
|
||||
color: #7d7c7c;
|
||||
}
|
||||
/* .return p, #charte p {
|
||||
display: inline-block;
|
||||
} */
|
||||
|
||||
#charte h2 {
|
||||
color: red;
|
||||
}
|
||||
|
||||
input:focus, select:focus, textarea:focus {
|
||||
outline: none;
|
||||
}
|
||||
select:active, select:hover {
|
||||
outline-color: red
|
||||
}
|
||||
input[type=submit]:hover {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.return a:hover, #charte a:hover {
|
||||
color: red;
|
||||
}
|
||||
.return a:visited, #charte a:visited {
|
||||
color: #7d7c7c;
|
||||
}
|
||||
27
rgpd/salaries/functions.php
Normal file
27
rgpd/salaries/functions.php
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
<?php
|
||||
|
||||
function configure_smtp(PHPMailer\PHPMailer\PHPMailer $phpmailer){
|
||||
$phpmailer->IsHTML(true);
|
||||
//Pour ne pas avoir de soucis par la suite il est conseillé de donner l' encodage
|
||||
$phpmailer->CharSet = "utf-8";
|
||||
$phpmailer->isSMTP(); //switch to smtp
|
||||
$phpmailer->Host = '192.168.31.254'; // A MODIFIER SELON L'ENV
|
||||
$phpmailer->SMTPAuth = false;
|
||||
$phpmailer->Port = '25';
|
||||
$phpmailer->Username = '';
|
||||
$phpmailer->Password = '';
|
||||
$phpmailer->SMTPSecure = false;
|
||||
// $phpmailer->AddAddress('sebastien.hattry@ldc.fr'); // A MODIFIER
|
||||
$phpmailer->AddAddress('rgpd@ldc.fr'); // A MODIFIER
|
||||
$phpmailer->AddBCC('sylvain.gouet@ldc.fr'); // A MODIFIER
|
||||
$phpmailer->SMTPAutoTLS = false;
|
||||
$phpmailer->SMTPOptions = array(
|
||||
'ssl' => array(
|
||||
'verify_peer' => false,
|
||||
'verify_peer_name' => false,
|
||||
'allow_self_signed' => true
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
?>
|
||||
BIN
rgpd/salaries/img/bg-page-big.jpg
Normal file
BIN
rgpd/salaries/img/bg-page-big.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 685 KiB |
39
rgpd/salaries/inc/Exception.php
Normal file
39
rgpd/salaries/inc/Exception.php
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
<?php
|
||||
/**
|
||||
* PHPMailer Exception class.
|
||||
* PHP Version 5.5.
|
||||
*
|
||||
* @see https://github.com/PHPMailer/PHPMailer/ The PHPMailer GitHub project
|
||||
*
|
||||
* @author Marcus Bointon (Synchro/coolbru) <phpmailer@synchromedia.co.uk>
|
||||
* @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 2010 - 2012 Jim Jagielski
|
||||
* @copyright 2004 - 2009 Andy Prevost
|
||||
* @license http://www.gnu.org/copyleft/lesser.html GNU Lesser General Public License
|
||||
* @note This program is distributed in the hope that it will be useful - WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*/
|
||||
|
||||
namespace PHPMailer\PHPMailer;
|
||||
|
||||
/**
|
||||
* PHPMailer exception handler.
|
||||
*
|
||||
* @author Marcus Bointon <phpmailer@synchromedia.co.uk>
|
||||
*/
|
||||
class Exception extends \Exception
|
||||
{
|
||||
/**
|
||||
* Prettify error message output.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function errorMessage()
|
||||
{
|
||||
return '<strong>' . htmlspecialchars($this->getMessage()) . "</strong><br />\n";
|
||||
}
|
||||
}
|
||||
138
rgpd/salaries/inc/OAuth.php
Normal file
138
rgpd/salaries/inc/OAuth.php
Normal file
|
|
@ -0,0 +1,138 @@
|
|||
<?php
|
||||
/**
|
||||
* PHPMailer - PHP email creation and transport class.
|
||||
* PHP Version 5.5.
|
||||
*
|
||||
* @see https://github.com/PHPMailer/PHPMailer/ The PHPMailer GitHub project
|
||||
*
|
||||
* @author Marcus Bointon (Synchro/coolbru) <phpmailer@synchromedia.co.uk>
|
||||
* @author Jim Jagielski (jimjag) <jimjag@gmail.com>
|
||||
* @author Andy Prevost (codeworxtech) <codeworxtech@users.sourceforge.net>
|
||||
* @author Brent R. Matzelle (original founder)
|
||||
* @copyright 2012 - 2015 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
|
||||
* @note This program is distributed in the hope that it will be useful - WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*/
|
||||
|
||||
namespace PHPMailer\PHPMailer;
|
||||
|
||||
use League\OAuth2\Client\Grant\RefreshToken;
|
||||
use League\OAuth2\Client\Provider\AbstractProvider;
|
||||
use League\OAuth2\Client\Token\AccessToken;
|
||||
|
||||
/**
|
||||
* OAuth - OAuth2 authentication wrapper class.
|
||||
* Uses the oauth2-client package from the League of Extraordinary Packages.
|
||||
*
|
||||
* @see http://oauth2-client.thephpleague.com
|
||||
*
|
||||
* @author Marcus Bointon (Synchro/coolbru) <phpmailer@synchromedia.co.uk>
|
||||
*/
|
||||
class OAuth
|
||||
{
|
||||
/**
|
||||
* An instance of the League OAuth Client Provider.
|
||||
*
|
||||
* @var AbstractProvider
|
||||
*/
|
||||
protected $provider;
|
||||
|
||||
/**
|
||||
* The current OAuth access token.
|
||||
*
|
||||
* @var AccessToken
|
||||
*/
|
||||
protected $oauthToken;
|
||||
|
||||
/**
|
||||
* The user's email address, usually used as the login ID
|
||||
* and also the from address when sending email.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $oauthUserEmail = '';
|
||||
|
||||
/**
|
||||
* The client secret, generated in the app definition of the service you're connecting to.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $oauthClientSecret = '';
|
||||
|
||||
/**
|
||||
* The client ID, generated in the app definition of the service you're connecting to.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $oauthClientId = '';
|
||||
|
||||
/**
|
||||
* The refresh token, used to obtain new AccessTokens.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $oauthRefreshToken = '';
|
||||
|
||||
/**
|
||||
* OAuth constructor.
|
||||
*
|
||||
* @param array $options Associative array containing
|
||||
* `provider`, `userName`, `clientSecret`, `clientId` and `refreshToken` elements
|
||||
*/
|
||||
public function __construct($options)
|
||||
{
|
||||
$this->provider = $options['provider'];
|
||||
$this->oauthUserEmail = $options['userName'];
|
||||
$this->oauthClientSecret = $options['clientSecret'];
|
||||
$this->oauthClientId = $options['clientId'];
|
||||
$this->oauthRefreshToken = $options['refreshToken'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a new RefreshToken.
|
||||
*
|
||||
* @return RefreshToken
|
||||
*/
|
||||
protected function getGrant()
|
||||
{
|
||||
return new RefreshToken();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a new AccessToken.
|
||||
*
|
||||
* @return AccessToken
|
||||
*/
|
||||
protected function getToken()
|
||||
{
|
||||
return $this->provider->getAccessToken(
|
||||
$this->getGrant(),
|
||||
['refresh_token' => $this->oauthRefreshToken]
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate a base64-encoded OAuth token.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getOauth64()
|
||||
{
|
||||
// Get a new token if it's not available or has expired
|
||||
if (null === $this->oauthToken || $this->oauthToken->hasExpired()) {
|
||||
$this->oauthToken = $this->getToken();
|
||||
}
|
||||
|
||||
return base64_encode(
|
||||
'user=' .
|
||||
$this->oauthUserEmail .
|
||||
"\001auth=Bearer " .
|
||||
$this->oauthToken .
|
||||
"\001\001"
|
||||
);
|
||||
}
|
||||
}
|
||||
4778
rgpd/salaries/inc/PHPMailer.php
Normal file
4778
rgpd/salaries/inc/PHPMailer.php
Normal file
File diff suppressed because it is too large
Load diff
419
rgpd/salaries/inc/POP3.php
Normal file
419
rgpd/salaries/inc/POP3.php
Normal file
|
|
@ -0,0 +1,419 @@
|
|||
<?php
|
||||
/**
|
||||
* PHPMailer POP-Before-SMTP Authentication Class.
|
||||
* PHP Version 5.5.
|
||||
*
|
||||
* @see https://github.com/PHPMailer/PHPMailer/ The PHPMailer GitHub project
|
||||
*
|
||||
* @author Marcus Bointon (Synchro/coolbru) <phpmailer@synchromedia.co.uk>
|
||||
* @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 2010 - 2012 Jim Jagielski
|
||||
* @copyright 2004 - 2009 Andy Prevost
|
||||
* @license http://www.gnu.org/copyleft/lesser.html GNU Lesser General Public License
|
||||
* @note This program is distributed in the hope that it will be useful - WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*/
|
||||
|
||||
namespace PHPMailer\PHPMailer;
|
||||
|
||||
/**
|
||||
* PHPMailer POP-Before-SMTP Authentication Class.
|
||||
* Specifically for PHPMailer to use for RFC1939 POP-before-SMTP authentication.
|
||||
* 1) This class does not support APOP authentication.
|
||||
* 2) Opening and closing lots of POP3 connections can be quite slow. If you need
|
||||
* to send a batch of emails then just perform the authentication once at the start,
|
||||
* and then loop through your mail sending script. Providing this process doesn't
|
||||
* take longer than the verification period lasts on your POP3 server, you should be fine.
|
||||
* 3) This is really ancient technology; you should only need to use it to talk to very old systems.
|
||||
* 4) This POP3 class is deliberately lightweight and incomplete, implementing just
|
||||
* enough to do authentication.
|
||||
* If you want a more complete class there are other POP3 classes for PHP available.
|
||||
*
|
||||
* @author Richard Davey (original author) <rich@corephp.co.uk>
|
||||
* @author Marcus Bointon (Synchro/coolbru) <phpmailer@synchromedia.co.uk>
|
||||
* @author Jim Jagielski (jimjag) <jimjag@gmail.com>
|
||||
* @author Andy Prevost (codeworxtech) <codeworxtech@users.sourceforge.net>
|
||||
*/
|
||||
class POP3
|
||||
{
|
||||
/**
|
||||
* The POP3 PHPMailer Version number.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
const VERSION = '6.1.4';
|
||||
|
||||
/**
|
||||
* Default POP3 port number.
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
const DEFAULT_PORT = 110;
|
||||
|
||||
/**
|
||||
* Default timeout in seconds.
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
const DEFAULT_TIMEOUT = 30;
|
||||
|
||||
/**
|
||||
* Debug display level.
|
||||
* Options: 0 = no, 1+ = yes.
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
public $do_debug = 0;
|
||||
|
||||
/**
|
||||
* POP3 mail server hostname.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $host;
|
||||
|
||||
/**
|
||||
* POP3 port number.
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
public $port;
|
||||
|
||||
/**
|
||||
* POP3 Timeout Value in seconds.
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
public $tval;
|
||||
|
||||
/**
|
||||
* POP3 username.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $username;
|
||||
|
||||
/**
|
||||
* POP3 password.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $password;
|
||||
|
||||
/**
|
||||
* Resource handle for the POP3 connection socket.
|
||||
*
|
||||
* @var resource
|
||||
*/
|
||||
protected $pop_conn;
|
||||
|
||||
/**
|
||||
* Are we connected?
|
||||
*
|
||||
* @var bool
|
||||
*/
|
||||
protected $connected = false;
|
||||
|
||||
/**
|
||||
* Error container.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $errors = [];
|
||||
|
||||
/**
|
||||
* Line break constant.
|
||||
*/
|
||||
const LE = "\r\n";
|
||||
|
||||
/**
|
||||
* Simple static wrapper for all-in-one POP before SMTP.
|
||||
*
|
||||
* @param string $host The hostname to connect to
|
||||
* @param int|bool $port The port number to connect to
|
||||
* @param int|bool $timeout The timeout value
|
||||
* @param string $username
|
||||
* @param string $password
|
||||
* @param int $debug_level
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public static function popBeforeSmtp(
|
||||
$host,
|
||||
$port = false,
|
||||
$timeout = false,
|
||||
$username = '',
|
||||
$password = '',
|
||||
$debug_level = 0
|
||||
) {
|
||||
$pop = new self();
|
||||
|
||||
return $pop->authorise($host, $port, $timeout, $username, $password, $debug_level);
|
||||
}
|
||||
|
||||
/**
|
||||
* Authenticate with a POP3 server.
|
||||
* A connect, login, disconnect sequence
|
||||
* appropriate for POP-before SMTP authorisation.
|
||||
*
|
||||
* @param string $host The hostname to connect to
|
||||
* @param int|bool $port The port number to connect to
|
||||
* @param int|bool $timeout The timeout value
|
||||
* @param string $username
|
||||
* @param string $password
|
||||
* @param int $debug_level
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function authorise($host, $port = false, $timeout = false, $username = '', $password = '', $debug_level = 0)
|
||||
{
|
||||
$this->host = $host;
|
||||
// If no port value provided, use default
|
||||
if (false === $port) {
|
||||
$this->port = static::DEFAULT_PORT;
|
||||
} else {
|
||||
$this->port = (int) $port;
|
||||
}
|
||||
// If no timeout value provided, use default
|
||||
if (false === $timeout) {
|
||||
$this->tval = static::DEFAULT_TIMEOUT;
|
||||
} else {
|
||||
$this->tval = (int) $timeout;
|
||||
}
|
||||
$this->do_debug = $debug_level;
|
||||
$this->username = $username;
|
||||
$this->password = $password;
|
||||
// Reset the error log
|
||||
$this->errors = [];
|
||||
// connect
|
||||
$result = $this->connect($this->host, $this->port, $this->tval);
|
||||
if ($result) {
|
||||
$login_result = $this->login($this->username, $this->password);
|
||||
if ($login_result) {
|
||||
$this->disconnect();
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
// We need to disconnect regardless of whether the login succeeded
|
||||
$this->disconnect();
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Connect to a POP3 server.
|
||||
*
|
||||
* @param string $host
|
||||
* @param int|bool $port
|
||||
* @param int $tval
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function connect($host, $port = false, $tval = 30)
|
||||
{
|
||||
// Are we already connected?
|
||||
if ($this->connected) {
|
||||
return true;
|
||||
}
|
||||
|
||||
//On Windows this will raise a PHP Warning error if the hostname doesn't exist.
|
||||
//Rather than suppress it with @fsockopen, capture it cleanly instead
|
||||
set_error_handler([$this, 'catchWarning']);
|
||||
|
||||
if (false === $port) {
|
||||
$port = static::DEFAULT_PORT;
|
||||
}
|
||||
|
||||
// connect to the POP3 server
|
||||
$this->pop_conn = fsockopen(
|
||||
$host, // POP3 Host
|
||||
$port, // Port #
|
||||
$errno, // Error Number
|
||||
$errstr, // Error Message
|
||||
$tval
|
||||
); // Timeout (seconds)
|
||||
// Restore the error handler
|
||||
restore_error_handler();
|
||||
|
||||
// Did we connect?
|
||||
if (false === $this->pop_conn) {
|
||||
// It would appear not...
|
||||
$this->setError(
|
||||
"Failed to connect to server $host on port $port. errno: $errno; errstr: $errstr"
|
||||
);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
// Increase the stream time-out
|
||||
stream_set_timeout($this->pop_conn, $tval, 0);
|
||||
|
||||
// Get the POP3 server response
|
||||
$pop3_response = $this->getResponse();
|
||||
// Check for the +OK
|
||||
if ($this->checkResponse($pop3_response)) {
|
||||
// The connection is established and the POP3 server is talking
|
||||
$this->connected = true;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Log in to the POP3 server.
|
||||
* Does not support APOP (RFC 2828, 4949).
|
||||
*
|
||||
* @param string $username
|
||||
* @param string $password
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function login($username = '', $password = '')
|
||||
{
|
||||
if (!$this->connected) {
|
||||
$this->setError('Not connected to POP3 server');
|
||||
}
|
||||
if (empty($username)) {
|
||||
$username = $this->username;
|
||||
}
|
||||
if (empty($password)) {
|
||||
$password = $this->password;
|
||||
}
|
||||
|
||||
// Send the Username
|
||||
$this->sendString("USER $username" . static::LE);
|
||||
$pop3_response = $this->getResponse();
|
||||
if ($this->checkResponse($pop3_response)) {
|
||||
// Send the Password
|
||||
$this->sendString("PASS $password" . static::LE);
|
||||
$pop3_response = $this->getResponse();
|
||||
if ($this->checkResponse($pop3_response)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Disconnect from the POP3 server.
|
||||
*/
|
||||
public function disconnect()
|
||||
{
|
||||
$this->sendString('QUIT');
|
||||
//The QUIT command may cause the daemon to exit, which will kill our connection
|
||||
//So ignore errors here
|
||||
try {
|
||||
@fclose($this->pop_conn);
|
||||
} catch (Exception $e) {
|
||||
//Do nothing
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a response from the POP3 server.
|
||||
*
|
||||
* @param int $size The maximum number of bytes to retrieve
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected function getResponse($size = 128)
|
||||
{
|
||||
$response = fgets($this->pop_conn, $size);
|
||||
if ($this->do_debug >= 1) {
|
||||
echo 'Server -> Client: ', $response;
|
||||
}
|
||||
|
||||
return $response;
|
||||
}
|
||||
|
||||
/**
|
||||
* Send raw data to the POP3 server.
|
||||
*
|
||||
* @param string $string
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
protected function sendString($string)
|
||||
{
|
||||
if ($this->pop_conn) {
|
||||
if ($this->do_debug >= 2) { //Show client messages when debug >= 2
|
||||
echo 'Client -> Server: ', $string;
|
||||
}
|
||||
|
||||
return fwrite($this->pop_conn, $string, strlen($string));
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks the POP3 server response.
|
||||
* Looks for for +OK or -ERR.
|
||||
*
|
||||
* @param string $string
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
protected function checkResponse($string)
|
||||
{
|
||||
if (strpos($string, '+OK') !== 0) {
|
||||
$this->setError("Server reported an error: $string");
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add an error to the internal error store.
|
||||
* Also display debug output if it's enabled.
|
||||
*
|
||||
* @param string $error
|
||||
*/
|
||||
protected function setError($error)
|
||||
{
|
||||
$this->errors[] = $error;
|
||||
if ($this->do_debug >= 1) {
|
||||
echo '<pre>';
|
||||
foreach ($this->errors as $e) {
|
||||
print_r($e);
|
||||
}
|
||||
echo '</pre>';
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get an array of error messages, if any.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getErrors()
|
||||
{
|
||||
return $this->errors;
|
||||
}
|
||||
|
||||
/**
|
||||
* POP3 connection error handler.
|
||||
*
|
||||
* @param int $errno
|
||||
* @param string $errstr
|
||||
* @param string $errfile
|
||||
* @param int $errline
|
||||
*/
|
||||
protected function catchWarning($errno, $errstr, $errfile, $errline)
|
||||
{
|
||||
$this->setError(
|
||||
'Connecting to the POP3 server raised a PHP warning:' .
|
||||
"errno: $errno errstr: $errstr; errfile: $errfile; errline: $errline"
|
||||
);
|
||||
}
|
||||
}
|
||||
1370
rgpd/salaries/inc/SMTP.php
Normal file
1370
rgpd/salaries/inc/SMTP.php
Normal file
File diff suppressed because it is too large
Load diff
202
rgpd/salaries/index.php
Normal file
202
rgpd/salaries/index.php
Normal file
|
|
@ -0,0 +1,202 @@
|
|||
<?php
|
||||
use PHPMailer\PHPMailer\PHPMailer;
|
||||
use PHPMailer\PHPMailer\Exception;
|
||||
|
||||
require("inc/PHPMailer.php");
|
||||
require("inc/SMTP.php");
|
||||
require("inc/Exception.php");
|
||||
require("functions.php");
|
||||
|
||||
$db = new \PDO('mysql:host=192.168.31.101;dbname=ldc2014;charset=UTF8', 'ldc2014adm', 'M86Am6Bz', array(\PDO::ATTR_ERRMODE => \PDO::ERRMODE_EXCEPTION)); // A MODIFIER SELON L'ENV
|
||||
|
||||
if(isset($_POST) && isset($_POST['g-recaptcha-response'])){
|
||||
$secret = "6LcPodQUAAAAANOJ3SMyXVidfktbHFesx5VIAxsO";
|
||||
$response = $_POST['g-recaptcha-response'];
|
||||
|
||||
if(isset($_SERVER["HTTP_X_FORWARDED_FOR"]) && $_SERVER["HTTP_X_FORWARDED_FOR"] != ""){
|
||||
if (strpos($_SERVER['HTTP_X_FORWARDED_FOR'], ',')) {
|
||||
$explode = explode(',', $_SERVER['HTTP_X_FORWARDED_FOR']);
|
||||
$remoteip = trim($explode[0]);
|
||||
}else{
|
||||
$remoteip = $_SERVER['HTTP_X_FORWARDED_FOR'];
|
||||
}
|
||||
}else{
|
||||
$remoteip = $_SERVER["REMOTE_ADDR"];
|
||||
}
|
||||
|
||||
$api_url = "https://www.google.com/recaptcha/api/siteverify?secret=". $secret. "&response=" . $response. "&remoteip=" . $remoteip ;
|
||||
$decode = json_decode(file_get_contents($api_url), true);
|
||||
|
||||
if ($decode['success'] == true){
|
||||
|
||||
session_start();
|
||||
|
||||
$mail = new PHPMailer();
|
||||
configure_smtp($mail);
|
||||
$bPass=false;
|
||||
$sErreur="";
|
||||
|
||||
if (isset($_POST['lastname']) && isset($_POST['firstname']) && isset($_POST['site']) && isset($_POST['email'])) {
|
||||
$sSource=htmlspecialchars($_POST['source']);
|
||||
$sLastName=htmlspecialchars($_POST['lastname']);
|
||||
$sFirstName=htmlspecialchars($_POST['firstname']);
|
||||
$sSiteProd=htmlspecialchars($_POST['site']);
|
||||
$sMail=htmlspecialchars($_POST['email']);
|
||||
$sChoice=htmlspecialchars($_POST['droits']);
|
||||
$sMsg=htmlspecialchars($_POST['commentaires']);
|
||||
if (!preg_match("#^[a-z0-9._-]+@[a-z0-9._-]{2,}\.[a-z]{2,4}$#", $sMail)) {
|
||||
$sErreur="La structure de l'email n'est pas correcte !";
|
||||
}
|
||||
//Objet du mail
|
||||
$mail->Subject = 'Nouvelles dispositions RGPD - ' . $sSource;
|
||||
// Email de l'expéditeur affiché dans le mail envoyé.
|
||||
$mail->From =$sMail;
|
||||
// Email de l'expéditeur
|
||||
$mail->Sender= $sMail;
|
||||
// Nom sde l'expéditeur affiché dans le mail envoyé
|
||||
$mail->FromName= $sFirstName . ' ' . $sLastName;
|
||||
|
||||
switch ($sChoice) {
|
||||
case 'check':
|
||||
$right='Vérifier mes données';
|
||||
break;
|
||||
case 'modify':
|
||||
$right='Rectifier mes données';
|
||||
break;
|
||||
case 'delete':
|
||||
$right='Effacer mes données';
|
||||
break;
|
||||
case 'freeze':
|
||||
$right='Geler l\'utilisation de mes données';
|
||||
break;
|
||||
case 'import':
|
||||
$right='Emporter mes données';
|
||||
break;
|
||||
case 'refuse':
|
||||
$right='M\'opposer à l\'utilisation de mes données';
|
||||
break;
|
||||
default:
|
||||
$right='Aucun choix.';
|
||||
break;
|
||||
}
|
||||
//Le contenu du mail.
|
||||
$sBody="<b>Source : </b>" . $sSource . "<br><br>";
|
||||
$sBody=$sBody . "<b>Nom : </b>" . $sLastName . "<br>";
|
||||
$sBody=$sBody . "<b>Prénom : </b>" . $sFirstName . "<br>";
|
||||
$sBody=$sBody . "<b>Site : </b>" . $sSiteProd . "<br>";
|
||||
$sBody=$sBody . "<b>Email : </b>" . $sMail . "<br><br>";
|
||||
$sBody=$sBody . "<b>L'utilisateur souhaite exercer le droit suivant :</b> " . $right . "<br><br>";
|
||||
$sBody=$sBody . "<b>Message : </b>" . $sMsg;
|
||||
$mail->Body = $sBody;
|
||||
|
||||
$bSendOK=false;
|
||||
$bPass=true;
|
||||
if ($mail->send()){
|
||||
$bSendOK=true;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
||||
<!DOCTYPE html>
|
||||
<html lang="fr">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<meta http-equiv="X-UA-Compatible" content="ie=edge">
|
||||
<link rel="stylesheet" href="css/style.css"/>
|
||||
<script src="https://cdn.jsdelivr.net/npm/jquery@3.4.1/dist/jquery.min.js"></script>
|
||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/fancyapps/fancybox@3.5.7/dist/jquery.fancybox.min.css" />
|
||||
<script src="https://cdn.jsdelivr.net/gh/fancyapps/fancybox@3.5.7/dist/jquery.fancybox.min.js"></script>
|
||||
<script src='https://www.google.com/recaptcha/api.js' async defer></script>
|
||||
<title>Formulaire RGPD</title>
|
||||
</head>
|
||||
<body>
|
||||
<div class="container">
|
||||
<form method="POST">
|
||||
<fieldset>
|
||||
<legend>Maîtriser mes données personnelles</legend>
|
||||
<p>
|
||||
<label for="nom">Nom*</label>
|
||||
<input type="text" name="lastname" id="nom" style="width:196px;" autofocus required>
|
||||
|
||||
</p>
|
||||
<p>
|
||||
<label for="prenom">Prénom*</label>
|
||||
<input type="text" name="firstname" id="prenom" style="width:177px;" required>
|
||||
</p>
|
||||
<p>
|
||||
<label for="site">De quelle société du Groupe LDC êtes-vous salarié ?*</label>
|
||||
</p>
|
||||
<p>
|
||||
<input type="text" name="site" id="siteprod" style="width:240px;" required>
|
||||
<p>
|
||||
<p>
|
||||
<label for="prenom">Email*</label>
|
||||
<input type="text" name="email" id="mail" style="width:191px;" required>
|
||||
</p>
|
||||
<p>
|
||||
<select name="droits" id="selDroits" style="width:250px;">
|
||||
<option value="ask" selected>Quel droit souhaitez-vous exercer ?</option>
|
||||
<option value="check">Vérifier mes données</option>
|
||||
<option value="modify">Rectifier mes données</option>
|
||||
<option value="delete">Effacer mes données</option>
|
||||
<option value="freeze">Geler l'utilisation de mes données</option>
|
||||
<option value="import">Emporter mes données</option>
|
||||
<option value="refuse">M'opposer à l'utilisation de mes données</option>
|
||||
</select>
|
||||
</p>
|
||||
<p>
|
||||
<textarea name="commentaires" id="comment" maxlength="1900" rows="10" placeholder="Informations complémentaires notamment si vous souhaitez nous expliquer les raisons de votre demande (et nous permettre d'améliorer nos services)"></textarea>
|
||||
</p>
|
||||
<div class="g-recaptcha" data-sitekey="6LcPodQUAAAAAEOYHMF7Et6qvzu_F3jZ3HhOlV7Q"></div>
|
||||
<p class="button">
|
||||
<span>
|
||||
<input type="hidden" name="source" value="salaries">
|
||||
<input type="submit" value="Envoyer">
|
||||
</span>
|
||||
<span> </span>
|
||||
<span>*champs obligatoires</span>
|
||||
</p>
|
||||
</fieldset>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<?php
|
||||
if ($bSendOK) {
|
||||
?>
|
||||
<div class="return">
|
||||
<p>Votre demande a été transmise à nos services. Vous recevrez une réponse à l'adresse mail renseignée dans le formulaire dans les plus brefs délais. Pour plus d'informations, merci de consulter notre <a data-fancybox data-src="#charte" href="javascript:;">charte de confidentialité</a>.<br>
|
||||
A bientôt <?php echo($sFirstName); ?> sur notre site !</p>
|
||||
</div>
|
||||
<?php
|
||||
try {
|
||||
$query = $db->prepare("select post_content from ldc_posts where ID = :id");
|
||||
$query->execute(['id' => 33584]);
|
||||
} catch (\PDOException $e) {
|
||||
die($e->getMessage());
|
||||
}
|
||||
$query->setFetchMode(\PDO::FETCH_ASSOC);
|
||||
$result = $query->fetch();
|
||||
$query->closeCursor();
|
||||
?>
|
||||
<div id="charte" style="display:none; width:80%; height:80%;">
|
||||
<?= $result['post_content']; ?>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
else {
|
||||
if ($bPass) {
|
||||
?>
|
||||
<div class="return">
|
||||
<p>La demande n'a pas été envoyée car un des champs n'a pas été correctement renseigné !</p>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
Loading…
Add table
Reference in a new issue