Browse Source

Rector sur Petitions avec config PHP 7.4+

master
Matthieu Marcillaud 11 months ago
parent
commit
95f686ccd2
  1. 4
      action/editer_petition.php
  2. 6
      action/editer_signature.php
  3. 2
      action/traiter_lot_signature.php
  4. 5
      formulaires/signature.php
  5. 2
      petitions_fonctions.php

4
action/editer_petition.php

@ -152,7 +152,7 @@ function petition_instituer($id_petition, $c) {
#$date_ancienne = $date = $row['date_time'];
$champs = array();
$s = isset($c['statut']) ? $c['statut'] : $statut;
$s = $c['statut'] ?? $statut;
// cf autorisations dans inc/petition_instituer
if ($s != $statut /*OR ($d AND $d != $date)*/) {
@ -184,7 +184,7 @@ function petition_instituer($id_petition, $c) {
)
);
if (!count($champs)) {
if (!(is_countable($champs) ? count($champs) : 0)) {
return;
}

6
action/editer_signature.php

@ -143,8 +143,8 @@ function signature_instituer($id_signature, $c, $calcul_rub = true) {
$date_ancienne = $date = $row['date_time'];
$champs = array();
$d = isset($c['date_time']) ? $c['date_time'] : null;
$s = isset($c['statut']) ? $c['statut'] : $statut;
$d = $c['date_time'] ?? null;
$s = $c['statut'] ?? $statut;
// cf autorisations dans inc/signature_instituer
if ($s != $statut or ($d and $d != $date)) {
@ -179,7 +179,7 @@ function signature_instituer($id_signature, $c, $calcul_rub = true) {
)
);
if (!count($champs)) {
if (!(is_countable($champs) ? count($champs) : 0)) {
return;
}

2
action/traiter_lot_signature.php

@ -46,7 +46,7 @@ function action_traiter_lot_signature_dist($arg = null) {
if ($where) {
$rows = sql_allfetsel("id_signature", "spip_signatures", $where);
if (!count($rows)) {
if (!(is_countable($rows) ? count($rows) : 0)) {
return;
}
$rows = array_column($rows, 'id_signature');

5
formulaires/signature.php

@ -30,8 +30,8 @@ function formulaires_signature_charger_dist($id_article) {
$valeurs = array(
'id_petition' => $id_petition,
'id_article' => $id_article, # pour compat
'session_nom' => isset($GLOBALS['visiteur_session']['session_nom']) ? $GLOBALS['visiteur_session']['session_nom'] : (isset($GLOBALS['visiteur_session']['nom']) ? $GLOBALS['visiteur_session']['nom'] : ''),
'session_email' => isset($GLOBALS['visiteur_session']['session_email']) ? $GLOBALS['visiteur_session']['session_email'] : (isset($GLOBALS['visiteur_session']['email']) ? $GLOBALS['visiteur_session']['email'] : ''),
'session_nom' => $GLOBALS['visiteur_session']['session_nom'] ?? $GLOBALS['visiteur_session']['nom'] ?? '',
'session_email' => $GLOBALS['visiteur_session']['session_email'] ?? $GLOBALS['visiteur_session']['email'] ?? '',
'signature_nom_site' => '',
'signature_url_site' => '',
'_texte' => $r['texte'],
@ -59,6 +59,7 @@ function affiche_reponse_confirmation($confirm) {
}
function formulaires_signature_verifier_dist($id_article) {
$url_site = null;
$erreurs = array();
$oblis = array('session_nom', 'session_email');
include_spip('base/abstract_sql');

2
petitions_fonctions.php

@ -88,6 +88,6 @@ if (!function_exists('quete_petitions')) {
$cache['varia']['pet' . $id_article] = 1;
# ne pas retourner '' car le texte sert aussi de presence
return $retour ? $retour : ' ';
return $retour ?: ' ';
}
}

Loading…
Cancel
Save