From 0123a9d96891a8803ac7b81219d140665cc1ae1f Mon Sep 17 00:00:00 2001
From: Cerdic <cedric@yterium.com>
Date: Mon, 13 Dec 2010 07:39:34 +0000
Subject: [PATCH] Report de r16567 (erreur sur le commit precedant qui etait
 aussi un report de r16567)

---
 ecrire/inc/utils.php | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/ecrire/inc/utils.php b/ecrire/inc/utils.php
index abd95c62f3..0adfabf1e6 100644
--- a/ecrire/inc/utils.php
+++ b/ecrire/inc/utils.php
@@ -1353,10 +1353,15 @@ function spip_initialisation_core($pi=NULL, $pa=NULL, $ti=NULL, $ta=NULL) {
 		$GLOBALS['profondeur_url'] = 1;
 	else {
 		$uri = isset($_SERVER['REQUEST_URI']) ? explode('?', $_SERVER['REQUEST_URI']) : '';
-		$uri_ref = (isset($_SERVER["SCRIPT_NAME"])?$_SERVER["SCRIPT_NAME"]:
-						(isset($GLOBALS['meta']['adresse_site'])?parse_url($GLOBALS['meta']['adresse_site'],PHP_URL_PATH).'/':'')
-						);
-		if (!$uri OR  !$uri_ref)
+		$uri_ref = $_SERVER["SCRIPT_NAME"];
+		if (!$uri_ref
+			// si on est appele avec un autre ti, on est sans doute en mutu
+			// si jamais c'est de la mutu avec sous rep, on est perdu si on se fie
+			// a spip.php qui est a la racine du spip, et vue qu'on sait pas se reperer
+			// s'en remettre a l'adresse du site. alea jacta est.
+			OR $ti!==_NOM_TEMPORAIRES_INACCESSIBLES)
+			$uri_ref = (isset($GLOBALS['meta']['adresse_site'])?parse_url($GLOBALS['meta']['adresse_site'],PHP_URL_PATH).'/':'');
+		if (!$uri OR !$uri_ref)
 			$GLOBALS['profondeur_url'] = 0;
 		else {
 			$GLOBALS['profondeur_url'] = max(0,
-- 
GitLab