From 49957d3858bccd152e98b644b976400f57d325c0 Mon Sep 17 00:00:00 2001 From: Dan Poltawski Date: Wed, 16 May 2012 11:11:33 +0800 Subject: [PATCH] MDL-28666 admin/repository: use PARAM_BOOL for booleans. --- admin/repository.php | 10 ++-------- admin/repositoryinstance.php | 9 ++------- 2 files changed, 4 insertions(+), 15 deletions(-) diff --git a/admin/repository.php b/admin/repository.php index a3af2ddc588..b3494cab5a5 100644 --- a/admin/repository.php +++ b/admin/repository.php @@ -21,7 +21,7 @@ require_once($CFG->libdir . '/adminlib.php'); $repository = optional_param('repos', '', PARAM_ALPHANUMEXT); $action = optional_param('action', '', PARAM_ACTION); $sure = optional_param('sure', '', PARAM_ALPHA); -$downloadcontents = optional_param('downloadcontents', '', PARAM_ALPHA); +$downloadcontents = optional_param('downloadcontents', false, PARAM_BOOL); $display = true; // fall through to normal display @@ -205,12 +205,6 @@ if (($action == 'edit') || ($action == 'new')) { print_error('confirmsesskeybad', '', $baseurl); } - if (!empty($downloadcontents) and $downloadcontents == 'yes') { - $downloadcontents = true; - } else { - $downloadcontents = false; - } - if ($repositorytype->delete($downloadcontents)) { redirect($baseurl); } else { @@ -237,7 +231,7 @@ if (($action == 'edit') || ($action == 'new')) { 'action' =>'delete', 'repos'=> $repository, 'sure' => 'yes', - 'downloadcontents' => 'yes', + 'downloadcontents' => 1, )); $output .= $OUTPUT->single_button($removeurl, get_string('continueuninstall', 'repository')); diff --git a/admin/repositoryinstance.php b/admin/repositoryinstance.php index f2b6e7f8e4f..fe751464192 100644 --- a/admin/repositoryinstance.php +++ b/admin/repositoryinstance.php @@ -27,7 +27,7 @@ $hide = optional_param('hide', 0, PARAM_INT); $delete = optional_param('delete', 0, PARAM_INT); $sure = optional_param('sure', '', PARAM_ALPHA); $type = optional_param('type', '', PARAM_PLUGIN); -$downloadcontents = optional_param('downloadcontents', '', PARAM_ALPHA); +$downloadcontents = optional_param('downloadcontents', false, PARAM_BOOL); $context = context_system::instance(); @@ -123,11 +123,6 @@ if (!empty($edit) || !empty($new)) { throw new repository_exception('readonlyinstance', 'repository'); } if ($sure) { - if (!empty($downloadcontents) and $downloadcontents == 'yes') { - $downloadcontents = true; - } else { - $downloadcontents = false; - } if ($instance->delete($downloadcontents)) { $deletedstr = get_string('instancedeleted', 'repository'); redirect($parenturl, $deletedstr, 3); @@ -145,7 +140,7 @@ if (!empty($edit) || !empty($new)) { 'sure' => 'yes', )); $continueanddownloadurl = new moodle_url($continueurl, array( - 'downloadcontents' => 'yes' + 'downloadcontents' => 1 )); $message = get_string('confirmdelete', 'repository', $instance->name); echo html_writer::tag('p', $message);