diff --git a/ecrire/aide_droite.php3 b/ecrire/aide_droite.php3 index cb32c8ed8c4e760b1ef551bbdc046b5d0f274382..3eedaa85219c5a49496bcec65f7dcc4d430aefc2 100644 --- a/ecrire/aide_droite.php3 +++ b/ecrire/aide_droite.php3 @@ -9,10 +9,48 @@ if (file_exists("inc_connect.php3")) { include_ecrire ("inc_lang.php3"); utiliser_langue_visiteur(); +if ($var_lang) changer_langue($var_lang); -include_ecrire ("inc_texte.php3"); -include_ecrire ("inc_filtres.php3"); +// Selection du fichier d'aide correspondant a la langue +function fichier_aide($lang_aide) { + if (@file_exists($fichier_aide = "AIDE/$lang_aide/aide")) + return array($fichier_aide, $lang_aide); + else // reduction ISO du code langue oci_prv_ni => oci_prv => oci + if (ereg("(.*)_", $lang_aide, $regs)) + return fichier_aide($regs[1]); + + return false; +} +if (!$aide) $aide = 'spip'; +$lang_aide = $spip_lang; + +// Recuperation du contenu de l'aide demandee +list($fichier_aide, $l) = fichier_aide($lang_aide); +if (!$fichier_aide) + $html = _T('aide_non_disponible'); +else { + $lastmodified = filemtime($fichier_aide); + $headers_only = http_last_modified($lastmodified); + if ($headers_only) exit; + + $html = join('', file($fichier_aide)); + $html = substr($html, strpos($html,"<$aide>") + strlen("<$aide>")); + $html = substr($html, 0, strpos($html, "</$aide>")); + + // Localisation des images de l'aide (si disponibles) + $suite = $html; + $html = ""; + while (ereg("AIDE/([-_a-zA-Z0-9]+\.(gif|jpg))", $suite, $r)) { + $f = $r[1]; + if (file_exists("AIDE/$l/$f")) $f = "$l/$f"; + else if (file_exists("AIDE/fr/$f")) $f = "fr/$f"; + $p = strpos($suite, $r[0]); + $html .= substr($suite, 0, $p) . "AIDE/$f"; + $suite = substr($suite, $p + strlen($r[0])); + } + $html .= $suite; +} ?> <html> @@ -70,13 +108,15 @@ table.spip td { </head> <?php +include_ecrire ("inc_texte.php3"); +include_ecrire ("inc_filtres.php3"); + echo '<body bgcolor="#FFFFFF" text="#000000" TOPMARGIN="24" LEFTMARGIN="24" MARGINWIDTH="24" MARGINHEIGHT="24"'; if ($spip_lang_rtl) echo " dir='rtl'"; echo ">"; -if (!$aide) { - $aide = 'spip'; +if ($aide == 'spip') { echo '<TABLE BORDER=0 WIDTH=100% HEIGHT=60%> <TR WIDTH=100% HEIGHT=60%> <TD WIDTH=100% HEIGHT=60% ALIGN="center" VALIGN="middle"> @@ -88,39 +128,6 @@ if (!$aide) { </TD></TR></TABLE>'; } - -// Selection du fichier d'aide correspondant a la langue -function fichier_aide($lang_aide, $aide) { - if (@file_exists($fichier_aide = "AIDE/$lang_aide/aide")) { - $html = join('', file($fichier_aide)); - $html = substr($html, strpos($html,"<$aide>") + strlen("<$aide>")); - $html = substr($html, 0, strpos($html, "</$aide>")); - } - else // reduction ISO du code langue oci_prv_ni => oci_prv => oci - if (ereg("(.*)_", $lang_aide, $regs)) - list($html,$lang_aide) = fichier_aide($regs[1], $aide); - - return array($html,$lang_aide); -} - -$lang_aide = $GLOBALS['spip_lang']; -list($html,$l) = fichier_aide($lang_aide, $aide); -if (!$html) - $html = _T('aide_non_disponible'); - -// Localisation des images de l'aide (si disponibles) -$suite = $html; -$html = ""; -while (ereg("AIDE/([-_a-zA-Z0-9]+\.(gif|jpg))", $suite, $r)) { - $f = $r[1]; - if (file_exists("AIDE/$l/$f")) $f = "$l/$f"; - else if (file_exists("AIDE/fr/$f")) $f = "fr/$f"; - $p = strpos($suite, $r[0]); - $html .= substr($suite, 0, $p) . "AIDE/$f"; - $suite = substr($suite, $p + strlen($r[0])); -} -$html .= $suite; - // hack pour que la langue de typo() soit celle de l'aide en ligne $spip_lang = $lang_aide; diff --git a/ecrire/aide_gauche.php3 b/ecrire/aide_gauche.php3 index 1bd9aa6dee17b8fb984e263b0a138eccb30e0922..46345ccc492c0addeb9864e17e35835554045c10 100644 --- a/ecrire/aide_gauche.php3 +++ b/ecrire/aide_gauche.php3 @@ -2,6 +2,10 @@ include ("inc_version.php3"); +$lastmodified = filemtime("aide_gauche.php3"); +$headers_only = http_last_modified($lastmodified, time() + 24 * 3600); +if ($headers_only) exit; + if (file_exists($flag_ecrire ? "inc_connect.php3" : "ecrire/inc_connect.php3")) { include_ecrire("inc_auth.php3"); $aide_statut = ($connect_statut == '1comite') ? 'redac' : 'admin'; @@ -10,6 +14,7 @@ else $aide_statut = 'admin'; include_ecrire("inc_lang.php3"); utiliser_langue_visiteur(); +if ($var_lang) changer_langue($var_lang); ?> <HTML> diff --git a/ecrire/aide_index.php3 b/ecrire/aide_index.php3 index 01a0bd8432988eb9b93d75f7a80aa01ec8508107..1d40d418c96208108f7eef5c0ef1c5d3cd9352b7 100644 --- a/ecrire/aide_index.php3 +++ b/ecrire/aide_index.php3 @@ -2,6 +2,10 @@ include ("inc_version.php3"); +$lastmodified = filemtime("aide_index.php3"); +$headers_only = http_last_modified($lastmodified, time() + 24 * 3600); +if ($headers_only) exit; + // Recuperer les infos de langue (preferences auteur), si possible if (file_exists("inc_connect.php3")) { include_ecrire ("inc_auth.php3"); @@ -9,14 +13,15 @@ if (file_exists("inc_connect.php3")) { include_ecrire("inc_lang.php3"); utiliser_langue_visiteur(); +if ($var_lang) changer_langue($var_lang); echo "<HTML>"; echo "<HEAD>"; echo "<TITLE dir=\"".($spip_lang_rtl ? 'rtl' : 'ltr')."\">"._T('info_aide_en_ligne')."</TITLE>"; echo "</HEAD>"; -$frame_menu = "<frame src=\"aide_gauche.php3?aide=$aide&les_rub=$les_rub#$ancre\" name=\"gauche\" scrolling=\"auto\" noresize>\n"; -$frame_body = "<frame src=\"aide_droite.php3?aide=$aide\" name=\"droite\" scrolling=\"auto\" noresize>\n"; +$frame_menu = "<frame src=\"aide_gauche.php3?aide=$aide&les_rub=$les_rub&var_lang=$spip_lang#$ancre\" name=\"gauche\" scrolling=\"auto\" noresize>\n"; +$frame_body = "<frame src=\"aide_droite.php3?aide=$aide&var_lang=$spip_lang\" name=\"droite\" scrolling=\"auto\" noresize>\n"; if ($spip_lang_rtl) { echo '<frameset cols="*,160" border="0" frameborder="0" framespacing="0">'; diff --git a/ecrire/inc_presentation.php3 b/ecrire/inc_presentation.php3 index 7a3afa2c981e583d05aaaba7874048a09842fa53..483ece5d3cde02a33f3b77068e320c514c95755c 100644 --- a/ecrire/inc_presentation.php3 +++ b/ecrire/inc_presentation.php3 @@ -13,11 +13,11 @@ utiliser_langue_visiteur(); // Aide // function aide($aide='') { - global $couleur_foncee, $spip_lang_rtl, $dir_ecrire; + global $couleur_foncee, $spip_lang, $spip_lang_rtl, $dir_ecrire; if (!$aide) return; - return " <a class='aide' href=\"".$dir_ecrire."aide_index.php3?aide=$aide\" target=\"spip_aide\" ". + return " <a class='aide' href=\"".$dir_ecrire."aide_index.php3?aide=$aide&var_lang=$spip_lang\" target=\"spip_aide\" ". "onclick=\"javascript:window.open(this.href, 'spip_aide', 'scrollbars=yes, ". "resizable=yes, width=740, height=580'); return false;\"><img ". "src=\"img_pack/aide.gif\" alt=\""._T('info_image_aide')."\" ". @@ -1336,7 +1336,7 @@ function debut_page($titre = "", $rubrique = "asuivre", $sous_rubrique = "asuivr global $connect_toutes_rubriques; global $auth_can_disconnect, $connect_login; global $options, $spip_display, $spip_ecran; - global $spip_lang_rtl; + global $spip_lang, $spip_lang_rtl; $activer_messagerie = lire_meta("activer_messagerie"); global $clean_link; @@ -1399,7 +1399,7 @@ function debut_page($titre = "", $rubrique = "asuivre", $sous_rubrique = "asuivr echo "</tr></table>\n"; echo "<table class='droite'><tr>\n"; - icone_bandeau_principal (_T('icone_aide_ligne'), "javascript:window.open('aide_index.php3', 'aide_spip', 'scrollbars=yes,resizable=yes,width=740,height=580');", "aide-48$spip_lang_rtl.gif", "vide", "", "aide_index.php3"); + icone_bandeau_principal (_T('icone_aide_ligne'), "javascript:window.open('aide_index.php3?var_lang=$spip_lang', 'aide_spip', 'scrollbars=yes,resizable=yes,width=740,height=580');", "aide-48$spip_lang_rtl.gif", "vide", "", "aide_index.php3?var_lang=$spip_lang"); icone_bandeau_principal (_T('icone_visiter_site'), "$adresse_site", "visiter-48$spip_lang_rtl.gif"); echo "</tr></table>\n"; diff --git a/ecrire/inc_version.php3 b/ecrire/inc_version.php3 index 6d29010620c3cde6594cd5762d9c7531aacba1cb..82a505913c98c54fd00b53b134509b6c9a10f2a7 100644 --- a/ecrire/inc_version.php3 +++ b/ecrire/inc_version.php3 @@ -378,6 +378,21 @@ function http_status($status) { else Header("HTTP/1.0 ".$status_string[$status]); } +function http_last_modified($lastmodified, $expire = 0) { + $gmoddate = gmdate("D, d M Y H:i:s", $lastmodified); + if ($GLOBALS['HTTP_IF_MODIFIED_SINCE']) { + $if_modified_since = ereg_replace(';.*$', '', $GLOBALS['HTTP_IF_MODIFIED_SINCE']); + $if_modified_since = trim(str_replace('GMT', '', $if_modified_since)); + if ($if_modified_since == $gmoddate) { + http_status(304); + $headers_only = true; + } + } + @Header ("Last-Modified: ".$gmoddate." GMT"); + if ($expire) + @Header ("Expires: ".gmdate("D, d M Y H:i:s", $expire)." GMT"); + return $headers_only; +} $flag_upload = (!$flag_get_cfg_var || (get_cfg_var('upload_max_filesize') > 0)); diff --git a/ecrire/spip_style.php3 b/ecrire/spip_style.php3 index 401efc4d49645cf6278937330e9abccbf718ba97..2c29eb7ab3177c718456966702bb6c87d6758d60 100644 --- a/ecrire/spip_style.php3 +++ b/ecrire/spip_style.php3 @@ -9,15 +9,7 @@ // En-tetes $lastmodified = @filemtime("spip_style.php3"); - $gmoddate = gmdate("D, d M Y H:i:s", $lastmodified); - $if_modified_since = ereg_replace(';.*$', '', $HTTP_IF_MODIFIED_SINCE); - $if_modified_since = trim(str_replace('GMT', '', $if_modified_since)); - if ($if_modified_since == $gmoddate) { - http_status(304); - $headers_only = true; - } - @Header ("Last-Modified: ".$gmoddate." GMT"); - @Header ("Expires: ".gmdate("D, d M Y H:i:s", $lastmodified + 7 * 24 * 3600)." GMT"); + $headers_only = http_last_modified($lastmodified, time() + 24 * 3600); @Header ("Content-Type: text/css"); if ($headers_only) exit; diff --git a/inc-public-global.php3 b/inc-public-global.php3 index 9c8398775fb3e0271891b2096ab7852aade86aca..6f77909bb3a28118753e49f724734108fed8811f 100644 --- a/inc-public-global.php3 +++ b/inc-public-global.php3 @@ -166,17 +166,8 @@ $effacer_cache |= $ecraser_cache; // ecraser le cache de l'article x s'il n'est // Envoyer les entetes $headers_only = ($HTTP_SERVER_VARS['REQUEST_METHOD'] == 'HEAD'); if (!$effacer_cache && !$flag_dynamique && $recalcul != 'oui' && !$HTTP_COOKIE_VARS['spip_admin']) { - if ($lastmodified) { - $gmoddate = gmdate("D, d M Y H:i:s", $lastmodified); - $if_modified_since = ereg_replace(';.*$', '', $HTTP_IF_MODIFIED_SINCE); - $if_modified_since = trim(str_replace('GMT', '', $if_modified_since)); - if ($if_modified_since == $gmoddate) { - http_status(304); - $headers_only = true; - } - @Header ("Last-Modified: ".$gmoddate." GMT"); - @Header ("Expires: ".gmdate("D, d M Y H:i:s", $lastmodified + $delais)." GMT"); - } + if ($lastmodified) + $headers_only |= http_last_modified($lastmodified, $lastmodified + $delais); } else { @Header("Expires: 0");