From dc476fb6b933e25cb6785b99844d5ad9eba1cf15 Mon Sep 17 00:00:00 2001 From: nicod_ <nicod@lerebooteux.fr> Date: Sun, 16 Apr 2023 20:33:19 +0200 Subject: [PATCH] =?UTF-8?q?Si=20on=20ne=20trouve=20pas=20d'infos=20dans=20?= =?UTF-8?q?la=20base,=20=C3=A9viter=20des=20erreurs=20et=20renvoyer=20simp?= =?UTF-8?q?lement=20le=20num=C3=A9ro=20du=20bloc?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- blocks_fonctions.php | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/blocks_fonctions.php b/blocks_fonctions.php index 9d59a97..2e473c9 100644 --- a/blocks_fonctions.php +++ b/blocks_fonctions.php @@ -159,14 +159,18 @@ function _block_charger_block($id_bloc) { * @return mixed|string */ function generer_TITRE_BLOC($id_bloc){ - $infos = sql_fetsel( + if($infos = sql_fetsel( 'bt.titre, bl.objet, bl.rang_lien, bl.id_objet', 'spip_blocs b join spip_blocs_types bt using(id_blocs_type) left join spip_blocs_liens bl using(id_bloc)', 'b.id_bloc = '.(int)$id_bloc - ); - $titre = $infos['titre']; - if($infos['id_objet'] && $infos['objet']) { - $titre = generer_objet_info($infos['id_objet'], $infos['objet'], 'titre') . ' - ' . $titre . ' #' . $infos['rang_lien']; + )) { + $titre = $infos['titre']; + if ($infos['id_objet'] && $infos['objet']) { + $titre = generer_objet_info($infos['id_objet'], $infos['objet'], 'titre') . ' - ' . $titre . ' #' . $infos['rang_lien']; + } + } else { + $titre = _T('bloc:titre_bloc').' '.$id_bloc; } + return $titre; } -- GitLab