From 21a700af748c28864525ffcf0534da65adab2e6e Mon Sep 17 00:00:00 2001
From: Fil <fil@rezo.net>
Date: Mon, 14 Feb 2005 09:02:06 +0000
Subject: [PATCH] =?UTF-8?q?modif=20du=20fonctionnement=20de=20find=5Fin=5F?=
 =?UTF-8?q?path=20(Anne=20Possoz)=20+=20qqs=20=C2=A9?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 ecrire/articles_ortho.php      | 11 +++++++++++
 ecrire/inc_calendrier.php      | 12 ++++++++++++
 ecrire/inc_lab.php             | 11 +++++++++++
 ecrire/inc_suivi_revisions.php | 12 ++++++++++++
 ecrire/inc_tidy.php            | 11 +++++++++++
 ecrire/inc_version.php3        | 14 ++++++++++----
 ecrire/js_menu_rubriques.php   | 11 +++++++++++
 ecrire/lab_diff.php            | 11 +++++++++++
 ecrire/lab_ortho.php           | 11 +++++++++++
 ecrire/lab_revisions.php       | 11 +++++++++++
 inc-calcul.php3                |  1 -
 inc-public-global.php3         |  6 +++++-
 inc-public.php3                |  2 +-
 spip_image.php3                |  1 -
 14 files changed, 117 insertions(+), 8 deletions(-)

diff --git a/ecrire/articles_ortho.php b/ecrire/articles_ortho.php
index 691d1c0017..3cee1d59e6 100644
--- a/ecrire/articles_ortho.php
+++ b/ecrire/articles_ortho.php
@@ -1,5 +1,16 @@
 <?php
 
+/***************************************************************************\
+ *  SPIP, Systeme de publication pour l'internet                           *
+ *                                                                         *
+ *  Copyright (c) 2001-2005                                                *
+ *  Arnaud Martin, Antoine Pitrou, Philippe Riviere, Emmanuel Saint-James  *
+ *                                                                         *
+ *  Ce programme est un logiciel libre distribue sous licence GNU/GPL.     *
+ *  Pour plus de details voir le fichier COPYING.txt ou l'aide en ligne.   *
+\***************************************************************************/
+
+
 include("inc_lab.php");
 
 include_spip("ecrire.php");
diff --git a/ecrire/inc_calendrier.php b/ecrire/inc_calendrier.php
index 3af961340b..0e27aa0d85 100644
--- a/ecrire/inc_calendrier.php
+++ b/ecrire/inc_calendrier.php
@@ -1,4 +1,16 @@
 <?php
+
+/***************************************************************************\
+ *  SPIP, Systeme de publication pour l'internet                           *
+ *                                                                         *
+ *  Copyright (c) 2001-2005                                                *
+ *  Arnaud Martin, Antoine Pitrou, Philippe Riviere, Emmanuel Saint-James  *
+ *                                                                         *
+ *  Ce programme est un logiciel libre distribue sous licence GNU/GPL.     *
+ *  Pour plus de details voir le fichier COPYING.txt ou l'aide en ligne.   *
+\***************************************************************************/
+
+
 //
 // Ce fichier ne sera execute qu'une fois
 if (defined("_ECRIRE_INC_CALENDRIER")) return;
diff --git a/ecrire/inc_lab.php b/ecrire/inc_lab.php
index ec1047c1aa..f80e061114 100644
--- a/ecrire/inc_lab.php
+++ b/ecrire/inc_lab.php
@@ -1,5 +1,16 @@
 <?php
 
+/***************************************************************************\
+ *  SPIP, Systeme de publication pour l'internet                           *
+ *                                                                         *
+ *  Copyright (c) 2001-2005                                                *
+ *  Arnaud Martin, Antoine Pitrou, Philippe Riviere, Emmanuel Saint-James  *
+ *                                                                         *
+ *  Ce programme est un logiciel libre distribue sous licence GNU/GPL.     *
+ *  Pour plus de details voir le fichier COPYING.txt ou l'aide en ligne.   *
+\***************************************************************************/
+
+
 	//
 	// Ce fichier assure la compatibilite avec spip-lab
 	//
diff --git a/ecrire/inc_suivi_revisions.php b/ecrire/inc_suivi_revisions.php
index 66ee7d8f2c..f23214d8fb 100644
--- a/ecrire/inc_suivi_revisions.php
+++ b/ecrire/inc_suivi_revisions.php
@@ -1,4 +1,16 @@
 <?php
+
+/***************************************************************************\
+ *  SPIP, Systeme de publication pour l'internet                           *
+ *                                                                         *
+ *  Copyright (c) 2001-2005                                                *
+ *  Arnaud Martin, Antoine Pitrou, Philippe Riviere, Emmanuel Saint-James  *
+ *                                                                         *
+ *  Ce programme est un logiciel libre distribue sous licence GNU/GPL.     *
+ *  Pour plus de details voir le fichier COPYING.txt ou l'aide en ligne.   *
+\***************************************************************************/
+
+
 //
 // Ce fichier ne sera execute qu'une fois
 if (defined("_ECRIRE_INC_SUIVI_REVISIONS")) return;
diff --git a/ecrire/inc_tidy.php b/ecrire/inc_tidy.php
index 46a145dda5..69b82b54a3 100644
--- a/ecrire/inc_tidy.php
+++ b/ecrire/inc_tidy.php
@@ -1,5 +1,16 @@
 <?php
 
+/***************************************************************************\
+ *  SPIP, Systeme de publication pour l'internet                           *
+ *                                                                         *
+ *  Copyright (c) 2001-2005                                                *
+ *  Arnaud Martin, Antoine Pitrou, Philippe Riviere, Emmanuel Saint-James  *
+ *                                                                         *
+ *  Ce programme est un logiciel libre distribue sous licence GNU/GPL.     *
+ *  Pour plus de details voir le fichier COPYING.txt ou l'aide en ligne.   *
+\***************************************************************************/
+
+
 //
 // Ce fichier ne sera execute qu'une fois
 if (defined("_ECRIRE_INC_TIDY")) return;
diff --git a/ecrire/inc_version.php3 b/ecrire/inc_version.php3
index 9cac32691f..dee9715fc9 100644
--- a/ecrire/inc_version.php3
+++ b/ecrire/inc_version.php3
@@ -1141,13 +1141,14 @@ function texte_script($texte) {
 //
 // find_in_path() : chercher un fichier nomme x selon le chemin rep1:rep2:rep3
 //
+define_once('_SPIP_PATH', './:squelettes/:dist/:formulaires/');
 function find_in_path ($filename, $path='AUTO') {
 	// Chemin standard depuis l'espace public
 
 	if ($path == 'AUTO') {
-		$path = '.:squelettes:dist:formulaires';
+		$path = _SPIP_PATH;
 		if ($GLOBALS['dossier_squelettes'])
-			$path = $GLOBALS['dossier_squelettes'].':'.$path;
+			$path = $GLOBALS['dossier_squelettes'].'/:'.$path;
 	}
 
 	// Depuis l'espace prive, remonter d'un cran 
@@ -1155,10 +1156,15 @@ function find_in_path ($filename, $path='AUTO') {
 
 	// Parcourir le chemin
 	foreach (split(':', $path) as $dir) {
-		$f = "$racine$dir/$filename";
-		if (@is_readable($f))
+		if (substr($dir, 0,1)<>'/')
+			$f = "$racine$dir$filename";
+		else
+			$f = "$dir$filename";
+
+		if (is_readable($f)) {
 			return $f;
 		}
+	}
 #	spip_log("find_in_path: pas de fichier '$filename' sur le chemin '$path'");
 }
 
diff --git a/ecrire/js_menu_rubriques.php b/ecrire/js_menu_rubriques.php
index 7d1d4e305a..3203526755 100644
--- a/ecrire/js_menu_rubriques.php
+++ b/ecrire/js_menu_rubriques.php
@@ -1,5 +1,16 @@
 <?php
 
+/***************************************************************************\
+ *  SPIP, Systeme de publication pour l'internet                           *
+ *                                                                         *
+ *  Copyright (c) 2001-2005                                                *
+ *  Arnaud Martin, Antoine Pitrou, Philippe Riviere, Emmanuel Saint-James  *
+ *                                                                         *
+ *  Ce programme est un logiciel libre distribue sous licence GNU/GPL.     *
+ *  Pour plus de details voir le fichier COPYING.txt ou l'aide en ligne.   *
+\***************************************************************************/
+
+
 include_once("inc.php3");
 
 if (http_last_modified(@filemtime("js_menu_rubriques.php"), time() + 24 * 3600)) 
diff --git a/ecrire/lab_diff.php b/ecrire/lab_diff.php
index 21153ff42b..e13e1738c0 100644
--- a/ecrire/lab_diff.php
+++ b/ecrire/lab_diff.php
@@ -1,5 +1,16 @@
 <?php
 
+/***************************************************************************\
+ *  SPIP, Systeme de publication pour l'internet                           *
+ *                                                                         *
+ *  Copyright (c) 2001-2005                                                *
+ *  Arnaud Martin, Antoine Pitrou, Philippe Riviere, Emmanuel Saint-James  *
+ *                                                                         *
+ *  Ce programme est un logiciel libre distribue sous licence GNU/GPL.     *
+ *  Pour plus de details voir le fichier COPYING.txt ou l'aide en ligne.   *
+\***************************************************************************/
+
+
 // Ce fichier ne sera execute qu'une fois
 if (defined("_ECRIRE_INC_DIFF")) return;
 define("_ECRIRE_INC_DIFF", "1");
diff --git a/ecrire/lab_ortho.php b/ecrire/lab_ortho.php
index 7e8281b44d..c47a09d743 100644
--- a/ecrire/lab_ortho.php
+++ b/ecrire/lab_ortho.php
@@ -1,5 +1,16 @@
 <?php
 
+/***************************************************************************\
+ *  SPIP, Systeme de publication pour l'internet                           *
+ *                                                                         *
+ *  Copyright (c) 2001-2005                                                *
+ *  Arnaud Martin, Antoine Pitrou, Philippe Riviere, Emmanuel Saint-James  *
+ *                                                                         *
+ *  Ce programme est un logiciel libre distribue sous licence GNU/GPL.     *
+ *  Pour plus de details voir le fichier COPYING.txt ou l'aide en ligne.   *
+\***************************************************************************/
+
+
 // Ce fichier ne sera execute qu'une fois
 if (defined("_ECRIRE_INC_ORTHO")) return;
 define("_ECRIRE_INC_ORTHO", "1");
diff --git a/ecrire/lab_revisions.php b/ecrire/lab_revisions.php
index eac81ef6ef..fb69d82576 100644
--- a/ecrire/lab_revisions.php
+++ b/ecrire/lab_revisions.php
@@ -1,5 +1,16 @@
 <?php
 
+/***************************************************************************\
+ *  SPIP, Systeme de publication pour l'internet                           *
+ *                                                                         *
+ *  Copyright (c) 2001-2005                                                *
+ *  Arnaud Martin, Antoine Pitrou, Philippe Riviere, Emmanuel Saint-James  *
+ *                                                                         *
+ *  Ce programme est un logiciel libre distribue sous licence GNU/GPL.     *
+ *  Pour plus de details voir le fichier COPYING.txt ou l'aide en ligne.   *
+\***************************************************************************/
+
+
 //
 // Ce fichier ne sera execute qu'une fois
 if (defined("_ECRIRE_INC_REVISIONS")) return;
diff --git a/inc-calcul.php3 b/inc-calcul.php3
index d077af503c..64cde30fc4 100644
--- a/inc-calcul.php3
+++ b/inc-calcul.php3
@@ -37,7 +37,6 @@ include_local("inc-calcul-outils.php3");
 if ($f = find_in_path("mes_fonctions.php3"))
 	include_local ($f);
 
-
 // Gestionnaire d'URLs
 if (@file_exists("inc-urls.php3"))
 	include_local("inc-urls.php3");
diff --git a/inc-public-global.php3 b/inc-public-global.php3
index be610cf148..cce25425c3 100644
--- a/inc-public-global.php3
+++ b/inc-public-global.php3
@@ -76,11 +76,15 @@ function calcule_header_et_page ($fond, $delais) {
 	AND ($GLOBALS['_COOKIE']['spip_admin']
 	OR $GLOBALS['_COOKIE']['spip_debug'])))
 		include_local(find_in_path('inc-formulaire_admin.php3'));
+		# attention, cet include ne considere pas forcement le
+		# $dossier_squelettes defini dans mes_fonctions.php3, mais si
+		# on incluait mes_fonctions.php3 on masquerait au webmestre l'erreur,
+		# courante, qui est de croire que ce fichier est toujours inclus.
+
 
 	$tableau_des_erreurs = array();
 	$page = afficher_page_globale ($fond, $delais, $use_cache);
 
-
 	//
 	// Envoyer les entetes appropries
 	// a condition d'etre sur de pouvoir le faire
diff --git a/inc-public.php3 b/inc-public.php3
index dfc99b438c..eb77d81736 100644
--- a/inc-public.php3
+++ b/inc-public.php3
@@ -74,7 +74,7 @@ if (defined("_INC_PUBLIC")) {
 		debug_dumpfile('',$var_mode_objet,$var_mode_affiche);
 	} 
 	if (count($tableau_des_erreurs) > 0 AND $affiche_boutons_admin)
-	  $page = affiche_erreurs_page($tableau_des_erreurs) . $page;
+		$page = affiche_erreurs_page($tableau_des_erreurs) . $page;
 
 	// Traiter var_recherche pour surligner les mots
 	if ($var_recherche) {
diff --git a/spip_image.php3 b/spip_image.php3
index 90cbb634f5..2f38256a12 100644
--- a/spip_image.php3
+++ b/spip_image.php3
@@ -35,7 +35,6 @@ foreach ($_FILES as $id => $file) {
 		unset ($_FILES[$id]);
 }
 
-
 // Si on est en mode 'document', les images doivent etre installees
 // comme documents dans le portfolio
 if ($forcer_document) $mode = 'document';
-- 
GitLab