From 83db28587053be4172d7e93cb147d8b48c4ee35a Mon Sep 17 00:00:00 2001 From: "Committo,Ergo:sum" <esj@rezo.net> Date: Wed, 20 Dec 2006 23:11:12 +0000 Subject: [PATCH] =?UTF-8?q?Retour=20du=20bon=20controle=20des=20idref=20(d?= =?UTF-8?q?=C3=A9sol=C3=A9=20C=C3=A9dric,=20les=20objets=20en=20PHP=20c'es?= =?UTF-8?q?t=20encore=20pire=20qu'ailleurs).=20Et=20donner=20la=20liste=20?= =?UTF-8?q?des=20attributs=20licites,=20mais=20au=20survol=20de=20la=20sou?= =?UTF-8?q?ris=20parce=20dit=20des=20dizaines=20de=20fois=20c'est=20insupp?= =?UTF-8?q?ortable=20tellement=20il=20y=20en=20a.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ecrire/inc/valider_xml.php | 39 +++++++++++++++++++++++--------------- ecrire/public/debug.php | 16 ++++++++++++++-- 2 files changed, 38 insertions(+), 17 deletions(-) diff --git a/ecrire/inc/valider_xml.php b/ecrire/inc/valider_xml.php index 5463ee2a57..6235d1d0d3 100644 --- a/ecrire/inc/valider_xml.php +++ b/ecrire/inc/valider_xml.php @@ -148,16 +148,15 @@ function validerElement($parser, $name, $attrs) $pere = $r[1]; if (isset($phraseur_xml->elements[$pere])) if (!@in_array($name, $phraseur_xml->elements[$pere])) { - $bons_peres = @join ('</b>, <b>', $phraseur_xml->peres[$name]); - $phraseur_xml->err[]= " <b>$name</b>" - . _L(" n'est pas un fils de ") - . '<b>' - . $pere - . '</b>' - . (!$bons_peres ? '' - : (_L( '<p style="font-size: 80%"> mais de <b>') . $bons_peres . '</b></p>')) - . coordonnees_erreur($parser); - } + $bons_peres = @join ('</b>, <b>', $phraseur_xml->peres[$name]); + $phraseur_xml->err[]= " <b>$name</b>" + . _L(" n'est pas un fils de ") + . '<b>' + . $pere + . '</b>' + . (!$bons_peres ? '' + : (_L( '<p style="font-size: 80%"> mais de <b>') . $bons_peres . '</b></p>')); + } } } if (isset($phraseur_xml->attributs[$name])) { @@ -184,12 +183,20 @@ function validerAttribut($parser, $name, $val, $bal) return ; $a = $phraseur_xml->attributs[$bal]; - if (!isset($a[$name])) + if (!isset($a[$name])) { + $bons = join(', ',array_keys($a)); + if ($bons) + $bons = " title=' " . + _L('attributs connus: ') . + $bons . + "'"; + $bons .= " style='font-weight: bold'"; $phraseur_xml->err[]= " <b>$name</b>" . _L(' attribut inconnu de ') - . "<b>$bal</b>" + . "<a$bons>$bal</a>" + . _L(" (survoler pour voir les corrects)") . coordonnees_erreur($parser); - else{ + } else{ $type = $a[$name][0]; if ($type[0]=='/') { if (!preg_match($a[$name][0], $val)) { @@ -261,8 +268,10 @@ function defautElement($phraseur, $data) // http://doc.spip.org/@phraserTout function phraserTout($phraseur, $data) { + global $phraseur_xml; + validateur($data); - if (isset($this->entites['HTMLsymbol'])) + if (isset($phraseur_xml->entites['HTMLsymbol'])) $data = unicode2charset(html2unicode($data, true)); @@ -272,7 +281,7 @@ function phraserTout($phraseur, $data) foreach ($this->idrefs as $idref) { list($nom, $ligne, $col) = $idref; if (!isset($phraseur_xml->ids[$nom])) - $this->err[]= " <p><b>$nom</b>" + $phraseur_xml->err[]= " <p><b>$nom</b>" . _L(" ID inconnu ") . $ligne . " " diff --git a/ecrire/public/debug.php b/ecrire/public/debug.php index 9b82aec1a3..874f504c29 100644 --- a/ecrire/public/debug.php +++ b/ecrire/public/debug.php @@ -536,7 +536,19 @@ function emboite_texte($texte, $fonc='',$self='') $GLOBALS['xhtml_error'], $regs, PREG_SET_ORDER); - $err = '<tr><th>#</th><th>Occ.</th><th>Li.</th><th>Col.</th><th>Err.</th></tr>'; + + $err = '<tr><th>' + . _L('Numero') + . "</th><th>" + . _L('Occurrence') + . "</th><th>" + . _L('Ligne') + . "</th><th>" + . _L('Colonne') + . "</th><th>" + . _L('Erreur') + . "</th></tr>"; + $fautifs = array(); $i = 0; $encore = array(); @@ -572,7 +584,7 @@ function emboite_texte($texte, $fonc='',$self='') . $i . "<a href='#fin_err'>" . _L(' erreur(s)') - . "</a></h2><table id='debut_err'>" + . "</a></h2><table id='debut_err' style='width: 100%'>" . $err . " </table><a id='fin_err'></a>"; return array(ancre_texte($texte, $fautifs), $err); -- GitLab