[SPIP][PLUGINS] v3.0-->v3.2
[lhc/web/www.git] / www / plugins-dist / sites / base / sites.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')) {
14 return;
15 }
16
17 /**
18 * Interfaces des tables syndic et syndic article
19 *
20 * @param array $interfaces
21 * @return array
22 */
23 function sites_declarer_tables_interfaces($interfaces) {
24
25 $interfaces['table_des_tables']['sites'] = 'syndic'; // compat pour les boucles (SITES)
26 $interfaces['table_des_tables']['syndication'] = 'syndic';
27 $interfaces['table_des_tables']['syndic'] = 'syndic';
28 $interfaces['table_des_tables']['syndic_articles'] = 'syndic_articles';
29
30 # ne sert plus ? verifier balise_URL_ARTICLE
31 $interfaces['exceptions_des_tables']['syndic_articles']['url_article'] = 'url';
32 # ne sert plus ? verifier balise_LESAUTEURS
33 $interfaces['exceptions_des_tables']['syndic_articles']['lesauteurs'] = 'lesauteurs';
34 $interfaces['exceptions_des_tables']['syndic_articles']['url_site'] = array('syndic', 'url_site');
35 $interfaces['exceptions_des_tables']['syndic_articles']['nom_site'] = array('syndic', 'nom_site');
36
37 $interfaces['table_date']['syndication'] = 'date';
38
39 $interfaces['tables_jointures']['spip_syndic_articles'][] = 'syndic';
40
41 $interfaces['table_des_traitements']['NOM_SITE'][] = _TRAITEMENT_TYPO;
42
43 // Articles syndiques : passage des donnees telles quelles, sans traitement typo
44 // la securite et conformite XHTML de ces champs est assuree par safehtml()
45 foreach (array('DESCRIPTIF', 'SOURCE', 'URL', 'URL_SOURCE', 'LESAUTEURS', 'TAGS') as $balise) {
46 if (!isset($interfaces['table_des_traitements'][$balise]['syndic_articles'])) {
47 $interfaces['table_des_traitements'][$balise]['syndic_articles'] = 'safehtml(%s)';
48 } else {
49 if (strpos($interfaces['table_des_traitements'][$balise]['syndic_articles'], 'safehtml') == false) {
50 $interfaces['table_des_traitements'][$balise]['syndic_articles'] = 'safehtml(' . $interfaces['table_des_traitements'][$balise]['syndic_articles'] . ')';
51 }
52 }
53 }
54
55 return $interfaces;
56 }
57
58
59 function sites_declarer_tables_objets_sql($tables) {
60 $tables['spip_syndic'] = array(
61 'table_objet_surnoms' => array('site'),
62 'type' => 'site',
63 'type_surnoms' => array('syndic'),
64 'texte_retour' => 'icone_retour',
65 'texte_objets' => 'icone_sites_references',
66 'texte_objet' => 'sites:icone_site_reference',
67 'texte_modifier' => 'sites:icone_modifier_site',
68 'texte_creer' => 'sites:icone_referencer_nouveau_site',
69 'info_aucun_objet' => 'sites:info_aucun_site',
70 'info_1_objet' => 'sites:info_1_site',
71 'info_nb_objets' => 'sites:info_nb_sites',
72 'titre' => "nom_site AS titre, '' AS lang",
73 'date' => 'date',
74 'principale' => 'oui',
75 'field' => array(
76 "id_syndic" => "bigint(21) NOT NULL",
77 "id_rubrique" => "bigint(21) DEFAULT '0' NOT NULL",
78 "id_secteur" => "bigint(21) DEFAULT '0' NOT NULL",
79 "nom_site" => "text DEFAULT '' NOT NULL",
80 "url_site" => "text DEFAULT '' NOT NULL",
81 "url_syndic" => "text DEFAULT '' NOT NULL",
82 "descriptif" => "text DEFAULT '' NOT NULL",
83 "maj" => "TIMESTAMP",
84 "syndication" => "VARCHAR(3) DEFAULT '' NOT NULL",
85 "statut" => "varchar(10) DEFAULT '0' NOT NULL",
86 "date" => "datetime DEFAULT '0000-00-00 00:00:00' NOT NULL",
87 "date_syndic" => "datetime DEFAULT '0000-00-00 00:00:00' NOT NULL",
88 "date_index" => "datetime DEFAULT '0000-00-00 00:00:00' NOT NULL",
89 "moderation" => "VARCHAR(3) DEFAULT 'non'",
90 "miroir" => "VARCHAR(3) DEFAULT 'non'",
91 "oubli" => "VARCHAR(3) DEFAULT 'non'",
92 "resume" => "VARCHAR(3) DEFAULT 'oui'"
93 ),
94 'key' => array(
95 "PRIMARY KEY" => "id_syndic",
96 "KEY id_rubrique" => "id_rubrique",
97 "KEY id_secteur" => "id_secteur",
98 "KEY statut" => "statut, date_syndic",
99 ),
100 'join' => array(
101 "id_syndic" => "id_syndic",
102 "id_rubrique" => "id_rubrique"
103 ),
104 'statut' => array(
105 array('champ' => 'statut', 'publie' => 'publie', 'previsu' => 'publie,prop', 'exception' => 'statut')
106 ),
107 'texte_changer_statut' => 'sites:info_statut_site_1',
108 'statut_textes_instituer' => array(
109 'prop' => 'texte_statut_propose_evaluation',
110 'publie' => 'texte_statut_publie',
111 'refuse' => 'texte_statut_poubelle',
112 ),
113
114 'rechercher_champs' => array(
115 'nom_site' => 5,
116 'url_site' => 1,
117 'descriptif' => 3
118 ),
119 'champs_versionnes' => array('id_rubrique', 'id_secteur', 'nom_site', 'url_site', 'url_syndic', 'descriptif'),
120 );
121
122 $tables['spip_syndic_articles'] = array(
123 'table_objet_surnoms' => array('syndic_article'),
124
125 'texte_retour' => 'icone_retour',
126 'texte_objets' => 'sites:icone_articles_syndic',
127 'texte_objet' => 'sites:icone_article_syndic',
128 'texte_modifier' => 'icone_modifier_article', # inutile en vrai
129 'info_aucun_objet' => 'sites:info_aucun_article_syndique',
130 'info_1_objet' => 'sites:info_1_article_syndique',
131 'info_nb_objets' => 'sites:info_nb_articles_syndiques',
132 'icone_objet' => 'site',
133
134 // pas de page propre ni dans ecrire ni dans le site public
135 'url_voir' => '',
136 'url_edit' => '',
137 'page' => '',
138
139 'date' => 'date',
140 'editable' => 'non',
141 'principale' => 'oui',
142 'field' => array(
143 "id_syndic_article" => "bigint(21) NOT NULL",
144 "id_syndic" => "bigint(21) DEFAULT '0' NOT NULL",
145 "titre" => "text DEFAULT '' NOT NULL",
146 "url" => "text DEFAULT '' NOT NULL",
147 "date" => "datetime DEFAULT '0000-00-00 00:00:00' NOT NULL",
148 "lesauteurs" => "text DEFAULT '' NOT NULL",
149 "maj" => "TIMESTAMP",
150 "statut" => "varchar(10) DEFAULT '0' NOT NULL",
151 "descriptif" => "text DEFAULT '' NOT NULL",
152 "lang" => "VARCHAR(10) DEFAULT '' NOT NULL",
153 "url_source" => "TINYTEXT DEFAULT '' NOT NULL",
154 "source" => "TINYTEXT DEFAULT '' NOT NULL",
155 "tags" => "TEXT DEFAULT '' NOT NULL"
156 ),
157 'key' => array(
158 "PRIMARY KEY" => "id_syndic_article",
159 "KEY id_syndic" => "id_syndic",
160 "KEY statut" => "statut",
161 "KEY url" => "url(255)"
162 ),
163 'join' => array(
164 "id_syndic_article" => "id_syndic_article",
165 "id_syndic" => "id_syndic"
166 ),
167 'statut' => array(
168 array('champ' => 'statut', 'publie' => 'publie', 'previsu' => 'publie,prop', 'exception' => 'statut'),
169 array(
170 'champ' => array(array('spip_syndic', 'id_syndic'), 'statut'),
171 'publie' => 'publie',
172 'previsu' => 'publie,prop',
173 'exception' => 'statut'
174 ),
175 ),
176 'statut_images' => array(
177 'puce-rouge-anim.gif',
178 'publie' => 'puce-publier-8.png',
179 'refuse' => 'puce-supprimer-8.png',
180 'dispo' => 'puce-proposer-8.png',
181 'off' => 'puce-refuser-8.png',
182 ),
183 'rechercher_champs' => array(
184 'titre' => 5,
185 'descriptif' => 1
186 )
187 );
188
189 return $tables;
190 }