diff --git a/ecrire/inc_db_mysql.php3 b/ecrire/inc_db_mysql.php3
index 88b24e99f023f5988785694270e4d7558f9f43db..2ec2022c79de0687a977517d36a6c69bc74c7979 100644
--- a/ecrire/inc_db_mysql.php3
+++ b/ecrire/inc_db_mysql.php3
@@ -6,65 +6,71 @@ if (defined("_ECRIRE_INC_DB_MYSQL")) return;
 define("_ECRIRE_INC_DB_MYSQL", "1");
 
 //
-// Connexion a la base
+// Appel de requetes SQL
 //
 
-function spip_connect_db($host, $port, $login, $pass, $db) {
-	if ($port > 0) $host = "$host:$port";
-	@mysql_connect($host, $login, $pass);
-	return @mysql_select_db($db);
-}
+function spip_query_db($query) {
+	static $tt = 0;
 
+	$my_admin = (($GLOBALS['connect_statut'] == '0minirezo') OR ($GLOBALS['auteur_session']['statut'] == '0minirezo'));
+	$my_profile = ($GLOBALS['mysql_profile'] AND $my_admin);
+	$my_debug = ($GLOBALS['mysql_debug'] AND $my_admin);
 
-//
-// Appel de requetes SQL
-//
+	$query = traite_query($query);
+
+	if ($my_profile)
+		$m1 = microtime();
 
-function spip_query_profile($query) {
-	static $tt = 0;
-	$suite = "";
-	if (eregi('[[:space:]](VALUES|WHERE)[[:space:]].*$', $query, $regs)) {
-		$suite = $regs[0];
-		$query = substr($query, 0, -strlen($suite));
-	}
-	$query = ereg_replace('([[:space:],])spip_', '\1'.$GLOBALS['table_prefix'].'_', $query) . $suite;
-	$m1 = microtime();
 	$result = mysql_query($query);
-	$m2 = microtime();
-	list($usec, $sec) = explode(" ", $m1);
-	list($usec2, $sec2) = explode(" ", $m2);
-	$dt = $sec2 + $usec2 - $sec - $usec;
-	$tt += $dt;
-	echo "<small>".htmlentities($query);
-	echo " -> <font color='blue'>".sprintf("%3f", $dt)."</font> ($tt)</small><p>\n";
-	return $result;
-}
 
-function spip_query_debug($query) {
-	$suite = "";
-	if (eregi('[[:space:]](VALUES|WHERE)[[:space:]].*$', $query, $regs)) {
-		$suite = $regs[0];
-		$query = substr($query, 0, -strlen($suite));
+	if ($my_profile) {
+		$m2 = microtime();
+		list($usec, $sec) = explode(" ", $m1);
+		list($usec2, $sec2) = explode(" ", $m2);
+		$dt = $sec2 + $usec2 - $sec - $usec;
+		$tt += $dt;
+		echo "<small>".htmlentities($query);
+		echo " -> <font color='blue'>".sprintf("%3f", $dt)."</font> ($tt)</small><p>\n";
+		
 	}
-	$query = ereg_replace('([[:space:],])spip_', '\1'.$GLOBALS['table_prefix'].'_', $query) . $suite;
-	$r = mysql_query($query);
-	if ($GLOBALS['connect_statut'] == '0minirezo' AND $s = mysql_error()) {
+
+	if ($my_debug AND $s = mysql_error()) {
 		echo "Erreur dans la requ&ecirc;te : ".htmlentities($query)."<br>";
 		echo "&laquo; ".htmlentities($s)." &raquo;<p>";
 	}
-	return $r;
+
+	return $result;
 }
 
-function spip_query_db($query) {
-	// return spip_query_profile($query);	// a decommenter pour chronometrer les requetes
-	// return spip_query_debug($query);		// a decommenter pour afficher toutes les erreurs
-	$suite = "";
+
+//
+// Passage d'une requete standardisee
+//
+function traite_query($query) {
+
+	// changer les noms des tables ($table_prefix)
 	if (eregi('[[:space:]](VALUES|WHERE)[[:space:]].*$', $query, $regs)) {
 		$suite = $regs[0];
 		$query = substr($query, 0, -strlen($suite));
 	}
 	$query = ereg_replace('([[:space:],])spip_', '\1'.$GLOBALS['table_prefix'].'_', $query) . $suite;
-	return mysql_query($query);
+
+	// supprimer les INSERT DELAYED
+	if (! $GLOBALS['flag_mysql_delayed'])
+		$query = ereg_replace('^INSERT DELAYED ', 'INSERT ', $query);
+
+	return $query;
+}
+
+
+//
+// Connexion a la base
+//
+
+function spip_connect_db($host, $port, $login, $pass, $db) {
+	if ($port > 0) $host = "$host:$port";
+	@mysql_connect($host, $login, $pass);
+	return @mysql_select_db($db);
 }
 
 
diff --git a/ecrire/inc_version.php3 b/ecrire/inc_version.php3
index 52774364160eb6917c835c23ce3cf9bf578eb8c5..2e58c260de66e6ac440d90366c95fd1273e564a6 100644
--- a/ecrire/inc_version.php3
+++ b/ecrire/inc_version.php3
@@ -14,9 +14,15 @@ define("_ECRIRE_INC_VERSION", "1");
 // (a modifier pour avoir plusieurs sites SPIP dans une seule base)
 $table_prefix = "spip";
 
-// faut-il loger les infos de debug dans data/spip.log ?
+// faut-il loger les infos de debug dans data/spip.log
 $debug = false;
 
+// faut-il passer les connexions MySQL en mode debug ?
+$mysql_debug = false;
+
+// faut-il chronometrer les requetes MySQL ?
+$mysql_profile = false;
+
 //
 // 	*** Fin du parametrage ***
 //
@@ -39,9 +45,12 @@ if (ereg('Name: v(.*) ','$Name$', $regs)) $spip_version_affichee = $regs[1];
 // Pas de warnings idiots
 error_reporting(E_ALL ^ E_NOTICE);
 
-// Securite : dossier des squelettes a preciser dans mes_fonctions.php3,
-// sous la forme d'une ligne : < ? php $GLOBALS['dossier_squelettes'] = 'squel'; ? >
+// ** Securite **
+// - le dossier des squelettes a preciser dans mes_fonctions.php3, sous
+//   la forme d'une ligne : < ? php $GLOBALS['dossier_squelettes'] = 'squel'; ? >
 $dossier_squelettes = '';
+$auteur_session = '';
+$connect_statut = '';
 
 //
 // Infos de version PHP
@@ -62,6 +71,8 @@ $flag_strpos_3 = (@strpos('baba', 'a', 2) == 3);
 $flag_get_cfg_var = (@get_cfg_var('error_reporting') != "");
 $flag_strtr2 = ($php_version_maj > 3);
 
+$flag_mysql_delayed = false;	// tant qu'on ne sait pas detecter si les INSERT DELAYED sont autorises...
+
 if ($flag_function_exists) {
 	$flag_ini_get = (function_exists("ini_get")
 		&& (@ini_get('max_execution_time') > 0));	// verifier pas desactivee
diff --git a/inc-public-global.php3 b/inc-public-global.php3
index d847b991ba760ee799225b0028227a0b7297b90d..4a83c3c0f98c5033db28d8e16b111672a8c12a09 100644
--- a/inc-public-global.php3
+++ b/inc-public-global.php3
@@ -69,7 +69,6 @@ else {
 //
 // Authentification
 //
-$auteur_session = '';
 if ($HTTP_COOKIE_VARS['spip_session'] OR $PHP_AUTH_USER) {
 	include_ecrire ("inc_session.php3");
 	verifier_visiteur();