[SPIP] ~v3.0.20-->v3.0.25
[lhc/web/clavette_www.git] / www / plugins-dist / forum / base / forum.php
1 <?php
2
3 /***************************************************************************\
4 * SPIP, Systeme de publication pour l'internet *
5 * *
6 * Copyright (c) 2001-2016 *
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 if (!defined('_ECRIRE_INC_VERSION')) return;
14
15 /**
16 * Interfaces de la table forum pour le compilateur
17 *
18 * @param array $interfaces
19 * @return array $interfaces
20 */
21 function forum_declarer_tables_interfaces($interfaces){
22
23 $interfaces['table_des_tables']['forums']='forum';
24
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';
28
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_secteur'] = array('spip_articles','id_secteur');
31 $interfaces['exceptions_des_jointures']['spip_forum']['id_mot'] = array('spip_mots','id_mot');
32 $interfaces['exceptions_des_jointures']['spip_forum']['titre_mot'] = array('spip_mots','titre');
33 $interfaces['exceptions_des_jointures']['spip_forum']['type_mot'] = array('spip_mots','type');
34 $interfaces['exceptions_des_jointures']['spip_forum']['id_groupe'] = array('spip_mots','id_groupe');
35
36
37 #$interfaces['table_titre']['forums']= "titre, '' AS lang";
38 #$interfaces['table_date']['forums']='date_heure';
39
40 $interfaces['table_statut']['spip_forum'][] = array('champ'=>'statut','publie'=>'publie','previsu'=>'publie,prop','exception'=>'statut');
41
42 $interfaces['table_des_traitements']['PARAMETRES_FORUM'][]= 'spip_htmlspecialchars(%s)';
43 $interfaces['table_des_traitements']['TEXTE']['forums']= "liens_nofollow(safehtml(".str_replace("%s","interdit_html(%s)",_TRAITEMENT_RACCOURCIS)."))";
44 $interfaces['table_des_traitements']['TITRE']['forums']= "liens_nofollow(safehtml(".str_replace("%s","interdit_html(%s)",_TRAITEMENT_TYPO)."))";
45 $interfaces['table_des_traitements']['NOTES']['forums']= "liens_nofollow(safehtml(".str_replace("%s","interdit_html(%s)",_TRAITEMENT_RACCOURCIS)."))";
46 $interfaces['table_des_traitements']['NOM_SITE']['forums']= "liens_nofollow(safehtml(".str_replace("%s","interdit_html(%s)",_TRAITEMENT_TYPO)."))";
47 $interfaces['table_des_traitements']['URL_SITE']['forums']= 'safehtml(vider_url(%s))';
48 $interfaces['table_des_traitements']['AUTEUR']['forums']= 'liens_nofollow(safehtml(vider_url(%s)))';
49 $interfaces['table_des_traitements']['EMAIL_AUTEUR']['forums']= 'safehtml(vider_url(%s))';
50
51 return $interfaces;
52 }
53
54 /**
55 * Déclaration de la table spip_forum et de l'objet forum
56 *
57 * @param array $tables Tableau des objets déclarés
58 * @return array $tables Tableau des objets complété
59 */
60 function forum_declarer_tables_objets_sql($tables){
61 $tables['spip_forum'] = array(
62 'table_objet'=>'forums', # ??? hum hum redevient spip_forum par table_objet_sql mais casse par un bete "spip_".table_objet()
63 'type'=>'forum',
64 'url_voir'=>'controler_forum',
65 'url_edit'=>'controler_forum',
66 'editable'=>'non',
67 'principale' => 'oui',
68 'page'=>'', // pas de page editoriale pour un forum
69
70 'texte_retour' => 'icone_retour',
71 'texte_objets' => 'forum:forum',
72 'texte_objet' => 'forum:forum',
73 'info_aucun_objet'=> 'forum:aucun_message_forum',
74 'info_1_objet' => 'forum:info_1_message_forum',
75 'info_nb_objets' => 'forum:info_nb_messages_forum',
76 'titre' => "titre, '' AS lang",
77 'date' => 'date_heure',
78
79 'champs_editables' => array('titre', 'texte', 'nom_site', 'url_site'),
80
81 'field'=> array(
82 "id_forum" => "bigint(21) NOT NULL",
83 "id_objet" => "bigint(21) DEFAULT '0' NOT NULL",
84 "objet" => "VARCHAR (25) DEFAULT '' NOT NULL",
85 "id_parent" => "bigint(21) DEFAULT '0' NOT NULL",
86 "id_thread" => "bigint(21) DEFAULT '0' NOT NULL",
87 "date_heure" => "datetime DEFAULT '0000-00-00 00:00:00' NOT NULL",
88 "date_thread" => "datetime DEFAULT '0000-00-00 00:00:00' NOT NULL",
89 "titre" => "text DEFAULT '' NOT NULL",
90 "texte" => "mediumtext DEFAULT '' NOT NULL",
91 "auteur" => "text DEFAULT '' NOT NULL",
92 "email_auteur" => "text DEFAULT '' NOT NULL",
93 "nom_site" => "text DEFAULT '' NOT NULL",
94 "url_site" => "text DEFAULT '' NOT NULL",
95 "statut" => "varchar(8) DEFAULT '0' NOT NULL",
96 "ip" => "varchar(40) DEFAULT '' NOT NULL",
97 "maj" => "TIMESTAMP",
98 "id_auteur" => "bigint DEFAULT '0' NOT NULL"
99 ),
100 'key' => array(
101 "PRIMARY KEY" => "id_forum",
102 "KEY id_auteur" => "id_auteur",
103 "KEY id_parent" => "id_parent",
104 "KEY id_thread" => "id_thread",
105 "KEY optimal" => "statut,id_parent,id_objet,objet,date_heure"
106 ),
107 'join' => array(
108 "id_forum"=>"id_forum",
109 "id_parent"=>"id_parent",
110 "id_objet"=>"id_objet",
111 "objet"=>"objet",
112 "id_auteur"=>"id_auteur",
113 ),
114 'rechercher_champs' => array(
115 'titre' => 3, 'texte' => 1, 'auteur' => 2, 'email_auteur' => 2, 'nom_site' => 1, 'url_site' => 1
116 ),
117 );
118
119 // jointures sur les forum pour tous les objets
120 $tables[]['tables_jointures'][]= 'forums';
121
122 return $tables;
123 }
124
125 ?>