Skip to content

Commit

Permalink
Rector process round 2 (#1598)
Browse files Browse the repository at this point in the history
* Avant la 2e pass

* Après la 2e pass
  • Loading branch information
stakovicz authored Jan 25, 2025
1 parent 1cf9b27 commit a534693
Show file tree
Hide file tree
Showing 74 changed files with 377 additions and 438 deletions.
4 changes: 2 additions & 2 deletions rector.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
__DIR__ . '/app',
__DIR__ . '/db',
__DIR__ . '/htdocs',
//__DIR__ . '/sources',
//__DIR__ . '/tests',
__DIR__ . '/sources',
__DIR__ . '/tests',
])
->withSkip([
__DIR__ . '/htdocs/cache',
Expand Down
10 changes: 5 additions & 5 deletions sources/Afup/Association/Cotisations.php
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ function ajouter($type_personne, $id_personne, $montant, $type_reglement,
$requete .= $type_personne . ',';
$requete .= $id_personne . ',';
$requete .= $montant . ',';
$requete .= ($type_reglement === null ? 'NULL' : $type_reglement) . ',';
$requete .= $this->_bdd->echapper($type_reglement) . ',';
$requete .= $this->_bdd->echapper($informations_reglement) . ',';
$requete .= $date_debut . ',';
$requete .= $date_fin . ',';
Expand Down Expand Up @@ -274,7 +274,7 @@ function validerReglementEnLigne($cmd, $total, $autorisation, $transaction)
);

} elseif (substr(md5($reference), -3) == strtolower($verif) and !$this->estDejaReglee($cmd)) {
list($ref, $date, $type_personne, $id_personne, $reste) = explode('-', $cmd, 5);
[$ref, $date, $type_personne, $id_personne, $reste] = explode('-', $cmd, 5);
$date_debut = mktime(0, 0, 0, substr($date, 2, 2), substr($date, 0, 2), substr($date, 4, 4));

$cotisation = $this->obtenirDerniere($type_personne, $id_personne);
Expand Down Expand Up @@ -307,7 +307,7 @@ public function getAccountFromCmd($cmd)
}

// Personne physique : $cmd=C2023-211120232237-0-5-PAUL-431
list($ref, $date, $memberType, $memberId, $stuff) = $arr;
[$ref, $date, $memberType, $memberId, $stuff] = $arr;

return ['type' => $memberType, 'id' => $memberId];
}
Expand Down Expand Up @@ -420,9 +420,9 @@ function genererFacture($id_cotisation, $chemin = null)
$pdf->Cell(25, 5, 'Prix TTC', 1, 0, 'R', 1);

if ($cotisation['type_personne'] == AFUP_PERSONNES_MORALES) {
list($totalHt, $total) = $this->buildDetailsPersonneMorale($pdf, $cotisation['montant'], $cotisation['date_fin']);
[$totalHt, $total] = $this->buildDetailsPersonneMorale($pdf, $cotisation['montant'], $cotisation['date_fin']);
} else {
list($totalHt, $total) = $this->buildDetailsPersonnePhysique($pdf, $cotisation['montant'], $cotisation['date_fin']);
[$totalHt, $total] = $this->buildDetailsPersonnePhysique($pdf, $cotisation['montant'], $cotisation['date_fin']);
}

$pdf->Ln();
Expand Down
2 changes: 1 addition & 1 deletion sources/Afup/AuthentificationWiki.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class AuthentificationWiki implements AuthentificationInterface
*/
public function seConnecter($event)
{
$wikiUser = array();
$wikiUser = [];
$wikiUser["show_comments"] = "Y";
$wikiUser["name"] = ucfirst(strtolower($event["prenom"])) . ucfirst(strtolower($event["nom"]));
$wikiUser["email"] = $event["email"];
Expand Down
4 changes: 2 additions & 2 deletions sources/Afup/Bootstrap/Cli.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

$startMicrotime = microtime(true);

require_once dirname(__FILE__) . '/_Common.php';
require_once dirname (__FILE__) . '/../../../vendor/autoload.php';
require_once __DIR__ . '/_Common.php';
require_once __DIR__ . '/../../../vendor/autoload.php';

Logs::initialiser($bdd, 0);
10 changes: 5 additions & 5 deletions sources/Afup/Bootstrap/Http.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

use Afup\Site\Corporate\Site;

require_once dirname(__FILE__) . '/_Common.php';
require_once __DIR__ . '/_Common.php';

// initialisation de la session / requête
if (ob_get_level() === 0) {
Expand All @@ -38,7 +38,7 @@
ini_set('error_reporting', E_ALL);
ini_set('display_errors', 1);
}
ini_set('include_path', ini_get('include_path') . PATH_SEPARATOR . dirname(__FILE__).'/../../../dependencies/PEAR/');
ini_set('include_path', ini_get('include_path') . PATH_SEPARATOR . __DIR__.'/../../../dependencies/PEAR/');

header('Content-type: text/html; charset=UTF-8');

Expand All @@ -58,10 +58,10 @@
// initialisation de Smarty, le moteur de template (html)

$smarty = new Smarty;
$smarty->template_dir = array(
$smarty->template_dir = [
AFUP_CHEMIN_RACINE . 'templates/' . $sous_site . '/',
AFUP_CHEMIN_RACINE . 'templates/commun/',
);
];
$smarty->compile_dir = AFUP_CHEMIN_RACINE . 'cache/templates';
$smarty->compile_id = $sous_site;
$smarty->use_sub_dirs = true;
Expand All @@ -73,4 +73,4 @@
$smarty->assign('chemin_javascript', $serveur.Site::WEB_PATH.'javascript/');

$GLOBALS['AFUP_DB']->executer("SET NAMES 'utf8'");
require_once(dirname(__FILE__) . '/commonStart.php');
require_once(__DIR__ . '/commonStart.php');
2 changes: 1 addition & 1 deletion sources/Afup/Bootstrap/OtherToolPlugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@

// chargement des paramétrages génériques / multi-contextuels de l'application

require_once dirname(__FILE__) . '/_Common.php';
require_once __DIR__ . '/_Common.php';
2 changes: 1 addition & 1 deletion sources/Afup/Bootstrap/_Common.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
use Afup\Site\Corporate\_Site_Base_De_Donnees;
use Afup\Site\Utils\Configuration;

$root = realpath(dirname(__FILE__) . '/../../..');
$root = realpath(__DIR__ . '/../../..');

require_once $root . '/vendor/autoload.php';
// définitions des constantes
Expand Down
20 changes: 9 additions & 11 deletions sources/Afup/Bootstrap/commonStart.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php

// Inclusion de l'autoload de composer
require_once dirname(__FILE__) . '/../../../vendor/autoload.php';
require_once __DIR__ . '/../../../vendor/autoload.php';

// Configuration du composant de traduction
$lang = 'fr';
Expand All @@ -11,9 +11,9 @@
}
$translator = new \Symfony\Component\Translation\Translator($lang);
$translator->addLoader('xliff', new \Symfony\Component\Translation\Loader\XliffFileLoader());
$translator->addResource('xliff', dirname(__FILE__) . '/../../../translations/inscription.en.xlf', 'en');
$translator->addResource('xliff', dirname(__FILE__) . '/../../../translations/cfp.en.xlf', 'en');
$translator->setFallbackLocales(array('fr'));
$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']);
}
Expand Down Expand Up @@ -111,7 +111,7 @@
define('AFUP_TRANSPORT_MODE_AVION_BUSINESS', 100);
define('AFUP_TRANSPORT_MODE_COMMUN', 110);

$AFUP_Tarifs_Forum = array(
$AFUP_Tarifs_Forum = [
AFUP_FORUM_INVITATION => 0,
AFUP_FORUM_ORGANISATION => 0,
AFUP_FORUM_SPONSOR => 0,
Expand All @@ -138,11 +138,11 @@
AFUP_FORUM_2_JOURNEES_SPONSOR => 200,
AFUP_FORUM_SPECIAL_PRICE => 0,

);
];

$GLOBALS['AFUP_Tarifs_Forum'] = $AFUP_Tarifs_Forum;

$AFUP_Tarifs_Forum_Lib = array(
$AFUP_Tarifs_Forum_Lib = [
AFUP_FORUM_INVITATION => 'Invitation',
AFUP_FORUM_ORGANISATION => 'Organisation',
AFUP_FORUM_PROJET => 'Projet PHP',
Expand All @@ -168,7 +168,7 @@
AFUP_FORUM_PREMIERE_JOURNEE_ETUDIANT_PREVENTE => '',
AFUP_FORUM_DEUXIEME_JOURNEE_ETUDIANT_PREVENTE => '',
AFUP_FORUM_SPECIAL_PRICE => 'Tarif Spécial',
);
];

$GLOBALS['AFUP_Tarifs_Forum_Lib'] = $AFUP_Tarifs_Forum_Lib;

Expand All @@ -195,6 +195,4 @@
['default' => ['database' => $GLOBALS['AFUP_CONF']->obtenir('database_name')]]
)
;
$services->set('security.csrf.token_manager', function(){
return new Symfony\Component\Security\Csrf\CsrfTokenManager();
});
$services->set('security.csrf.token_manager', fn() => new Symfony\Component\Security\Csrf\CsrfTokenManager());
12 changes: 6 additions & 6 deletions sources/Afup/Comptabilite/Comptabilite.php
Original file line number Diff line number Diff line change
Expand Up @@ -100,12 +100,12 @@ function obtenirSousTotalJournalBanque($compte = 1, $periode_debut, $periode_fin
$dif_old = 0;
for ($i = 1; $i <= 12; $i++) {
$dif = $dif_old + $credit[$i] - $debit[$i];
$tableau[$i] = array("mois" => $i,
$tableau[$i] = ["mois" => $i,
"debit" => $debit[$i],
"credit" => $credit[$i],
"dif" => $dif,
"nligne" => $nligne[$i]
);
];
$dif_old = $dif;
}

Expand All @@ -131,11 +131,11 @@ function obtenirTotalJournalBanque($compte = 1, $periode_debut, $periode_fin)
//for ($i=1;$i<=12;$i++)
//{
// $dif=$dif_old+$credit[$i]-$debit[$i];
$tableau = array(
$tableau = [
"debit" => $debit,
"credit" => $credit,
"dif" => $credit - $debit
);
];
// $dif_old=$dif;
//}

Expand Down Expand Up @@ -862,11 +862,11 @@ function obtenirSousTotalBalance($evenement, $periode_debut, $periode_fin)

for ($i = 1; $i <= 30; $i++) {
if ($debit[$i] || $credit[$i]) {
$tableau[$i] = array("idevenement" => $i,
$tableau[$i] = ["idevenement" => $i,
"debit" => $debit[$i],
"credit" => $credit[$i],
"nligne" => $nligne[$i]
);
];
}
}

Expand Down
2 changes: 1 addition & 1 deletion sources/Afup/Comptabilite/PDF.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ function tableau($position, $header, $data)
$this->SetFont('Times', 'B', 10);
//En-tête
// $w=array(40,35,45,40);
$w = array(30, 85, 20);
$w = [30, 85, 20];

// Categorie","Description","Montant
$this->SETXY($position, $y);
Expand Down
12 changes: 4 additions & 8 deletions sources/Afup/Corporate/Article.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,7 @@ public static function getThemeLabel($code)
{
$themes = self::getThemesLabels();

if (isset($themes[$code])) {
return $themes[$code];
}

return '';
return $themes[$code] ?? '';
}

/**
Expand Down Expand Up @@ -149,7 +145,7 @@ function date()

function positionable()
{
$positions = array();
$positions = [];
for ($i = 9; $i >= -9; $i--) {
$positions[$i] = $i;
}
Expand All @@ -159,7 +155,7 @@ function positionable()

function exportable()
{
return array(
return [
'id' => $this->id,
'id_site_rubrique' => $this->id_site_rubrique,
'id_personne_physique' => $this->id_personne_physique,
Expand All @@ -173,7 +169,7 @@ function exportable()
'theme' => $this->theme,
'id_forum' => $this->id_forum,
'etat' => $this->etat,
);
];
}

function supprimer()
Expand Down
6 changes: 3 additions & 3 deletions sources/Afup/Corporate/Articles.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ function chargerArticlesDeRubrique($id_site_rubrique, $rowcount = null)
}
$elements = $this->bdd->obtenirTous($requete);

$articles = array();
$articles = [];
if (is_array($elements)) {
foreach ($elements as $element) {
$article = new Article(null, $this->bdd);
Expand Down Expand Up @@ -88,7 +88,7 @@ function chargerDerniersAjouts($rowcount = 10)
$requete .= ' ORDER BY date DESC';
$requete .= ' LIMIT 0, ' . (int)$rowcount;

$ajouts = array();
$ajouts = [];
$elements = $this->bdd->obtenirTous($requete);

if (false === $elements) {
Expand All @@ -114,7 +114,7 @@ function chargerDernieresQuestions()
$requete .= ' ORDER BY date DESC';
$requete .= ' LIMIT 0, 10';

$questions = array();
$questions = [];
$elements = $this->bdd->obtenirTous($requete);
foreach ($elements as $element) {
$article = new Article(null, $this->bdd);
Expand Down
6 changes: 3 additions & 3 deletions sources/Afup/Corporate/Feuille.php
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ function remplir($f)

function exportable()
{
return array(
return [
'id' => $this->id,
'id_parent' => $this->id_parent,
'nom' => $this->nom,
Expand All @@ -110,7 +110,7 @@ function exportable()
'date' => date('Y-m-d', $this->date),
'etat' => $this->etat,
'patterns' => $this->patterns,
);
];
}

function charger()
Expand All @@ -130,7 +130,7 @@ function supprimer()

function positionable()
{
$positions = array();
$positions = [];
for ($i = 9; $i >= -9; $i--) {
$positions[$i] = $i;
}
Expand Down
10 changes: 5 additions & 5 deletions sources/Afup/Corporate/Page.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,15 @@ function definirRoute($route)
$this->route = $route;
switch (true) {
case preg_match("%\s*/[0-9]*/\s*%", $this->route):
list(, $id,) = explode("/", $this->route);
[, $id, ] = explode("/", $this->route);
$article = new Article($id, $this->bdd);
$article->charger();
$this->title = $article->titre;
$this->content = $article->afficher();
break;

case preg_match("%s*/[0-9]*%", $this->route):
list(, $id) = explode("/", $this->route);
[, $id] = explode("/", $this->route);
$rubrique = new Rubrique($id, $this->bdd);
$rubrique->charger();
$this->title = $rubrique->nom;
Expand Down Expand Up @@ -117,15 +117,15 @@ function header($url = null, UserInterface $user = null)
}
}

if (false !== strpos($url, $feuille['lien'])) {
if (false !== strpos($url, (string) $feuille['lien'])) {
$isCurrent = true;
}

if (false === $isCurrent) {
$enfants = $branche->feuillesEnfants($feuille['id']);
foreach ($enfants as $feuilleEnfant) {
foreach ($branche->feuillesEnfants($feuilleEnfant['id']) as $feuillesEnfant2) {
if (false !== strpos($url, $feuillesEnfant2['lien'])) {
if (false !== strpos($url, (string) $feuillesEnfant2['lien'])) {
$isCurrent = true;
}
}
Expand Down Expand Up @@ -189,7 +189,7 @@ function getRightColumn() {
return $branche;

$content = '<aside id="sidebar-article" class="mod item left w33 m50 t100">';
$content .= '<h2>L\'afup<br>organise...</h2>' . $branche->naviguer(1, 2, "externe", "");
$content .= '<h2>L\'afup<br>organise...</h2>' . $branche->naviguer(1, 2, "externe");
//twitter widget
$content .= '<h2>Sur Twitter...</h2><a class="twitter-timeline" href="https://twitter.com/afup" data-widget-id="582135958075752448">Tweets by @afup</a>';
$content .= '<script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?"http":"https";if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=p+"://platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script>';
Expand Down
Loading

0 comments on commit a534693

Please sign in to comment.