]> git.mjollnir.org Git - moodle.git/commitdiff
MDL-14679 fixed dml conversion issues
authorPetr Skoda <skodak@moodle.org>
Tue, 17 Nov 2009 10:21:29 +0000 (10:21 +0000)
committerPetr Skoda <skodak@moodle.org>
Tue, 17 Nov 2009 10:21:29 +0000 (10:21 +0000)
admin/user/user_bulk_confirm.php
admin/user/user_bulk_delete.php
admin/user/user_bulk_message.php

index b2870b83115b0d1e81475de4eb704d4a52e0ee64..f6603a05b1f10c8a8bf4df825220bab8e160b6b4 100755 (executable)
@@ -23,8 +23,8 @@ admin_externalpage_print_header();
 //TODO: add support for large number of users
 
 if ($confirm and confirm_sesskey()) {
-    $in = implode(',', $SESSION->bulk_users);
-    if ($rs = $DB->get_recordset_select('user', "id IN ($in)", null, '', 'id, username, secret, confirmed, auth, firstname, lastname')) {
+    list($in, $params) = $DB->get_in_or_equal($SESSION->bulk_users);
+    if ($rs = $DB->get_recordset_select('user', "id $in", $params, '', 'id, username, secret, confirmed, auth, firstname, lastname')) {
         foreach ($rs as $user) {
             if ($user->confirmed) {
                 continue;
@@ -40,8 +40,8 @@ if ($confirm and confirm_sesskey()) {
     redirect($return, get_string('changessaved'));
 
 } else {
-    $in = implode(',', $SESSION->bulk_users);
-    $userlist = $DB->get_records_select_menu('user', "id IN ($in)", null, 'fullname', 'id,'.$DB->sql_fullname().' AS fullname');
+    list($in, $params) = $DB->get_in_or_equal($SESSION->bulk_users);
+    $userlist = $DB->get_records_select_menu('user', "id $in", $params, 'fullname', 'id,'.$DB->sql_fullname().' AS fullname');
     $usernames = implode(', ', $userlist);
     echo $OUTPUT->heading(get_string('confirmation', 'admin'));
     $formcontinue = html_form::make_button('user_bulk_confirm.php', array('confirm' => 1), get_string('yes'));
index aac880c21f22f3a7a91cf27b70840046064ee2b9..0b398668f5acb11c0feaa2778a174c74cb087c66 100755 (executable)
@@ -25,8 +25,8 @@ admin_externalpage_print_header();
 if ($confirm and confirm_sesskey()) {
     $primaryadmin = get_admin();
 
-    $in = implode(',', $SESSION->bulk_users);
-    if ($rs = $DB->get_recordset_select('user', "id IN ($in)", null)) {
+    list($in, $params) = $DB->get_in_or_equal($SESSION->bulk_users);
+    if ($rs = $DB->get_recordset_select('user', "id $in", $params)) {
         foreach ($rs as $user) {
             if ($primaryadmin->id != $user->id and $USER->id != $user->id and delete_user($user)) {
                 unset($SESSION->bulk_users[$user->id]);
@@ -40,8 +40,8 @@ if ($confirm and confirm_sesskey()) {
     redirect($return, get_string('changessaved'));
 
 } else {
-    $in = implode(',', $SESSION->bulk_users);
-    $userlist = $DB->get_records_select_menu('user', "id IN ($in)", null, 'fullname', 'id,'.$DB->sql_fullname().' AS fullname');
+    list($in, $params) = $DB->get_in_or_equal($SESSION->bulk_users);
+    $userlist = $DB->get_records_select_menu('user', "id $in", $params, 'fullname', 'id,'.$DB->sql_fullname().' AS fullname');
     $usernames = implode(', ', $userlist);
     echo $OUTPUT->heading(get_string('confirmation', 'admin'));
     $formcontinue = html_form::make_button('user_bulk_delete.php', array('confirm' => 1), get_string('yes'));
index bbfca19ebdd9b365ab82d60a64da6f1b734fb57d..67819be736b1a9c16e963dcc83fe44e77eec0ded 100755 (executable)
@@ -24,8 +24,8 @@ if (empty($CFG->messaging)) {
 //TODO: add support for large number of users
 
 if ($confirm and !empty($msg) and confirm_sesskey()) {
-    $in = implode(',', $SESSION->bulk_users);
-    if ($rs = $DB->get_recordset_select('user', "id IN ($in)", null)) {
+    list($in, $params) = $DB->get_in_or_equal($SESSION->bulk_users);
+    if ($rs = $DB->get_recordset_select('user', "id $in", $params)) {
         foreach ($rs as $user) {
             message_post_message($USER, $user, $msg, FORMAT_HTML, 'direct');
         }
@@ -52,8 +52,8 @@ if ($msgform->is_cancelled()) {
 
     $msg = format_text($formdata->messagebody, $formdata->format, $options);
 
-    $in = implode(',', $SESSION->bulk_users);
-    $userlist = $DB->get_records_select_menu('user', "id IN ($in)", null, 'fullname', 'id,'.$DB->sql_fullname().' AS fullname');
+    list($in, $params) = $DB->get_in_or_equal($SESSION->bulk_users);
+    $userlist = $DB->get_records_select_menu('user', "id $in", $params, 'fullname', 'id,'.$DB->sql_fullname().' AS fullname');
     $usernames = implode(', ', $userlist);
     admin_externalpage_print_header();
     echo $OUTPUT->heading(get_string('confirmation', 'admin'));