From a8249a2ddf40f2a19b33cedb9d22a006f60cb041 Mon Sep 17 00:00:00 2001 From: vgreb Date: Wed, 6 May 2026 01:12:42 +0200 Subject: [PATCH] Suppression du framework legacy --- app/config/routing/admin.yml | 4 - app/config/services.yml | 7 - composer.json | 41 +----- composer.lock | 106 +-------------- htdocs/pages/administration/index.php | 46 ------- htdocs/pages/administration/message.php | 25 ---- htdocs/templates/administration/entete.html | 17 --- htdocs/templates/administration/head.html | 18 --- htdocs/templates/administration/message.html | 14 -- .../templates/administration/pagination.html | 20 --- .../administration/pied_de_page.html | 55 -------- htdocs/templates/commun/formulaire-en.html | 55 -------- htdocs/templates/commun/formulaire.html | 105 -------------- ...ml-quickform-html-quickform-date-php.patch | 11 -- ...3r-html-quickform-html-quickform-php.patch | 11 -- phpstan.neon | 4 - sources/Afup/Bootstrap/Cli.php | 27 ---- sources/Afup/Bootstrap/Http.php | 78 ----------- sources/Afup/Bootstrap/_Common.php | 3 - sources/Afup/Bootstrap/commonStart.php | 43 ------ sources/Afup/Droits.php | 36 ----- sources/Afup/Pagination.php | 35 ----- sources/Afup/fonctions.php | 128 ------------------ .../Association/Form/HTML_QuickForm.php | 13 -- .../AppBundle/Controller/LegacyController.php | 105 -------------- templates/admin/base_with_header.html.twig | 4 - 26 files changed, 2 insertions(+), 1009 deletions(-) delete mode 100644 htdocs/pages/administration/index.php delete mode 100644 htdocs/pages/administration/message.php delete mode 100644 htdocs/templates/administration/entete.html delete mode 100644 htdocs/templates/administration/head.html delete mode 100644 htdocs/templates/administration/message.html delete mode 100644 htdocs/templates/administration/pagination.html delete mode 100644 htdocs/templates/administration/pied_de_page.html delete mode 100644 htdocs/templates/commun/formulaire-en.html delete mode 100644 htdocs/templates/commun/formulaire.html delete mode 100644 patches/znk3r-html-quickform-html-quickform-date-php.patch delete mode 100644 patches/znk3r-html-quickform-html-quickform-php.patch delete mode 100644 sources/Afup/Bootstrap/Cli.php delete mode 100644 sources/Afup/Bootstrap/Http.php delete mode 100644 sources/Afup/Pagination.php delete mode 100644 sources/Afup/fonctions.php delete mode 100644 sources/AppBundle/Association/Form/HTML_QuickForm.php delete mode 100644 sources/AppBundle/Controller/LegacyController.php diff --git a/app/config/routing/admin.yml b/app/config/routing/admin.yml index d52a8b7ce..7e5ed08d7 100644 --- a/app/config/routing/admin.yml +++ b/app/config/routing/admin.yml @@ -6,10 +6,6 @@ admin_relances: path: /association/relances/{page} defaults: {_controller: AppBundle\Controller\Admin\Membership\ReminderLogAction} -admin_void: - path: /void - defaults: {_controller: AppBundle\Controller\LegacyController::backOffice} - admin_members: resource: "admin_members.yml" prefix: /members diff --git a/app/config/services.yml b/app/config/services.yml index d007307c4..4e6b927a4 100644 --- a/app/config/services.yml +++ b/app/config/services.yml @@ -75,13 +75,6 @@ services: ### Pages legacy - FIN - AppBundle\Controller\LegacyController: - autowire: true - autoconfigure: true - public: false - arguments: - $backOfficePages: '%app.pages_backoffice%' - AppBundle\Payment\PayboxFactory: autowire: true arguments: ["@router", "%paybox_domain_server%", "%paybox_secret_key%", "%paybox_site%", "%paybox_rang%", "%paybox_identifiant%"] diff --git a/composer.json b/composer.json index 65ab53534..5894daf30 100644 --- a/composer.json +++ b/composer.json @@ -43,7 +43,6 @@ "robmorgan/phinx": "0.16.*", "sabre/vobject": "^4.1", "setasign/tfpdf": "^1.33", - "smarty/smarty": "^5.4", "symfony/asset": "7.4.*", "symfony/asset-mapper": "7.4.*", "symfony/clock": "7.4.*", @@ -71,9 +70,7 @@ "twig/intl-extra": "^3.21", "twig/string-extra": "^3.21", "twig/twig": "^3.21", - "webmozart/assert": "^2.1", - "znk3r/html_common": "*", - "znk3r/html_quickform": "4.0.2" + "webmozart/assert": "^2.1" }, "scripts": { "post-install-cmd": [ @@ -102,10 +99,6 @@ "patches": { "setasign/tfpdf": [ "patches/setasign-tfpdf-tfpdf-php.patch" - ], - "znk3r/html_quickform": [ - "patches/znk3r-html-quickform-html-quickform-date-php.patch", - "patches/znk3r-html-quickform-html-quickform-php.patch" ] }, "symfony-app-dir": "app", @@ -173,38 +166,6 @@ "tomasvotruba/type-coverage": "^2.1" }, "repositories": [ - { - "type": "package", - "package": { - "name": "znk3r/html_quickform", - "version": "4.0.2", - "dist": { - "url": "https://github.com/macintoshplus/HTML_QuickForm/archive/v4.0.2.zip", - "type": "zip" - }, - "autoload": { - "classmap": [ - "HTML/" - ] - } - } - }, - { - "type": "package", - "package": { - "name": "znk3r/html_common", - "version": "v2.0.1", - "dist": { - "url": "https://github.com/znk3r/HTML_Common/archive/v2.0.1.zip", - "type": "zip" - }, - "autoload": { - "classmap": [ - "HTML/" - ] - } - } - }, { "type": "package", "package": { diff --git a/composer.lock b/composer.lock index 94513db1b..4a18674cd 100644 --- a/composer.lock +++ b/composer.lock @@ -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": "ffba3f3c8e8ab86a80b176d74ebf1a13", + "content-hash": "7c1df4523022034b8e6dc570feb2785a", "packages": [ { "name": "algolia/algoliasearch-client-php", @@ -5533,82 +5533,6 @@ }, "time": "2022-12-20T10:26:07+00:00" }, - { - "name": "smarty/smarty", - "version": "v5.8.0", - "source": { - "type": "git", - "url": "https://github.com/smarty-php/smarty.git", - "reference": "78d259d3b971c59a0cd719c270cc5cbb740c36a7" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/smarty-php/smarty/zipball/78d259d3b971c59a0cd719c270cc5cbb740c36a7", - "reference": "78d259d3b971c59a0cd719c270cc5cbb740c36a7", - "shasum": "" - }, - "require": { - "php": "^7.2 || ^8.0", - "symfony/polyfill-mbstring": "^1.27" - }, - "require-dev": { - "phpunit/phpunit": "^8.5 || ^7.5", - "smarty/smarty-lexer": "^4.0.2" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "5.0.x-dev" - } - }, - "autoload": { - "files": [ - "src/functions.php" - ], - "psr-4": { - "Smarty\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "LGPL-3.0" - ], - "authors": [ - { - "name": "Monte Ohrt", - "email": "monte@ohrt.com" - }, - { - "name": "Uwe Tews", - "email": "uwe.tews@googlemail.com" - }, - { - "name": "Rodney Rehm", - "email": "rodney.rehm@medialize.de" - }, - { - "name": "Simon Wisselink", - "homepage": "https://www.iwink.nl/" - } - ], - "description": "Smarty - the compiling PHP template engine", - "homepage": "https://smarty-php.github.io/smarty/", - "keywords": [ - "templating" - ], - "support": { - "forum": "https://github.com/smarty-php/smarty/discussions", - "issues": "https://github.com/smarty-php/smarty/issues", - "source": "https://github.com/smarty-php/smarty/tree/v5.8.0" - }, - "funding": [ - { - "url": "https://github.com/wisskid", - "type": "github" - } - ], - "time": "2026-02-15T14:27:15+00:00" - }, { "name": "symfony/asset", "version": "v7.4.8", @@ -11267,34 +11191,6 @@ "source": "https://github.com/geocoder-php/php-common/tree/5.0.0" }, "time": "2025-01-01T15:52:42+00:00" - }, - { - "name": "znk3r/html_common", - "version": "v2.0.1", - "dist": { - "type": "zip", - "url": "https://github.com/znk3r/HTML_Common/archive/v2.0.1.zip" - }, - "type": "library", - "autoload": { - "classmap": [ - "HTML/" - ] - } - }, - { - "name": "znk3r/html_quickform", - "version": "4.0.2", - "dist": { - "type": "zip", - "url": "https://github.com/macintoshplus/HTML_QuickForm/archive/v4.0.2.zip" - }, - "type": "library", - "autoload": { - "classmap": [ - "HTML/" - ] - } } ], "packages-dev": [ diff --git a/htdocs/pages/administration/index.php b/htdocs/pages/administration/index.php deleted file mode 100644 index a687583ba..000000000 --- a/htdocs/pages/administration/index.php +++ /dev/null @@ -1,46 +0,0 @@ -getResponse(); -$response->send(); - -$kernel->getKernel()->terminate($request, $response); diff --git a/htdocs/pages/administration/message.php b/htdocs/pages/administration/message.php deleted file mode 100644 index 6b61296b4..000000000 --- a/htdocs/pages/administration/message.php +++ /dev/null @@ -1,25 +0,0 @@ -assign('message', stripslashes((string) $_GET['message'])); - $smarty->assign('url' , $_GET['url']); - $smarty->assign('erreur' , $_GET['erreur']); - $smarty->display('message.html'); - - // On s'arrête là pour ne pas afficher le pied de page - exit; diff --git a/htdocs/templates/administration/entete.html b/htdocs/templates/administration/entete.html deleted file mode 100644 index d90b1e45b..000000000 --- a/htdocs/templates/administration/entete.html +++ /dev/null @@ -1,17 +0,0 @@ - - - - {include file="head.html"} - - - - - -
-
-
diff --git a/htdocs/templates/administration/head.html b/htdocs/templates/administration/head.html deleted file mode 100644 index 8c0260824..000000000 --- a/htdocs/templates/administration/head.html +++ /dev/null @@ -1,18 +0,0 @@ - - - {$titre_page} - Administration AFUP - - - - - - - - - - - - - - - diff --git a/htdocs/templates/administration/message.html b/htdocs/templates/administration/message.html deleted file mode 100644 index 2a867bae4..000000000 --- a/htdocs/templates/administration/message.html +++ /dev/null @@ -1,14 +0,0 @@ - - - - - {include file="head.html"} - - - -
- {$message|escape|nl2br}

-

Poursuivre

-
- - \ No newline at end of file diff --git a/htdocs/templates/administration/pagination.html b/htdocs/templates/administration/pagination.html deleted file mode 100644 index ddf0221cb..000000000 --- a/htdocs/templates/administration/pagination.html +++ /dev/null @@ -1,20 +0,0 @@ -
- - {if ($numero_page < $nombre_pages)} - - {/if} - {$numero_page}/{$nombre_pages} - {if $numero_page > 1} - - {/if} -
diff --git a/htdocs/templates/administration/pied_de_page.html b/htdocs/templates/administration/pied_de_page.html deleted file mode 100644 index 99f719cb5..000000000 --- a/htdocs/templates/administration/pied_de_page.html +++ /dev/null @@ -1,55 +0,0 @@ -
-
- -
-
-
- - - - {if $flash_message} -
-

{$flash_message|escape|nl2br}

-
- - {literal} - - {/literal} - {/if} - - - - - diff --git a/htdocs/templates/commun/formulaire-en.html b/htdocs/templates/commun/formulaire-en.html deleted file mode 100644 index 9a18c8783..000000000 --- a/htdocs/templates/commun/formulaire-en.html +++ /dev/null @@ -1,55 +0,0 @@ - -{$formulaire.hidden} - {if isset($erreur)} -

{$erreur}

- {/if} - - {foreach from=$formulaire.sections item=section} - - {if $section.header}{$section.header}{/if} - - {foreach from=$section.elements item=element} -
- {if $element.type == 'submit'} - {$element.html} - {elseif $element.type == 'static' && ($element.name == 'html')} -

{$element.html|nl2br}

- {elseif $element.type == 'static' && ($element.name == 'note')} -

{$element.html|nl2br}

- {elseif $element.type == 'static' && ($element.name == 'raccourci')} -

{$element.html|nl2br}

- {elseif $element.type == 'group'} - {if $element.label != ''} - - {/if} - - {foreach from=$element.elements item=element_groupe name=groupe} - {$element_groupe.html} - {if !$smarty.foreach.groupe.last}{$element.separator}{/if} - {/foreach} - {if $element.error}

{$element.error}

{/if} -
- {else} - {if $element.label != ''} - - {/if} - - {$element.html} - {if $element.error}

{$element.error}

{/if} -
- {/if} -
- {/foreach} - - -
 
- - {/foreach} -

* required field

- diff --git a/htdocs/templates/commun/formulaire.html b/htdocs/templates/commun/formulaire.html deleted file mode 100644 index 37adaf057..000000000 --- a/htdocs/templates/commun/formulaire.html +++ /dev/null @@ -1,105 +0,0 @@ -{assign var='auMoinsUnChampsRequis' value=false} - -{$formulaire.hidden} - {if isset($erreur)} -

{$erreur}

- {/if} - - {foreach from=$formulaire.sections key=num item=section} - -
- {if $section.header} -

{$section.header}

-
- {/if} - - {foreach from=$section.elements item=element} - {if $element.required}{assign var='auMoinsUnChampsRequis' value=true}{/if} -
- - {if $element.error} -
-
-
-
-
- {$element.error} -
-
-
- {/if} - -
- {if $element.type == 'submit'} - -
- {$element.html} -
- {elseif $element.type == 'static' && ($element.name == 'html')} -

{$element.html|nl2br}

- {elseif $element.type == 'static' && ($element.name == 'note')} - -
- {$element.html|nl2br} -
- {elseif $element.type == 'static' && ($element.name == 'info')} - -
- {$element.html} -
- {elseif $element.type == 'static' && ($element.name == 'label')} - - {elseif $element.type == 'static' && ($element.name == 'raccourci')} -

{$element.html|nl2br}

- {elseif $element.type == 'group'} - {if $element.label != ''} - - {/if} -
- {foreach from=$element.elements item=element_groupe name=groupe} -
- {$element_groupe.html} -
- {if !$smarty.foreach.groupe.last}{$element.separator}{/if} - {/foreach} -
- {elseif $element.type == 'text' or $element.type == 'select' or $element.type == 'textarea' - or $element.type == 'password' or $element.type == 'checkbox' or $element.type == 'file' - or $element.type == 'date' - } - -
-
- {if $element.type == 'textarea'}
{/if} - {$element.html} - {if $element.type == 'textarea'}
{/if} -
-
- {else} - Type de champ {$element.type} {if $element.name }({$element.name}){/if} non géré. - {/if} -
-
- {/foreach} - -
- {/foreach} - {if $auMoinsUnChampsRequis} -
-

* indique un champ obligatoire

-
- {/if} - diff --git a/patches/znk3r-html-quickform-html-quickform-date-php.patch b/patches/znk3r-html-quickform-html-quickform-date-php.patch deleted file mode 100644 index 6a35addd5..000000000 --- a/patches/znk3r-html-quickform-html-quickform-date-php.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- /dev/null -+++ ../HTML/QuickForm/date.php -@@ -317,7 +317,7 @@ - $locale = $this->_locale[$this->_options['language']]; - $backslash = false; - for ($i = 0, $length = strlen($this->_options['format']); $i < $length; $i++) { -- $sign = $this->_options['format']{$i}; -+ $sign = $this->_options['format'][$i]; - if ($backslash) { - $backslash = false; - $separator .= $sign; diff --git a/patches/znk3r-html-quickform-html-quickform-php.patch b/patches/znk3r-html-quickform-html-quickform-php.patch deleted file mode 100644 index 0e37fd97e..000000000 --- a/patches/znk3r-html-quickform-html-quickform-php.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- /dev/null -+++ ../HTML/QuickForm.php -@@ -281,7 +281,7 @@ - $attributes = array('action'=>$action, 'method'=>$method, 'name'=>$formName, 'id'=>$formName) + $target; - $this->updateAttributes($attributes); - if (!$trackSubmit || isset($_REQUEST['_qf__' . $formName])) { -- if (1 == get_magic_quotes_gpc()) { -+ if (function_exists('get_magic_quotes_gpc') && 1 == get_magic_quotes_gpc()) { - $this->_submitValues = $this->_recursiveFilter('stripslashes', 'get' == $method? $_GET: $_POST); - foreach ($_FILES as $keyFirst => $valFirst) { - foreach ($valFirst as $keySecond => $valSecond) { diff --git a/phpstan.neon b/phpstan.neon index 4963981f1..d6402a022 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -8,10 +8,6 @@ parameters: stubFiles: - tests/stubs/Ting/Repository/Repository.php.stub - tests/stubs/Ting/Repository/RepositoryFactory.php.stub - ignoreErrors: - - - identifier: property.onlyWritten - path: sources/AppBundle/Controller/LegacyController.php type_coverage: return: 71 param: 71 diff --git a/sources/Afup/Bootstrap/Cli.php b/sources/Afup/Bootstrap/Cli.php deleted file mode 100644 index 83385ea8f..000000000 --- a/sources/Afup/Bootstrap/Cli.php +++ /dev/null @@ -1,27 +0,0 @@ - - * @author Olivier Hoareau - * @copyright 2010 Association Française des Utilisateurs de PHP - * - * @category AFUP - * @package AFUP - * @group Bootstraps - */ - - -$startMicrotime = microtime(true); - -require_once __DIR__ . '/_Common.php'; -require_once __DIR__ . '/../../../vendor/autoload.php'; diff --git a/sources/Afup/Bootstrap/Http.php b/sources/Afup/Bootstrap/Http.php deleted file mode 100644 index 562c85a77..000000000 --- a/sources/Afup/Bootstrap/Http.php +++ /dev/null @@ -1,78 +0,0 @@ - - * @author Olivier Hoareau - * @copyright 2010 Association Française des Utilisateurs de PHP - * - * @category AFUP - * @package AFUP - * @group Bootstraps - */ - -// chargement des paramétrages génériques / multi-contextuels de l'application - -use Afup\Site\Corporate\Site; -use Smarty\Smarty; - -require_once __DIR__ . '/_Common.php'; - -// initialisation de la session / requête -if (ob_get_level() === 0) { - ob_start(); -} - -// mise à jour des paramétrages PHP en fonction de la configuration - -if (getenv('APP_ENV') === 'prod') { - ini_set('error_reporting', (string) (E_ALL ^ E_WARNING ^ E_NOTICE)); - ini_set('display_errors', '0'); -} else { - ini_set('error_reporting', (string) E_ALL); - ini_set('display_errors', '1'); -} - -header('Content-type: text/html; charset=UTF-8'); - -// choix du 'sous-site' en fonction de l'url - -$serveur = ''; -$url = $_SERVER['REQUEST_URI']; -if (strrpos((string) $url, '?') !== false) { - $position = strrpos((string) $url, '?'); - $url = substr((string) $url, 0, $position); -} -$position = strrpos((string) $url, '/'); -$url = substr((string) $_SERVER['REQUEST_URI'], 0, $position); -$parties = explode('/', $url); -$sous_site = array_pop($parties); - -// initialisation de Smarty, le moteur de template (html) - -$smarty = new Smarty(); -$smarty->setTemplateDir([ - AFUP_CHEMIN_RACINE . 'templates/' . $sous_site . '/', - AFUP_CHEMIN_RACINE . 'templates/commun/', -]); -$smarty->setCompileDir(AFUP_CHEMIN_RACINE . 'cache/templates'); -$smarty->compile_id = $sous_site; -$smarty->use_sub_dirs = true; -$smarty->compile_check = Smarty::COMPILECHECK_ON; -$smarty->registerPlugin("modifier","stripslashes", "stripslashes"); -$smarty->registerPlugin("modifier","floatval", "floatval"); - -$smarty->assign('url_base', 'https://' . $_SERVER['HTTP_HOST'] . '/'); -$smarty->assign('chemin_template', $serveur . '/templates/' . $sous_site . '/'); -$smarty->assign('chemin_javascript', $serveur . '/javascript/'); - -require_once(__DIR__ . '/commonStart.php'); diff --git a/sources/Afup/Bootstrap/_Common.php b/sources/Afup/Bootstrap/_Common.php index 3a00b18d0..7068e8c87 100644 --- a/sources/Afup/Bootstrap/_Common.php +++ b/sources/Afup/Bootstrap/_Common.php @@ -33,9 +33,6 @@ } date_default_timezone_set('Europe/Paris'); -// préparation de la requête / session -require_once __DIR__ . '/../fonctions.php'; - // chargement de la configuration $conf = new Configuration(); diff --git a/sources/Afup/Bootstrap/commonStart.php b/sources/Afup/Bootstrap/commonStart.php index 280a7b611..3cdd27d49 100644 --- a/sources/Afup/Bootstrap/commonStart.php +++ b/sources/Afup/Bootstrap/commonStart.php @@ -3,10 +3,6 @@ declare(strict_types=1); use AppBundle\Event\Model\Ticket; -use CCMBenchmark\Ting\Services; -use Symfony\Component\Security\Csrf\CsrfTokenManager; -use Symfony\Component\Translation\Loader\XliffFileLoader; -use Symfony\Component\Translation\Translator; // Inclusion de l'autoload de composer require_once __DIR__ . '/../../../vendor/autoload.php'; @@ -17,20 +13,6 @@ if (isset($_GET['lang']) && in_array($_GET['lang'], $langs)) { $lang = $_GET['lang']; } -$translator = new Translator($lang); -$translator->addLoader('xliff', new XliffFileLoader()); -$translator->addResource('xliff', __DIR__ . '/../../../translations/inscription.en.xlf', 'en'); -$translator->addResource('xliff', __DIR__ . '/../../../translations/cfp.en.xlf', 'en'); -$translator->setFallbackLocales(['fr']); -if (isset($smarty)) { - $smarty->register_modifier('trans', $translator->trans(...)); -} - - -$debug = false; -if (isset($_SERVER['HTTP_HOST']) && $_SERVER['HTTP_HOST'] === 'afup.dev') { - $debug = true; -} define('AFUP_COTISATION_PERSONNE_PHYSIQUE', 30); define('AFUP_COTISATION_PERSONNE_MORALE', 150); @@ -64,28 +46,3 @@ define('AFUP_TRANSPORT_MODE_AVION_ECO', 90); define('AFUP_TRANSPORT_MODE_AVION_BUSINESS', 100); define('AFUP_TRANSPORT_MODE_COMMUN', 110); - - -// Initialisation de ting -$services = new Services(); -$services->get('ConnectionPool')->setConfig([ - 'main' => [ - 'namespace' => '\CCMBenchmark\Ting\Driver\Mysqli', - 'master' => [ - 'host' => $GLOBALS['AFUP_CONF']->obtenir('database_host'), - 'user' => $GLOBALS['AFUP_CONF']->obtenir('database_user'), - 'password' => $GLOBALS['AFUP_CONF']->obtenir('database_password'), - 'port' => 3306, - ], - ], -]); - -$services - ->get('MetadataRepository') - ->batchLoadMetadata( - 'AppBundle\Event\Model\Repository', - __DIR__ . '/../Event/Model/Repository/*.php', - ['default' => ['database' => $GLOBALS['AFUP_CONF']->obtenir('database_name')]], - ) -; -$services->set('security.csrf.token_manager', fn(): CsrfTokenManager => new CsrfTokenManager()); diff --git a/sources/Afup/Droits.php b/sources/Afup/Droits.php index cafd5eed3..20dcc6e89 100644 --- a/sources/Afup/Droits.php +++ b/sources/Afup/Droits.php @@ -22,11 +22,6 @@ */ class Droits { - /** - * Liste structurée avec toutes les pages référencées dans l'application - */ - private array $_pages = []; - public function __construct( private readonly TokenStorageInterface $tokenStorage, private readonly AuthorizationCheckerInterface $authorizationChecker, @@ -46,37 +41,6 @@ public function obtenirIdentifiant(): ?int return null; } - public function chargerToutesLesPages($pages): void - { - if (is_array($pages)) { - $this->_pages = $pages; - } - } - - /** - * @param int|string $page - */ - public function verifierDroitSurLaPage($page): bool - { - if ($this->authorizationChecker->isGranted('ROLE_SUPER_ADMIN')) { - return true; - } - foreach ($this->_pages as $_page => $_page_details) { - if ($page == $_page && (isset($_page_details['niveau']) && $this->authorizationChecker->isGranted($_page_details['niveau']))) { - return true; - } - if (isset($_page_details['elements']) && is_array($_page_details['elements'])) { - foreach ($_page_details['elements'] as $_element => $_element_details) { - if ($page == $_element && (isset($_element_details['niveau']) && $this->authorizationChecker->isGranted($_element_details['niveau']))) { - return true; - } - } - } - } - - return false; - } - /** * @param int $compagnyId */ diff --git a/sources/Afup/Pagination.php b/sources/Afup/Pagination.php deleted file mode 100644 index a8d6b4959..000000000 --- a/sources/Afup/Pagination.php +++ /dev/null @@ -1,35 +0,0 @@ -nombre_elements_total / $this->nombre_elements_par_page); - $pages = []; - for ($i = 1; $i <= $page_max; $i++) { - $pages[] = $i; - } - - $smarty->assign('pagination_page_courante', $this->page_courante); - $smarty->assign('pagination_pages', $pages); - - $smarty->register_function('pagination_genere_route', $this->genere_route, false); - - ob_start(); - $smarty->display('pagination.html'); - return (string) ob_get_clean(); - } -} diff --git a/sources/Afup/fonctions.php b/sources/Afup/fonctions.php deleted file mode 100644 index d48e43038..000000000 --- a/sources/Afup/fonctions.php +++ /dev/null @@ -1,128 +0,0 @@ -removeAttribute('name'); - return $formulaire; -} - -/** - * Renvoit un tableau contenant les éléments d'un formulaire - * - * @param HTML_QuickForm $formulaire Formulaire à traiter - * @return array - */ -function genererFormulaire(HTML_QuickForm &$formulaire) -{ - foreach ($formulaire->getElements() as $el) { - $attrs = $el->getAttributes(); - if ($el instanceof HTML_QuickForm_submit) { - $attrs['class'] = 'ui primary button'; - } - $el->setAttributes($attrs); - } - - $renderer = new HTML_QuickForm_Renderer_Array(true, true); - $formulaire->accept($renderer); - $resultat = $renderer->toArray(); - unset($renderer); - return $resultat; -} - -/** - * Vérifie qu'une action est disponible et si ce n'est pas le cas, renvoit l'action par défaut - * - * L'action par défaut est la première des actions disponibles. - * - * @param array $actions_disponibles Actions disponibles - * @return string - */ -function verifierAction(array $actions_disponibles) -{ - if (count($actions_disponibles) == 0) { - trigger_error("Les actions disponibles doivent être passées sous forme d'un tableau d'au moins un élément", E_USER_ERROR); - } - - if (!empty($_GET['action']) && in_array($_GET['action'], $actions_disponibles)) { - return $_GET['action']; - } else { - return $actions_disponibles[0]; - } -} - -function obtenirTitre($pages, $page) -{ - foreach ($pages as $_page => $_page_details) { - if ($page == $_page) { - return $_page_details['nom']; - } - if (isset($_page_details['elements']) && is_array($_page_details['elements'])) { - foreach ($_page_details['elements'] as $_element => $_element_details) { - if ($page == $_element) { - return $_element_details['nom']; - } - } - } - } - return null; -} - -function chargerForumId(): void -{ - $_GET['id_forum'] ??= $_SESSION['_sf2_attributes'][RedirectEventFromSessionListener::SESSION_KEY] ?? 0; -} - -function checkForumRedirection(): void -{ - $idFromSession = $_SESSION['_sf2_attributes'][RedirectEventFromSessionListener::SESSION_KEY] ?? null; - - if ( - $_SERVER['REQUEST_METHOD'] === 'GET' - && !isset($_GET['id_forum']) - && $idFromSession !== null - ) { - $url = $_SERVER['REQUEST_URI']; - - $parsedUrl = parse_url((string) $url); - parse_str($parsedUrl['query'] ?? '', $queryParams); - - $queryParams['id_forum'] = $idFromSession; - - $newQuery = http_build_query($queryParams); - $newUrl = $parsedUrl['path'] . '?' . $newQuery; - - header("Location: $newUrl"); - exit(); - } -} diff --git a/sources/AppBundle/Association/Form/HTML_QuickForm.php b/sources/AppBundle/Association/Form/HTML_QuickForm.php deleted file mode 100644 index 83a028db0..000000000 --- a/sources/AppBundle/Association/Form/HTML_QuickForm.php +++ /dev/null @@ -1,13 +0,0 @@ -_elements; - } -} diff --git a/sources/AppBundle/Controller/LegacyController.php b/sources/AppBundle/Controller/LegacyController.php deleted file mode 100644 index dca75765c..000000000 --- a/sources/AppBundle/Controller/LegacyController.php +++ /dev/null @@ -1,105 +0,0 @@ -tokenStorage, $this->authorizationChecker); - $pages = $this->backOfficePages; - /** @var Session $session */ - $session = $this->requestStack->getSession(); - - if ($_GET['page'] == 'index' || !file_exists(__DIR__ . '/../../../htdocs/pages/administration/' . $_GET['page'] . '.php')) { - return $this->redirectToRoute('admin_home'); - } - // On vérifie que l'utilisateur a le droit d'accéder à la page - $droits->chargerToutesLesPages($pages); - if (!$droits->verifierDroitSurLaPage($_GET['page'])) { - $this->addFlash('error', "Vous n'avez pas le droit d'accéder à\u{a0}cette page"); - return $this->redirectToRoute('admin_home'); - } - // Initialisation de AFUP_Log - require_once __DIR__ . '/../../../htdocs/pages/administration/' . $_GET['page'] . '.php'; - // On gère des infos popups - if (isset($_SESSION['flash']['message'])) { - $this->addFlash('notice', $_SESSION['flash']['message']); - } - if (isset($_SESSION['flash']['erreur'])) { - $this->addFlash('error', $_SESSION['flash']['erreur']); - } - unset($_SESSION['flash']); - // Récupération du contenu de la page généré par smarty - $content = $smarty->fetch($_GET['page'] . '.html'); - - $file = $_GET['page'] . '.js.html'; - $js = ''; - if ($smarty->templateExists($file)) { - $js = $smarty->fetch($file); - } - - return $this->render('admin/base_with_header.html.twig', [ - 'title' => obtenirTitre($pages, $_GET['page']), - 'page' => $_GET['page'], - 'content' => $content, - 'js' => $js, - ]); - } -} diff --git a/templates/admin/base_with_header.html.twig b/templates/admin/base_with_header.html.twig index 7b4e2bccc..0d95fbf5f 100644 --- a/templates/admin/base_with_header.html.twig +++ b/templates/admin/base_with_header.html.twig @@ -211,10 +211,6 @@ } - - {% if js is defined %} - {{ js|raw }} - {% endif %} {% endblock %} {% endblock %}