diff --git a/ecrire/inc_logos.php3 b/ecrire/inc_logos.php3
index f1aa0e2a167603c294ca98694ee6877b6cf9196b..fd190d961f3ca6c9bb3f55429775d9282eb57b76 100644
--- a/ecrire/inc_logos.php3
+++ b/ecrire/inc_logos.php3
@@ -384,16 +384,16 @@ function reduire_image_logo($img, $taille = 120, $taille_y=0) {
 	if (ereg("^" . _DIR_IMG, $logo))
 		$img = substr($logo,strlen(_DIR_IMG));
 	else { $img = $logo; $logo = _DIR_IMG . $logo;}
-	spip_log("$img, $logo" . file_exists($logo));
+
 	if (@file_exists($logo) AND
 	    eregi("^(.*)\.(jpg|gif|png)$", $img, $regs)) {
-		include_local('inc-cache.php3');
+		include_local('inc-public-global.php3');
 		$nom = $regs[1];
 		$format = $regs[2];
 		$suffixe = '-'.$taille.'x'.$taille_y;
 		$cache_folder=  _DIR_IMG . creer_repertoire(_DIR_IMG, 'cache'.$suffixe);
 		$preview = creer_vignette($logo, $taille, $taille_y, $format, $cache_folder.$nom.$suffixe);
-		spip_log($preview['fichier'] . $cache_folder);
+
 		if ($preview) {
 			$vignette = $preview['fichier'];
 			$width = $preview['width'];
diff --git a/inc-balises.php3 b/inc-balises.php3
index 7e962cfce5536e7191a0cc261af0b99578f83833..8591f891a7bde7e3f07005d29354c7adf072f551 100644
--- a/inc-balises.php3
+++ b/inc-balises.php3
@@ -622,7 +622,6 @@ function calcul_balise_logo ($p) {
 	     "''") .
 	    ", $code_lien, '$flag_fichier')";
 	}
-	  spip_log($p->nom_champ . $type_objet . "'$flag_fichier'" . $p->code);
 	$p->statut = 'php';
 	return $p;
 }
diff --git a/inc-cache.php3 b/inc-cache.php3
index d5ef5409c6a4a8a42c1ff6e6158d916a6ca74a14..e67c600416efc619e4ad46278a86964eac37d7f1 100644
--- a/inc-cache.php3
+++ b/inc-cache.php3
@@ -61,7 +61,7 @@ function generer_nom_fichier_cache($contexte='', $fond='') {
 
 	$gzip = $flag_gz && $compresser_cache ? '.gz' : '';
 
-	return $subdir.$subdir2.$fichier_cache.$gzip;
+	return 'CACHE/' . $subdir.$subdir2.$fichier_cache.$gzip;
 }
 
 
@@ -97,36 +97,6 @@ function utiliser_cache(&$chemin_cache, $delais) {
 }
 
 
-//
-// Retourne $subdir/ si le sous-repertoire peut etre cree, '' sinon
-//
-
-function creer_repertoire($base, $subdir) {
-	if (@file_exists("$base/.plat")) return '';
-	$path = $base.'/'.$subdir;
-	if (@file_exists($path)) return "$subdir/";
-
-	@mkdir($path, 0777);
-	@chmod($path, 0777);
-	$ok = false;
-	if ($f = @fopen("$path/.test", "w")) {
-		@fputs($f, '<'.'?php $ok = true; ?'.'>');
-		@fclose($f);
-		include("$path/.test");
-	}
-	if (!$ok) {
-		$f = @fopen("$base/.plat", "w");
-		if ($f)
-			fclose($f);
-		else {
-			@header("Location: spip_test_dirs.php3");
-			exit;
-		}
-	}
-	return ($ok? "$subdir/" : '');
-}
-
-
 // Obsolete ?  Utilisee pour vider le cache depuis l'espace prive
 // (ou juste les squelettes si un changement de config le necessite)
 function purger_repertoire($dir, $age='ignore', $regexp = '') {
diff --git a/inc-public-global.php3 b/inc-public-global.php3
index 3c5ef3a772891be86d077616d7eef36847240d8e..7235c526b4dcde9be1239cc0ec13031dd23b34c1 100644
--- a/inc-public-global.php3
+++ b/inc-public-global.php3
@@ -124,7 +124,7 @@ function afficher_page_globale ($fond, $delais, &$use_cache) {
 	}
 
 	// Calculer le chemin putatif du cache
-	$chemin_cache = 'CACHE/'.generer_nom_fichier_cache('', $fond);
+	$chemin_cache = generer_nom_fichier_cache('', $fond);
 
 	// Faut-il effacer des pages invalidees ?
 	if (lire_meta('invalider')) {
@@ -249,7 +249,7 @@ function inclure_page($fond, $delais_inclus, $contexte_inclus, $cache_incluant='
 
 	$contexte_inclus['fond'] = $fond;
 
-	$chemin_cache = 'CACHE/'.generer_nom_fichier_cache($contexte_inclus, $fond);
+	$chemin_cache = generer_nom_fichier_cache($contexte_inclus, $fond);
 
 	// Peut-on utiliser un fichier cache ?
 	determiner_cache($delais_inclus, $use_cache, $chemin_cache);
@@ -292,7 +292,7 @@ function admin_page($cached, $texte) {
 
 function calcule_fichier_logo($on) {
   $r= ereg_replace("^" . _DIR_IMG, "", $on);
-  spip_log("calculer_fihchier_logo $on $r");
+#  spip_log("calculer_fihchier_logo $on $r");
   return $r;
 }
 
@@ -314,10 +314,42 @@ function taches_de_fond() {
 		// Si MySQL est out, laisser souffler
 		if (!@file_exists('ecrire/data/mysql_out')
 		OR (time() - @filemtime('ecrire/data/mysql_out') > 300)) {
+#		  spip_log("cron");
 			include_ecrire('inc_cron.php3');
+
 			spip_cron();
 		}
 	}
 }
 
+
+//
+// Retourne $subdir/ si le sous-repertoire peut etre cree, '' sinon
+//
+
+function creer_repertoire($base, $subdir) {
+	if (@file_exists("$base/.plat")) return '';
+	$path = $base.'/'.$subdir;
+	if (@file_exists($path)) return "$subdir/";
+
+	@mkdir($path, 0777);
+	@chmod($path, 0777);
+	$ok = false;
+	if ($f = @fopen("$path/.test", "w")) {
+		@fputs($f, '<'.'?php $ok = true; ?'.'>');
+		@fclose($f);
+		include("$path/.test");
+	}
+	if (!$ok) {
+		$f = @fopen("$base/.plat", "w");
+		if ($f)
+			fclose($f);
+		else {
+			@header("Location: spip_test_dirs.php3");
+			exit;
+		}
+	}
+	return ($ok? "$subdir/" : '');
+}
+
 ?>
diff --git a/spip_image.php3 b/spip_image.php3
index db7bef2017e46bbcacf143f7d6ac751ba4e0995a..59995ec4fb7ec8b513b29071a12a25f4361153e4 100644
--- a/spip_image.php3
+++ b/spip_image.php3
@@ -1,15 +1,12 @@
 <?php
 
 include ("ecrire/inc_version.php3");
-
+include_local("inc-public-global.php3");
 include_ecrire("inc_filtres.php3");
 include_ecrire("inc_charsets.php3");
 include_ecrire("inc_meta.php3");
 include_ecrire("inc_admin.php3");
-include_local("inc-cache.php3");
 
-global $flag_ecrire;
-define('_DIR_IMG', ($flag_ecrire ? "../" : "")."IMG/");
 
 function creer_repertoire_documents($nom) {
 # est-il bien raisonnable d'accepter de creer si creer_rep retourne '' ?
@@ -77,7 +74,7 @@ if ($test_vignette) {
 		$loc =_DIR_IMG . "test_$test_vignette";
 		if ($preview = creer_vignette(_DIR_IMG . 'test_image.jpg',
 					      $taille_preview, $taille_preview, 'jpg', $loc, $test_vignette, true))
-			@header("Location: $m." . $preview['format']);
+			@header("Location: $loc." . $preview['format']);
 	}
 	exit;
 }
@@ -665,7 +662,6 @@ if ($vignette) {
 	if ($regs) {
 		$source = $regs[0];
 		$format = $regs[3];
-		include_local('inc-cache.php3');
 		$destination = creer_repertoire_documents('vignettes').$regs[2].'-s';	// adresse new style
 
 		if (lire_meta("creer_preview") == 'oui') {
@@ -685,8 +681,7 @@ if ($vignette) {
 	}
 
 	@header("Location: $fichier_vignette");
-	exit;
-}
+ } else {
 
 
 //
@@ -695,23 +690,26 @@ if ($vignette) {
 
 #var_dump($GLOBALS);
 
-if ($HTTP_POST_VARS) $vars = $HTTP_POST_VARS;
-else $vars = $HTTP_GET_VARS;
-$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.*|transformer.*|modifier_.*|ok|type|forcer_.*|var_rot|action_zip)$", $key)) {
-		$link->addVar($key, $val);
-	}
-}
-if ($id_document)
-	$link->addVar('id_document',$id_document);
-if ($type == 'rubrique')
-	$link->delVar('id_article');
-
-header ("Location: ".$link->getUrl());
+	if ($HTTP_POST_VARS) $vars = $HTTP_POST_VARS;
+	else $vars = $HTTP_GET_VARS;
+	$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.*|transformer.*|modifier_.*|ok|type|forcer_.*|var_rot|action_zip)$", $key)) {
+	    $link->addVar($key, $val);
+	  }
+	}
+	if ($id_document)
+	  $link->addVar('id_document',$id_document);
+	if ($type == 'rubrique')
+	  $link->delVar('id_article');
+	
+	header("Location: ".$link->getUrl());
+ }
 
-exit;
+# etudier les acces concurrents avant de lancer ça
+# header("Connection: close");
+# taches_de_fond();
 
 ?>