From: stronk7 Date: Sat, 9 Oct 2004 23:19:53 +0000 (+0000) Subject: Use of cleardoubleslashes() added to the backup and restore functions. X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=26082098d979e53e31cae23992d9e35d154fac18;p=moodle.git Use of cleardoubleslashes() added to the backup and restore functions. They will be changed to calls to new, central zip and unzip functions. (coming soon) Merged from MOODLE_14_STABLE --- diff --git a/backup/backuplib.php b/backup/backuplib.php index 8015e9a12d..6b580966cf 100644 --- a/backup/backuplib.php +++ b/backup/backuplib.php @@ -1,4 +1,4 @@ -dataroot."/temp/backup/".$preferences->backup_unique_code; + $basedir = cleardoubleslashes($CFG->dataroot."/temp/backup/".$preferences->backup_unique_code); //Backup zip file name $name = $preferences->backup_name; //List base_dir files and directories @@ -1280,14 +1280,14 @@ //} //Include into array //echo "
Adding file/dir ".$file; //Debug - $files[] = $basedir."/".$file; + $files[] = cleardoubleslashes($basedir."/".$file); } include_once("$CFG->dirroot/lib/pclzip/pclzip.lib.php"); //include_once("$CFG->dirroot/lib/pclzip/pclerror.lib.php"); //Debug //include_once("$CFG->dirroot/lib/pclzip/pcltrace.lib.php"); //Debug //PclTraceOn(2); //Debug - $archive = new PclZip("$basedir/$name"); - if (($list = $archive->create($files,PCLZIP_OPT_REMOVE_PATH,$basedir)) == 0) { + $archive = new PclZip(cleardoubleslashes("$basedir/$name")); + if (($list = $archive->create($files,PCLZIP_OPT_REMOVE_PATH,rtrim(cleardoubleslashes($basedir), "/"))) == 0) { error($archive->errorInfo(true)); $status = false; } diff --git a/backup/restorelib.php b/backup/restorelib.php index 6b5d485ef0..e118b86c41 100644 --- a/backup/restorelib.php +++ b/backup/restorelib.php @@ -14,8 +14,8 @@ //include_once("$CFG->dirroot/lib/pclzip/pclerror.lib.php"); //Debug //include_once("$CFG->dirroot/lib/pclzip/pcltrace.lib.php"); //Debug //PclTraceOn(2); //Debug - $archive = new PclZip($file); - if (!$list = $archive->extract(dirname($file))) { + $archive = new PclZip(cleardoubleslashes($file)); + if (!$list = $archive->extract(PCLZIP_OPT_PATH, cleardoubleslashes(dirname($file)))) { $status = false; } //PclTraceDisplay(); //Debug