From 61038e06e1ff1ee713b27417ff8e4e6375282aba Mon Sep 17 00:00:00 2001 From: "Committo,Ergo:sum" <esj@rezo.net> Date: Wed, 21 Mar 2007 21:35:26 +0000 Subject: [PATCH] Passer par les controles pour creer IMG/distant. Et un peu d'optim. --- ecrire/inc/distant.php | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/ecrire/inc/distant.php b/ecrire/inc/distant.php index 76a26a58a6..e2f307fa04 100644 --- a/ecrire/inc/distant.php +++ b/ecrire/inc/distant.php @@ -253,16 +253,23 @@ function recuperer_page($url, $munge_charset=false, $get_headers=false, // des filesystems // http://doc.spip.org/@nom_fichier_copie_locale function nom_fichier_copie_locale($source, $extension) { - $dir = sous_repertoire(_DIR_IMG, 'distant'); # IMG/distant/ - $dir2 = sous_repertoire($dir, $extension); # IMG/distant/pdf/ - $chemin = $dir2 . substr(preg_replace(',[^\w-],', '', basename($source)).'-'.md5($source),0,12). - substr(md5($source),0,4).'.'.$extension; + + $d = creer_repertoire_documents('distant'); # IMG/distant/ + $d = sous_repertoire($d, $extension); # IMG/distant/pdf/ // on se place tout le temps comme si on etait a la racine if (_DIR_RACINE) - $chemin = preg_replace(',^'.preg_quote(_DIR_RACINE).',', '', $chemin); + $d = preg_replace(',^'.preg_quote(_DIR_RACINE).',', '', $d); + + $m = md5($source); + + return $d + . substr(preg_replace(',[^\w-],', '', basename($source)).'-'.$m,0,12) + . substr($m,0,4) + . ".$extension"; - return $chemin; + + } // -- GitLab