init project

This commit is contained in:
Ploush 2026-03-21 13:38:18 +01:00
commit 6a7b3be7f4
88 changed files with 15407 additions and 0 deletions

17
.editorconfig Normal file
View file

@ -0,0 +1,17 @@
# editorconfig.org
root = true
[*]
charset = utf-8
end_of_line = lf
indent_size = 4
indent_style = space
insert_final_newline = true
trim_trailing_whitespace = true
[{compose.yaml,compose.*.yaml}]
indent_size = 2
[*.md]
trim_trailing_whitespace = false

48
.env Normal file
View file

@ -0,0 +1,48 @@
# In all environments, the following files are loaded if they exist,
# the latter taking precedence over the former:
#
# * .env contains default values for the environment variables needed by the app
# * .env.local uncommitted file with local overrides
# * .env.$APP_ENV committed environment-specific defaults
# * .env.$APP_ENV.local uncommitted environment-specific overrides
#
# Real environment variables win over .env files.
#
# DO NOT DEFINE PRODUCTION SECRETS IN THIS FILE NOR IN ANY OTHER COMMITTED FILES.
# https://symfony.com/doc/current/configuration/secrets.html
#
# Run "composer dump-env prod" to compile .env files for production use (requires symfony/flex >=1.2).
# https://symfony.com/doc/current/best_practices.html#use-environment-variables-for-infrastructure-configuration
###> symfony/framework-bundle ###
APP_ENV=dev
APP_SECRET=
APP_SHARE_DIR=var/share
###< symfony/framework-bundle ###
###> symfony/routing ###
# Configure how to generate URLs in non-HTTP contexts, such as CLI commands.
# See https://symfony.com/doc/current/routing.html#generating-urls-in-commands
DEFAULT_URI=http://localhost
###< symfony/routing ###
###> doctrine/doctrine-bundle ###
# Format described at https://www.doctrine-project.org/projects/doctrine-dbal/en/latest/reference/configuration.html#connecting-using-a-url
# IMPORTANT: You MUST configure your server version, either here or in config/packages/doctrine.yaml
#
# DATABASE_URL="sqlite:///%kernel.project_dir%/var/data_%kernel.environment%.db"
# DATABASE_URL="mysql://app:!ChangeMe!@127.0.0.1:3306/app?serverVersion=8.0.32&charset=utf8mb4"
# DATABASE_URL="mysql://app:!ChangeMe!@127.0.0.1:3306/app?serverVersion=10.11.2-MariaDB&charset=utf8mb4"
###< doctrine/doctrine-bundle ###
###> symfony/messenger ###
# Choose one of the transports below
# MESSENGER_TRANSPORT_DSN=amqp://guest:guest@localhost:5672/%2f/messages
# MESSENGER_TRANSPORT_DSN=redis://localhost:6379/messages
MESSENGER_TRANSPORT_DSN=doctrine://default?auto_setup=0
###< symfony/messenger ###
###> symfony/mailer ###
MAILER_DSN=null://null
###< symfony/mailer ###

4
.env.dev Normal file
View file

@ -0,0 +1,4 @@
###> symfony/framework-bundle ###
APP_SECRET=372d954ac8cc9525d4a118fc6152b94d
###< symfony/framework-bundle ###

3
.env.test Normal file
View file

@ -0,0 +1,3 @@
# define your env variables for the test env here
KERNEL_CLASS='App\Kernel'
APP_SECRET='$ecretf0rt3st'

22
.gitignore vendored Normal file
View file

@ -0,0 +1,22 @@
.idea
###> symfony/framework-bundle ###
/.env.local
/.env.local.php
/.env.*.local
/config/secrets/prod/prod.decrypt.private.php
/public/bundles/
/var/
/vendor/
###< symfony/framework-bundle ###
###> phpunit/phpunit ###
/phpunit.xml
/.phpunit.cache/
###< phpunit/phpunit ###
###> symfony/asset-mapper ###
/public/assets/
/assets/vendor/
###< symfony/asset-mapper ###

12
assets/app.js Normal file
View file

@ -0,0 +1,12 @@
import 'bootstrap';
import 'bootstrap/dist/css/bootstrap.min.css';
import './stimulus_bootstrap.js';
/*
* Welcome to your app's main JavaScript file!
*
* This file will be included onto the page via the importmap() Twig function,
* which should already be in your base.html.twig.
*/
import './styles/app.css';
console.log('This log comes from assets/app.js - welcome to AssetMapper! 🎉');

15
assets/controllers.json Normal file
View file

@ -0,0 +1,15 @@
{
"controllers": {
"@symfony/ux-turbo": {
"turbo-core": {
"enabled": true,
"fetch": "eager"
},
"mercure-turbo-stream": {
"enabled": false,
"fetch": "eager"
}
}
},
"entrypoints": []
}

View file

@ -0,0 +1,81 @@
const nameCheck = /^[-_a-zA-Z0-9]{4,22}$/;
const tokenCheck = /^[-_/+a-zA-Z0-9]{24,}$/;
// Generate and double-submit a CSRF token in a form field and a cookie, as defined by Symfony's SameOriginCsrfTokenManager
// Use `form.requestSubmit()` to ensure that the submit event is triggered. Using `form.submit()` will not trigger the event
// and thus this event-listener will not be executed.
document.addEventListener('submit', function (event) {
generateCsrfToken(event.target);
}, true);
// When @hotwired/turbo handles form submissions, send the CSRF token in a header in addition to a cookie
// The `framework.csrf_protection.check_header` config option needs to be enabled for the header to be checked
document.addEventListener('turbo:submit-start', function (event) {
const h = generateCsrfHeaders(event.detail.formSubmission.formElement);
Object.keys(h).map(function (k) {
event.detail.formSubmission.fetchRequest.headers[k] = h[k];
});
});
// When @hotwired/turbo handles form submissions, remove the CSRF cookie once a form has been submitted
document.addEventListener('turbo:submit-end', function (event) {
removeCsrfToken(event.detail.formSubmission.formElement);
});
export function generateCsrfToken (formElement) {
const csrfField = formElement.querySelector('input[data-controller="csrf-protection"], input[name="_csrf_token"]');
if (!csrfField) {
return;
}
let csrfCookie = csrfField.getAttribute('data-csrf-protection-cookie-value');
let csrfToken = csrfField.value;
if (!csrfCookie && nameCheck.test(csrfToken)) {
csrfField.setAttribute('data-csrf-protection-cookie-value', csrfCookie = csrfToken);
csrfField.defaultValue = csrfToken = btoa(String.fromCharCode.apply(null, (window.crypto || window.msCrypto).getRandomValues(new Uint8Array(18))));
}
csrfField.dispatchEvent(new Event('change', { bubbles: true }));
if (csrfCookie && tokenCheck.test(csrfToken)) {
const cookie = csrfCookie + '_' + csrfToken + '=' + csrfCookie + '; path=/; samesite=strict';
document.cookie = window.location.protocol === 'https:' ? '__Host-' + cookie + '; secure' : cookie;
}
}
export function generateCsrfHeaders (formElement) {
const headers = {};
const csrfField = formElement.querySelector('input[data-controller="csrf-protection"], input[name="_csrf_token"]');
if (!csrfField) {
return headers;
}
const csrfCookie = csrfField.getAttribute('data-csrf-protection-cookie-value');
if (tokenCheck.test(csrfField.value) && nameCheck.test(csrfCookie)) {
headers[csrfCookie] = csrfField.value;
}
return headers;
}
export function removeCsrfToken (formElement) {
const csrfField = formElement.querySelector('input[data-controller="csrf-protection"], input[name="_csrf_token"]');
if (!csrfField) {
return;
}
const csrfCookie = csrfField.getAttribute('data-csrf-protection-cookie-value');
if (tokenCheck.test(csrfField.value) && nameCheck.test(csrfCookie)) {
const cookie = csrfCookie + '_' + csrfField.value + '=0; path=/; samesite=strict; max-age=0';
document.cookie = window.location.protocol === 'https:' ? '__Host-' + cookie + '; secure' : cookie;
}
}
/* stimulusFetch: 'lazy' */
export default 'csrf-protection-controller';

View file

@ -0,0 +1,16 @@
import { Controller } from '@hotwired/stimulus';
/*
* This is an example Stimulus controller!
*
* Any element with a data-controller="hello" attribute will cause
* this controller to be executed. The name "hello" comes from the filename:
* hello_controller.js -> "hello"
*
* Delete this file or adapt it for your use!
*/
export default class extends Controller {
connect() {
this.element.textContent = 'Hello Stimulus! Edit me in assets/controllers/hello_controller.js';
}
}

BIN
assets/images/bg-dark.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 284 KiB

BIN
assets/images/bg-light.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 47 KiB

53
assets/js/header.js Normal file
View file

@ -0,0 +1,53 @@
/**
* public/js/header.js
* Comportements interactifs du header :
* - Bascule thème clair / sombre
* - Ouverture / fermeture du dropdown de connexion
*/
document.addEventListener('DOMContentLoaded', function () {
// ── THÈME ───────────────────────────────────────────────────
const themeToggle = document.getElementById('themeToggle');
themeToggle.addEventListener('click', function () {
const current = document.documentElement.getAttribute('data-theme');
const next = current === 'dark' ? 'light' : 'dark';
document.documentElement.setAttribute('data-theme', next);
localStorage.setItem('mc-theme', next);
});
// ── DROPDOWN CONNEXION ──────────────────────────────────────
const loginWrapper = document.getElementById('loginWrapper');
const loginToggle = document.getElementById('loginToggle');
const loginDropdown = document.getElementById('loginDropdown');
/** Ouvre ou ferme le dropdown */
function toggleDropdown(force) {
const willOpen = force !== undefined ? force : !loginDropdown.classList.contains('open');
loginDropdown.classList.toggle('open', willOpen);
loginToggle.setAttribute('aria-expanded', String(willOpen));
}
// Clic sur le bouton
loginToggle.addEventListener('click', function (e) {
e.stopPropagation();
toggleDropdown();
});
// Clic en dehors → fermeture
document.addEventListener('click', function (e) {
if (!loginWrapper.contains(e.target)) {
toggleDropdown(false);
}
});
// Touche Échap → fermeture
document.addEventListener('keydown', function (e) {
if (e.key === 'Escape') {
toggleDropdown(false);
}
});
});

View file

@ -0,0 +1,5 @@
import { startStimulusApp } from '@symfony/stimulus-bundle';
const app = startStimulusApp();
// register any custom, 3rd party controllers here
// app.register('some_controller_name', SomeImportedController);

1
assets/styles/app.css Normal file
View file

@ -0,0 +1 @@

360
assets/styles/header.css Normal file
View file

@ -0,0 +1,360 @@
/* ================================================================
public/css/header.css
Styles du header thème clair & sombre
================================================================ */
/* ── RESET MINIMAL ─────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
/* ── VARIABLES ─────────────────────────────────────────────────── */
:root {
--violet: #7C3AED;
--violet-light: #A78BFA;
--violet-glow: rgba(124, 58, 237, 0.18);
--nav-bg-light: rgba(255, 255, 255, 0.78);
--nav-bg-dark: rgba(12, 10, 18, 0.82);
--text-light: #1a1625;
--text-dark: #ede9f6;
--muted-light: #6b7280;
--muted-dark: #9ca3af;
--border-light: rgba(0, 0, 0, 0.08);
--border-dark: rgba(255, 255, 255, 0.08);
--pill-bg-light: rgba(124, 58, 237, 0.08);
--pill-bg-dark: rgba(124, 58, 237, 0.20);
}
/* ── BODY / BACKGROUND ─────────────────────────────────────────── */
html, body {
min-height: 100vh;
font-family: 'DM Sans', sans-serif;
transition: background 0.4s ease;
}
body {
background-image: url('../images/bg-light.png'); /* assets/images/bg-light.png */
background-size: cover;
background-position: center;
background-attachment: fixed;
padding-top: 64px; /* compense le header fixe */
}
[data-theme="dark"] body {
background-image: url('../images/bg-dark.png'); /* assets/images/bg-dark.png */
}
/* ── HEADER ────────────────────────────────────────────────────── */
header {
position: fixed;
top: 0; left: 0; right: 0;
z-index: 100;
height: 64px;
padding: 0 2rem;
display: flex;
align-items: center;
justify-content: space-between;
gap: 1.5rem;
background: var(--nav-bg-light);
backdrop-filter: blur(20px) saturate(1.4);
-webkit-backdrop-filter: blur(20px) saturate(1.4);
border-bottom: 1px solid var(--border-light);
transition: background 0.4s ease, border-color 0.4s ease;
}
[data-theme="dark"] header {
background: var(--nav-bg-dark);
border-bottom-color: var(--border-dark);
}
/* ── LOGO ──────────────────────────────────────────────────────── */
.logo {
display: flex;
align-items: center;
gap: 0.55rem;
text-decoration: none;
flex-shrink: 0;
}
.logo-mark {
width: 30px;
height: 30px;
background: var(--violet);
border-radius: 8px;
display: flex;
align-items: center;
justify-content: center;
transition: transform 0.25s ease, box-shadow 0.25s ease;
}
.logo:hover .logo-mark {
transform: rotate(-6deg) scale(1.08);
box-shadow: 0 0 18px var(--violet-glow);
}
.logo-name {
font-weight: 800;
font-size: 1.05rem;
letter-spacing: -0.02em;
color: var(--text-light);
transition: color 0.4s ease;
}
[data-theme="dark"] .logo-name { color: var(--text-dark); }
/* ── NAVIGATION ────────────────────────────────────────────────── */
nav {
display: flex;
align-items: center;
gap: 0.5rem;
flex: 1;
justify-content: center;
}
.nav-link {
position: relative;
padding: 0.6rem 1.5rem;
border-radius: 10px;
font-family: 'Syne', sans-serif;
font-weight: 600;
font-size: 0.9rem;
letter-spacing: 0.04em;
text-transform: uppercase;
color: var(--muted-light);
text-decoration: none;
white-space: nowrap;
transition: color 0.2s ease, background 0.2s ease, transform 0.15s ease;
}
[data-theme="dark"] .nav-link { color: var(--muted-dark); }
.nav-link::after {
content: '';
position: absolute;
bottom: 4px;
left: 50%;
transform: translateX(-50%) scaleX(0);
width: 16px;
height: 2px;
border-radius: 2px;
background: var(--violet);
transition: transform 0.25s ease;
}
.nav-link:hover {
color: var(--text-light);
background: rgba(0, 0, 0, 0.05);
transform: translateY(-1px);
}
[data-theme="dark"] .nav-link:hover {
color: var(--text-dark);
background: rgba(255, 255, 255, 0.07);
}
.nav-link:hover::after {
transform: translateX(-50%) scaleX(1);
}
/* Onglet actif */
.nav-link.active {
color: var(--violet);
background: var(--pill-bg-light);
font-weight: 700;
}
[data-theme="dark"] .nav-link.active {
color: var(--violet-light);
background: var(--pill-bg-dark);
}
.nav-link.active::after {
transform: translateX(-50%) scaleX(1);
}
[data-theme="dark"] .nav-link.active::after {
background: var(--violet-light);
}
/* Actualité */
.nav-link:has(.badge-dot) {
display: flex;
align-items: center;
gap: 0.45rem;
}
.badge-dot {
width: 6px;
height: 6px;
border-radius: 50%;
background: var(--violet);
flex-shrink: 0;
animation: pulse-dot 2.5s ease-in-out infinite;
}
[data-theme="dark"] .badge-dot { background: var(--violet-light); }
@keyframes pulse-dot {
0%, 100% { opacity: 1; transform: scale(1); }
50% { opacity: 0.5; transform: scale(0.7); }
}
/* ── ACTIONS ───────────────────────────────────────────────────── */
.header-actions {
display: flex;
align-items: center;
gap: 0.6rem;
flex-shrink: 0;
}
/* ── BOUTON THÈME ──────────────────────────────────────────────── */
.theme-btn {
width: 36px;
height: 36px;
border-radius: 10px;
border: 1px solid var(--border-light);
background: transparent;
cursor: pointer;
display: flex;
align-items: center;
justify-content: center;
color: var(--muted-light);
transition: color 0.25s, background 0.25s, border-color 0.25s, transform 0.3s;
}
[data-theme="dark"] .theme-btn {
border-color: var(--border-dark);
color: var(--muted-dark);
}
.theme-btn:hover {
background: rgba(0, 0, 0, 0.06);
color: var(--violet);
transform: rotate(20deg);
}
[data-theme="dark"] .theme-btn:hover {
background: rgba(255, 255, 255, 0.08);
color: var(--violet-light);
}
/* Icônes soleil / lune */
.icon-sun { display: block; }
.icon-moon { display: none; }
[data-theme="dark"] .icon-sun { display: none; }
[data-theme="dark"] .icon-moon { display: block; }
/* ── BOUTON CONNEXION ──────────────────────────────────────────── */
.login-btn {
display: flex;
align-items: center;
gap: 0.45rem;
padding: 0.4rem 1.1rem;
border-radius: 10px;
border: 1px solid var(--border-light);
background: transparent;
cursor: pointer;
font-family: 'DM Sans', sans-serif;
font-weight: 500;
font-size: 0.875rem;
color: var(--text-light);
text-decoration: none;
transition: background 0.2s, border-color 0.2s, color 0.2s, box-shadow 0.2s;
}
[data-theme="dark"] .login-btn {
border-color: var(--border-dark);
color: var(--text-dark);
}
.login-btn:hover {
background: var(--violet);
border-color: var(--violet);
color: #fff;
box-shadow: 0 4px 20px rgba(124, 58, 237, 0.35);
}
/* ── DROPDOWN CONNEXION ────────────────────────────────────────── */
.login-wrapper { position: relative; }
.login-dropdown {
position: absolute;
top: calc(100% + 10px);
right: 0;
width: 260px;
background: var(--nav-bg-light);
backdrop-filter: blur(20px);
-webkit-backdrop-filter: blur(20px);
border: 1px solid var(--border-light);
border-radius: 14px;
padding: 1.25rem;
box-shadow: 0 16px 40px rgba(0, 0, 0, 0.12);
display: none;
flex-direction: column;
gap: 0.75rem;
animation: dropdown-in 0.2s ease;
}
[data-theme="dark"] .login-dropdown {
background: var(--nav-bg-dark);
border-color: var(--border-dark);
box-shadow: 0 16px 40px rgba(0, 0, 0, 0.4);
}
.login-dropdown.open { display: flex; }
@keyframes dropdown-in {
from { opacity: 0; transform: translateY(-6px); }
to { opacity: 1; transform: translateY(0); }
}
/* ── FORMULAIRE DANS LE DROPDOWN ───────────────────────────────── */
.dropdown-title {
font-family: 'Syne', sans-serif;
font-weight: 700;
font-size: 0.95rem;
color: var(--text-light);
}
[data-theme="dark"] .dropdown-title { color: var(--text-dark); }
.form-field {
display: flex;
flex-direction: column;
gap: 0.3rem;
}
.form-field label {
font-size: 0.72rem;
font-weight: 500;
letter-spacing: 0.06em;
text-transform: uppercase;
color: var(--muted-light);
}
[data-theme="dark"] .form-field label { color: var(--muted-dark); }
.form-field input {
height: 36px;
border-radius: 8px;
border: 1px solid var(--border-light);
background: rgba(0, 0, 0, 0.03);
padding: 0 0.75rem;
font-family: 'DM Sans', sans-serif;
font-size: 0.875rem;
color: var(--text-light);
outline: none;
transition: border-color 0.2s, box-shadow 0.2s;
}
[data-theme="dark"] .form-field input {
border-color: var(--border-dark);
background: rgba(255, 255, 255, 0.04);
color: var(--text-dark);
}
.form-field input:focus {
border-color: var(--violet);
box-shadow: 0 0 0 3px var(--violet-glow);
}
.submit-btn {
width: 100%;
height: 36px;
border-radius: 8px;
border: none;
background: var(--violet);
color: #fff;
font-family: 'DM Sans', sans-serif;
font-weight: 600;
font-size: 0.875rem;
cursor: pointer;
transition: background 0.2s, box-shadow 0.2s, transform 0.15s;
}
.submit-btn:hover {
background: #6d28d9;
box-shadow: 0 4px 16px rgba(124, 58, 237, 0.4);
transform: translateY(-1px);
}
/* ── MOBILE ────────────────────────────────────────────────────── */
@media (max-width: 640px) {
nav { display: none; }
header { padding: 0 1rem; }
}

21
bin/console Executable file
View file

@ -0,0 +1,21 @@
#!/usr/bin/env php
<?php
use App\Kernel;
use Symfony\Bundle\FrameworkBundle\Console\Application;
if (!is_dir(dirname(__DIR__).'/vendor')) {
throw new LogicException('Dependencies are missing. Try running "composer install".');
}
if (!is_file(dirname(__DIR__).'/vendor/autoload_runtime.php')) {
throw new LogicException('Symfony Runtime is missing. Try running "composer require symfony/runtime".');
}
require_once dirname(__DIR__).'/vendor/autoload_runtime.php';
return function (array $context) {
$kernel = new Kernel($context['APP_ENV'], (bool) $context['APP_DEBUG']);
return new Application($kernel);
};

4
bin/phpunit Executable file
View file

@ -0,0 +1,4 @@
#!/usr/bin/env php
<?php
require dirname(__DIR__).'/vendor/phpunit/phpunit/phpunit';

18
compose.override.yaml Normal file
View file

@ -0,0 +1,18 @@
services:
###> doctrine/doctrine-bundle ###
database:
ports:
- "5432"
###< doctrine/doctrine-bundle ###
###> symfony/mailer ###
mailer:
image: axllent/mailpit
ports:
- "1025"
- "8025"
environment:
MP_SMTP_AUTH_ACCEPT_ANY: 1
MP_SMTP_AUTH_ALLOW_INSECURE: 1
###< symfony/mailer ###

25
compose.yaml Normal file
View file

@ -0,0 +1,25 @@
services:
###> doctrine/doctrine-bundle ###
database:
image: postgres:${POSTGRES_VERSION:-16}-alpine
environment:
POSTGRES_DB: ${POSTGRES_DB:-app}
# You should definitely change the password in production
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-!ChangeMe!}
POSTGRES_USER: ${POSTGRES_USER:-app}
healthcheck:
test: ["CMD", "pg_isready", "-d", "${POSTGRES_DB:-app}", "-U", "${POSTGRES_USER:-app}"]
timeout: 5s
retries: 5
start_period: 60s
volumes:
- database_data:/var/lib/postgresql/data:rw
# You may use a bind-mounted host directory instead, so that it is harder to accidentally remove the volume and lose all your data!
# - ./docker/db/data:/var/lib/postgresql/data:rw
###< doctrine/doctrine-bundle ###
volumes:
###> doctrine/doctrine-bundle ###
database_data:
###< doctrine/doctrine-bundle ###

107
composer.json Normal file
View file

@ -0,0 +1,107 @@
{
"type": "project",
"license": "proprietary",
"minimum-stability": "stable",
"prefer-stable": true,
"require": {
"php": ">=8.2",
"ext-ctype": "*",
"ext-iconv": "*",
"doctrine/doctrine-bundle": "^2.18",
"doctrine/doctrine-migrations-bundle": "^3.7",
"doctrine/orm": "^3.6",
"phpdocumentor/reflection-docblock": "^6.0",
"phpstan/phpdoc-parser": "^2.3",
"symfony/asset": "7.4.*",
"symfony/asset-mapper": "7.4.*",
"symfony/console": "7.4.*",
"symfony/doctrine-messenger": "7.4.*",
"symfony/dotenv": "7.4.*",
"symfony/expression-language": "7.4.*",
"symfony/flex": "^2",
"symfony/form": "7.4.*",
"symfony/framework-bundle": "7.4.*",
"symfony/http-client": "7.4.*",
"symfony/intl": "7.4.*",
"symfony/mailer": "7.4.*",
"symfony/mime": "7.4.*",
"symfony/monolog-bundle": "^3.0|^4.0",
"symfony/notifier": "7.4.*",
"symfony/process": "7.4.*",
"symfony/property-access": "7.4.*",
"symfony/property-info": "7.4.*",
"symfony/runtime": "7.4.*",
"symfony/security-bundle": "7.4.*",
"symfony/serializer": "7.4.*",
"symfony/stimulus-bundle": "^2.32",
"symfony/string": "7.4.*",
"symfony/translation": "7.4.*",
"symfony/twig-bundle": "7.4.*",
"symfony/ux-turbo": "^2.32",
"symfony/validator": "7.4.*",
"symfony/web-link": "7.4.*",
"symfony/yaml": "7.4.*",
"twig/extra-bundle": "^2.12|^3.0",
"twig/twig": "^2.12|^3.0"
},
"config": {
"allow-plugins": {
"php-http/discovery": true,
"symfony/flex": true,
"symfony/runtime": true
},
"bump-after-update": true,
"sort-packages": true
},
"autoload": {
"psr-4": {
"App\\": "src/"
}
},
"autoload-dev": {
"psr-4": {
"App\\Tests\\": "tests/"
}
},
"replace": {
"symfony/polyfill-ctype": "*",
"symfony/polyfill-iconv": "*",
"symfony/polyfill-php72": "*",
"symfony/polyfill-php73": "*",
"symfony/polyfill-php74": "*",
"symfony/polyfill-php80": "*",
"symfony/polyfill-php81": "*",
"symfony/polyfill-php82": "*"
},
"scripts": {
"auto-scripts": {
"cache:clear": "symfony-cmd",
"assets:install %PUBLIC_DIR%": "symfony-cmd",
"importmap:install": "symfony-cmd"
},
"post-install-cmd": [
"@auto-scripts"
],
"post-update-cmd": [
"@auto-scripts"
]
},
"conflict": {
"symfony/symfony": "*"
},
"extra": {
"symfony": {
"allow-contrib": false,
"require": "7.4.*"
}
},
"require-dev": {
"phpunit/phpunit": "^12.5",
"symfony/browser-kit": "7.4.*",
"symfony/css-selector": "7.4.*",
"symfony/debug-bundle": "7.4.*",
"symfony/maker-bundle": "^1.0",
"symfony/stopwatch": "7.4.*",
"symfony/web-profiler-bundle": "7.4.*"
}
}

10151
composer.lock generated Normal file

File diff suppressed because it is too large Load diff

16
config/bundles.php Normal file
View file

@ -0,0 +1,16 @@
<?php
return [
Symfony\Bundle\FrameworkBundle\FrameworkBundle::class => ['all' => true],
Doctrine\Bundle\DoctrineBundle\DoctrineBundle::class => ['all' => true],
Doctrine\Bundle\MigrationsBundle\DoctrineMigrationsBundle::class => ['all' => true],
Symfony\Bundle\DebugBundle\DebugBundle::class => ['dev' => true],
Symfony\Bundle\TwigBundle\TwigBundle::class => ['all' => true],
Symfony\Bundle\WebProfilerBundle\WebProfilerBundle::class => ['dev' => true, 'test' => true],
Symfony\UX\StimulusBundle\StimulusBundle::class => ['all' => true],
Symfony\UX\Turbo\TurboBundle::class => ['all' => true],
Twig\Extra\TwigExtraBundle\TwigExtraBundle::class => ['all' => true],
Symfony\Bundle\SecurityBundle\SecurityBundle::class => ['all' => true],
Symfony\Bundle\MonologBundle\MonologBundle::class => ['all' => true],
Symfony\Bundle\MakerBundle\MakerBundle::class => ['dev' => true],
];

View file

@ -0,0 +1,11 @@
framework:
asset_mapper:
# The paths to make available to the asset mapper.
paths:
- assets/
missing_import_mode: strict
when@prod:
framework:
asset_mapper:
missing_import_mode: warn

View file

@ -0,0 +1,19 @@
framework:
cache:
# Unique name of your app: used to compute stable namespaces for cache keys.
#prefix_seed: your_vendor_name/app_name
# The "app" cache stores to the filesystem by default.
# The data in this cache should persist between deploys.
# Other options include:
# Redis
#app: cache.adapter.redis
#default_redis_provider: redis://localhost
# APCu (not recommended with heavy random-write workloads as memory fragmentation can cause perf issues)
#app: cache.adapter.apcu
# Namespaced pools use the above "app" backend by default
#pools:
#my.dedicated.cache: null

11
config/packages/csrf.yaml Normal file
View file

@ -0,0 +1,11 @@
# Enable stateless CSRF protection for forms and logins/logouts
framework:
form:
csrf_protection:
token_id: submit
csrf_protection:
stateless_token_ids:
- submit
- authenticate
- logout

View file

@ -0,0 +1,5 @@
when@dev:
debug:
# Forwards VarDumper Data clones to a centralized server allowing to inspect dumps on CLI or in your browser.
# See the "server:dump" command to start a new server.
dump_destination: "tcp://%env(VAR_DUMPER_SERVER)%"

View file

@ -0,0 +1,54 @@
doctrine:
dbal:
url: '%env(resolve:DATABASE_URL)%'
# IMPORTANT: You MUST configure your server version,
# either here or in the DATABASE_URL env var (see .env file)
#server_version: '16'
profiling_collect_backtrace: '%kernel.debug%'
use_savepoints: true
orm:
auto_generate_proxy_classes: true
enable_lazy_ghost_objects: true
report_fields_where_declared: true
validate_xml_mapping: true
naming_strategy: doctrine.orm.naming_strategy.underscore_number_aware
identity_generation_preferences:
Doctrine\DBAL\Platforms\PostgreSQLPlatform: identity
auto_mapping: true
mappings:
App:
type: attribute
is_bundle: false
dir: '%kernel.project_dir%/src/Entity'
prefix: 'App\Entity'
alias: App
controller_resolver:
auto_mapping: false
when@test:
doctrine:
dbal:
# "TEST_TOKEN" is typically set by ParaTest
dbname_suffix: '_test%env(default::TEST_TOKEN)%'
when@prod:
doctrine:
orm:
auto_generate_proxy_classes: false
proxy_dir: '%kernel.build_dir%/doctrine/orm/Proxies'
query_cache_driver:
type: pool
pool: doctrine.system_cache_pool
result_cache_driver:
type: pool
pool: doctrine.result_cache_pool
framework:
cache:
pools:
doctrine.result_cache_pool:
adapter: cache.app
doctrine.system_cache_pool:
adapter: cache.system

View file

@ -0,0 +1,6 @@
doctrine_migrations:
migrations_paths:
# namespace is arbitrary but should be different from App\Migrations
# as migrations classes should NOT be autoloaded
'DoctrineMigrations': '%kernel.project_dir%/migrations'
enable_profiler: false

View file

@ -0,0 +1,15 @@
# see https://symfony.com/doc/current/reference/configuration/framework.html
framework:
secret: '%env(APP_SECRET)%'
# Note that the session will be started ONLY if you read or write from it.
session: true
#esi: true
#fragments: true
when@test:
framework:
test: true
session:
storage_factory_id: session.storage.factory.mock_file

View file

@ -0,0 +1,3 @@
framework:
mailer:
dsn: '%env(MAILER_DSN)%'

View file

@ -0,0 +1,26 @@
framework:
messenger:
failure_transport: failed
transports:
# https://symfony.com/doc/current/messenger.html#transport-configuration
async:
dsn: '%env(MESSENGER_TRANSPORT_DSN)%'
retry_strategy:
max_retries: 3
multiplier: 2
failed: 'doctrine://default?queue_name=failed'
# sync: 'sync://'
default_bus: messenger.bus.default
buses:
messenger.bus.default: []
routing:
Symfony\Component\Mailer\Messenger\SendEmailMessage: async
Symfony\Component\Notifier\Message\ChatMessage: async
Symfony\Component\Notifier\Message\SmsMessage: async
# Route your messages to the transports
# 'App\Message\YourMessage': async

View file

@ -0,0 +1,55 @@
monolog:
channels:
- deprecation # Deprecations are logged in the dedicated "deprecation" channel when it exists
when@dev:
monolog:
handlers:
main:
type: stream
path: "%kernel.logs_dir%/%kernel.environment%.log"
level: debug
channels: ["!event"]
console:
type: console
process_psr_3_messages: false
channels: ["!event", "!doctrine", "!console"]
when@test:
monolog:
handlers:
main:
type: fingers_crossed
action_level: error
handler: nested
excluded_http_codes: [404, 405]
channels: ["!event"]
nested:
type: stream
path: "%kernel.logs_dir%/%kernel.environment%.log"
level: debug
when@prod:
monolog:
handlers:
main:
type: fingers_crossed
action_level: error
handler: nested
excluded_http_codes: [404, 405]
channels: ["!deprecation"]
buffer_size: 50 # How many messages should be saved? Prevent memory leaks
nested:
type: stream
path: php://stderr
level: debug
formatter: monolog.formatter.json
console:
type: console
process_psr_3_messages: false
channels: ["!event", "!doctrine"]
deprecation:
type: stream
channels: [deprecation]
path: php://stderr
formatter: monolog.formatter.json

View file

@ -0,0 +1,12 @@
framework:
notifier:
chatter_transports:
texter_transports:
channel_policy:
# use chat/slack, chat/telegram, sms/twilio or sms/nexmo
urgent: ['email']
high: ['email']
medium: ['email']
low: ['email']
admin_recipients:
- { email: admin@example.com }

View file

@ -0,0 +1,3 @@
framework:
property_info:
with_constructor_extractor: true

View file

@ -0,0 +1,10 @@
framework:
router:
# Configure how to generate URLs in non-HTTP contexts, such as CLI commands.
# See https://symfony.com/doc/current/routing.html#generating-urls-in-commands
default_uri: '%env(DEFAULT_URI)%'
when@prod:
framework:
router:
strict_requirements: null

View file

@ -0,0 +1,53 @@
security:
# https://symfony.com/doc/current/security.html#registering-the-user-hashing-passwords
password_hashers:
Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface: 'auto'
# https://symfony.com/doc/current/security.html#loading-the-user-the-user-provider
providers:
# used to reload user from session & other features (e.g. switch_user)
app_user_provider:
entity:
class: App\Entity\User
property: pseudo
firewalls:
dev:
# Ensure dev tools and static assets are always allowed
pattern: ^/(_profiler|_wdt|assets|build)/
security: false
main:
provider: app_user_provider
form_login:
login_path: app_login # route GET (affichage formulaire)
check_path: app_login # route POST (traitement)
username_parameter: _username
password_parameter: _password
default_target_path: app_accueil
enable_csrf: true
logout:
path: app_logout
# where to redirect after logout
# target: app_any_route
# Activate different ways to authenticate:
# https://symfony.com/doc/current/security.html#the-firewall
# https://symfony.com/doc/current/security/impersonating_user.html
# switch_user: true
# Note: Only the *first* matching rule is applied
access_control:
# - { path: ^/admin, roles: ROLE_ADMIN }
# - { path: ^/profile, roles: ROLE_USER }
when@test:
security:
password_hashers:
# Password hashers are resource-intensive by design to ensure security.
# In tests, it's safe to reduce their cost to improve performance.
Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface:
algorithm: auto
cost: 4 # Lowest possible value for bcrypt
time_cost: 3 # Lowest possible value for argon
memory_cost: 10 # Lowest possible value for argon

View file

@ -0,0 +1,5 @@
framework:
default_locale: en
translator:
default_path: '%kernel.project_dir%/translations'
providers:

View file

@ -0,0 +1,6 @@
twig:
file_name_pattern: '*.twig'
when@test:
twig:
strict_variables: true

View file

@ -0,0 +1,4 @@
# Enable stateless CSRF protection for forms and logins/logouts
framework:
csrf_protection:
check_header: true

View file

@ -0,0 +1,11 @@
framework:
validation:
# Enables validator auto-mapping support.
# For instance, basic validation constraints will be inferred from Doctrine's metadata.
#auto_mapping:
# App\Entity\: []
when@test:
framework:
validation:
not_compromised_password: false

View file

@ -0,0 +1,13 @@
when@dev:
web_profiler:
toolbar: true
framework:
profiler:
collect_serializer_data: true
when@test:
framework:
profiler:
collect: false
collect_serializer_data: true

5
config/preload.php Normal file
View file

@ -0,0 +1,5 @@
<?php
if (file_exists(dirname(__DIR__).'/var/cache/prod/App_KernelProdContainer.preload.php')) {
require dirname(__DIR__).'/var/cache/prod/App_KernelProdContainer.preload.php';
}

1672
config/reference.php Normal file

File diff suppressed because it is too large Load diff

11
config/routes.yaml Normal file
View file

@ -0,0 +1,11 @@
# yaml-language-server: $schema=../vendor/symfony/routing/Loader/schema/routing.schema.json
# This file is the entry point to configure the routes of your app.
# Methods with the #[Route] attribute are automatically imported.
# See also https://symfony.com/doc/current/routing.html
# To list all registered routes, run the following command:
# bin/console debug:router
controllers:
resource: routing.controllers

View file

@ -0,0 +1,4 @@
when@dev:
_errors:
resource: '@FrameworkBundle/Resources/config/routing/errors.php'
prefix: /_error

View file

@ -0,0 +1,3 @@
_security_logout:
resource: security.route_loader.logout
type: service

View file

@ -0,0 +1,8 @@
when@dev:
web_profiler_wdt:
resource: '@WebProfilerBundle/Resources/config/routing/wdt.php'
prefix: /_wdt
web_profiler_profiler:
resource: '@WebProfilerBundle/Resources/config/routing/profiler.php'
prefix: /_profiler

23
config/services.yaml Normal file
View file

@ -0,0 +1,23 @@
# yaml-language-server: $schema=../vendor/symfony/dependency-injection/Loader/schema/services.schema.json
# This file is the entry point to configure your own services.
# Files in the packages/ subdirectory configure your dependencies.
# See also https://symfony.com/doc/current/service_container/import.html
# Put parameters here that don't need to change on each machine where the app is deployed
# https://symfony.com/doc/current/best_practices.html#use-parameters-for-application-configuration
parameters:
services:
# default configuration for services in *this* file
_defaults:
autowire: true # Automatically injects dependencies in your services.
autoconfigure: true # Automatically registers your services as commands, event subscribers, etc.
# makes classes in src/ available to be used as services
# this creates a service per class whose id is the fully-qualified class name
App\:
resource: '../src/'
# add more service definitions when explicit configuration is needed
# please note that last definitions always *replace* previous ones

38
importmap.php Normal file
View file

@ -0,0 +1,38 @@
<?php
/**
* Returns the importmap for this application.
*
* - "path" is a path inside the asset mapper system. Use the
* "debug:asset-map" command to see the full list of paths.
*
* - "entrypoint" (JavaScript only) set to true for any module that will
* be used as an "entrypoint" (and passed to the importmap() Twig function).
*
* The "importmap:require" command can be used to add new entries to this file.
*/
return [
'app' => [
'path' => './assets/app.js',
'entrypoint' => true,
],
'@hotwired/stimulus' => [
'version' => '3.2.2',
],
'@symfony/stimulus-bundle' => [
'path' => './vendor/symfony/stimulus-bundle/assets/dist/loader.js',
],
'@hotwired/turbo' => [
'version' => '7.3.0',
],
'bootstrap' => [
'version' => '5.3.8',
],
'@popperjs/core' => [
'version' => '2.11.8',
],
'bootstrap/dist/css/bootstrap.min.css' => [
'version' => '5.3.8',
'type' => 'css',
],
];

0
migrations/.gitignore vendored Normal file
View file

View file

@ -0,0 +1,107 @@
<?php
declare(strict_types=1);
namespace DoctrineMigrations;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
/**
* Auto-generated Migration: Please modify to your needs!
*/
final class Version20260320225432 extends AbstractMigration
{
public function getDescription(): string
{
return '';
}
public function up(Schema $schema): void
{
// this up() migration is auto-generated, please modify it to your needs
$this->addSql('CREATE TABLE categorie_publication (id INT GENERATED BY DEFAULT AS IDENTITY NOT NULL, libelle VARCHAR(50) NOT NULL, PRIMARY KEY (id))');
$this->addSql('CREATE UNIQUE INDEX UNIQ_70C24170A4D60759 ON categorie_publication (libelle)');
$this->addSql('CREATE TABLE constitue (id INT GENERATED BY DEFAULT AS IDENTITY NOT NULL, optionnel BOOLEAN NOT NULL, mod_id INT NOT NULL, modpack_id INT NOT NULL, PRIMARY KEY (id))');
$this->addSql('CREATE INDEX IDX_AA077561338E21CD ON constitue (mod_id)');
$this->addSql('CREATE INDEX IDX_AA077561949D6AEB ON constitue (modpack_id)');
$this->addSql('CREATE UNIQUE INDEX unique_constitue ON constitue (mod_id, modpack_id)');
$this->addSql('CREATE TABLE illustration (id INT GENERATED BY DEFAULT AS IDENTITY NOT NULL, uri VARCHAR(255) NOT NULL, publication_id INT NOT NULL, PRIMARY KEY (id))');
$this->addSql('CREATE UNIQUE INDEX UNIQ_D67B9A42841CB121 ON illustration (uri)');
$this->addSql('CREATE UNIQUE INDEX UNIQ_D67B9A4238B217A7 ON illustration (publication_id)');
$this->addSql('CREATE TABLE joueur (id UUID NOT NULL, pseudo VARCHAR(50) NOT NULL, PRIMARY KEY (id))');
$this->addSql('CREATE TABLE mod (id INT GENERATED BY DEFAULT AS IDENTITY NOT NULL, nom VARCHAR(50) NOT NULL, version VARCHAR(50) NOT NULL, uri VARCHAR(255) NOT NULL, PRIMARY KEY (id))');
$this->addSql('CREATE UNIQUE INDEX UNIQ_17F45348841CB121 ON mod (uri)');
$this->addSql('CREATE UNIQUE INDEX mod_unique ON mod (nom, version)');
$this->addSql('CREATE TABLE mod_mod (mod_source INT NOT NULL, mod_target INT NOT NULL, PRIMARY KEY (mod_source, mod_target))');
$this->addSql('CREATE INDEX IDX_99C60BF72B3D400C ON mod_mod (mod_source)');
$this->addSql('CREATE INDEX IDX_99C60BF732D81083 ON mod_mod (mod_target)');
$this->addSql('CREATE TABLE mod_modpack (mod_id INT NOT NULL, modpack_id INT NOT NULL, PRIMARY KEY (mod_id, modpack_id))');
$this->addSql('CREATE INDEX IDX_9449C4F4338E21CD ON mod_modpack (mod_id)');
$this->addSql('CREATE INDEX IDX_9449C4F4949D6AEB ON mod_modpack (modpack_id)');
$this->addSql('CREATE TABLE modpack (id INT GENERATED BY DEFAULT AS IDENTITY NOT NULL, version VARCHAR(50) NOT NULL, PRIMARY KEY (id))');
$this->addSql('CREATE UNIQUE INDEX UNIQ_54871F66BF1CD3C3 ON modpack (version)');
$this->addSql('CREATE TABLE publication (id INT GENERATED BY DEFAULT AS IDENTITY NOT NULL, date TIMESTAMP(0) WITHOUT TIME ZONE NOT NULL, contenu TEXT NOT NULL, author_id INT NOT NULL, categorie_id INT NOT NULL, PRIMARY KEY (id))');
$this->addSql('CREATE INDEX IDX_AF3C6779F675F31B ON publication (author_id)');
$this->addSql('CREATE INDEX IDX_AF3C6779BCF5E72D ON publication (categorie_id)');
$this->addSql('CREATE TABLE session (id INT GENERATED BY DEFAULT AS IDENTITY NOT NULL, debut TIMESTAMP(0) WITHOUT TIME ZONE NOT NULL, fin TIMESTAMP(0) WITHOUT TIME ZONE DEFAULT NULL, joueur_id UUID NOT NULL, PRIMARY KEY (id))');
$this->addSql('CREATE INDEX IDX_D044D5D4A9E2D76C ON session (joueur_id)');
$this->addSql('CREATE TABLE territoire (id INT GENERATED BY DEFAULT AS IDENTITY NOT NULL, x INT NOT NULL, z INT NOT NULL, description TEXT NOT NULL, PRIMARY KEY (id))');
$this->addSql('CREATE TABLE territoire_joueur (territoire_id INT NOT NULL, joueur_id UUID NOT NULL, PRIMARY KEY (territoire_id, joueur_id))');
$this->addSql('CREATE INDEX IDX_A714A788D0F97A8 ON territoire_joueur (territoire_id)');
$this->addSql('CREATE INDEX IDX_A714A788A9E2D76C ON territoire_joueur (joueur_id)');
$this->addSql('CREATE TABLE "user" (id INT GENERATED BY DEFAULT AS IDENTITY NOT NULL, pseudo VARCHAR(180) NOT NULL, roles JSON NOT NULL, password VARCHAR(255) NOT NULL, uri_pp VARCHAR(255) DEFAULT NULL, theme_sombre BOOLEAN NOT NULL, joueur_id UUID DEFAULT NULL, creator_id INT DEFAULT NULL, PRIMARY KEY (id))');
$this->addSql('CREATE UNIQUE INDEX UNIQ_8D93D649A9E2D76C ON "user" (joueur_id)');
$this->addSql('CREATE INDEX IDX_8D93D64961220EA6 ON "user" (creator_id)');
$this->addSql('CREATE UNIQUE INDEX UNIQ_IDENTIFIER_PSEUDO ON "user" (pseudo)');
$this->addSql('CREATE TABLE messenger_messages (id BIGINT GENERATED BY DEFAULT AS IDENTITY NOT NULL, body TEXT NOT NULL, headers TEXT NOT NULL, queue_name VARCHAR(190) NOT NULL, created_at TIMESTAMP(0) WITHOUT TIME ZONE NOT NULL, available_at TIMESTAMP(0) WITHOUT TIME ZONE NOT NULL, delivered_at TIMESTAMP(0) WITHOUT TIME ZONE DEFAULT NULL, PRIMARY KEY (id))');
$this->addSql('CREATE INDEX IDX_75EA56E0FB7336F0E3BD61CE16BA31DBBF396750 ON messenger_messages (queue_name, available_at, delivered_at, id)');
$this->addSql('ALTER TABLE constitue ADD CONSTRAINT FK_AA077561338E21CD FOREIGN KEY (mod_id) REFERENCES mod (id) NOT DEFERRABLE');
$this->addSql('ALTER TABLE constitue ADD CONSTRAINT FK_AA077561949D6AEB FOREIGN KEY (modpack_id) REFERENCES modpack (id) NOT DEFERRABLE');
$this->addSql('ALTER TABLE illustration ADD CONSTRAINT FK_D67B9A4238B217A7 FOREIGN KEY (publication_id) REFERENCES publication (id) NOT DEFERRABLE');
$this->addSql('ALTER TABLE mod_mod ADD CONSTRAINT FK_99C60BF72B3D400C FOREIGN KEY (mod_source) REFERENCES mod (id) ON DELETE CASCADE');
$this->addSql('ALTER TABLE mod_mod ADD CONSTRAINT FK_99C60BF732D81083 FOREIGN KEY (mod_target) REFERENCES mod (id) ON DELETE CASCADE');
$this->addSql('ALTER TABLE mod_modpack ADD CONSTRAINT FK_9449C4F4338E21CD FOREIGN KEY (mod_id) REFERENCES mod (id) ON DELETE CASCADE');
$this->addSql('ALTER TABLE mod_modpack ADD CONSTRAINT FK_9449C4F4949D6AEB FOREIGN KEY (modpack_id) REFERENCES modpack (id) ON DELETE CASCADE');
$this->addSql('ALTER TABLE publication ADD CONSTRAINT FK_AF3C6779F675F31B FOREIGN KEY (author_id) REFERENCES "user" (id) NOT DEFERRABLE');
$this->addSql('ALTER TABLE publication ADD CONSTRAINT FK_AF3C6779BCF5E72D FOREIGN KEY (categorie_id) REFERENCES categorie_publication (id) NOT DEFERRABLE');
$this->addSql('ALTER TABLE session ADD CONSTRAINT FK_D044D5D4A9E2D76C FOREIGN KEY (joueur_id) REFERENCES joueur (id) NOT DEFERRABLE');
$this->addSql('ALTER TABLE territoire_joueur ADD CONSTRAINT FK_A714A788D0F97A8 FOREIGN KEY (territoire_id) REFERENCES territoire (id) ON DELETE CASCADE');
$this->addSql('ALTER TABLE territoire_joueur ADD CONSTRAINT FK_A714A788A9E2D76C FOREIGN KEY (joueur_id) REFERENCES joueur (id) ON DELETE CASCADE');
$this->addSql('ALTER TABLE "user" ADD CONSTRAINT FK_8D93D649A9E2D76C FOREIGN KEY (joueur_id) REFERENCES joueur (id)');
$this->addSql('ALTER TABLE "user" ADD CONSTRAINT FK_8D93D64961220EA6 FOREIGN KEY (creator_id) REFERENCES "user" (id)');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE constitue DROP CONSTRAINT FK_AA077561338E21CD');
$this->addSql('ALTER TABLE constitue DROP CONSTRAINT FK_AA077561949D6AEB');
$this->addSql('ALTER TABLE illustration DROP CONSTRAINT FK_D67B9A4238B217A7');
$this->addSql('ALTER TABLE mod_mod DROP CONSTRAINT FK_99C60BF72B3D400C');
$this->addSql('ALTER TABLE mod_mod DROP CONSTRAINT FK_99C60BF732D81083');
$this->addSql('ALTER TABLE mod_modpack DROP CONSTRAINT FK_9449C4F4338E21CD');
$this->addSql('ALTER TABLE mod_modpack DROP CONSTRAINT FK_9449C4F4949D6AEB');
$this->addSql('ALTER TABLE publication DROP CONSTRAINT FK_AF3C6779F675F31B');
$this->addSql('ALTER TABLE publication DROP CONSTRAINT FK_AF3C6779BCF5E72D');
$this->addSql('ALTER TABLE session DROP CONSTRAINT FK_D044D5D4A9E2D76C');
$this->addSql('ALTER TABLE territoire_joueur DROP CONSTRAINT FK_A714A788D0F97A8');
$this->addSql('ALTER TABLE territoire_joueur DROP CONSTRAINT FK_A714A788A9E2D76C');
$this->addSql('ALTER TABLE "user" DROP CONSTRAINT FK_8D93D649A9E2D76C');
$this->addSql('ALTER TABLE "user" DROP CONSTRAINT FK_8D93D64961220EA6');
$this->addSql('DROP TABLE categorie_publication');
$this->addSql('DROP TABLE constitue');
$this->addSql('DROP TABLE illustration');
$this->addSql('DROP TABLE joueur');
$this->addSql('DROP TABLE mod');
$this->addSql('DROP TABLE mod_mod');
$this->addSql('DROP TABLE mod_modpack');
$this->addSql('DROP TABLE modpack');
$this->addSql('DROP TABLE publication');
$this->addSql('DROP TABLE session');
$this->addSql('DROP TABLE territoire');
$this->addSql('DROP TABLE territoire_joueur');
$this->addSql('DROP TABLE "user"');
$this->addSql('DROP TABLE messenger_messages');
}
}

44
phpunit.dist.xml Normal file
View file

@ -0,0 +1,44 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- https://phpunit.readthedocs.io/en/latest/configuration.html -->
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="vendor/phpunit/phpunit/phpunit.xsd"
colors="true"
failOnDeprecation="true"
failOnNotice="true"
failOnWarning="true"
bootstrap="tests/bootstrap.php"
cacheDirectory=".phpunit.cache"
>
<php>
<ini name="display_errors" value="1" />
<ini name="error_reporting" value="-1" />
<server name="APP_ENV" value="test" force="true" />
<server name="SHELL_VERBOSITY" value="-1" />
</php>
<testsuites>
<testsuite name="Project Test Suite">
<directory>tests</directory>
</testsuite>
</testsuites>
<source ignoreSuppressionOfDeprecations="true"
ignoreIndirectDeprecations="true"
restrictNotices="true"
restrictWarnings="true"
>
<include>
<directory>src</directory>
</include>
<deprecationTrigger>
<method>Doctrine\Deprecations\Deprecation::trigger</method>
<method>Doctrine\Deprecations\Deprecation::delegateTriggerToBackend</method>
<function>trigger_deprecation</function>
</deprecationTrigger>
</source>
<extensions>
</extensions>
</phpunit>

9
public/index.php Normal file
View file

@ -0,0 +1,9 @@
<?php
use App\Kernel;
require_once dirname(__DIR__).'/vendor/autoload_runtime.php';
return function (array $context) {
return new Kernel($context['APP_ENV'], (bool) $context['APP_DEBUG']);
};

0
src/Controller/.gitignore vendored Normal file
View file

View file

@ -0,0 +1,32 @@
<?php
namespace App\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Attribute\Route;
use Symfony\Component\Security\Http\Authentication\AuthenticationUtils;
class SecurityController extends AbstractController
{
#[Route(path: '/login', name: 'app_login')]
public function login(AuthenticationUtils $authenticationUtils): Response
{
// get the login error if there is one
$error = $authenticationUtils->getLastAuthenticationError();
// last username entered by the user
$lastUsername = $authenticationUtils->getLastUsername();
return $this->render('security/login.html.twig', [
'last_username' => $lastUsername,
'error' => $error,
]);
}
#[Route(path: '/logout', name: 'app_logout')]
public function logout(): void
{
throw new \LogicException('This method can be blank - it will be intercepted by the logout key on your firewall.');
}
}

View file

@ -0,0 +1,18 @@
<?php
namespace App\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Attribute\Route;
final class VitrineController extends AbstractController
{
#[Route('/', name: 'app_accueil')]
public function index(): Response
{
return $this->render('vitrine/index.html.twig', [
'controller_name' => 'VitrineController',
]);
}
}

0
src/Entity/.gitignore vendored Normal file
View file

View file

@ -0,0 +1,78 @@
<?php
namespace App\Entity;
use App\Repository\CategoriePublicationRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
#[ORM\Entity(repositoryClass: CategoriePublicationRepository::class)]
class CategoriePublication
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column]
private ?int $id = null;
#[ORM\Column(length: 50, unique: true)]
private ?string $libelle = null;
/**
* @var Collection<int, Publication>
*/
#[ORM\OneToMany(targetEntity: Publication::class, mappedBy: 'categorie')]
private Collection $publications;
public function __construct()
{
$this->publications = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
public function getLibelle(): ?string
{
return $this->libelle;
}
public function setLibelle(string $libelle): static
{
$this->libelle = $libelle;
return $this;
}
/**
* @return Collection<int, Publication>
*/
public function getPublications(): Collection
{
return $this->publications;
}
public function addPublication(Publication $publication): static
{
if (!$this->publications->contains($publication)) {
$this->publications->add($publication);
$publication->setCategorie($this);
}
return $this;
}
public function removePublication(Publication $publication): static
{
if ($this->publications->removeElement($publication)) {
// set the owning side to null (unless already changed)
if ($publication->getCategorie() === $this) {
$publication->setCategorie(null);
}
}
return $this;
}
}

69
src/Entity/Constitue.php Normal file
View file

@ -0,0 +1,69 @@
<?php
namespace App\Entity;
use App\Repository\ConstitueRepository;
use Doctrine\ORM\Mapping as ORM;
#[ORM\Entity(repositoryClass: ConstitueRepository::class)]
#[ORM\UniqueConstraint(name: 'unique_constitue', columns: ['mod_id', 'modpack_id'])]
#[UniqueEntity(fields: ['mod', 'modpack'], message: 'relation already exists')]
class Constitue
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column]
private ?int $id = null;
#[ORM\Column]
private ?bool $optionnel = null;
#[ORM\ManyToOne(inversedBy: 'constitues')]
#[ORM\JoinColumn(nullable: false)]
private ?Mod $mod = null;
#[ORM\ManyToOne(inversedBy: 'constitues')]
#[ORM\JoinColumn(nullable: false)]
private ?Modpack $modpack = null;
public function getId(): ?int
{
return $this->id;
}
public function isOptionnel(): ?bool
{
return $this->optionnel;
}
public function setOptionnel(bool $optionnel): static
{
$this->optionnel = $optionnel;
return $this;
}
public function getMod(): ?Mod
{
return $this->mod;
}
public function setMod(?Mod $mod): static
{
$this->mod = $mod;
return $this;
}
public function getModpack(): ?Modpack
{
return $this->modpack;
}
public function setModpack(?Modpack $modpack): static
{
$this->modpack = $modpack;
return $this;
}
}

View file

@ -0,0 +1,51 @@
<?php
namespace App\Entity;
use App\Repository\IllustrationRepository;
use Doctrine\ORM\Mapping as ORM;
#[ORM\Entity(repositoryClass: IllustrationRepository::class)]
class Illustration
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column]
private ?int $id = null;
#[ORM\Column(length: 255,unique: true)]
private ?string $uri = null;
#[ORM\OneToOne(inversedBy: 'illustration', cascade: ['persist', 'remove'])]
#[ORM\JoinColumn(nullable: false)]
private ?Publication $publication = null;
public function getId(): ?int
{
return $this->id;
}
public function getUri(): ?string
{
return $this->uri;
}
public function setUri(string $uri): static
{
$this->uri = $uri;
return $this;
}
public function getPublication(): ?Publication
{
return $this->publication;
}
public function setPublication(Publication $publication): static
{
$this->publication = $publication;
return $this;
}
}

137
src/Entity/Joueur.php Normal file
View file

@ -0,0 +1,137 @@
<?php
namespace App\Entity;
use App\Repository\JoueurRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
#[ORM\Entity(repositoryClass: JoueurRepository::class)]
class Joueur
{
#[ORM\Id]
#[ORM\Column(type: 'guid', length: 36)]
private string $id;
#[ORM\Column(length: 50)]
private ?string $pseudo = null;
/**
* @var Collection<int, Session>
*/
#[ORM\OneToMany(targetEntity: Session::class, mappedBy: 'joueur')]
private Collection $sessions;
/**
* @var Collection<int, Territoire>
*/
#[ORM\ManyToMany(targetEntity: Territoire::class, mappedBy: 'joueurs')]
private Collection $territoires;
#[ORM\OneToOne(mappedBy: 'joueur', cascade: ['persist', 'remove'])]
private ?User $owner = null;
public function __construct(string $uuid)
{
$this->id = $uuid;
$this->sessions = new ArrayCollection();
$this->territoires = new ArrayCollection();
}
public function getId(): string
{
return $this->id;
}
public function getPseudo(): ?string
{
return $this->pseudo;
}
public function setPseudo(string $pseudo): static
{
$this->pseudo = $pseudo;
return $this;
}
/**
* @return Collection<int, Session>
*/
public function getSessions(): Collection
{
return $this->sessions;
}
public function addSession(Session $session): static
{
if (!$this->sessions->contains($session)) {
$this->sessions->add($session);
$session->setJoueur($this);
}
return $this;
}
public function removeSession(Session $session): static
{
if ($this->sessions->removeElement($session)) {
// set the owning side to null (unless already changed)
if ($session->getJoueur() === $this) {
$session->setJoueur(null);
}
}
return $this;
}
/**
* @return Collection<int, Territoire>
*/
public function getTerritoires(): Collection
{
return $this->territoires;
}
public function addTerritoire(Territoire $territoire): static
{
if (!$this->territoires->contains($territoire)) {
$this->territoires->add($territoire);
$territoire->addJoueur($this);
}
return $this;
}
public function removeTerritoire(Territoire $territoire): static
{
if ($this->territoires->removeElement($territoire)) {
$territoire->removeJoueur($this);
}
return $this;
}
public function getOwner(): ?User
{
return $this->owner;
}
public function setOwner(?User $owner): static
{
// unset the owning side of the relation if necessary
if ($owner === null && $this->owner !== null) {
$this->owner->setJoueur(null);
}
// set the owning side of the relation if necessary
if ($owner !== null && $owner->getJoueur() !== $this) {
$owner->setJoueur($this);
}
$this->owner = $owner;
return $this;
}
}

183
src/Entity/Mod.php Normal file
View file

@ -0,0 +1,183 @@
<?php
namespace App\Entity;
use App\Repository\ModRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
#[ORM\Entity(repositoryClass: ModRepository::class)]
#[ORM\UniqueConstraint(name: 'mod_unique', columns: ['nom', 'version'])]
#[UniqueEntity(fields: ['nom', 'version'], message: 'relation already exists')]
class Mod
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column]
private ?int $id = null;
#[ORM\Column(length: 50)]
private ?string $nom = null;
#[ORM\Column(length: 50)]
private ?string $version = null;
#[ORM\Column(length: 255,unique: true)]
private ?string $uri = null;
/**
* @var Collection<int, self>
*/
#[ORM\ManyToMany(targetEntity: self::class, inversedBy: 'soumis')]
private Collection $dependances;
/**
* @var Collection<int, self>
*/
#[ORM\ManyToMany(targetEntity: self::class, mappedBy: 'dependances')]
private Collection $soumis;
/**
* @var Collection<int, Modpack>
*/
#[ORM\ManyToMany(targetEntity: Modpack::class, inversedBy: 'mods')]
private Collection $constitue;
/**
* @var Collection<int, Constitue>
*/
#[ORM\OneToMany(targetEntity: Constitue::class, mappedBy: 'mod')]
private Collection $constitues;
public function __construct()
{
$this->soumis = new ArrayCollection();
$this->dependances = new ArrayCollection();
$this->constitue = new ArrayCollection();
$this->constitues = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
public function getNom(): ?string
{
return $this->nom;
}
public function setNom(string $nom): static
{
$this->nom = $nom;
return $this;
}
public function getVersion(): ?string
{
return $this->version;
}
public function setVersion(string $version): static
{
$this->version = $version;
return $this;
}
public function getUri(): ?string
{
return $this->uri;
}
public function setUri(string $uri): static
{
$this->uri = $uri;
return $this;
}
/**
* @return Collection<int, self>
*/
public function getSoumis(): Collection
{
return $this->soumis;
}
public function addSoumis(self $soumi): static
{
if (!$this->soumis->contains($soumi)) {
$this->soumis->add($soumi);
}
return $this;
}
public function removeSoumis(self $soumi): static
{
$this->soumis->removeElement($soumi);
return $this;
}
/**
* @return Collection<int, self>
*/
public function getDependances(): Collection
{
return $this->dependances;
}
public function addDependance(self $dependance): static
{
if (!$this->dependances->contains($dependance)) {
$this->dependances->add($dependance);
$dependance->addSoumis($this);
}
return $this;
}
public function removeDependance(self $dependance): static
{
if ($this->dependances->removeElement($dependance)) {
$dependance->removeSoumis($this);
}
return $this;
}
/**
* @return Collection<int, Constitue>
*/
public function getConstitues(): Collection
{
return $this->constitues;
}
public function addConstitue(Constitue $constitue): static
{
if (!$this->constitues->contains($constitue)) {
$this->constitues->add($constitue);
$constitue->setMod($this);
}
return $this;
}
public function removeConstitue(Constitue $constitue): static
{
if ($this->constitues->removeElement($constitue)) {
// set the owning side to null (unless already changed)
if ($constitue->getMod() === $this) {
$constitue->setMod(null);
}
}
return $this;
}
}

78
src/Entity/Modpack.php Normal file
View file

@ -0,0 +1,78 @@
<?php
namespace App\Entity;
use App\Repository\ModpackRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
#[ORM\Entity(repositoryClass: ModpackRepository::class)]
class Modpack
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column]
private ?int $id = null;
#[ORM\Column(length: 50, unique: true, nullable: false)]
private ?string $version = null;
/**
* @var Collection<int, Constitue>
*/
#[ORM\OneToMany(targetEntity: Constitue::class, mappedBy: 'modpack')]
private Collection $constitues;
public function __construct()
{
$this->constitues = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
public function getVersion(): ?string
{
return $this->version;
}
public function setVersion(string $version): static
{
$this->version = $version;
return $this;
}
/**
* @return Collection<int, Constitue>
*/
public function getConstitues(): Collection
{
return $this->constitues;
}
public function addConstitue(Constitue $constitue): static
{
if (!$this->constitues->contains($constitue)) {
$this->constitues->add($constitue);
$constitue->setModpack($this);
}
return $this;
}
public function removeConstitue(Constitue $constitue): static
{
if ($this->constitues->removeElement($constitue)) {
// set the owning side to null (unless already changed)
if ($constitue->getModpack() === $this) {
$constitue->setModpack(null);
}
}
return $this;
}
}

103
src/Entity/Publication.php Normal file
View file

@ -0,0 +1,103 @@
<?php
namespace App\Entity;
use App\Repository\PublicationRepository;
use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Mapping as ORM;
#[ORM\Entity(repositoryClass: PublicationRepository::class)]
class Publication
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column]
private ?int $id = null;
#[ORM\Column]
private ?\DateTime $date = null;
#[ORM\Column(type: Types::TEXT)]
private ?string $contenu = null;
#[ORM\ManyToOne(inversedBy: 'publications')]
#[ORM\JoinColumn(nullable: false)]
private ?User $author = null;
#[ORM\OneToOne(mappedBy: 'publication', cascade: ['persist', 'remove'])]
private ?Illustration $illustration = null;
#[ORM\ManyToOne(inversedBy: 'publications')]
#[ORM\JoinColumn(nullable: false)]
private ?CategoriePublication $categorie = null;
public function getId(): ?int
{
return $this->id;
}
public function getDate(): ?\DateTime
{
return $this->date;
}
public function setDate(\DateTime $date): static
{
$this->date = $date;
return $this;
}
public function getContenu(): ?string
{
return $this->contenu;
}
public function setContenu(string $contenu): static
{
$this->contenu = $contenu;
return $this;
}
public function getAuthor(): ?User
{
return $this->author;
}
public function setAuthor(?User $author): static
{
$this->author = $author;
return $this;
}
public function getIllustration(): ?Illustration
{
return $this->illustration;
}
public function setIllustration(Illustration $illustration): static
{
// set the owning side of the relation if necessary
if ($illustration->getPublication() !== $this) {
$illustration->setPublication($this);
}
$this->illustration = $illustration;
return $this;
}
public function getCategorie(): ?CategoriePublication
{
return $this->categorie;
}
public function setCategorie(?CategoriePublication $categorie): static
{
$this->categorie = $categorie;
return $this;
}
}

66
src/Entity/Session.php Normal file
View file

@ -0,0 +1,66 @@
<?php
namespace App\Entity;
use App\Repository\SessionRepository;
use Doctrine\ORM\Mapping as ORM;
#[ORM\Entity(repositoryClass: SessionRepository::class)]
class Session
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column]
private ?int $id = null;
#[ORM\Column]
private ?\DateTime $debut = null;
#[ORM\Column(nullable: true)]
private ?\DateTime $fin = null;
#[ORM\ManyToOne(inversedBy: 'sessions')]
#[ORM\JoinColumn(nullable: false)]
private ?Joueur $joueur = null;
public function getId(): ?int
{
return $this->id;
}
public function getDebut(): ?\DateTime
{
return $this->debut;
}
public function setDebut(\DateTime $debut): static
{
$this->debut = $debut;
return $this;
}
public function getFin(): ?\DateTime
{
return $this->fin;
}
public function setFin(?\DateTime $fin): static
{
$this->fin = $fin;
return $this;
}
public function getJoueur(): ?Joueur
{
return $this->joueur;
}
public function setJoueur(?Joueur $joueur): static
{
$this->joueur = $joueur;
return $this;
}
}

103
src/Entity/Territoire.php Normal file
View file

@ -0,0 +1,103 @@
<?php
namespace App\Entity;
use App\Repository\TerritoireRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Mapping as ORM;
#[ORM\Entity(repositoryClass: TerritoireRepository::class)]
class Territoire
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column]
private ?int $id = null;
#[ORM\Column]
private ?int $x = null;
#[ORM\Column]
private ?int $z = null;
#[ORM\Column(type: Types::TEXT)]
private ?string $description = null;
/**
* @var Collection<int, Joueur>
*/
#[ORM\ManyToMany(targetEntity: Joueur::class, inversedBy: 'territoires')]
private Collection $joueurs;
public function __construct()
{
$this->joueurs = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
public function getX(): ?int
{
return $this->x;
}
public function setX(int $x): static
{
$this->x = $x;
return $this;
}
public function getZ(): ?int
{
return $this->z;
}
public function setZ(int $z): static
{
$this->z = $z;
return $this;
}
public function getDescription(): ?string
{
return $this->description;
}
public function setDescription(string $description): static
{
$this->description = $description;
return $this;
}
/**
* @return Collection<int, Joueur>
*/
public function getJoueurs(): Collection
{
return $this->joueurs;
}
public function addJoueur(Joueur $joueur): static
{
if (!$this->joueurs->contains($joueur)) {
$this->joueurs->add($joueur);
}
return $this;
}
public function removeJoueur(Joueur $joueur): static
{
$this->joueurs->removeElement($joueur);
return $this;
}
}

255
src/Entity/User.php Normal file
View file

@ -0,0 +1,255 @@
<?php
namespace App\Entity;
use App\Repository\UserRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface;
use Symfony\Component\Security\Core\User\UserInterface;
#[ORM\Entity(repositoryClass: UserRepository::class)]
#[ORM\Table(name: '`user`')]
#[ORM\UniqueConstraint(name: 'UNIQ_IDENTIFIER_PSEUDO', fields: ['pseudo'])]
class User implements UserInterface, PasswordAuthenticatedUserInterface
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column]
private ?int $id = null;
#[ORM\Column(length: 180)]
private ?string $pseudo = null;
/**
* @var list<string> The user roles
*/
#[ORM\Column]
private array $roles = [];
/**
* @var string The hashed password
*/
#[ORM\Column]
private ?string $password = null;
#[ORM\Column(length: 255, nullable: true)]
private ?string $uri_pp = null;
#[ORM\Column]
private ?bool $theme_sombre = null;
#[ORM\OneToOne(inversedBy: 'owner', cascade: ['persist', 'remove'])]
private ?Joueur $joueur = null;
#[ORM\ManyToOne(targetEntity: self::class, inversedBy: 'users')]
private ?self $creator = null;
/**
* @var Collection<int, self>
*/
#[ORM\OneToMany(targetEntity: self::class, mappedBy: 'creator')]
private Collection $users;
/**
* @var Collection<int, Publication>
*/
#[ORM\OneToMany(targetEntity: Publication::class, mappedBy: 'author')]
private Collection $publications;
public function __construct()
{
$this->users = new ArrayCollection();
$this->publications = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
public function getPseudo(): ?string
{
return $this->pseudo;
}
public function setPseudo(string $pseudo): static
{
$this->pseudo = $pseudo;
return $this;
}
/**
* A visual identifier that represents this user.
*
* @see UserInterface
*/
public function getUserIdentifier(): string
{
return (string) $this->pseudo;
}
/**
* @see UserInterface
*/
public function getRoles(): array
{
$roles = $this->roles;
// guarantee every user at least has ROLE_USER
$roles[] = 'ROLE_USER';
return array_unique($roles);
}
/**
* @param list<string> $roles
*/
public function setRoles(array $roles): static
{
$this->roles = $roles;
return $this;
}
/**
* @see PasswordAuthenticatedUserInterface
*/
public function getPassword(): ?string
{
return $this->password;
}
public function setPassword(string $password): static
{
$this->password = $password;
return $this;
}
/**
* Ensure the session doesn't contain actual password hashes by CRC32C-hashing them, as supported since Symfony 7.3.
*/
public function __serialize(): array
{
$data = (array) $this;
$data["\0".self::class."\0password"] = hash('crc32c', $this->password);
return $data;
}
#[\Deprecated]
public function eraseCredentials(): void
{
// @deprecated, to be removed when upgrading to Symfony 8
}
public function getUriPp(): ?string
{
return $this->uri_pp;
}
public function setUriPp(?string $uri_pp): static
{
$this->uri_pp = $uri_pp;
return $this;
}
public function isThemeSombre(): ?bool
{
return $this->theme_sombre;
}
public function setThemeSombre(bool $theme_sombre): static
{
$this->theme_sombre = $theme_sombre;
return $this;
}
public function getJoueur(): ?Joueur
{
return $this->joueur;
}
public function setJoueur(?Joueur $joueur): static
{
$this->joueur = $joueur;
return $this;
}
public function getCreator(): ?self
{
return $this->creator;
}
public function setCreator(?self $creator): static
{
$this->creator = $creator;
return $this;
}
/**
* @return Collection<int, self>
*/
public function getUsers(): Collection
{
return $this->users;
}
public function addUser(self $user): static
{
if (!$this->users->contains($user)) {
$this->users->add($user);
$user->setCreator($this);
}
return $this;
}
public function removeUser(self $user): static
{
if ($this->users->removeElement($user)) {
// set the owning side to null (unless already changed)
if ($user->getCreator() === $this) {
$user->setCreator(null);
}
}
return $this;
}
/**
* @return Collection<int, Publication>
*/
public function getPublications(): Collection
{
return $this->publications;
}
public function addPublication(Publication $publication): static
{
if (!$this->publications->contains($publication)) {
$this->publications->add($publication);
$publication->setAuthor($this);
}
return $this;
}
public function removePublication(Publication $publication): static
{
if ($this->publications->removeElement($publication)) {
// set the owning side to null (unless already changed)
if ($publication->getAuthor() === $this) {
$publication->setAuthor(null);
}
}
return $this;
}
}

11
src/Kernel.php Normal file
View file

@ -0,0 +1,11 @@
<?php
namespace App;
use Symfony\Bundle\FrameworkBundle\Kernel\MicroKernelTrait;
use Symfony\Component\HttpKernel\Kernel as BaseKernel;
class Kernel extends BaseKernel
{
use MicroKernelTrait;
}

0
src/Repository/.gitignore vendored Normal file
View file

View file

@ -0,0 +1,43 @@
<?php
namespace App\Repository;
use App\Entity\CategoriePublication;
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
use Doctrine\Persistence\ManagerRegistry;
/**
* @extends ServiceEntityRepository<CategoriePublication>
*/
class CategoriePublicationRepository extends ServiceEntityRepository
{
public function __construct(ManagerRegistry $registry)
{
parent::__construct($registry, CategoriePublication::class);
}
// /**
// * @return CategoriePublication[] Returns an array of CategoriePublication objects
// */
// public function findByExampleField($value): array
// {
// return $this->createQueryBuilder('c')
// ->andWhere('c.exampleField = :val')
// ->setParameter('val', $value)
// ->orderBy('c.id', 'ASC')
// ->setMaxResults(10)
// ->getQuery()
// ->getResult()
// ;
// }
// public function findOneBySomeField($value): ?CategoriePublication
// {
// return $this->createQueryBuilder('c')
// ->andWhere('c.exampleField = :val')
// ->setParameter('val', $value)
// ->getQuery()
// ->getOneOrNullResult()
// ;
// }
}

View file

@ -0,0 +1,43 @@
<?php
namespace App\Repository;
use App\Entity\Constitue;
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
use Doctrine\Persistence\ManagerRegistry;
/**
* @extends ServiceEntityRepository<Constitue>
*/
class ConstitueRepository extends ServiceEntityRepository
{
public function __construct(ManagerRegistry $registry)
{
parent::__construct($registry, Constitue::class);
}
// /**
// * @return Constitue[] Returns an array of Constitue objects
// */
// public function findByExampleField($value): array
// {
// return $this->createQueryBuilder('c')
// ->andWhere('c.exampleField = :val')
// ->setParameter('val', $value)
// ->orderBy('c.id', 'ASC')
// ->setMaxResults(10)
// ->getQuery()
// ->getResult()
// ;
// }
// public function findOneBySomeField($value): ?Constitue
// {
// return $this->createQueryBuilder('c')
// ->andWhere('c.exampleField = :val')
// ->setParameter('val', $value)
// ->getQuery()
// ->getOneOrNullResult()
// ;
// }
}

View file

@ -0,0 +1,43 @@
<?php
namespace App\Repository;
use App\Entity\Illustration;
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
use Doctrine\Persistence\ManagerRegistry;
/**
* @extends ServiceEntityRepository<Illustration>
*/
class IllustrationRepository extends ServiceEntityRepository
{
public function __construct(ManagerRegistry $registry)
{
parent::__construct($registry, Illustration::class);
}
// /**
// * @return Illustration[] Returns an array of Illustration objects
// */
// public function findByExampleField($value): array
// {
// return $this->createQueryBuilder('i')
// ->andWhere('i.exampleField = :val')
// ->setParameter('val', $value)
// ->orderBy('i.id', 'ASC')
// ->setMaxResults(10)
// ->getQuery()
// ->getResult()
// ;
// }
// public function findOneBySomeField($value): ?Illustration
// {
// return $this->createQueryBuilder('i')
// ->andWhere('i.exampleField = :val')
// ->setParameter('val', $value)
// ->getQuery()
// ->getOneOrNullResult()
// ;
// }
}

View file

@ -0,0 +1,43 @@
<?php
namespace App\Repository;
use App\Entity\Joueur;
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
use Doctrine\Persistence\ManagerRegistry;
/**
* @extends ServiceEntityRepository<Joueur>
*/
class JoueurRepository extends ServiceEntityRepository
{
public function __construct(ManagerRegistry $registry)
{
parent::__construct($registry, Joueur::class);
}
// /**
// * @return Joueur[] Returns an array of Joueur objects
// */
// public function findByExampleField($value): array
// {
// return $this->createQueryBuilder('j')
// ->andWhere('j.exampleField = :val')
// ->setParameter('val', $value)
// ->orderBy('j.id', 'ASC')
// ->setMaxResults(10)
// ->getQuery()
// ->getResult()
// ;
// }
// public function findOneBySomeField($value): ?Joueur
// {
// return $this->createQueryBuilder('j')
// ->andWhere('j.exampleField = :val')
// ->setParameter('val', $value)
// ->getQuery()
// ->getOneOrNullResult()
// ;
// }
}

View file

@ -0,0 +1,43 @@
<?php
namespace App\Repository;
use App\Entity\Mod;
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
use Doctrine\Persistence\ManagerRegistry;
/**
* @extends ServiceEntityRepository<Mod>
*/
class ModRepository extends ServiceEntityRepository
{
public function __construct(ManagerRegistry $registry)
{
parent::__construct($registry, Mod::class);
}
// /**
// * @return Mod[] Returns an array of Mod objects
// */
// public function findByExampleField($value): array
// {
// return $this->createQueryBuilder('m')
// ->andWhere('m.exampleField = :val')
// ->setParameter('val', $value)
// ->orderBy('m.id', 'ASC')
// ->setMaxResults(10)
// ->getQuery()
// ->getResult()
// ;
// }
// public function findOneBySomeField($value): ?Mod
// {
// return $this->createQueryBuilder('m')
// ->andWhere('m.exampleField = :val')
// ->setParameter('val', $value)
// ->getQuery()
// ->getOneOrNullResult()
// ;
// }
}

View file

@ -0,0 +1,43 @@
<?php
namespace App\Repository;
use App\Entity\Modpack;
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
use Doctrine\Persistence\ManagerRegistry;
/**
* @extends ServiceEntityRepository<Modpack>
*/
class ModpackRepository extends ServiceEntityRepository
{
public function __construct(ManagerRegistry $registry)
{
parent::__construct($registry, Modpack::class);
}
// /**
// * @return Modpack[] Returns an array of Modpack objects
// */
// public function findByExampleField($value): array
// {
// return $this->createQueryBuilder('m')
// ->andWhere('m.exampleField = :val')
// ->setParameter('val', $value)
// ->orderBy('m.id', 'ASC')
// ->setMaxResults(10)
// ->getQuery()
// ->getResult()
// ;
// }
// public function findOneBySomeField($value): ?Modpack
// {
// return $this->createQueryBuilder('m')
// ->andWhere('m.exampleField = :val')
// ->setParameter('val', $value)
// ->getQuery()
// ->getOneOrNullResult()
// ;
// }
}

View file

@ -0,0 +1,43 @@
<?php
namespace App\Repository;
use App\Entity\Publication;
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
use Doctrine\Persistence\ManagerRegistry;
/**
* @extends ServiceEntityRepository<Publication>
*/
class PublicationRepository extends ServiceEntityRepository
{
public function __construct(ManagerRegistry $registry)
{
parent::__construct($registry, Publication::class);
}
// /**
// * @return Publication[] Returns an array of Publication objects
// */
// public function findByExampleField($value): array
// {
// return $this->createQueryBuilder('p')
// ->andWhere('p.exampleField = :val')
// ->setParameter('val', $value)
// ->orderBy('p.id', 'ASC')
// ->setMaxResults(10)
// ->getQuery()
// ->getResult()
// ;
// }
// public function findOneBySomeField($value): ?Publication
// {
// return $this->createQueryBuilder('p')
// ->andWhere('p.exampleField = :val')
// ->setParameter('val', $value)
// ->getQuery()
// ->getOneOrNullResult()
// ;
// }
}

View file

@ -0,0 +1,43 @@
<?php
namespace App\Repository;
use App\Entity\Session;
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
use Doctrine\Persistence\ManagerRegistry;
/**
* @extends ServiceEntityRepository<Session>
*/
class SessionRepository extends ServiceEntityRepository
{
public function __construct(ManagerRegistry $registry)
{
parent::__construct($registry, Session::class);
}
// /**
// * @return Session[] Returns an array of Session objects
// */
// public function findByExampleField($value): array
// {
// return $this->createQueryBuilder('s')
// ->andWhere('s.exampleField = :val')
// ->setParameter('val', $value)
// ->orderBy('s.id', 'ASC')
// ->setMaxResults(10)
// ->getQuery()
// ->getResult()
// ;
// }
// public function findOneBySomeField($value): ?Session
// {
// return $this->createQueryBuilder('s')
// ->andWhere('s.exampleField = :val')
// ->setParameter('val', $value)
// ->getQuery()
// ->getOneOrNullResult()
// ;
// }
}

View file

@ -0,0 +1,43 @@
<?php
namespace App\Repository;
use App\Entity\Territoire;
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
use Doctrine\Persistence\ManagerRegistry;
/**
* @extends ServiceEntityRepository<Territoire>
*/
class TerritoireRepository extends ServiceEntityRepository
{
public function __construct(ManagerRegistry $registry)
{
parent::__construct($registry, Territoire::class);
}
// /**
// * @return Territoire[] Returns an array of Territoire objects
// */
// public function findByExampleField($value): array
// {
// return $this->createQueryBuilder('t')
// ->andWhere('t.exampleField = :val')
// ->setParameter('val', $value)
// ->orderBy('t.id', 'ASC')
// ->setMaxResults(10)
// ->getQuery()
// ->getResult()
// ;
// }
// public function findOneBySomeField($value): ?Territoire
// {
// return $this->createQueryBuilder('t')
// ->andWhere('t.exampleField = :val')
// ->setParameter('val', $value)
// ->getQuery()
// ->getOneOrNullResult()
// ;
// }
}

View file

@ -0,0 +1,60 @@
<?php
namespace App\Repository;
use App\Entity\User;
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
use Doctrine\Persistence\ManagerRegistry;
use Symfony\Component\Security\Core\Exception\UnsupportedUserException;
use Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface;
use Symfony\Component\Security\Core\User\PasswordUpgraderInterface;
/**
* @extends ServiceEntityRepository<User>
*/
class UserRepository extends ServiceEntityRepository implements PasswordUpgraderInterface
{
public function __construct(ManagerRegistry $registry)
{
parent::__construct($registry, User::class);
}
/**
* Used to upgrade (rehash) the user's password automatically over time.
*/
public function upgradePassword(PasswordAuthenticatedUserInterface $user, string $newHashedPassword): void
{
if (!$user instanceof User) {
throw new UnsupportedUserException(sprintf('Instances of "%s" are not supported.', $user::class));
}
$user->setPassword($newHashedPassword);
$this->getEntityManager()->persist($user);
$this->getEntityManager()->flush();
}
// /**
// * @return User[] Returns an array of User objects
// */
// public function findByExampleField($value): array
// {
// return $this->createQueryBuilder('u')
// ->andWhere('u.exampleField = :val')
// ->setParameter('val', $value)
// ->orderBy('u.id', 'ASC')
// ->setMaxResults(10)
// ->getQuery()
// ->getResult()
// ;
// }
// public function findOneBySomeField($value): ?User
// {
// return $this->createQueryBuilder('u')
// ->andWhere('u.exampleField = :val')
// ->setParameter('val', $value)
// ->getQuery()
// ->getOneOrNullResult()
// ;
// }
}

325
symfony.lock Normal file
View file

@ -0,0 +1,325 @@
{
"doctrine/deprecations": {
"version": "1.1",
"recipe": {
"repo": "github.com/symfony/recipes",
"branch": "main",
"version": "1.0",
"ref": "87424683adc81d7dc305eefec1fced883084aab9"
}
},
"doctrine/doctrine-bundle": {
"version": "2.18",
"recipe": {
"repo": "github.com/symfony/recipes",
"branch": "main",
"version": "2.13",
"ref": "620b57f496f2e599a6015a9fa222c2ee0a32adcb"
},
"files": [
"config/packages/doctrine.yaml",
"src/Entity/.gitignore",
"src/Repository/.gitignore"
]
},
"doctrine/doctrine-migrations-bundle": {
"version": "3.7",
"recipe": {
"repo": "github.com/symfony/recipes",
"branch": "main",
"version": "3.1",
"ref": "1d01ec03c6ecbd67c3375c5478c9a423ae5d6a33"
},
"files": [
"config/packages/doctrine_migrations.yaml",
"migrations/.gitignore"
]
},
"phpunit/phpunit": {
"version": "12.5",
"recipe": {
"repo": "github.com/symfony/recipes",
"branch": "main",
"version": "11.1",
"ref": "1117deb12541f35793eec9fff7494d7aa12283fc"
},
"files": [
".env.test",
"phpunit.dist.xml",
"tests/bootstrap.php",
"bin/phpunit"
]
},
"symfony/asset-mapper": {
"version": "7.4",
"recipe": {
"repo": "github.com/symfony/recipes",
"branch": "main",
"version": "6.4",
"ref": "5ad1308aa756d58f999ffbe1540d1189f5d7d14a"
},
"files": [
"assets/app.js",
"assets/styles/app.css",
"config/packages/asset_mapper.yaml",
"importmap.php"
]
},
"symfony/console": {
"version": "7.4",
"recipe": {
"repo": "github.com/symfony/recipes",
"branch": "main",
"version": "5.3",
"ref": "1781ff40d8a17d87cf53f8d4cf0c8346ed2bb461"
},
"files": [
"bin/console"
]
},
"symfony/debug-bundle": {
"version": "7.4",
"recipe": {
"repo": "github.com/symfony/recipes",
"branch": "main",
"version": "5.3",
"ref": "5aa8aa48234c8eb6dbdd7b3cd5d791485d2cec4b"
},
"files": [
"config/packages/debug.yaml"
]
},
"symfony/flex": {
"version": "2.10",
"recipe": {
"repo": "github.com/symfony/recipes",
"branch": "main",
"version": "2.4",
"ref": "52e9754527a15e2b79d9a610f98185a1fe46622a"
},
"files": [
".env",
".env.dev"
]
},
"symfony/form": {
"version": "7.4",
"recipe": {
"repo": "github.com/symfony/recipes",
"branch": "main",
"version": "7.2",
"ref": "7d86a6723f4a623f59e2bf966b6aad2fc461d36b"
},
"files": [
"config/packages/csrf.yaml"
]
},
"symfony/framework-bundle": {
"version": "7.4",
"recipe": {
"repo": "github.com/symfony/recipes",
"branch": "main",
"version": "7.4",
"ref": "09f6e081c763a206802674ce0cb34a022f0ffc6d"
},
"files": [
"config/packages/cache.yaml",
"config/packages/framework.yaml",
"config/preload.php",
"config/routes/framework.yaml",
"config/services.yaml",
"public/index.php",
"src/Controller/.gitignore",
"src/Kernel.php",
".editorconfig"
]
},
"symfony/mailer": {
"version": "7.4",
"recipe": {
"repo": "github.com/symfony/recipes",
"branch": "main",
"version": "4.3",
"ref": "09051cfde49476e3c12cd3a0e44289ace1c75a4f"
},
"files": [
"config/packages/mailer.yaml"
]
},
"symfony/maker-bundle": {
"version": "1.66",
"recipe": {
"repo": "github.com/symfony/recipes",
"branch": "main",
"version": "1.0",
"ref": "fadbfe33303a76e25cb63401050439aa9b1a9c7f"
}
},
"symfony/messenger": {
"version": "7.4",
"recipe": {
"repo": "github.com/symfony/recipes",
"branch": "main",
"version": "6.0",
"ref": "d8936e2e2230637ef97e5eecc0eea074eecae58b"
},
"files": [
"config/packages/messenger.yaml"
]
},
"symfony/monolog-bundle": {
"version": "4.0",
"recipe": {
"repo": "github.com/symfony/recipes",
"branch": "main",
"version": "3.7",
"ref": "1b9efb10c54cb51c713a9391c9300ff8bceda459"
},
"files": [
"config/packages/monolog.yaml"
]
},
"symfony/notifier": {
"version": "7.4",
"recipe": {
"repo": "github.com/symfony/recipes",
"branch": "main",
"version": "5.0",
"ref": "178877daf79d2dbd62129dd03612cb1a2cb407cc"
},
"files": [
"config/packages/notifier.yaml"
]
},
"symfony/property-info": {
"version": "7.4",
"recipe": {
"repo": "github.com/symfony/recipes",
"branch": "main",
"version": "7.3",
"ref": "dae70df71978ae9226ae915ffd5fad817f5ca1f7"
},
"files": [
"config/packages/property_info.yaml"
]
},
"symfony/routing": {
"version": "7.4",
"recipe": {
"repo": "github.com/symfony/recipes",
"branch": "main",
"version": "7.4",
"ref": "bc94c4fd86f393f3ab3947c18b830ea343e51ded"
},
"files": [
"config/packages/routing.yaml",
"config/routes.yaml"
]
},
"symfony/security-bundle": {
"version": "7.4",
"recipe": {
"repo": "github.com/symfony/recipes",
"branch": "main",
"version": "7.4",
"ref": "c42fee7802181cdd50f61b8622715829f5d2335c"
},
"files": [
"config/packages/security.yaml",
"config/routes/security.yaml"
]
},
"symfony/stimulus-bundle": {
"version": "2.32",
"recipe": {
"repo": "github.com/symfony/recipes",
"branch": "main",
"version": "2.24",
"ref": "3357f2fa6627b93658d8e13baa416b2a94a50c5f"
},
"files": [
"assets/controllers.json",
"assets/controllers/csrf_protection_controller.js",
"assets/controllers/hello_controller.js",
"assets/stimulus_bootstrap.js"
]
},
"symfony/translation": {
"version": "7.4",
"recipe": {
"repo": "github.com/symfony/recipes",
"branch": "main",
"version": "6.3",
"ref": "620a1b84865ceb2ba304c8f8bf2a185fbf32a843"
},
"files": [
"config/packages/translation.yaml",
"translations/.gitignore"
]
},
"symfony/twig-bundle": {
"version": "7.4",
"recipe": {
"repo": "github.com/symfony/recipes",
"branch": "main",
"version": "6.4",
"ref": "cab5fd2a13a45c266d45a7d9337e28dee6272877"
},
"files": [
"config/packages/twig.yaml",
"templates/base.html.twig"
]
},
"symfony/ux-turbo": {
"version": "2.32",
"recipe": {
"repo": "github.com/symfony/recipes",
"branch": "main",
"version": "2.20",
"ref": "287f7c6eb6e9b65e422d34c00795b360a787380b"
},
"files": [
"config/packages/ux_turbo.yaml"
]
},
"symfony/validator": {
"version": "7.4",
"recipe": {
"repo": "github.com/symfony/recipes",
"branch": "main",
"version": "7.0",
"ref": "8c1c4e28d26a124b0bb273f537ca8ce443472bfd"
},
"files": [
"config/packages/validator.yaml"
]
},
"symfony/web-profiler-bundle": {
"version": "7.4",
"recipe": {
"repo": "github.com/symfony/recipes",
"branch": "main",
"version": "7.3",
"ref": "a363460c1b0b4a4d0242f2ce1a843ca0f6ac9026"
},
"files": [
"config/packages/web_profiler.yaml",
"config/routes/web_profiler.yaml"
]
},
"symfony/webapp-pack": {
"version": "1.4",
"recipe": {
"repo": "github.com/symfony/recipes",
"branch": "main",
"version": "1.0",
"ref": "b9e6cc8e7b6069d0e8a816665809a423864eb4dd"
},
"files": [
"config/packages/messenger.yaml"
]
},
"twig/extra-bundle": {
"version": "v3.23.0"
}
}

37
templates/base.html.twig Normal file
View file

@ -0,0 +1,37 @@
<!DOCTYPE html>
<html data-theme="light">
<head>
<meta charset="UTF-8">
<title>{% block title %}CraftWorld{% endblock %}</title>
<link rel="icon" href="data:image/svg+xml,<svg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 128 128%22><text y=%221.2em%22 font-size=%2296%22>⚫️</text><text y=%221.3em%22 x=%220.2em%22 font-size=%2276%22 fill=%22%23fff%22>sf</text></svg>">
{# Fonts #}
<link rel="preconnect" href="https://fonts.googleapis.com">
<link href="https://fonts.googleapis.com/css2?family=Syne:wght@400;600;700;800&family=DM+Sans:wght@300;400;500&display=swap" rel="stylesheet">
{# Styles globaux + header #}
<link rel="stylesheet" href="{{ asset('styles/header.css') }}">
{% block stylesheets %}{% endblock %}
{% block javascripts %}
{% block importmap %}{{ importmap('app') }}{% endblock %}
{% endblock %}
{# Anti-flash thème sombre : exécuté avant le premier paint #}
<script>
(function () {
const saved = localStorage.getItem('mc-theme') || 'light';
document.documentElement.setAttribute('data-theme', saved);
})();
</script>
</head>
<body>
{% include 'partials/_header.html.twig' %}
{% block body %}{% endblock %}
<script src="{{ asset('js/header.js') }}"></script>
</body>
</html>

View file

@ -0,0 +1,42 @@
{# ══════════════════════════════════════════════════════════════
templates/partials/_header.html.twig
Header principal — inclus depuis base.html.twig
══════════════════════════════════════════════════════════════ #}
{% set current_route = app.request.attributes.get('_route') %}
<header>
{# ── Logo ──────────────────────────────────────────────── #}
<a href="{{ path('app_accueil') }}" class="logo">
<span class="logo-name">LOGO</span>
</a>
{# ── Navigation ────────────────────────────────────────── #}
<nav>
<a href="{{ path('app_accueil') }}"
class="nav-link {{ current_route == 'app_home' ? 'active' }}">
Accueil
</a>
<a href="{{ path('app_accueil') }}"
class="nav-link {{ current_route == 'app_home' ? 'active' }}">
Modpack
</a>
<a href="{{ path('app_accueil') }}"
class="nav-link {{ current_route == 'app_home' ? 'active' }}">
Statistiques
</a>
<a href="{{ path('app_accueil') }}"
class="nav-link {{ current_route == 'app_home' ? 'active' }}">
<span class="badge-dot"></span>Actualité
</a>
</nav>
{# ── Actions (thème + connexion) ───────────────────────── #}
<div class="header-actions">
{% include 'partials/_theme_toggle.html.twig' %}
{% include 'partials/_login_dropdown.html.twig' %}
</div>
</header>

View file

@ -0,0 +1,60 @@
{# ══════════════════════════════════════════════════════════════
templates/partials/_login_dropdown.html.twig
Bouton + dropdown formulaire de connexion
══════════════════════════════════════════════════════════════ #}
<div class="login-wrapper" id="loginWrapper">
{# Bouton déclencheur #}
<button class="login-btn" id="loginToggle"
aria-haspopup="true" aria-expanded="false">
<svg width="15" height="15" viewBox="0 0 24 24"
fill="none" stroke="currentColor" stroke-width="2"
stroke-linecap="round" stroke-linejoin="round">
<path d="M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2"/>
<circle cx="12" cy="7" r="4"/>
</svg>
Connexion
</button>
{# Dropdown #}
<div class="login-dropdown" id="loginDropdown"
role="dialog" aria-label="Formulaire de connexion">
<span class="dropdown-title">Connexion</span>
<form action="{{ path('app_login') }}" method="post">
<div class="form-field">
<label for="username">Pseudo</label>
<input type="text"
id="username"
name="_username"
value="{{ last_username is defined ? last_username : '' }}"
autocomplete="username"
placeholder="Pseudo"
required>
</div>
<div class="form-field">
<label for="password">Mot de passe</label>
<input type="password"
id="password"
name="_password"
autocomplete="current-password"
placeholder="••••••••"
required>
</div>
<input type="hidden"
name="_csrf_token"
value="{{ csrf_token('authenticate') }}">
<button class="submit-btn" type="submit">Se connecter</button>
</form>
</div>
</div>

View file

@ -0,0 +1,30 @@
{# ══════════════════════════════════════════════════════════════
templates/partials/_theme_toggle.html.twig
Bouton bascule thème clair / sombre
══════════════════════════════════════════════════════════════ #}
<button class="theme-btn" id="themeToggle" aria-label="Changer le thème" title="Changer le thème">
{# Soleil — affiché en mode clair #}
<svg class="icon-sun" width="17" height="17" viewBox="0 0 24 24"
fill="none" stroke="currentColor" stroke-width="2"
stroke-linecap="round" stroke-linejoin="round">
<circle cx="12" cy="12" r="5"/>
<line x1="12" y1="1" x2="12" y2="3"/>
<line x1="12" y1="21" x2="12" y2="23"/>
<line x1="4.22" y1="4.22" x2="5.64" y2="5.64"/>
<line x1="18.36" y1="18.36" x2="19.78" y2="19.78"/>
<line x1="1" y1="12" x2="3" y2="12"/>
<line x1="21" y1="12" x2="23" y2="12"/>
<line x1="4.22" y1="19.78" x2="5.64" y2="18.36"/>
<line x1="18.36" y1="5.64" x2="19.78" y2="4.22"/>
</svg>
{# Lune — affichée en mode sombre #}
<svg class="icon-moon" width="16" height="16" viewBox="0 0 24 24"
fill="none" stroke="currentColor" stroke-width="2"
stroke-linecap="round" stroke-linejoin="round">
<path d="M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z"/>
</svg>
</button>

View file

@ -0,0 +1,38 @@
{% extends 'base.html.twig' %}
{% block title %}Log in!{% endblock %}
{% block body %}
<form method="post">
{% if error %}
<div class="alert alert-danger">{{ error.messageKey|trans(error.messageData, 'security') }}</div>
{% endif %}
{% if app.user %}
<div class="mb-3">
You are logged in as {{ app.user.userIdentifier }}, <a href="{{ logout_path() }}">Logout</a>
</div>
{% endif %}
<h1 class="h3 mb-3 font-weight-normal">Please sign in</h1>
<label for="username">Pseudo</label>
<input type="text" value="{{ last_username }}" name="_username" id="username" class="form-control" autocomplete="username" required autofocus>
<label for="password">Password</label>
<input type="password" name="_password" id="password" class="form-control" autocomplete="current-password" required>
<input type="hidden" name="_csrf_token" data-controller="csrf-protection" value="{{ csrf_token('authenticate') }}">
{#
Uncomment this section and add a remember_me option below your firewall to activate remember me functionality.
See https://symfony.com/doc/current/security/remember_me.html
<div class="checkbox mb-3">
<input type="checkbox" name="_remember_me" id="_remember_me">
<label for="_remember_me">Remember me</label>
</div>
#}
<button class="btn btn-lg btn-primary" type="submit">
Sign in
</button>
</form>
{% endblock %}

View file

@ -0,0 +1,6 @@
{% extends 'base.html.twig' %}
{% block title %} Accueil {% endblock %}
{% block body %}
{% endblock %}

13
tests/bootstrap.php Normal file
View file

@ -0,0 +1,13 @@
<?php
use Symfony\Component\Dotenv\Dotenv;
require dirname(__DIR__).'/vendor/autoload.php';
if (method_exists(Dotenv::class, 'bootEnv')) {
(new Dotenv())->bootEnv(dirname(__DIR__).'/.env');
}
if ($_SERVER['APP_DEBUG']) {
umask(0000);
}

0
translations/.gitignore vendored Normal file
View file