From 1057d3f8c3da5ab9a11d126ea986adebb9217251 Mon Sep 17 00:00:00 2001 From: nicod_ <nicod@lerebooteux.fr> Date: Thu, 25 May 2023 14:59:33 +0200 Subject: [PATCH] Formatage --- base/blocks.php | 9 +++++---- blocks_administrations.php | 4 ++-- formulaires/editer_block.php | 8 ++++---- 3 files changed, 11 insertions(+), 10 deletions(-) diff --git a/base/blocks.php b/base/blocks.php index f9b8a8f..864ca34 100644 --- a/base/blocks.php +++ b/base/blocks.php @@ -84,9 +84,9 @@ function blocks_declarer_tables_objets_sql($tables) { ]; $tables['spip_blocktypes'] = [ - 'type' => 'blocktype', - 'principale' => 'oui', - 'field' => [ + 'type' => 'blocktype', + 'principale' => 'oui', + 'field' => [ 'id_blocktype' => 'bigint(21) NOT NULL', 'titre' => 'text NOT NULL DEFAULT ""', 'description' => 'text NOT NULL DEFAULT ""', @@ -95,7 +95,7 @@ function blocks_declarer_tables_objets_sql($tables) { 'objets' => 'text NOT NULL DEFAULT ""', 'maj' => 'timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP', ], - 'key' => [ + 'key' => [ 'PRIMARY KEY' => 'id_blocktype', 'UNIQUE KEY identifiant' => 'identifiant', ], @@ -144,6 +144,7 @@ function blocks_declarer_tables_auxiliaires($tables) { ], 'key' => [ 'PRIMARY KEY' => 'id_block,id_objet,objet', + // clé unique : un block ne peut être associé qu'à un seul objet 'UNIQUE KEY id_block' => 'id_block', ], ]; diff --git a/blocks_administrations.php b/blocks_administrations.php index 03e0eb0..5821c0b 100644 --- a/blocks_administrations.php +++ b/blocks_administrations.php @@ -74,7 +74,7 @@ function blocks_installe_config() { // associer par défaut aux articles ecrire_config('blocks/objets', [ - 0 => 'spip_articles' + 0 => 'spip_articles', ], ); @@ -135,7 +135,7 @@ function blocks_installe_config() { ); } -function blocks_update_1_0_1(){ +function blocks_update_1_0_1() { // renommage des tables sql_alter('TABLE spip_blocs RENAME TO spip_blocks'); sql_alter('TABLE spip_blocs_liens RENAME TO spip_blocks_liens'); diff --git a/formulaires/editer_block.php b/formulaires/editer_block.php index 4b80a88..caa2537 100644 --- a/formulaires/editer_block.php +++ b/formulaires/editer_block.php @@ -244,9 +244,9 @@ function formulaires_editer_block_traiter_dist($id_block = 'new', $objet = null, } if (isset($retours['redirect'])) { - $retours['redirect'] = parametre_url($retours['redirect'],'id_blocktype',''); - $retours['redirect'] = parametre_url($retours['redirect'],'id_block',''); - $retours['redirect'] = parametre_url($retours['redirect'],'edit_bloc',''); + $retours['redirect'] = parametre_url($retours['redirect'], 'id_blocktype', ''); + $retours['redirect'] = parametre_url($retours['redirect'], 'id_block', ''); + $retours['redirect'] = parametre_url($retours['redirect'], 'edit_bloc', ''); $retours['redirect'] = ancre_url($retours['redirect'], 'block_' . $id_block); } @@ -254,7 +254,7 @@ function formulaires_editer_block_traiter_dist($id_block = 'new', $objet = null, } if (_request('annuler')) { - $retours['redirect'] = parametre_url($retour,'id_blocktype',''); + $retours['redirect'] = parametre_url($retour, 'id_blocktype', ''); } return $retours; -- GitLab