Skip to content

Commit dcb224f

Browse files
authored
Merge pull request #99 from learnweb/check-params
Check parameters
2 parents c5359ac + 78f5620 commit dcb224f

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

post.php

+10
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,16 @@
3434
$delete = optional_param('delete', 0, PARAM_INT);
3535
$confirm = optional_param('confirm', 0, PARAM_INT);
3636

37+
$count = 0;
38+
$count += $moodleoverflow ? 1 : 0;
39+
$count += $reply ? 1 : 0;
40+
$count += $edit ? 1 : 0;
41+
$count += $delete ? 1 : 0;
42+
43+
if ($count !== 1) {
44+
throw new coding_exception('Exactly one parameter should be specified!');
45+
}
46+
3747
// Set the URL that should be used to return to this page.
3848
$PAGE->set_url('/mod/moodleoverflow/post.php', array(
3949
'moodleoverflow' => $moodleoverflow,

0 commit comments

Comments
 (0)