@@ -16,7 +16,7 @@ discard block |
||
| 16 | 16 | * @package SPIP\Core\Minipres |
| 17 | 17 | **/ |
| 18 | 18 | if (!defined('_ECRIRE_INC_VERSION')) { |
| 19 | - return; |
|
| 19 | + return; |
|
| 20 | 20 | } |
| 21 | 21 | |
| 22 | 22 | include_spip('inc/headers'); |
@@ -46,61 +46,61 @@ discard block |
||
| 46 | 46 | */ |
| 47 | 47 | function install_debut_html($titre = 'AUTO', $onLoad = '', $all_inline = false) { |
| 48 | 48 | |
| 49 | - utiliser_langue_visiteur(); |
|
| 50 | - |
|
| 51 | - http_no_cache(); |
|
| 52 | - |
|
| 53 | - if ($titre == 'AUTO') { |
|
| 54 | - $titre = _T('info_installation_systeme_publication'); |
|
| 55 | - } |
|
| 56 | - |
|
| 57 | - # le charset est en utf-8, pour recuperer le nom comme il faut |
|
| 58 | - # lors de l'installation |
|
| 59 | - if (!headers_sent()) { |
|
| 60 | - header('Content-Type: text/html; charset=utf-8'); |
|
| 61 | - } |
|
| 62 | - |
|
| 63 | - $css = ""; |
|
| 64 | - $files = array('reset.css', 'clear.css', 'minipres.css'); |
|
| 65 | - if ($all_inline) { |
|
| 66 | - // inliner les CSS (optimisation de la page minipres qui passe en un seul hit a la demande) |
|
| 67 | - foreach ($files as $name) { |
|
| 68 | - $file = direction_css(find_in_theme($name)); |
|
| 69 | - if (function_exists("compacte")) { |
|
| 70 | - $file = compacte($file); |
|
| 71 | - } else { |
|
| 72 | - $file = url_absolue_css($file); // precaution |
|
| 73 | - } |
|
| 74 | - lire_fichier($file, $c); |
|
| 75 | - $css .= $c; |
|
| 76 | - } |
|
| 77 | - $css = "<style type='text/css'>" . $css . "</style>"; |
|
| 78 | - } else { |
|
| 79 | - foreach ($files as $name) { |
|
| 80 | - $file = direction_css(find_in_theme($name)); |
|
| 81 | - $css .= "<link rel='stylesheet' href='$file' type='text/css' />\n"; |
|
| 82 | - } |
|
| 83 | - } |
|
| 84 | - |
|
| 85 | - // au cas ou minipres() est appele avant spip_initialisation_suite() |
|
| 86 | - if (!defined('_DOCTYPE_ECRIRE')) { |
|
| 87 | - define('_DOCTYPE_ECRIRE', ''); |
|
| 88 | - } |
|
| 89 | - |
|
| 90 | - return _DOCTYPE_ECRIRE . |
|
| 91 | - html_lang_attributes() . |
|
| 92 | - "<head>\n" . |
|
| 93 | - "<title>" . |
|
| 94 | - textebrut($titre) . |
|
| 95 | - "</title>\n" . |
|
| 96 | - "<meta name='viewport' content='width=device-width' />\n" . |
|
| 97 | - $css . |
|
| 98 | - "</head> |
|
| 49 | + utiliser_langue_visiteur(); |
|
| 50 | + |
|
| 51 | + http_no_cache(); |
|
| 52 | + |
|
| 53 | + if ($titre == 'AUTO') { |
|
| 54 | + $titre = _T('info_installation_systeme_publication'); |
|
| 55 | + } |
|
| 56 | + |
|
| 57 | + # le charset est en utf-8, pour recuperer le nom comme il faut |
|
| 58 | + # lors de l'installation |
|
| 59 | + if (!headers_sent()) { |
|
| 60 | + header('Content-Type: text/html; charset=utf-8'); |
|
| 61 | + } |
|
| 62 | + |
|
| 63 | + $css = ""; |
|
| 64 | + $files = array('reset.css', 'clear.css', 'minipres.css'); |
|
| 65 | + if ($all_inline) { |
|
| 66 | + // inliner les CSS (optimisation de la page minipres qui passe en un seul hit a la demande) |
|
| 67 | + foreach ($files as $name) { |
|
| 68 | + $file = direction_css(find_in_theme($name)); |
|
| 69 | + if (function_exists("compacte")) { |
|
| 70 | + $file = compacte($file); |
|
| 71 | + } else { |
|
| 72 | + $file = url_absolue_css($file); // precaution |
|
| 73 | + } |
|
| 74 | + lire_fichier($file, $c); |
|
| 75 | + $css .= $c; |
|
| 76 | + } |
|
| 77 | + $css = "<style type='text/css'>" . $css . "</style>"; |
|
| 78 | + } else { |
|
| 79 | + foreach ($files as $name) { |
|
| 80 | + $file = direction_css(find_in_theme($name)); |
|
| 81 | + $css .= "<link rel='stylesheet' href='$file' type='text/css' />\n"; |
|
| 82 | + } |
|
| 83 | + } |
|
| 84 | + |
|
| 85 | + // au cas ou minipres() est appele avant spip_initialisation_suite() |
|
| 86 | + if (!defined('_DOCTYPE_ECRIRE')) { |
|
| 87 | + define('_DOCTYPE_ECRIRE', ''); |
|
| 88 | + } |
|
| 89 | + |
|
| 90 | + return _DOCTYPE_ECRIRE . |
|
| 91 | + html_lang_attributes() . |
|
| 92 | + "<head>\n" . |
|
| 93 | + "<title>" . |
|
| 94 | + textebrut($titre) . |
|
| 95 | + "</title>\n" . |
|
| 96 | + "<meta name='viewport' content='width=device-width' />\n" . |
|
| 97 | + $css . |
|
| 98 | + "</head> |
|
| 99 | 99 | <body" . $onLoad . " class='minipres'> |
| 100 | 100 | <div id='minipres'> |
| 101 | 101 | <h1>" . |
| 102 | - $titre . |
|
| 103 | - "</h1> |
|
| 102 | + $titre . |
|
| 103 | + "</h1> |
|
| 104 | 104 | <div>\n"; |
| 105 | 105 | } |
| 106 | 106 | |
@@ -110,7 +110,7 @@ discard block |
||
| 110 | 110 | * @return string Code HTML |
| 111 | 111 | */ |
| 112 | 112 | function install_fin_html() { |
| 113 | - return "\n\t</div>\n\t</div>\n</body>\n</html>"; |
|
| 113 | + return "\n\t</div>\n\t</div>\n</body>\n</html>"; |
|
| 114 | 114 | } |
| 115 | 115 | |
| 116 | 116 | |
@@ -148,76 +148,76 @@ discard block |
||
| 148 | 148 | */ |
| 149 | 149 | function minipres($titre = '', $corps = "", $options = array()) { |
| 150 | 150 | |
| 151 | - // compat signature old |
|
| 152 | - // minipres($titre='', $corps="", $onload='', $all_inline = false) |
|
| 153 | - $args = func_get_args(); |
|
| 154 | - if (isset($args[2]) and is_string($args[2])) { |
|
| 155 | - $options = array('onload' => $args[2]); |
|
| 156 | - } |
|
| 157 | - if (isset($args[3])) { |
|
| 158 | - $options['all_inline'] = $args[3]; |
|
| 159 | - } |
|
| 160 | - |
|
| 161 | - $options = array_merge(array( |
|
| 162 | - 'onload' => '', |
|
| 163 | - 'all_inline' => false, |
|
| 164 | - ), $options); |
|
| 165 | - |
|
| 166 | - if (!defined('_AJAX')) { |
|
| 167 | - define('_AJAX', false); |
|
| 168 | - } // par securite |
|
| 169 | - if (!$titre) { |
|
| 170 | - if (!isset($options['status'])) { |
|
| 171 | - $options['status'] = 403; |
|
| 172 | - } |
|
| 173 | - if (!$titre = _request('action') |
|
| 174 | - and !$titre = _request('exec') |
|
| 175 | - and !$titre = _request('page') |
|
| 176 | - ) { |
|
| 177 | - $titre = '?'; |
|
| 178 | - } |
|
| 179 | - |
|
| 180 | - $titre = spip_htmlspecialchars($titre); |
|
| 181 | - |
|
| 182 | - $titre = ($titre == 'install') |
|
| 183 | - ? _T('avis_espace_interdit') |
|
| 184 | - : $titre . ' : ' . _T('info_acces_interdit'); |
|
| 185 | - |
|
| 186 | - $statut = isset($GLOBALS['visiteur_session']['statut']) ? $GLOBALS['visiteur_session']['statut'] : ''; |
|
| 187 | - $nom = isset($GLOBALS['visiteur_session']['nom']) ? $GLOBALS['visiteur_session']['nom'] : ''; |
|
| 188 | - |
|
| 189 | - if ($statut != '0minirezo') { |
|
| 190 | - $titre = _T('info_acces_interdit'); |
|
| 191 | - } |
|
| 192 | - |
|
| 193 | - if ($statut AND test_espace_prive()) { |
|
| 194 | - $corps = bouton_action(_T('public:accueil_site'),generer_url_ecrire('accueil')); |
|
| 195 | - } |
|
| 196 | - elseif (!empty($_COOKIE['spip_admin'])) { |
|
| 197 | - $corps = bouton_action(_T('public:lien_connecter'),generer_url_public('login')); |
|
| 198 | - } |
|
| 199 | - else { |
|
| 200 | - $corps = bouton_action(_T('public:accueil_site'),$GLOBALS['meta']['adresse_site']); |
|
| 201 | - } |
|
| 202 | - $corps = "<div class='boutons'>$corps</div>"; |
|
| 203 | - spip_log($nom . " $titre " . $_SERVER['REQUEST_URI']); |
|
| 204 | - } |
|
| 205 | - |
|
| 206 | - if (!_AJAX) { |
|
| 207 | - if (isset($options['status'])) { |
|
| 208 | - http_status($options['status']); |
|
| 209 | - } |
|
| 210 | - |
|
| 211 | - return install_debut_html($titre, $options['onload'], $options['all_inline']) |
|
| 212 | - . $corps |
|
| 213 | - . install_fin_html(); |
|
| 214 | - } else { |
|
| 215 | - include_spip('inc/headers'); |
|
| 216 | - include_spip('inc/actions'); |
|
| 217 | - $url = self('&', true); |
|
| 218 | - foreach ($_POST as $v => $c) { |
|
| 219 | - $url = parametre_url($url, $v, $c, '&'); |
|
| 220 | - } |
|
| 221 | - ajax_retour("<div>" . $titre . redirige_formulaire($url) . "</div>", false); |
|
| 222 | - } |
|
| 151 | + // compat signature old |
|
| 152 | + // minipres($titre='', $corps="", $onload='', $all_inline = false) |
|
| 153 | + $args = func_get_args(); |
|
| 154 | + if (isset($args[2]) and is_string($args[2])) { |
|
| 155 | + $options = array('onload' => $args[2]); |
|
| 156 | + } |
|
| 157 | + if (isset($args[3])) { |
|
| 158 | + $options['all_inline'] = $args[3]; |
|
| 159 | + } |
|
| 160 | + |
|
| 161 | + $options = array_merge(array( |
|
| 162 | + 'onload' => '', |
|
| 163 | + 'all_inline' => false, |
|
| 164 | + ), $options); |
|
| 165 | + |
|
| 166 | + if (!defined('_AJAX')) { |
|
| 167 | + define('_AJAX', false); |
|
| 168 | + } // par securite |
|
| 169 | + if (!$titre) { |
|
| 170 | + if (!isset($options['status'])) { |
|
| 171 | + $options['status'] = 403; |
|
| 172 | + } |
|
| 173 | + if (!$titre = _request('action') |
|
| 174 | + and !$titre = _request('exec') |
|
| 175 | + and !$titre = _request('page') |
|
| 176 | + ) { |
|
| 177 | + $titre = '?'; |
|
| 178 | + } |
|
| 179 | + |
|
| 180 | + $titre = spip_htmlspecialchars($titre); |
|
| 181 | + |
|
| 182 | + $titre = ($titre == 'install') |
|
| 183 | + ? _T('avis_espace_interdit') |
|
| 184 | + : $titre . ' : ' . _T('info_acces_interdit'); |
|
| 185 | + |
|
| 186 | + $statut = isset($GLOBALS['visiteur_session']['statut']) ? $GLOBALS['visiteur_session']['statut'] : ''; |
|
| 187 | + $nom = isset($GLOBALS['visiteur_session']['nom']) ? $GLOBALS['visiteur_session']['nom'] : ''; |
|
| 188 | + |
|
| 189 | + if ($statut != '0minirezo') { |
|
| 190 | + $titre = _T('info_acces_interdit'); |
|
| 191 | + } |
|
| 192 | + |
|
| 193 | + if ($statut AND test_espace_prive()) { |
|
| 194 | + $corps = bouton_action(_T('public:accueil_site'),generer_url_ecrire('accueil')); |
|
| 195 | + } |
|
| 196 | + elseif (!empty($_COOKIE['spip_admin'])) { |
|
| 197 | + $corps = bouton_action(_T('public:lien_connecter'),generer_url_public('login')); |
|
| 198 | + } |
|
| 199 | + else { |
|
| 200 | + $corps = bouton_action(_T('public:accueil_site'),$GLOBALS['meta']['adresse_site']); |
|
| 201 | + } |
|
| 202 | + $corps = "<div class='boutons'>$corps</div>"; |
|
| 203 | + spip_log($nom . " $titre " . $_SERVER['REQUEST_URI']); |
|
| 204 | + } |
|
| 205 | + |
|
| 206 | + if (!_AJAX) { |
|
| 207 | + if (isset($options['status'])) { |
|
| 208 | + http_status($options['status']); |
|
| 209 | + } |
|
| 210 | + |
|
| 211 | + return install_debut_html($titre, $options['onload'], $options['all_inline']) |
|
| 212 | + . $corps |
|
| 213 | + . install_fin_html(); |
|
| 214 | + } else { |
|
| 215 | + include_spip('inc/headers'); |
|
| 216 | + include_spip('inc/actions'); |
|
| 217 | + $url = self('&', true); |
|
| 218 | + foreach ($_POST as $v => $c) { |
|
| 219 | + $url = parametre_url($url, $v, $c, '&'); |
|
| 220 | + } |
|
| 221 | + ajax_retour("<div>" . $titre . redirige_formulaire($url) . "</div>", false); |
|
| 222 | + } |
|
| 223 | 223 | } |
@@ -74,7 +74,7 @@ discard block |
||
| 74 | 74 | lire_fichier($file, $c); |
| 75 | 75 | $css .= $c; |
| 76 | 76 | } |
| 77 | - $css = "<style type='text/css'>" . $css . "</style>"; |
|
| 77 | + $css = "<style type='text/css'>".$css."</style>"; |
|
| 78 | 78 | } else { |
| 79 | 79 | foreach ($files as $name) { |
| 80 | 80 | $file = direction_css(find_in_theme($name)); |
@@ -87,19 +87,19 @@ discard block |
||
| 87 | 87 | define('_DOCTYPE_ECRIRE', ''); |
| 88 | 88 | } |
| 89 | 89 | |
| 90 | - return _DOCTYPE_ECRIRE . |
|
| 91 | - html_lang_attributes() . |
|
| 92 | - "<head>\n" . |
|
| 93 | - "<title>" . |
|
| 94 | - textebrut($titre) . |
|
| 95 | - "</title>\n" . |
|
| 96 | - "<meta name='viewport' content='width=device-width' />\n" . |
|
| 97 | - $css . |
|
| 90 | + return _DOCTYPE_ECRIRE. |
|
| 91 | + html_lang_attributes(). |
|
| 92 | + "<head>\n". |
|
| 93 | + "<title>". |
|
| 94 | + textebrut($titre). |
|
| 95 | + "</title>\n". |
|
| 96 | + "<meta name='viewport' content='width=device-width' />\n". |
|
| 97 | + $css. |
|
| 98 | 98 | "</head> |
| 99 | -<body" . $onLoad . " class='minipres'> |
|
| 99 | +<body" . $onLoad." class='minipres'> |
|
| 100 | 100 | <div id='minipres'> |
| 101 | 101 | <h1>" . |
| 102 | - $titre . |
|
| 102 | + $titre. |
|
| 103 | 103 | "</h1> |
| 104 | 104 | <div>\n"; |
| 105 | 105 | } |
@@ -181,7 +181,7 @@ discard block |
||
| 181 | 181 | |
| 182 | 182 | $titre = ($titre == 'install') |
| 183 | 183 | ? _T('avis_espace_interdit') |
| 184 | - : $titre . ' : ' . _T('info_acces_interdit'); |
|
| 184 | + : $titre.' : '._T('info_acces_interdit'); |
|
| 185 | 185 | |
| 186 | 186 | $statut = isset($GLOBALS['visiteur_session']['statut']) ? $GLOBALS['visiteur_session']['statut'] : ''; |
| 187 | 187 | $nom = isset($GLOBALS['visiteur_session']['nom']) ? $GLOBALS['visiteur_session']['nom'] : ''; |
@@ -191,16 +191,16 @@ discard block |
||
| 191 | 191 | } |
| 192 | 192 | |
| 193 | 193 | if ($statut AND test_espace_prive()) { |
| 194 | - $corps = bouton_action(_T('public:accueil_site'),generer_url_ecrire('accueil')); |
|
| 194 | + $corps = bouton_action(_T('public:accueil_site'), generer_url_ecrire('accueil')); |
|
| 195 | 195 | } |
| 196 | 196 | elseif (!empty($_COOKIE['spip_admin'])) { |
| 197 | - $corps = bouton_action(_T('public:lien_connecter'),generer_url_public('login')); |
|
| 197 | + $corps = bouton_action(_T('public:lien_connecter'), generer_url_public('login')); |
|
| 198 | 198 | } |
| 199 | 199 | else { |
| 200 | - $corps = bouton_action(_T('public:accueil_site'),$GLOBALS['meta']['adresse_site']); |
|
| 200 | + $corps = bouton_action(_T('public:accueil_site'), $GLOBALS['meta']['adresse_site']); |
|
| 201 | 201 | } |
| 202 | 202 | $corps = "<div class='boutons'>$corps</div>"; |
| 203 | - spip_log($nom . " $titre " . $_SERVER['REQUEST_URI']); |
|
| 203 | + spip_log($nom." $titre ".$_SERVER['REQUEST_URI']); |
|
| 204 | 204 | } |
| 205 | 205 | |
| 206 | 206 | if (!_AJAX) { |
@@ -218,6 +218,6 @@ discard block |
||
| 218 | 218 | foreach ($_POST as $v => $c) { |
| 219 | 219 | $url = parametre_url($url, $v, $c, '&'); |
| 220 | 220 | } |
| 221 | - ajax_retour("<div>" . $titre . redirige_formulaire($url) . "</div>", false); |
|
| 221 | + ajax_retour("<div>".$titre.redirige_formulaire($url)."</div>", false); |
|
| 222 | 222 | } |
| 223 | 223 | } |
@@ -192,11 +192,9 @@ |
||
| 192 | 192 | |
| 193 | 193 | if ($statut AND test_espace_prive()) { |
| 194 | 194 | $corps = bouton_action(_T('public:accueil_site'),generer_url_ecrire('accueil')); |
| 195 | - } |
|
| 196 | - elseif (!empty($_COOKIE['spip_admin'])) { |
|
| 195 | + } elseif (!empty($_COOKIE['spip_admin'])) { |
|
| 197 | 196 | $corps = bouton_action(_T('public:lien_connecter'),generer_url_public('login')); |
| 198 | - } |
|
| 199 | - else { |
|
| 197 | + } else { |
|
| 200 | 198 | $corps = bouton_action(_T('public:accueil_site'),$GLOBALS['meta']['adresse_site']); |
| 201 | 199 | } |
| 202 | 200 | $corps = "<div class='boutons'>$corps</div>"; |