[SPIP] ~maj 3.0.10 --> 3.0.14
[lhc/web/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-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 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_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');
34
35
36 #$interfaces['table_titre']['forums']= "titre, '' AS lang";
37 #$interfaces['table_date']['forums']='date_heure';
38
39 $interfaces['table_statut']['spip_forum'][] = array('champ'=>'statut','publie'=>'publie','previsu'=>'publie,prop','exception'=>'statut');
40
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))';
49
50 return $interfaces;
51 }
52
53 /**
54 * Déclaration de la table spip_forum et de l'objet forum
55 *
56 * @param array $tables Tableau des objets déclarés
57 * @return array $tables Tableau des objets complété
58 */
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()
62 'type'=>'forum',
63 'url_voir'=>'controler_forum',
64 'url_edit'=>'controler_forum',
65 'editable'=>'non',
66 'principale' => 'oui',
67 'page'=>'', // pas de page editoriale pour un forum
68
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',
77
78 'champs_editables' => array('titre', 'texte', 'nom_site', 'url_site'),
79
80 'field'=> array(
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",
96 "maj" => "TIMESTAMP",
97 "id_auteur" => "bigint DEFAULT '0' NOT NULL"
98 ),
99 'key' => array(
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"
105 ),
106 'join' => array(
107 "id_forum"=>"id_forum",
108 "id_parent"=>"id_parent",
109 "id_objet"=>"id_objet",
110 "objet"=>"objet",
111 "id_auteur"=>"id_auteur",
112 ),
113 'rechercher_champs' => array(
114 'titre' => 3, 'texte' => 1, 'auteur' => 2, 'email_auteur' => 2, 'nom_site' => 1, 'url_site' => 1
115 ),
116 );
117
118 // jointures sur les forum pour tous les objets
119 $tables[]['tables_jointures'][]= 'forums';
120
121 return $tables;
122 }
123
124 ?>