3 /***************************************************************************\
4 * SPIP, Systeme de publication pour l'internet *
6 * Copyright (c) 2001-2014 *
7 * Arnaud Martin, Antoine Pitrou, Philippe Riviere, Emmanuel Saint-James *
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 \***************************************************************************/
13 if (!defined('_ECRIRE_INC_VERSION')) return;
16 * Interfaces de la table forum pour le compilateur
18 * @param array $interfaces
19 * @return array $interfaces
21 function forum_declarer_tables_interfaces($interfaces){
23 $interfaces['table_des_tables']['forums']='forum';
25 $interfaces['exceptions_des_tables']['forums']['date']='date_heure';
26 $interfaces['exceptions_des_tables']['forums']['nom']='auteur';
27 $interfaces['exceptions_des_tables']['forums']['email']='email_auteur';
29 // il ne faut pas essayer de chercher le forum du mot cle, mais bien le mot cle associe au forum
30 $interfaces['exceptions_des_jointures']['spip_forum']['id_mot'] = array('spip_mots','id_mot');
31 $interfaces['exceptions_des_jointures']['spip_forum']['titre_mot'] = array('spip_mots','titre');
32 $interfaces['exceptions_des_jointures']['spip_forum']['type_mot'] = array('spip_mots','type');
33 $interfaces['exceptions_des_jointures']['spip_forum']['id_groupe'] = array('spip_mots','id_groupe');
36 #$interfaces['table_titre']['forums']= "titre, '' AS lang";
37 #$interfaces['table_date']['forums']='date_heure';
39 $interfaces['table_statut']['spip_forum'][] = array('champ'=>'statut','publie'=>'publie','previsu'=>'publie,prop','exception'=>'statut');
41 $interfaces['table_des_traitements']['PARAMETRES_FORUM'][]= 'spip_htmlspecialchars(%s)';
42 $interfaces['table_des_traitements']['TEXTE']['forums']= "liens_nofollow(safehtml(".str_replace("%s","interdit_html(%s)",_TRAITEMENT_RACCOURCIS
)."))";
43 $interfaces['table_des_traitements']['TITRE']['forums']= "liens_nofollow(safehtml(".str_replace("%s","interdit_html(%s)",_TRAITEMENT_TYPO
)."))";
44 $interfaces['table_des_traitements']['NOTES']['forums']= "liens_nofollow(safehtml(".str_replace("%s","interdit_html(%s)",_TRAITEMENT_RACCOURCIS
)."))";
45 $interfaces['table_des_traitements']['NOM_SITE']['forums']= "liens_nofollow(safehtml(".str_replace("%s","interdit_html(%s)",_TRAITEMENT_TYPO
)."))";
46 $interfaces['table_des_traitements']['URL_SITE']['forums']= 'safehtml(vider_url(%s))';
47 $interfaces['table_des_traitements']['AUTEUR']['forums']= 'liens_nofollow(safehtml(vider_url(%s)))';
48 $interfaces['table_des_traitements']['EMAIL_AUTEUR']['forums']= 'safehtml(vider_url(%s))';
54 * Déclaration de la table spip_forum et de l'objet forum
56 * @param array $tables Tableau des objets déclarés
57 * @return array $tables Tableau des objets complété
59 function forum_declarer_tables_objets_sql($tables){
60 $tables['spip_forum'] = array(
61 'table_objet'=>'forums', # ??? hum hum redevient spip_forum par table_objet_sql mais casse par un bete "spip_".table_objet()
63 'url_voir'=>'controler_forum',
64 'url_edit'=>'controler_forum',
66 'principale' => 'oui',
67 'page'=>'', // pas de page editoriale pour un forum
69 'texte_retour' => 'icone_retour',
70 'texte_objets' => 'forum:forum',
71 'texte_objet' => 'forum:forum',
72 'info_aucun_objet'=> 'forum:aucun_message_forum',
73 'info_1_objet' => 'forum:info_1_message_forum',
74 'info_nb_objets' => 'forum:info_nb_messages_forum',
75 'titre' => "titre, '' AS lang",
76 'date' => 'date_heure',
78 'champs_editables' => array('titre', 'texte', 'nom_site', 'url_site'),
81 "id_forum" => "bigint(21) NOT NULL",
82 "id_objet" => "bigint(21) DEFAULT '0' NOT NULL",
83 "objet" => "VARCHAR (25) DEFAULT '' NOT NULL",
84 "id_parent" => "bigint(21) DEFAULT '0' NOT NULL",
85 "id_thread" => "bigint(21) DEFAULT '0' NOT NULL",
86 "date_heure" => "datetime DEFAULT '0000-00-00 00:00:00' NOT NULL",
87 "date_thread" => "datetime DEFAULT '0000-00-00 00:00:00' NOT NULL",
88 "titre" => "text DEFAULT '' NOT NULL",
89 "texte" => "mediumtext DEFAULT '' NOT NULL",
90 "auteur" => "text DEFAULT '' NOT NULL",
91 "email_auteur" => "text DEFAULT '' NOT NULL",
92 "nom_site" => "text DEFAULT '' NOT NULL",
93 "url_site" => "text DEFAULT '' NOT NULL",
94 "statut" => "varchar(8) DEFAULT '0' NOT NULL",
95 "ip" => "varchar(40) DEFAULT '' NOT NULL",
97 "id_auteur" => "bigint DEFAULT '0' NOT NULL"
100 "PRIMARY KEY" => "id_forum",
101 "KEY id_auteur" => "id_auteur",
102 "KEY id_parent" => "id_parent",
103 "KEY id_thread" => "id_thread",
104 "KEY optimal" => "statut,id_parent,id_objet,objet,date_heure"
107 "id_forum"=>"id_forum",
108 "id_parent"=>"id_parent",
109 "id_objet"=>"id_objet",
111 "id_auteur"=>"id_auteur",
113 'rechercher_champs' => array(
114 'titre' => 3, 'texte' => 1, 'auteur' => 2, 'email_auteur' => 2, 'nom_site' => 1, 'url_site' => 1
118 // jointures sur les forum pour tous les objets
119 $tables[]['tables_jointures'][]= 'forums';