From 57c9947c62f2b6c62820ba4d04512a853929eb2e Mon Sep 17 00:00:00 2001
From: Antoine Pitrou <pitrou@free.fr>
Date: Sat, 23 Mar 2002 00:31:51 +0000
Subject: [PATCH] =?UTF-8?q?nouveaux=20types=20pour=20versions=20r=C3=A9cen?=
 =?UTF-8?q?tes=20de=20getimagesize=20+=20modifs=20code=20transparentes=20(?=
 =?UTF-8?q?diplo-crash-test=20=3F)?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 .gitattributes                |   1 +
 IMG/icones/bmp.png            | Bin 0 -> 2553 bytes
 ecrire/article_documents.php3 |  41 ++++++++++++--------------
 ecrire/inc_base.php3          |   7 +++++
 ecrire/inc_documents.php3     |  52 +++++++++++++++++++--------------
 ecrire/inc_version.php3       |   2 +-
 spip_image.php3               |  53 ++++++++++++++++++++++++----------
 7 files changed, 95 insertions(+), 61 deletions(-)
 create mode 100644 IMG/icones/bmp.png

diff --git a/.gitattributes b/.gitattributes
index bd2d3b2964..83a24279f5 100644
--- a/.gitattributes
+++ b/.gitattributes
@@ -2,6 +2,7 @@
 IMG/icones/aiff-dist.png -text
 IMG/icones/asf-dist.png -text
 IMG/icones/avi-dist.png -text
+IMG/icones/bmp.png -text
 IMG/icones/bz2-dist.png -text
 IMG/icones/css-dist.png -text
 IMG/icones/defaut-dist.png -text
diff --git a/IMG/icones/bmp.png b/IMG/icones/bmp.png
new file mode 100644
index 0000000000000000000000000000000000000000..a409064f1cc531009e348db7ea103702ddd261af
GIT binary patch
literal 2553
zcmV<V2?q9wP)<h;3K|Lk000e1NJLTq001xm001-y1^@s6%#*v300006VoOIv0RI60
z0RN!9r;`8x39d;*K~#9!)tcLH9Mv7iKj$*D7vB=w#3?km#c4@unuLcUksz8XLVajJ
zdEo)6FG$oW%0p8{s>B=WU%&$>N*V+usftiZ4M|F)&_ZfRg-LJ}CqV5&ViG&PU)J`H
zcXsBSKCE}WcN;@!_(>z}o|!ZI{hr_T{LTX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article_documents.php3
index c8aaa0d3a2..e93608c512 100644
--- a/ecrire/article_documents.php3
+++ b/ecrire/article_documents.php3
@@ -3,6 +3,17 @@
 include ("inc.php3");
 include_local ("inc_documents.php3");
 
+$redirect_url = new Link('article_documents.php3');
+if ($id_document) $redirect_url->addVar('id_document', $id_document);
+if ($id_article) $redirect_url->addVar('id_article', $id_article);
+$redirect_url = $redirect_url->getUrl();
+
+$image_link = new Link('../spip_image.php3');
+if ($id_article) $image_link->addVar('id_article', $id_article);
+
+$id_doc_actif = $id_document;
+
+
 //
 // editable ?
 //
@@ -26,20 +37,6 @@ if (!$flag_editable) {
 // 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)");
-	}
-}
-
-// eventuel triangle a garder deplie
-$id_doc_actif = $id_document;
-
 if ($modif_document == 'oui') {
 	$titre = addslashes(corriger_caracteres($titre));
 	$descriptif = addslashes(corriger_caracteres($descriptif));
@@ -49,15 +46,15 @@ if ($modif_document == 'oui') {
 // transformer en vignette/document
 if ($transformer_image == 'document') {
 	mysql_query("UPDATE spip_documents SET mode='document' WHERE id_document=$id_document");
-} else if ($transformer_image == 'vignette') {
-	// est-ce qu'on met aussi id_vignette=0 ? (Non : on garde une trace de l'id_vignette en cas
-	// d'aller-retour document -> vignette -> document
-	mysql_query("UPDATE spip_documents SET mode='vignette' WHERE id_document=$id_document");
+}
+else if ($transformer_image == 'vignette') {
+	mysql_query("UPDATE spip_documents SET mode='vignette', id_vignette=0 WHERE id_document=$id_document");
 }
 
 //
 // Affichage
 //
+
 $query = "SELECT titre FROM spip_articles WHERE id_article = $id_article";
 $result = mysql_query($query);
 if ($art = mysql_fetch_object($result)) {
@@ -90,7 +87,7 @@ if ($documents_lies) {
 	reset($documents_lies);
 	while (list(, $id_document) = each($documents_lies)) {
 		echo "<tr><td>\n";
-		afficher_document($id_document, $id_doc_actif);
+		afficher_document($id_document, $image_link, $redirect_url, $id_doc_actif == $id_document);
 		echo "</td></tr>\n";
 	}
 	echo "<tr><td height='10'>&nbsp;</td></tr>\n";
@@ -123,7 +120,7 @@ if ($images_liees) {
 	reset($images_liees);
 	while (list(, $id_document) = each($images_liees)) {
 		echo "<tr><td>\n";
-		afficher_document($id_document, $id_doc_actif);
+		afficher_document($id_document, $image_link, $redirect_url, $id_doc_actif == $id_document);
 		echo "</td></tr>\n";
 	}
 	echo "<tr><td height='10'>&nbsp;</td></tr>\n";
@@ -144,11 +141,11 @@ echo "</td></tr></table>\n";
 
 echo debut_boite_info();
 
-$link = new Link('../spip_image.php3');
+$link = $image_link;
+$link->addVar('redirect', $redirect_url);
 $link->addVar('hash', calculer_action_auteur("ajout_doc"));
 $link->addVar('hash_id_auteur', $connect_id_auteur);
 $link->addVar('ajout_doc', 'oui');
-$link->addVar('id_article', $id_article);
 
 afficher_upload($link, 'T&eacute;l&eacute;charger depuis votre ordinateur&nbsp;:');
 
diff --git a/ecrire/inc_base.php3 b/ecrire/inc_base.php3
index 943e6775b9..6a61555b9e 100644
--- a/ecrire/inc_base.php3
+++ b/ecrire/inc_base.php3
@@ -375,6 +375,12 @@ function creer_base() {
 		"(3, 'gif', 'Image GIF', 'image')";
 	mysql_query($query);
 
+	$query = "INSERT IGNORE spip_types_documents (extension, titre, inclus) VALUES ".
+		"('bmp', 'Image BMP', 'image'), ".
+		"('psd', 'Image Photoshop', 'image'), ".
+		"('tif', 'Image TIFF', 'image')";
+	mysql_query($query);
+
 	$query = "INSERT IGNORE spip_types_documents (extension, titre) VALUES ".
 		"('txt', 'Document texte'), ".
 		"('htm', 'Fichier HTML'), ".
@@ -399,6 +405,7 @@ function creer_base() {
 		"('tgz', 'Archive TGZ'), ".
 		"('swf', 'Animation Flash')";
 	mysql_query($query);
+
 }
 
 
diff --git a/ecrire/inc_documents.php3 b/ecrire/inc_documents.php3
index dc4cee88c4..76f3a1c56b 100644
--- a/ecrire/inc_documents.php3
+++ b/ecrire/inc_documents.php3
@@ -56,8 +56,7 @@ function afficher_upload($link, $intitule, $inclus = '') {
 	global $this_link, $connect_statut;
 
 	if (!$link->getVar('redirect')) {
-		$my_link = new Link("article_documents.php3");	// faute de mieux pour l'instant (Fil)
-		$link->addVar('redirect', $my_link->getUrl());
+		$link->addVar('redirect', $this_link->getUrl());
 	}
 
 	echo "<font face='verdana, arial, helvetica, sans-serif' size='2'>\n";
@@ -95,12 +94,14 @@ function afficher_upload($link, $intitule, $inclus = '') {
 // Afficher un document sous forme de ligne depliable
 //
 
-function afficher_document($id_document, $id_doc_actif = 0) {
+function afficher_document($id_document, $image_link, $redirect_url = "", $deplier = false) {
 	global $connect_id_auteur, $connect_statut;
 	global $couleur_foncee, $couleur_claire;
 	global $this_link;
 	global $id_article;
 
+	if (!$redirect_url) $redirect_url = $this_link->getUrl();
+
 	$document = fetch_document($id_document);
 
 	$id_vignette = $document->get('id_vignette');
@@ -121,7 +122,7 @@ function afficher_document($id_document, $id_doc_actif = 0) {
 	}
 
 	$block = "document $id_document";
-	if ($id_document == $id_doc_actif)
+	if ($deplier)
 		echo bouton_block_visible($block);
 	else
 		echo bouton_block_invisible($block);
@@ -136,11 +137,11 @@ function afficher_document($id_document, $id_doc_actif = 0) {
 	echo "</font>\n";
 
 	echo "<font size='1'>";
-	$link = new Link('../spip_image.php3');
-	$link->addVar('redirect', $this_link->getUrl());
+
+	$link = $image_link;
+	$link->addVar('redirect', $redirect_url);
 	$link->addVar('hash', calculer_action_auteur("supp_doc ".$id_document));
 	$link->addVar('hash_id_auteur', $connect_id_auteur);
-	$link->addVar('id_article', $id_article);
 	$link->addVar('doc_supp', $id_document);
 
 	echo "[<b><a ".$link->getHref().">SUPPRIMER</a></b>]\n";
@@ -148,7 +149,7 @@ function afficher_document($id_document, $id_doc_actif = 0) {
 
 	echo "</font>\n";
 
-	if ($id_document == $id_doc_actif)
+	if ($deplier)
 		echo debut_block_visible($block);
 	else
 		echo debut_block_invisible($block);
@@ -186,14 +187,14 @@ function afficher_document($id_document, $id_doc_actif = 0) {
 
 	if ($type_inclus == 'image') {
 		if ($mode == 'vignette') {
-			$link = new Link();
-			$link->addVar('transformer_image','document');
-			$link->addVar('id_document',$id_document);
+			$link = new Link($redirect_url);
+			$link->addVar('transformer_image', 'document');
+			$link->addVar('id_document', $id_document);
 			$link_transformer = "<font size='1'>[<b><a ".$link->getHref().">Transformer en document</a></b>]</font>\n";
 		} else if ($mode == 'document') {
-			$link = new Link();
-			$link->addVar('transformer_image','vignette');
-			$link->addVar('id_document',$id_document);
+			$link = new Link($redirect_url);
+			$link->addVar('transformer_image', 'vignette');
+			$link->addVar('id_document', $id_document);
 			$link_transformer = "<font size='1'>[<b><a ".$link->getHref().">Transformer en image affichable</a></b>]</font>\n";
 		}
 	}
@@ -257,7 +258,14 @@ function afficher_document($id_document, $id_doc_actif = 0) {
 			echo texte_vignette($largeur_vignette, $hauteur_vignette, $fichier_vignette);
 			echo "<font size='2'>\n";
 			$hash = calculer_action_auteur("supp_doc ".$id_vignette);
-			echo "[<a href='../spip_image.php3?redirect=".urlencode("article_documents.php3")."&id_document=$id_document&id_article=$id_article&hash_id_auteur=$connect_id_auteur&hash=$hash&doc_supp=$id_vignette'>";
+
+			$link = $image_link;
+			$link->addVar('redirect', $redirect_url);
+			$link->addVar('hash', calculer_action_auteur("supp_doc ".$id_vignette));
+			$link->addVar('hash_id_auteur', $connect_id_auteur);
+			$link->addVar('doc_supp', $id_vignette);
+
+			echo "[<a ".$link->getHref().">";
 			echo "supprimer la vignette";
 			echo "</a>]</font><br>\n";
 			echo $raccourci_doc;
@@ -276,14 +284,14 @@ function afficher_document($id_document, $id_doc_actif = 0) {
 
 			echo "<div align='left'>\n";
 			$hash = calculer_action_auteur("ajout_doc");
-			$link = new Link('../spip_image.php3');
-			$link->addVar('redirect', $this_link->getUrl());
+
+			$link = $image_link;
+			$link->addVar('redirect', $redirect_url);
+			$link->addVar('hash', calculer_action_auteur("ajout_doc"));
+			$link->addVar('hash_id_auteur', $connect_id_auteur);
 			$link->addVar('ajout_doc', 'oui');
 			$link->addVar('id_document', $id_document);
-			$link->addVar('id_article', $id_article);
 			$link->addVar('mode', 'vignette');
-			$link->addVar('hash_id_auteur', $connect_id_auteur);
-			$link->addVar('hash', $hash);
 	
 			afficher_upload($link, 'Charger une vignette&nbsp;:', 'image');
 			echo "</div>\n";
@@ -307,10 +315,10 @@ function afficher_document($id_document, $id_doc_actif = 0) {
 function pave_documents($id_article) {
 	global $puce;
 
-	$result_doc = mysql_query(("SELECT type.extension AS extension, COUNT(doc.id_document) AS cnt
+	$result_doc = mysql_query("SELECT type.extension AS extension, COUNT(doc.id_document) AS cnt
 		FROM spip_types_documents AS type, spip_documents AS doc, spip_documents_articles AS lien
 		WHERE lien.id_article=$id_article AND doc.id_document = lien.id_document AND doc.id_type = type.id_type
-		GROUP BY doc.id_type"));
+		GROUP BY doc.id_type");
 	while ($type = mysql_fetch_object($result_doc)) {
 		$documents .= $puce.$type->cnt." ".$type->extension."<br>";
 		$nbdoc += $type->cnt;
diff --git a/ecrire/inc_version.php3 b/ecrire/inc_version.php3
index 3750e4cc7f..ab59a38c24 100644
--- a/ecrire/inc_version.php3
+++ b/ecrire/inc_version.php3
@@ -12,7 +12,7 @@ define("_ECRIRE_INC_VERSION", "1");
 // (utilise pour les modifs de la base de donnees)
 //
 
-$spip_version = 1.409; // version de la base
+$spip_version = 1.410; // version de la base
 
 // dernier tag connu ou date si cvs
 if (! ereg('Name: v(.*) ','$Name$', $regs))
diff --git a/spip_image.php3 b/spip_image.php3
index 233a73ea17..8d698c5bce 100644
--- a/spip_image.php3
+++ b/spip_image.php3
@@ -25,6 +25,33 @@ function deplacer_fichier_upload($source, $dest) {
 }
 
 
+//
+// Convertit le type numerique retourne par getimagesize() en extension fichier
+//
+
+function decoder_type_image($type, $strict = false) {
+	switch ($type) {
+	case 1:
+		return "gif";
+	case 2:
+		return "jpg";
+	case 3:
+		return "png";
+	case 4:
+		return $strict ? "" : "swf";
+	case 5:
+		return "psd";
+	case 6:
+		return "bmp";
+	case 7:
+	case 8:
+		return "tif";
+	default:
+		return "";
+	}
+}
+
+
 //
 // Ajouter une image (logo)
 //
@@ -42,13 +69,8 @@ function ajout_image($source, $dest) {
 
 	// analyse le type de l'image (on ne fait pas confiance au nom de
 	// fichier envoye par le browser : pour les Macs c'est plus sur)
-	$size = getimagesize($loc);
-	$type = $size[2];
-
-	if ($type=="1") $type="gif";
-	else if ($type=="2") $type="jpg";
-	else if ($type=="3") $type="png";
-	else $type = "";
+	$size = @getimagesize($loc);
+	$type = decoder_type_image($size[2], true);
 
 	if ($type) {
 		rename($loc, "$loc.$type");
@@ -88,8 +110,9 @@ function ajout_doc($orig, $source, $dest, $mode, $id_document) {
 	$result = mysql_query($query);
 	if ($row = @mysql_fetch_array($result)) {
 		$id_type = $row['id_type'];
+		$type_inclus = $row['inclus'];
 	}
-	else return array(false,0);
+	else return false;
 
 	//
 	// Preparation
@@ -124,14 +147,14 @@ function ajout_doc($orig, $source, $dest, $mode, $id_document) {
 	else
 		$dest_path = "IMG/$dest";
 
-	if (!deplacer_fichier_upload($source, $dest_path)) return;
+	if (!deplacer_fichier_upload($source, $dest_path)) return false;
 
 	//
 	// Recopier le fichier
 	//
 
 	$size_image = getimagesize($dest_path);
-	$type_image = $size_image[2];
+	$type_image = decoder_type_image($size_image[2]);
 	if ($type_image) {
 		$largeur = $size_image[0];
 		$hauteur = $size_image[1];
@@ -139,7 +162,7 @@ function ajout_doc($orig, $source, $dest, $mode, $id_document) {
 	$taille = filesize($dest_path);
 
 	if ($nouveau) {
-		if (!$mode) $mode = $type_image ? 'vignette' : 'document';
+		if (!$mode) $mode = ($type_image AND $type_inclus == 'image') ? 'vignette' : 'document';
 		$titre = ereg_replace("\..*$", "", $orig);
 		$titre = ereg_replace("ecrire/|upload/", "", $titre);
 		$titre = strtr($titre, "_", " ");
@@ -156,25 +179,23 @@ function ajout_doc($orig, $source, $dest, $mode, $id_document) {
 		$id_document = $id_document_lie; // pour que le 'return' active le bon doc.
 	}
 
-	return array (true,$id_document) ; // on veut bien effacer le fichier s'il est dans ftp/upload/
+	return $id_document;
 }
 
 
 
 // image_name n'est valide que par POST http, mais pas par la methode ftp/upload
 // par ailleurs, pour un fichier ftp/upload, il faut effacer l'original nous-memes
-$effacer_si_ok = false;
 if (!$image_name AND $image2) {
 	$image = "ecrire/upload/".$image2;
 	$image_name = $image;
-	$effacer_si_ok = true;
 }
 
 //
 // ajouter un document
 //
 if ($ajout_doc == 'oui') {
-	list ($ok, $id_document) = ajout_doc($image_name, $image, $fichier, $mode, $id_document);
+	$id_document = ajout_doc($image_name, $image, $fichier, $mode, $id_document);
 }
 
 
@@ -226,7 +247,7 @@ $redirect_url = "ecrire/" . $vars["redirect"];
 $link = new Link($redirect_url);
 reset($vars);
 while (list ($key, $val) = each ($vars)) {
-	if (!ereg("^(redirect|image.*|hash.*|ajout.*|doc.*|id_document|transformer.*)$", $key)) {
+	if (!ereg("^(redirect|image.*|hash.*|ajout.*|doc.*|transformer.*)$", $key)) {
 		$link->addVar($key, $val);
 	}
 }
-- 
GitLab