From 72d25592785a5fe28035180b04c275dd1320476f Mon Sep 17 00:00:00 2001
From: "Committo,Ergo:sum" <esj@rezo.net>
Date: Wed, 15 Nov 2006 12:23:18 +0000
Subject: [PATCH] =?UTF-8?q?Encore=20qq=20incoh=C3=A9nreces=20dans=20l'usag?=
 =?UTF-8?q?e=20de=20=5FSPIP=5FAJAX.?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 ecrire/inc/boutons.php      | 2 +-
 ecrire/inc/gadgets.php      | 2 +-
 ecrire/inc/layer.php        | 6 +++---
 ecrire/inc/presentation.php | 4 +++-
 4 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/ecrire/inc/boutons.php b/ecrire/inc/boutons.php
index e2f5b3b1fb..1d61bcda61 100644
--- a/ecrire/inc/boutons.php
+++ b/ecrire/inc/boutons.php
@@ -424,7 +424,7 @@ function bandeau_principal2($rubrique, $sous_rubrique, $largeur) {
 	$largitem_moy = 85;
 
 	foreach($GLOBALS['boutons_admin'] as $page => $detail) {
-		if (($rubrique == $page) AND (_SPIP_AJAX === -1)) {
+		if (($rubrique == $page) AND (!_SPIP_AJAX)) {
 			$class = "visible_au_chargement";
 		} else {
 			$class = "invisible_au_chargement";
diff --git a/ecrire/inc/gadgets.php b/ecrire/inc/gadgets.php
index ce9b04ee18..43309006af 100644
--- a/ecrire/inc/gadgets.php
+++ b/ecrire/inc/gadgets.php
@@ -480,7 +480,7 @@ function gadget_messagerie() {
 // http://doc.spip.org/@repercuter_gadgets
 function repercuter_gadgets($id_rubrique) {
 
-	if (_SPIP_AJAX === -1) return '';
+	if (!_SPIP_AJAX) return '';
 
 	$rub = $id_rubrique ? "\\x26id_rubrique=$id_rubrique" : '';
 
diff --git a/ecrire/inc/layer.php b/ecrire/inc/layer.php
index 9064bedf9f..99fd45dd64 100644
--- a/ecrire/inc/layer.php
+++ b/ecrire/inc/layer.php
@@ -32,7 +32,7 @@ function block_parfois_visible($nom, $invite, $masque, $style='', $visible=false
 	$nom = 'Layer' . renomme_block($nom);
 
 	// initialement invisible, seulement si on sait rendre visible
-	if (!$visible AND (_SPIP_AJAX !== -1))
+	if (!$visible AND (!_SPIP_AJAX))
 		$visible = 'display:none;';
 	else 	$visible = 'display:block;';
 
@@ -72,7 +72,7 @@ function debut_block_invisible($nom_block){
 	if (!$browser_layer) return '';
 
 	// si on n'accepte pas js, ne pas fermer
-	if (_SPIP_AJAX === -1)
+	if (!_SPIP_AJAX)
 		return debut_block_visible($nom_block);
 
 	return "<div id='Layer".renomme_block($nom_block)."' style='display: none;'>";
@@ -135,7 +135,7 @@ function produire_acceder_couche($couches, $nom, $icone) {
 
 	global $spip_lang_rtl;
 	// ne rien afficher si js desactive
-	if (_SPIP_AJAX === -1)
+	if (!_SPIP_AJAX)
 		return '';
 
 	$onclick = array();
diff --git a/ecrire/inc/presentation.php b/ecrire/inc/presentation.php
index 2a0ef06753..54ecc632c3 100644
--- a/ecrire/inc/presentation.php
+++ b/ecrire/inc/presentation.php
@@ -1334,7 +1334,9 @@ function debut_javascript($admin, $stat)
 	// envoi le fichier JS de config si browser ok.
 		$GLOBALS['browser_layer'] .
 	 	http_script(
-			(_SPIP_AJAX ? '' : "ajah('GET', '$testeur')") .
+			(isset($_COOKIE['spip_accepte_ajax']) >= 1
+			? ''
+			: "ajah('GET', '$testeur')") .
 			"\nvar ajax_image_searching = \n'<div style=\"float: ".$GLOBALS['spip_lang_right'].";\"><img src=\"".url_absolue(_DIR_IMG_PACK."searching.gif")."\" /></div>';" .
 			"\nvar stat = " . ($stat ? 1 : 0) .
 			"\nvar largeur_icone = " .
-- 
GitLab