Merge branch 'develop' into issue-27-redirections

This commit is contained in:
Corentin Huet 2025-07-03 17:25:53 +02:00
commit abe83e1661
14 changed files with 267 additions and 12 deletions

View file

@ -37,6 +37,7 @@ SMTP_SECURE=
MAIL_FROM_NAME=
MAIL_FROM_ADDRESS=
MAIL_ADMIN=
MAIL_CONTACT_RGPD=
# ADMIN SECURE
LDCWEB_API_TOKEN=

1
.gitignore vendored
View file

@ -8,6 +8,7 @@ public/app/themes/*/
public/app/upgrade
public/app/uploads/*
!public/app/uploads/.gitkeep
!public/app/uploads/export/.gitkeep
public/app/cache/*
public/app/webp-express
public/app/themes/.htaccess

View file

@ -1,5 +1,5 @@
FROM registry.s-web.fr/ldc-web/projets/ldc-web-images-docker/ldcweb-production-8.2:latest
FROM registry.s-web.fr/ldc-web/projets/ldc-web-images-docker/ldcweb-production-8.2:170625-080812
COPY --chown=www-data:www-data . /app/srcs
USER root
RUN chmod -R 755 /app/srcs/public/app/uploads
USER www-data
USER www-data

View file

@ -27,7 +27,6 @@
"roots/wordpress": "6.7.2",
"roots/wp-config": "1.0.0",
"roots/wp-password-bcrypt": "1.2.0",
"uwil/ldc-theme": "^1.1",
"ldc/ldccrmv4client": "^4.0",
"wpackagist-plugin/breadcrumb-navxt": "^7.4",
"wpengine/advanced-custom-fields-pro": "^6.3",
@ -37,7 +36,8 @@
"wpackagist-plugin/duplicate-post": "^4.5",
"wpackagist-plugin/webp-express": "^0.25.9",
"wpackagist-plugin/relevanssi": "^4.24",
"wpackagist-plugin/wordpress-seo": "^24.8"
"wpackagist-plugin/wordpress-seo": "^24.8",
"uwil/ldc-theme": "^1.2"
},
"require-dev": {
"roave/security-advisories": "dev-latest",

14
composer.lock generated
View file

@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "18e8af366c29fa60c54eb4cef3391e63",
"content-hash": "f011c5ac850c3daeef55c48183820047",
"packages": [
{
"name": "composer/installers",
@ -1893,16 +1893,16 @@
},
{
"name": "uwil/ldc-theme",
"version": "1.1.2",
"version": "1.2.5",
"source": {
"type": "git",
"url": "git@lab.s-web.fr:ldc-web/projets/ldc-theme.git",
"reference": "28fe02953ab0518597d1d26d9a7a22ab619c4b44"
"reference": "fd4f40681afe43550691cec28695fecf99978beb"
},
"dist": {
"type": "zip",
"url": "https://lab.s-web.fr/api/v4/projects/232/packages/composer/archives/uwil/ldc-theme.zip?sha=28fe02953ab0518597d1d26d9a7a22ab619c4b44",
"reference": "28fe02953ab0518597d1d26d9a7a22ab619c4b44",
"url": "https://lab.s-web.fr/api/v4/projects/232/packages/composer/archives/uwil/ldc-theme.zip?sha=fd4f40681afe43550691cec28695fecf99978beb",
"reference": "fd4f40681afe43550691cec28695fecf99978beb",
"shasum": ""
},
"type": "wordpress-theme",
@ -2628,6 +2628,6 @@
"platform": {
"php": ">=8.1"
},
"platform-dev": [],
"plugin-api-version": "2.3.0"
"platform-dev": {},
"plugin-api-version": "2.6.0"
}

View file

@ -31,6 +31,7 @@ Config::define('SMTP_SECURE', env('SMTP_SECURE'));
Config::define('MAIL_FROM_NAME', env('MAIL_FROM_NAME'));
Config::define('MAIL_FROM_ADDRESS', env('MAIL_FROM_ADDRESS'));
Config::define('MAIL_ADMIN', env('MAIL_ADMIN'));
Config::define('MAIL_CONTACT_RGPD', env('MAIL_CONTACT_RGPD'));
/**
* MATOMO ANALYTICS

View file

@ -30,6 +30,7 @@ data:
MAIL_FROM_NAME: "${APP_MAIL_FROM_NAME}"
MAIL_FROM_ADDRESS: "${APP_MAIL_FROM_ADDRESS}"
MAIL_ADMIN: "${APP_MAIL_ADMIN}"
MAIL_CONTACT_RGPD: "${APP_MAIL_CONTACT_RGPD}"
MATOMO_SITE_ID: "${APP_MATOMO_SITE_ID}"
RECAPTCHA_V3_PUBLIC: "${APP_RECAPTCHA_V3_PUBLIC}"
RECAPTCHA_V3_SECRET: "${APP_RECAPTCHA_V3_SECRET}"
@ -100,7 +101,7 @@ spec:
app: ${CI_PROJECT_PATH_SLUG}-app
ports:
- port: 80
targetPort: 443
targetPort: 80
---
apiVersion: traefik.io/v1alpha1
@ -119,10 +120,22 @@ spec:
port: 80
middlewares:
- name: redirect-no-www-to-www
- name: redirect-ldc-rgpd-to-rgpd
tls:
secretName: ${CRT_TLS_NAME}
---
# Redirect with domain replacement
apiVersion: traefik.io/v1alpha1
kind: Middleware
metadata:
name: redirect-ldc-rgpd-to-rgpd
spec:
redirectRegex:
regex: ^https://${REDIRECT}${APP_DOMAIN}/rgpd/(professionnels|salaries|consommateurs)(/(en|de))?
replacement: https://rgpd.ldc.fr/fr/${1}
permanent: true
---
apiVersion: batch/v1
kind: CronJob
metadata:
@ -250,3 +263,44 @@ spec:
fsGroup: 33
fsGroupChangePolicy: "OnRootMismatch"
restartPolicy: OnFailure
---
apiVersion: batch/v1
kind: CronJob
metadata:
name: ${CI_PROJECT_PATH_SLUG}-cronjob-publish-posts
spec:
schedule: "*/5 * * * *"
concurrencyPolicy: Forbid
jobTemplate:
spec:
template:
spec:
affinity:
podAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
- labelSelector:
matchExpressions:
- key: app
operator: In
values:
- ${CI_PROJECT_PATH_SLUG}-app
topologyKey: "kubernetes.io/hostname"
namespaces: [$KUBE_NAMESPACE]
containers:
- name: ${CI_PROJECT_PATH_SLUG}-scheduled
image: $IMAGE_TAG
imagePullPolicy: IfNotPresent
command: ["sh", "-c"]
args:
- curl -sf https://${REDIRECT}${APP_DOMAIN}/wp/wp-cron.php?doing_wp_cron
envFrom:
- configMapRef:
name: ${CI_PROJECT_PATH_SLUG}-config-map
imagePullSecrets:
- name: docker-registry-credentials
securityContext:
runAsUser: 33
runAsGroup: 33
fsGroup: 33
fsGroupChangePolicy: "OnRootMismatch"
restartPolicy: OnFailure

0
public/export/.gitkeep Normal file
View file

Binary file not shown.

After

Width:  |  Height:  |  Size: 145 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 232 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 556 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 262 KiB

12
public/unsubdr.php Normal file
View file

@ -0,0 +1,12 @@
<?php
require_once(__DIR__ . '/wp/wp-load.php');
global $wpdb;
if (isset($_GET['email'])) {
$email = filter_var($_GET['email'], FILTER_SANITIZE_EMAIL);
$wpdb->query("DELETE FROM wp_digitalrecruiter_jobalert WHERE email = '$email'");
}
header('Location: https://www.ldc.fr');
exit;

186
public/unsubscribe.php Normal file
View file

@ -0,0 +1,186 @@
<?php
require_once(__DIR__ . '/wp/wp-load.php');
use LDC\LDCCRM\Exceptions\ApiErrorException;
use LDC\LDCCRM\Exceptions\CrmException;
use LDC\LDCCRM\Exceptions\ValidationException;
use LDC\LDCCRM\Models\SingleOptin;
$callOK = false;
// phpcs:ignore WordPress.Security.NonceVerification.Recommended
if (isset($_GET['hashcode']) and !empty($_GET['hashcode'])) {
// * Initialise CRM API
initApiCrm();
// phpcs:ignore WordPress.Security.NonceVerification.Recommended
$hashcode = sanitize_key($_GET['hashcode']);
// Seul single optin est géré
try {
SingleOptin::unsetStatusWithHashcode($hashcode);
$callOK = true;
} catch (ValidationException | CrmException | ApiErrorException $e) {
// phpcs:ignore WordPress.PHP.DevelopmentFunctions.error_log_error_log,Squiz.PHP.DiscouragedFunctions.Found
error_log(sprintf(
'ERROR CRM API : %s - %s | hashcode : %s',
get_class($e) === ApiErrorException::class ? $e->getApiError()->label : $e->getMessage(),
$e->getMessage(),
$hashcode
));
}
}
?>
<!DOCTYPE html>
<html lang="fr">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Désinscription à la newsletter LDC</title>
<style>
html,
body,
::before,
::after,
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
font-family: Arial, Helvetica, sans-serif;
font-size: 30px;
font-weight: normal;
color: #000000;
}
.post-title {
font-family: Arial, Helvetica, sans-serif;
font-size: 1.33em;
font-weight: 700;
color: #e30613;
}
a {
color: #000000;
transition: color .5s;
}
a:hover {
color: #e30613;
}
p {
margin: 1em 0;
font-size: .8em;
}
span {
font-size: .6em;
}
.wrapper-unsub {
display: grid;
grid-template-rows: min-content min-content auto min-content;
justify-items: center;
min-height: 100vh;
padding: 10vw 4vw;
}
.unsub--logo {
width: 60%;
text-align: center;
}
.unsub--logo img {
width: 100%;
max-width: 300px;
}
.unsub--title {
margin: 4vw 0;
text-align: center;
}
.unsub--footer {
width: 100%;
}
@media only screen and (min-width:768px) {
.post-title {
font-size: 2em;
}
p {
font-size: 1em;
}
span {
font-size: .8em;
}
.wrapper-unsub {
padding: 4vw 10vw;
}
}
@media only screen and (min-width:1024px) {
.post-title {
font-size: 2.33em;
}
p {
font-size: 1.2em;
}
span {
font-size: 1em;
}
}
@media only screen and (min-width:1440px) {}
@media only screen and (min-width:1920px) {}
</style>
</head>
<body>
<div class="wrapper-unsub">
<div class="unsub--logo">
<img src="/content/themes/ldc/img/logo.png" alt="Logo de la marque LDC">
</div>
<div class="unsub--title">
<h1 class="post-title">Désinscription</h1>
</div>
<?php
/**
* On ne communique pas sur model not found
* pour ne pas créer une page où on peut determiner
* qui est inscrit dans la crm
*/
if ($callOK) { ?>
<div class="unsub--content">
<p>Vous êtes désinscris de la newsletter LDC.</p>
<p>En espérant vous revoir bientôt !</p>
</div>
<?php } else { ?>
<div class="unsub--content">
<p>Une erreur est survenue.</p>
<p>Veuillez réessayer ultérieurement.</p>
</div>
<?php } ?>
<div class="unsub--footer">
<span>Retrouvez-nous sur <a href="https://www.ldc.fr">ldc.fr</a> !</span>
</div>
</div>
</body>
</html>