From 865adcbc9ff8eb8744db6a5ed6939648bab6c5df Mon Sep 17 00:00:00 2001
From: Matthieu Marcillaud <marcimat@rezo.net>
Date: Wed, 13 Feb 2013 16:36:19 +0000
Subject: [PATCH] =?UTF-8?q?Mettre=20le=20test=20sur=20soi-m=C3=AAme=20en?=
 =?UTF-8?q?=20t=C3=AAte=20suite=20=C3=A0=20r20137=20(cerdic)=20+=20correct?=
 =?UTF-8?q?ion=20phpdoc?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 ecrire/inc/distant.php | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/ecrire/inc/distant.php b/ecrire/inc/distant.php
index 1a49f95258..4ac56beb2e 100644
--- a/ecrire/inc/distant.php
+++ b/ecrire/inc/distant.php
@@ -11,7 +11,7 @@
 \***************************************************************************/
 
 /**
- * Ce fichier gère le bandeau supérieur de l'espace privé
+ * Ce fichier gère l'obtention de données distantes
  * 
  * @package SPIP\Core\Distant
 **/
@@ -47,6 +47,12 @@ define('_REGEXP_COPIE_LOCALE', ',' .
  */
 function copie_locale($source, $mode='auto', $local = null) {
 
+	// si c'est la protection de soi-meme, retourner le path
+	if ($mode !== 'force' AND preg_match(_REGEXP_COPIE_LOCALE, $source, $match)) {
+		$source = substr(_DIR_IMG,strlen(_DIR_RACINE)) . urldecode($match[1]);
+		return @file_exists($source) ? $source : false;
+	}
+
 	if (is_null($local))
 		$local = fichier_copie_locale($source);
 	else {
@@ -55,11 +61,6 @@ function copie_locale($source, $mode='auto', $local = null) {
 		}
 	}
 
-	// si c'est la protection de soi-meme, retourner le path
-	if ($mode !== 'force' AND preg_match(_REGEXP_COPIE_LOCALE, $source, $local)) {
-		$source = substr(_DIR_IMG,strlen(_DIR_RACINE)) . urldecode($local[1]);
-		return @file_exists($source) ? $source : false;
-	}
 
 	$localrac = _DIR_RACINE.$local;
 	$t = ($mode=='force') ? false  : @file_exists($localrac);
-- 
GitLab