From e249bf62425e47cf9ece0c5064cb72bd6df2f967 Mon Sep 17 00:00:00 2001
From: Fil <fil@rezo.net>
Date: Wed, 26 Nov 2003 01:25:31 +0000
Subject: [PATCH] =?UTF-8?q?traducteurs=20r=C3=A9cup=C3=A8rent=20le=20texte?=
 =?UTF-8?q?=20original=20(sauf=20le=20titre)=20lorsqu'ils=20appellent=20la?=
 =?UTF-8?q?=20page=20"traduire=20cet=20article"?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 ecrire/articles_edit.php3 | 53 ++++++++++++++++++++++++---------------
 1 file changed, 33 insertions(+), 20 deletions(-)

diff --git a/ecrire/articles_edit.php3 b/ecrire/articles_edit.php3
index 56923ff25a..73cb0611ed 100644
--- a/ecrire/articles_edit.php3
+++ b/ecrire/articles_edit.php3
@@ -22,6 +22,8 @@ unset ($flag_editable);
 // Creation de l'objet article
 //
 
+unset ($row);
+
 if ($id_article) {
 	spip_query("UPDATE spip_articles SET date_modif=NOW(), auteur_modif=$connect_id_auteur WHERE id_article=$id_article");
 	$id_article_bloque = $id_article;	// message pour inc_presentation
@@ -32,27 +34,7 @@ if ($id_article) {
 
 	if ($row = spip_fetch_array($result)) {
 		$id_article = $row["id_article"];
-		$surtitre = $row["surtitre"];
 		$titre = $row["titre"];
-		$soustitre = $row["soustitre"];
-		$id_rubrique = $row["id_rubrique"];
-		$id_secteur = $row['id_secteur'];
-		$descriptif = $row["descriptif"];
-		$nom_site = $row["nom_site"];
-		$url_site = $row["url_site"];
-		$chapo = $row["chapo"];
-		$texte = $row["texte"];
-		$ps = $row["ps"];
-		$date = $row["date"];
-		$statut = $row['statut'];
-		$date_redac = $row['date_redac'];
-	    	if (ereg("([0-9]{4})-([0-9]{2})-([0-9]{2})",$date_redac,$regs)){
-		        $mois_redac = $regs[2];
-		        $jour_redac = $regs[3];
-		        $annee_redac = $regs[1];
-		        if ($annee_redac > 4000) $annee_redac -= 9000;
-		}
-		$extra=$row["extra"];
 
 		$query = "SELECT * FROM spip_auteurs_articles WHERE id_article=$id_article AND id_auteur=$connect_id_auteur";
 		$result_auteur = spip_query($query);
@@ -66,6 +48,37 @@ else if ($new=='oui') {
 	$titre = filtrer_entites(_T('info_nouvel_article'));
 	$row_rub = spip_fetch_array(spip_query("SELECT id_secteur FROM spip_rubriques WHERE id_rubrique=$id_rubrique"));
 	$id_secteur = $row_rub['id_secteur'];
+
+	// creation d'une traduction : recuperer les elements du texte original si on a les droits
+	if ($lier_trad = intval($lier_trad)) {
+		$row_tmp = spip_fetch_array(spip_query("SELECT * FROM spip_articles WHERE id_article=$lier_trad"));
+		if (($connect_statut == '0minirezo' AND acces_rubrique($row_tmp['id_rubrique']))
+		OR ($row_tmp['statut'] == 'publie') OR ($row_tmp['statut'] == 'prop'))
+			$row = $row_tmp;
+	}
+}
+
+if ($row) {
+	$surtitre = $row["surtitre"];
+	$soustitre = $row["soustitre"];
+	$id_rubrique = $row["id_rubrique"];
+	$id_secteur = $row['id_secteur'];
+	$descriptif = $row["descriptif"];
+	$nom_site = $row["nom_site"];
+	$url_site = $row["url_site"];
+	$chapo = $row["chapo"];
+	$texte = $row["texte"];
+	$ps = $row["ps"];
+	$date = $row["date"];
+	$statut = $row['statut'];
+	$date_redac = $row['date_redac'];
+    	if (ereg("([0-9]{4})-([0-9]{2})-([0-9]{2})",$date_redac,$regs)){
+	        $mois_redac = $regs[2];
+	        $jour_redac = $regs[3];
+	        $annee_redac = $regs[1];
+	        if ($annee_redac > 4000) $annee_redac -= 9000;
+	}
+	$extra=$row["extra"];
 }
 
 if (!$flag_editable) {
-- 
GitLab