diff --git a/course/category.php b/course/category.php index 016ddaac218..b2e62c94b24 100644 --- a/course/category.php +++ b/course/category.php @@ -6,17 +6,17 @@ require_once("../config.php"); require_once("lib.php"); - $id = required_param('id', PARAM_INT); // Category id - $page = optional_param('page', 0, PARAM_INT); // which page to show - $perpage = optional_param('perpage', 20, PARAM_INT); // how many per page - $edit = optional_param('edit','',PARAM_ALPHA); - $hide = optional_param('hide',0,PARAM_INT); - $show = optional_param('show',0,PARAM_INT); - $moveup = optional_param('moveup',0,PARAM_INT); - $movedown = optional_param('movedown',0,PARAM_INT); - $moveto = optional_param('moveto',0,PARAM_INT); - $rename = optional_param('rename',''); - $resort = optional_param('resort',''); + $id = required_param('id', PARAM_INT); // Category id + $page = optional_param('page', 0, PARAM_INT); // which page to show + $perpage = optional_param('perpage', 20, PARAM_INT); // how many per page + $edit = optional_param('edit', -1, PARAM_BOOL); + $hide = optional_param('hide', 0, PARAM_INT); + $show = optional_param('show', 0, PARAM_INT); + $moveup = optional_param('moveup', 0, PARAM_INT); + $movedown = optional_param('movedown', 0, PARAM_INT); + $moveto = optional_param('moveto', 0, PARAM_INT); + $rename = optional_param('rename', '', PARAM_NOTAGS); + $resort = optional_param('resort', 0, PARAM_BOOL); if (!$site = get_site()) { error("Site isn't defined!"); @@ -31,12 +31,8 @@ } if (iscreator()) { - if (!empty($edit) and confirm_sesskey()) { - if ($edit == "on") { - $USER->categoryediting = true; - } else if ($edit == "off") { - $USER->categoryediting = false; - } + if ($edit !== -1) { + $USER->categoryediting = $edit; } $navbaritem = update_category_button($category->id); @@ -64,7 +60,7 @@ /// Resort the category if requested - if (!empty($resort) and confirm_sesskey()) { + if ($resort and confirm_sesskey()) { if ($courses = get_courses($category->id, "fullname ASC", 'c.id,c.fullname,c.sortorder')) { // move it off the range $count = get_record_sql('SELECT MAX(sortorder) AS max, 1 diff --git a/course/delete.php b/course/delete.php index 2a9d0da6340..74b0dae7c63 100644 --- a/course/delete.php +++ b/course/delete.php @@ -3,8 +3,8 @@ require_once("../config.php"); - $id = required_param('id',PARAM_INT); // course id - $delete = optional_param('delete'); // delete confirmation + $id = required_param('id', PARAM_INT); // course id + $delete = optional_param('delete', '', PARAM_ALPHANUM); // delete confirmation hash require_login(); diff --git a/course/edit.php b/course/edit.php index 8b87c3a16e0..d196164e318 100644 --- a/course/edit.php +++ b/course/edit.php @@ -5,7 +5,7 @@ require_once("lib.php"); require_once("$CFG->libdir/blocklib.php"); - $id = optional_param('id', 0, PARAM_INT); // course id + $id = optional_param('id', 0, PARAM_INT); // course id $category = optional_param('category', 0, PARAM_INT); // possible default category require_login(); diff --git a/course/group-edit.html b/course/group-edit.html index 58cef414326..57969bbea03 100644 --- a/course/group-edit.html +++ b/course/group-edit.html @@ -18,7 +18,7 @@