define("MAX_USERS_PER_PAGE", 50);
- $id = required_param('id',PARAM_INT); // course id
- $add = optional_param('add', '', PARAM_INT);
- $remove = optional_param('remove', '', PARAM_INT);
- $search = optional_param('search', '', PARAM_CLEAN); // search string
+ $id = required_param('id', PARAM_INT); // course id
+ $add = optional_param('add', 0, PARAM_INT);
+ $remove = optional_param('remove', 0, PARAM_INT);
+ $search = optional_param('search', '', PARAM_RAW); // search string
require_login();
} else {
- if ($search) {
- echo "<p align=\"center\">($strsearchresults : $search)</p>";
+ if ($search != '') {
+ echo "<p align=\"center\">($strsearchresults : ".s($search).")</p>";
}
if (!$users = get_users(true, $search, true, $teacherlist)) {
print_table($table);
}
- if ($search or $usercount > MAX_USERS_PER_PAGE) {
+ if (($search != '') or $usercount > MAX_USERS_PER_PAGE) {
echo "<center>";
echo "<form action=\"teacher.php\" method=\"get\">";
echo "<input type=\"hidden\" name=\"id\" value=\"$course->id\" />";
require_once("../config.php");
require_once("lib.php");
- $id = required_param('id',PARAM_INT); //course
- $user = optional_param('user', $USER->id, PARAM_INT); //user
- $confirm = optional_param('confirm','',PARAM_ALPHA);
+ $id = required_param('id', PARAM_INT); //course
+ $user = optional_param('user', $USER->id, PARAM_INT); //user
+ $confirm = optional_param('confirm', 0, PARAM_BOOL);
if (! $course = get_record("course", "id", $id) ) {
error("That's an invalid course id");
error("You are not allowed to unenroll");
}
- if (!empty($confirm) and confirm_sesskey()) {
+ if ($confirm and confirm_sesskey()) {
if (! unenrol_student($user->id, $course->id)) {
error("An error occurred while trying to unenrol you.");
$modes = array("outline", "complete", "todaylogs", "alllogs");
- $id = required_param('id',PARAM_INT); // course id
- $user = required_param('user',PARAM_INT); // user id
- $mode = optional_param('mode', "todaylogs", PARAM_ALPHA);
- $page = optional_param('page', 0, PARAM_INT);
+ $id = required_param('id',PARAM_INT); // course id
+ $user = required_param('user',PARAM_INT); // user id
+ $mode = optional_param('mode', "todaylogs", PARAM_ALPHA);
+ $page = optional_param('page', 0, PARAM_INT);
$perpage = optional_param('perpage', 100, PARAM_INT);
require_login();