[ Index ]

PHP Cross Reference of Moodle 1.9.3 [Build 15-Oct-2008]

title

Body

[close]

/backup/ -> restore_precheck.html (source)

   1  <?php  // $Id: restore_precheck.html,v 1.18.10.2 2008/05/02 04:07:30 dongsheng Exp $
   2      //This page copies th zip to the temp directory,
   3      //unzip it, check that it is a valid backup file
   4      //inform about its contents and fill all the necesary
   5      //variables to continue with the restore.
   6  
   7      //Checks we have the file variable
   8      if (!isset($file)) {         
   9          error ("File not specified");
  10      }
  11  
  12      //Check login   
  13      require_login();
  14   
  15      //Check admin
  16      if (!empty($id)) {
  17          if (!has_capability('moodle/site:restore', get_context_instance(CONTEXT_COURSE, $id))) {
  18              if (empty($to)) {
  19                  error("You need to be a teacher or admin user to use this page.", "$CFG->wwwroot/login/index.php");
  20              } else {
  21                  if (!has_capability('moodle/site:restore', get_context_instance(CONTEXT_COURSE, $to))
  22                      && !has_capability('moodle/site:import',  get_context_instance(CONTEXT_COURSE, $to))) {
  23                      error("You need to be a teacher or admin user to use this page.", "$CFG->wwwroot/login/index.php");
  24                  }
  25              }
  26          }
  27      } else {
  28          if (!has_capability('moodle/site:restore', get_context_instance(CONTEXT_SYSTEM))) {
  29              error("You need to be an admin user to use this page.", "$CFG->wwwroot/login/index.php");   
  30          }
  31      }
  32  
  33      //Check site
  34      if (!$site = get_site()) {
  35          error("Site not found!");
  36      }
  37  
  38      $errorstr = '';
  39      if (!empty($SESSION->restore->importing)) {
  40          define('RESTORE_SILENTLY',true);
  41      }
  42      $status = restore_precheck($id,$file,$errorstr);
  43   
  44      if (!$status) {
  45          error("An error occured");
  46      }
  47  
  48  ?>


Generated: Wed Jan 14 11:33:29 2009 Cross-referenced by PHPXref 0.7