[ Index ] |
PHP Cross Reference of MyBB 1.8.38 |
[Summary view] [Print] [Text view]
1 <?php 2 /** 3 * MyBB 1.8 4 * Copyright 2014 MyBB Group, All Rights Reserved 5 * 6 * Website: http://www.mybb.com 7 * License: http://www.mybb.com/about/license 8 * 9 */ 10 11 // Disallow direct access to this file for security reasons 12 if(!defined("IN_MYBB")) 13 { 14 die("Direct initialization of this file is not allowed.<br /><br />Please make sure IN_MYBB is defined."); 15 } 16 17 $page->add_breadcrumb_item($lang->awaiting_activation, "index.php?module=user-awaiting_activation"); 18 19 $sub_tabs['awaiting_activation'] = array( 20 'title' => $lang->awaiting_activation, 21 'link' => "index.php?module=user-awaiting_activation", 22 'description' => $lang->awaiting_activation_desc 23 ); 24 25 $plugins->run_hooks("admin_user_awaiting_activation_begin"); 26 27 if($mybb->input['action'] == "activate" && $mybb->request_method == "post") 28 { 29 $plugins->run_hooks("admin_user_awaiting_activation_activate"); 30 31 if(!is_array($mybb->input['user'])) 32 { 33 $mybb->input['user'] = array(); 34 } 35 36 $mybb->input['user'] = array_map('intval', $mybb->input['user']); 37 $user_ids = implode(", ", $mybb->input['user']); 38 39 if(empty($user_ids)) 40 { 41 flash_message($lang->no_users_selected, 'error'); 42 admin_redirect("index.php?module=user-awaiting_activation"); 43 } 44 45 $num_activated = $num_deleted = 0; 46 $users_to_delete = array(); 47 if(!empty($mybb->input['delete'])) // Delete selected user(s) 48 { 49 require_once MYBB_ROOT.'inc/datahandlers/user.php'; 50 $userhandler = new UserDataHandler('delete'); 51 52 $query = $db->simple_select("users", "uid, usergroup", "uid IN ({$user_ids})"); 53 while($user = $db->fetch_array($query)) 54 { 55 if($user['usergroup'] == 5) 56 { 57 ++$num_deleted; 58 $users_to_delete[] = (int)$user['uid']; 59 } 60 } 61 62 if(!empty($users_to_delete)) 63 { 64 $userhandler->delete_user($users_to_delete, 1); 65 } 66 67 $plugins->run_hooks("admin_user_awaiting_activation_activate_delete_commit"); 68 69 // Log admin action 70 log_admin_action('deleted', $num_deleted); 71 72 flash_message($lang->success_users_deleted, 'success'); 73 admin_redirect("index.php?module=user-awaiting_activation"); 74 } 75 else // Activate selected user(s) 76 { 77 $query = $db->simple_select("users", "uid, username, email, usergroup, coppauser", "uid IN ({$user_ids})"); 78 while($user = $db->fetch_array($query)) 79 { 80 ++$num_activated; 81 if($user['coppauser']) 82 { 83 $updated_user = array( 84 "coppauser" => 0 85 ); 86 } 87 else 88 { 89 $db->delete_query("awaitingactivation", "uid='{$user['uid']}'"); 90 } 91 92 // Move out of awaiting activation if they're in it. 93 if($user['usergroup'] == 5) 94 { 95 $updated_user['usergroup'] = 2; 96 } 97 98 $db->update_query("users", $updated_user, "uid='{$user['uid']}'"); 99 100 $message = $lang->sprintf($lang->email_adminactivateaccount, $user['username'], $mybb->settings['bbname'], $mybb->settings['bburl']); my_mail($user['email'], $lang->sprintf($lang->emailsubject_activateaccount, $mybb->settings['bbname']), $message); 101 } 102 103 $cache->update_awaitingactivation(); 104 105 $plugins->run_hooks("admin_user_awaiting_activation_activate_commit"); 106 107 // Log admin action 108 log_admin_action('activated', $num_activated); 109 110 flash_message($lang->success_users_activated, 'success'); 111 admin_redirect("index.php?module=user-awaiting_activation"); 112 } 113 } 114 115 if(!$mybb->input['action']) 116 { 117 $plugins->run_hooks("admin_user_awaiting_activation_start"); 118 119 $query = $db->simple_select("users", "COUNT(uid) AS users", "usergroup='5'"); 120 $total_rows = $db->fetch_field($query, "users"); 121 122 $per_page = 20; 123 124 $mybb->input['page'] = $mybb->get_input('page', MyBB::INPUT_INT); 125 126 if($mybb->input['page'] > 1) 127 { 128 $mybb->input['page'] = $mybb->input['page']; 129 $start = ($mybb->input['page']*$per_page)-$per_page; 130 $pages = ceil($total_rows / $per_page); 131 if($mybb->input['page'] > $pages) 132 { 133 $mybb->input['page'] = 1; 134 $start = 0; 135 } 136 } 137 else 138 { 139 $mybb->input['page'] = 1; 140 $start = 0; 141 } 142 143 $page->output_header($lang->manage_awaiting_activation); 144 145 $page->output_nav_tabs($sub_tabs, 'awaiting_activation'); 146 147 $form = new Form("index.php?module=user-awaiting_activation&action=activate", "post"); 148 149 $table = new Table; 150 $table->construct_header($form->generate_check_box("allbox", 1, '', array('class' => 'checkall'))); 151 $table->construct_header($lang->username, array('width' => '20%')); 152 $table->construct_header($lang->registered, array('width' => '15%', 'class' => 'align_center')); 153 $table->construct_header($lang->last_active, array('width' => '15%', 'class' => 'align_center')); 154 $table->construct_header($lang->email, array('width' => '15%', 'class' => 'align_center')); 155 $table->construct_header($lang->ipaddress, array('width' => '10%', 'class' => 'align_center')); 156 $table->construct_header($lang->type, array('class' => 'align_center')); 157 158 $query = $db->query(" 159 SELECT u.uid, u.username, u.regdate, u.regip, u.lastactive, u.email, u.coppauser, a.type AS reg_type, a.validated 160 FROM ".TABLE_PREFIX."users u 161 LEFT JOIN ".TABLE_PREFIX."awaitingactivation a ON (a.uid=u.uid) 162 WHERE u.usergroup='5' 163 ORDER BY u.regdate DESC 164 LIMIT {$start}, {$per_page} 165 "); 166 while($user = $db->fetch_array($query)) 167 { 168 $trow = alt_trow(); 169 $user['username'] = htmlspecialchars_uni($user['username']); 170 $user['profilelink'] = build_profile_link($user['username'], $user['uid'], "_blank"); 171 $user['email'] = htmlspecialchars_uni($user['email']); 172 $user['regdate'] = my_date('relative', $user['regdate']); 173 $user['lastactive'] = my_date('relative', $user['lastactive']); 174 175 if($user['reg_type'] == 'r' || $user['reg_type'] == 'b' && $user['validated'] == 0) 176 { 177 $user['type'] = $lang->email_activation; 178 } 179 elseif($user['coppauser'] == 1) 180 { 181 $user['type'] = $lang->admin_activation_coppa; 182 } 183 else 184 { 185 $user['type'] = $lang->administrator_activation; 186 } 187 188 if(empty($user['regip'])) 189 { 190 $user['regip'] = $lang->na; 191 } 192 else 193 { 194 $user['regip'] = my_inet_ntop($db->unescape_binary($user['regip'])); 195 } 196 197 $table->construct_cell($form->generate_check_box("user[{$user['uid']}]", $user['uid'], '')); 198 $table->construct_cell($user['profilelink']); 199 $table->construct_cell($user['regdate'], array("class" => "align_center")); 200 $table->construct_cell($user['lastactive'], array("class" => "align_center")); 201 $table->construct_cell($user['email'], array("class" => "align_center")); 202 $table->construct_cell($user['regip'], array("class" => "align_center")); 203 $table->construct_cell($user['type'], array("class" => "align_center")); 204 $table->construct_row(); 205 } 206 207 if($table->num_rows() == 0) 208 { 209 $table->construct_cell($lang->no_users_awaiting_activation, array('colspan' => 7)); 210 $table->construct_row(); 211 $table->output($lang->manage_awaiting_activation); 212 } 213 else 214 { 215 $table->output($lang->manage_awaiting_activation); 216 $buttons[] = $form->generate_submit_button($lang->activate_users, array('onclick' => "return confirm('{$lang->confirm_activate_users}');")); 217 $buttons[] = $form->generate_submit_button($lang->delete_users, array('name' => 'delete', 'onclick' => "return confirm('{$lang->confirm_delete_users}');")); 218 $form->output_submit_wrapper($buttons); 219 } 220 221 $form->end(); 222 223 echo "<br />".draw_admin_pagination($mybb->input['page'], $per_page, $total_rows, "index.php?module=user-awaiting_activation&page={page}"); 224 225 $page->output_footer(); 226 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
2005 - 2021 © MyBB.de | Alle Rechte vorbehalten! | Sponsor: netcup | Cross-referenced by PHPXref |