[SPIP] +2.1.12
[velocampus/web/www.git] / www / ecrire / inc / minipres.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 include_spip('inc/headers');
16 include_spip('inc/texte'); //inclue inc/lang et inc/filtres
17
18 //
19 // Presentation des pages d'installation et d'erreurs
20 //
21
22 // http://doc.spip.org/@install_debut_html
23 function install_debut_html($titre = 'AUTO', $onLoad = '') {
24 global $spip_lang_right,$spip_lang_left;
25
26 utiliser_langue_visiteur();
27
28 http_no_cache();
29
30 if ($titre=='AUTO')
31 $titre=_T('info_installation_systeme_publication');
32
33 # le charset est en utf-8, pour recuperer le nom comme il faut
34 # lors de l'installation
35 if (!headers_sent())
36 header('Content-Type: text/html; charset=utf-8');
37
38 // au cas ou minipres() est appele avant spip_initialisation_suite()
39 if (!defined('_DOCTYPE_ECRIRE')) define('_DOCTYPE_ECRIRE', '');
40 return _DOCTYPE_ECRIRE.
41 html_lang_attributes().
42 "<head>\n".
43 "<title>".
44 textebrut($titre).
45 "</title>
46 <link rel='stylesheet' href='".direction_css(find_in_path('minipres.css')).
47 "' type='text/css' media='all' />\n" .
48 // cet appel permet d'assurer un copier-coller du nom du repertoire a creer dans tmp (esj)
49 http_script('', "spip_barre.js") .
50 "</head>
51 <body".$onLoad." class='minipres'>
52 <div id='minipres'>
53 <h1>".
54 $titre .
55 "</h1>
56 <div>\n";
57 }
58
59 // http://doc.spip.org/@install_fin_html
60 function install_fin_html() {
61 return "\n\t</div>\n\t</div>\n</body>\n</html>";
62 }
63
64 // http://doc.spip.org/@minipres
65 function minipres($titre='', $corps="", $onload='')
66 {
67 if (!defined('_AJAX')) define('_AJAX', false);
68 if (!$titre) {
69 if (!_AJAX)
70 http_status(403);
71 if (!$titre = _request('action')
72 AND !$titre = _request('exec')
73 AND !$titre = _request('page'))
74 $titre = '?';
75
76 $titre = htmlspecialchars($titre);
77
78 $titre = ($titre == 'install')
79 ? _T('avis_espace_interdit')
80 : $titre . '&nbsp;: '. _T('info_acces_interdit');
81 $corps = generer_form_ecrire('accueil', '','',_T('public:accueil_site'));
82 spip_log($GLOBALS['visiteur_session']['nom'] . " $titre " . $_SERVER['REQUEST_URI']);
83 }
84
85 if (!_AJAX)
86 return install_debut_html($titre, $onload)
87 . $corps
88 . install_fin_html();
89 else {
90 include_spip('inc/headers');
91 include_spip('inc/actions');
92 $url = self('&',true);
93 foreach ($_POST as $v => $c)
94 $url = parametre_url($url, $v, $c, '&');
95 echo ajax_retour("<div>".$titre . redirige_formulaire($url)."</div>",false);
96 }
97 }
98 ?>