From 26082098d979e53e31cae23992d9e35d154fac18 Mon Sep 17 00:00:00 2001 From: stronk7 <stronk7> Date: Sat, 9 Oct 2004 23:19:53 +0000 Subject: [PATCH] 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 --- backup/backuplib.php | 10 +++++----- backup/restorelib.php | 4 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) 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 @@ -<?PHP //$Id$ +<?php //$Id$ //This file contains all the function needed in the backup utility //except the mod-related funtions that are into every backuplib.php inside //every mod directory @@ -1263,7 +1263,7 @@ $status = true; //Base dir where everything happens - $basedir = $CFG->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 "<br />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 -- 2.39.5