]> git.mjollnir.org Git - moodle.git/commitdiff
added check login, check admin and check site to every page.
authorstronk7 <stronk7>
Sun, 18 May 2003 17:15:05 +0000 (17:15 +0000)
committerstronk7 <stronk7>
Sun, 18 May 2003 17:15:05 +0000 (17:15 +0000)
If not, it was possible to execute them...!!

backup/backup_check.html
backup/backup_execute.html
backup/backup_form.html
backup/restore.php
backup/restore_precheck.html

index 2c61f34234a57cd85ad5cbe168f7186afd879f04..b08cb9b451c53c4bb75b4ad00901f6b8b0b911d2 100644 (file)
@@ -1,6 +1,19 @@
 <?PHP //$Id$
     //This page prints the backup todo list to see everything
 
+    //Check login   
+    require_login();
+
+    //Check admin
+    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!");
+    }
+
    //Checks for the required files/functions to backup every mod
     //And check if there is data about it
     $count = 0;
index 9e0bc141562656c1aac79d502d2b45794aeb0810..dc9e1323c511c554d95a87abda88c411ff24c5a9 100644 (file)
@@ -1,6 +1,19 @@
 <?PHP //$Id$
     //This page prints the backup todo list to see everything
 
+    //Check login   
+    require_login();
+
+    //Check admin
+    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!");
+    }
+
    //Checks for the required files/functions to backup every mod
     //And check if there is data about it
     $count = 0;
index 7996fdb00a93b939a9d8268ae687496a94bdb752..3ac9c7a6e42d6938f03f2639ffb7a794adc96f4e 100644 (file)
@@ -1,6 +1,19 @@
 <?PHP //$Id$
     //This page prints the backup form to select everything
 
+    //Check login   
+    require_login();
+
+    //Check admin
+    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!");
+    }
+
    //Checks for the required files/functions to backup every mod
     //And check if there is data about it 
     $count = 0;
index 9b562d34641d64c1d96ff811556a9954ae1f6738..5c0e9fe58fa5d4608279916ff8e4ca9843021d41 100644 (file)
@@ -65,8 +65,8 @@
     //Call the form, depending the step we are
     if (!$launch) {
         include_once("restore_precheck.html");
-    } else if ($launch == "check") {
-        include_once("backup_check.html");
+    } else if ($launch == "form") {
+        include_once("restore_form.html");
     } else if ($launch == "execute") {
         include_once("backup_execute.html");
     }
index b16a000e3376eaa50a897480a5e42fd5f7e6a11a..35e4e8f96e8e40518c6b67875e35a3c1dbff88da 100644 (file)
@@ -9,6 +9,19 @@
         error ("File not specified");
     }
 
+    //Check login   
+    require_login();
+
+    //Check admin
+    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!");
+    }
+
     //Prepend dataroot to variable to have the absolute path
     $file = $CFG->dataroot."/".$file;
 
         }
     }
 
+    //Save course header and info into php session
+    if ($status) {
+        $SESSION->info = $info;
+        $SESSION->course_header = $course_header;
+    }
+
+    //Finally, a little form to continue
+    //with some hidden fields
+    if ($status) {
+        echo "<br><CENTER>";
+        $hidden["backup_unique_code"] = $backup_unique_code;
+        $hidden["launch"]             = "form";
+        $hidden["file"]               =  $file;
+        print_single_button("restore.php", $hidden, get_string("continue"),"post");
+        echo "</CENTER>";
+    }
+  
     if (!$status) {
         error ("An error has ocurred");
     }
+
 ?>