[SPIP] v3.2.1-->v3.2.2
[lhc/web/www.git] / www / ecrire / exec / fond_monobloc.php
1 <?php
2
3 /***************************************************************************\
4 * SPIP, Systeme de publication pour l'internet *
5 * *
6 * Copyright (c) 2001-2019 *
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 /**
14 * Gestion d'affichage des pages privées en squelette (méthode dépreciée)
15 *
16 * Chargé depuis ecrire/index.php lorsqu'une page demandée est présente
17 * en tant que squelettes dans `prive/exec`.
18 *
19 * @deprecated
20 * Il faut créer les squelettes de l'espace privé dans `prive/squelettes`
21 *
22 * @package SPIP\Core\Exec
23 */
24
25 if (!defined('_ECRIRE_INC_VERSION')) {
26 return;
27 }
28
29 /**
30 * Un exec générique qui utilise le fond homonyme de l'exec demandé
31 * dans l'URL
32 *
33 * Ancien système transitoire basé sur un squelette unique avec un
34 * pseudo balisage par commentaires HTML
35 *
36 * @deprecated Ne plus utiliser. Migrer vers `prive/squelettes/`
37 *
38 * @pipeline_appel affiche_hierarchie
39 * @pipeline_appel affiche_gauche
40 * @pipeline_appel affiche_droite
41 * @pipeline_appel affiche_milieu
42 *
43 */
44 function exec_fond_monobloc_dist() {
45
46 // pas d'autorisation
47 // c'est au fond de les gerer avec #AUTORISER, et de renvoyer un fond vide le cas echeant
48 // qui declenchera un minipres acces interdit
49 $exec = _request('exec');
50 $fond = trim(recuperer_fond("prive/exec/$exec", $_REQUEST));
51 if (!$fond) {
52 include_spip('inc/minipres');
53 echo minipres();
54 } else {
55
56 $titre = "exec_$exec";
57 $hierarchie = "";
58 $navigation = "";
59 $extra = "";
60
61 // recuperer le titre dans le premier hn de la page
62 if (preg_match(",<h[1-6][^>]*>(.+)</h[1-6]>,Uims", $fond, $match)) {
63 $titre = $match[1];
64 }
65
66 // recuperer la hierarchie (au-dessus du contenu)
67 if (preg_match(",<!--#hierarchie-->.+<!--/#hierarchie-->,Uims", $fond, $match)) {
68 $hierarchie = $match[0];
69 $fond = str_replace($hierarchie, "", $fond);
70 }
71
72 // recuperer la navigation (colonne de gauche)
73 if (preg_match(",<!--#navigation-->.+<!--/#navigation-->,Uims", $fond, $match)) {
74 $navigation = $match[0];
75 $fond = str_replace($navigation, "", $fond);
76 }
77
78 // recuperer les extras (colonne de droite)
79 if (preg_match(",<!--#extra-->.+<!--/#extra-->,Uims", $fond, $match)) {
80 $extra = $match[0];
81 $fond = str_replace($extra, "", $fond);
82 }
83
84 include_spip('inc/presentation'); // alleger les inclusions avec un inc/presentation_mini
85 $commencer_page = charger_fonction('commencer_page', 'inc');
86 echo $commencer_page($titre);
87
88 if ($hierarchie) {
89 echo debut_grand_cadre(true);
90 echo pipeline(
91 'affiche_hierarchie',
92 array(
93 'args' => array(
94 'exec' => $exec
95 ),
96 'data' => $hierarchie
97 )
98 );
99 echo fin_grand_cadre(true);
100 }
101
102 echo debut_gauche("exec_$exec", true);
103
104 $contexte = array('exec' => $exec);
105 if ($objet_exec = trouver_objet_exec($exec)) {
106 $id = $objet_exec['id_table_objet'];
107 if (_request($id)) {
108 $contexte[$id] = _request($id);
109 }
110 }
111
112 echo $navigation;
113 echo pipeline('affiche_gauche', array('args' => $contexte, 'data' => ''));
114
115 echo creer_colonne_droite("exec_$exec", true);
116 echo $extra;
117 echo pipeline('affiche_droite', array('args' => $contexte, 'data' => ''));
118
119 echo debut_droite("exec_$exec", true);
120 echo $fond;
121 echo pipeline('affiche_milieu', array('args' => $contexte, 'data' => ''));
122
123 echo fin_gauche(), fin_page();
124 }
125 }