diff --git a/base/blocks.php b/base/blocks.php index f9b8a8f519e2945809f8e92dd5e3b97e1be28c4c..864ca34a108067a9ff2353edbfeeaf6453d88375 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 03e0eb05497c637df06404e5dfdc471d860d5bef..5821c0b7e4789b5d940233328cbeff83ca01eb4a 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 4b80a8870de5c52659670d408d311f7cde660485..caa25370593850a44ae0fdc8e2e3b446089f2697 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;