From dc4d911fdfa33d0dfc005eaa66024e5fc8e44183 Mon Sep 17 00:00:00 2001
From: "Committo,Ergo:sum" <esj@rezo.net>
Date: Thu, 30 Nov 2006 10:29:45 +0000
Subject: [PATCH] =?UTF-8?q?[7980]=C2=A0suite:=20pas=20de=20lien=20vers=20l?=
 =?UTF-8?q?'=C3=A9dition=20si=20pas=20les=20droits=20(Fil).?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 ecrire/inc/formater_article.php |  2 +-
 ecrire/inc/presentation.php     | 24 +++++++++++++++---------
 2 files changed, 16 insertions(+), 10 deletions(-)

diff --git a/ecrire/inc/formater_article.php b/ecrire/inc/formater_article.php
index 1ade1dd474..d4e73a2f3c 100644
--- a/ecrire/inc/formater_article.php
+++ b/ecrire/inc/formater_article.php
@@ -86,7 +86,7 @@ function inc_formater_article_dist($row)
 	$s = affdate_jourcourt($date);
 	$vals[] = $s ? $s : '&nbsp;';
 
-	if  ($nb) $vals[]= afficher_numero_edit($id_article, 'id_article', 'articles_edit');
+	if  ($nb) $vals[]= afficher_numero_edit($id_article, 'id_article', 'article');
 
 	if ($options == "avancees") { // Afficher le numero (JMB)
 		  $largeurs = array(11, '', 80, 100, 50);
diff --git a/ecrire/inc/presentation.php b/ecrire/inc/presentation.php
index 32ce8ed151..9397c522c9 100644
--- a/ecrire/inc/presentation.php
+++ b/ecrire/inc/presentation.php
@@ -929,7 +929,7 @@ function afficher_breves_boucle($row, &$tous_id,  $voir_logo, $own)
 	$vals[] = $s;
 			
 	if ($options == "avancees") {
-		$vals[] = afficher_numero_edit($id_breve, 'id_breve', 'breves_edit');
+		$vals[] = afficher_numero_edit($id_breve, 'id_breve', 'breve');
 	}
 			
 	return $vals;
@@ -1780,7 +1780,6 @@ function meme_rubrique($id_rubrique, $id, $type, $order='date', $limit=30)
 	if ($options != "avancees") return '';
 
 	$table = $type . 's';
-	$script = $type . 's_edit';
 	$key = 'id_' . $type;
 
 	$voss = spip_query("SELECT $key AS id, titre, statut FROM spip_$table WHERE id_rubrique=$id_rubrique AND (statut = 'publie' OR statut = 'prop') AND ($key != $id) ORDER BY $order DESC LIMIT $limit");
@@ -1791,7 +1790,7 @@ function meme_rubrique($id_rubrique, $id, $type, $order='date', $limit=30)
 
 	while($row = spip_fetch_array($voss)) {
 		$n = $row['id'];
-		$retour .= afficher_numero_edit($n, $key, $script)
+		$retour .= afficher_numero_edit($n, $key, $type)
 		. "<a class='"
 		. $row['statut']
 		. "' style='font-size: 10px;' href='"
@@ -1810,23 +1809,30 @@ function meme_rubrique($id_rubrique, $id, $type, $order='date', $limit=30)
 }
 
 // http://doc.spip.org/@afficher_numero_edit
-function afficher_numero_edit($id, $key, $script)
+function afficher_numero_edit($id, $key, $type)
 {
 	global $spip_lang_right, $spip_lang_left;
 	static $numero , $style='' ;
-	
+
 	if (!$style) {
 		$style = " style='float: $spip_lang_right; padding-$spip_lang_left: 4px;font-size: 10px; color: black; '"; 
 
 		$numero = _T('info_numero_abbreviation');
 	}
 
-	return "<a$style\nhref='"
-	. generer_url_ecrire($script,"$key=$id")
-	. "'><b>"
+	if (!autoriser('modifier',$type,$id)) {
+		$bal ='span';
+		$href = '';
+	} else {
+		$bal = 'a';
+		$href = "\nhref='"
+		. generer_url_ecrire($type . "s_edit","$key=$id")
+		. "'";
+	}
+	return "<$bal$style$href><b>"
 	. $numero
 	. $id
-	. "</b></a>";
+	. "</b></$bal>";
 }
 
 //
-- 
GitLab