mirror of
https://github.com/moodle/moodle.git
synced 2025-01-29 19:50:14 +01:00
community block/publication MDL-23056 use required_param instead of optional_param when possible
This commit is contained in:
parent
54ab8769cd
commit
0d731457f7
@ -33,8 +33,7 @@ require_once($CFG->dirroot . '/blocks/community/forms.php');
|
||||
require_once($CFG->dirroot . '/' . $CFG->admin . '/registration/lib.php');
|
||||
|
||||
require_login();
|
||||
|
||||
$courseid = optional_param('courseid', $SITE->id, PARAM_INT); //if no courseid is given
|
||||
$courseid = required_param('courseid', PARAM_INT); //if no courseid is given
|
||||
$parentcourse = $DB->get_record('course', array('id' => $courseid), '*', MUST_EXIST);
|
||||
|
||||
$context = get_context_instance(CONTEXT_COURSE, $courseid);
|
||||
|
@ -39,9 +39,9 @@ require_once($CFG->libdir . '/filelib.php');
|
||||
|
||||
|
||||
//retrieve initial page parameters
|
||||
$id = optional_param('id', 0, PARAM_INT);
|
||||
$hubcourseid = optional_param('hubcourseid', 0, PARAM_INT);
|
||||
$huburl = optional_param('huburl', '', PARAM_URL);
|
||||
$id = required_param('id', PARAM_INT);
|
||||
$hubcourseid = required_param('hubcourseid', PARAM_INT);
|
||||
$huburl = required_param('huburl', PARAM_URL);
|
||||
$hubname = optional_param('hubname', '', PARAM_TEXT);
|
||||
|
||||
//some permissions and parameters checking
|
||||
@ -51,9 +51,6 @@ if (!has_capability('moodle/course:publish', get_context_instance(CONTEXT_COURSE
|
||||
or !confirm_sesskey()) {
|
||||
throw new moodle_exception('nopermission');
|
||||
}
|
||||
if (empty($huburl) or empty($hubcourseid)) {
|
||||
throw new moodle_exception('missingparameter');
|
||||
}
|
||||
|
||||
//page settings
|
||||
$PAGE->set_url('/course/publish/backup.php');
|
||||
|
@ -29,7 +29,7 @@ require('../../config.php');
|
||||
require_once($CFG->dirroot.'/' . $CFG->admin . '/registration/lib.php');
|
||||
require_once($CFG->dirroot.'/course/publish/forms.php');
|
||||
|
||||
$id = optional_param('id', 0, PARAM_INT);
|
||||
$id = required_param('id', PARAM_INT);
|
||||
$course = $DB->get_record('course', array('id'=>$id), '*', MUST_EXIST);
|
||||
require_login($course);
|
||||
|
||||
|
@ -30,7 +30,7 @@ require('../../config.php');
|
||||
require_once($CFG->dirroot . '/' . $CFG->admin . '/registration/lib.php');
|
||||
require_once($CFG->dirroot . '/course/publish/lib.php');
|
||||
|
||||
$id = optional_param('id', 0, PARAM_INT);
|
||||
$id = required_param('id', PARAM_INT);
|
||||
$hubname = optional_param('hubname', 0, PARAM_TEXT);
|
||||
$huburl = optional_param('huburl', 0, PARAM_URL);
|
||||
|
||||
|
@ -38,11 +38,7 @@ require_once($CFG->libdir . '/filelib.php');
|
||||
|
||||
|
||||
//check user access capability to this page
|
||||
$id = optional_param('id', 0, PARAM_INT);
|
||||
|
||||
if (empty($id)) {
|
||||
throw new moodle_exception('wrongurlformat', 'hub');
|
||||
}
|
||||
$id = required_param('id', PARAM_INT);
|
||||
|
||||
$course = $DB->get_record('course', array('id' => $id), '*', MUST_EXIST);
|
||||
require_login($course);
|
||||
|
Loading…
x
Reference in New Issue
Block a user