mirror of
https://github.com/moodle/moodle.git
synced 2025-01-19 06:18:28 +01:00
44 lines
1.2 KiB
HTML
44 lines
1.2 KiB
HTML
<?php // $Id$
|
|
//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");
|
|
}
|
|
|
|
//Check login
|
|
require_login();
|
|
|
|
//Check admin
|
|
if (!empty($id)) {
|
|
if (!isteacheredit($id)) {
|
|
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");
|
|
}
|
|
}
|
|
}
|
|
} else {
|
|
if (!isadmin()) {
|
|
error("You need to be an admin user to use this page.", "$CFG->wwwroot/login/index.php");
|
|
}
|
|
}
|
|
|
|
//Check site
|
|
if (!$site = get_site()) {
|
|
error("Site not found!");
|
|
}
|
|
|
|
$status = restore_precheck($id,$file,!empty($SESSION->restore->importing));
|
|
|
|
if (!$status) {
|
|
error("An error occured");
|
|
}
|
|
|
|
?>
|