From 7a9fd5c33c2a4f80c9530288d42895032e802891 Mon Sep 17 00:00:00 2001 From: n Date: Sat, 14 Sep 2024 21:19:39 +0200 Subject: [PATCH 1/3] move CI to Forgejo (n/playbooks#227) --- {.gitea => .forgejo}/workflows/lint.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) rename {.gitea => .forgejo}/workflows/lint.yml (95%) diff --git a/.gitea/workflows/lint.yml b/.forgejo/workflows/lint.yml similarity index 95% rename from .gitea/workflows/lint.yml rename to .forgejo/workflows/lint.yml index acf819b..7f90f20 100644 --- a/.gitea/workflows/lint.yml +++ b/.forgejo/workflows/lint.yml @@ -1,3 +1,4 @@ +--- name: lint run-name: lint is launched by ${{ github.actor }} on: [push] @@ -7,12 +8,12 @@ jobs: name: lint steps: - run: echo "🎉 The job was automatically triggered by a ${{ github.event_name }} event." - - run: echo "🐧 This job is now running on a ${{ runner.os }} server hosted by Gitea!" + - run: echo "🐧 This job is now running on a ${{ runner.os }} server hosted by Forgejo!" - run: echo "🔎 The name of your branch is ${{ github.ref }} and your repository is ${{ github.repository }}." - name: Check out repository code uses: actions/checkout@v4 - name: Install linters using Composer - run: | + run: | export COMPOSER_HOME=/tmp echo "{}" > composer.json composer config --no-interaction allow-plugins.bamarni/composer-bin-plugin true @@ -24,4 +25,3 @@ jobs: - name: PHP CS Fixer run: vendor/bin/php-cs-fixer fix --dry-run --verbose --diff . - run: echo "🍏 This job's status is ${{ job.status }}." - -- 2.40.1 From 41732eeda962497c398f3e29247ee740593212ff Mon Sep 17 00:00:00 2001 From: n Date: Sat, 14 Sep 2024 21:20:01 +0200 Subject: [PATCH 2/3] PHP-CS-Fixer fixes --- .php-cs-fixer.php | 5 +++++ include/standard.inc.php | 26 +++++++++++++------------- index.php | 2 +- modules/goldbook.php | 2 +- modules/liens.php | 4 ++-- pages/leclub.php | 2 +- 6 files changed, 23 insertions(+), 18 deletions(-) create mode 100644 .php-cs-fixer.php diff --git a/.php-cs-fixer.php b/.php-cs-fixer.php new file mode 100644 index 0000000..77b7371 --- /dev/null +++ b/.php-cs-fixer.php @@ -0,0 +1,5 @@ +setParallelConfig(PhpCsFixer\Runner\Parallel\ParallelConfigFactory::detect()) +; diff --git a/include/standard.inc.php b/include/standard.inc.php index 5cecde0..93d18df 100644 --- a/include/standard.inc.php +++ b/include/standard.inc.php @@ -113,7 +113,7 @@ function formcaller() function splitchar($Number) { $byte = strval(dechex($Number)); - switch(strlen($byte)) { + switch (strlen($byte)) { case 1: $byte0 = $byte; $byte1 = $byte2 = $byte3 = 0; @@ -260,7 +260,7 @@ function password($folder) $fd = fopen("$folder/password.txt", "r"); $titre = fgetcsv($fd, 10000, ","); - while($fd) { + while ($fd) { $data = fgetcsv($fd, 10000, ","); $login[$i] = $data[0]; $mdp[$i] = $data[1]; @@ -361,13 +361,13 @@ function nb_visiteurs_connecte($time, $filename = "/tmp/nbweb.dat") $ii = 0; $bool = 0; - if(file_exists($filename)) { - if($fichier = fopen($filename, "r")) { - while(!feof($fichier)) { + if (file_exists($filename)) { + if ($fichier = fopen($filename, "r")) { + while (!feof($fichier)) { $ligne = fgets($fichier, 4096); $tab = explode("|", $ligne); - if($tab[1] > 0) { + if ($tab[1] > 0) { $tab_de_tab[$i][0] = $tab[0]; $tab_de_tab[$i][1] = $tab[1]; @@ -378,8 +378,8 @@ function nb_visiteurs_connecte($time, $filename = "/tmp/nbweb.dat") } } - for($j = 0;$j < $i;$j++) { - if(($date - chop($tab_de_tab[$j][1])) > $time) { + for ($j = 0;$j < $i;$j++) { + if (($date - chop($tab_de_tab[$j][1])) > $time) { //on ne fait rien } else { $tab_de_tab_actualise[$ii][0] = $tab_de_tab[$j][0]; @@ -388,20 +388,20 @@ function nb_visiteurs_connecte($time, $filename = "/tmp/nbweb.dat") } } - for($j = 0;$j < $ii;$j++) { - if($tab_de_tab_actualise[$j][0] == $ip) { + for ($j = 0;$j < $ii;$j++) { + if ($tab_de_tab_actualise[$j][0] == $ip) { $bool = 1; } } - if($bool == 0) { + if ($bool == 0) { $tab_de_tab_actualise[$ii][0] = $ip; $tab_de_tab_actualise[$ii][1] = $date; $ii++; } - if($fichier = fopen($filename, "w")) { - for($j = 0;$j < $ii;$j++) { + if ($fichier = fopen($filename, "w")) { + for ($j = 0;$j < $ii;$j++) { fputs($fichier, chop($tab_de_tab_actualise[$j][0])); fputs($fichier, "|"); fputs($fichier, chop($tab_de_tab_actualise[$j][1])); diff --git a/index.php b/index.php index adff58d..0adfacf 100644 --- a/index.php +++ b/index.php @@ -81,7 +81,7 @@ echo " $Cpt)) { echo "
"; if ($NbMaxPost) { - for($i = 0;$i <= $NbMaxPost - 1;$i++) { + for ($i = 0;$i <= $NbMaxPost - 1;$i++) { if ($VisitorName[$i] == "") { $VisitorName[$i] = "Anonyme"; } diff --git a/modules/liens.php b/modules/liens.php index 20ee234..b0c2b01 100644 --- a/modules/liens.php +++ b/modules/liens.php @@ -45,7 +45,7 @@ if ($Cpt <= 0) { "; - for($i = 0;$i <= $NbMaxPost - 1;$i++) { + for ($i = 0;$i <= $NbMaxPost - 1;$i++) { echo "\n"; } @@ -53,7 +53,7 @@ if ($Cpt <= 0) { } else { // affichage des liens echo "
"; - for($i = 0;$i <= $NbMaxPost - 1;$i++) { + for ($i = 0;$i <= $NbMaxPost - 1;$i++) { if ($level[$i] == 1) { echo ""; if ($url[$i] != "") { diff --git a/pages/leclub.php b/pages/leclub.php index 274a1a3..0a92043 100644 --- a/pages/leclub.php +++ b/pages/leclub.php @@ -1,6 +1,6 @@ Date: Sat, 14 Sep 2024 21:20:28 +0200 Subject: [PATCH 3/3] gitignore composer stuff --- .gitignore | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.gitignore b/.gitignore index ebc626f..586efff 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,5 @@ modules/goldbook/*.csv modules/timers/*.csv tmp/ +vendor/ +composer.* -- 2.40.1