f753d5e0d2e4e125fa49ae6b77b520393f62199a
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 des tables petitions et signatures pour le compilateur
18 * @param array $interfaces
21 function petitions_declarer_tables_interfaces($interfaces){
23 $interfaces['table_des_tables']['petitions']='petitions';
24 $interfaces['table_des_tables']['signatures']='signatures';
26 $interfaces['exceptions_des_tables']['signatures']['date']='date_time';
27 $interfaces['exceptions_des_tables']['signatures']['nom']='nom_email';
28 $interfaces['exceptions_des_tables']['signatures']['email']='ad_email';
30 $interfaces['tables_jointures']['spip_articles'][]= 'petitions';
31 $interfaces['tables_jointures']['spip_articles'][]= 'signatures';
33 $interfaces['exceptions_des_jointures']['petition'] = array('spip_petitions', 'texte');
34 $interfaces['exceptions_des_jointures']['id_signature']= array('spip_signatures', 'id_signature');
36 $interfaces['table_des_traitements']['MESSAGE'][]= _TRAITEMENT_RACCOURCIS
;
38 // Signatures : passage des donnees telles quelles, sans traitement typo
39 // la securite et conformite XHTML de ces champs est assuree par safehtml()
40 foreach(array('NOM_EMAIL','AD_EMAIL','NOM_SITE','URL_SITE','MESSAGE') as $balise)
41 if (!isset($interfaces['table_des_traitements'][$balise]['signatures']))
42 $interfaces['table_des_traitements'][$balise]['signatures'] = 'liens_nofollow(safehtml(%s))';
44 if (strpos($interfaces['table_des_traitements'][$balise]['signatures'],'safehtml')==false)
45 $interfaces['table_des_traitements'][$balise]['signatures'] = 'liens_nofollow(safehtml('.$interfaces['table_des_traitements'][$balise]['signatures'].'))';
50 function petitions_declarer_tables_objets_sql($tables){
51 $tables['spip_petitions'] = array(
52 'url_voir'=>'controler_petition',
53 'url_edit'=>'controler_petition',
55 'principale' => 'oui',
56 'page'=>'', // pas de page editoriale pour une petition
58 'texte_retour' => 'icone_retour',
59 'texte_objets' => 'petitions:titre_petitions',
60 'texte_objet' => 'petitions:titre_petition',
62 'titre' => "texte as titre, '' AS lang",
65 "id_petition" => "bigint(21) NOT NULL",
66 "id_article" => "bigint(21) DEFAULT '0' NOT NULL",
67 "email_unique" => "CHAR (3) DEFAULT '' NOT NULL",
68 "site_obli" => "CHAR (3) DEFAULT '' NOT NULL",
69 "site_unique" => "CHAR (3) DEFAULT '' NOT NULL",
70 "message" => "CHAR (3) DEFAULT '' NOT NULL",
71 "texte" => "LONGTEXT DEFAULT '' NOT NULL",
72 "statut" => "VARCHAR (10) DEFAULT 'publie' NOT NULL",
76 "PRIMARY KEY" => "id_petition",
77 "UNIQUE id_article" => "id_article"
80 array('champ'=>'statut','publie'=>'publie,off','previsu'=>'publie,off','exception'=>array('statut')),
84 $tables['spip_signatures'] = array(
85 'url_voir'=>'controler_petition',
86 'url_edit'=>'controler_petition',
88 'principale' => 'oui',
89 'page'=>'', // pas de page editoriale pour une signature
91 'texte_retour' => 'icone_retour',
92 'texte_objets' => 'public:signatures_petition',
93 'texte_objet' => 'entree_signature',
94 'info_aucun_objet'=> 'petitions:aucune_signature',
95 'info_1_objet' => 'petitions:une_signature',
96 'info_nb_objets' => 'petitions:nombre_signatures',
97 'titre' => "nom_email as titre, '' AS lang",
98 'date' => 'date_time',
101 "id_signature" => "bigint(21) NOT NULL",
102 "id_petition" => "bigint(21) DEFAULT '0' NOT NULL",
103 # "id_article" => "bigint(21) DEFAULT '0' NOT NULL",
104 "date_time" => "datetime DEFAULT '0000-00-00 00:00:00' NOT NULL",
105 "nom_email" => "text DEFAULT '' NOT NULL",
106 "ad_email" => "text DEFAULT '' NOT NULL",
107 "nom_site" => "text DEFAULT '' NOT NULL",
108 "url_site" => "text DEFAULT '' NOT NULL",
109 "message" => "mediumtext DEFAULT '' NOT NULL",
110 "statut" => "varchar(10) DEFAULT '0' NOT NULL",
114 "PRIMARY KEY" => "id_signature",
115 "KEY id_petition" => "id_petition",
116 # "KEY id_article" => "id_article",
117 "KEY statut" => "statut"
120 "id_signature"=>"id_signature",
121 "id_petition"=>"id_petition"
123 'tables_jointures'=> array(
127 array('champ'=>'statut','publie'=>'publie','previsu'=>'publie','exception'=>array('statut','tout')),
129 'rechercher_champs' => array(
130 'nom_email' => 2, 'ad_email' => 4,
131 'nom_site' => 2, 'url_site' => 4,
134 'icone_objet' => 'petition',