forum_envoi.php3 inc_barre.php3 inc_filtres.php3 inc_texte.php3 inc_tidy.php inc_version.php3 1.30 1.28 1.126 1.221 1.9 1.329 1.31 1.29 1.127 1.222 1.10 1.330

Update of /home/spip-cvs/spip/ecrire
In directory alan:/tmp/cvs-serv16864/ecrire

Modified Files:
  forum_envoi.php3 inc_barre.php3 inc_filtres.php3
  inc_texte.php3 inc_tidy.php inc_version.php3
Log Message:
modifs et nettoayges ; il faut vérifier que tidy fonctionne toujours
sinon : changement de client TeX
(la box d'arno passe du côté serveur)

Index: inc_tidy.php

RCS file: /home/spip-cvs/spip/ecrire/inc_tidy.php,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- inc_tidy.php 19 Jul 2004 04:42:41 -0000 1.9
+++ inc_tidy.php 24 Jul 2004 00:45:07 -0000 1.10
@@ -7,18 +7,16 @@

function version_tidy() {
- $version = 0;
-
- if (function_exists('tidy_parse_string')) {
- $version = 1;
- if (function_exists('tidy_get_body')) {
- $version = 2;
+ static $version = -1;
+ if ($version == -1) {
+ $version = 0;
+ if (function_exists('tidy_parse_string')) {
+ $version = 1;
+ if (function_exists('tidy_get_body')) {
+ $version = 2;
+ }
     }
   }
-
-// $charset = lire_meta('charset');
-// if ($charset != "iso-8859-1" AND $charset != "uft-8") $version = 0;
-
   return $version;
}

@@ -50,21 +48,7 @@
     $letexte = substr($letexte,0,$pos)."@@SPIP_$source$num_echap@@"
       .substr($letexte,$pos+strlen($regs[0]));
   }
-
-/* // et les textarea
- $regexp_echap_cadre = "/<\?((.*?))>/si";
- $source = "php";
-
- while (preg_match($regexp_echap_cadre, $letexte, $regs)) {
- $num_echap++;
-
- $les_echap[$num_echap] = $regs[0];

- $pos = strpos($letexte, $regs[0]);
- $letexte = substr($letexte,0,$pos)."@@SPIP_$source$num_echap@@"
- .substr($letexte,$pos+strlen($regs[0]));
- }*/
-
   return array($letexte, $les_echap);
}

@@ -78,13 +62,12 @@
     $les_echap = $retour_echap[1];

     // Options selon: http://tidy.sourceforge.net/docs/quickref.html
-
     $charset = lire_meta('charset');
     if ($charset == "iso-8859-1") $enc_char = "latin1";
     else if ($charset == "utf-8") $enc_char = "utf8";
+ else return echappe_retour($buffer, $les_echap, "xhtml")r;

     tidy_set_encoding ($enc_char);
-
     tidy_setopt('wrap', 0);
     tidy_setopt('indent-spaces', 4);
     tidy_setopt('output-xhtml', true);
@@ -92,14 +75,15 @@
     tidy_setopt('indent', 5);
     tidy_setopt('show-body-only', false);
     tidy_setopt('quote-nbsp', false);
-
- $html = tidy_parse_string($buffer);
- tidy_clean_repair();
- $tidy = tidy_get_output();
- $tidy = echappe_retour($tidy, $les_echap, "xhtml");
- // En Latin1, tidy ajoute une declaration XML (malgre add-xml-decl a false)
- // il faut le supprimer pour eviter interpretation PHP provoquant une erreur
- $tidy = ereg_replace ("\<\?xml([^\>]*)\>", "", $tidy);
+
+ $tidy = tidy_parse_string($buffer);
+ tidy_clean_repair($tidy);
+ $tidy = tidy_get_output($tidy);
+ $tidy = echappe_retour($tidy, $les_echap, "xhtml");
+ // En Latin1, tidy ajoute une declaration XML
+ // (malgre add-xml-decl a false) ; il faut le supprimer
+ // pour eviter interpretation PHP provoquant une erreur
+ $tidy = ereg_replace ("\<\?xml([^\>]*)\>", "", $tidy);
     return $tidy;
   }
   else if (version_tidy() == "2") {
@@ -107,51 +91,11 @@
       'output-xhtml' => TRUE,
       'wrap' => 200);
     $tidy = tidy_parse_string($buffer, $config, 'UTF8');
- $tidy->cleanRepair();
- return $tidy;
- }
- else return $buffer;
-}
-
-
-
-function xhtml_nettoyer_chaine ($buffer) {
- if (version_tidy() == "1") {
- include_ecrire("inc_texte.php3");
-
- $retour_echap = echappe_xhtml ($buffer);
- $buffer = $retour_echap[0];
- $les_echap = $retour_echap[1];
-
- // Options selon: http://tidy.sourceforge.net/docs/quickref.html
- tidy_set_encoding ("utf8");
- tidy_setopt('wrap', 0);
- tidy_setopt('indent-spaces', 4);
- tidy_setopt('output-xhtml', true);
- tidy_setopt('indent', 5);
- tidy_setopt('show-body-only', true);
- tidy_setopt('quote-nbsp', false);
-
- $html = tidy_parse_string($buffer);
- tidy_clean_repair();
- $tidy = tidy_get_output();
- $tidy = echappe_retour($tidy, $les_echap, "xhtml");
+ tidy_clean_repair($tidy);
     return $tidy;
   }
- else if (version_tidy() == "2") {
- $config = array('indent' => TRUE,
- 'output-xhtml' => TRUE,
- 'wrap' => 200,
- 'show-body-only' => TRUE);
- $tidy = tidy_parse_string($buffer, $config, 'UTF8');
- $tidy->cleanRepair();
- return $tidy;
- }
- else return $buffer;
-}
-
-
-
-
+ else
+ return $buffer;
+}

?>
\ No newline at end of file

Index: inc_filtres.php3

RCS file: /home/spip-cvs/spip/ecrire/inc_filtres.php3,v
retrieving revision 1.126
retrieving revision 1.127
diff -u -d -r1.126 -r1.127
--- inc_filtres.php3 13 Jul 2004 19:48:45 -0000 1.126
+++ inc_filtres.php3 24 Jul 2004 00:45:07 -0000 1.127
@@ -708,13 +708,7 @@

function image_math($tex) {
- // Correction pour forcer la ligne de base
- $tex = "\large\\setbox1=\\hbox{\$\\displaystyle ".$tex."\$}\n"
- ."\\newdimen\\haut\n\\newdimen\prof\n"
- ."\\haut=\\ht1\n\\prof=\\dp1\n"
- ."\\ifdim\\haut>\\prof\\prof=\\haut\\else\\haut=\\prof\\fi\n"
- ."\\advance\haut by .5em\n"
- ."\\color{white}\\vrule height \\haut depth \\prof width 0.1pt\\color{black}\\box1";
+spip_log($tex);

   // Regarder dans le repertoire local des images TeX
   $dir = ($GLOBALS['flag_ecrire'] ? '../' : '').'IMG/TeX';

Index: inc_texte.php3

RCS file: /home/spip-cvs/spip/ecrire/inc_texte.php3,v
retrieving revision 1.221
retrieving revision 1.222
diff -u -d -r1.221 -r1.222
--- inc_texte.php3 15 Jul 2004 12:18:35 -0000 1.221
+++ inc_texte.php3 24 Jul 2004 00:45:07 -0000 1.222
@@ -216,39 +216,21 @@
     $texte_milieu = substr($texte_a_voir, $debut+strlen("<math>"), $fin-$debut-strlen("<math></math>"));
     $texte_fin = substr($texte_a_voir, $fin, strlen($texte_a_voir));

- $traiter_math = "image";
- //$traiter_math = "mathml";
-
- if ($traiter_math == "image") {
- while((ereg("(\\$){2}([^$]+)(\\$){2}",$texte_milieu, $regs))) {
- $num_echap++;
- $les_echap[$num_echap] = "\n<p class=\"spip\" style=\"text-align: center;\">".image_math($regs[2])."</p>\n";
- $pos = strpos($texte_milieu, $regs[0]);
- $texte_milieu = substr($texte_milieu,0,$pos)."@@SPIP_$source$num_echap@@"
- .substr($texte_milieu,$pos+strlen($regs[0]));
- }
- while((ereg("(\\$){1}([^$]+)(\\$){1}",$texte_milieu, $regs))) {
- $num_echap++;
- $les_echap[$num_echap] = image_math($regs[2]);
- $pos = strpos($texte_milieu, $regs[0]);
- $texte_milieu = substr($texte_milieu,0,$pos)."@@SPIP_$source$num_echap@@"
- .substr($texte_milieu,$pos+strlen($regs[0]));
- }
- } else {
- while((ereg("(\\$){2}([^$]+)(\\$){2}",$texte_milieu, $regs))) {
- $num_echap++;
- $les_echap[$num_echap] = "\n<p class=\"spip\" style=\"text-align: center;\">".mathml_math($regs[2])."</p>\n";
- $pos = strpos($texte_milieu, $regs[0]);
- $texte_milieu = substr($texte_milieu,0,$pos)."@@SPIP_$source$num_echap@@"
- .substr($texte_milieu,$pos+strlen($regs[0]));
- }
- while((ereg("(\\$){1}([^$]+)(\\$){1}",$texte_milieu, $regs))) {
- $num_echap++;
- $les_echap[$num_echap] = mathml_math($regs[2]);
- $pos = strpos($texte_milieu, $regs[0]);
- $texte_milieu = substr($texte_milieu,0,$pos)."@@SPIP_$source$num_echap@@"
- .substr($texte_milieu,$pos+strlen($regs[0]));
- }
+ $traiter_math = "image_math"; // "mathml_math";
+
+ while((ereg("[$][$]([^$]+)[$][$]",$texte_milieu, $regs))) {
+ $num_echap++;
+ $les_echap[$num_echap] = "\n<p class=\"spip\" style=\"text-align: center;\">".$traiter_math($regs[1])."</p>\n";
+ $pos = strpos($texte_milieu, $regs[0]);
+ $texte_milieu = substr($texte_milieu,0,$pos)."@@SPIP_$source$num_echap@@"
+ .substr($texte_milieu,$pos+strlen($regs[0]));
+ }
+ while((ereg("[$]([^$]+)[$]",$texte_milieu, $regs))) {
+ $num_echap++;
+ $les_echap[$num_echap] = $traiter_math($regs[1]);
+ $pos = strpos($texte_milieu, $regs[0]);
+ $texte_milieu = substr($texte_milieu,0,$pos)."@@SPIP_$source$num_echap@@"
+ .substr($texte_milieu,$pos+strlen($regs[0]));
     }

     $texte_a_voir = $texte_debut.$texte_milieu.$texte_fin;
@@ -900,7 +882,6 @@

   $letexte = "\n".trim($letexte);

-
   // les listes
   if (ereg("\n-[*#]", $letexte))
     $letexte = traiter_listes($letexte);

Index: forum_envoi.php3

RCS file: /home/spip-cvs/spip/ecrire/forum_envoi.php3,v
retrieving revision 1.30
retrieving revision 1.31
diff -u -d -r1.30 -r1.31
--- forum_envoi.php3 20 Apr 2004 12:31:38 -0000 1.30
+++ forum_envoi.php3 24 Jul 2004 00:45:06 -0000 1.31
@@ -40,9 +40,9 @@
     $id_message = $row['id_message'];
     $id_syndic = $row['id_syndic'];
     $statut = $row['statut'];
- $titre_parent = stripslashes($row['titre']);
- $texte_parent = stripslashes($row['texte']);
- $auteur_parent = stripslashes($row['auteur']);
+ $titre_parent = $row['titre'];
+ $texte_parent = $row['texte'];
+ $auteur_parent = $row['auteur'];
     $id_auteur_parent = $row['id_auteur'];
     $date_heure_parent = $row['date_heure'];
     $nom_site_parent = $row['nom_site'];

Index: inc_version.php3

RCS file: /home/spip-cvs/spip/ecrire/inc_version.php3,v
retrieving revision 1.329
retrieving revision 1.330
diff -u -d -r1.329 -r1.330
--- inc_version.php3 23 Jul 2004 23:13:26 -0000 1.329
+++ inc_version.php3 24 Jul 2004 00:45:07 -0000 1.330
@@ -838,12 +838,14 @@
//
function _T($text, $args = '') {
   include_ecrire('inc_lang.php3');
- $chaine = traduire_chaine($text, $args);
-
+ $text = traduire_chaine($text, $args);
+
+ if ($GLOBALS['xhtml']) {
     include_ecrire("inc_charsets.php3");
- $chaine = html2unicode($chaine);
+ $text = html2unicode($text);
+ }

- return $chaine;
+ return $text;
}

// chaines en cours de traduction

Index: inc_barre.php3

RCS file: /home/spip-cvs/spip/ecrire/inc_barre.php3,v
retrieving revision 1.28
retrieving revision 1.29
diff -u -d -r1.28 -r1.29
--- inc_barre.php3 19 Jul 2004 04:42:41 -0000 1.28
+++ inc_barre.php3 24 Jul 2004 00:45:06 -0000 1.29
@@ -7,8 +7,7 @@
//include_ecrire ("inc_layers.php3"); // (pour memoire)

function test_barre() {
- global $HTTP_UA_OS, $browser_name, $browser_version, $browser_description, $browser_rev;
- global $xhtml;
+ global $browser_name, $browser_version, $browser_rev;
   
   if ($browser_name == '') verif_butineur();

@@ -21,8 +20,7 @@

function test_claret() {
- global $HTTP_UA_OS, $browser_name, $browser_version, $browser_description, $browser_rev;
-
+ global $browser_name;
   if ( test_barre() && (eregi("msie", $browser_name)) ) return true;
}