diff --git a/action/dupliquer_formulaire.php b/action/dupliquer_formulaire.php index f5a7efc081dbb476330c5404c4dcb47cfc611bfe..81e30951e950e453c425c1200128f5d34f5b2055 100644 --- a/action/dupliquer_formulaire.php +++ b/action/dupliquer_formulaire.php @@ -18,6 +18,7 @@ function action_dupliquer_formulaire_dist($arg = null) { $arg = $securiser_action(); } $id_formulaire = intval($arg); + $erreur = ''; // Si le formulaire existe bien if ( diff --git a/action/editer_formulaire.php b/action/editer_formulaire.php index 21a1908aa6ca134cb299219803b892834efc1ba2..0f345a65922f0aaab056755f7a7827603eab7503 100644 --- a/action/editer_formulaire.php +++ b/action/editer_formulaire.php @@ -15,6 +15,7 @@ function action_editer_formulaire_dist($arg = null) { $securiser_action = charger_fonction('securiser_action', 'inc'); $arg = $securiser_action(); } + $err = ''; // si id_formulaire n'est pas un nombre, c'est une creation if (!$id_formulaire = intval($arg)) { diff --git a/echanger/formulaire/forms.php b/echanger/formulaire/forms.php index 9592dcdcaf3ddadd66c1c48b5573b08617ac0ba1..988009d581435b0d31ac25029f7647406ba89a13 100644 --- a/echanger/formulaire/forms.php +++ b/echanger/formulaire/forms.php @@ -11,6 +11,8 @@ function echanger_formulaire_forms_importer_dist($fichier) { include_spip('inc/xml'); $arbre = spip_xml_load($fichier, false); + $id_formulaire = 0; + if (isset($arbre['forms'])) { foreach ($arbre['forms'] as $forms) { foreach ($forms['form'] as $form) { diff --git a/echanger/formulaire/wcs.php b/echanger/formulaire/wcs.php index d2f1ab8b8d18d806bcd586970a20a17a7fd38c10..fb64881c808a8f8d86659a87bf3a2e74800bfd9f 100644 --- a/echanger/formulaire/wcs.php +++ b/echanger/formulaire/wcs.php @@ -11,6 +11,8 @@ function echanger_formulaire_wcs_importer_dist($fichier) { include_spip('inc/saisies'); include_spip('inc/formidable'); $arbre = spip_xml_load($fichier, false); + $id_formulaire = 0; + $erreur = ''; if (isset($arbre['formdef'])) { foreach ($arbre['formdef'] as $form) { diff --git a/echanger/formulaire/yaml.php b/echanger/formulaire/yaml.php index fd86d06b403293e41bc1bfa4780d0c23bc38dda8..bae945e8e6de470097e148674aa7fce294a9c0a7 100644 --- a/echanger/formulaire/yaml.php +++ b/echanger/formulaire/yaml.php @@ -42,6 +42,7 @@ function echanger_formulaire_yaml_importer_dist($fichier) { $erreur = ''; // Si on a bien recupere une chaine on tente de la decoder + $yaml = '';//Pour PHPstan if (lire_fichier($fichier, $yaml) && $yaml) { include_spip('inc/yaml'); $formulaire = yaml_decode($yaml); diff --git a/formidable_fonctions.php b/formidable_fonctions.php index 78c04f312bd58517684603ed928367ddbcc7efe9..c6b77ffbda8c4a948c8d19fde5abed115c1cf647 100644 --- a/formidable_fonctions.php +++ b/formidable_fonctions.php @@ -154,6 +154,7 @@ function calculer_voir_reponse($id_formulaires_reponse, $id_formulaire, $nom, $s function affiche_resume_reponse($id_formulaires_reponse, $id_formulaire = null, $modele_resume = null) { static $modeles_resume = []; static $saisies_form = []; + $saisies = []; include_spip('formidable_fonctions'); diff --git a/formulaires/exporter_formulaire_analyse.php b/formulaires/exporter_formulaire_analyse.php index b1e977f7c6440c47610e7e65b73c2718d9dc2bf5..16434df19dd8afb347c7941eb03b05b4e09f14bb 100644 --- a/formulaires/exporter_formulaire_analyse.php +++ b/formulaires/exporter_formulaire_analyse.php @@ -74,6 +74,7 @@ function action_exporter_analyse_reponses($id_formulaire, $delim = ',') { $valeurs[$r['nom']][] = formidable_deserialize($r['valeur']); } + $reponse_complete[] = []; foreach ($saisies as $nom => $saisie) { $valeur = sql_getfetsel( 'valeur', diff --git a/formulaires/formidable.php b/formulaires/formidable.php index 12c34d5530275af6c94e1b97c08fb65dc6068174..dbac55467f7e47f6316caf0e39b9b17756156041 100644 --- a/formulaires/formidable.php +++ b/formulaires/formidable.php @@ -67,6 +67,7 @@ function formidable_id_formulaire($id) { **/ function formulaires_formidable_saisies_dist($id, $valeurs = [], $options_appel = [], $deprecated_url_redirect = false, $deprecated_forcer_modif = false) { $saisies = []; + $formulaire = []; include_spip('formidable_fonctions'); if ( ($id_formulaire = formidable_id_formulaire($id)) @@ -113,8 +114,10 @@ function formulaires_formidable_saisies_dist($id, $valeurs = [], $options_appel **/ function formulaires_formidable_charger_dist($id, $valeurs = [], $options_appel = [], $deprecated_url_redirect = false, $deprecated_forcer_modif = false) { $contexte = []; + $formulaire = []; include_spip('formidable_fonctions'); + $options_appel = formulaires_formidable_normaliser_options_appel($options_appel, $deprecated_url_redirect, $deprecated_forcer_modif); $id_formulaires_reponse = $options_appel['id_formulaires_reponse']; @@ -316,6 +319,7 @@ function formulaires_formidable_verifier_traitements($id, $valeurs = [], $option $erreurs = []; $id_formulaires_reponse = $options_appel['id_formulaires_reponse'] ?? false; include_spip('formidable_fonctions'); + $formulaire = []; if ( ($id_formulaire = formidable_id_formulaire($id)) diff --git a/http/collectionjson/formulaires_reponses.php b/http/collectionjson/formulaires_reponses.php index 63c7d88c78f08dbe9506257d6b51a7b293079cc5..dd2a3d160b310fcada8a820d7ab3e0cf44681bcd 100644 --- a/http/collectionjson/formulaires_reponses.php +++ b/http/collectionjson/formulaires_reponses.php @@ -18,6 +18,7 @@ function http_collectionjson_formulaires_reponses_post_collection_dist($requete, include_spip('inc/session'); include_spip('inc/autoriser'); $fonction_erreur = charger_fonction('erreur', 'http/collectionjson/'); + $id_formulaire = 0; // On teste si on a bien du contenu au bon format if ( diff --git a/inc/formidable.php b/inc/formidable.php index f587af756b9ef7edf028f41a85492f8ecad6b0b9..e44c16fb5fa0362ef3dadf21007c93d101a0c43c 100644 --- a/inc/formidable.php +++ b/inc/formidable.php @@ -162,6 +162,7 @@ function formidable_verifier_reponse_formulaire($id_formulaire, $choix_identific $nom_cookie = formidable_generer_nom_cookie($id_formulaire); $cookie = isset($_COOKIE[$nom_cookie]) ? $_COOKIE[$nom_cookie] : false; $variable_php_identification = formidable_variable_php_identification($variable_php_identification, $id_formulaire); + $where = ''; // ni cookie ni id, ni variable_php, on ne peut rien faire if (!$cookie && !$id_auteur && !$variable_php_identification) { @@ -504,6 +505,8 @@ function formidable_raccourcis_arobases_2_valeurs_champs(string $chaine, array $ $id_formulaire = $options['id_formulaire'] ?? 0; $contexte = $options['contexte'] ?? ''; + $valeurs = []; + $valeurs_libellees = []; if ($source === 'request') { list($valeurs, $valeurs_libellees) = formidable_tableau_valeurs_saisies($saisies, $sans_reponse); @@ -594,12 +597,13 @@ function formidable_raccourcis_arobases_2_valeurs_champs(string $chaine, array $ * On met les résultats en statiques pour gagner un peu de temps */ function formidable_tableau_valeurs_saisies($saisies, $sans_reponse = true) { - if (isset($valeurs)) { + static $valeurs = []; + static $valeurs_libellees = []; + static $done = false; + if ($done) { return [$valeurs,$valeurs_libellees]; } // On parcourt les champs pour générer le tableau des valeurs - static $valeurs = []; - static $valeurs_libellees = []; if ($sans_reponse === true) { $sans_reponse = _T('saisies:sans_reponse'); } @@ -636,6 +640,7 @@ function formidable_tableau_valeurs_saisies($saisies, $sans_reponse = true) { )); } } + $done = true; return [$valeurs, $valeurs_libellees]; }