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 c903a15af..77baf88cf 100644 --- a/app/config/services.yml +++ b/app/config/services.yml @@ -60,28 +60,6 @@ services: autoconfigure: true public: false - ### Pages legacy - DEBUT - # Les anciennes pages ont besoin que certains services soient publics, - # car récupérés via `$container->get()`. Ils sont listés ici : - - AppBundle\Event\Ticket\TicketTypeAvailability: - autowire: true - - AppBundle\Event\Invoice\InvoiceService: - autowire: true - - AppBundle\Event\Model\Repository\EventStatsRepository: - autowire: true - - ### 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 3e7c06931..b3f2c2e5b 100644 --- a/composer.json +++ b/composer.json @@ -42,7 +42,6 @@ "robmorgan/phinx": "0.16.*", "sabre/vobject": "^4.6", "setasign/tfpdf": "^1.33", - "smarty/smarty": "^5.8", "symfony/asset": "7.4.*", "symfony/asset-mapper": "7.4.*", "symfony/clock": "7.4.*", @@ -72,9 +71,7 @@ "twig/intl-extra": "^3.26", "twig/string-extra": "^3.24", "twig/twig": "^3.27", - "webmozart/assert": "^2.4", - "znk3r/html_common": "*", - "znk3r/html_quickform": "4.0.2" + "webmozart/assert": "^2.4" }, "scripts": { "post-install-cmd": [ @@ -103,10 +100,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", @@ -123,11 +116,7 @@ "Afup\\Site\\": "sources/Afup/", "AppBundle\\": "sources/AppBundle/", "PlanetePHP\\": "sources/PlanetePHP/" - }, - "files": [ - "sources/Afup/Bootstrap/_Common.php", - "sources/Afup/Bootstrap/commonStart.php" - ] + } }, "autoload-dev": { "psr-4": { @@ -175,38 +164,6 @@ "tomasvotruba/type-coverage": "^2.2" }, "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 e4174d5c9..d615a060c 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": "2b829d682a03370932a35b2ea08cc74c", + "content-hash": "1e640736f643d9fc8df9261fac72f28b", "packages": [ { "name": "algolia/algoliasearch-client-php", @@ -5457,82 +5457,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", @@ -10988,34 +10912,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 0d071506d..000000000 --- a/htdocs/templates/administration/head.html +++ /dev/null @@ -1,16 +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-baseline.php b/phpstan-baseline.php index 30c4b3e7c..0099d3272 100644 --- a/phpstan-baseline.php +++ b/phpstan-baseline.php @@ -1,36 +1,6 @@ '#^Binary operation "\\." between \'https\\://\' and mixed results in an error\\.$#', - 'identifier' => 'binaryOp.invalid', - 'count' => 1, - 'path' => __DIR__ . '/sources/Afup/Bootstrap/Http.php', -]; -$ignoreErrors[] = [ - 'message' => '#^Cannot cast mixed to string\\.$#', - 'identifier' => 'cast.string', - 'count' => 5, - 'path' => __DIR__ . '/sources/Afup/Bootstrap/Http.php', -]; -$ignoreErrors[] = [ - 'message' => '#^Parameter \\#3 \\$length of function substr expects int\\|null, int\\|false given\\.$#', - 'identifier' => 'argument.type', - 'count' => 1, - 'path' => __DIR__ . '/sources/Afup/Bootstrap/Http.php', -]; -$ignoreErrors[] = [ - 'message' => '#^Cannot call method register_modifier\\(\\) on mixed\\.$#', - 'identifier' => 'method.nonObject', - 'count' => 1, - 'path' => __DIR__ . '/sources/Afup/Bootstrap/commonStart.php', -]; -$ignoreErrors[] = [ - 'message' => '#^Parameter \\#1 \\$locale of class Symfony\\\\Component\\\\Translation\\\\Translator constructor expects string, mixed given\\.$#', - 'identifier' => 'argument.type', - 'count' => 1, - 'path' => __DIR__ . '/sources/Afup/Bootstrap/commonStart.php', -]; $ignoreErrors[] = [ 'message' => '#^Argument of an invalid type mixed supplied for foreach, only iterables are supported\\.$#', 'identifier' => 'foreach.nonIterable', @@ -127,84 +97,6 @@ 'count' => 1, 'path' => __DIR__ . '/sources/Afup/Corporate/Page.php', ]; -$ignoreErrors[] = [ - 'message' => '#^Cannot access offset \'elements\' on mixed\\.$#', - 'identifier' => 'offsetAccess.nonOffsetAccessible', - 'count' => 1, - 'path' => __DIR__ . '/sources/Afup/Droits.php', -]; -$ignoreErrors[] = [ - 'message' => '#^Cannot access offset \'niveau\' on mixed\\.$#', - 'identifier' => 'offsetAccess.nonOffsetAccessible', - 'count' => 2, - 'path' => __DIR__ . '/sources/Afup/Droits.php', -]; -$ignoreErrors[] = [ - 'message' => '#^Cannot call method getUser\\(\\) on Symfony\\\\Component\\\\Security\\\\Core\\\\Authentication\\\\Token\\\\TokenInterface\\|null\\.$#', - 'identifier' => 'method.nonObject', - 'count' => 2, - 'path' => __DIR__ . '/sources/Afup/Droits.php', -]; -$ignoreErrors[] = [ - 'message' => '#^Method Afup\\\\Site\\\\Droits\\:\\:chargerToutesLesPages\\(\\) has parameter \\$pages with no type specified\\.$#', - 'identifier' => 'missingType.parameter', - 'count' => 1, - 'path' => __DIR__ . '/sources/Afup/Droits.php', -]; -$ignoreErrors[] = [ - 'message' => '#^Property Afup\\\\Site\\\\Droits\\:\\:\\$_pages type has no value type specified in iterable type array\\.$#', - 'identifier' => 'missingType.iterableValue', - 'count' => 1, - 'path' => __DIR__ . '/sources/Afup/Droits.php', -]; -$ignoreErrors[] = [ - 'message' => '#^Binary operation "/" between mixed and mixed results in an error\\.$#', - 'identifier' => 'binaryOp.invalid', - 'count' => 1, - 'path' => __DIR__ . '/sources/Afup/Pagination.php', -]; -$ignoreErrors[] = [ - 'message' => '#^Cannot call method assign\\(\\) on mixed\\.$#', - 'identifier' => 'method.nonObject', - 'count' => 2, - 'path' => __DIR__ . '/sources/Afup/Pagination.php', -]; -$ignoreErrors[] = [ - 'message' => '#^Cannot call method display\\(\\) on mixed\\.$#', - 'identifier' => 'method.nonObject', - 'count' => 1, - 'path' => __DIR__ . '/sources/Afup/Pagination.php', -]; -$ignoreErrors[] = [ - 'message' => '#^Cannot call method register_function\\(\\) on mixed\\.$#', - 'identifier' => 'method.nonObject', - 'count' => 1, - 'path' => __DIR__ . '/sources/Afup/Pagination.php', -]; -$ignoreErrors[] = [ - 'message' => '#^Method Afup\\\\Site\\\\Pagination\\:\\:__construct\\(\\) has parameter \\$genere_route with no type specified\\.$#', - 'identifier' => 'missingType.parameter', - 'count' => 1, - 'path' => __DIR__ . '/sources/Afup/Pagination.php', -]; -$ignoreErrors[] = [ - 'message' => '#^Method Afup\\\\Site\\\\Pagination\\:\\:__construct\\(\\) has parameter \\$nombre_elements_par_page with no type specified\\.$#', - 'identifier' => 'missingType.parameter', - 'count' => 1, - 'path' => __DIR__ . '/sources/Afup/Pagination.php', -]; -$ignoreErrors[] = [ - 'message' => '#^Method Afup\\\\Site\\\\Pagination\\:\\:__construct\\(\\) has parameter \\$nombre_elements_total with no type specified\\.$#', - 'identifier' => 'missingType.parameter', - 'count' => 1, - 'path' => __DIR__ . '/sources/Afup/Pagination.php', -]; -$ignoreErrors[] = [ - 'message' => '#^Method Afup\\\\Site\\\\Pagination\\:\\:__construct\\(\\) has parameter \\$page_courante with no type specified\\.$#', - 'identifier' => 'missingType.parameter', - 'count' => 1, - 'path' => __DIR__ . '/sources/Afup/Pagination.php', -]; $ignoreErrors[] = [ 'message' => '#^Binary operation "\\." between mixed and \' \' results in an error\\.$#', 'identifier' => 'binaryOp.invalid', @@ -229,18 +121,6 @@ 'count' => 1, 'path' => __DIR__ . '/sources/Afup/Utils/Pays.php', ]; -$ignoreErrors[] = [ - 'message' => '#^Method Afup\\\\Site\\\\Utils\\\\SymfonyKernel\\:\\:getResponse\\(\\) should return Symfony\\\\Component\\\\HttpFoundation\\\\Response but returns Symfony\\\\Component\\\\HttpFoundation\\\\Response\\|null\\.$#', - 'identifier' => 'return.type', - 'count' => 1, - 'path' => __DIR__ . '/sources/Afup/Utils/SymfonyKernel.php', -]; -$ignoreErrors[] = [ - 'message' => '#^Parameter \\#1 \\$request of method Symfony\\\\Component\\\\HttpKernel\\\\Kernel\\:\\:handle\\(\\) expects Symfony\\\\Component\\\\HttpFoundation\\\\Request, Symfony\\\\Component\\\\HttpFoundation\\\\Request\\|null given\\.$#', - 'identifier' => 'argument.type', - 'count' => 1, - 'path' => __DIR__ . '/sources/Afup/Utils/SymfonyKernel.php', -]; $ignoreErrors[] = [ 'message' => '#^Binary operation "\\." between non\\-falsy\\-string and mixed results in an error\\.$#', 'identifier' => 'binaryOp.invalid', @@ -325,108 +205,6 @@ 'count' => 1, 'path' => __DIR__ . '/sources/Afup/Utils/Vat.php', ]; -$ignoreErrors[] = [ - 'message' => '#^Argument of an invalid type mixed supplied for foreach, only iterables are supported\\.$#', - 'identifier' => 'foreach.nonIterable', - 'count' => 2, - 'path' => __DIR__ . '/sources/Afup/fonctions.php', -]; -$ignoreErrors[] = [ - 'message' => '#^Cannot access offset \'class\' on mixed\\.$#', - 'identifier' => 'offsetAccess.nonOffsetAccessible', - 'count' => 1, - 'path' => __DIR__ . '/sources/Afup/fonctions.php', -]; -$ignoreErrors[] = [ - 'message' => '#^Cannot access offset \'elements\' on mixed\\.$#', - 'identifier' => 'offsetAccess.nonOffsetAccessible', - 'count' => 1, - 'path' => __DIR__ . '/sources/Afup/fonctions.php', -]; -$ignoreErrors[] = [ - 'message' => '#^Cannot access offset \'erreur\' on mixed\\.$#', - 'identifier' => 'offsetAccess.nonOffsetAccessible', - 'count' => 1, - 'path' => __DIR__ . '/sources/Afup/fonctions.php', -]; -$ignoreErrors[] = [ - 'message' => '#^Cannot access offset \'event_selector_current_id\' on mixed\\.$#', - 'identifier' => 'offsetAccess.nonOffsetAccessible', - 'count' => 2, - 'path' => __DIR__ . '/sources/Afup/fonctions.php', -]; -$ignoreErrors[] = [ - 'message' => '#^Cannot access offset \'message\' on mixed\\.$#', - 'identifier' => 'offsetAccess.nonOffsetAccessible', - 'count' => 1, - 'path' => __DIR__ . '/sources/Afup/fonctions.php', -]; -$ignoreErrors[] = [ - 'message' => '#^Cannot access offset \'nom\' on mixed\\.$#', - 'identifier' => 'offsetAccess.nonOffsetAccessible', - 'count' => 2, - 'path' => __DIR__ . '/sources/Afup/fonctions.php', -]; -$ignoreErrors[] = [ - 'message' => '#^Cannot access offset \'path\' on array\\{scheme\\?\\: string, host\\?\\: string, port\\?\\: int\\<0, 65535\\>, user\\?\\: string, pass\\?\\: string, path\\?\\: string, query\\?\\: string, fragment\\?\\: string\\}\\|false\\.$#', - 'identifier' => 'offsetAccess.nonOffsetAccessible', - 'count' => 1, - 'path' => __DIR__ . '/sources/Afup/fonctions.php', -]; -$ignoreErrors[] = [ - 'message' => '#^Cannot call method getAttributes\\(\\) on mixed\\.$#', - 'identifier' => 'method.nonObject', - 'count' => 1, - 'path' => __DIR__ . '/sources/Afup/fonctions.php', -]; -$ignoreErrors[] = [ - 'message' => '#^Cannot call method setAttributes\\(\\) on mixed\\.$#', - 'identifier' => 'method.nonObject', - 'count' => 1, - 'path' => __DIR__ . '/sources/Afup/fonctions.php', -]; -$ignoreErrors[] = [ - 'message' => '#^Cannot cast mixed to string\\.$#', - 'identifier' => 'cast.string', - 'count' => 1, - 'path' => __DIR__ . '/sources/Afup/fonctions.php', -]; -$ignoreErrors[] = [ - 'message' => '#^Function genererFormulaire\\(\\) return type has no value type specified in iterable type array\\.$#', - 'identifier' => 'missingType.iterableValue', - 'count' => 1, - 'path' => __DIR__ . '/sources/Afup/fonctions.php', -]; -$ignoreErrors[] = [ - 'message' => '#^Function obtenirTitre\\(\\) has no return type specified\\.$#', - 'identifier' => 'missingType.return', - 'count' => 1, - 'path' => __DIR__ . '/sources/Afup/fonctions.php', -]; -$ignoreErrors[] = [ - 'message' => '#^Function obtenirTitre\\(\\) has parameter \\$page with no type specified\\.$#', - 'identifier' => 'missingType.parameter', - 'count' => 1, - 'path' => __DIR__ . '/sources/Afup/fonctions.php', -]; -$ignoreErrors[] = [ - 'message' => '#^Function obtenirTitre\\(\\) has parameter \\$pages with no type specified\\.$#', - 'identifier' => 'missingType.parameter', - 'count' => 1, - 'path' => __DIR__ . '/sources/Afup/fonctions.php', -]; -$ignoreErrors[] = [ - 'message' => '#^Function verifierAction\\(\\) should return string but returns mixed\\.$#', - 'identifier' => 'return.type', - 'count' => 1, - 'path' => __DIR__ . '/sources/Afup/fonctions.php', -]; -$ignoreErrors[] = [ - 'message' => '#^Parameter \\#3 \\$action of class AppBundle\\\\Association\\\\Form\\\\HTML_QuickForm constructor expects string, mixed given\\.$#', - 'identifier' => 'argument.type', - 'count' => 1, - 'path' => __DIR__ . '/sources/Afup/fonctions.php', -]; $ignoreErrors[] = [ 'message' => '#^Method AppBundle\\\\Accounting\\\\Entity\\\\Repository\\\\AccountRepository\\:\\:getAllSortedByName\\(\\) should return array\\ but returns mixed\\.$#', 'identifier' => 'return.type', @@ -871,12 +649,6 @@ 'count' => 1, 'path' => __DIR__ . '/sources/AppBundle/Association/Form/ContactDetailsType.php', ]; -$ignoreErrors[] = [ - 'message' => '#^Method AppBundle\\\\Association\\\\Form\\\\HTML_QuickForm\\:\\:getElements\\(\\) has no return type specified\\.$#', - 'identifier' => 'missingType.return', - 'count' => 1, - 'path' => __DIR__ . '/sources/AppBundle/Association/Form/HTML_QuickForm.php', -]; $ignoreErrors[] = [ 'message' => '#^Class AppBundle\\\\Association\\\\Form\\\\NearestOfficeChoiceType extends generic class Symfony\\\\Component\\\\Form\\\\AbstractType but does not specify its types\\: TData$#', 'identifier' => 'missingType.generics', @@ -5323,72 +5095,6 @@ 'count' => 1, 'path' => __DIR__ . '/sources/AppBundle/Controller/Event/Vote/VoteController.php', ]; -$ignoreErrors[] = [ - 'message' => '#^Binary operation "\\." between literal\\-string&non\\-falsy\\-string and mixed results in an error\\.$#', - 'identifier' => 'binaryOp.invalid', - 'count' => 2, - 'path' => __DIR__ . '/sources/AppBundle/Controller/LegacyController.php', -]; -$ignoreErrors[] = [ - 'message' => '#^Binary operation "\\." between mixed and \'\\.html\' results in an error\\.$#', - 'identifier' => 'binaryOp.invalid', - 'count' => 1, - 'path' => __DIR__ . '/sources/AppBundle/Controller/LegacyController.php', -]; -$ignoreErrors[] = [ - 'message' => '#^Binary operation "\\." between mixed and \'\\.js\\.html\' results in an error\\.$#', - 'identifier' => 'binaryOp.invalid', - 'count' => 1, - 'path' => __DIR__ . '/sources/AppBundle/Controller/LegacyController.php', -]; -$ignoreErrors[] = [ - 'message' => '#^Cannot access offset \'erreur\' on mixed\\.$#', - 'identifier' => 'offsetAccess.nonOffsetAccessible', - 'count' => 1, - 'path' => __DIR__ . '/sources/AppBundle/Controller/LegacyController.php', -]; -$ignoreErrors[] = [ - 'message' => '#^Cannot access offset \'message\' on mixed\\.$#', - 'identifier' => 'offsetAccess.nonOffsetAccessible', - 'count' => 1, - 'path' => __DIR__ . '/sources/AppBundle/Controller/LegacyController.php', -]; -$ignoreErrors[] = [ - 'message' => '#^Cannot call method fetch\\(\\) on mixed\\.$#', - 'identifier' => 'method.nonObject', - 'count' => 2, - 'path' => __DIR__ . '/sources/AppBundle/Controller/LegacyController.php', -]; -$ignoreErrors[] = [ - 'message' => '#^Cannot call method templateExists\\(\\) on mixed\\.$#', - 'identifier' => 'method.nonObject', - 'count' => 1, - 'path' => __DIR__ . '/sources/AppBundle/Controller/LegacyController.php', -]; -$ignoreErrors[] = [ - 'message' => '#^Method AppBundle\\\\Controller\\\\LegacyController\\:\\:__construct\\(\\) has parameter \\$backOfficePages with no value type specified in iterable type array\\.$#', - 'identifier' => 'missingType.iterableValue', - 'count' => 1, - 'path' => __DIR__ . '/sources/AppBundle/Controller/LegacyController.php', -]; -$ignoreErrors[] = [ - 'message' => '#^Method AppBundle\\\\Controller\\\\LegacyController\\:\\:backOffice\\(\\) has no return type specified\\.$#', - 'identifier' => 'missingType.return', - 'count' => 1, - 'path' => __DIR__ . '/sources/AppBundle/Controller/LegacyController.php', -]; -$ignoreErrors[] = [ - 'message' => '#^Method AppBundle\\\\Controller\\\\LegacyController\\:\\:void\\(\\) has no return type specified\\.$#', - 'identifier' => 'missingType.return', - 'count' => 1, - 'path' => __DIR__ . '/sources/AppBundle/Controller/LegacyController.php', -]; -$ignoreErrors[] = [ - 'message' => '#^Parameter \\#1 \\$page of method Afup\\\\Site\\\\Droits\\:\\:verifierDroitSurLaPage\\(\\) expects int\\|string, mixed given\\.$#', - 'identifier' => 'argument.type', - 'count' => 1, - 'path' => __DIR__ . '/sources/AppBundle/Controller/LegacyController.php', -]; $ignoreErrors[] = [ 'message' => '#^Parameter \\#1 \\$content of class Symfony\\\\Component\\\\HttpFoundation\\\\Response constructor expects string\\|null, string\\|false given\\.$#', 'identifier' => 'argument.type', diff --git a/phpstan.neon b/phpstan.neon index e1a42dc58..518a44700 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -9,10 +9,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/phpunit.xml b/phpunit.xml index fd7c6b15f..7bc6af8f8 100644 --- a/phpunit.xml +++ b/phpunit.xml @@ -17,5 +17,6 @@ + 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 deleted file mode 100644 index bac1fba4c..000000000 --- a/sources/Afup/Bootstrap/_Common.php +++ /dev/null @@ -1,33 +0,0 @@ - - * @author Olivier Hoareau - * @copyright 2010 Association Française des Utilisateurs de PHP - * - * @category AFUP - * @package AFUP - * @group Bootstraps - */ - -$root = dirname(__DIR__, 3); - -require_once $root . '/vendor/autoload.php'; - -// définitions des constantes -if (!defined('AFUP_CHEMIN_RACINE')) { - define('AFUP_CHEMIN_RACINE', $root . '/htdocs/'); -} -date_default_timezone_set('Europe/Paris'); - -// préparation de la requête / session -require_once __DIR__ . '/../fonctions.php'; diff --git a/sources/Afup/Bootstrap/commonStart.php b/sources/Afup/Bootstrap/commonStart.php deleted file mode 100644 index 028c4d12e..000000000 --- a/sources/Afup/Bootstrap/commonStart.php +++ /dev/null @@ -1,30 +0,0 @@ -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; -} diff --git a/sources/Afup/Droits.php b/sources/Afup/Droits.php index e59609fbd..3e55cc6f4 100644 --- a/sources/Afup/Droits.php +++ b/sources/Afup/Droits.php @@ -14,11 +14,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, @@ -29,7 +24,7 @@ public function __construct( */ public function obtenirIdentifiant(): ?int { - $user = $this->tokenStorage->getToken()->getUser(); + $user = $this->tokenStorage->getToken()?->getUser(); if ($user instanceof User || $user instanceof GithubUser) { return $user->getId(); @@ -38,43 +33,12 @@ 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 */ public function verifierDroitManagerPersonneMorale($compagnyId): bool { - $user = $this->tokenStorage->getToken()->getUser(); + $user = $this->tokenStorage->getToken()?->getUser(); if ($user instanceof User) { return $user->getCompanyId() == $compagnyId && $this->authorizationChecker->isGranted('ROLE_COMPANY_MANAGER'); } 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/Utils/SymfonyKernel.php b/sources/Afup/Utils/SymfonyKernel.php deleted file mode 100644 index 6eb07cc86..000000000 --- a/sources/Afup/Utils/SymfonyKernel.php +++ /dev/null @@ -1,82 +0,0 @@ -kernel = new AppKernel($env, $debug); - $this->kernel->boot(); - if (!$request instanceof Request) { - $request = Request::createFromGlobals(); - } - $this->request = $request; - } - - private function handleRequest(?string $uri = null): void - { - if (!$this->response instanceof Response) { - $server = $_SERVER; - if ($uri !== null) { - $_SERVER['REQUEST_URI'] = $uri; - $_SERVER['AFUP_CONTEXT'] = true; - } - $this->response = $this->kernel->handle($this->request); - $_SERVER = $server; - } - } - - public function getKernel(): KernelInterface - { - return $this->kernel; - } - - public function getResponse(): Response - { - $this->handleRequest(); - return $this->response; - } - - public function setResponse(Response $response): void - { - $this->response = $response; - } - - public function getToken(): ?string - { - if (!$this->response instanceof Response) { - return null; - } - return $this->response->headers->get('X-Debug-Token'); - } - - public function getRequest(string $uri): ?Request - { - $this->handleRequest($uri); - return $this->request; - } -} diff --git a/sources/Afup/Utils/Utils.php b/sources/Afup/Utils/Utils.php index 33da55806..b424a7734 100644 --- a/sources/Afup/Utils/Utils.php +++ b/sources/Afup/Utils/Utils.php @@ -4,10 +4,6 @@ namespace Afup\Site\Utils; -use Afup\Site\Droits; -use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface; -use Symfony\Component\Security\Core\Authorization\AuthorizationCheckerInterface; - /** * Diverses méthodes permettant de se simplifier la vie */ @@ -16,11 +12,6 @@ class Utils public const float TICKETING_VAT_RATE = 0.1; public const float MEMBERSHIP_FEE_VAT_RATE = 0.2; - public static function fabriqueDroits(TokenStorageInterface $tokenStorage, AuthorizationCheckerInterface $authorizationChecker): Droits - { - return new Droits($tokenStorage, $authorizationChecker); - } - /** * Get either a Gravatar URL or complete image tag for a specified email address. * 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 2bf4175e8..06ef65edc 100644 --- a/templates/admin/base_with_header.html.twig +++ b/templates/admin/base_with_header.html.twig @@ -207,10 +207,6 @@ } - - {% if js is defined %} - {{ js|raw }} - {% endif %} {% endblock %} {% endblock %}