From 70bdbcacea468879db901ad58d172fd433edd986 Mon Sep 17 00:00:00 2001 From: James <james@rezo.net> Date: Mon, 6 Nov 2006 16:14:48 +0000 Subject: [PATCH] =?UTF-8?q?upload/=20et=20ses=20sous=5Frep=20par=20admins?= =?UTF-8?q?=20restreints=20cr=C3=A9=C3=A9s=20=C3=A0=20la=20vol=C3=A9e.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ecrire/exec/admin_tech.php | 10 +++++++++- ecrire/exec/export_all.php | 10 +++++++++- ecrire/exec/import_all.php | 20 ++++++++++++++++++-- ecrire/inc/actions.php | 10 +++++++++- tmp/upload/remove.txt | 3 --- 5 files changed, 45 insertions(+), 8 deletions(-) delete mode 100644 tmp/upload/remove.txt diff --git a/ecrire/exec/admin_tech.php b/ecrire/exec/admin_tech.php index 7cb06e3b4a..9358833f1b 100644 --- a/ecrire/exec/admin_tech.php +++ b/ecrire/exec/admin_tech.php @@ -46,7 +46,15 @@ function exec_admin_tech_dist() $dir_dump = $repertoire; } else { debut_gauche(); - $dir_dump = _DIR_TRANSFERT . $connect_login . '/'; + $repertoire = _DIR_TRANSFERT; + if(!@file_exists($repertoire)) { + $repertoire = preg_replace(','._DIR_TMP.',', '', $repertoire); + $repertoire = sous_repertoire(_DIR_TMP, $repertoire); + } + if(!@file_exists($repertoire.$connect_login)) { + $sous_rep = sous_repertoire($repertoire, $connect_login); + } + $dir_dump = $sous_rep . '/'; } include_spip('exec/export_all'); $file = joli_repertoire($dir_dump . export_nom_fichier_dump($dir_dump,false)); diff --git a/ecrire/exec/export_all.php b/ecrire/exec/export_all.php index b4304a0165..8a50e89f2c 100644 --- a/ecrire/exec/export_all.php +++ b/ecrire/exec/export_all.php @@ -80,7 +80,15 @@ function exec_export_all_dist() } $dir = $repertoire; } else { - $dir = _DIR_TRANSFERT . $connect_login . '/'; + $repertoire = _DIR_TRANSFERT; + if(!@file_exists($repertoire)) { + $repertoire = preg_replace(','._DIR_TMP.',', '', $repertoire); + $repertoire = sous_repertoire(_DIR_TMP, $repertoire); + } + if(!@file_exists($repertoire.$connect_login)) { + $sous_rep = sous_repertoire($repertoire, $connect_login); + } + $dir = $sous_rep . '/'; } if (!$archive) diff --git a/ecrire/exec/import_all.php b/ecrire/exec/import_all.php index 05e443b05e..868df43706 100644 --- a/ecrire/exec/import_all.php +++ b/ecrire/exec/import_all.php @@ -50,7 +50,15 @@ function verifier_version_sauvegarde ($archive) { } $dir = $repertoire; } else { - $dir = _DIR_TRANSFERT . $connect_login . '/'; + $repertoire = _DIR_TRANSFERT; + if(!@file_exists($repertoire)) { + $repertoire = preg_replace(','._DIR_TMP.',', '', $repertoire); + $repertoire = sous_repertoire(_DIR_TMP, $repertoire); + } + if(!@file_exists($repertoire.$connect_login)) { + $sous_rep = sous_repertoire($repertoire, $connect_login); + } + $dir = $sous_rep . '/'; } $_fopen = ($flag_gz) ? gzopen : fopen; $_fread = ($flag_gz) ? gzread : fread; @@ -139,7 +147,15 @@ function import_all_continue() } $dir = $repertoire; } else { - $dir = _DIR_TRANSFERT . $connect_login . '/'; + $repertoire = _DIR_TRANSFERT; + if(!@file_exists($repertoire)) { + $repertoire = preg_replace(','._DIR_TMP.',', '', $repertoire); + $repertoire = sous_repertoire(_DIR_TMP, $repertoire); + } + if(!@file_exists($repertoire.$connect_login)) { + $sous_rep = sous_repertoire($repertoire, $connect_login); + } + $dir = $sous_rep . '/'; } $archive = $dir . $request['archive']; $affiche_progression_pourcent = @filesize($archive); diff --git a/ecrire/inc/actions.php b/ecrire/inc/actions.php index 8092cd5420..a81a0e052a 100644 --- a/ecrire/inc/actions.php +++ b/ecrire/inc/actions.php @@ -251,7 +251,15 @@ function determine_upload() $var_auth = $var_auth(); } if ($connect_statut != '0minirezo') return false; - return _DIR_TRANSFERT . + $repertoire = _DIR_TRANSFERT; + if(!@file_exists($repertoire)) { + $repertoire = preg_replace(','._DIR_TMP.',', '', $repertoire); + $repertoire = sous_repertoire(_DIR_TMP, $repertoire); + } + if(!$connect_toutes_rubriques AND !@file_exists($repertoire.$connect_login)) { + $sous_rep = sous_repertoire($repertoire, $connect_login); + } + return $repertoire . ($connect_toutes_rubriques ? '' : ($connect_login . '/')); } diff --git a/tmp/upload/remove.txt b/tmp/upload/remove.txt deleted file mode 100644 index 977321426c..0000000000 --- a/tmp/upload/remove.txt +++ /dev/null @@ -1,3 +0,0 @@ -Vous pouvez effacer ce fichier sans dommages. - -You can safely remove this file. -- GitLab