3 /***************************************************************************\
4 * SPIP, Systeme de publication pour l'internet *
6 * Copyright (c) 2001-2007 *
7 * Arnaud Martin, Antoine Pitrou, Philippe Riviere, Emmanuel Saint-James *
9 * Ce programme est un logiciel libre distribue sous licence GNU/GPL. *
10 * Pour plus de details voir le fichier COPYING.txt ou l'aide en ligne. *
11 \***************************************************************************/
13 if (!defined("_ECRIRE_INC_VERSION")) return;
15 include_spip('inc/presentation');
16 include_spip('inc/distant');
17 include_spip('inc/ortho');
19 // http://doc.spip.org/@exec_articles_ortho_dist
20 function exec_articles_ortho_dist()
22 global $champs_extra, $chapo, $descriptif, $dir_lang, $id_article, $les_notes, $ps, $soustitre, $spip_lang_left, $spip_lang_right, $surtitre, $texte, $titre;
25 //charset_texte('utf-8');
30 $id_article = intval($id_article);
31 if (!autoriser('voir', 'article', $id_article))
32 {include_spip('minipres');
37 $result = spip_query("SELECT * FROM spip_articles WHERE id_article='$id_article'");
40 if ($row = spip_fetch_array($result)) {
41 $id_article = $row["id_article"];
42 $surtitre = $row["surtitre"];
43 $titre = $row["titre"];
44 $soustitre = $row["soustitre"];
45 $id_rubrique = $row["id_rubrique"];
46 $descriptif = $row["descriptif"];
47 $nom_site = $row["nom_site"];
48 $url_site = $row["url_site"];
49 $chapo = $row["chapo"];
50 $texte = $row["texte"];
53 $statut_article = $row["statut"];
55 $date_redac = $row["date_redac"];
56 $visites = $row["visites"];
57 $referers = $row["referers"];
58 $extra = $row["extra"];
59 $id_trad = $row["id_trad"];
60 $lang_article = $row["lang"];
62 if (!$lang_article) $lang_article = $GLOBALS['meta']['langue_site'];
63 changer_typo($lang_article); # pour l'affichage du texte
65 // pour l'affichage du virtuel
67 if (substr($chapo, 0, 1) == '=') {
68 $virtuel = substr($chapo, 1);
77 // Gros hack IE pour le "position: fixed"
78 $code_ie = "<!--[if IE]>
79 <style type=\"text/css\" media=\"screen\">
81 height: 100%; margin: 0px; padding: 0px;
85 position: absolute; $spip_lang_left: 0px;
86 height: 100%; margin: 0px; padding: 0px;
91 position: absolute; $spip_lang_right: 0px; width: 25%;
92 height: 100%; margin: 0px; padding: 0px;
101 debut_html(_T('ortho_orthographe').' «'.$titre.'»', $code_ie);
104 // Ajouts et suppressions de mots par l'utilisateur
105 gerer_dico_ortho($lang_article);
110 echo "<div id='ortho-fixed'>";
111 echo "<div class='ortho-padding serif'>";
113 debut_cadre_enfonce();
115 $champs = array('surtitre', 'titre', 'soustitre', 'descriptif', 'chapo', 'texte', 'ps');
116 foreach ($champs as $champ) {
117 $ortho .= $
$champ." ";
119 $ortho = preparer_ortho($ortho, $lang_article);
120 $result_ortho = corriger_ortho($ortho, $lang_article);
121 if (is_array($result_ortho)) {
122 $mots = $result_ortho['mauvais'];
123 if ($erreur = $result_ortho['erreur']) {
124 echo "<b>"._T('ortho_trop_de_fautes').aide('corrortho')."</b><p>\n";
125 echo "<b>"._T('ortho_trop_de_fautes2')."</b><p>";
128 echo "<b>"._T('ortho_mode_demploi').aide('corrortho')."</b><br />\n";
131 echo panneau_ortho($result_ortho);
134 $erreur = $result_ortho;
135 echo "<b>"._T('ortho_dico_absent').aide('corrortho')." (";
136 echo traduire_nom_langue($lang_article);
138 echo _T('ortho_verif_impossible')."</b>";
147 // Colonne de gauche : textes de l'article
149 echo "<div class='ortho-content' id='ortho-content'>";
150 echo "<div class='ortho-padding serif'>";
152 // Traitement des champs : soulignement des mots mal orthographies
153 foreach ($champs as $champ) {
159 // Mettre de cote les <code>, <cadre>, etc.
160 $
$champ = echappe_html($
$champ,'ORTHO');
161 $
$champ = propre($
$champ);
164 $
$champ = typo($
$champ);
167 // On passe en UTF-8 juste pour la correction
168 $
$champ = preparer_ortho($
$champ, $lang_article);
169 if (is_array($result_ortho))
170 $
$champ = souligner_ortho($
$champ, $lang_article, $result_ortho);
171 // Et on repasse dans le charset original pour remettre les echappements
172 $
$champ = afficher_ortho($
$champ);
173 $
$champ = echappe_retour($
$champ, 'ORTHO');
175 // Traitement identique pour les notes de bas de page
177 $les_notes = preparer_ortho($les_notes, $lang_article);
178 if (is_array($result_ortho))
179 $les_notes = souligner_ortho($les_notes, $lang_article, $result_ortho);
180 $les_notes = afficher_ortho($les_notes);
183 debut_cadre_relief();
186 echo "<span $dir_lang><span class='arial1 spip_medium'><b>", $surtitre, "</b></span></span>\n";
191 echo "<span $dir_lang><span class='arial1 spip_medium'><b>", $soustitre, "</b></span></span>\n";
194 if ($descriptif OR $url_site OR $nom_site) {
195 echo "<div align='$spip_lang_left' style='padding: 5px; border: 1px dashed #aaaaaa; background-color: #e4e4e4;' $dir_lang>";
196 $t = ($descriptif) ?
"{{"._T('info_descriptif')."}} $descriptif\n\n" : '';
197 $t .= ($nom_site.$url_site) ?
"{{"._T('info_urlref')."}} [".$nom_site."->".$url_site."]" : '';
198 echo "<span class='verdana1 spip_small'>", $t, "</span>";
203 // Corps de l'article
205 echo "\n\n<div style='text-align: justify'>";
209 echo _T('info_renvoi_article'),
210 propre("<span style='text-align: center'> [->$virtuel]</span>");
214 echo "<div $dir_lang><b>";
216 echo "</b></div>\n\n";
218 echo "<div $dir_lang>";
223 echo debut_cadre_enfonce();
224 echo "<div $dir_lang class='verdana1 spip_small'>", "<b>"._T('info_ps')."</b>", $ps, "</div>";
225 echo fin_cadre_enfonce();
229 echo debut_cadre_relief();
230 echo "<div $dir_lang><span class='spip_small'>", "<b>"._T('info_notes')." :</b> ".$les_notes, "</span></div>";
231 echo fin_cadre_relief();
234 if ($champs_extra AND $extra) {
235 include_spip('inc/extra');
236 echo extra_affichage($extra, "articles");
246 // html_background();
247 echo "</div></div></body></html>\n";
255 // http://doc.spip.org/@debut_html
256 function debut_html($titre = "", $rubrique="") {
257 include_spip('inc/headers');
259 $nom_site_spip = entites_html(textebrut(typo($GLOBALS['meta']["nom_site"])));
260 if (!$nom_site_spip) $nom_site_spip= _T('info_mon_site_spip');
261 $titre = textebrut(typo($titre));
264 echo _DOCTYPE_ECRIRE
.
265 html_lang_attributes(),
267 "<title>[$nom_site_spip] $titre</title>\n";
269 echo $rubrique, "\n";
270 echo envoi_link($nom_site_spip),
271 http_script("$(document).ready(function(){
273 if(jQuery.browser.msie) document.getElementById('ortho-content').focus();
278 echo "<body", ($GLOBALS['spip_lang_rtl'] ?
" dir='rtl'" : ""), ">";