Update of /home/spip-cvs/spip
In directory alan:/tmp/cvs-serv16887
Modified Files:
inc-calcul-squel.php3 inc-champ-squel.php3
inc-public-global.php3
Log Message:
Multilinguisme basé visiteur
Index: inc-calcul-squel.php3
RCS file: /home/spip-cvs/spip/inc-calcul-squel.php3,v
retrieving revision 1.200
retrieving revision 1.201
diff -u -d -r1.200 -r1.201
--- a/inc-calcul-squel.php3 9 Apr 2004 11:32:32 -0000 1.200
+++ b/inc-calcul-squel.php3 11 Apr 2004 13:03:56 -0000 1.201
@@ -1318,6 +1318,19 @@
break;
//
+ // Formulaire de changement de langue
+ case 'FORMULAIRE_LANG':
+ $milieu = '
+ $'.$nom_var.' = "<"."?php
+ include_ecrire(\"inc_lang.php3\");
+ echo menu_langues(\"var_lang\", \$menu_lang);
+ ?".">";
+ ';
+
+ break;
+
+
+ //
// Formulaire pour ecrire a l'auteur
//
case 'FORMULAIRE_ECRIRE_AUTEUR':
Index: inc-champ-squel.php3
RCS file: /home/spip-cvs/spip/inc-champ-squel.php3,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -d -r1.11 -r1.12
--- a/inc-champ-squel.php3 9 Apr 2004 11:32:32 -0000 1.11
+++ b/inc-champ-squel.php3 11 Apr 2004 13:03:56 -0000 1.12
@@ -92,7 +92,7 @@
'TAILLE', 'EXTENSION', 'DEBUT_SURLIGNE', 'FIN_SURLIGNE',
'TYPE_DOCUMENT', 'EXTENSION_DOCUMENT', 'FORMULAIRE_ADMIN',
'LOGIN_PRIVE', 'LOGIN_PUBLIC', 'URL_LOGOUT', 'PUCE', 'EXTRA',
- 'ON_OFF', 'EXPOSER'
+ 'ON_OFF', 'EXPOSER', 'FORMULAIRE_LANG'
);
reset($c);
while (list(, $val) = each($c)) {
Index: inc-public-global.php3
RCS file: /home/spip-cvs/spip/inc-public-global.php3,v
retrieving revision 1.90
retrieving revision 1.91
diff -u -d -r1.90 -r1.91
--- a/inc-public-global.php3 19 Mar 2004 16:10:28 -0000 1.90
+++ b/inc-public-global.php3 11 Apr 2004 13:03:56 -0000 1.91
@@ -21,6 +21,24 @@
// Inclusions de squelettes
//
+function chercher_langue_squelette ($fichier_cache, $contexte='') {
+ global $lang, $multilang, $spip_lang;
+
+ // multilingue visiteur
+ if ($contexte['lang'])
+ $lang_squel = $contexte['lang'];
+ else if ($lang)
+ $contexte['lang'] = $lang_squel = $lang;
+ else if ($multilang) {
+ include_ecrire('inc_lang.php3');
+ utiliser_langue_visiteur();
+ $contexte['lang'] = $lang_squel = $spip_lang;
+ $fichier_cache .= "-$lang_squel";
+ }
+
+ return array($fichier_cache, $lang_squel, $contexte);
+}
+
function inclure_fichier($fond, $delais, $contexte_inclus = "") {
global $fichier_cache;
$fichier_requete = $fond;
@@ -30,15 +48,17 @@
$fichier_requete .= '&'.$key.'='.$val;
}
$fichier_cache = generer_nom_fichier_cache($fichier_requete);
- $chemin_cache = "CACHE/$fichier_cache";
+ list($fichier_cache, $lang_squel, $contexte_inclus) = chercher_langue_squelette ($fichier_cache, $contexte_inclus);
+
+ $chemin_cache = "CACHE/$fichier_cache";
$use_cache = utiliser_cache($chemin_cache, $delais);
if (!$use_cache) {
include_local("inc-calcul.php3");
$timer_a = explode(" ", microtime());
- $fond = chercher_squelette($fond, $contexte_inclus['id_rubrique'], $contexte_inclus['lang']);
+ $fond = chercher_squelette($fond, $contexte_inclus['id_rubrique'], $lang_squel);
$page = calculer_page($fond, $contexte_inclus);
$timer_b = explode(" ", microtime());
if ($page) {
@@ -53,14 +73,42 @@
//
+// Authentification
+//
+
+if ($HTTP_COOKIE_VARS['spip_session'] OR ($PHP_AUTH_USER AND !$ignore_auth_http)) {
+ include_ecrire ("inc_session.php3");
+ verifier_visiteur();
+}
+
+
+//
+// Gerer modif langue visiteur
+//
+if ($HTTP_COOKIE_VARS['spip_lang']) {
+ include_ecrire('inc_lang.php3');
+ utiliser_langue_visiteur();
+}
+if ($var_lang) {
+ include_ecrire('inc_lang.php3');
+ gerer_menu_langues();
+}
+$menu_lang = $GLOBALS['spip_lang'];
+
+
+//
// Gestion du cache et calcul de la page
//
+// nom du fichier cache
$fichier_requete = $REQUEST_URI;
$fichier_requete = strtr($fichier_requete, '?', '&');
$fichier_requete = eregi_replace('&(submit|valider|PHPSESSID|(var_[^=&]*)|recalcul)=[^&]*', '', $fichier_requete);
$fichier_cache = generer_nom_fichier_cache($fichier_requete);
+
+list ($fichier_cache, $lang_squel) = chercher_langue_squelette($fichier_cache, $contexte);
+if ($multilang AND !$lang) $lang = $lang_squel;
$chemin_cache = "CACHE/$fichier_cache";
$use_cache = utiliser_cache($chemin_cache, $delais);
@@ -74,16 +122,6 @@
//
-// Authentification
-//
-
-if ($HTTP_COOKIE_VARS['spip_session'] OR ($PHP_AUTH_USER AND !$ignore_auth_http)) {
- include_ecrire ("inc_session.php3");
- verifier_visiteur();
-}
-
-
-//
// Ajouter un forum
//
@@ -132,6 +170,7 @@
if ($calculer_cache) {
include_local ("inc-calcul.php3");
$timer_a = explode(" ", microtime());
+
$page = calculer_page_globale($fond);
$timer_b = explode(" ", microtime());
if ($page) {