[SPIP] +2.1.12
[velocampus/web/www.git] / www / ecrire / exec / sites.php
1 <?php
2
3 /***************************************************************************\
4 * SPIP, Systeme de publication pour l'internet *
5 * *
6 * Copyright (c) 2001-2011 *
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 include_spip('inc/presentation');
15 include_spip('inc/date');
16 include_spip('inc/config');
17
18 // http://doc.spip.org/@exec_sites_dist
19 function exec_sites_dist()
20 {
21 exec_sites_args(intval(_request('id_syndic')));
22 }
23
24 // http://doc.spip.org/@exec_sites_args
25 function exec_sites_args($id_syndic)
26 {
27 if (!autoriser('voir','site',$id_syndic)
28 OR (!$row = sql_fetsel("*", "spip_syndic", "id_syndic=$id_syndic"))) {
29 include_spip('inc/minipres');
30 echo minipres(_T('public:aucun_site'));
31 } else {
32
33 $id_rubrique = $row["id_rubrique"];
34 $nom_site = $row["nom_site"];
35 $titre_page = "&laquo; $nom_site &raquo;";
36 pipeline('exec_init',array('args'=>array('exec'=>'sites','id_syndic'=>$id_syndic),'data'=>''));
37
38 $commencer_page = charger_fonction('commencer_page', 'inc');
39 echo $commencer_page("$titre_page","naviguer","sites", $id_rubrique);
40 afficher_site($id_syndic, $id_rubrique, $nom_site, $row);
41 echo fin_gauche();
42 echo fin_page();
43 }
44 }
45
46
47 // http://doc.spip.org/@afficher_site
48 function afficher_site($id_syndic, $id_rubrique, $nom_site, $row){
49
50 global $spip_lang_left,
51 $spip_lang_right;
52
53 $cherche_mot = _request('cherche_mot');
54 $select_groupe = _request('select_groupe');
55 $id_secteur = $row["id_secteur"];
56 $url_site = $row["url_site"];
57 $url_syndic = $row["url_syndic"];
58 $descriptif = $row["descriptif"];
59 $syndication = $row["syndication"];
60 $statut = $row["statut"];
61 $date_heure = $row["date"];
62 $date_syndic = $row['date_syndic'];
63 $mod = $row['moderation'];
64 $extra=$row["extra"];
65
66 $flag_administrable = autoriser('modifier','site',$id_syndic);
67 $flag_editable = ($flag_administrable OR ($GLOBALS['meta']["proposer_sites"] > 0 AND ($statut == 'prop')));
68
69 $meme_rubrique = charger_fonction('meme_rubrique', 'inc');
70 $iconifier = charger_fonction('iconifier', 'inc');
71 if ($flag_editable AND ($statut == 'publie'))
72 $dater = charger_fonction('dater', 'inc');
73 $editer_mots = charger_fonction('editer_mots', 'inc');
74 if ($flag_administrable)
75 $instituer_site = charger_fonction('instituer_site','inc');
76
77 echo debut_grand_cadre(true);
78 echo afficher_hierarchie($id_rubrique);
79 echo fin_grand_cadre(true);
80
81 echo debut_gauche('', true);
82 echo debut_boite_info(true);
83 echo pipeline ('boite_infos', array('data' => '',
84 'args' => array(
85 'type'=>'site',
86 'id' => $id_syndic,
87 'row' => $row
88 )
89 ));
90 echo fin_boite_info(true);
91 echo $iconifier('id_syndic', $id_syndic, 'sites', false, $flag_administrable);
92
93 echo pipeline('affiche_gauche',array('args'=>array('exec'=>'sites','id_syndic'=>$id_syndic),'data'=>''));
94
95 echo creer_colonne_droite('', true);
96 echo $meme_rubrique($id_rubrique, $id_syndic, 'syndic');
97 echo pipeline('affiche_droite',array('args'=>array('exec'=>'sites','id_syndic'=>$id_syndic),'data'=>''));
98
99 echo bloc_des_raccourcis(
100 icone_horizontale(_T('icone_voir_sites_references'), generer_url_ecrire("sites_tous",""), "site-24.gif","rien.gif", false)
101 );
102
103
104 echo debut_droite('', true);
105
106 if ($syndication == 'off' OR $syndication == 'sus')
107 $droit = $id_rubrique;
108 else $droit = 0;
109
110 $url_affichee = $url_site;
111 if (strlen($url_affichee) > 40) $url_affichee = substr($url_affichee, 0, 30)."...";
112
113 $actions =
114 ($flag_editable ? icone_inline(_T('icone_modifier_site'), generer_url_ecrire('sites_edit',"id_syndic=$id_syndic"), "site-24.gif", "edit.gif",$spip_lang_right) : "");
115
116 $haut =
117 "<div class='bandeau_actions'>$actions</div>".
118 gros_titre($nom_site?$nom_site:"("._T('info_sans_titre_2').")", '' , false)
119 . "<a href='$url_site' class='url_site'>$url_affichee</a>";
120
121 $type = 'site';
122 $contexte = array('id'=>$id_syndic,'id_rubrique'=>$id_rubrique);
123 $fond = recuperer_fond("prive/contenu/$type",$contexte);
124 // permettre aux plugin de faire des modifs ou des ajouts
125 $fond = pipeline('afficher_contenu_objet',
126 array(
127 'args'=>array(
128 'type'=>$type,
129 'id_objet'=>$id_syndic,
130 'contexte'=>$contexte),
131 'data'=> $fond));
132
133 $fond = "<div id='wysiwyg'>$fond</div>";
134
135 $onglet_contenu =
136 (_INTERFACE_ONGLETS?
137 ($statut == 'prop' ? "<p class='site_prop'>"._T('info_site_propose')." <b>".affdate($date_heure)."&nbsp;</b></p>" : "")
138 . $fond:"")
139
140 . (($syndication == "oui" OR $syndication == "off" OR $syndication == "sus") ?
141 "<p class='site_syndique'><a href='".htmlspecialchars($url_syndic)."'>"
142 . http_img_pack('feed.png', 'RSS'). '</a>'._T('info_site_syndique').'</p>'
143
144 . (($syndication == "off" OR $syndication=="sus") ?
145 "<div class='site_syndique_probleme'>" . _T('avis_site_syndique_probleme', array('url_syndic' => quote_amp($url_syndic)))
146 . redirige_action_auteur('editer_site', $id_syndic, 'sites', '',
147 "<input type='hidden' name='reload' value='oui' />
148 <input type='submit' value=\""
149 . attribut_html(_T('lien_nouvelle_recuperation'))
150 . "\" class='spip_xx-small' />")
151 . "</div>"
152 : "")
153
154 . afficher_objets('syndic_article',_T('titre_articles_syndiques'), array('FROM' => 'spip_syndic_articles', 'WHERE' => "id_syndic=$id_syndic", 'ORDER BY' => "date DESC"), $id_syndic)
155
156 . ($date_syndic ? "<div class='date_syndic'>" . _T('info_derniere_syndication').' '.affdate_heure($date_syndic) .".</div>" : "")
157 . "<div class='mise_a_jour_syndic'>"
158 . redirige_action_post('editer_site', $id_syndic, 'sites', "id_syndic=$id_syndic",
159 "<input type='hidden' name='reload' value='oui' />
160 <input type='submit' value=\""
161 . attribut_html(_T('lien_mise_a_jour_syndication'))
162 . "\" class='spip_xx-small' />")
163 . "</div>"
164
165 : choix_feed($id_syndic, $id_rubrique, $nom_site, $row))
166 . (_INTERFACE_ONGLETS?"":($flag_administrable ? options_moderation($row) : ""))
167
168 ;
169
170 $onglet_proprietes =
171 (_INTERFACE_ONGLETS?"":
172 $fond
173 . ($statut == 'prop' ? "<p class='site_prop'>"._T('info_site_propose')." <b>".affdate($date_heure)."&nbsp;</b></p>" : "")
174 )
175 . afficher_site_rubrique($id_syndic, $id_rubrique, $id_secteur)
176 . ($dater ? $dater($id_syndic, $flag_editable, $statut, 'syndic', 'sites', $date_heure) : "")
177 . $editer_mots('syndic', $id_syndic, $cherche_mot, $select_groupe, $flag_editable, true, 'sites')
178 . (_INTERFACE_ONGLETS?($flag_administrable ? options_moderation($row) : ""):"")
179 . pipeline('affiche_milieu',array('args'=>array('exec'=>'sites','id_syndic'=>$id_syndic),'data'=>''))
180 ;
181
182 $discuter = charger_fonction('discuter', 'inc');
183 $onglet_discuter = $discuter($id_syndic, 'sites', 'id_syndic');
184 $onglet_documents = "" ;
185 $onglet_interactivite = "";
186
187 echo
188 "<div class='fiche_objet'>"
189 . $haut
190 . afficher_onglets_pages(array(
191 'voir' => _T('onglet_contenu'),
192 'props' => _T('onglet_proprietes'),
193 'docs' => _T('onglet_documents'),
194 'interactivite' => _T('onglet_interactivite'),
195 'discuter' => _T('onglet_discuter')),
196 _INTERFACE_ONGLETS?
197 array(
198 'voir'=>$onglet_contenu,
199 'props'=>$onglet_proprietes,
200 'docs'=>$onglet_documents,
201 'interactivite'=>$onglet_interactivite,
202 'discuter'=>$onglet_discuter)
203 :array(
204 'props'=>$onglet_proprietes,
205 'voir'=>$onglet_contenu )
206 )
207 . "</div>"
208 . (_INTERFACE_ONGLETS?"":$onglet_discuter);
209 }
210
211 // http://doc.spip.org/@options_moderation
212 function options_moderation($row) {
213
214 global $spip_lang_left;
215
216 if ($row['syndication'] == 'non' or $row['syndication'] == '') return '';
217
218 $id_syndic = $row['id_syndic'];
219 $moderation = $row['moderation'];
220 if ($moderation != 'oui') $moderation='non';
221
222 $res = '';
223 $res .= "<div style='text-align: ".$GLOBALS['spip_lang_left']."'>".
224 _T('syndic_choix_moderation')
225 . "<div style='padding-$spip_lang_left: 40px;'>"
226 . afficher_choix('moderation', $moderation,
227 array(
228 'non' => _T('info_publier') .' ('._T('bouton_radio_modere_posteriori').')',
229 'oui' => _T('info_bloquer') .' ('._T('bouton_radio_modere_priori').')' ))
230 . "</div></div>\n";
231
232 // Oublier les vieux liens ?
233 // Depublier les liens qui ne figurent plus ?
234
235 $res .= "\n<div>&nbsp;</div>"
236 . "\n<div style='text-align:".$GLOBALS['spip_lang_left']."'>"._T('syndic_choix_oublier'). '</div>'
237 . "\n<ul style='text-align:".$GLOBALS['spip_lang_left']."'>\n";
238
239 $on = array('oui' => _T('item_oui'), 'non' => _T('item_non'));
240 if (!$miroir = $row['miroir'])
241 $miroir = 'non';
242
243 $res .= "\n<li>"._T('syndic_option_miroir').' '
244 . afficher_choix('miroir', $miroir, $on, " &nbsp; ")
245 . "</li>\n";
246
247 if (!$oubli = $row['oubli'])
248 $oubli = 'non';
249 $res .= "\n<li>"
250 . _T('syndic_option_oubli', array('mois' => 2)).' '
251 . afficher_choix('oubli', $oubli, $on," &nbsp; ")
252 . "</li>\n"
253 . "</ul>\n";
254
255 // Prendre les resumes ou le texte integral ?
256 if (!$resume = $row['resume'])
257 $resume = 'oui';
258
259 $res .= "\n<div style='text-align: $spip_lang_left'>"
260 . _T('syndic_choix_resume')
261 . "\n<div style='padding-$spip_lang_left: 40px;'>"
262 . afficher_choix('resume', $resume,
263 array( 'oui' => _T('syndic_option_resume_oui'),
264 'non' => _T('syndic_option_resume_non') ))
265 . "</div></div>\n";
266
267 // Bouton "Valider"
268 $res .= "\n<div style='text-align:".$GLOBALS['spip_lang_right'].";'><input type='submit' value='"._T('bouton_valider')."' /></div>\n";
269
270 return
271 debut_cadre_relief('feed.png', true, "", _T('syndic_options').aide('artsyn'))
272 . redirige_action_post('editer_site', "options/$id_syndic", 'sites', '', $res)
273 . fin_cadre_relief(true);
274 }
275
276 // Site pour lesquels feedfinder a un ou plusieurs flux,
277 // et l'on propose de choisir
278
279 // http://doc.spip.org/@choix_feed
280 function choix_feed($id_syndic, $id_rubrique, $nom_site, $row) {
281
282 global $spip_lang_left, $spip_lang_right;
283
284 if (!preg_match(',^\s*select: (.*),', $row['url_syndic'], $regs))
285 return '';
286
287 $url_site = $row["url_site"];
288 $descriptif = $row["descriptif"];
289 $statut = $row["statut"];
290
291 $date_heure = $row["date"];
292 $date_syndic = $row['date_syndic'];
293 $mod = $row['moderation'];
294 $extra=$row["extra"];
295
296 $res = "";
297
298 foreach (array('id_rubrique', 'nom_site', 'url_site', 'descriptif', 'statut') as $var) {
299 $res .= "<input type='hidden' name='$var' value=\"".entites_html($$var)."\" />\n";
300 }
301 $res .= "<div style='text-align: $spip_lang_left'>\n";
302 $res .= "<div><input type='radio' name='syndication' value='non' id='syndication_non' checked='checked' />";
303 $res .= " <b><label for='syndication_non'>"._T('bouton_radio_non_syndication')."</label></b></div>\n";
304 $res .= "<div><input type='radio' name='syndication' value='oui' id='syndication_oui' />";
305 $res .= " <label for='syndication_oui'>"._T('bouton_radio_syndication')."</label></div>\n";
306
307 $res .= "<select name='url_syndic' id='url_syndic'>\n";
308 foreach (explode(' ',$regs[1]) as $feed) {
309 $res .= '<option value="'.entites_html($feed).'">'.$feed."</option>\n";
310 }
311 $res .= "</select>\n";
312 $res .= aide("rubsyn");
313 $res .= "<div style='text-align: $spip_lang_right'><input type='submit' value='"._T('bouton_valider')."' /></div>\n";
314 $res .= "</div>\n";
315
316 $res = redirige_action_post('editer_site', $id_syndic, 'sites','', $res);
317
318 return debut_cadre_relief('', true) . $res . fin_cadre_relief(true);
319 }
320
321 // http://doc.spip.org/@afficher_site_rubrique
322 function afficher_site_rubrique($id_syndic, $id_rubrique, $id_secteur)
323 {
324 global $spip_lang_right;
325
326 if (!_INTERFACE_ONGLETS) return "";
327
328 $chercher_rubrique = charger_fonction('chercher_rubrique', 'inc');
329
330 $form = $chercher_rubrique($id_rubrique, 'site', false);
331 if (strpos($form,'<select')!==false) {
332 $form .= "<div style='text-align: $spip_lang_right;'>"
333 . '<input type="submit" value="'._T('bouton_choisir').'"/>'
334 . "</div>";
335 }
336
337 $msg = _T('titre_cadre_interieur_rubrique');
338
339 $form = "<input type='hidden' name='editer_article' value='oui' />\n" . $form;
340 $form = redirige_action_post("editer_site", $id_syndic, 'sites', $form, " class='submit_plongeur'");
341
342 if ($id_rubrique == 0) $logo = "racine-site-24.gif";
343 elseif ($id_secteur == $id_rubrique) $logo = "secteur-24.gif";
344 else $logo = "rubrique-24.gif";
345
346 return debut_cadre_couleur($logo, true, "", $msg) . $form .fin_cadre_couleur(true);
347 }
348 ?>