Subversion Repositories Sites.tela-botanica.org

Rev

Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
4 david 1
<?php
2
 
3
/***************************************************************************\
4
 *  SPIP, Systeme de publication pour l'internet                           *
5
 *                                                                         *
6
 *  Copyright (c) 2001-2005                                                *
7
 *  Arnaud Martin, Antoine Pitrou, Philippe Riviere, Emmanuel Saint-James  *
8
 *                                                                         *
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
\***************************************************************************/
12
 
13
 
14
include("inc_lab.php");
15
 
16
include_spip("ecrire.php");
17
include_spip("ortho.php");
18
include_spip("layer.php"); // Pour $browser_name
19
 
20
//charset_texte('utf-8');
21
 
22
 
23
//
24
// Lire l'article
25
//
26
 
27
$query = "SELECT * FROM spip_articles WHERE id_article='$id_article'";
28
$result = spip_query($query);
29
 
30
if ($row = spip_fetch_array($result)) {
31
	$id_article = $row["id_article"];
32
	$surtitre = $row["surtitre"];
33
	$titre = $row["titre"];
34
	$soustitre = $row["soustitre"];
35
	$id_rubrique = $row["id_rubrique"];
36
	$descriptif = $row["descriptif"];
37
	$nom_site = $row["nom_site"];
38
	$url_site = $row["url_site"];
39
	$chapo = $row["chapo"];
40
	$texte = $row["texte"];
41
	$ps = $row["ps"];
42
	$date = $row["date"];
43
	$statut_article = $row["statut"];
44
	$maj = $row["maj"];
45
	$date_redac = $row["date_redac"];
46
	$visites = $row["visites"];
47
	$referers = $row["referers"];
48
	$extra = $row["extra"];
49
	$id_trad = $row["id_trad"];
50
	$lang_article = $row["lang"];
51
}
52
if (!$lang_article) $lang_article = lire_meta('langue_site');
53
changer_typo($lang_article); # pour l'affichage du texte
54
 
55
// pour l'affichage du virtuel
56
unset($virtuel);
57
if (substr($chapo, 0, 1) == '=') {
58
	$virtuel = substr($chapo, 1);
59
	$chapo = "";
60
}
61
 
62
$champs = array('surtitre', 'titre', 'soustitre', 'descriptif', 'chapo', 'texte', 'ps');
63
$echap = array();
64
$ortho = "";
65
 
66
//
67
// Affichage HTML
68
//
69
 
70
// Gros hack IE pour le "position: fixed"
71
$code_ie = "<!--[if IE]>
72
<style type=\"text/css\" media=\"screen\">
73
	body {
74
		height: 100%; margin: 0px; padding: 0px;
75
		overflow: hidden;
76
	}
77
	.ortho-content {
78
		position: absolute; $spip_lang_left: 0px;
79
		height: 100%; margin: 0px; padding: 0px;
80
		width: 72%;
81
		overflow-y: auto;
82
	}
83
	#ortho-fixed {
84
		position: absolute; $spip_lang_right: 0px; width: 25%;
85
		height: 100%; margin: 0px; padding: 0px;
86
		overflow: hidden;
87
	}
88
	.ortho-padding {
89
		padding: 12px;
90
	}
91
</style>
92
<script type=\"text/javascript\">
93
	onload = function() { document.getElementById('ortho-content').focus(); }
94
</script>
95
<![endif]-->";
96
 
97
debut_html(_T('ortho_orthographe').' &laquo;'.$titre.'&raquo;', $code_ie);
98
 
99
 
100
// Ajouts et suppressions de mots par l'utilisateur
101
gerer_dico_ortho($lang_article);
102
 
103
//
104
// Panneau de droite
105
//
106
echo "<div id='ortho-fixed'>";
107
echo "<div class='ortho-padding serif'>";
108
 
109
debut_cadre_enfonce();
110
 
111
foreach ($champs as $champ) {
112
	$ortho .= $$champ." ";
113
}
114
$ortho = preparer_ortho($ortho, $lang_article);
115
$result_ortho = corriger_ortho($ortho, $lang_article);
116
if (is_array($result_ortho)) {
117
	$mots = $result_ortho['mauvais'];
118
	if ($erreur = $result_ortho['erreur']) {
119
		echo "<b>"._T('ortho_trop_de_fautes').aide('corrortho')."</b><p>\n";
120
		echo "<b>"._T('ortho_trop_de_fautes2')."</b><p>";
121
	}
122
	else {
123
		echo "<b>"._T('ortho_mode_demploi').aide('corrortho')."</b><p>\n";
124
	}
125
 
126
	panneau_ortho($result_ortho);
127
}
128
else {
129
	$erreur = $result_ortho;
130
	echo "<b>"._T('ortho_dico_absent').aide('corrortho')." (";
131
	echo traduire_nom_langue($lang_article);
132
	echo "). ";
133
	echo _T('ortho_verif_impossible')."</b>";
134
}
135
 
136
fin_cadre_enfonce();
137
 
138
echo "</div>";
139
echo "</div>";
140
 
141
//
142
// Colonne de gauche : textes de l'article
143
//
144
echo "<div class='ortho-content' id='ortho-content'>";
145
echo "<div class='ortho-padding serif'>";
146
 
147
// Traitement des champs : soulignement des mots mal orthographies
148
foreach ($champs as $champ) {
149
	switch ($champ) {
150
	case 'texte':
151
	case 'chapo':
152
	case 'descriptif':
153
	case 'ps':
154
		// Mettre de cote les <code>, <cadre>, etc.
155
		list($$champ, $echap) = echappe_html($$champ, "ORTHO");
156
		$$champ = propre($$champ);
157
		break;
158
	default:
159
		$echap = "";
160
		$$champ = typo($$champ);
161
		break;
162
	}
163
	// On passe en UTF-8 juste pour la correction
164
	$$champ = preparer_ortho($$champ, $lang_article);
165
	if (is_array($result_ortho))
166
		$$champ = souligner_ortho($$champ, $lang_article, $result_ortho);
167
	// Et on repasse dans le charset original pour remettre les echappements
168
	$$champ = afficher_ortho($$champ);
169
	if ($echap)
170
		$$champ = echappe_retour($$champ, $echap, "ORTHO");
171
}
172
// Traitement identique pour les notes de bas de page
173
if ($les_notes) {
174
	$les_notes = preparer_ortho($les_notes, $lang_article);
175
	if (is_array($result_ortho))
176
		$les_notes = souligner_ortho($les_notes, $lang_article, $result_ortho);
177
	$les_notes = afficher_ortho($les_notes);
178
}
179
 
180
debut_cadre_relief();
181
 
182
if ($surtitre) {
183
	echo "<span $dir_lang><font face='arial,helvetica' size='3'><b>";
184
	echo $surtitre;
185
	echo "</b></font></span>\n";
186
}
187
gros_titre($titre);
188
 
189
if ($soustitre) {
190
	echo "<span $dir_lang><font face='arial,helvetica' size='3'><b>";
191
	echo $soustitre;
192
	echo "</b></font></span>\n";
193
}
194
 
195
if ($descriptif OR $url_site OR $nom_site) {
196
	echo "<p><div align='$spip_lang_left' style='padding: 5px; border: 1px dashed #aaaaaa; background-color: #e4e4e4;' $dir_lang>";
197
	echo "<font size='2' face='Verdana,Arial,Sans,sans-serif'>";
198
	$texte_case = ($descriptif) ? "{{"._T('info_descriptif')."}} $descriptif\n\n" : '';
199
	$texte_case .= ($nom_site.$url_site) ? "{{"._T('info_urlref')."}} [".$nom_site."->".$url_site."]" : '';
200
	echo $descriptif;
201
	echo "</font>";
202
	echo "</div>";
203
}
204
 
205
 
206
// Corps de l'article
207
 
208
echo "\n\n<div align='justify'>";
209
 
210
if ($virtuel) {
211
	debut_boite_info();
212
	echo _T('info_renvoi_article')." ".propre("<center>[->$virtuel]</center>");
213
	fin_boite_info();
214
}
215
else {
216
	echo "<div $dir_lang><b>";
217
	echo $chapo;
218
	echo "</b></div>\n\n";
219
 
220
	echo "<div $dir_lang>";
221
	echo $texte;
222
	echo "</div>";
223
 
224
	if ($ps) {
225
		echo debut_cadre_enfonce();
226
		echo "<div $dir_lang><font size='2' face='Verdana,Arial,Sans,sans-serif'>";
227
		echo "<b>"._T('info_ps')."</b> ";
228
		echo $ps;
229
		echo "</font></div>";
230
		echo fin_cadre_enfonce();
231
	}
232
 
233
	if ($les_notes) {
234
		echo debut_cadre_relief();
235
		echo "<div $dir_lang><font size='2'>";
236
		echo "<b>"._T('info_notes')."&nbsp;:</b> ".$les_notes;
237
		echo "</font></div>";
238
		echo fin_cadre_relief();
239
	}
240
 
241
	if ($champs_extra AND $extra) {
242
		include_spip("extra.php");
243
		extra_affichage($extra, "articles");
244
	}
245
}
246
 
247
 
248
echo "</div>";
249
 
250
 
251
fin_cadre_relief();
252
 
253
html_background();
254
echo "</div>";
255
echo "</div>";
256
 
257
fin_html();
258
 
259
?>