Commit 2649e660 authored by Son Nguyen's avatar Son Nguyen Committed by Aaron Wells

Fix incorrect calls to record_exists_select()

Bug 1399464: $values param must be an array

Change-Id: Ia865e42641830400fffeb3950f6cbe4fbed7ccbb
Signed-off-by: 's avatarSon Nguyen <son.nguyen@catalyst.net.nz>
parent 6ba2a9cf
......@@ -155,7 +155,7 @@ function accountprefs_validate(Pieform $form, $values) {
if (!AuthInternal::is_username_valid($values['username'])) {
$form->set_error('username', get_string('usernameinvalidform', 'auth.internal'));
}
if (!$form->get_error('username') && record_exists_select('usr', 'LOWER(username) = ?', strtolower($values['username']))) {
if (!$form->get_error('username') && record_exists_select('usr', 'LOWER(username) = ?', array(strtolower($values['username'])))) {
$form->set_error('username', get_string('usernamealreadytaken', 'auth.internal'));
}
}
......
......@@ -194,7 +194,7 @@ function adduser_validate(Pieform $form, $values) {
$form->set_error('username', get_string('usernameinvalidform', 'auth.internal'));
}
}
if (!$form->get_error('username') && record_exists_select('usr', 'LOWER(username) = ?', strtolower($username))) {
if (!$form->get_error('username') && record_exists_select('usr', 'LOWER(username) = ?', array(strtolower($username)))) {
$form->set_error('username', get_string('usernamealreadytaken', 'auth.internal'));
}
......
......@@ -287,7 +287,7 @@ function edituser_site_validate(Pieform $form, $values) {
}
}
if (!$form->get_error('username') && record_exists_select('usr', 'LOWER(username) = ?', strtolower($values['username']))) {
if (!$form->get_error('username') && record_exists_select('usr', 'LOWER(username) = ?', array(strtolower($values['username'])))) {
$form->set_error('username', get_string('usernamealreadytaken', 'auth.internal'));
}
}
......
......@@ -309,7 +309,7 @@ function uploadcsv_validate(Pieform $form, $values) {
$csverrors->add($i, get_string('uploadcsverroruseralreadyexists', 'admin', $i, $username));
}
else {
if (!$values['updateusers'] && record_exists_select('usr', 'LOWER(username) = ?', strtolower($username))) {
if (!$values['updateusers'] && record_exists_select('usr', 'LOWER(username) = ?', array(strtolower($username)))) {
$csverrors->add($i, get_string('uploadcsverroruseralreadyexists', 'admin', $i, $username));
}
$usernames[strtolower($username)] = array(
......
......@@ -975,7 +975,7 @@ function requiredfields_validate(Pieform $form, $values) {
if (!AuthInternal::is_username_valid($values['username'])) {
$form->set_error('username', get_string('usernameinvalidform', 'auth.internal'));
}
if (!$form->get_error('username') && record_exists_select('usr', 'LOWER(username) = ?', strtolower($values['username']))) {
if (!$form->get_error('username') && record_exists_select('usr', 'LOWER(username) = ?', array(strtolower($values['username'])))) {
$form->set_error('username', get_string('usernamealreadytaken', 'auth.internal'));
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment