1 | <?php |
---|
2 | |
---|
3 | /***************************************************************************\ |
---|
4 | * SPIP, Systeme de publication pour l'internet * |
---|
5 | * * |
---|
6 | * Copyright (c) 2001-2014 * |
---|
7 | * Arnaud Martin, Antoine Pitrou, Philippe Riviere, Emmanuel Saint-James * |
---|
8 | * * |
---|
9 | * Ce programme est un logiciel libre distribue sous licence GNU/GPL. * |
---|
10 | * Pour plus de details voir le fichier COPYING.txt ou l'aide en ligne. * |
---|
11 | \***************************************************************************/ |
---|
12 | |
---|
13 | /** |
---|
14 | * Déclarations des tables et objets au compilateur |
---|
15 | * |
---|
16 | * @package SPIP\Core\Pipelines |
---|
17 | **/ |
---|
18 | |
---|
19 | if (!defined('_ECRIRE_INC_VERSION')) { |
---|
20 | return; |
---|
21 | } |
---|
22 | |
---|
23 | /** |
---|
24 | * Interfaces de la table forum pour le compilateur |
---|
25 | * |
---|
26 | * @pipeline declarer_tables_interfaces |
---|
27 | * @param array $interfaces |
---|
28 | * @return array $interfaces |
---|
29 | */ |
---|
30 | function forum_declarer_tables_interfaces($interfaces) { |
---|
31 | |
---|
32 | $interfaces['table_des_tables']['forums'] = 'forum'; |
---|
33 | |
---|
34 | $interfaces['exceptions_des_tables']['forums']['date'] = 'date_heure'; |
---|
35 | $interfaces['exceptions_des_tables']['forums']['nom'] = 'auteur'; |
---|
36 | $interfaces['exceptions_des_tables']['forums']['email'] = 'email_auteur'; |
---|
37 | |
---|
38 | // il ne faut pas essayer de chercher le forum du mot cle, mais bien le mot cle associe au forum |
---|
39 | $interfaces['exceptions_des_jointures']['spip_forum']['id_secteur'] = array('spip_articles', 'id_secteur'); |
---|
40 | $interfaces['exceptions_des_jointures']['spip_forum']['id_mot'] = array('spip_mots', 'id_mot'); |
---|
41 | $interfaces['exceptions_des_jointures']['spip_forum']['titre_mot'] = array('spip_mots', 'titre'); |
---|
42 | $interfaces['exceptions_des_jointures']['spip_forum']['type_mot'] = array('spip_mots', 'type'); |
---|
43 | $interfaces['exceptions_des_jointures']['spip_forum']['id_groupe'] = array('spip_mots', 'id_groupe'); |
---|
44 | |
---|
45 | |
---|
46 | #$interfaces['table_titre']['forums']= "titre, '' AS lang"; |
---|
47 | #$interfaces['table_date']['forums']='date_heure'; |
---|
48 | |
---|
49 | $interfaces['table_statut']['spip_forum'][] = array( |
---|
50 | 'champ' => 'statut', |
---|
51 | 'publie' => 'publie', |
---|
52 | 'previsu' => 'publie,prop', |
---|
53 | 'exception' => 'statut' |
---|
54 | ); |
---|
55 | |
---|
56 | $interfaces['table_des_traitements']['PARAMETRES_FORUM'][] = 'spip_htmlspecialchars(%s)'; |
---|
57 | $interfaces['table_des_traitements']['TEXTE']['forums'] = "liens_nofollow(safehtml(" . str_replace("%s", |
---|
58 | "interdit_html(%s)", _TRAITEMENT_RACCOURCIS) . "))"; |
---|
59 | $interfaces['table_des_traitements']['TITRE']['forums'] = "liens_nofollow(safehtml(" . str_replace("%s", |
---|
60 | "interdit_html(%s)", _TRAITEMENT_TYPO) . "))"; |
---|
61 | $interfaces['table_des_traitements']['NOTES']['forums'] = "liens_nofollow(safehtml(" . str_replace("%s", |
---|
62 | "interdit_html(%s)", _TRAITEMENT_RACCOURCIS) . "))"; |
---|
63 | $interfaces['table_des_traitements']['NOM_SITE']['forums'] = "liens_nofollow(safehtml(" . str_replace("%s", |
---|
64 | "interdit_html(%s)", _TRAITEMENT_TYPO) . "))"; |
---|
65 | $interfaces['table_des_traitements']['URL_SITE']['forums'] = 'safehtml(vider_url(%s))'; |
---|
66 | $interfaces['table_des_traitements']['AUTEUR']['forums'] = 'liens_nofollow(safehtml(vider_url(%s)))'; |
---|
67 | $interfaces['table_des_traitements']['EMAIL_AUTEUR']['forums'] = 'safehtml(vider_url(%s))'; |
---|
68 | |
---|
69 | return $interfaces; |
---|
70 | } |
---|
71 | |
---|
72 | /** |
---|
73 | * Déclaration de la table spip_forum et de l'objet forum |
---|
74 | * |
---|
75 | * @pipeline declarer_tables_objets_sql |
---|
76 | * @param array $tables Tableau des objets déclarés |
---|
77 | * @return array $tables Tableau des objets complété |
---|
78 | */ |
---|
79 | function forum_declarer_tables_objets_sql($tables) { |
---|
80 | $tables['spip_forum'] = array( |
---|
81 | 'table_objet' => 'forums', |
---|
82 | # ??? hum hum redevient spip_forum par table_objet_sql mais casse par un bete "spip_".table_objet() |
---|
83 | 'type' => 'forum', |
---|
84 | 'url_voir' => 'controler_forum', |
---|
85 | 'url_edit' => 'controler_forum', |
---|
86 | 'editable' => 'non', |
---|
87 | 'principale' => 'oui', |
---|
88 | 'page' => '', |
---|
89 | // pas de page editoriale pour un forum |
---|
90 | |
---|
91 | 'texte_retour' => 'icone_retour', |
---|
92 | 'texte_objets' => 'forum:forum', |
---|
93 | 'texte_objet' => 'forum:forum', |
---|
94 | 'info_aucun_objet' => 'forum:aucun_message_forum', |
---|
95 | 'info_1_objet' => 'forum:info_1_message_forum', |
---|
96 | 'info_nb_objets' => 'forum:info_nb_messages_forum', |
---|
97 | 'titre' => "titre, '' AS lang", |
---|
98 | 'date' => 'date_heure', |
---|
99 | |
---|
100 | 'champs_editables' => array('titre', 'texte', 'nom_site', 'url_site'), |
---|
101 | |
---|
102 | 'field' => array( |
---|
103 | "id_forum" => "bigint(21) NOT NULL", |
---|
104 | "id_objet" => "bigint(21) DEFAULT '0' NOT NULL", |
---|
105 | "objet" => "VARCHAR (25) DEFAULT '' NOT NULL", |
---|
106 | "id_parent" => "bigint(21) DEFAULT '0' NOT NULL", |
---|
107 | "id_thread" => "bigint(21) DEFAULT '0' NOT NULL", |
---|
108 | "date_heure" => "datetime DEFAULT '0000-00-00 00:00:00' NOT NULL", |
---|
109 | "date_thread" => "datetime DEFAULT '0000-00-00 00:00:00' NOT NULL", |
---|
110 | "titre" => "text DEFAULT '' NOT NULL", |
---|
111 | "texte" => "mediumtext DEFAULT '' NOT NULL", |
---|
112 | "auteur" => "text DEFAULT '' NOT NULL", |
---|
113 | "email_auteur" => "text DEFAULT '' NOT NULL", |
---|
114 | "nom_site" => "text DEFAULT '' NOT NULL", |
---|
115 | "url_site" => "text DEFAULT '' NOT NULL", |
---|
116 | "statut" => "varchar(8) DEFAULT '0' NOT NULL", |
---|
117 | "ip" => "varchar(40) DEFAULT '' NOT NULL", |
---|
118 | "maj" => "TIMESTAMP", |
---|
119 | "id_auteur" => "bigint DEFAULT '0' NOT NULL" |
---|
120 | ), |
---|
121 | 'key' => array( |
---|
122 | "PRIMARY KEY" => "id_forum", |
---|
123 | "KEY id_auteur" => "id_auteur", |
---|
124 | "KEY id_parent" => "id_parent", |
---|
125 | "KEY id_thread" => "id_thread", |
---|
126 | "KEY optimal" => "statut,id_parent,id_objet,objet,date_heure" |
---|
127 | ), |
---|
128 | 'join' => array( |
---|
129 | "id_forum" => "id_forum", |
---|
130 | "id_parent" => "id_parent", |
---|
131 | "id_objet" => "id_objet", |
---|
132 | "objet" => "objet", |
---|
133 | "id_auteur" => "id_auteur", |
---|
134 | ), |
---|
135 | 'rechercher_champs' => array( |
---|
136 | 'titre' => 3, |
---|
137 | 'texte' => 1, |
---|
138 | 'auteur' => 2, |
---|
139 | 'email_auteur' => 2, |
---|
140 | 'nom_site' => 1, |
---|
141 | 'url_site' => 1 |
---|
142 | ), |
---|
143 | ); |
---|
144 | |
---|
145 | // jointures sur les forum pour tous les objets |
---|
146 | $tables[]['tables_jointures'][] = 'forums'; |
---|
147 | |
---|
148 | return $tables; |
---|
149 | } |
---|
150 | |
---|
151 | ?> |
---|