backup MDL-22142 P19 - Moved optional_param call for backupid out of load controller static method and into backup.php

This commit is contained in:
Sam Hemelryk 2010-05-02 03:36:26 +00:00
parent f6ae3f0108
commit 8c6d7f34ed
2 changed files with 6 additions and 3 deletions

View File

@ -23,6 +23,10 @@ require_once($CFG->dirroot . '/backup/moodle2/backup_plan_builder.class.php');
$courseid = required_param('id', PARAM_INT);
$sectionid = optional_param('section', null, PARAM_INT);
$cmid = optional_param('cm', null, PARAM_INT);
/**
* Part of the forms in stages after initial, is POST never GET
*/
$backupid = optional_param('backup', false, PARAM_ALPHANUM);
$url = new moodle_url('/backup/backup.php', array('id'=>$courseid));
if ($sectionid !== null) {
@ -72,7 +76,7 @@ switch ($type) {
print_error('unknownbackuptype');
}
if (!($bc = backup_ui::load_controller())) {
if (!($bc = backup_ui::load_controller($backupid))) {
$bc = new backup_controller($type, $id, backup::FORMAT_MOODLE,
backup::INTERACTIVE_YES, backup::MODE_GENERAL, $USER->id);
}

View File

@ -293,9 +293,8 @@ class backup_ui {
* Loads the backup controller if we are tracking one
* @return backup_controller|false
*/
final public static function load_controller() {
final public static function load_controller($backupid=false) {
// Get the backup id optional param
$backupid = optional_param('backup', false, PARAM_ALPHANUM);
if ($backupid) {
try {
// Try to load the controller with it.