From 0ddf973c84416d0d3d61cae0717dace2f71bcf17 Mon Sep 17 00:00:00 2001
From: Antoine Pitrou <pitrou@free.fr>
Date: Tue, 19 Feb 2002 00:29:57 +0000
Subject: [PATCH] =?UTF-8?q?Modifs=20dans=20l'interface=20des=20documents?=
 =?UTF-8?q?=20:=20maintenant=20dans=20une=20fen=C3=AAtre=20s=C3=A9par?=
 =?UTF-8?q?=C3=A9e=20depuis=20l'=C3=A9dition=20des=20articles=20(plus=20cl?=
 =?UTF-8?q?air=20et=20a=C3=A9r=C3=A9,=20et=20=C3=A9vite=20les=20chargement?=
 =?UTF-8?q?s=20trop=20lourds=20sur=20la=20page=20de=20l'article).=20Reste?=
 =?UTF-8?q?=20beaucoup=20de=20trucs=20=C3=A0=20faire=20au=20niveau=20du=20?=
 =?UTF-8?q?code,=20mais=20le=20design=20a=20l'air=20=C3=A0=20peu=20pr?=
 =?UTF-8?q?=C3=A8s=20correct=20d=C3=A9j=C3=A0.=20Qu'est-ce=20que=20vous=20?=
 =?UTF-8?q?en=20pensez=20=3F?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

(heu, Fil, désolé, en fait les problèmes étaient à peu près normaux,
ça ne marchait que dans quelques cas de tests bien précis ;-) là
ça devrait aller mieux, mais rien de garanti)
---
 ecrire/article_documents.php3 | 352 ++++++++++++++++++++++++++++++++++
 ecrire/articles.php3          |  96 +---------
 ecrire/articles_edit.php3     |  11 +-
 ecrire/inc_presentation.php3  |  98 ++++++----
 4 files changed, 426 insertions(+), 131 deletions(-)
 create mode 100644 ecrire/article_documents.php3

diff --git a/ecrire/article_documents.php3 b/ecrire/article_documents.php3
new file mode 100644
index 0000000000..439abb7134
--- /dev/null
+++ b/ecrire/article_documents.php3
@@ -0,0 +1,352 @@
+<?php
+
+include ("inc.php3");
+
+
+function afficher_document($id_document) {
+	global $connect_id_auteur, $connect_statut;
+	global $couleur_foncee, $couleur_claire;
+	global $this_link;
+	global $id_article;
+
+	$result = mysql_query("SELECT * FROM spip_documents WHERE id_document=$id_document");
+	if ($row = mysql_fetch_array($result)) {
+		$id_document = $row['id_document'];
+		$id_vignette = $row['id_vignette'];
+		$id_type = $row['id_type'];
+		$titre = $row['titre'];
+		$descriptif = $row['descriptif'];
+		$fichier = $row['fichier'];
+		$largeur = $row['largeur'];
+		$hauteur = $row['hauteur'];
+		$taille = $row['taille'];
+		$mode = $row['mode'];
+	}
+
+	if ($mode == 'vignette') {
+		$row_vignette = $row;
+	}
+	else if ($id_vignette) {
+		$result_vignette = mysql_query("SELECT * FROM spip_documents WHERE id_document=$id_vignette");
+		$row_vignette = @mysql_fetch_array($result_vignette);
+	}
+	if ($row_vignette) {
+		$fichier_vignette = $row_vignette['fichier'];
+		$largeur_vignette = $row_vignette['largeur'];
+		$hauteur_vignette = $row_vignette['hauteur'];
+		$taille_vignette = $row_vignette['taille'];
+	}
+
+	$result = mysql_query("SELECT * FROM spip_types_documents WHERE id_type=$id_type");
+	if ($row = @mysql_fetch_array($result))	{
+		$type_extension = $row['extension'];
+		$type_inclus = $row['inclus'];
+		$type_titre = $row['titre'];
+	}
+
+	$block = "document $id_document";
+	echo bouton_block_invisible($block);
+	echo "<font face='Verdana, Arial, Helvetica, sans-serif'>\n";
+	echo "<font size='4' color='#444444'><b>$titre</b></font> ";
+	echo "<font size='2'>";
+	if ($taille > 0) {
+		if ($type_titre) echo propre($type_titre);
+		else echo "fichier &laquo;&nbsp;.$type_extension&nbsp;&raquo;";
+		if ($largeur && $hauteur) echo " - $largeur x $hauteur pixels";
+		echo " - ".taille_en_octets($taille);
+	}
+	echo "</font>\n";
+
+	echo "<font size='1'>";
+	$hash = calculer_action_auteur("supp_doc ".$id_document);
+	echo "[<b><a href='../spip_image.php3?redirect=".urlencode("article_documents.php3")."&id_article=$id_article&hash_id_auteur=$connect_id_auteur&hash=$hash&doc_supp=".$id_document."'>SUPPRIMER&nbsp;CE&nbsp;DOCUMENT</a></b>]\n";
+	echo "</font>\n";
+
+	echo "</font>\n";
+
+	echo debut_block_invisible($block);
+	echo debut_boite_info();
+
+	echo "<table width='100%' border='0' cellspacing='0' cellpadding='8'><tr>\n";
+	echo "<td width='150' align='center' valign='top'>\n";
+
+	//
+	// Affichage de la vignette ou de l'apercu
+	//
+
+	if ($mode == 'document') {
+		echo "<div style='border: 1px dashed black; padding: 4px; background-color: #fdf4e8;'>\n";
+		echo "<font size='2'><b>VIGNETTE DE PR&Eacute;VISUALISATION</b></font><br>";
+	}
+	else {
+		echo "<div style='border: 1px solid #808080; padding: 4px; background-color: #e0f080;'>\n";
+		echo "<font size='2'><b>APER&Ccedil;U</b></font><br>";
+	}
+
+
+	if ($fichier_vignette) {
+		if ($largeur_vignette > 140) {
+			$rapport = 140.0 / $largeur_vignette;
+			$largeur_vignette = 140;
+			$hauteur_vignette = floor($hauteur_vignette * $rapport);
+		}
+		if ($hauteur_vignette > 150) {
+			$rapport = 150.0 / $hauteur_vignette;
+			$hauteur_vignette = 150;
+			$largeur_vignette = floor($largeur_vignette * $rapport);
+		}
+		echo "<a href='../$fichier_vignette'><img src='../$fichier_vignette' border='0' height='$hauteur_vignette' width='$largeur_vignette'></a>\n";
+
+		if ($mode == 'document') {
+			$hash = calculer_action_auteur("supp_doc ".$id_vignette);
+			echo "<font size='2'>\n";
+			echo "[<a href='../spip_image.php3?redirect=".urlencode("article_documents.php3")."&id_article=$id_article&hash_id_auteur=$connect_id_auteur&hash=$hash&doc_supp=$id_vignette'>";
+			echo "supprimer la vignette</a>]</font><br>\n";
+		}
+
+		echo "<font size='1'>\n";
+		echo "<div align='left'>&lt;img$id_document|left&gt;</div>\n";
+		echo "<div align='center'>&lt;img$id_document|center&gt;</div>\n";
+		echo "<div align='right'>&lt;img$id_document|right&gt;</div>\n";
+		echo "</font>\n";
+	}
+	else {
+		echo "<font face='verdana, arial, helvetica, sans-serif' size='2'>\n";
+		echo "<div align='left'>Si vous voulez ins&eacute;rer un lien graphique vers ce document, installez ici une vignette de pr&eacute;visualisation.<p>";
+
+		$hash = calculer_action_auteur("ajout_doc");
+		echo "<form action='../spip_image.php3' METHOD='POST' ENCTYPE='multipart/form-data'>";
+		echo "<input name='redirect' type='Hidden' VALUE='article_documents.php3'>";
+		echo "<input name='ajout_doc' type='Hidden' VALUE='oui'>";
+		echo "<input name='id_document' type='Hidden' VALUE='$id_document'>";
+		echo "<input name='id_article' type='Hidden' VALUE='$id_article'>";
+		echo "<input name='mode' type='Hidden' VALUE='vignette'>";
+		echo "<Input name='hash_id_auteur' type='Hidden' VALUE='$connect_id_auteur'>";
+		echo "<input name='hash' type='Hidden' VALUE='$hash'>";
+
+		if (tester_upload()) {
+			echo "<B>T&eacute;l&eacute;charger une nouvelle image&nbsp;:</B>";
+			echo aide ("artimg");
+			echo "<small><br><INPUT NAME='image' TYPE='File'>\n";
+			echo " <INPUT NAME='ok' TYPE=Submit VALUE='T&eacute;l&eacute;charger' CLASS='fondo'></small>\n";
+		}
+		if ($GLOBALS['connect_statut'] == '0minirezo') {
+			echo "<br>";
+			$texte_upload = '';
+			$myDir = opendir("upload");
+			while($entryName = readdir($myDir)) {
+				if (ereg('\.(gif|jpe?g|png)$', $entryName)) {
+					$texte_upload .= "\n<OPTION VALUE=\"ecrire/upload/$entryName\">$entryName";
+				}
+			}
+			closedir($myDir);
+			if ($texte_upload) {
+				echo "\nS&eacute;lectionner un fichier&nbsp;:";
+				echo "\n<SELECT NAME='image' CLASS='forml' SIZE=1>";
+				echo $texte_upload;
+				echo "\n</SELECT>";
+				echo "\n</option>";
+				echo "\n  <INPUT NAME='ok' TYPE=Submit VALUE='Choisir' CLASS='fondo'>";
+			}
+			else if (!tester_upload()) {
+				echo "Installer des images dans le dossier /ecrire/upload pour pouvoir les s&eacute;lectionner ici.";
+			}
+		}
+		echo "</form>\n";
+		echo "</font>\n";
+	}
+
+	echo "</div>\n";
+
+	echo "</td>\n";
+
+	//
+	// Afficher le document en tant que tel
+	//
+
+	echo "<td width='100%' align='left' valign='top'>\n";
+
+	// Si quelqu'un trouve un endroit ou caser la jolie icone en HTML fait main d'Arno ;-))
+/*	if ($fichier) {
+		echo "<table cellpadding=0 cellspacing=0 border=0 width=35 height=32 align='left' valign='bottom'>\n";
+		echo "<tr width=35 height=32>\n";
+		echo "<td width=35 height=32 background='IMG2/document-vierge.gif' align='left'>\n";
+		echo "<table bgcolor='#666666' style='border: solid 1px black; margin-top: 10px; padding-top: 0px; padding-bottom: 0px; padding-left: 3px; padding-right: 3px;' cellspacing=0 border=0>\n";
+		echo "<tr><td><font face='verdana,arial,helvetica,sans-serif' color='white' size='1'>$type_extension</font></td></tr></table>\n";
+		echo "</td></tr></table>\n&nbsp;&nbsp;&nbsp;";
+	}*/
+
+	if ($descriptif) {
+		echo debut_cadre_relief();
+		echo "<font face='Georgia, Garamond, Times, sans-serif' size='2'>\n";
+		echo propre($descriptif);
+		echo "</font>";
+		echo fin_cadre_relief();
+	}
+	echo "<font face=\"Georgia, Garamond, Times, serif\" size=\"3\">";
+
+	echo "<form action='article_documents.php3' method='post'>";
+	echo "<input type='hidden' name='id_article' value='$id_article'>";
+	echo "<input type='hidden' name='id_document' value='$id_document'>";
+	echo "<input type='hidden' name='modif_document' value='oui'>";
+
+	$titre = htmlspecialchars($titre);
+	echo "<b>Titre&nbsp;:</b><br>\n";
+	echo "<INPUT TYPE='text' NAME='titre' CLASS='formo' VALUE=\"".htmlspecialchars($titre)."\" SIZE='40'><br>";
+
+	echo "<b>Description&nbsp;:</b<<br>\n";
+	echo "<textarea name='descriptif' CLASS='forml' ROWS='3' COLS='*' wrap='soft'>";
+	echo htmlspecialchars($descriptif);
+	echo "</textarea>\n";
+
+	echo "<div align='right'>";
+	echo "<input clasS='fondo' TYPE='submit' NAME='Valider' VALUE='Valider'>";
+	echo "</div>";
+	echo "</form>";
+	echo "</font>";
+
+
+	echo "</td>\n";
+
+	echo "</tr></table>\n";
+
+	echo fin_boite_info();
+	echo fin_block($block);
+}
+
+
+//
+// Gerer les modifications
+//
+
+if ($new == "oui") {
+	mysql_query("INSERT spip_documents (id_vignette, titre) ".
+		"VALUES ('$id_vignette', 'nouveau document')");
+	$id_document =  mysql_insert_id();
+
+	if ($id_article) {
+		mysql_query("INSERT spip_documents_articles (id_document, id_article) ".
+			"VALUES ($id_document, $id_article)");
+	}
+}
+
+$flag_editable = true; // a affiner ;-))
+
+if ($modif_document == 'oui') {
+	$titre = addslashes(corriger_caracteres($titre));
+	$descriptif = addslashes(corriger_caracteres($descriptif));
+	mysql_query("UPDATE spip_documents SET titre=\"$titre\", descriptif=\"$descriptif\" WHERE id_document=$id_document");
+}
+
+
+debut_html("Images et documents li&eacute;s &agrave; l'article");
+
+echo "<table width='100%' border='0' cellpadding='6' cellspacing='0'>\n";
+
+echo "<tr bgcolor='$couleur_foncee'>\n";
+echo "<td width='100%'><font face='Verdana,Arial,Helvetica,sans-serif' size='4' color='#FFFFFF'>";
+echo "Documents li&eacute;s &agrave l'article";
+echo "</td></tr>\n";
+
+$docs_affiches = "";
+
+$query = "SELECT lien.id_document, documents.id_vignette FROM spip_documents_articles AS lien, spip_documents AS documents ".
+	"WHERE id_article=$id_article AND lien.id_document=documents.id_document ".
+	"AND documents.mode='document' AND documents.titre!='' ORDER BY documents.titre";
+$result = mysql_query($query);
+while ($row = mysql_fetch_array($result)) {
+	$id_document = $row[0];
+	$docs_affiches[] = $row[1];
+
+	echo "<tr><td>\n";
+	afficher_document($id_document);
+	echo "</td></tr>\n";
+}
+
+
+echo "<tr><td height='10'>&nbsp;</td></tr>\n";
+
+echo "<tr bgcolor='$couleur_foncee'>\n";
+echo "<td width='100%'><font face='Verdana,Arial,Helvetica,sans-serif' size='4' color='#FFFFFF'>";
+echo "Images affichables dans l'article";
+echo "</td></tr>\n";
+
+if ($docs_affiches) $docs_affiches = "AND lien.id_document NOT IN (".join(',', $docs_affiches).") ";
+
+$query = "SELECT lien.id_document FROM spip_documents_articles AS lien, spip_documents AS documents ".
+	"WHERE id_article=$id_article AND lien.id_document=documents.id_document ".$docs_affiches.
+	"AND documents.mode='vignette' AND documents.titre!='' ORDER BY documents.titre";
+$result = mysql_query($query);
+while ($row = mysql_fetch_array($result)) {
+	$id_document = $row[0];
+
+	echo "<tr><td>\n";
+	afficher_document($id_document);
+	echo "</td></tr>\n";
+}
+
+
+//
+// Ajouter un document
+//
+
+
+echo "<tr><td height='15'>&nbsp;</td></tr>\n";
+
+echo "<tr bgcolor='#EEEECC'>\n";
+echo "<td width='100%'><font face='Verdana,Arial,Helvetica,sans-serif' size='4' color='#000000'>";
+echo "Ajouter un nouveau document";
+echo "</td></tr>\n";
+
+
+echo "<tr><td>\n";
+
+$hash = calculer_action_auteur("ajout_doc");
+
+echo "<font face=\"verdana, arial, helvetica, sans-serif\" size='2'>\n";
+echo "<FORM ACTION='../spip_image.php3' METHOD='POST' ENCTYPE='multipart/form-data'>\n";
+echo "<INPUT NAME='redirect' TYPE=Hidden VALUE='article_documents.php3'>\n";
+echo "<INPUT NAME='id_article' TYPE=Hidden VALUE=$id_article>\n";
+echo "<INPUT NAME='hash_id_auteur' TYPE=Hidden VALUE=$connect_id_auteur>\n";
+echo "<INPUT NAME='hash' TYPE=Hidden VALUE=$hash>\n";
+echo "<INPUT NAME='ajout_doc' TYPE=Hidden VALUE='oui'>\n";
+if (tester_upload()) {
+	echo "Ajouter une image ou un document&nbsp;:";
+	echo aide("artimg");
+	echo "<br><small><INPUT NAME='image' TYPE=File CLASS='forml'></small>";
+	echo "   <INPUT NAME='ok' TYPE=Submit VALUE='T&eacute;l&eacute;charger' CLASS='fondo'>";
+}
+if ($connect_statut == '0minirezo') {
+	$myDir = opendir("upload");
+	while($entryName = readdir($myDir)){
+		if (!ereg("^\.", $entryName) AND eregi("(gif|jpg|png)$", $entryName)) {
+			$entryName = addslashes($entryName);
+			$afficher .= "\n<OPTION VALUE='ecrire/upload/$entryName'>$entryName</OPTION>";
+		}
+	}
+	closedir($myDir);
+
+	if (strlen($afficher) > 10){
+		echo "\nS&eacute;lectionner un fichier&nbsp;:";
+		echo "\n<SELECT NAME='image' CLASS='forml' SIZE=1>";
+		echo $afficher;
+		echo "\n</SELECT>";
+		echo "\n  <INPUT NAME='ok' TYPE=Submit VALUE='Choisir' CLASS='fondo'>";
+	}
+	else if (!tester_upload()) {
+		echo "Vous devez installer des images dans le dossier /ecrire/upload pour pouvoir les s&eacute;lectionner ici.<p>";
+	}
+}
+echo "</FORM>";
+echo "</div>";
+echo "</font>\n";
+
+echo "</td></tr>\n";
+
+echo "</table>\n";
+
+
+
+fin_html();
+
+?>
diff --git a/ecrire/articles.php3 b/ecrire/articles.php3
index 5f78eadd0e..6a9d539172 100644
--- a/ecrire/articles.php3
+++ b/ecrire/articles.php3
@@ -1,6 +1,7 @@
 <?php
 
 include ("inc.php3");
+
 include_local ("inc_logos.php3");
 include_local ("inc_index.php3");
 include_local ("inc_mots.php3");
@@ -1137,97 +1138,8 @@ if ($flag_editable) {
 echo "<DIV ALIGN=left>";
 
 
-
-/////// Documents joints...
-function afficher_documents_non_inclus($row) {
-	global $nb_image, $connect_id_auteur, $flag_editable;
-	$id_article = $row['id_article'];
-	$id_document = $row['id_document'];
-	$titre = $row ['titre'];
-	$descriptif = $row['descriptif'];
-	$numero = $row['numero_document'];
-	$nom_fichier_preview = $row['nom_fichier_preview'];
-	$largeur = $row['largeur_preview'];
-	$hauteur = $row['hauteur_preview'];
-	$inclus = $row['inclus'];
-	$type = $row['type'];
-	$nom_fichier_doc = $row['nom_fichier_doc'];
-	$largeur_doc = $row['largeur_doc'];
-	$hauteur_doc = $row['hauteur_doc'];
-	$taille_fichier_doc = $row['taille_fichier_doc'];
-
-
-	if ($numero > $nb_image) $nb_image = $numero;
-	if (!$titre) $titre = "Document $numero";	
-
-	echo "<tr class='arial1'>";
-
-	
-	if ($flag_editable)
-		echo "<td><b><a href='document_edit.php3?id_document=$id_document&id_article=$id_article'><img src='IMG2/document.gif' align='middle' alt='[DOC]' width='16' height='12' border='0'> $titre</a></b></td>";
-	else 
-		echo "<td><b><img src='IMG2/document.gif' align='middle' alt='[DOC]' width='16' height='12' border='0'> $titre</b></td>";
-	
-	
-
-
-	echo "<td>";
-		if ($taille_fichier_doc > 0){
-			echo "<a href='../IMG/$nom_fichier_doc'>Voir le fichier ".strtoupper($type)."</a>";	
-		} else {
-			echo "$type";		
-		}
-	
-	echo "</td>";
-	
-	echo "<td>";
-		if ($taille_fichier_doc > 0){
-			echo taille_en_octets($taille_fichier_doc);
-		}
-		else {
-			echo "<font color='red'>Pas de document li&eacute;</font>";
-		}
-	echo "</td>";
-	echo "<td>";
-		if ($largeur_doc>0) echo "$largeur_doc x $hauteur_doc pixels";
-	echo "</td>";
-	
-	if ($flag_editable){
-		$hash = calculer_action_auteur("supp_def ".$id_document);
-
-		echo "<td align='right'>";
-		echo "<a href='../spip_image.php3?redirect=articles.php3&hash_id_auteur=$connect_id_auteur&hash=$hash&id_article=$id_article&def_supp=$id_document'>Supprimer ce document</a>";
-		echo "</td>";
-	}
-	echo "</tr>";
-}
-
-$query = "SELECT * FROM spip_documents WHERE id_article=$id_article AND inclus='non' ORDER BY numero_document";
-$result = mysql_query($query);
-
-if (mysql_num_rows($result)>0){
-
-	echo "<p><table width=100% cellpadding=3 cellspacing=0 border=0>";
-	echo "<tr width=100% background=''>";
-	echo "<td width=40%><hr noshade></td>";
-	echo "<td>&nbsp;&nbsp;</td>";
-	echo "<td><font size=1 face='verdana,arial,helvetica,sans-serif'><b>DOCUMENTS&nbsp;ASSOCI&Eacute;S</b></font></td>";
-	echo "<td>&nbsp;&nbsp;</td>";
-	echo "<td width=40%><hr noshade></td>";
-	echo "</tr></table>";
-	
-	while ($row = mysql_fetch_array($result))
-	{
-		echo "<table width=100% cellpadding=0 cellspacing=0 border=0>";
-		afficher_documents_non_inclus($row);
-		echo "</table>";
-	}
-}
-if ($flag_editable){
-	$nb_image ++;
-	echo "<div align='right'><b><a href='document_edit.php3?id_article=$id_article&new=oui&nb_image=$nb_image'>Ajouter un document li&eacute; &agrave; cet article</a></b></div>";
-}
-
+echo "$puce <b><a href=\"javascript:window.open('article_documents.php3?id_article=$id_article', 'docs_article', 'scrollbars=yes,resizable=yes,width=620,height=500'); void(0);\">\n";
+echo "Documents li&eacute;s &agrave; l'article</a></b>\n";
 
 
 //////////////////////////////////////////////////////
@@ -1243,7 +1155,6 @@ if ($flag_auteur AND $statut_article == 'prepa') {
 	fin_cadre_relief();
 }
 
-
 echo "</TD></TR></TABLE>";
 
 
@@ -1287,7 +1198,6 @@ echo "<P align='left'>";
 $query_forum = "SELECT * FROM spip_forum WHERE statut='prive' AND id_article='$id_article' AND id_parent=0 ORDER BY date_heure DESC LIMIT $debut,$total_afficher";
 $result_forum = mysql_query($query_forum);
 afficher_forum($result_forum, $forum_retour);
-	
 
 
 	if (!$debut) $debut = 0;
diff --git a/ecrire/articles_edit.php3 b/ecrire/articles_edit.php3
index 46672dfbb7..d98d89a76c 100644
--- a/ecrire/articles_edit.php3
+++ b/ecrire/articles_edit.php3
@@ -293,7 +293,7 @@ debut_page();
 debut_gauche();
 
 
-if ($new != "oui") {
+if ($new != "oui" AND 0) {
 	echo "<p>\n";
 	afficher_images($id_article);
 
@@ -340,6 +340,15 @@ if ($new != "oui") {
 	echo "</font>\n";
 }
 
+debut_boite_info();
+
+echo "<font size='3'>";
+echo "$puce <b><a href=\"javascript:window.open('article_documents.php3?id_article=$id_article', 'docs_article', 'scrollbars=yes,resizable=yes,width=620,height=500'); void(0);\">\n";
+echo "Documents li&eacute;s &agrave; l'article</a></b>\n";
+echo "</font>\n";
+
+fin_boite_info();
+
 
 debut_droite();
 
diff --git a/ecrire/inc_presentation.php3 b/ecrire/inc_presentation.php3
index c4b55adf72..b41a279144 100644
--- a/ecrire/inc_presentation.php3
+++ b/ecrire/inc_presentation.php3
@@ -111,13 +111,13 @@ function fin_cadre_relief(){
 // une boite alerte
 //
 function debut_boite_alerte() {
-	echo "<P><TABLE CELLPADDING=6 BORDER=0><TR><TD WIDTH='100%' BGCOLOR='red'>";
-	echo "<TABLE WIDTH='100%' CELLPADDING=12 BORDER=0><TR><TD WIDTH='100%' bgcolor='white'>";
+	echo "<p><table cellpadding='6' border='0'><tr><td width='100%' bgcolor='red'>";
+	echo "<table width='100%' cellpadding='12' border='0'><tr><td width='100%' bgcolor='white'>";
 }
 
 function fin_boite_alerte() {
-	echo "</TD></TR></TABLE>";
-	echo "</TD></TR></TABLE>";
+	echo "</td></tr></table>";
+	echo "</td></tr></table>";
 }
 
 
@@ -125,13 +125,13 @@ function fin_boite_alerte() {
 // une boite info
 //
 function debut_boite_info() {
-	echo "<P><TABLE CELLPADDING=5 CELLSPACING=0 BORDER=1 WIDTH='100%' CLASS='profondeur' BACKGROUND=''>";
-	echo "<TR><TD BGCOLOR='#DBE1C5' WIDTH='100%'>";
-	echo "<FONT FACE='Verdana,Arial,Helvetica,sans-serif' SIZE=2 COLOR='#333333'>";
+	echo "<p><table cellpadding='5' cellspacing='0' border='1' width='100%' class='profondeur' background=''>";
+	echo "<tr><td bgcolor='#DBE1C5' width='100%'>";
+	echo "<font face='Verdana,Arial,Helvetica,sans-serif' size='2' color='#333333'>";
 }
 
 function fin_boite_info() {
-	echo "</FONT></TD></TR></TABLE>";
+	echo "</font></td></tr></table>";
 }
 
 //
@@ -654,16 +654,16 @@ function bouton($titre,$lien) {
 
 
 //
-// presentation de l'interface privee, debut
+// Presentation de l'interface privee, debut du HTML
 //
-function debut_page($titre = "") {
+
+function debut_html($titre = "") {
 	global $couleur_foncee;
 	global $couleur_claire;
-	$nom_site_spip=htmlspecialchars(lire_meta("nom_site"));
+	$nom_site_spip = htmlspecialchars(lire_meta("nom_site"));
 	$titre = textebrut(typo($titre));
 
-	if ($nom_site_spip == "")
-		$nom_site_spip="SPIP";
+	if ($nom_site_spip == "") $nom_site_spip="SPIP";
 	
 	?>
 	<html>
@@ -697,7 +697,6 @@ function debut_page($titre = "") {
 		padding: 5px; 
 	}
 
-
 	.boutonlien {
 		font-family: Verdana,Arial,Helvetica,sans-serif;
 		font-weight: bold;
@@ -706,7 +705,6 @@ function debut_page($titre = "") {
 	a.boutonlien:hover {color:#454545; text-decoration: none;}
 	a.boutonlien {color:#808080; text-decoration: none;}
 
-
 	h3.spip {
 		font-family: Verdana,Arial,Helvetica,sans-serif;
 		font-weight: bold;
@@ -751,19 +749,29 @@ afficher_script_layer();
 </head>
 <body bgcolor="#E4E4E4" <?php
 	global $fond;
-	if ($fond==1) $img='IMG2/rayures.gif';
-	if ($fond==2) $img='IMG2/blob.gif';
-	if ($fond==3) $img='IMG2/carreaux.gif';
-	if ($fond==4) $img='IMG2/fond-trame.gif';
-	if ($fond==5) $img='IMG2/degrade.jpg';
-	if (!$img) $img='IMG2/rayures.gif';
+	if ($fond == 1) $img='IMG2/rayures.gif';
+	else if ($fond == 2) $img='IMG2/blob.gif';
+	else if ($fond == 3) $img='IMG2/carreaux.gif';
+	else if ($fond == 4) $img='IMG2/fond-trame.gif';
+	else if ($fond == 5) $img='IMG2/degrade.jpg';
+	else if (!$img) $img='IMG2/rayures.gif';
 
 	echo "background='$img'";
 	
 	?> text="#000000" link="#E86519" vlink="#6E003A" alink="#FF9900" >
-	
+
+<?php
+
+}
+
+//
+// Debut du corps de la page
+//
+
+function debut_page($titre = "") {
+	debut_html($titre);
+?>
 	<center>
-	
 <?php
 	global $spip_survol;
 	if ($spip_survol=="off"){
@@ -933,7 +941,6 @@ afficher_script_layer();
 
 ?>
 
-
 	<map name="map-interface">
 	<area shape='rect' coords='19,29,31,44' href='interface.php3' onMouseOver="fond.src='IMG2/modifier-interface-texte.gif'" onMouseOut="fond.src='IMG2/rien.gif'">
 	<?php
@@ -960,8 +967,9 @@ afficher_script_layer();
 
 	<?php
 
-
-	/// Messagerie...
+	//
+	// Resume de messagerie
+	//
 	
 	global $changer_config;
 	global $activer_messagerie;
@@ -1011,6 +1019,10 @@ afficher_script_layer();
 }
 
 
+//
+// Debut de la colonne de gauche
+//
+
 function debut_gauche() {
 	global $connect_statut, $cookie_admin;
 	global $REQUEST_URI;
@@ -1030,9 +1042,9 @@ function debut_gauche() {
 	
 	?>
 	<br><br>
-	
+
 	<table width=700 cellpadding=0 cellspacing=0 border=0>
-	
+
 	<tr>
 	<td width=180 valign="top">
 	<font face='Georgia,Garamond,Times,serif' size=2>
@@ -1083,8 +1095,9 @@ function debut_gauche() {
 
 
 //
-// presentation de l'interface privee, marge de droite
+// Presentation de l'interface privee, marge de droite
 //
+
 function debut_droite() {
 	//
 	// Boite de recherche
@@ -1111,23 +1124,34 @@ function debut_droite() {
 
 
 //
-// presentation de l'interface privee, fin de page et flush()
+// Presentation de l'interface privee, fin de page et flush()
 //
-function fin_page() {
-	global $spip_version_affichee;
 
+function fin_html() {
+	global $spip_version_affichee;
 ?>
-<p align='right'><font size='2'><a href='http://www.uzine.net/spip'>SPIP
-<?php echo $spip_version_affichee; ?></a> est distribu&eacute;
-<a href='gpl.txt'>sous licence GPL</a>.</p></td></tr>
-<tr><td width="180" valign="bottom"></td></tr></table></center></body></html>
+<p align='right'><font face="Verdana, Arial, Helvetica, sans-serif" size='2'>
+<a href='http://www.uzine.net/spip'>SPIP <?php echo $spip_version_affichee; ?></a>
+est distribu&eacute; <a href='gpl.txt'>sous licence GPL</a>.</p>
+</body></html>
 <?php
 	flush();
 }
 
+
+function fin_page() {
+
+?>
+</td></tr>
+</table></center>
+<?php
+	fin_html();
+}
+
 //
-// presentation pages d'installation et d'erreurs
+// Presentation des pages d'installation et d'erreurs
 //
+
 function install_debut_html($titre="Installation du syst&egrave;me de publication...") {
 	?>
 <html>
-- 
GitLab