Zeile 40 | Zeile 40 |
---|
// Fetch banned groups $query = $db->simple_select("usergroups", "gid,title", "isbannedgroup=1", array('order_by' => 'title'));
|
// Fetch banned groups $query = $db->simple_select("usergroups", "gid,title", "isbannedgroup=1", array('order_by' => 'title'));
|
| $banned_groups = array();
|
while($group = $db->fetch_array($query)) { $banned_groups[$group['gid']] = $group['title'];
| while($group = $db->fetch_array($query)) { $banned_groups[$group['gid']] = $group['title'];
|
Zeile 93 | Zeile 94 |
---|
{ $moderation->delete_post($post['pid']); }
|
{ $moderation->delete_post($post['pid']); }
|
$cache->update_reportedcontent();
|
|
$plugins->run_hooks("admin_user_banning_prune_commit");
|
$plugins->run_hooks("admin_user_banning_prune_commit");
|
| $cache->update_reportedcontent();
|
// Log admin action
|
// Log admin action
|
log_admin_action($mybb->input['uid'], $user['username']);
| log_admin_action($user['uid'], $user['username']);
|
flash_message($lang->success_pruned, 'success'); admin_redirect("index.php?module=user-banning");
| flash_message($lang->success_pruned, 'success'); admin_redirect("index.php?module=user-banning");
|
Zeile 113 | Zeile 115 |
---|
{ // User clicked no if($mybb->input['no'])
|
{ // User clicked no if($mybb->input['no'])
|
{ admin_redirect("index.php?module=user-banning"); }
| { admin_redirect("index.php?module=user-banning"); }
|
$query = $db->simple_select("banned", "*", "uid='{$mybb->input['uid']}'"); $ban = $db->fetch_array($query);
| $query = $db->simple_select("banned", "*", "uid='{$mybb->input['uid']}'"); $ban = $db->fetch_array($query);
|
Zeile 143 | Zeile 145 |
---|
'additionalgroups' => $ban['oldadditionalgroups'], 'displaygroup' => $ban['olddisplaygroup'] );
|
'additionalgroups' => $ban['oldadditionalgroups'], 'displaygroup' => $ban['olddisplaygroup'] );
|
$db->update_query("users", $updated_group, "uid='{$ban['uid']}'");
| |
$db->delete_query("banned", "uid='{$ban['uid']}'");
|
$db->delete_query("banned", "uid='{$ban['uid']}'");
|
$cache->update_banned(); $cache->update_moderators();
| |
$plugins->run_hooks("admin_user_banning_lift_commit");
|
$plugins->run_hooks("admin_user_banning_lift_commit");
|
// Log admin action log_admin_action($mybb->input['uid'], $user['username']);
| $db->update_query("users", $updated_group, "uid='{$ban['uid']}'");
$cache->update_banned(); $cache->update_moderators();
|
|
|
flash_message($lang->success_ban_lifted, 'success'); admin_redirect("index.php?module=user-banning");
| // Log admin action log_admin_action($ban['uid'], $user['username']);
flash_message($lang->success_ban_lifted, 'success'); admin_redirect("index.php?module=user-banning");
|
} else {
| } else {
|
Zeile 200 | Zeile 203 |
---|
{ // Ban the user if($mybb->input['bantime'] == '---')
|
{ // Ban the user if($mybb->input['bantime'] == '---')
|
{
| {
|
$lifted = 0; } else
| $lifted = 0; } else
|
Zeile 214 | Zeile 217 |
---|
{ $group = array_keys($banned_groups); $mybb->input['usergroup'] = $group[0];
|
{ $group = array_keys($banned_groups); $mybb->input['usergroup'] = $group[0];
|
}
| }
|
$update_array = array(
|
$update_array = array(
|
'gid' => (int)$mybb->input['usergroup'],
| 'gid' => $mybb->get_input('usergroup', MyBB::INPUT_INT),
|
'dateline' => TIME_NOW, 'bantime' => $db->escape_string($mybb->input['bantime']), 'lifted' => $db->escape_string($lifted), 'reason' => $db->escape_string($reason)
|
'dateline' => TIME_NOW, 'bantime' => $db->escape_string($mybb->input['bantime']), 'lifted' => $db->escape_string($lifted), 'reason' => $db->escape_string($reason)
|
);
| );
|
$db->update_query('banned', $update_array, "uid='{$ban['uid']}'");
// Move the user to the banned group $update_array = array(
|
$db->update_query('banned', $update_array, "uid='{$ban['uid']}'");
// Move the user to the banned group $update_array = array(
|
'usergroup' => (int)$mybb->input['usergroup'],
| 'usergroup' => $mybb->get_input('usergroup', MyBB::INPUT_INT),
|
'displaygroup' => 0, 'additionalgroups' => '', ); $db->update_query('users', $update_array, "uid = {$ban['uid']}");
|
'displaygroup' => 0, 'additionalgroups' => '', ); $db->update_query('users', $update_array, "uid = {$ban['uid']}");
|
$cache->update_banned();
| |
$plugins->run_hooks("admin_user_banning_edit_commit");
|
$plugins->run_hooks("admin_user_banning_edit_commit");
|
| $cache->update_banned();
|
// Log admin action
|
// Log admin action
|
log_admin_action($mybb->input['uid'], $user['username']);
| log_admin_action($ban['uid'], $user['username']);
|
flash_message($lang->success_ban_updated, 'success'); admin_redirect("index.php?module=user-banning");
| flash_message($lang->success_ban_updated, 'success'); admin_redirect("index.php?module=user-banning");
|
Zeile 261 | Zeile 264 |
---|
$page->output_inline_error($errors); } else
|
$page->output_inline_error($errors); } else
|
{
| {
|
$mybb->input = array_merge($mybb->input, $ban); }
$form_container = new FormContainer($lang->edit_ban);
|
$mybb->input = array_merge($mybb->input, $ban); }
$form_container = new FormContainer($lang->edit_ban);
|
$form_container->output_row($lang->ban_username, "", $user['username']);
| $form_container->output_row($lang->ban_username, "", htmlspecialchars_uni($user['username']));
|
$form_container->output_row($lang->ban_reason, "", $form->generate_text_area('reason', $mybb->input['reason'], array('id' => 'reason', 'maxlength' => '255')), 'reason'); if(count($banned_groups) > 1)
|
$form_container->output_row($lang->ban_reason, "", $form->generate_text_area('reason', $mybb->input['reason'], array('id' => 'reason', 'maxlength' => '255')), 'reason'); if(count($banned_groups) > 1)
|
{
| {
|
$form_container->output_row($lang->ban_group, $lang->ban_group_desc, $form->generate_select_box('usergroup', $banned_groups, $mybb->input['usergroup'], array('id' => 'usergroup')), 'usergroup');
|
$form_container->output_row($lang->ban_group, $lang->ban_group_desc, $form->generate_select_box('usergroup', $banned_groups, $mybb->input['usergroup'], array('id' => 'usergroup')), 'usergroup');
|
}
| }
|
if($mybb->input['bantime'] == 'perm' || $mybb->input['bantime'] == '' || $mybb->input['lifted'] == 'perm' ||$mybb->input['lifted'] == '') { $mybb->input['bantime'] = '---'; $mybb->input['lifted'] = '---';
|
if($mybb->input['bantime'] == 'perm' || $mybb->input['bantime'] == '' || $mybb->input['lifted'] == 'perm' ||$mybb->input['lifted'] == '') { $mybb->input['bantime'] = '---'; $mybb->input['lifted'] = '---';
|
}
foreach($ban_times as $time => $period)
| }
foreach($ban_times as $time => $period)
|
{ if($time != '---') {
|
{ if($time != '---') {
|
$friendly_time = my_date("D, jS M Y @ g:ia", ban_date2timestamp($time));
| $friendly_time = my_date("D, jS M Y @ {$mybb->settings['timeformat']}", ban_date2timestamp($time));
|
$period = "{$period} ({$friendly_time})"; } $length_list[$time] = $period;
| $period = "{$period} ({$friendly_time})"; } $length_list[$time] = $period;
|
Zeile 295 | Zeile 298 |
---|
$buttons[] = $form->generate_submit_button($lang->update_ban); $form->output_submit_wrapper($buttons); $form->end();
|
$buttons[] = $form->generate_submit_button($lang->update_ban); $form->output_submit_wrapper($buttons); $form->end();
|
|
|
$page->output_footer(); }
| $page->output_footer(); }
|
Zeile 310 | Zeile 313 |
---|
$options = array( 'fields' => array('username', 'usergroup', 'additionalgroups', 'displaygroup') );
|
$options = array( 'fields' => array('username', 'usergroup', 'additionalgroups', 'displaygroup') );
|
|
|
$user = get_user_by_username($mybb->input['username'], $options);
|
$user = get_user_by_username($mybb->input['username'], $options);
|
|
|
// Are we searching a user?
|
// Are we searching a user?
|
if(isset($mybb->input['search']) && $mybb->get_input('search') != '')
| if(isset($mybb->input['search']))
|
{ $where_sql = 'uid=\''.(int)$user['uid'].'\''; $where_sql_full = 'WHERE b.uid=\''.(int)$user['uid'].'\'';
| { $where_sql = 'uid=\''.(int)$user['uid'].'\''; $where_sql_full = 'WHERE b.uid=\''.(int)$user['uid'].'\'';
|
Zeile 327 | Zeile 330 |
---|
} // Is the user we're trying to ban a super admin and we're not? else if(is_super_admin($user['uid']) && !is_super_admin($mybb->user['uid']))
|
} // Is the user we're trying to ban a super admin and we're not? else if(is_super_admin($user['uid']) && !is_super_admin($mybb->user['uid']))
|
{
| {
|
$errors[] = $lang->error_no_perm_to_ban; } else { $query = $db->simple_select("banned", "uid", "uid='{$user['uid']}'"); if($db->fetch_field($query, "uid"))
|
$errors[] = $lang->error_no_perm_to_ban; } else { $query = $db->simple_select("banned", "uid", "uid='{$user['uid']}'"); if($db->fetch_field($query, "uid"))
|
{ $errors[] = $lang->error_already_banned;
| { $errors[] = $lang->error_already_banned;
|
}
|
}
|
|
|
// Get PRIMARY usergroup information $usergroups = $cache->read("usergroups"); if(!empty($usergroups[$user['usergroup']]) && $usergroups[$user['usergroup']]['isbannedgroup'] == 1) { $errors[] = $lang->error_already_banned;
|
// Get PRIMARY usergroup information $usergroups = $cache->read("usergroups"); if(!empty($usergroups[$user['usergroup']]) && $usergroups[$user['usergroup']]['isbannedgroup'] == 1) { $errors[] = $lang->error_already_banned;
|
}
| }
|
}
if($user['uid'] == $mybb->user['uid'])
| }
if($user['uid'] == $mybb->user['uid'])
|
Zeile 374 | Zeile 377 |
---|
$insert_array = array( 'uid' => $user['uid'],
|
$insert_array = array( 'uid' => $user['uid'],
|
'gid' => (int)$mybb->input['usergroup'],
| 'gid' => $mybb->get_input('usergroup', MyBB::INPUT_INT),
|
'oldgroup' => $user['usergroup'], 'oldadditionalgroups' => $user['additionalgroups'], 'olddisplaygroup' => $user['displaygroup'],
| 'oldgroup' => $user['usergroup'], 'oldadditionalgroups' => $user['additionalgroups'], 'olddisplaygroup' => $user['displaygroup'],
|
Zeile 383 | Zeile 386 |
---|
'bantime' => $db->escape_string($mybb->input['bantime']), 'lifted' => $db->escape_string($lifted), 'reason' => $db->escape_string($reason)
|
'bantime' => $db->escape_string($mybb->input['bantime']), 'lifted' => $db->escape_string($lifted), 'reason' => $db->escape_string($reason)
|
);
| );
|
$db->insert_query('banned', $insert_array);
// Move the user to the banned group $update_array = array(
|
$db->insert_query('banned', $insert_array);
// Move the user to the banned group $update_array = array(
|
'usergroup' => (int)$mybb->input['usergroup'],
| 'usergroup' => $mybb->get_input('usergroup', MyBB::INPUT_INT),
|
'displaygroup' => 0, 'additionalgroups' => '', );
|
'displaygroup' => 0, 'additionalgroups' => '', );
|
$db->update_query('users', $update_array, "uid = '{$user['uid']}'");
|
|
$db->delete_query("forumsubscriptions", "uid = '{$user['uid']}'"); $db->delete_query("threadsubscriptions", "uid = '{$user['uid']}'");
|
$db->delete_query("forumsubscriptions", "uid = '{$user['uid']}'"); $db->delete_query("threadsubscriptions", "uid = '{$user['uid']}'");
|
$cache->update_banned();
$plugins->run_hooks("admin_user_banning_start_commit");
| $plugins->run_hooks("admin_user_banning_start_commit");
$db->update_query('users', $update_array, "uid = '{$user['uid']}'");
$cache->update_banned();
|
// Log admin action log_admin_action($user['uid'], $user['username'], $lifted);
flash_message($lang->success_banned, 'success'); admin_redirect("index.php?module=user-banning");
|
// Log admin action log_admin_action($user['uid'], $user['username'], $lifted);
flash_message($lang->success_banned, 'success'); admin_redirect("index.php?module=user-banning");
|
}
| }
|
} }
| } }
|
Zeile 421 | Zeile 425 |
---|
if($mybb->input['page'] > 0) {
|
if($mybb->input['page'] > 0) {
|
$current_page = $mybb->get_input('page', 1);
| $current_page = $mybb->get_input('page', MyBB::INPUT_INT);
|
$start = ($current_page-1)*$per_page; $pages = $ban_count / $per_page; $pages = ceil($pages);
| $start = ($current_page-1)*$per_page; $pages = $ban_count / $per_page; $pages = ceil($pages);
|
Zeile 429 | Zeile 433 |
---|
{ $start = 0; $current_page = 1;
|
{ $start = 0; $current_page = 1;
|
} }
| } }
|
else { $start = 0; $current_page = 1;
|
else { $start = 0; $current_page = 1;
|
}
$pagination = draw_admin_pagination($current_page, $per_page, $ban_count, "index.php?module=user-banning&page={page}");
| }
$pagination = draw_admin_pagination($current_page, $per_page, $ban_count, "index.php?module=user-banning&page={page}");
$form = new Form("index.php?module=user-banning", "post"); if($errors) { $page->output_inline_error($errors); }
if($mybb->input['uid'] && !$mybb->input['username']) { $user = get_user($mybb->input['uid']); $mybb->input['username'] = $user['username']; }
$form_container = new FormContainer($lang->ban_a_user); $form_container->output_row($lang->ban_username, $lang->autocomplete_enabled, $form->generate_text_box('username', $mybb->input['username'], array('id' => 'username')), 'username'); $form_container->output_row($lang->ban_reason, "", $form->generate_text_area('reason', $mybb->input['reason'], array('id' => 'reason', 'maxlength' => '255')), 'reason'); if(count($banned_groups) > 1) { $form_container->output_row($lang->ban_group, $lang->add_ban_group_desc, $form->generate_select_box('usergroup', $banned_groups, $mybb->input['usergroup'], array('id' => 'usergroup')), 'usergroup'); } foreach($ban_times as $time => $period) { if($time != "---") { $friendly_time = my_date("D, jS M Y @ {$mybb->settings['timeformat']}", ban_date2timestamp($time)); $period = "{$period} ({$friendly_time})"; } $length_list[$time] = $period; } $form_container->output_row($lang->ban_time, "", $form->generate_select_box('bantime', $length_list, $mybb->input['bantime'], array('id' => 'bantime')), 'bantime');
$form_container->end();
// Autocompletion for usernames echo ' <link rel="stylesheet" href="../jscripts/select2/select2.css"> <script type="text/javascript" src="../jscripts/select2/select2.min.js?ver=1804"></script> <script type="text/javascript"> <!-- $("#username").select2({ placeholder: "'.$lang->search_for_a_user.'", minimumInputLength: 2, multiple: false, ajax: { // instead of writing the function to execute the request we use Select2\'s convenient helper url: "../xmlhttp.php?action=get_users", dataType: \'json\', data: function (term, page) { return { query: term, // search term }; }, results: function (data, page) { // parse the results into the format expected by Select2. // since we are using custom formatting functions we do not need to alter remote JSON data return {results: data}; } }, initSelection: function(element, callback) { var query = $(element).val(); if (query !== "") { $.ajax("../xmlhttp.php?action=get_users&getone=1", { data: { query: query }, dataType: "json" }).done(function(data) { callback(data); }); } }, });
$(\'[for=username]\').click(function(){ $("#username").select2(\'open\'); return false; }); // --> </script>';
$buttons[] = $form->generate_submit_button($lang->ban_user); $buttons[] = $form->generate_submit_button($lang->search_for_a_user, array('name' => 'search')); $form->output_submit_wrapper($buttons); $form->end();
echo '<br />';
|
$table = new Table; $table->construct_header($lang->user);
| $table = new Table; $table->construct_header($lang->user);
|
Zeile 445 | Zeile 531 |
---|
$table->construct_header($lang->time_left, array("class" => "align_center", "width" => 150)); $table->construct_header($lang->controls, array("class" => "align_center", "colspan" => 2, "width" => 200)); $table->construct_header($lang->moderation, array("class" => "align_center", "colspan" => 1, "width" => 200));
|
$table->construct_header($lang->time_left, array("class" => "align_center", "width" => 150)); $table->construct_header($lang->controls, array("class" => "align_center", "colspan" => 2, "width" => 200)); $table->construct_header($lang->moderation, array("class" => "align_center", "colspan" => 1, "width" => 200));
|
|
|
// Fetch bans $query = $db->query(" SELECT b.*, a.username AS adminuser, u.username
| // Fetch bans $query = $db->query(" SELECT b.*, a.username AS adminuser, u.username
|
Zeile 460 | Zeile 546 |
---|
// Get the banned users while($ban = $db->fetch_array($query)) {
|
// Get the banned users while($ban = $db->fetch_array($query)) {
|
$profile_link = build_profile_link($ban['username'], $ban['uid'], "_blank");
| $profile_link = build_profile_link(htmlspecialchars_uni($ban['username']), $ban['uid'], "_blank");
|
$ban_date = my_date($mybb->settings['dateformat'], $ban['dateline']); if($ban['lifted'] == 'perm' || $ban['lifted'] == '' || $ban['bantime'] == 'perm' || $ban['bantime'] == '---') {
| $ban_date = my_date($mybb->settings['dateformat'], $ban['dateline']); if($ban['lifted'] == 'perm' || $ban['lifted'] == '' || $ban['bantime'] == 'perm' || $ban['bantime'] == '---') {
|
Zeile 468 | Zeile 554 |
---|
$time_remaining = $lifts_on = $lang->na; } else
|
$time_remaining = $lifts_on = $lang->na; } else
|
{
| {
|
$ban_period = $lang->for." ".$ban_times[$ban['bantime']];
$remaining = $ban['lifted']-TIME_NOW;
| $ban_period = $lang->for." ".$ban_times[$ban['bantime']];
$remaining = $ban['lifted']-TIME_NOW;
|
Zeile 485 | Zeile 571 |
---|
else if($remaining < 604800) { $time_remaining = "<span style=\"color: green;\">{$time_remaining}</span>";
|
else if($remaining < 604800) { $time_remaining = "<span style=\"color: green;\">{$time_remaining}</span>";
|
} else { $time_remaining = "{$time_remaining}"; }
| }
|
$lifts_on = my_date($mybb->settings['dateformat'], $ban['lifted']); }
| $lifts_on = my_date($mybb->settings['dateformat'], $ban['lifted']); }
|
Zeile 497 | Zeile 580 |
---|
{ if($ban['admin'] == 0) {
|
{ if($ban['admin'] == 0) {
|
$ban['adminuser'] = "MyBB System";
| $ban['adminuser'] = $lang->mybb_engine;
|
} else {
| } else {
|
Zeile 521 | Zeile 604 |
---|
} $table->output($lang->banned_accounts); echo $pagination;
|
} $table->output($lang->banned_accounts); echo $pagination;
|
$form = new Form("index.php?module=user-banning", "post"); if($errors) { $page->output_inline_error($errors); }
if($mybb->input['uid'] && !$mybb->input['username']) { $user = get_user($mybb->input['uid']); $mybb->input['username'] = $user['username']; }
$form_container = new FormContainer($lang->ban_a_user); $form_container->output_row($lang->ban_username, $lang->autocomplete_enabled, $form->generate_text_box('username', $mybb->input['username'], array('id' => 'username')), 'username'); $form_container->output_row($lang->ban_reason, "", $form->generate_text_area('reason', $mybb->input['reason'], array('id' => 'reason', 'maxlength' => '255')), 'reason'); if(count($banned_groups) > 1) { $form_container->output_row($lang->ban_group, $lang->add_ban_group_desc, $form->generate_select_box('usergroup', $banned_groups, $mybb->input['usergroup'], array('id' => 'usergroup')), 'usergroup'); } foreach($ban_times as $time => $period) { if($time != "---") { $friendly_time = my_date("D, jS M Y @ g:ia", ban_date2timestamp($time)); $period = "{$period} ({$friendly_time})"; } $length_list[$time] = $period; } $form_container->output_row($lang->ban_time, "", $form->generate_select_box('bantime', $length_list, $mybb->input['bantime'], array('id' => 'bantime')), 'bantime');
$form_container->end();
// Autocompletion for usernames echo ' <link rel="stylesheet" href="../jscripts/select2/select2.css"> <script type="text/javascript" src="../jscripts/select2/select2.min.js"></script> <script type="text/javascript"> <!-- $("#username").select2({ placeholder: "Search for a user", minimumInputLength: 3, maximumSelectionSize: 3, multiple: false, ajax: { // instead of writing the function to execute the request we use Select2\'s convenient helper url: "../xmlhttp.php?action=get_users", dataType: \'json\', data: function (term, page) { return { query: term, // search term }; }, results: function (data, page) { // parse the results into the format expected by Select2. // since we are using custom formatting functions we do not need to alter remote JSON data return {results: data}; } }, initSelection: function(element, callback) { var query = $(element).val(); if (query !== "") { $.ajax("../xmlhttp.php?action=get_users&getone=1", { data: { query: query }, dataType: "json" }).done(function(data) { callback(data); }); } }, }); // --> </script>';
$buttons[] = $form->generate_submit_button($lang->ban_user); $buttons[] = $form->generate_submit_button($lang->search_user, array('name' => 'search')); $form->output_submit_wrapper($buttons); $form->end();
| |
$page->output_footer(); }
| $page->output_footer(); }
|