Vergleich admin/modules/user/banning.php - 1.8.9 - 1.8.37

  Keine Änderungen   Hinzugefügt   Modifiziert   Entfernt
Zeile 40Zeile 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 53Zeile 54
if($mybb->input['action'] == "prune")
{
// User clicked no

if($mybb->input['action'] == "prune")
{
// User clicked no

	if($mybb->input['no'])

	if($mybb->get_input('no'))

	{
admin_redirect("index.php?module=user-banning");
}

	{
admin_redirect("index.php?module=user-banning");
}

Zeile 61Zeile 62
	$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);


	if(!$ban['uid'])

	if(!$ban)

	{
flash_message($lang->error_invalid_ban, 'error');
admin_redirect("index.php?module=user-banning");

	{
flash_message($lang->error_invalid_ban, 'error');
admin_redirect("index.php?module=user-banning");

Zeile 69Zeile 70

$user = get_user($ban['uid']);



$user = get_user($ban['uid']);


	if(is_super_admin($user['uid']) && ($mybb->user['uid'] != $user['uid'] && !is_super_admin($mybb->user['uid'])))

	if(!$user || (is_super_admin($user['uid']) && ($mybb->user['uid'] != $user['uid'] && !is_super_admin($mybb->user['uid']))))

	{
flash_message($lang->cannot_perform_action_super_admin_general, 'error');
admin_redirect("index.php?module=user-banning");

	{
flash_message($lang->cannot_perform_action_super_admin_general, 'error');
admin_redirect("index.php?module=user-banning");

Zeile 99Zeile 100
		$cache->update_reportedcontent();

// Log admin action

		$cache->update_reportedcontent();

// Log admin action

		log_admin_action($user['uid'], htmlspecialchars_uni($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 113Zeile 114
if($mybb->input['action'] == "lift")
{
// User clicked no

if($mybb->input['action'] == "lift")
{
// User clicked no

	if($mybb->input['no'])

	if($mybb->get_input('no'))

	{
admin_redirect("index.php?module=user-banning");
}

	{
admin_redirect("index.php?module=user-banning");
}

Zeile 121Zeile 122
	$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);


	if(!$ban['uid'])

	if(!$ban)

	{
flash_message($lang->error_invalid_ban, 'error');
admin_redirect("index.php?module=user-banning");

	{
flash_message($lang->error_invalid_ban, 'error');
admin_redirect("index.php?module=user-banning");

Zeile 129Zeile 130

$user = get_user($ban['uid']);



$user = get_user($ban['uid']);


	if(is_super_admin($user['uid']) && ($mybb->user['uid'] != $user['uid'] && !is_super_admin($mybb->user['uid'])))

	if(!$user || (is_super_admin($user['uid']) && ($mybb->user['uid'] != $user['uid'] && !is_super_admin($mybb->user['uid']))))

	{
flash_message($lang->cannot_perform_action_super_admin_general, 'error');
admin_redirect("index.php?module=user-banning");

	{
flash_message($lang->cannot_perform_action_super_admin_general, 'error');
admin_redirect("index.php?module=user-banning");

Zeile 141Zeile 142
	{
$updated_group = array(
'usergroup' => $ban['oldgroup'],

	{
$updated_group = array(
'usergroup' => $ban['oldgroup'],

			'additionalgroups' => $ban['oldadditionalgroups'],

			'additionalgroups' => $db->escape_string($ban['oldadditionalgroups']),

			'displaygroup' => $ban['olddisplaygroup']
);
$db->delete_query("banned", "uid='{$ban['uid']}'");

			'displaygroup' => $ban['olddisplaygroup']
);
$db->delete_query("banned", "uid='{$ban['uid']}'");

Zeile 150Zeile 151

$db->update_query("users", $updated_group, "uid='{$ban['uid']}'");



$db->update_query("users", $updated_group, "uid='{$ban['uid']}'");


		$cache->update_banned();

 
		$cache->update_moderators();

// Log admin action

		$cache->update_moderators();

// Log admin action

		log_admin_action($ban['uid'], htmlspecialchars_uni($user['username']));

		log_admin_action($ban['uid'], $user['username']);


flash_message($lang->success_ban_lifted, 'success');
admin_redirect("index.php?module=user-banning");


flash_message($lang->success_ban_lifted, 'success');
admin_redirect("index.php?module=user-banning");

Zeile 170Zeile 170
	$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);


	$user = get_user($ban['uid']);

if(!$ban['uid'])

	if(!$ban)



	{
flash_message($lang->error_invalid_ban, 'error');
admin_redirect("index.php?module=user-banning");
}

	{
flash_message($lang->error_invalid_ban, 'error');
admin_redirect("index.php?module=user-banning");
}

 

$user = get_user($ban['uid']);


$plugins->run_hooks("admin_user_banning_edit");

if($mybb->request_method == "post")
{


$plugins->run_hooks("admin_user_banning_edit");

if($mybb->request_method == "post")
{

		if(!$ban['uid'])

		if(empty($ban['uid']))

		{
$errors[] = $lang->error_invalid_username;
}

		{
$errors[] = $lang->error_invalid_username;
}

Zeile 237Zeile 237
			$db->update_query('users', $update_array, "uid = {$ban['uid']}");

$plugins->run_hooks("admin_user_banning_edit_commit");

			$db->update_query('users', $update_array, "uid = {$ban['uid']}");

$plugins->run_hooks("admin_user_banning_edit_commit");


$cache->update_banned();

 

// Log admin action


// Log admin action

			log_admin_action($ban['uid'], htmlspecialchars_uni($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");
}

	}

	}

	$page->add_breadcrumb_item($lang->edit_ban);
$page->output_header($lang->edit_ban);

	$page->add_breadcrumb_item($lang->edit_ban);
$page->output_header($lang->edit_ban);





	$sub_tabs = array();
$sub_tabs['edit'] = array(
'title' => $lang->edit_ban,

	$sub_tabs = array();
$sub_tabs['edit'] = array(
'title' => $lang->edit_ban,

Zeile 264Zeile 262
	}
else
{

	}
else
{

		$mybb->input = array_merge($mybb->input, $ban);














		$mybb->input = array_merge($mybb->input, $ban);
}

if(!empty($ban['gid']))
{
$mybb->input['usergroup'] = $ban['gid'];
}
else if(!empty($user['usergroup']))
{
$mybb->input['usergroup'] = $user['usergroup'];
}
else
{
$mybb->input['usergroup'] = 0;

	}

$form_container = new FormContainer($lang->edit_ban);

	}

$form_container = new FormContainer($lang->edit_ban);

Zeile 314Zeile 325
		);

$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']))

		if(is_array($user) && isset($mybb->input['search']))

		{
$where_sql = 'uid=\''.(int)$user['uid'].'\'';
$where_sql_full = 'WHERE b.uid=\''.(int)$user['uid'].'\'';
}
else
{

		{
$where_sql = 'uid=\''.(int)$user['uid'].'\'';
$where_sql_full = 'WHERE b.uid=\''.(int)$user['uid'].'\'';
}
else
{

			if(!$user['uid'])

			if(!$user)

			{
$errors[] = $lang->error_invalid_username;
}

			{
$errors[] = $lang->error_invalid_username;
}

Zeile 331Zeile 342
			else if(is_super_admin($user['uid']) && !is_super_admin($mybb->user['uid']))
{
$errors[] = $lang->error_no_perm_to_ban;

			else if(is_super_admin($user['uid']) && !is_super_admin($mybb->user['uid']))
{
$errors[] = $lang->error_no_perm_to_ban;

			}
else

			}
else

			{
$query = $db->simple_select("banned", "uid", "uid='{$user['uid']}'");
if($db->fetch_field($query, "uid"))
{
$errors[] = $lang->error_already_banned;
}

			{
$query = $db->simple_select("banned", "uid", "uid='{$user['uid']}'");
if($db->fetch_field($query, "uid"))
{
$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'])
{
$errors[] = $lang->error_ban_self;


if($user['uid'] == $mybb->user['uid'])
{
$errors[] = $lang->error_ban_self;
}

			}

// No errors? Insert

			}

// No errors? Insert

Zeile 378Zeile 389
					'uid' => $user['uid'],
'gid' => $mybb->get_input('usergroup', MyBB::INPUT_INT),
'oldgroup' => $user['usergroup'],

					'uid' => $user['uid'],
'gid' => $mybb->get_input('usergroup', MyBB::INPUT_INT),
'oldgroup' => $user['usergroup'],

					'oldadditionalgroups' => $user['additionalgroups'],

					'oldadditionalgroups' => $db->escape_string($user['additionalgroups']),

					'olddisplaygroup' => $user['displaygroup'],
'admin' => (int)$mybb->user['uid'],
'dateline' => TIME_NOW,

					'olddisplaygroup' => $user['displaygroup'],
'admin' => (int)$mybb->user['uid'],
'dateline' => TIME_NOW,

Zeile 387Zeile 398
					'reason' => $db->escape_string($reason)
);
$db->insert_query('banned', $insert_array);

					'reason' => $db->escape_string($reason)
);
$db->insert_query('banned', $insert_array);





				// Move the user to the banned group
$update_array = array(
'usergroup' => $mybb->get_input('usergroup', MyBB::INPUT_INT),
'displaygroup' => 0,
'additionalgroups' => '',
);

				// Move the user to the banned group
$update_array = array(
'usergroup' => $mybb->get_input('usergroup', MyBB::INPUT_INT),
'displaygroup' => 0,
'additionalgroups' => '',
);





				$db->delete_query("forumsubscriptions", "uid = '{$user['uid']}'");
$db->delete_query("threadsubscriptions", "uid = '{$user['uid']}'");

$plugins->run_hooks("admin_user_banning_start_commit");

$db->update_query('users', $update_array, "uid = '{$user['uid']}'");

				$db->delete_query("forumsubscriptions", "uid = '{$user['uid']}'");
$db->delete_query("threadsubscriptions", "uid = '{$user['uid']}'");

$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

				log_admin_action($user['uid'], htmlspecialchars_uni($user['username']), $lifted);

				log_admin_action($user['uid'], $user['username'], $lifted);


flash_message($lang->success_banned, 'success');
admin_redirect("index.php?module=user-banning");


flash_message($lang->success_banned, 'success');
admin_redirect("index.php?module=user-banning");

			}
}
}

$page->output_header($lang->banned_accounts);


			}
}
}

$page->output_header($lang->banned_accounts);


	$page->output_nav_tabs($sub_tabs, "bans");

	$page->output_nav_tabs($sub_tabs, "bans");





	$query = $db->simple_select("banned", "COUNT(*) AS ban_count", $where_sql);
$ban_count = $db->fetch_field($query, "ban_count");

$per_page = 20;

	$query = $db->simple_select("banned", "COUNT(*) AS ban_count", $where_sql);
$ban_count = $db->fetch_field($query, "ban_count");

$per_page = 20;





$mybb->input['page'] = $mybb->get_input('page', MyBB::INPUT_INT);

	if($mybb->input['page'] > 0)
{

	if($mybb->input['page'] > 0)
{

		$current_page = $mybb->get_input('page', MyBB::INPUT_INT);

		$current_page = $mybb->input['page'];

		$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 441Zeile 451
	}

$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);
}

$mybb->input['username'] = $mybb->get_input('username');
$mybb->input['reason'] = $mybb->get_input('reason');
$mybb->input['bantime'] = $mybb->get_input('bantime');

if(isset($mybb->input['uid']) && empty($mybb->input['username']))
{
$user = get_user($mybb->input['uid']);
$mybb->input['username'] = $user['username'];
}

if(empty($mybb->input['usergroup']))
{
if(!empty($mybb->settings['purgespammerbangroup']))
{
$mybb->input['usergroup'] = $mybb->settings['purgespammerbangroup'];
}
else if(count($banned_groups))
{
$group = array_keys($banned_groups);
$mybb->input['usergroup'] = $group[0];
}
else
{
$mybb->input['usergroup'] = 0;
}
}

$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->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]\').on(\'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 521Zeile 634
	}
$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 @ {$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();

 

$page->output_footer();
}


$page->output_footer();
}