From c115fe6fb97965f6599f8cc47b25742a7f24b3a6 Mon Sep 17 00:00:00 2001
From: Cerdic <cedric@yterium.com>
Date: Sat, 20 Jan 2007 17:35:49 +0000
Subject: [PATCH] "tous les autoriser('voir',...) qu'il faut pour du filtrage
 dans l'espace prive. Inclus l'affichage de articles_tous, de l'accueil, et du
 selecteur de rubrique pour les articles"

---
 ecrire/exec/articles_edit.php     |   9 +-
 ecrire/exec/articles_tous.php     |  68 +++---
 ecrire/exec/articles_versions.php |  10 +-
 ecrire/exec/breves_edit.php       |  27 ++-
 ecrire/exec/breves_voir.php       |  18 +-
 ecrire/exec/rubriques_edit.php    |  16 +-
 ecrire/exec/sites.php             |   8 +-
 ecrire/exec/sites_edit.php        |   9 +-
 ecrire/inc/chercher_rubrique.php  |  20 +-
 ecrire/inc/plonger.php            |  12 +-
 ecrire/inc/presentation.php       |  95 +++++----
 ecrire/inc/sites_voir.php         | 334 +++++++++++++++---------------
 ecrire/inc/suivi_versions.php     | 118 +++++------
 13 files changed, 404 insertions(+), 340 deletions(-)

diff --git a/ecrire/exec/articles_edit.php b/ecrire/exec/articles_edit.php
index f84d534d74..bdd578171d 100644
--- a/ecrire/exec/articles_edit.php
+++ b/ecrire/exec/articles_edit.php
@@ -31,6 +31,14 @@ function exec_articles_edit_dist()
 // http://doc.spip.org/@articles_edit
 function articles_edit($id_article, $id_rubrique,$lier_trad,  $id_version, $new, $config_fonc)
 {
+	$commencer_page = charger_fonction('commencer_page', 'inc');
+	if (!autoriser('voir', 'article', $id_article)
+		OR !autoriser('modifier','article', $id_article)) {
+		echo $commencer_page(_T('info_modifier_titre', array('titre' => $titre)), "naviguer", "rubriques", $id_rubrique);
+		echo "<strong>"._T('avis_acces_interdit')."</strong>";
+		echo fin_page();
+		exit;
+	}
 
 	pipeline('exec_init',array('args'=>array('exec'=>'articles_edit','id_article'=>$id_article),'data'=>''));
 	
@@ -47,7 +55,6 @@ function articles_edit($id_article, $id_rubrique,$lier_trad,  $id_version, $new,
 	if ($id_version) $titre.= ' ('._T('version')." $id_version)";
 	else $titre = $row['titre'];
 
-	$commencer_page = charger_fonction('commencer_page', 'inc');
 	echo $commencer_page(_T('titre_page_articles_edit', array('titre' => $titre)), "naviguer", "articles", $id_rubrique);
 
 	debut_grand_cadre();
diff --git a/ecrire/exec/articles_tous.php b/ecrire/exec/articles_tous.php
index d04d034a30..f5ca002188 100644
--- a/ecrire/exec/articles_tous.php
+++ b/ecrire/exec/articles_tous.php
@@ -88,14 +88,16 @@ function arbo_articles_tous()
 	$first_couche = 0;
 	while ($row = spip_fetch_array($result)) {
 		$id_rubrique = $row['id_rubrique'];
-		$id_parent = $row['id_parent'];
-		$enfant[$id_parent][$id_rubrique] = typo($row['titre']);
-		$nom_block = "rubrique$id_rubrique";
-		if (!isset($numero_block[$nom_block])){
-			$compteur_block++;
-			$numero_block[$nom_block] = $compteur_block;
-
-			if (!$first_couche) $first_couche = $compteur_block;
+		if (autoriser('voir','rubrique',$id_rubrique)){
+			$id_parent = $row['id_parent'];
+			$enfant[$id_parent][$id_rubrique] = typo($row['titre']);
+			$nom_block = "rubrique$id_rubrique";
+			if (!isset($numero_block[$nom_block])){
+				$compteur_block++;
+				$numero_block[$nom_block] = $compteur_block;
+	
+				if (!$first_couche) $first_couche = $compteur_block;
+			}
 		}
 	}
 	$last_couche = $first_couche ? $compteur_block : 0;
@@ -121,32 +123,34 @@ function texte_articles_tous(&$sel_lang, $flag_trad, $aff_art){
 	while($row = spip_fetch_array($result)) {
 		$id_rubrique=$row['id_rubrique'];
 		$id_article = $row['id_article'];
-		$titre = typo($row['titre']);
-		$statut = $row['statut'];
-		$lang = $row['lang'];
-		$id_trad = $row['id_trad'];
-		$date_modif = $row['date_modif'];
-		
-		$aff_statut[$statut] = true; // signale qu'il existe de tels articles
-		$text_article[$id_article]["titre"] = strlen($titre)?$titre:_T('ecrire:info_sans_titre');
-		$text_article[$id_article]["statut"] = $statut;
-		$text_article[$id_article]["lang"] = $lang;
-		$text_article[$id_article]["id_trad"] = $id_trad;
-		$text_article[$id_article]["date_modif"] = $date_modif;
-		$GLOBALS['langues_utilisees'][$lang] = true;
-		
-		if (count($langues) > 1) {
-			while (list(, $l) = each ($langues)) {
-				if (in_array($l, $sel_lang)) $text_article[$id_article]["trad"]["$l"] =  "<span class='creer'>$l</span>";
+		if (autoriser('voir','article',$id_article)){
+			$titre = typo($row['titre']);
+			$statut = $row['statut'];
+			$lang = $row['lang'];
+			$id_trad = $row['id_trad'];
+			$date_modif = $row['date_modif'];
+			
+			$aff_statut[$statut] = true; // signale qu'il existe de tels articles
+			$text_article[$id_article]["titre"] = strlen($titre)?$titre:_T('ecrire:info_sans_titre');
+			$text_article[$id_article]["statut"] = $statut;
+			$text_article[$id_article]["lang"] = $lang;
+			$text_article[$id_article]["id_trad"] = $id_trad;
+			$text_article[$id_article]["date_modif"] = $date_modif;
+			$GLOBALS['langues_utilisees'][$lang] = true;
+			
+			if (count($langues) > 1) {
+				while (list(, $l) = each ($langues)) {
+					if (in_array($l, $sel_lang)) $text_article[$id_article]["trad"]["$l"] =  "<span class='creer'>$l</span>";
+				}
 			}
+			
+			if ($id_trad == $id_article OR $id_trad == 0) {
+				$text_article[$id_article]["trad"]["$lang"] = "<span class='lang_base'$spip_dir_lang>$lang</span>";
+			}
+			
+			if (in_array($statut, $aff_art))
+				$article[$id_rubrique][] = $id_article;
 		}
-		
-		if ($id_trad == $id_article OR $id_trad == 0) {
-			$text_article[$id_article]["trad"]["$lang"] = "<span class='lang_base'$spip_dir_lang>$lang</span>";
-		}
-		
-		if (in_array($statut, $aff_art))
-			$article[$id_rubrique][] = $id_article;
 	}
 
 	if ($text_article)
diff --git a/ecrire/exec/articles_versions.php b/ecrire/exec/articles_versions.php
index b3f4c80407..86bb6021ac 100644
--- a/ecrire/exec/articles_versions.php
+++ b/ecrire/exec/articles_versions.php
@@ -30,7 +30,14 @@ function exec_articles_versions_dist()
 
 	$id_article = intval($id_article);
 	$row = spip_fetch_array(spip_query("SELECT * FROM spip_articles WHERE id_article='$id_article'"));
-
+	$commencer_page = charger_fonction('commencer_page', 'inc');
+	if (!autoriser('voir', 'article', $id_article)
+		OR !autoriser('modifier','article', $id_article)) {
+		echo $commencer_page(_T('info_modifier_titre', array('titre' => $titre)), "naviguer", "rubriques", $id_rubrique);
+		echo "<strong>"._T('avis_acces_interdit')."</strong>";
+		echo fin_page();
+		exit;
+	}
 	if(!(autoriser('voirrevisions', 'article', $id_article) AND $row)) {
 		include_spip('minipres');
 		echo minipres();
@@ -59,7 +66,6 @@ function exec_articles_versions_dist()
 
 
 
-	$commencer_page = charger_fonction('commencer_page', 'inc');
 	echo $commencer_page(_T('info_historique')." &laquo; $titre &raquo;", "naviguer", "articles", $id_rubrique);
 
 	debut_grand_cadre();
diff --git a/ecrire/exec/breves_edit.php b/ecrire/exec/breves_edit.php
index f80848afce..7f8defd030 100644
--- a/ecrire/exec/breves_edit.php
+++ b/ecrire/exec/breves_edit.php
@@ -21,11 +21,19 @@ function exec_breves_edit_dist()
 {
 	global $connect_statut, $connect_id_rubrique, $spip_ecran;
 
-    $id_breve = intval(_request('id_breve'));
-    $id_rubrique  = intval(_request('id_rubrique'));
-    $new = _request('new');
+	$id_breve = intval(_request('id_breve'));
+	$id_rubrique  = intval(_request('id_rubrique'));
+	$new = _request('new');
+
+	if ( (!$new AND !autoriser('voir','breve',$id_breve))
+		OR ($new AND !autoriser('voir','rubrique',$id_rubrique)) ) {
+		echo $commencer_page("&laquo; $titre_breve &raquo;", "naviguer", "breves", $id_rubrique);
+		echo "<strong>"._T('avis_acces_interdit')."</strong>";
+		echo fin_page();
+		exit;
+	}
 
-    if ($new != "oui") {
+	if ($new != "oui") {
 	$result = spip_query("SELECT * FROM spip_breves WHERE id_breve=$id_breve");
 
 	
@@ -38,13 +46,14 @@ function exec_breves_edit_dist()
 		$statut=$row['statut'];
 		$id_rubrique=$row['id_rubrique'];
 		$extra = $row['extra'];
-	} else 
-	      {include_spip('minipres');
+	} 
+	else {
+		include_spip('minipres');
 		echo minipres();
 		exit;
-	      }
+	}
 
-    } else {
+	} else {
 	$titre = filtrer_entites(_T('titre_nouvelle_breve'));
 	$texte = "";
 	$onfocus = " onfocus=\"if(!antifocus){this.value='';antifocus=true;}\"";
@@ -53,7 +62,7 @@ function exec_breves_edit_dist()
 	$statut = "prop";
 	$row = spip_fetch_array(spip_query("SELECT id_secteur FROM spip_rubriques WHERE id_rubrique = ".intval($id_rubrique)));
 	$id_rubrique = $row['id_secteur'];
-}
+	}
 
 pipeline('exec_init',array('args'=>array('exec'=>'breves_edit','id_breve'=>$id_breve),'data'=>''));
 
diff --git a/ecrire/exec/breves_voir.php b/ecrire/exec/breves_voir.php
index fde965659e..978b5eb081 100644
--- a/ecrire/exec/breves_voir.php
+++ b/ecrire/exec/breves_voir.php
@@ -34,13 +34,22 @@ function afficher_breves_voir($id_breve, $cherche_mot, $select_groupe)
 		$lien_url=$row['lien_url'];
 		$statut=$row['statut'];
 		$id_rubrique=$row['id_rubrique'];
-	} else 
-	      {include_spip('minipres');
+	}
+	else {
+		include_spip('minipres');
 		echo minipres();
 		exit;
-	      }
+	}
 
-	$flag_editable = (autoriser('publierdans','rubrique',$id_rubrique) OR $statut == 'prop');
+	$commencer_page = charger_fonction('commencer_page', 'inc');
+	if (!autoriser('voir','breve',$id_breve)){
+		echo $commencer_page("&laquo; $titre_breve &raquo;", "naviguer", "breves", $id_rubrique);
+		echo "<strong>"._T('avis_acces_interdit')."</strong>";
+		echo fin_page();
+		exit;
+	}
+
+	$flag_editable = autoriser('modifier','breve',$id_breve);
 
 	// Est-ce que quelqu'un a deja ouvert la breve en edition ?
 	if ($flag_editable
@@ -58,7 +67,6 @@ function afficher_breves_voir($id_breve, $cherche_mot, $select_groupe)
 		)
 	);
 
-	$commencer_page = charger_fonction('commencer_page', 'inc');
 	echo $commencer_page("&laquo; $titre_breve &raquo;", "naviguer", "breves", $id_rubrique);
 	
 	debut_grand_cadre();
diff --git a/ecrire/exec/rubriques_edit.php b/ecrire/exec/rubriques_edit.php
index c095e85ebb..9d69f86a2b 100644
--- a/ecrire/exec/rubriques_edit.php
+++ b/ecrire/exec/rubriques_edit.php
@@ -26,11 +26,6 @@ function exec_rubriques_edit_dist()
 	  $new,
 	  $options;
 
-	if ($connect_statut !='0minirezo')  {
-		echo _T('avis_acces_interdit');
-		exit;
-	}
-
 	if ($new == "oui") {
 		$id_rubrique = 0;
 		$titre = filtrer_entites(_T('titre_nouvelle_rubrique'));
@@ -56,9 +51,18 @@ function exec_rubriques_edit_dist()
 		$id_secteur = $row['id_secteur'];
 		$extra = $row["extra"];
 	}
+	$commencer_page = charger_fonction('commencer_page', 'inc');
+
+	if ($connect_statut !='0minirezo'
+	OR ($new AND !autoriser('voir','rubrique',$id_parent))
+	OR (!$new AND !autoriser('voir','rubrique',$id_rubrique)))  {
+		echo $commencer_page(_T('info_modifier_titre', array('titre' => $titre)), "naviguer", "rubriques", $id_rubrique);
+		echo "<strong>"._T('avis_acces_interdit')."</strong>";
+		echo fin_page();
+		exit;
+	}
 
 	pipeline('exec_init',array('args'=>array('exec'=>'rubriques_edit','id_rubrique'=>$id_rubrique),'data'=>''));
-	$commencer_page = charger_fonction('commencer_page', 'inc');
 	echo $commencer_page(_T('info_modifier_titre', array('titre' => $titre)), "naviguer", "rubriques", $id_rubrique);
 
 	if ($id_parent == 0) $ze_logo = "secteur-24.gif";
diff --git a/ecrire/exec/sites.php b/ecrire/exec/sites.php
index 946115b1e7..fd7504b92e 100644
--- a/ecrire/exec/sites.php
+++ b/ecrire/exec/sites.php
@@ -26,6 +26,13 @@ function exec_sites_dist()
 	global $cherche_mot, $select_groupe, $id_syndic;
 
 	$id_syndic = intval($id_syndic);
+	$commencer_page = charger_fonction('commencer_page', 'inc');
+	if (!autoriser('voir','site',$id_syndic)){
+		echo $commencer_page("$titre_page","naviguer","sites", $id_rubrique);
+		echo "<strong>"._T('avis_acces_interdit')."</strong>";
+		echo fin_page();
+		exit;
+	}
 
 	$result = spip_query("SELECT * FROM spip_syndic WHERE id_syndic=$id_syndic");
 
@@ -57,7 +64,6 @@ function exec_sites_dist()
 	pipeline('exec_init',array('args'=>array('exec'=>'sites','id_syndic'=>$id_syndic),'data'=>''));
 
 
-	$commencer_page = charger_fonction('commencer_page', 'inc');
 	echo $commencer_page("$titre_page","naviguer","sites", $id_rubrique);
 
 	debut_grand_cadre();
diff --git a/ecrire/exec/sites_edit.php b/ecrire/exec/sites_edit.php
index f8e0575bae..43db3de4ef 100644
--- a/ecrire/exec/sites_edit.php
+++ b/ecrire/exec/sites_edit.php
@@ -19,6 +19,14 @@ function exec_sites_edit_dist()
 	global $connect_statut, $descriptif, $id_rubrique, $id_secteur, $id_syndic, $new, $nom_site, $syndication, $url_site, $url_syndic, $connect_id_rubrique;
 
 	$result = spip_query("SELECT * FROM spip_syndic WHERE id_syndic=" . intval($id_syndic));
+	$commencer_page = charger_fonction('commencer_page', 'inc');
+	if (!autoriser('voir','site',$id_syndic)
+	  OR !autoriser('modifier','site',$id_syndic)){
+		echo $commencer_page(_T('info_site_reference_2'), "naviguer", "sites", $id_rubrique);
+		echo "<strong>"._T('avis_acces_interdit')."</strong>";
+		echo fin_page();
+		exit;
+	}
 
 	if ($row = spip_fetch_array($result)) {
 		$id_syndic = $row["id_syndic"];
@@ -41,7 +49,6 @@ function exec_sites_edit_dist()
 	}
 	pipeline('exec_init',array('args'=>array('exec'=>'sites_edit','id_syndic'=>$id_syndic),'data'=>''));
 
-	$commencer_page = charger_fonction('commencer_page', 'inc');
 	echo $commencer_page(_T('info_site_reference_2'), "naviguer", "sites", $id_rubrique);
 
 	debut_grand_cadre();
diff --git a/ecrire/inc/chercher_rubrique.php b/ecrire/inc/chercher_rubrique.php
index 687d4c6719..d8c74dc295 100644
--- a/ecrire/inc/chercher_rubrique.php
+++ b/ecrire/inc/chercher_rubrique.php
@@ -157,15 +157,17 @@ function selecteur_rubrique_html($id_rubrique, $type, $restreint, $idem=0) {
 
 	$q = spip_query("SELECT id_rubrique, id_parent, titre, statut, lang, langue_choisie FROM spip_rubriques " . ($type == 'breve' ?  'WHERE id_parent=0 ' : '') . "ORDER BY 0+titre,titre");
 	while ($r = spip_fetch_array($q)) {
-		// titre largeur maxi a 50
-		$titre = couper(supprimer_tags(typo(extraire_multi($r['titre']
-		)))." ", 50);
-		if ($GLOBALS['meta']['multi_rubriques'] == 'oui'
-		AND ($r['langue_choisie'] == "oui" OR $r['id_parent'] == 0))
-			$titre .= ' ['.traduire_nom_langue($r['lang']).']';
-		$data[$r['id_rubrique']] = $titre;
-		$enfants[$r['id_parent']][] = $r['id_rubrique'];
-		if ($id_rubrique == $r['id_rubrique']) $id_parent = $r['id_parent'];
+		if (autoriser('voir','rubrique',$r['id_rubrique'])){
+			// titre largeur maxi a 50
+			$titre = couper(supprimer_tags(typo(extraire_multi($r['titre']
+			)))." ", 50);
+			if ($GLOBALS['meta']['multi_rubriques'] == 'oui'
+			AND ($r['langue_choisie'] == "oui" OR $r['id_parent'] == 0))
+				$titre .= ' ['.traduire_nom_langue($r['lang']).']';
+			$data[$r['id_rubrique']] = $titre;
+			$enfants[$r['id_parent']][] = $r['id_rubrique'];
+			if ($id_rubrique == $r['id_rubrique']) $id_parent = $r['id_parent'];
+		}
 	}
 
 
diff --git a/ecrire/inc/plonger.php b/ecrire/inc/plonger.php
index 5d6e5db0c0..59b4973b53 100644
--- a/ecrire/inc/plonger.php
+++ b/ecrire/inc/plonger.php
@@ -27,11 +27,13 @@ function inc_plonger_dist($id_rubrique, $idom="", $list=array(), $col = 1, $excl
 	$res = spip_query("SELECT rub1.id_rubrique, rub1.titre, rub1.id_parent, rub1.lang, rub1.langue_choisie FROM spip_rubriques AS rub1, spip_rubriques AS rub2 WHERE ((rub1.id_parent = $id_rubrique) OR (rub2.id_parent = $id_rubrique AND rub1.id_parent=rub2.id_rubrique)) AND rub1.id_rubrique!=$exclu GROUP BY rub1.id_rubrique");
 
 	while ($row = spip_fetch_array($res)) {
-		$rub[$row['id_parent']]['enfants'] = true;
-		if ($row['id_parent'] == $id_rubrique)
-			$ordre[$row['id_rubrique']]= trim(typo($row['titre']))
-			. (($row['langue_choisie'] != 'oui')
-			   ? '' : (' [' . $row['lang'] . ']'));
+		if (autoriser('voir','rubrique',$row['id_rubrique'])){
+			$rub[$row['id_parent']]['enfants'] = true;
+			if ($row['id_parent'] == $id_rubrique)
+				$ordre[$row['id_rubrique']]= trim(typo($row['titre']))
+				. (($row['langue_choisie'] != 'oui')
+				   ? '' : (' [' . $row['lang'] . ']'));
+		}
 	}
 	$next = isset($list[$col]) ? $list[$col] : 0;
 	if ($ordre) {
diff --git a/ecrire/inc/presentation.php b/ecrire/inc/presentation.php
index 79e6bc1e96..053473093d 100644
--- a/ecrire/inc/presentation.php
+++ b/ecrire/inc/presentation.php
@@ -723,7 +723,9 @@ function afficher_articles_trad($titre_table, $requete, $formater, $tmp_var, $ha
 
 	$q = spip_query("SELECT " . $requete['SELECT'] . " FROM " . $requete['FROM'] . ($requete['WHERE'] ? (' WHERE ' . $requete['WHERE']) : '') . ($requete['GROUP BY'] ? (' GROUP BY ' . $requete['GROUP BY']) : '') . ($requete['ORDER BY'] ? (' ORDER BY ' . $requete['ORDER BY']) : '') . " LIMIT " . ($deb_aff >= 0 ? "$deb_aff, $nb_aff" : ($requete['LIMIT'] ? $requete['LIMIT'] : "99999")));
 	$t = '';
-	while ($r = spip_fetch_array($q)) $t .= $formater($r);
+	while ($r = spip_fetch_array($q))
+		if (autoriser('voir','article',$r['id_article']))
+			$t .= $formater($r);
 	spip_free_result($q);
 
 	$style = "style='visibility: hidden; float: $spip_lang_right'";
@@ -897,53 +899,54 @@ function afficher_breves_boucle($row, &$tous_id,  $voir_logo, $own)
 	$vals = '';
 
 	$id_breve = $row['id_breve'];
-	$tous_id[] = $id_breve;
-	$date_heure = $row['date_heure'];
-	$titre = sinon($row['titre'], _T('ecrire:info_sans_titre'));
-	$statut = $row['statut'];
-	if (isset($row['lang']))
-	  changer_typo($lang = $row['lang']);
-	else $lang = $langue_defaut;
-	$id_rubrique = $row['id_rubrique'];
-			
-	$vals[] = puce_statut_breve($id_breve, $statut, 'breve', ($droit && autoriser('publierdans','rubrique',$id_rubrique)));
-
-	$s = "\n<div>";
-	$s .= "<a href='" . generer_url_ecrire("breves_voir","id_breve=$id_breve") . "' style=\"display:block;\">";
-	if ($voir_logo) {
-		$chercher_logo = charger_fonction('chercher_logo', 'inc');
-		if ($logo = $chercher_logo($id_breve, 'id_breve', 'on')) {
-			list($fid, $dir, $nom, $format) = $logo;
-			include_spip('inc/filtres_images');
-			$logo = image_reduire("<img src='$fid' alt='' />", 26, 20);
-			if ($logo)
-				$s .= "\n<span style='float: $spip_lang_right; margin-top: -2px; margin-bottom: -2px;'>$logo</span>";
+	if (autoriser('voir','breve',$id_breve)){
+		$tous_id[] = $id_breve;
+		$date_heure = $row['date_heure'];
+		$titre = sinon($row['titre'], _T('ecrire:info_sans_titre'));
+		$statut = $row['statut'];
+		if (isset($row['lang']))
+		  changer_typo($lang = $row['lang']);
+		else $lang = $langue_defaut;
+		$id_rubrique = $row['id_rubrique'];
+				
+		$vals[] = puce_statut_breve($id_breve, $statut, 'breve', ($droit && autoriser('publierdans','rubrique',$id_rubrique)));
+	
+		$s = "\n<div>";
+		$s .= "<a href='" . generer_url_ecrire("breves_voir","id_breve=$id_breve") . "' style=\"display:block;\">";
+		if ($voir_logo) {
+			$chercher_logo = charger_fonction('chercher_logo', 'inc');
+			if ($logo = $chercher_logo($id_breve, 'id_breve', 'on')) {
+				list($fid, $dir, $nom, $format) = $logo;
+				include_spip('inc/filtres_images');
+				$logo = image_reduire("<img src='$fid' alt='' />", 26, 20);
+				if ($logo)
+					$s .= "\n<span style='float: $spip_lang_right; margin-top: -2px; margin-bottom: -2px;'>$logo</span>";
+			}
+		}
+		$s .= typo($titre);
+		if ($afficher_langue AND $lang != $langue_defaut)
+			$s .= " <span class='spip_xx-small' style='color: #666666'$dir_lang>(".traduire_nom_langue($lang).")</span>";
+		$s .= "</a>";
+	
+	
+		$s .= "</div>";
+		$vals[] = $s;
+	
+		$s = "";
+		if ($affrub) {
+			$rub = spip_fetch_array(spip_query("SELECT id_rubrique, titre FROM spip_rubriques WHERE id_rubrique=$id_rubrique"));
+			$id_rubrique = $rub['id_rubrique'];
+			$s .= "<a href='" . generer_url_ecrire("naviguer","id_rubrique=$id_rubrique") . "' style=\"display:block;\">".typo($rub['titre'])."</a>";
+		} else if ($statut != "prop")
+				$s = affdate_jourcourt($date_heure);
+			else
+				$s .= _T('info_a_valider');
+		$vals[] = $s;
+				
+		if ($options == "avancees") {
+			$vals[] = afficher_numero_edit($id_breve, 'id_breve', 'breve');
 		}
 	}
-	$s .= typo($titre);
-	if ($afficher_langue AND $lang != $langue_defaut)
-		$s .= " <span class='spip_xx-small' style='color: #666666'$dir_lang>(".traduire_nom_langue($lang).")</span>";
-	$s .= "</a>";
-
-
-	$s .= "</div>";
-	$vals[] = $s;
-
-	$s = "";
-	if ($affrub) {
-		$rub = spip_fetch_array(spip_query("SELECT id_rubrique, titre FROM spip_rubriques WHERE id_rubrique=$id_rubrique"));
-		$id_rubrique = $rub['id_rubrique'];
-		$s .= "<a href='" . generer_url_ecrire("naviguer","id_rubrique=$id_rubrique") . "' style=\"display:block;\">".typo($rub['titre'])."</a>";
-	} else if ($statut != "prop")
-			$s = affdate_jourcourt($date_heure);
-		else
-			$s .= _T('info_a_valider');
-	$vals[] = $s;
-			
-	if ($options == "avancees") {
-		$vals[] = afficher_numero_edit($id_breve, 'id_breve', 'breve');
-	}
-			
 	return $vals;
 }
 
diff --git a/ecrire/inc/sites_voir.php b/ecrire/inc/sites_voir.php
index a63dc1baa1..c6a1a00611 100644
--- a/ecrire/inc/sites_voir.php
+++ b/ecrire/inc/sites_voir.php
@@ -30,80 +30,82 @@ function afficher_sites_boucle($row, &$tous_id, $voir_logo, $bof)
 	global $spip_lang_right;
 	$vals = '';
 	$id_syndic=$row["id_syndic"];
-	$id_rubrique=$row["id_rubrique"];
-	$nom_site=sinon(typo($row["nom_site"]), _T('info_sans_titre'));
-	$url_site=$row["url_site"];
-	$url_syndic=$row["url_syndic"];
-	$syndication=$row["syndication"];
-	$statut=$row["statut"];
-			
-	$tous_id[] = $id_syndic;
-
-	switch ($statut) {
-		case 'publie':
-				if (acces_restreint_rubrique($id_rubrique))
-					$puce = 'puce-verte-anim.gif';
-				else
-					$puce='puce-verte-breve.gif';
-				$title = _T('info_site_reference');
-				break;
-			case 'prop':
-				if (acces_restreint_rubrique($id_rubrique))
+	if (autoriser('voir','site',$id_syndic)){
+		$id_rubrique=$row["id_rubrique"];
+		$nom_site=sinon(typo($row["nom_site"]), _T('info_sans_titre'));
+		$url_site=$row["url_site"];
+		$url_syndic=$row["url_syndic"];
+		$syndication=$row["syndication"];
+		$statut=$row["statut"];
+				
+		$tous_id[] = $id_syndic;
+	
+		switch ($statut) {
+			case 'publie':
+					if (acces_restreint_rubrique($id_rubrique))
+						$puce = 'puce-verte-anim.gif';
+					else
+						$puce='puce-verte-breve.gif';
+					$title = _T('info_site_reference');
+					break;
+				case 'prop':
+					if (acces_restreint_rubrique($id_rubrique))
+						$puce = 'puce-orange-anim.gif';
+					else
+						$puce='puce-orange-breve.gif';
+					$title = _T('info_site_attente');
+					break;
+				case 'refuse':
+					if (acces_restreint_rubrique($id_rubrique))
+						$puce = 'puce-poubelle-anim.gif';
+					else
+						$puce='puce-poubelle-breve.gif';
+					$title = _T('info_site_refuse');
+					break;
+		}
+		if ($syndication == 'off' OR $syndication == 'sus') {
 					$puce = 'puce-orange-anim.gif';
-				else
-					$puce='puce-orange-breve.gif';
-				$title = _T('info_site_attente');
-				break;
-			case 'refuse':
-				if (acces_restreint_rubrique($id_rubrique))
-					$puce = 'puce-poubelle-anim.gif';
-				else
-					$puce='puce-poubelle-breve.gif';
-				$title = _T('info_site_refuse');
-				break;
-	}
-	if ($syndication == 'off' OR $syndication == 'sus') {
-				$puce = 'puce-orange-anim.gif';
-				$title = _T('info_panne_site_syndique');
+					$title = _T('info_panne_site_syndique');
+				}
+	
+		$s = "<a href=\"".generer_url_ecrire("sites","id_syndic=$id_syndic")."\" title=\"$title\">";
+	
+		if ($voir_logo) {
+			$chercher_logo = charger_fonction('chercher_logo', 'inc');
+			if ($logo = $chercher_logo($id_syndic, 'id_syndic', 'on'))  {
+				list($fid, $dir, $nom, $format) = $logo;
+				include_spip('inc/filtres_images');
+				$logo = image_reduire("<img src='$fid' alt='' />", 26, 20);
+				if ($logo)
+					$s .= "<span style='float: $spip_lang_right; margin-top: -2px; margin-bottom: -2px;'>$logo</span>";
 			}
-
-	$s = "<a href=\"".generer_url_ecrire("sites","id_syndic=$id_syndic")."\" title=\"$title\">";
-
-	if ($voir_logo) {
-		$chercher_logo = charger_fonction('chercher_logo', 'inc');
-		if ($logo = $chercher_logo($id_syndic, 'id_syndic', 'on'))  {
-			list($fid, $dir, $nom, $format) = $logo;
-			include_spip('inc/filtres_images');
-			$logo = image_reduire("<img src='$fid' alt='' />", 26, 20);
-			if ($logo)
-				$s .= "<span style='float: $spip_lang_right; margin-top: -2px; margin-bottom: -2px;'>$logo</span>";
 		}
-	}
-
-	$s .= http_img_pack($puce, $statut, "class='puce'") ."&nbsp;&nbsp;";
-			
-	$s .= typo($nom_site);
 	
-	$s .= "</a> &nbsp;&nbsp; <span class='spip_xx-small'>[<a href='$url_site'>"._T('lien_visite_site')."</a>]</span>";
-	$vals[] = $s;
-			
-	$s = "";
-
-	if ($syndication == 'off' OR $syndication == 'sus') {
-		$s .= "<span style='color: red;'>"._T('info_probleme_grave')." </span>";
-	}
-	if ($syndication == "oui" or $syndication == "off" OR $syndication == 'sus'){
-		$s .= "<span style='color: red;'>"._T('info_syndication')."</span>";
-	}
-	$vals[] = $s;
-
-	if ($syndication == "oui" OR $syndication == "off" OR $syndication == "sus") {
-		$total_art = spip_fetch_array(spip_query("SELECT COUNT(*) AS n FROM spip_syndic_articles WHERE id_syndic='$id_syndic'"));
-		$s = " " . $total_art['n'] . " " . _T('info_syndication_articles');
-	} else {
-			$s = "&nbsp;";
+		$s .= http_img_pack($puce, $statut, "class='puce'") ."&nbsp;&nbsp;";
+				
+		$s .= typo($nom_site);
+		
+		$s .= "</a> &nbsp;&nbsp; <span class='spip_xx-small'>[<a href='$url_site'>"._T('lien_visite_site')."</a>]</span>";
+		$vals[] = $s;
+				
+		$s = "";
+	
+		if ($syndication == 'off' OR $syndication == 'sus') {
+			$s .= "<span style='color: red;'>"._T('info_probleme_grave')." </span>";
+		}
+		if ($syndication == "oui" or $syndication == "off" OR $syndication == 'sus'){
+			$s .= "<span style='color: red;'>"._T('info_syndication')."</span>";
+		}
+		$vals[] = $s;
+	
+		if ($syndication == "oui" OR $syndication == "off" OR $syndication == "sus") {
+			$total_art = spip_fetch_array(spip_query("SELECT COUNT(*) AS n FROM spip_syndic_articles WHERE id_syndic='$id_syndic'"));
+			$s = " " . $total_art['n'] . " " . _T('info_syndication_articles');
+		} else {
+				$s = "&nbsp;";
+		}
+		$vals[] = $s;
 	}
-	$vals[] = $s;
 
 	return $vals;
 }
@@ -141,108 +143,110 @@ function afficher_syndic_articles_boucle($row, &$my_sites, $bof, $redirect)
 
 	$id_syndic_article=$row["id_syndic_article"];
 	$id_syndic=$row["id_syndic"];
-	$titre=safehtml($row["titre"]);
-	$url=$row["url"];
-	$date=$row["date"];
-	$lesauteurs=typo($row["lesauteurs"]);
-	$statut=$row["statut"];
-	$descriptif=safehtml($row["descriptif"]);
-
-	if ($statut=='publie') {
-			$puce='puce-verte.gif';
-	}
-	else if ($statut == "refuse") {
-			$puce = 'puce-poubelle.gif';
-	}
-
-	else if ($statut == "dispo") { // moderation : a valider
-			$puce = 'puce-rouge.gif';
-	}
-
-	else if ($statut == "off") { // feed d'un site en mode "miroir"
-			$puce = 'puce-rouge-anim.gif';
-	}
-
-	$vals[] = http_img_pack($puce, $statut, "class='puce'");
-
-	$s = "<a href='$url'>$titre</a>";
-
-	$date = affdate_court($date);
-	if (strlen($lesauteurs) > 0) $date = $lesauteurs.', '.$date;
-	$s.= " ($date)";
-
-	// Tags : d'un cote les enclosures, de l'autre les liens
-	if($e = afficher_enclosures($row['tags']))
-		$s .= ' '.$e;
-
-	// descriptif
-	if (strlen($descriptif) > 0) {
-		// couper un texte vraiment tres long
-		if (strlen($descriptif) > 10000)
-			$descriptif = safehtml(spip_substr($descriptif, 0, 6000)).' (...)';
-		else
-			$descriptif = safehtml($descriptif);
-		$s .= '<div class="arial1">'
-			# 385px = largeur de la colonne ou s'affiche le texte
-			. filtrer('image_reduire',$descriptif, 385, 550)
-			. '</div>';
-	}
-
-	// tags
-	if ($tags = afficher_tags($row['tags']))
-		$s .= "<div style='float:$spip_lang_right;'>&nbsp;<em>"
-			. $tags . '</em></div>';
-
-	// source
-	if (strlen($row['url_source']))
-		$s .= "<div style='float:$spip_lang_right;'>"
-		. propre("[".$row['source']."->".$row['url_source']."]")
-		. "</div>";
-	else if (strlen($row['source']))
-		$s .= "<div style='float:$spip_lang_right;'>"
-		. typo($row['source'])
-		. "</div>";
-
-	$vals[] = $s;
-
-	// on n'affiche pas la colonne 'site' lorsqu'on regarde un site precis
-	if ($GLOBALS['exec'] != 'sites') {
-		// $my_sites cache les resultats des requetes sur les sites
-		if (!$my_sites[$id_syndic])
-			$my_sites[$id_syndic] = spip_fetch_array(spip_query("SELECT nom_site, moderation, miroir FROM spip_syndic WHERE id_syndic=$id_syndic"));
-
-		$aff = $my_sites[$id_syndic]['nom_site'];
-		if ($my_sites[$id_syndic]['moderation'] == 'oui')
-			$aff = "<i>$aff</i>";
-			
-		$s = "<a href='" . generer_url_ecrire("sites","id_syndic=$id_syndic") . "'>$aff</a>";
-
-		$vals[] = $s;
-	}
-				
-	if ($connect_statut == '0minirezo'){
-		list($tmp_var, $id) = $redirect;
-		$redirect = ($tmp_var . '=' . intval(_request($tmp_var)))
-		. (!$id ? '' : "&id_syndic=$id");
-
-		if ($statut == "publie"){
-		  $s =  "[<a href='". redirige_action_auteur('instituer_syndic',"$id_syndic_article-refuse", $GLOBALS['exec'], $redirect) . "'><span style='color: black'>"._T('info_bloquer_lien')."</span></a>]";
-		
+	if (autoriser('voir','site',$id_syndic)){
+		$titre=safehtml($row["titre"]);
+		$url=$row["url"];
+		$date=$row["date"];
+		$lesauteurs=typo($row["lesauteurs"]);
+		$statut=$row["statut"];
+		$descriptif=safehtml($row["descriptif"]);
+	
+		if ($statut=='publie') {
+				$puce='puce-verte.gif';
 		}
-		else if ($statut == "refuse"){
-		  $s =  "[<a href='". redirige_action_auteur('instituer_syndic',"$id_syndic_article-publie", $GLOBALS['exec'], $redirect) . "'>"._T('info_retablir_lien')."</a>]";
+		else if ($statut == "refuse") {
+				$puce = 'puce-poubelle.gif';
 		}
-		else if ($statut == "off"
-		AND $my_sites[$id_syndic]['miroir'] == 'oui') {
-			$s = '('._T('syndic_lien_obsolete').')';
+	
+		else if ($statut == "dispo") { // moderation : a valider
+				$puce = 'puce-rouge.gif';
 		}
-		else /* 'dispo' ou 'off' (dans le cas ancien site 'miroir') */
-		{
-		  $s = "[<a href='". redirige_action_auteur('instituer_syndic',"$id_syndic_article-publie", $GLOBALS['exec'], $redirect) . "'>"._T('info_valider_lien')."</a>]";
+	
+		else if ($statut == "off") { // feed d'un site en mode "miroir"
+				$puce = 'puce-rouge-anim.gif';
+		}
+	
+		$vals[] = http_img_pack($puce, $statut, "class='puce'");
+	
+		$s = "<a href='$url'>$titre</a>";
+	
+		$date = affdate_court($date);
+		if (strlen($lesauteurs) > 0) $date = $lesauteurs.', '.$date;
+		$s.= " ($date)";
+	
+		// Tags : d'un cote les enclosures, de l'autre les liens
+		if($e = afficher_enclosures($row['tags']))
+			$s .= ' '.$e;
+	
+		// descriptif
+		if (strlen($descriptif) > 0) {
+			// couper un texte vraiment tres long
+			if (strlen($descriptif) > 10000)
+				$descriptif = safehtml(spip_substr($descriptif, 0, 6000)).' (...)';
+			else
+				$descriptif = safehtml($descriptif);
+			$s .= '<div class="arial1">'
+				# 385px = largeur de la colonne ou s'affiche le texte
+				. filtrer('image_reduire',$descriptif, 385, 550)
+				. '</div>';
 		}
+	
+		// tags
+		if ($tags = afficher_tags($row['tags']))
+			$s .= "<div style='float:$spip_lang_right;'>&nbsp;<em>"
+				. $tags . '</em></div>';
+	
+		// source
+		if (strlen($row['url_source']))
+			$s .= "<div style='float:$spip_lang_right;'>"
+			. propre("[".$row['source']."->".$row['url_source']."]")
+			. "</div>";
+		else if (strlen($row['source']))
+			$s .= "<div style='float:$spip_lang_right;'>"
+			. typo($row['source'])
+			. "</div>";
+	
 		$vals[] = $s;
-	}
+	
+		// on n'affiche pas la colonne 'site' lorsqu'on regarde un site precis
+		if ($GLOBALS['exec'] != 'sites') {
+			// $my_sites cache les resultats des requetes sur les sites
+			if (!$my_sites[$id_syndic])
+				$my_sites[$id_syndic] = spip_fetch_array(spip_query("SELECT nom_site, moderation, miroir FROM spip_syndic WHERE id_syndic=$id_syndic"));
+	
+			$aff = $my_sites[$id_syndic]['nom_site'];
+			if ($my_sites[$id_syndic]['moderation'] == 'oui')
+				$aff = "<i>$aff</i>";
+				
+			$s = "<a href='" . generer_url_ecrire("sites","id_syndic=$id_syndic") . "'>$aff</a>";
+	
+			$vals[] = $s;
+		}
+					
+		if ($connect_statut == '0minirezo'){
+			list($tmp_var, $id) = $redirect;
+			$redirect = ($tmp_var . '=' . intval(_request($tmp_var)))
+			. (!$id ? '' : "&id_syndic=$id");
+	
+			if ($statut == "publie"){
+			  $s =  "[<a href='". redirige_action_auteur('instituer_syndic',"$id_syndic_article-refuse", $GLOBALS['exec'], $redirect) . "'><span style='color: black'>"._T('info_bloquer_lien')."</span></a>]";
 			
+			}
+			else if ($statut == "refuse"){
+			  $s =  "[<a href='". redirige_action_auteur('instituer_syndic',"$id_syndic_article-publie", $GLOBALS['exec'], $redirect) . "'>"._T('info_retablir_lien')."</a>]";
+			}
+			else if ($statut == "off"
+			AND $my_sites[$id_syndic]['miroir'] == 'oui') {
+				$s = '('._T('syndic_lien_obsolete').')';
+			}
+			else /* 'dispo' ou 'off' (dans le cas ancien site 'miroir') */
+			{
+			  $s = "[<a href='". redirige_action_auteur('instituer_syndic',"$id_syndic_article-publie", $GLOBALS['exec'], $redirect) . "'>"._T('info_valider_lien')."</a>]";
+			}
+			$vals[] = $s;
+		}
+	}
+
 	return $vals;
 }
 ?>
diff --git a/ecrire/inc/suivi_versions.php b/ecrire/inc/suivi_versions.php
index d46f6d7e25..0deea588ed 100644
--- a/ecrire/inc/suivi_versions.php
+++ b/ecrire/inc/suivi_versions.php
@@ -97,70 +97,72 @@ $revisions .= "<a href='".generer_url_ecrire('suivi_revisions', "debut=$next&id_
 			$id_auteur = $row['id_auteur'];
 			$date = $row['date'];
 			$id_article = $row['id_article'];
-			$statut = $row['statut'];
-			$titre = typo($row['titre']);
-			
-			// l'id_auteur peut etre un numero IP (edition anonyme)
-			if ($row_auteur = spip_fetch_array(spip_query("SELECT nom,email FROM spip_auteurs	WHERE id_auteur = '".addslashes($id_auteur)."'"))) {
-				$nom = typo($row_auteur["nom"]);
-				$email = $row_auteur['email'];
-			} else {
-				$nom = $id_auteur;
-				$email = '';
-			}
+			if (autoriser('voir','article',$id_article)){
+				$statut = $row['statut'];
+				$titre = typo($row['titre']);
+				
+				// l'id_auteur peut etre un numero IP (edition anonyme)
+				if ($row_auteur = spip_fetch_array(spip_query("SELECT nom,email FROM spip_auteurs	WHERE id_auteur = '".addslashes($id_auteur)."'"))) {
+					$nom = typo($row_auteur["nom"]);
+					$email = $row_auteur['email'];
+				} else {
+					$nom = $id_auteur;
+					$email = '';
+				}
+		
+				if (!$rss) {
+					$logo_statut = "puce-".puce_statut($statut).".gif";
+					$revisions .= "\n<div class='tr_liste' style='padding: 5px; border-top: 1px solid #aaaaaa;'>";
+		
+					$revisions .= "<span class='arial2'>";
+					if (!$court) $revisions .= bouton_block_visible("$id_version-$id_article-$id_auteur");
+					$revisions .= "<img src='" . _DIR_IMG_PACK . "$logo_statut' alt=' ' />&nbsp;";
+					$revisions .= "<a class='$statut' style='font-weight: bold;' href='" . generer_url_ecrire("articles_versions","id_article=$id_article") . "'>$titre</a>";
+					$revisions .= "</span>";
+					$revisions .= "<span class='arial1'$dir_lang>";
+					$revisions .= " ".date_relative($date)." "; # laisser un peu de privacy aux redacteurs
+					if (strlen($nom)>0) $revisions .= "($nom)";
+					$revisions .= "</span>";
+				} else {
+					$item = array(
+						'title' => $titre,
+						'url' => generer_url_ecrire("articles_versions","id_article=$id_article&id_version=$id_version"),
+						'date' => $date,
+						'author' => $nom,
+						'email' => $email
+					);
+				}
 	
-			if (!$rss) {
-				$logo_statut = "puce-".puce_statut($statut).".gif";
-				$revisions .= "\n<div class='tr_liste' style='padding: 5px; border-top: 1px solid #aaaaaa;'>";
+				// "court" n'affiche pas les modifs
+				if (!$court) {
+					$textes = revision_comparee($id_article, $id_version, 'diff');
+					if (!$rss)
+						$revisions .= debut_block_visible("$id_version-$id_article-$id_auteur");
 	
-				$revisions .= "<span class='arial2'>";
-				if (!$court) $revisions .= bouton_block_visible("$id_version-$id_article-$id_auteur");
-				$revisions .= "<img src='" . _DIR_IMG_PACK . "$logo_statut' alt=' ' />&nbsp;";
-				$revisions .= "<a class='$statut' style='font-weight: bold;' href='" . generer_url_ecrire("articles_versions","id_article=$id_article") . "'>$titre</a>";
-				$revisions .= "</span>";
-				$revisions .= "<span class='arial1'$dir_lang>";
-				$revisions .= " ".date_relative($date)." "; # laisser un peu de privacy aux redacteurs
-				if (strlen($nom)>0) $revisions .= "($nom)";
-				$revisions .= "</span>";
-			} else {
-				$item = array(
-					'title' => $titre,
-					'url' => generer_url_ecrire("articles_versions","id_article=$id_article&id_version=$id_version"),
-					'date' => $date,
-					'author' => $nom,
-					'email' => $email
-				);
-			}
-
-			// "court" n'affiche pas les modifs
-			if (!$court) {
-				$textes = revision_comparee($id_article, $id_version, 'diff');
-				if (!$rss)
-					$revisions .= debut_block_visible("$id_version-$id_article-$id_auteur");
-
-				if (is_array($textes))
-				foreach ($textes as $var => $t) {
-					if (strlen($t) > 0) {
-						if (!$rss) $revisions .= "<blockquote class='serif1'>";
-						$aff = propre_diff($t);
-						if ($GLOBALS['les_notes']) {
-							$aff .= '<p>'.$GLOBALS['les_notes'];
-							$GLOBALS['les_notes'] = '';
+					if (is_array($textes))
+					foreach ($textes as $var => $t) {
+						if (strlen($t) > 0) {
+							if (!$rss) $revisions .= "<blockquote class='serif1'>";
+							$aff = propre_diff($t);
+							if ($GLOBALS['les_notes']) {
+								$aff .= '<p>'.$GLOBALS['les_notes'];
+								$GLOBALS['les_notes'] = '';
+							}
+							if (!$rss) {
+								$revisions .= $aff;
+								$revisions .= "</blockquote>";
+							} else
+								$item['description'] = $aff;
 						}
-						if (!$rss) {
-							$revisions .= $aff;
-							$revisions .= "</blockquote>";
-						} else
-							$item['description'] = $aff;
 					}
+					if (!$rss) $revisions .= fin_block();
 				}
-				if (!$rss) $revisions .= fin_block();
+				
+				if (!$rss) $revisions .= "</div>";
+	
+				if ($rss)
+					$items[] = $item;
 			}
-			
-			if (!$rss) $revisions .= "</div>";
-
-			if ($rss)
-				$items[] = $item;
 		}		
 		if (!$rss) $revisions .= "</div>";
 	}
-- 
GitLab