2004-09-12 01:34:24 +00:00
|
|
|
<?php // $Id$
|
2003-05-16 21:52:49 +00:00
|
|
|
//This page copies th zip to the temp directory,
|
|
|
|
//unzip it, check that it is a valid backup file
|
|
|
|
//inform about its contents and fill all the necesary
|
|
|
|
//variables to continue with the restore.
|
|
|
|
|
|
|
|
//Checks we have the file variable
|
|
|
|
if (!isset($file)) {
|
|
|
|
error ("File not specified");
|
|
|
|
}
|
|
|
|
|
2003-05-18 17:15:05 +00:00
|
|
|
//Check login
|
|
|
|
require_login();
|
2003-05-22 22:12:32 +00:00
|
|
|
|
2003-05-18 17:15:05 +00:00
|
|
|
//Check admin
|
2003-08-02 16:06:33 +00:00
|
|
|
if (!empty($id)) {
|
2003-08-16 06:37:06 +00:00
|
|
|
if (!isteacheredit($id)) {
|
2005-01-27 02:35:10 +00:00
|
|
|
if (empty($to)) {
|
|
|
|
error("You need to be a teacher or admin user to use this page.", "$CFG->wwwroot/login/index.php");
|
|
|
|
} else {
|
|
|
|
if (!isteacheredit($to)) {
|
|
|
|
error("You need to be a teacher or admin user to use this page.", "$CFG->wwwroot/login/index.php");
|
|
|
|
}
|
|
|
|
}
|
2003-08-02 16:06:33 +00:00
|
|
|
}
|
|
|
|
} else {
|
|
|
|
if (!isadmin()) {
|
|
|
|
error("You need to be an admin user to use this page.", "$CFG->wwwroot/login/index.php");
|
|
|
|
}
|
2003-05-18 17:15:05 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//Check site
|
|
|
|
if (!$site = get_site()) {
|
|
|
|
error("Site not found!");
|
|
|
|
}
|
|
|
|
|
2006-01-15 21:09:13 +00:00
|
|
|
$errorstr = '';
|
|
|
|
if (!empty($SESSION->restore->importing)) {
|
|
|
|
define('RESTORE_SILENTLY',true);
|
|
|
|
}
|
|
|
|
$status = restore_precheck($id,$file,$errorstr);
|
2005-01-27 02:35:10 +00:00
|
|
|
|
2003-05-18 15:51:20 +00:00
|
|
|
if (!$status) {
|
2005-01-27 02:35:10 +00:00
|
|
|
error("An error occured");
|
2003-05-17 17:34:30 +00:00
|
|
|
}
|
2003-05-18 17:15:05 +00:00
|
|
|
|
2003-05-16 21:52:49 +00:00
|
|
|
?>
|