diff --git a/article-dist.html b/article-dist.html index 2feb0fe584d93f9eb029c92c4b64dab1a2f0841a..3d46981d66c706e6be1bb529c6b9658d11a6adf0 100644 --- a/article-dist.html +++ b/article-dist.html @@ -126,10 +126,14 @@ <div class="contenu" id="principal"> <div class="cartouche"> +#DEBUT_SURLIGNE + [(#LOGO_ARTICLE|left)] [<div class="surtitre">(#SURTITRE)</div>] <h1 class="titre-texte">#TITRE</h1> [<div class="surtitre">(#SOUSTITRE)</div>] + +#FIN_SURLIGNE [(#DATE|nom_jour)] [(#DATE|affdate).] </div> <div style="line-height: 0em"> </div><!-- Bug Mozilla http://bugzilla.mozilla.org/show_bug.cgi?id=200510 --> @@ -187,12 +191,14 @@ </div> +#DEBUT_SURLIGNE [<div class="chapo">(#CHAPO)</div>] [<div class="texte">(#TEXTE)</div>] [<div class="ps">(#PS)</div>] [<div class="notes">(#NOTES)</div>] +#FIN_SURLIGNE <BOUCLE_documents_joints(DOCUMENTS) {id_article} {mode=document} {doublons} {"<br>"}> [(#LOGO_DOCUMENT|#URL_DOCUMENT)][<br>(#TITRE)][ - (#DESCRIPTIF)] diff --git a/ecrire/inc_surligne.php3 b/ecrire/inc_surligne.php3 index bab595413eba5bca289d90dbf0af12fa7ef95b64..edd8929082b0673de9d04c15c7b7e5d082010fc0 100644 --- a/ecrire/inc_surligne.php3 +++ b/ecrire/inc_surligne.php3 @@ -100,12 +100,13 @@ function surligner_mots($page, $mots) { // On boucle pour le cas ou` il y a plusieurs zones $p = strpos($page, MARQUEUR_SURLIGNE); - if ($p) { + if ($p !== false) { $debut = ''; while ($p) { $debut .= substr($page, 0, $p-1); $page = substr($page, $p+strlen(MARQUEUR_SURLIGNE)); - $q = strpos($page,MARQUEUR_FSURLIGNE); + if (!$q = strpos($page,MARQUEUR_FSURLIGNE)) + $q = 1+strlen($page); $debut .= trouve_surligne(substr($page, 0, $q-1), $regexp); $page = substr($page, $q+strlen(MARQUEUR_SURLIGNE)+1); $p = strpos($page,MARQUEUR_SURLIGNE); diff --git a/inc-public-global.php3 b/inc-public-global.php3 index cfdfce0a24bd4d17344d290e8a9f53a6e9f645fe..a6e1eff9e4b7c6dd2624da26269324f8a1f9f8d2 100644 --- a/inc-public-global.php3 +++ b/inc-public-global.php3 @@ -126,12 +126,6 @@ function afficher_page_globale ($fond, $delais, &$use_cache) { $page['texte'] = $page_boutons_admin; $page['process_ins'] = 'php'; } - - // Surligne - if ($GLOBALS['var_recherche']) { - include_ecrire("inc_surligne.php3"); - $page['texte'] = surligner_mots($page['texte'], $GLOBALS['var_recherche']); - } } if ($chemin_cache) $page['cache'] = $chemin_cache; diff --git a/inc-public.php3 b/inc-public.php3 index 3e120411ff029c046294b6ead3c8b1d6c524ed85..e9117ffb2d460069e6317090e0e295c242b46201 100644 --- a/inc-public.php3 +++ b/inc-public.php3 @@ -75,11 +75,33 @@ else { afficher_page_si_demande_admin ('page', $page['texte'], $page['cache']); + // Recuperer la resultat dans un buffer + // a la fois pour le content-length et le var_recherche + if ($flag_ob) + ob_start(); + + // envoyer la page if ($page['process_ins'] == 'php') eval('?' . '>' . $page['texte']); // page 'php' else echo $page['texte']; // page tout 'html' + // surlignement des mots recherches + unset ($envoi); + if ($flag_ob) { + $envoi = ob_get_clean(); + if ($var_recherche AND $flag_pcre AND !$flag_preserver) { + include_ecrire("inc_surligne.php3"); + $envoi = surligner_mots($envoi, $var_recherche); + } + } + + if ($envoi) { + @header("Content-Length: ".strlen($envoi)); + @header("Connection: close"); + echo $envoi; + } + terminer_public_global($use_cache, $page['cache']); }