~ubuntu-branches/ubuntu/jaunty/moodle/jaunty

« back to all changes in this revision

Viewing changes to admin/user/user_bulk_confirm.php

  • Committer: Bazaar Package Importer
  • Author(s): Jordan Mantha, Matt Oquist
  • Date: 2009-02-25 15:16:22 UTC
  • mfrom: (1.1.11 upstream)
  • Revision ID: james.westby@ubuntu.com-20090225151622-0ekt1liwhv2obfza
Tags: 1.9.4.dfsg-0ubuntu1
* Merge with Debian git (Closes LP: #322961, #239481, #334611):
  - use Ubuntu's smarty lib directory for linking
  - use internal yui library 
  - add update-notifier support back in

[Matt Oquist]
  * renamed prerm script
  * significantly rewrote postinst and other maintainer scripts to improve
    user experience and package maintainability
    (Closes LP: #225662, #325450, #327843, #303078, #234609)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<?php //$Id: user_bulk_confirm.php,v 1.3.2.1 2007/11/13 09:02:12 skodak Exp $
 
2
/**
 
3
* script for bulk user delete operations
 
4
*/
 
5
 
 
6
require_once('../../config.php');
 
7
require_once($CFG->libdir.'/adminlib.php');
 
8
 
 
9
$confirm = optional_param('confirm', 0, PARAM_BOOL);
 
10
 
 
11
admin_externalpage_setup('userbulk');
 
12
require_capability('moodle/user:update', get_context_instance(CONTEXT_SYSTEM));
 
13
 
 
14
$return = $CFG->wwwroot.'/'.$CFG->admin.'/user/user_bulk.php';
 
15
 
 
16
if (empty($SESSION->bulk_users)) {
 
17
    redirect($return);
 
18
}
 
19
 
 
20
admin_externalpage_print_header();
 
21
 
 
22
//TODO: add support for large number of users
 
23
 
 
24
if ($confirm and confirm_sesskey()) {
 
25
    $in = implode(',', $SESSION->bulk_users);
 
26
    if ($rs = get_recordset_select('user', "id IN ($in)", '', 'id, username, secret, confirmed, auth, firstname, lastname')) {
 
27
        while ($user = rs_fetch_next_record($rs)) {
 
28
            if ($user->confirmed) {
 
29
                continue;
 
30
            }
 
31
            $auth = get_auth_plugin($user->auth);
 
32
            $result = $auth->user_confirm(addslashes($user->username), addslashes($user->secret));
 
33
            if ($result != AUTH_CONFIRM_OK && $result != AUTH_CONFIRM_ALREADY) {
 
34
                notify(get_string('usernotconfirmed', '', fullname($user, true)));
 
35
            }
 
36
        }
 
37
        rs_close($rs);
 
38
    }
 
39
    redirect($return, get_string('changessaved'));
 
40
 
 
41
} else {
 
42
    $in = implode(',', $SESSION->bulk_users);
 
43
    $userlist = get_records_select_menu('user', "id IN ($in)", 'fullname', 'id,'.sql_fullname().' AS fullname');
 
44
    $usernames = implode(', ', $userlist);
 
45
    $optionsyes = array();
 
46
    $optionsyes['confirm'] = 1;
 
47
    $optionsyes['sesskey'] = sesskey();
 
48
    print_heading(get_string('confirmation', 'admin'));
 
49
    notice_yesno(get_string('confirmcheckfull', '', $usernames), 'user_bulk_confirm.php', 'user_bulk.php', $optionsyes, NULL, 'post', 'get');
 
50
}
 
51
 
 
52
admin_externalpage_print_footer();
 
53
?>
 
 
b'\\ No newline at end of file'