HEX
Server: Apache/2
System: Linux deejung.jaideehosting.com 3.10.0-693.17.1.el7.x86_64 #1 SMP Thu Jan 25 20:13:58 UTC 2018 x86_64
User: mbp (1631)
PHP: 7.4.15
Disabled: NONE
Upload Files
File: /home/mbp/domains/mbp.ac.th/public_html/old/main/backup/restore_precheck.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 (!has_capability('moodle/site:restore', get_context_instance(CONTEXT_COURSE, $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 (!has_capability('moodle/site:restore', get_context_instance(CONTEXT_COURSE, $to))
                    && !has_capability('moodle/site:import',  get_context_instance(CONTEXT_COURSE, $to))) {
                    error("You need to be a teacher or admin user to use this page.", "$CFG->wwwroot/login/index.php");
                }
            }
        }
    } else {
        if (!has_capability('moodle/site:restore', get_context_instance(CONTEXT_SYSTEM))) {
            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!");
    }

    $errorstr = '';
    if (!empty($SESSION->restore->importing)) {
        define('RESTORE_SILENTLY',true);
    }
    $status = restore_precheck($id,$file,$errorstr);
 
    if (!$status) {
        error("An error occured");
    }

?>