[SPIP] +2.1.12
[velocampus/web/www.git] / www / ecrire / exec / fond.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
15 /**
16 * Un exec generique qui utilise le fond homonyme de l'exec demande
17 * dans l'url
18 */
19 function exec_fond_dist(){
20
21 // pas d'autorisation
22 // c'est au fond de les gerer avec #AUTORISER, et de renvoyer un fond vide le cas echeant
23 // qui declenchera un minipres acces interdit
24 $exec = _request('exec');
25 $fond = trim(recuperer_fond("prive/exec/$exec",$_REQUEST));
26 if (!$fond) {
27 include_spip('inc/minipres');
28 echo minipres();
29 } else {
30
31 $titre = "exec_$exec";
32 $navigation = "";
33 $extra = "";
34
35 // recuperer le titre dans le premier hn de la page
36 if (preg_match(",<h[1-6][^>]*>(.+)</h[1-6]>,Uims",$fond,$match)){
37 $titre = $match[1];
38 }
39
40 // recuperer la hierarchie (au-dessus du contenu)
41 if (preg_match(",<!--#hierarchie-->.+<!--/#hierarchie-->,Uims",$fond,$match)){
42 $hierarchie = $match[0];
43 $fond = str_replace($hierarchie,"",$fond);
44 }
45
46 // recuperer la navigation (colonne de gauche)
47 if (preg_match(",<!--#navigation-->.+<!--/#navigation-->,Uims",$fond,$match)){
48 $navigation = $match[0];
49 $fond = str_replace($navigation,"",$fond);
50 }
51
52 // recuperer les extras (colonne de droite)
53 if (preg_match(",<!--#extra-->.+<!--/#extra-->,Uims",$fond,$match)){
54 $extra = $match[0];
55 $fond = str_replace($extra,"",$fond);
56 }
57
58 include_spip('inc/presentation'); // alleger les inclusions avec un inc/presentation_mini
59 $commencer_page = charger_fonction('commencer_page','inc');
60 echo $commencer_page($titre);
61
62 if ($hierarchie){
63 echo debut_grand_cadre(true);
64 echo pipeline(
65 'affiche_hierarchie',
66 array(
67 'args' => array(
68 'exec' => $exec
69 ),
70 'data' => $hierarchie
71 )
72 );
73 echo fin_grand_cadre(true);
74 }
75
76 echo debut_gauche("exec_$exec",true);
77 $contexte = array('exec'=>$exec);
78 $objet = objet_type(preg_replace(",_edit$,","",$exec));
79 $id = id_table_objet($objet);
80 if (_request($id))
81 $contexte[$id] = _request($id);
82
83 echo $navigation;
84 echo pipeline('affiche_gauche',array('args'=>$contexte,'data'=>''));
85
86 echo creer_colonne_droite("exec_$exec",true);
87 echo $extra;
88 echo pipeline('affiche_droite',array('args'=>$contexte,'data'=>''));
89
90 echo debut_droite("exec_$exec",true);
91 echo $fond;
92 echo pipeline('affiche_milieu',array('args'=>$contexte,'data'=>''));
93
94 echo fin_gauche(),fin_page();
95 }
96 }
97
98 ?>