Vergleich admin/modules/user/users.php - 1.8.7 - 1.8.26

  Keine Änderungen   Hinzugefügt   Modifiziert   Entfernt
Zeile 317Zeile 317
					unset($mybb->input['additionalgroups'][$key]);
}
}

					unset($mybb->input['additionalgroups'][$key]);
}
}

			$additionalgroups = implode(",", $mybb->input['additionalgroups']);

			$additionalgroups = implode(",", array_map('intval', $mybb->input['additionalgroups']));

		}
else
{

		}
else
{

Zeile 393Zeile 393
	}

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

	}

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

	$form_container->output_row($lang->username." <em>*</em>", "", $form->generate_text_box('username', $mybb->input['username'], array('id' => 'username')), 'username');

	$form_container->output_row($lang->username." <em>*</em>", "", $form->generate_text_box('username', htmlspecialchars_uni($mybb->get_input('username')), array('id' => 'username')), 'username');

	$form_container->output_row($lang->password." <em>*</em>", "", $form->generate_password_box('password', $mybb->input['password'], array('id' => 'password', 'autocomplete' => 'off')), 'password');
$form_container->output_row($lang->confirm_password." <em>*</em>", "", $form->generate_password_box('confirm_password', $mybb->input['confirm_password'], array('id' => 'confirm_new_password')), 'confirm_new_password');
$form_container->output_row($lang->email_address." <em>*</em>", "", $form->generate_text_box('email', $mybb->input['email'], array('id' => 'email')), 'email');

	$form_container->output_row($lang->password." <em>*</em>", "", $form->generate_password_box('password', $mybb->input['password'], array('id' => 'password', 'autocomplete' => 'off')), 'password');
$form_container->output_row($lang->confirm_password." <em>*</em>", "", $form->generate_password_box('confirm_password', $mybb->input['confirm_password'], array('id' => 'confirm_new_password')), 'confirm_new_password');
$form_container->output_row($lang->email_address." <em>*</em>", "", $form->generate_text_box('email', $mybb->input['email'], array('id' => 'email')), 'email');

Zeile 421Zeile 421
	$form->end();
$page->output_footer();
}

	$form->end();
$page->output_footer();
}





if($mybb->input['action'] == "edit")
{
$user = get_user($mybb->input['uid']);

if($mybb->input['action'] == "edit")
{
$user = get_user($mybb->input['uid']);

Zeile 437Zeile 437

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


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

 
		$plugins->run_hooks("admin_user_users_edit_start");

		if(is_super_admin($mybb->input['uid']) && $mybb->user['uid'] != $mybb->input['uid'] && !is_super_admin($mybb->user['uid']))
{
flash_message($lang->error_no_perms_super_admin, 'error');

		if(is_super_admin($mybb->input['uid']) && $mybb->user['uid'] != $mybb->input['uid'] && !is_super_admin($mybb->user['uid']))
{
flash_message($lang->error_no_perms_super_admin, 'error');

Zeile 451Zeile 452
				if($gid == $mybb->input['usergroup'])
{
unset($mybb->input['additionalgroups'][$key]);

				if($gid == $mybb->input['usergroup'])
{
unset($mybb->input['additionalgroups'][$key]);

				}

				}

			}

			}

			$additionalgroups = implode(",", $mybb->input['additionalgroups']);

			$additionalgroups = implode(",", array_map('intval', $mybb->input['additionalgroups']));

		}
else
{

		}
else
{

Zeile 511Zeile 512
			"profile_fields_editable" => true,
"website" => $mybb->input['website'],
"icq" => $mybb->input['icq'],

			"profile_fields_editable" => true,
"website" => $mybb->input['website'],
"icq" => $mybb->input['icq'],

			"aim" => $mybb->input['aim'],
"yahoo" => $mybb->input['yahoo'],

 
			"skype" => $mybb->input['skype'],
"google" => $mybb->input['google'],
"birthday" => array(

			"skype" => $mybb->input['skype'],
"google" => $mybb->input['google'],
"birthday" => array(

Zeile 627Zeile 626
			// Are we setting a new avatar from a URL?
else if($mybb->input['avatar_url'] && $mybb->input['avatar_url'] != $user['avatar'])
{

			// Are we setting a new avatar from a URL?
else if($mybb->input['avatar_url'] && $mybb->input['avatar_url'] != $user['avatar'])
{

				if(filter_var($mybb->input['avatar_url'], FILTER_VALIDATE_EMAIL) !== false)

				if(!$mybb->settings['allowremoteavatars'])

				{

				{

					// Gravatar
$email = md5(strtolower(trim($mybb->input['avatar_url'])));

$s = '';
if(!$mybb->settings['maxavatardims'])
{
$mybb->settings['maxavatardims'] = '100x100'; // Hard limit of 100 if there are no limits
}

// Because Gravatars are square, hijack the width
list($maxwidth, $maxheight) = explode("x", my_strtolower($mybb->settings['maxavatardims']));

$s = "?s={$maxwidth}";
$maxheight = (int)$maxwidth;

$extra_user_updates = array(
"avatar" => "https://www.gravatar.com/avatar/{$email}{$s}",
"avatardimensions" => "{$maxheight}|{$maxheight}",
"avatartype" => "gravatar"
);

					$errors = array($lang->error_remote_avatar_not_allowed);




















				}
else
{

				}
else
{

					$mybb->input['avatar_url'] = preg_replace("#script:#i", "", $mybb->input['avatar_url']);
$ext = get_extension($mybb->input['avatar_url']);















					if(filter_var($mybb->input['avatar_url'], FILTER_VALIDATE_EMAIL) !== false)
{
// Gravatar
$email = md5(strtolower(trim($mybb->input['avatar_url'])));

$s = '';
if(!$mybb->settings['maxavatardims'])
{
$mybb->settings['maxavatardims'] = '100x100'; // Hard limit of 100 if there are no limits
}

// Because Gravatars are square, hijack the width
list($maxwidth, $maxheight) = preg_split('/[|x]/', my_strtolower($mybb->settings['maxavatardims']));

$s = "?s={$maxwidth}";
$maxheight = (int)$maxwidth;





					// Copy the avatar to the local server (work around remote URL access disabled for getimagesize)
$file = fetch_remote_file($mybb->input['avatar_url']);
if(!$file)
{
$avatar_error = $lang->error_invalidavatarurl;
}
else
{
$tmp_name = "../".$mybb->settings['avataruploadpath']."/remote_".md5(random_str());
$fp = @fopen($tmp_name, "wb");
if(!$fp)




						$extra_user_updates = array(
"avatar" => "https://www.gravatar.com/avatar/{$email}{$s}",
"avatardimensions" => "{$maxheight}|{$maxheight}",
"avatartype" => "gravatar"
);
}
else
{
$mybb->input['avatar_url'] = preg_replace("#script:#i", "", $mybb->input['avatar_url']);
$ext = get_extension($mybb->input['avatar_url']);

// Copy the avatar to the local server (work around remote URL access disabled for getimagesize)
$file = fetch_remote_file($mybb->input['avatar_url']);
if(!$file)

						{
$avatar_error = $lang->error_invalidavatarurl;
}
else

						{
$avatar_error = $lang->error_invalidavatarurl;
}
else

						{
fwrite($fp, $file);
fclose($fp);
list($width, $height, $type) = @getimagesize($tmp_name);
@unlink($tmp_name);
echo $type;
if(!$type)
{
$avatar_error = $lang->error_invalidavatarurl;























						{
$tmp_name = "../".$mybb->settings['avataruploadpath']."/remote_".md5(random_str());
$fp = @fopen($tmp_name, "wb");
if(!$fp)
{
$avatar_error = $lang->error_invalidavatarurl;
}
else
{
fwrite($fp, $file);
fclose($fp);
list($width, $height, $type) = @getimagesize($tmp_name);
@unlink($tmp_name);
echo $type;
if(!$type)
{
$avatar_error = $lang->error_invalidavatarurl;
}
}
}

if(empty($avatar_error))
{
if($width && $height && $mybb->settings['maxavatardims'] != "")
{
list($maxwidth, $maxheight) = preg_split('/[|x]/', my_strtolower($mybb->settings['maxavatardims']));
if(($maxwidth && $width > $maxwidth) || ($maxheight && $height > $maxheight))
{
$lang->error_avatartoobig = $lang->sprintf($lang->error_avatartoobig, $maxwidth, $maxheight);
$avatar_error = $lang->error_avatartoobig;
}

							}
}

							}
}

					}

 




					if(empty($avatar_error))
{
if($width && $height && $mybb->settings['maxavatardims'] != "")

						if(empty($avatar_error))



						{

						{

							list($maxwidth, $maxheight) = explode("x", my_strtolower($mybb->settings['maxavatardims']));
if(($maxwidth && $width > $maxwidth) || ($maxheight && $height > $maxheight))

							if($width > 0 && $height > 0)


							{

							{

								$lang->error_avatartoobig = $lang->sprintf($lang->error_avatartoobig, $maxwidth, $maxheight);
$avatar_error = $lang->error_avatartoobig;

								$avatar_dimensions = (int)$width."|".(int)$height;


							}

							}

 
							$extra_user_updates = array(
"avatar" => $db->escape_string($mybb->input['avatar_url'].'?dateline='.TIME_NOW),
"avatardimensions" => $avatar_dimensions,
"avatartype" => "remote"
);
remove_avatars($user['uid']);

						}

						}

					}

if(empty($avatar_error))
{
if($width > 0 && $height > 0)

						else





						{

						{

							$avatar_dimensions = (int)$width."|".(int)$height;

							$errors = array($avatar_error);

						}

						}

						$extra_user_updates = array(
"avatar" => $db->escape_string($mybb->input['avatar_url'].'?dateline='.TIME_NOW),
"avatardimensions" => $avatar_dimensions,
"avatartype" => "remote"
);
remove_avatars($user['uid']);
}
else
{
$errors = array($avatar_error);

 
					}
}
}

					}
}
}

Zeile 781Zeile 787
							elseif($suspend_length && $suspend_length != "-1")
{
// Temporary ban on action

							elseif($suspend_length && $suspend_length != "-1")
{
// Temporary ban on action

								$extra_user_updates[$option['update_length']] = TIME_NOW + $suspend_length;
}
}

								$extra_user_updates[$option['update_length']] = TIME_NOW + $suspend_length;
}
}

						elseif(!$user[$option['update_field']])
{
// New suspension for this user... bad user!

						elseif(!$user[$option['update_field']])
{
// New suspension for this user... bad user!

Zeile 791Zeile 797
							if($suspend_length == "-1")
{
$extra_user_updates[$option['update_length']] = 0;

							if($suspend_length == "-1")
{
$extra_user_updates[$option['update_length']] = 0;

							}

							}

							else
{
$extra_user_updates[$option['update_length']] = TIME_NOW + $suspend_length;
}
}
}

							else
{
$extra_user_updates[$option['update_length']] = TIME_NOW + $suspend_length;
}
}
}

				}
}


				}
}


			if($extra_user_updates['moderateposts'] && $extra_user_updates['suspendposting'])
{
$errors[] = $lang->suspendmoderate_error;

			if($extra_user_updates['moderateposts'] && $extra_user_updates['suspendposting'])
{
$errors[] = $lang->suspendmoderate_error;

			}


			}


			if(isset($away_in_past))
{
$errors[] = $lang->error_acp_return_date_past;

			if(isset($away_in_past))
{
$errors[] = $lang->error_acp_return_date_past;

Zeile 826Zeile 832
						'includesig' => ($mybb->input['update_posts'] == 'enable' ? 1 : 0)
);
$db->update_query("posts", $update_signature, "uid='{$user['uid']}'");

						'includesig' => ($mybb->input['update_posts'] == 'enable' ? 1 : 0)
);
$db->update_query("posts", $update_signature, "uid='{$user['uid']}'");

				}

				}


$plugins->run_hooks("admin_user_users_edit_commit");



$plugins->run_hooks("admin_user_users_edit_commit");


Zeile 840Zeile 846

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


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

			}


			}
$plugins->run_hooks("admin_user_users_edit_end");

		}
}

		}
}





	if(!$errors)
{
$user['usertitle'] = htmlspecialchars_decode($user['usertitle']);
$mybb->input = array_merge($mybb->input, $user);

	if(!$errors)
{
$user['usertitle'] = htmlspecialchars_decode($user['usertitle']);
$mybb->input = array_merge($mybb->input, $user);





		$options = array(
'bday1', 'bday2', 'bday3',
'new_password', 'confirm_new_password',
'action_time', 'action_period',
'modpost_period', 'moderateposting', 'modpost_time', 'suspost_period', 'suspost_time'
);

		$options = array(
'bday1', 'bday2', 'bday3',
'new_password', 'confirm_new_password',
'action_time', 'action_period',
'modpost_period', 'moderateposting', 'modpost_time', 'suspost_period', 'suspost_time'
);





		foreach($options as $option)
{
if(!isset($input_user[$option]))
{
$mybb->input[$option] = '';
}

		foreach($options as $option)
{
if(!isset($input_user[$option]))
{
$mybb->input[$option] = '';
}

		}

		}


// We need to fetch this users profile field values
$query = $db->simple_select("userfields", "*", "ufid='{$user['uid']}'");


// We need to fetch this users profile field values
$query = $db->simple_select("userfields", "*", "ufid='{$user['uid']}'");

Zeile 874Zeile 881
		$mybb->input['bday'][0] = $mybb->input['bday1'];
$mybb->input['bday'][1] = $mybb->input['bday2'];
$mybb->input['bday'][2] = $mybb->get_input('bday3', MyBB::INPUT_INT);

		$mybb->input['bday'][0] = $mybb->input['bday1'];
$mybb->input['bday'][1] = $mybb->input['bday2'];
$mybb->input['bday'][2] = $mybb->get_input('bday3', MyBB::INPUT_INT);

	}
else
{

	}
else
{

		$mybb->input['bday'] = array(0, 0, '');

if($user['birthday'])
{
$mybb->input['bday'] = explode('-', $user['birthday']);

		$mybb->input['bday'] = array(0, 0, '');

if($user['birthday'])
{
$mybb->input['bday'] = explode('-', $user['birthday']);

		}
}

		}
}


if($mybb->input['away_day'] || $mybb->input['away_month'] || $mybb->input['away_year'])
{


if($mybb->input['away_day'] || $mybb->input['away_month'] || $mybb->input['away_year'])
{

Zeile 898Zeile 905
		if($user['returndate'])
{
list($mybb->input['away_day'], $mybb->input['away_month'], $mybb->input['away_year']) = explode('-', $user['returndate']);

		if($user['returndate'])
{
list($mybb->input['away_day'], $mybb->input['away_month'], $mybb->input['away_year']) = explode('-', $user['returndate']);

		}

		}

	}

// Fetch custom profile fields

	}

// Fetch custom profile fields

Zeile 921Zeile 928

$page->extra_header .= <<<EOF



$page->extra_header .= <<<EOF


	<link rel="stylesheet" href="../jscripts/sceditor/editor_themes/mybb.css" type="text/css" media="all" />
<script type="text/javascript" src="../jscripts/sceditor/jquery.sceditor.bbcode.min.js?ver=1805"></script>
<script type="text/javascript" src="../jscripts/bbcodes_sceditor.js?ver=1804"></script>
<script type="text/javascript" src="../jscripts/sceditor/editor_plugins/undo.js?ver=1805"></script>

	<link rel="stylesheet" href="../jscripts/sceditor/themes/mybb.css" type="text/css" media="all" />
<script type="text/javascript" src="../jscripts/sceditor/jquery.sceditor.bbcode.min.js?ver=1822"></script>
<script type="text/javascript" src="../jscripts/bbcodes_sceditor.js?ver=1824"></script>
<script type="text/javascript" src="../jscripts/sceditor/plugins/undo.js?ver=1805"></script>

EOF;
$page->output_header($lang->edit_user);


EOF;
$page->output_header($lang->edit_user);


Zeile 946Zeile 953
	// Is this user a COPPA user? We show a warning & activate link
if($user['coppauser'])
{

	// Is this user a COPPA user? We show a warning & activate link
if($user['coppauser'])
{

		echo $lang->sprintf($lang->warning_coppa_user, $user['uid']);

		echo $lang->sprintf($lang->warning_coppa_user, $user['uid'], $mybb->post_code);

	}

$tabs = array(

	}

$tabs = array(

Zeile 969Zeile 976
	$table->construct_header($lang->general_account_stats, array('colspan' => '2', 'class' => 'align_center'));

// Avatar

	$table->construct_header($lang->general_account_stats, array('colspan' => '2', 'class' => 'align_center'));

// Avatar

	$avatar_dimensions = explode("|", $user['avatardimensions']);
if($user['avatar'])
{
if($user['avatardimensions'])
{
require_once MYBB_ROOT."inc/functions_image.php";
list($width, $height) = explode("|", $user['avatardimensions']);
$scaled_dimensions = scale_image($width, $height, 120, 120);
}
else
{
$scaled_dimensions = array(
"width" => 120,
"height" => 120
);
}
if(my_substr($user['avatar'], 0, 7) !== 'http://' && my_substr($user['avatar'], 0, 8) !== 'https://')
{
$user['avatar'] = "../{$user['avatar']}\n";
}
}
else
{
$user['avatar'] = "../".$mybb->settings['useravatar'];

	$avatar_dimensions = preg_split('/[|x]/', $user['avatardimensions']);
if($user['avatardimensions'])
{
require_once MYBB_ROOT."inc/functions_image.php";
list($width, $height) = preg_split('/[|x]/', $user['avatardimensions']);
$scaled_dimensions = scale_image($width, $height, 120, 120);
}
else
{
















		$scaled_dimensions = array(
"width" => 120,
"height" => 120
);

		$scaled_dimensions = array(
"width" => 120,
"height" => 120
);

 
	}
if($user['avatar'] && (my_strpos($user['avatar'], '://') === false || $mybb->settings['allowremoteavatars']))
{
if(!my_validate_url($user['avatar']))
{
$avatar = format_avatar($user['avatar'], $user['avatardimensions']);
$user['avatar'] = $avatar['image'];
}
}
else
{
if(my_validate_url($mybb->settings['useravatar']))
{
$user['avatar'] = str_replace('{theme}', 'images', $mybb->settings['useravatar']);
}
else
{
$user['avatar'] = "../".str_replace('{theme}', 'images', $mybb->settings['useravatar']);
}

	}
$avatar_top = ceil((126-$scaled_dimensions['height'])/2);

	}
$avatar_top = ceil((126-$scaled_dimensions['height'])/2);

	if($user['lastactive'])


	$last_seen = max(array($user['lastactive'], $user['lastvisit']));
if(!empty($last_seen))

	{

	{

		$last_active = my_date('relative', $user['lastactive']);

		$last_active = my_date('relative', $last_seen);

	}
else
{

	}
else
{

Zeile 1010Zeile 1022
	$reg_date = my_date('relative', $user['regdate']);
if($user['dst'] == 1)
{

	$reg_date = my_date('relative', $user['regdate']);
if($user['dst'] == 1)
{

		$timezone = $user['timezone']+1;

		$timezone = (float)$user['timezone']+1;

	}
else
{

	}
else
{

		$timezone = $user['timezone'];

		$timezone = (float)$user['timezone'];

	}
$local_date = gmdate($mybb->settings['dateformat'], TIME_NOW + ($timezone * 3600));
$local_time = gmdate($mybb->settings['timeformat'], TIME_NOW + ($timezone * 3600));

	}
$local_date = gmdate($mybb->settings['dateformat'], TIME_NOW + ($timezone * 3600));
$local_time = gmdate($mybb->settings['timeformat'], TIME_NOW + ($timezone * 3600));

Zeile 1098Zeile 1110
	$table->construct_cell("<strong>{$lang->last_known_ip}:</strong> ".my_inet_ntop($db->unescape_binary($user['lastip'])));
$table->construct_row();


	$table->construct_cell("<strong>{$lang->last_known_ip}:</strong> ".my_inet_ntop($db->unescape_binary($user['lastip'])));
$table->construct_row();


	$table->output("{$lang->user_overview}: {$user['username']}");



	$username = htmlspecialchars_uni($user['username']);
$table->output("{$lang->user_overview}: {$username}");
$plugins->run_hooks("admin_user_users_edit_overview");

	echo "</div>\n";

//

	echo "</div>\n";

//

Zeile 1106Zeile 1120
	//
echo "<div id=\"tab_profile\">\n";


	//
echo "<div id=\"tab_profile\">\n";


	$form_container = new FormContainer($lang->required_profile_info.": {$user['username']}");

	$form_container = new FormContainer($lang->required_profile_info.": ".htmlspecialchars_uni($user['username']));

	$form_container->output_row($lang->username." <em>*</em>", "", $form->generate_text_box('username', $mybb->input['username'], array('id' => 'username')), 'username');
$form_container->output_row($lang->new_password, $lang->new_password_desc, $form->generate_password_box('new_password', $mybb->input['new_password'], array('id' => 'new_password', 'autocomplete' => 'off')), 'new_password');
$form_container->output_row($lang->confirm_new_password, $lang->new_password_desc, $form->generate_password_box('confirm_new_password', $mybb->input['confirm_new_password'], array('id' => 'confirm_new_password')), 'confirm_new_password');

	$form_container->output_row($lang->username." <em>*</em>", "", $form->generate_text_box('username', $mybb->input['username'], array('id' => 'username')), 'username');
$form_container->output_row($lang->new_password, $lang->new_password_desc, $form->generate_password_box('new_password', $mybb->input['new_password'], array('id' => 'new_password', 'autocomplete' => 'off')), 'new_password');
$form_container->output_row($lang->confirm_new_password, $lang->new_password_desc, $form->generate_password_box('confirm_new_password', $mybb->input['confirm_new_password'], array('id' => 'confirm_new_password')), 'confirm_new_password');

Zeile 1141Zeile 1155

$form_container->end();



$form_container->end();


	$form_container = new FormContainer($lang->optional_profile_info.": {$user['username']}");

	$form_container = new FormContainer($lang->optional_profile_info.': '.htmlspecialchars_uni($user['username']));

	$form_container->output_row($lang->custom_user_title, $lang->custom_user_title_desc, $form->generate_text_box('usertitle', $mybb->input['usertitle'], array('id' => 'usertitle')), 'usertitle');
$form_container->output_row($lang->website, "", $form->generate_text_box('website', $mybb->input['website'], array('id' => 'website')), 'website');
$form_container->output_row($lang->icq_number, "", $form->generate_numeric_field('icq', $mybb->input['icq'], array('id' => 'icq', 'min' => 0)), 'icq');

	$form_container->output_row($lang->custom_user_title, $lang->custom_user_title_desc, $form->generate_text_box('usertitle', $mybb->input['usertitle'], array('id' => 'usertitle')), 'usertitle');
$form_container->output_row($lang->website, "", $form->generate_text_box('website', $mybb->input['website'], array('id' => 'website')), 'website');
$form_container->output_row($lang->icq_number, "", $form->generate_numeric_field('icq', $mybb->input['icq'], array('id' => 'icq', 'min' => 0)), 'icq');

	$form_container->output_row($lang->aim_handle, "", $form->generate_text_box('aim', $mybb->input['aim'], array('id' => 'aim')), 'aim');
$form_container->output_row($lang->yahoo_messanger_handle, "", $form->generate_text_box('yahoo', $mybb->input['yahoo'], array('id' => 'yahoo')), 'yahoo');

 
	$form_container->output_row($lang->skype_handle, "", $form->generate_text_box('skype', $mybb->input['skype'], array('id' => 'skype')), 'skype');
$form_container->output_row($lang->google_handle, "", $form->generate_text_box('google', $mybb->input['google'], array('id' => 'google')), 'google');

// Birthday
$birthday_days = array(0 => '');
for($i = 1; $i <= 31; $i++)

	$form_container->output_row($lang->skype_handle, "", $form->generate_text_box('skype', $mybb->input['skype'], array('id' => 'skype')), 'skype');
$form_container->output_row($lang->google_handle, "", $form->generate_text_box('google', $mybb->input['google'], array('id' => 'google')), 'google');

// Birthday
$birthday_days = array(0 => '');
for($i = 1; $i <= 31; $i++)

	{

	{

		$birthday_days[$i] = $i;
}


		$birthday_days[$i] = $i;
}


Zeile 1187Zeile 1199

if($mybb->settings['allowaway'] != 0)
{


if($mybb->settings['allowaway'] != 0)
{

		$form_container = new FormContainer($lang->away_information.": {$user['username']}");

		$form_container = new FormContainer($lang->away_information.': '.htmlspecialchars_uni($user['username']));

		$awaycheck = array(false, true);
if($mybb->input['away'] == 1)
{

		$awaycheck = array(false, true);
if($mybb->input['away'] == 1)
{

Zeile 1195Zeile 1207
		}
$form_container->output_row($lang->away_status, $lang->away_status_desc, $form->generate_radio_button('away', 1, $lang->im_away, array('id' => 'away', "checked" => $awaycheck[0]))." ".$form->generate_radio_button('away', 0, $lang->im_here, array('id' => 'away2', "checked" => $awaycheck[1])), 'away');
$form_container->output_row($lang->away_reason, $lang->away_reason_desc, $form->generate_text_box('awayreason', $mybb->input['awayreason'], array('id' => 'awayreason')), 'awayreason');

		}
$form_container->output_row($lang->away_status, $lang->away_status_desc, $form->generate_radio_button('away', 1, $lang->im_away, array('id' => 'away', "checked" => $awaycheck[0]))." ".$form->generate_radio_button('away', 0, $lang->im_here, array('id' => 'away2', "checked" => $awaycheck[1])), 'away');
$form_container->output_row($lang->away_reason, $lang->away_reason_desc, $form->generate_text_box('awayreason', $mybb->input['awayreason'], array('id' => 'awayreason')), 'awayreason');





		//Return date (we can use the arrays from birthday)
$return_row = $form->generate_select_box('away_day', $birthday_days, $mybb->input['away_day'], array('id' => 'away_day'));
$return_row .= ' '.$form->generate_select_box('away_month', $birthday_months, $mybb->input['away_month'], array('id' => 'away_month'));
$return_row .= ' '.$form->generate_numeric_field('away_year', $mybb->input['away_year'], array('id' => 'away_year', 'style' => 'width: 4em;', 'min' => 0));

		//Return date (we can use the arrays from birthday)
$return_row = $form->generate_select_box('away_day', $birthday_days, $mybb->input['away_day'], array('id' => 'away_day'));
$return_row .= ' '.$form->generate_select_box('away_month', $birthday_months, $mybb->input['away_month'], array('id' => 'away_month'));
$return_row .= ' '.$form->generate_numeric_field('away_year', $mybb->input['away_year'], array('id' => 'away_year', 'style' => 'width: 4em;', 'min' => 0));





		$form_container->output_row($lang->return_date, $lang->return_date_desc, $return_row, 'away_date');

		$form_container->output_row($lang->return_date, $lang->return_date_desc, $return_row, 'away_date');





		$form_container->end();
}

		$form_container->end();
}





$plugins->run_hooks("admin_user_users_edit_profile");

	echo "</div>\n";

	echo "</div>\n";


//


//

	// ACCOUNT SETTINGS

	// ACCOUNT SETTINGS

	//

// Plugin hook note - we should add hooks in above each output_row for the below so users can add their own options to each group :>


	//




	echo "<div id=\"tab_settings\">\n";

	echo "<div id=\"tab_settings\">\n";

	$form_container = new FormContainer($lang->account_settings.": {$user['username']}");

	$form_container = new FormContainer($lang->account_settings.': '.htmlspecialchars_uni($user['username']));

	$login_options = array(
$form->generate_check_box("invisible", 1, $lang->hide_from_whos_online, array("checked" => $mybb->input['invisible'])),
);
$form_container->output_row($lang->login_cookies_privacy, "", "<div class=\"user_settings_bit\">".implode("</div><div class=\"user_settings_bit\">", $login_options)."</div>");

if($mybb->input['pmnotice'] > 1)

	$login_options = array(
$form->generate_check_box("invisible", 1, $lang->hide_from_whos_online, array("checked" => $mybb->input['invisible'])),
);
$form_container->output_row($lang->login_cookies_privacy, "", "<div class=\"user_settings_bit\">".implode("</div><div class=\"user_settings_bit\">", $login_options)."</div>");

if($mybb->input['pmnotice'] > 1)

	{

	{

		$mybb->input['pmnotice'] = 1;
}


		$mybb->input['pmnotice'] = 1;
}


Zeile 1235Zeile 1246
		$form->generate_check_box("pmnotify", 1, $lang->email_notify_new_pms, array("checked" => $mybb->input['pmnotify'])),
$form->generate_check_box("buddyrequestspm", 1, $lang->buddy_requests_pm, array("checked" => $mybb->input['buddyrequestspm'])),
$form->generate_check_box("buddyrequestsauto", 1, $lang->buddy_requests_auto, array("checked" => $mybb->input['buddyrequestsauto'])),

		$form->generate_check_box("pmnotify", 1, $lang->email_notify_new_pms, array("checked" => $mybb->input['pmnotify'])),
$form->generate_check_box("buddyrequestspm", 1, $lang->buddy_requests_pm, array("checked" => $mybb->input['buddyrequestspm'])),
$form->generate_check_box("buddyrequestsauto", 1, $lang->buddy_requests_auto, array("checked" => $mybb->input['buddyrequestsauto'])),

		"<label for=\"subscriptionmethod\">{$lang->default_thread_subscription_mode}:</label><br />".$form->generate_select_box("subscriptionmethod", array($lang->do_not_subscribe, $lang->no_email_notification, $lang->instant_email_notification), $mybb->input['subscriptionmethod'], array('id' => 'subscriptionmethod'))

		"<label for=\"subscriptionmethod\">{$lang->default_thread_subscription_mode}:</label><br />".$form->generate_select_box("subscriptionmethod", array($lang->do_not_subscribe, $lang->no_notification, $lang->instant_email_notification, $lang->instant_pm_notification), $mybb->input['subscriptionmethod'], array('id' => 'subscriptionmethod'))

	);

	);

 

// Allow plugins to add messaging options
$messaging_options = $plugins->run_hooks('admin_user_users_edit_messaging_options', $messaging_options);

// Output messaging options

	$form_container->output_row($lang->messaging_and_notification, "", "<div class=\"user_settings_bit\">".implode("</div><div class=\"user_settings_bit\">", $messaging_options)."</div>");

$date_format_options = array($lang->use_default);
foreach($date_formats as $key => $format)
{
$date_format_options[$key] = my_date($format, TIME_NOW, "", 0);

	$form_container->output_row($lang->messaging_and_notification, "", "<div class=\"user_settings_bit\">".implode("</div><div class=\"user_settings_bit\">", $messaging_options)."</div>");

$date_format_options = array($lang->use_default);
foreach($date_formats as $key => $format)
{
$date_format_options[$key] = my_date($format, TIME_NOW, "", 0);

	}


	}


	$time_format_options = array($lang->use_default);
foreach($time_formats as $key => $format)
{

	$time_format_options = array($lang->use_default);
foreach($time_formats as $key => $format)
{

Zeile 1257Zeile 1273
		"<label for=\"timezone\">{$lang->time_zone}:</label><br />".build_timezone_select("timezone", $mybb->input['timezone']),
"<label for=\"dstcorrection\">{$lang->daylight_savings_time_correction}:</label><br />".$form->generate_select_box("dstcorrection", array(2 => $lang->automatically_detect, 1 => $lang->always_use_dst_correction, 0 => $lang->never_use_dst_correction), $mybb->input['dstcorrection'], array('id' => 'dstcorrection'))
);

		"<label for=\"timezone\">{$lang->time_zone}:</label><br />".build_timezone_select("timezone", $mybb->input['timezone']),
"<label for=\"dstcorrection\">{$lang->daylight_savings_time_correction}:</label><br />".$form->generate_select_box("dstcorrection", array(2 => $lang->automatically_detect, 1 => $lang->always_use_dst_correction, 0 => $lang->never_use_dst_correction), $mybb->input['dstcorrection'], array('id' => 'dstcorrection'))
);

	$form_container->output_row($lang->date_and_time_options, "", "<div class=\"user_settings_bit\">".implode("</div><div class=\"user_settings_bit\">", $date_options)."</div>");







// Allow plugins to add date options
$date_options = $plugins->run_hooks('admin_user_users_edit_date_options', $date_options);

// Output date options
$form_container->output_row($lang->date_and_time_options, "", "<div class=\"user_settings_bit\">".implode("</div><div class=\"user_settings_bit\">", $date_options)."</div>");



$tpp_options = array($lang->use_default);



$tpp_options = array($lang->use_default);

Zeile 1270Zeile 1291
			{
if($tpp <= 0) continue;
$tpp_options[$tpp] = $tpp;

			{
if($tpp <= 0) continue;
$tpp_options[$tpp] = $tpp;

			}
}
}

			}
}
}


$thread_age_options = array(
0 => $lang->use_default,


$thread_age_options = array(
0 => $lang->use_default,

Zeile 1285Zeile 1306
		100 => $lang->show_threads_last_100_days,
365 => $lang->show_threads_last_year,
9999 => $lang->show_all_threads

		100 => $lang->show_threads_last_100_days,
365 => $lang->show_threads_last_year,
9999 => $lang->show_all_threads

	);


	);


	$forum_options = array(
"<label for=\"tpp\">{$lang->threads_per_page}:</label><br />".$form->generate_select_box("tpp", $tpp_options, $mybb->input['tpp'], array('id' => 'tpp')),
"<label for=\"daysprune\">{$lang->default_thread_age_view}:</label><br />".$form->generate_select_box("daysprune", $thread_age_options, $mybb->input['daysprune'], array('id' => 'daysprune'))
);

	$forum_options = array(
"<label for=\"tpp\">{$lang->threads_per_page}:</label><br />".$form->generate_select_box("tpp", $tpp_options, $mybb->input['tpp'], array('id' => 'tpp')),
"<label for=\"daysprune\">{$lang->default_thread_age_view}:</label><br />".$form->generate_select_box("daysprune", $thread_age_options, $mybb->input['daysprune'], array('id' => 'daysprune'))
);

 

// Allow plugins to add forum options
$forum_options = $plugins->run_hooks('admin_user_users_edit_forum_options', $forum_options);

// Output forum options

	$form_container->output_row($lang->forum_display_options, "", "<div class=\"user_settings_bit\">".implode("</div><div class=\"user_settings_bit\">", $forum_options)."</div>");

$ppp_options = array($lang->use_default);

	$form_container->output_row($lang->forum_display_options, "", "<div class=\"user_settings_bit\">".implode("</div><div class=\"user_settings_bit\">", $forum_options)."</div>");

$ppp_options = array($lang->use_default);

Zeile 1317Zeile 1343
		"<label for=\"ppp\">{$lang->posts_per_page}:</label><br />".$form->generate_select_box("ppp", $ppp_options, $mybb->input['ppp'], array('id' => 'ppp')),
"<label for=\"threadmode\">{$lang->default_thread_view_mode}:</label><br />".$form->generate_select_box("threadmode", array("" => $lang->use_default, "linear" => $lang->linear_mode, "threaded" => $lang->threaded_mode), $mybb->input['threadmode'], array('id' => 'threadmode'))
);

		"<label for=\"ppp\">{$lang->posts_per_page}:</label><br />".$form->generate_select_box("ppp", $ppp_options, $mybb->input['ppp'], array('id' => 'ppp')),
"<label for=\"threadmode\">{$lang->default_thread_view_mode}:</label><br />".$form->generate_select_box("threadmode", array("" => $lang->use_default, "linear" => $lang->linear_mode, "threaded" => $lang->threaded_mode), $mybb->input['threadmode'], array('id' => 'threadmode'))
);

 

// Allow plugins to add thread options
$thread_options = $plugins->run_hooks('admin_user_users_edit_thread_options', $thread_options);

// Output thread options

	$form_container->output_row($lang->thread_view_options, "", "<div class=\"user_settings_bit\">".implode("</div><div class=\"user_settings_bit\">", $thread_options)."</div>");

$languages = array_merge(array('' => $lang->use_default), $lang->get_languages());

	$form_container->output_row($lang->thread_view_options, "", "<div class=\"user_settings_bit\">".implode("</div><div class=\"user_settings_bit\">", $thread_options)."</div>");

$languages = array_merge(array('' => $lang->use_default), $lang->get_languages());

Zeile 1328Zeile 1359
		"<label for=\"style\">{$lang->theme}:</label><br />".build_theme_select("style", $mybb->input['style'], 0, "", true, false, true),
"<label for=\"language\">{$lang->board_language}:</label><br />".$form->generate_select_box("language", $languages, $mybb->input['language'], array('id' => 'language'))
);

		"<label for=\"style\">{$lang->theme}:</label><br />".build_theme_select("style", $mybb->input['style'], 0, "", true, false, true),
"<label for=\"language\">{$lang->board_language}:</label><br />".$form->generate_select_box("language", $languages, $mybb->input['language'], array('id' => 'language'))
);

 

// Allow plugins to add other options
$other_options = $plugins->run_hooks('admin_user_users_edit_other_options', $other_options);

// Output other options

	$form_container->output_row($lang->other_options, "", "<div class=\"user_settings_bit\">".implode("</div><div class=\"user_settings_bit\">", $other_options)."</div>");

$form_container->end();

	$form_container->output_row($lang->other_options, "", "<div class=\"user_settings_bit\">".implode("</div><div class=\"user_settings_bit\">", $other_options)."</div>");

$form_container->end();

 
	$plugins->run_hooks("admin_user_users_edit_settings");

	echo "</div>\n";

//

	echo "</div>\n";

//

Zeile 1359Zeile 1396
		$sig_imgcode = $lang->on;
}
echo "<div id=\"tab_signature\">\n";

		$sig_imgcode = $lang->on;
}
echo "<div id=\"tab_signature\">\n";

	$form_container = new FormContainer("{$lang->signature}: {$user['username']}");

	$form_container = new FormContainer($lang->signature.': '.htmlspecialchars_uni($user['username']));

	$form_container->output_row($lang->signature, $lang->sprintf($lang->signature_desc, $sig_mycode, $sig_smilies, $sig_imgcode, $sig_html), $signature_editor, 'signature');

$periods = array(

	$form_container->output_row($lang->signature, $lang->sprintf($lang->signature_desc, $sig_mycode, $sig_smilies, $sig_imgcode, $sig_html), $signature_editor, 'signature');

$periods = array(

Zeile 1385Zeile 1422
		{
// There's a limit to the suspension!
$remaining = $user['suspendsigtime']-TIME_NOW;

		{
// There's a limit to the suspension!
$remaining = $user['suspendsigtime']-TIME_NOW;

			$expired = nice_time($remaining, array('seconds' => false));

$color = 'inherit';
if($remaining < 3600)

			$expired = nice_time($remaining, array('seconds' => false));

$color = 'inherit';
if($remaining < 3600)

			{
$color = 'red';
}

			{
$color = 'red';
}

Zeile 1422Zeile 1459
		function toggleAction()
{
if($("#suspend_action").is(\':visible\'))

		function toggleAction()
{
if($("#suspend_action").is(\':visible\'))

			{

			{

				$("#suspend_action").hide();
}
else

				$("#suspend_action").hide();
}
else

Zeile 1455Zeile 1492
	</script>';

$form_container->output_row($lang->suspend_sig, $lang->suspend_sig_info, $actions);

	</script>';

$form_container->output_row($lang->suspend_sig, $lang->suspend_sig_info, $actions);





	$signature_options = array(
$form->generate_radio_button("update_posts", "enable", $lang->enable_sig_in_all_posts, array("checked" => 0)),
$form->generate_radio_button("update_posts", "disable", $lang->disable_sig_in_all_posts, array("checked" => 0)),

	$signature_options = array(
$form->generate_radio_button("update_posts", "enable", $lang->enable_sig_in_all_posts, array("checked" => 0)),
$form->generate_radio_button("update_posts", "disable", $lang->disable_sig_in_all_posts, array("checked" => 0)),

Zeile 1465Zeile 1502
	$form_container->output_row($lang->signature_preferences, "", implode("<br />", $signature_options));

$form_container->end();

	$form_container->output_row($lang->signature_preferences, "", implode("<br />", $signature_options));

$form_container->end();

 
	$plugins->run_hooks("admin_user_users_edit_signatur");

	echo "</div>\n";

//

	echo "</div>\n";

//

Zeile 1481Zeile 1519
	{
$current_avatar_msg = "<br /><strong>{$lang->user_current_using_uploaded_avatar}</strong>";
}

	{
$current_avatar_msg = "<br /><strong>{$lang->user_current_using_uploaded_avatar}</strong>";
}

	elseif($user['avatartype'] == "remote" || my_strpos(my_strtolower($user['avatar']), "http://") !== false)

	elseif($user['avatartype'] == "remote" || my_validate_url($user['avatar']))

	{
$current_avatar_msg = "<br /><strong>{$lang->user_current_using_remote_avatar}</strong>";
$avatar_url = $user['avatar'];

	{
$current_avatar_msg = "<br /><strong>{$lang->user_current_using_remote_avatar}</strong>";
$avatar_url = $user['avatar'];

Zeile 1494Zeile 1532

if($mybb->settings['maxavatardims'] != "")
{


if($mybb->settings['maxavatardims'] != "")
{

		list($max_width, $max_height) = explode("x", my_strtolower($mybb->settings['maxavatardims']));

		list($max_width, $max_height) = preg_split('/[|x]/', my_strtolower($mybb->settings['maxavatardims']));

		$max_size = "<br />{$lang->max_dimensions_are} {$max_width}x{$max_height}";
}


		$max_size = "<br />{$lang->max_dimensions_are} {$max_width}x{$max_height}";
}


Zeile 1507Zeile 1545
	if($user['avatar'])
{
$remove_avatar = "<br /><br />".$form->generate_check_box("remove_avatar", 1, "<strong>{$lang->remove_avatar}</strong>");

	if($user['avatar'])
{
$remove_avatar = "<br /><br />".$form->generate_check_box("remove_avatar", 1, "<strong>{$lang->remove_avatar}</strong>");

	}

	}


$table->construct_cell($lang->avatar_desc."{$remove_avatar}<br /><small>{$max_size}</small>");
$table->construct_row();



$table->construct_cell($lang->avatar_desc."{$remove_avatar}<br /><small>{$max_size}</small>");
$table->construct_row();


	$table->output($lang->avatar.": {$user['username']}");


	$table->output($lang->avatar.': '.htmlspecialchars_uni($user['username']));


	// Custom avatar
if($mybb->settings['avatarresizing'] == "auto")

	// Custom avatar
if($mybb->settings['avatarresizing'] == "auto")

	{

	{

		$auto_resize = $lang->avatar_auto_resize;

		$auto_resize = $lang->avatar_auto_resize;

	}

	}

	else if($mybb->settings['avatarresizing'] == "user")

	else if($mybb->settings['avatarresizing'] == "user")

	{

	{

		$auto_resize = "<input type=\"checkbox\" name=\"auto_resize\" value=\"1\" checked=\"checked\" id=\"auto_resize\" /> <label for=\"auto_resize\">{$lang->attempt_to_auto_resize}</label></span>";

		$auto_resize = "<input type=\"checkbox\" name=\"auto_resize\" value=\"1\" checked=\"checked\" id=\"auto_resize\" /> <label for=\"auto_resize\">{$lang->attempt_to_auto_resize}</label></span>";

	}

	}

	$form_container = new FormContainer($lang->specify_custom_avatar);
$form_container->output_row($lang->upload_avatar, $auto_resize, $form->generate_file_upload_box('avatar_upload', array('id' => 'avatar_upload')), 'avatar_upload');

	$form_container = new FormContainer($lang->specify_custom_avatar);
$form_container->output_row($lang->upload_avatar, $auto_resize, $form->generate_file_upload_box('avatar_upload', array('id' => 'avatar_upload')), 'avatar_upload');

	$form_container->output_row($lang->or_specify_avatar_url, "", $form->generate_text_box('avatar_url', $avatar_url, array('id' => 'avatar_url')), 'avatar_url');




	if($mybb->settings['allowremoteavatars'])
{
$form_container->output_row($lang->or_specify_avatar_url, "", $form->generate_text_box('avatar_url', $avatar_url, array('id' => 'avatar_url')), 'avatar_url');
}

	$form_container->end();

	$form_container->end();

 
	$plugins->run_hooks("admin_user_users_edit_avatar");

	echo "</div>\n";

//

	echo "</div>\n";

//

Zeile 1541Zeile 1583
	);

echo "<div id=\"tab_modoptions\">\n";

	);

echo "<div id=\"tab_modoptions\">\n";

	$form_container = new FormContainer($lang->mod_options.": {$user['username']}");

	$form_container = new FormContainer($lang->mod_options.': '.htmlspecialchars_uni($user['username']));

	$form_container->output_row($lang->user_notes, '', $form->generate_text_area('usernotes', $mybb->input['usernotes'], array('id' => 'usernotes')), 'usernotes');

// Mod posts

	$form_container->output_row($lang->user_notes, '', $form->generate_text_area('usernotes', $mybb->input['usernotes'], array('id' => 'usernotes')), 'usernotes');

// Mod posts

Zeile 1581Zeile 1623
	}

$modpost_div = '<div id="modpost">'.$existing_info.''.$lang->moderate_for.' '.$form->generate_numeric_field("modpost_time", $mybb->input['modpost_time'], array('style' => 'width: 3em;', 'min' => 0)).' '.$modpost_options.'</div>';

	}

$modpost_div = '<div id="modpost">'.$existing_info.''.$lang->moderate_for.' '.$form->generate_numeric_field("modpost_time", $mybb->input['modpost_time'], array('style' => 'width: 3em;', 'min' => 0)).' '.$modpost_options.'</div>';

	$lang->moderate_posts_info = $lang->sprintf($lang->moderate_posts_info, $user['username']);

	$lang->moderate_posts_info = $lang->sprintf($lang->moderate_posts_info, htmlspecialchars_uni($user['username']));

	$form_container->output_row($form->generate_check_box("moderateposting", 1, $lang->moderate_posts, array("id" => "moderateposting", "onclick" => "toggleBox('modpost');", "checked" => $mybb->input['moderateposting'])), $lang->moderate_posts_info, $modpost_div);

// Suspend posts

	$form_container->output_row($form->generate_check_box("moderateposting", 1, $lang->moderate_posts, array("id" => "moderateposting", "onclick" => "toggleBox('modpost');", "checked" => $mybb->input['moderateposting'])), $lang->moderate_posts_info, $modpost_div);

// Suspend posts

Zeile 1621Zeile 1663
	}

$suspost_div = '<div id="suspost">'.$existing_info.''.$lang->suspend_for.' '.$form->generate_numeric_field("suspost_time", $mybb->input['suspost_time'], array('style' => 'width: 3em;', 'min' => 0)).' '.$suspost_options.'</div>';

	}

$suspost_div = '<div id="suspost">'.$existing_info.''.$lang->suspend_for.' '.$form->generate_numeric_field("suspost_time", $mybb->input['suspost_time'], array('style' => 'width: 3em;', 'min' => 0)).' '.$suspost_options.'</div>';

	$lang->suspend_posts_info = $lang->sprintf($lang->suspend_posts_info, $user['username']);

	$lang->suspend_posts_info = $lang->sprintf($lang->suspend_posts_info, htmlspecialchars_uni($user['username']));

	$form_container->output_row($form->generate_check_box("suspendposting", 1, $lang->suspend_posts, array("id" => "suspendposting", "onclick" => "toggleBox('suspost');", "checked" => $mybb->input['suspendposting'])), $lang->suspend_posts_info, $suspost_div);


$form_container->end();

	$form_container->output_row($form->generate_check_box("suspendposting", 1, $lang->suspend_posts, array("id" => "suspendposting", "onclick" => "toggleBox('suspost');", "checked" => $mybb->input['suspendposting'])), $lang->suspend_posts_info, $suspost_div);


$form_container->end();

 
	$plugins->run_hooks("admin_user_users_edit_moderator_options");

	echo "</div>\n";

$plugins->run_hooks("admin_user_users_edit_graph");

	echo "</div>\n";

$plugins->run_hooks("admin_user_users_edit_graph");

Zeile 1883Zeile 1926
		$table->construct_row();
}


		$table->construct_row();
}


	$table->output($lang->ip_address_for." {$user['username']}");

	$table->output($lang->ip_address_for.' '.htmlspecialchars_uni($user['username']));


$page->output_footer();
}


$page->output_footer();
}

Zeile 1894Zeile 1937

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


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

		$source_user = get_user_by_username($mybb->input['source_username'], array('fields' => '*'));
if(!$source_user['uid'])

		foreach(array('source', 'destination') as $target)


		{

		{

			$errors[] = $lang->error_invalid_user_source;
}

$destination_user = get_user_by_username($mybb->input['destination_username'], array('fields' => '*'));
if(!$destination_user['uid'])
{
$errors[] = $lang->error_invalid_user_destination;

			${$target.'_user'} = get_user_by_username($mybb->input[$target.'_username'], array('fields' => '*'));
if(!${$target.'_user'}['uid'])
{
$errors[] = $lang->{'error_invalid_user_'.$target};
}



		}

// If we're not a super admin and we're merging a source super admin or a destination super admin then dissallow this action

		}

// If we're not a super admin and we're merging a source super admin or a destination super admin then dissallow this action

Zeile 1911Zeile 1951
		{
flash_message($lang->error_no_perms_super_admin, 'error');
admin_redirect("index.php?module=user-users");

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

		}

if($source_user['uid'] == $destination_user['uid'])
{

		}

if($source_user['uid'] == $destination_user['uid'] && !empty($source_user['uid']))
{

			$errors[] = $lang->error_cannot_merge_same_account;
}


			$errors[] = $lang->error_cannot_merge_same_account;
}


Zeile 1926Zeile 1966
			);
$query = $db->simple_select("adminoptions", "uid", "uid='{$destination_user['uid']}'");
$existing_admin_options = $db->fetch_field($query, "uid");

			);
$query = $db->simple_select("adminoptions", "uid", "uid='{$destination_user['uid']}'");
$existing_admin_options = $db->fetch_field($query, "uid");





			// Only carry over admin options/permissions if we don't already have them
if(!$existing_admin_options)
{
$db->update_query("adminoptions", $uid_update, "uid='{$source_user['uid']}'");

			// Only carry over admin options/permissions if we don't already have them
if(!$existing_admin_options)
{
$db->update_query("adminoptions", $uid_update, "uid='{$source_user['uid']}'");

			}


			}


			$db->update_query("adminlog", $uid_update, "uid='{$source_user['uid']}'");
$db->update_query("announcements", $uid_update, "uid='{$source_user['uid']}'");
$db->update_query("events", $uid_update, "uid='{$source_user['uid']}'");

			$db->update_query("adminlog", $uid_update, "uid='{$source_user['uid']}'");
$db->update_query("announcements", $uid_update, "uid='{$source_user['uid']}'");
$db->update_query("events", $uid_update, "uid='{$source_user['uid']}'");

Zeile 1944Zeile 1984
			$db->update_query("posts", $uid_update, "uid='{$source_user['uid']}'");
$db->update_query("privatemessages", $uid_update, "uid='{$source_user['uid']}'");
$db->update_query("reportedcontent", $uid_update, "uid='{$source_user['uid']}'");

			$db->update_query("posts", $uid_update, "uid='{$source_user['uid']}'");
$db->update_query("privatemessages", $uid_update, "uid='{$source_user['uid']}'");
$db->update_query("reportedcontent", $uid_update, "uid='{$source_user['uid']}'");

			$db->update_query("threadratings", $uid_update, "uid='{$source_user['uid']}'");

 
			$db->update_query("threads", $uid_update, "uid='{$source_user['uid']}'");
$db->update_query("warnings", $uid_update, "uid='{$source_user['uid']}'");
$db->update_query("warnings", array("revokedby" => $destination_user['uid']), "revokedby='{$source_user['uid']}'");
$db->update_query("warnings", array("issuedby" => $destination_user['uid']), "issuedby='{$source_user['uid']}'");

			$db->update_query("threads", $uid_update, "uid='{$source_user['uid']}'");
$db->update_query("warnings", $uid_update, "uid='{$source_user['uid']}'");
$db->update_query("warnings", array("revokedby" => $destination_user['uid']), "revokedby='{$source_user['uid']}'");
$db->update_query("warnings", array("issuedby" => $destination_user['uid']), "issuedby='{$source_user['uid']}'");

 

// Thread ratings
merge_thread_ratings($source_user['uid'], $destination_user['uid']);


// Banning
$db->update_query("banned", array('admin' => $destination_user['uid']), "admin = '{$source_user['uid']}'");


// Banning
$db->update_query("banned", array('admin' => $destination_user['uid']), "admin = '{$source_user['uid']}'");
















// Carry over referrals
$db->update_query("users", array("referrer" => $destination_user['uid']), "referrer='{$source_user['uid']}' AND uid!='{$destination_user['uid']}'");
// If destination user has no referrer but source does and source user was not referred by destination user
// or destination user was referred by the source user
if(($destination_user['referrer'] == 0 && $source_user['referrer'] > 0 && $source_user['referrer'] != $destination_user['uid']) || $destination_user['referrer'] == $source_user['uid'])
{
$db->update_query("users", array("referrer" => $source_user['referrer']), "uid='{$destination_user['uid']}'");
}
$query = $db->simple_select("users", "COUNT(uid) as total_referrals", "referrer='{$destination_user['uid']}' AND uid!='{$source_user['uid']}'");
$new_referrals = $db->fetch_field($query, "total_referrals");
$db->update_query("users", array("referrals" => (int)$new_referrals), "uid='{$destination_user['uid']}'");


			// Merging Reputation
// First, let's change all the details over to our new user...
$db->update_query("reputation", array("adduid" => $destination_user['uid']), "adduid = '".$source_user['uid']."'");

			// Merging Reputation
// First, let's change all the details over to our new user...
$db->update_query("reputation", array("adduid" => $destination_user['uid']), "adduid = '".$source_user['uid']."'");

Zeile 2004Zeile 2058
			$db->update_query("users", array('reputation' => (int)$total_reputation), "uid='{$destination_user['uid']}'");

// Calculate warning points

			$db->update_query("users", array('reputation' => (int)$total_reputation), "uid='{$destination_user['uid']}'");

// Calculate warning points

			$query = $db->query("

			$query = $db->query("

				SELECT SUM(points) as warn_lev
FROM ".TABLE_PREFIX."warnings
WHERE uid='{$source_user['uid']}' AND expired='0'

				SELECT SUM(points) as warn_lev
FROM ".TABLE_PREFIX."warnings
WHERE uid='{$source_user['uid']}' AND expired='0'

Zeile 2064Zeile 2118
				"ignorelist" => $ignored
);
$db->update_query("users", $lists, "uid='{$destination_user['uid']}'");

				"ignorelist" => $ignored
);
$db->update_query("users", $lists, "uid='{$destination_user['uid']}'");


// Set up user handler.
require_once MYBB_ROOT.'inc/datahandlers/user.php';
$userhandler = new UserDataHandler('delete');

// Delete the old user
$userhandler->delete_user($source_user['uid']);

 

// Get a list of forums where post count doesn't apply
$fids = array();


// Get a list of forums where post count doesn't apply
$fids = array();

Zeile 2084Zeile 2131
			if(!empty($fids))
{
$fids_not_in = "AND fid NOT IN(".implode(',', $fids).")";

			if(!empty($fids))
{
$fids_not_in = "AND fid NOT IN(".implode(',', $fids).")";

			}


			}


			// Update user post count
$query = $db->simple_select("posts", "COUNT(*) AS postnum", "uid='".$destination_user['uid']."' {$fids_not_in}");
$num = $db->fetch_array($query);

			// Update user post count
$query = $db->simple_select("posts", "COUNT(*) AS postnum", "uid='".$destination_user['uid']."' {$fids_not_in}");
$num = $db->fetch_array($query);

Zeile 2106Zeile 2153
			if($destination_user['regdate'] > $source_user['regdate'])
{
$db->update_query("users", array('regdate' => $source_user['regdate']), "uid='{$destination_user['uid']}'");

			if($destination_user['regdate'] > $source_user['regdate'])
{
$db->update_query("users", array('regdate' => $source_user['regdate']), "uid='{$destination_user['uid']}'");

			}

$plugins->run_hooks("admin_user_users_merge_commit");









			}

$plugins->run_hooks("admin_user_users_merge_commit");

// Set up user handler.
require_once MYBB_ROOT.'inc/datahandlers/user.php';
$userhandler = new UserDataHandler('delete');

// Delete the old user
$userhandler->delete_user($source_user['uid']);


			$cache->update_awaitingactivation();

// Log admin action
log_admin_action($source_user['uid'], $source_user['username'], $destination_user['uid'], $destination_user['username']);

// Redirect!

			$cache->update_awaitingactivation();

// Log admin action
log_admin_action($source_user['uid'], $source_user['username'], $destination_user['uid'], $destination_user['username']);

// Redirect!

			flash_message("<strong>{$source_user['username']}</strong> {$lang->success_merged} {$destination_user['username']}", "success");



			$username = htmlspecialchars_uni($source_user['username']);
$destination_username = htmlspecialchars_uni($destination_user['username']);
flash_message("<strong>{$username}</strong> {$lang->success_merged} {$destination_username}", "success");

			admin_redirect("index.php?module=user-users");
exit;
}

			admin_redirect("index.php?module=user-users");
exit;
}

	}


	}


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

$page->output_nav_tabs($sub_tabs, 'merge_users');

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

$page->output_nav_tabs($sub_tabs, 'merge_users');





	// If we have any error messages, show them
if($errors)
{

	// If we have any error messages, show them
if($errors)
{

Zeile 2147Zeile 2203
	<script type="text/javascript">
<!--
$("#source_username").select2({

	<script type="text/javascript">
<!--
$("#source_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) {

		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", {

			var query = $(element).val();
if (query !== "") {
$.ajax("../xmlhttp.php?action=get_users&getone=1", {

Zeile 2268Zeile 2324
		if($mybb->input['sortby'])
{
$admin_view['sortby'] = $mybb->input['sortby'];

		if($mybb->input['sortby'])
{
$admin_view['sortby'] = $mybb->input['sortby'];

		}

		}


if($mybb->get_input('perpage', MyBB::INPUT_INT))
{


if($mybb->get_input('perpage', MyBB::INPUT_INT))
{

Zeile 2281Zeile 2337
		}

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

		}

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

		{

		{

			$admin_view['view_type'] = $mybb->input['displayas'];

			$admin_view['view_type'] = $mybb->input['displayas'];

		}

		}


if($mybb->input['profile_fields'])
{
$admin_view['custom_profile_fields'] = $mybb->input['profile_fields'];


if($mybb->input['profile_fields'])
{
$admin_view['custom_profile_fields'] = $mybb->input['profile_fields'];

		}

		}


$plugins->run_hooks("admin_user_users_search_commit");



$plugins->run_hooks("admin_user_users_search_commit");


Zeile 2301Zeile 2357
			$page->output_nav_tabs($sub_tabs, 'find_users');
echo $results;
$page->output_footer();

			$page->output_nav_tabs($sub_tabs, 'find_users');
echo $results;
$page->output_footer();

		}

		}

		else
{
if($mybb->input['from'] == "home")

		else
{
if($mybb->input['from'] == "home")

Zeile 2321Zeile 2377
	$page->output_header($lang->find_users);

$page->output_nav_tabs($sub_tabs, 'find_users');

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

$page->output_nav_tabs($sub_tabs, 'find_users');


// If we have any error messages, show them
if($errors)
{
$page->output_inline_error($errors);


// If we have any error messages, show them
if($errors)
{
$page->output_inline_error($errors);

	}

if(!$mybb->input['displayas'])
{
$mybb->input['displayas'] = "card";

	}

if(!$mybb->input['displayas'])
{
$mybb->input['displayas'] = "card";

	}

$form = new Form("index.php?module=user-users&amp;action=search", "post");

	}

$form = new Form("index.php?module=user-users&amp;action=search", "post");


user_search_conditions($mybb->input, $form);



user_search_conditions($mybb->input, $form);


Zeile 2362Zeile 2418
	{
// We have a custom view
if(!$mybb->cookies['acp_view'])

	{
// We have a custom view
if(!$mybb->cookies['acp_view'])

		{

		{

			// Set a cookie
my_setcookie("acp_view", $mybb->input['vid'], 60);
}

			// Set a cookie
my_setcookie("acp_view", $mybb->input['vid'], 60);
}

Zeile 2383Zeile 2439
		{
$selected[] = (int)$id;
}

		{
$selected[] = (int)$id;
}

	}

	}


// Verify incoming POST request
if(!verify_post_check($mybb->input['my_post_key']))


// Verify incoming POST request
if(!verify_post_check($mybb->input['my_post_key']))

Zeile 2439Zeile 2495
				$to_update_count = count($to_update);
$lang->inline_activated = $lang->sprintf($lang->inline_activated, my_number_format($to_update_count));


				$to_update_count = count($to_update);
$lang->inline_activated = $lang->sprintf($lang->inline_activated, my_number_format($to_update_count));


				if($to_update_count != count($selected))

				if(is_array($selected) && $to_update_count != count($selected))

				{
// The update count is different to how many we selected!
$not_updated_count = count($selected) - $to_update_count;

				{
// The update count is different to how many we selected!
$not_updated_count = count($selected) - $to_update_count;

Zeile 2477Zeile 2533
				{
$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->update_query("users", $updated_group, "uid = '".$ban['uid']."'");
$db->delete_query("banned", "uid = '".$ban['uid']."'");
}


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


				$cache->update_banned();

 
				$cache->update_moderators();

$mybb->input['action'] = "inline_lift";

				$cache->update_moderators();

$mybb->input['action'] = "inline_lift";

Zeile 2556Zeile 2611
							'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 2578Zeile 2633
					$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();

 
					++$banned_count;
}
$mybb->input['action'] = "inline_banned";

					++$banned_count;
}
$mybb->input['action'] = "inline_banned";

Zeile 2618Zeile 2672
			{
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 2791Zeile 2845
							$db->delete_query("polls", "tid='$tid'");
$db->delete_query("threadsread", "tid='$tid'");
$db->delete_query("threadratings", "tid='$tid'");

							$db->delete_query("polls", "tid='$tid'");
$db->delete_query("threadsread", "tid='$tid'");
$db->delete_query("threadratings", "tid='$tid'");

						}

						}

					}

// After deleting threads, rebuild the thread counters for the affected threads
if(is_array($prune_array['thread_update']) && count($prune_array['thread_update']) > 0)

					}

// After deleting threads, rebuild the thread counters for the affected threads
if(is_array($prune_array['thread_update']) && count($prune_array['thread_update']) > 0)

					{

					{

						$sql_array = implode(",", $prune_array['thread_update']);
$query = $db->simple_select("threads", "tid", "tid IN (".$sql_array.")", array('order_by' => 'tid', 'order_dir' => 'asc'));
while($thread = $db->fetch_array($query))
{
rebuild_thread_counters($thread['tid']);

						$sql_array = implode(",", $prune_array['thread_update']);
$query = $db->simple_select("threads", "tid", "tid IN (".$sql_array.")", array('order_by' => 'tid', 'order_dir' => 'asc'));
while($thread = $db->fetch_array($query))
{
rebuild_thread_counters($thread['tid']);

						}

						}

					}

// After updating thread counters, update the affected forum counters

					}

// After updating thread counters, update the affected forum counters

Zeile 2836Zeile 2890
			$table = new Table;
$lang->mass_prune_info = $lang->sprintf($lang->mass_prune_info, count($selected));
$table->construct_cell($lang->mass_prune_info);

			$table = new Table;
$lang->mass_prune_info = $lang->sprintf($lang->mass_prune_info, count($selected));
$table->construct_cell($lang->mass_prune_info);

			$table->construct_row();
$table->output($lang->important);

			$table->construct_row();
$table->output($lang->important);


if($errors)
{
$page->output_inline_error($errors);


if($errors)
{
$page->output_inline_error($errors);

			}


			}


			// Display the prune options
$form = new Form("index.php?module=user-users", "post");
echo $form->generate_hidden_field('action', 'inline_edit');
echo $form->generate_hidden_field('inline_action', 'multiprune');
echo $form->generate_hidden_field('processed', '1');

			// Display the prune options
$form = new Form("index.php?module=user-users", "post");
echo $form->generate_hidden_field('action', 'inline_edit');
echo $form->generate_hidden_field('inline_action', 'multiprune');
echo $form->generate_hidden_field('processed', '1');





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

// Generate a list of days (1 - 31)

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

// Generate a list of days (1 - 31)

Zeile 2882Zeile 2936
			{
$string = "option_{$i}";
$set_options[] = $lang->$string;

			{
$string = "option_{$i}";
$set_options[] = $lang->$string;

			}


			}


			$form_container->output_row($lang->relative_date, "", $lang->delete_posts." ".$form->generate_select_box('set', $set_options, $mybb->input['set']), 'set');
$form_container->end();


			$form_container->output_row($lang->relative_date, "", $lang->delete_posts." ".$form->generate_select_box('set', $set_options, $mybb->input['set']), 'set');
$form_container->end();


Zeile 2912Zeile 2966
				{
$additionalgroups = '';
}

				{
$additionalgroups = '';
}





				// Create an update array
$update_array = array(
"usergroup" => $mybb->get_input('usergroup', MyBB::INPUT_INT),

				// Create an update array
$update_array = array(
"usergroup" => $mybb->get_input('usergroup', MyBB::INPUT_INT),

Zeile 2922Zeile 2976

// Do the usergroup update for all those selected
// If the a selected user is a super admin, don't update that user


// Do the usergroup update for all those selected
// If the a selected user is a super admin, don't update that user

 
				$users_to_update = array();

				foreach($selected as $user)
{
if(!is_super_admin($user))
{
$users_to_update[] = $user;
}

				foreach($selected as $user)
{
if(!is_super_admin($user))
{
$users_to_update[] = $user;
}

				}

				}


$to_update_count = count($users_to_update);


$to_update_count = count($users_to_update);

				if($to_update_count > 0 && is_array($users_to_update))

				if($to_update_count > 0)

				{
// Update the users in the database
$sql = implode(",", $users_to_update);

				{
// Update the users in the database
$sql = implode(",", $users_to_update);

Zeile 3021Zeile 3076
	{
// Showing a specific view
if(isset($mybb->input['vid']))

	{
// Showing a specific view
if(isset($mybb->input['vid']))

		{

		{

			$query = $db->simple_select("adminviews", "*", "vid='".$mybb->get_input('vid', MyBB::INPUT_INT)."'");
$admin_view = $db->fetch_array($query);
// View does not exist or this view is private and does not belong to the current user

			$query = $db->simple_select("adminviews", "*", "vid='".$mybb->get_input('vid', MyBB::INPUT_INT)."'");
$admin_view = $db->fetch_array($query);
// View does not exist or this view is private and does not belong to the current user

Zeile 3066Zeile 3121
	{
// If we came from the home page and clicked on the "Activate Users" link, send them back to here
if($admin_session['data']['from'] == "home")

	{
// If we came from the home page and clicked on the "Activate Users" link, send them back to here
if($admin_session['data']['from'] == "home")

		{

		{

			flash_message($admin_session['data']['flash_message2']['message'], $admin_session['data']['flash_message2']['type']);
update_admin_session('flash_message2', '');
update_admin_session('from', '');
admin_redirect("index.php");
exit;

			flash_message($admin_session['data']['flash_message2']['message'], $admin_session['data']['flash_message2']['type']);
update_admin_session('flash_message2', '');
update_admin_session('from', '');
admin_redirect("index.php");
exit;

		}

		}

		else
{
$errors[] = $lang->error_no_users_found;

		else
{
$errors[] = $lang->error_no_users_found;

		}
}


		}
}


	// If we have any error messages, show them
if($errors)
{

	// If we have any error messages, show them
if($errors)
{

Zeile 3087Zeile 3142
			echo "<div style=\"display: inline; float: right;\">{$admin_view['popup']}</div><br />\n";
}
$page->output_inline_error($errors);

			echo "<div style=\"display: inline; float: right;\">{$admin_view['popup']}</div><br />\n";
}
$page->output_inline_error($errors);

	}

echo $results;

	}

echo $results;


$page->output_footer();
}


$page->output_footer();
}

Zeile 3102Zeile 3157
function build_users_view($view)
{
global $mybb, $db, $cache, $lang, $user_view_fields, $page;

function build_users_view($view)
{
global $mybb, $db, $cache, $lang, $user_view_fields, $page;

 

if($view['view_type'] != 'card')
{
$view['view_type'] = 'table';
}


$view_title = '';
if($view['title'])


$view_title = '';
if($view['title'])

Zeile 3111Zeile 3171
		if($lang->$title_string)
{
$view['title'] = $lang->$title_string;

		if($lang->$title_string)
{
$view['title'] = $lang->$title_string;

		}


		}


		$view_title .= " (".htmlspecialchars_uni($view['title']).")";
}


		$view_title .= " (".htmlspecialchars_uni($view['title']).")";
}


Zeile 3132Zeile 3192
	if(!is_array($view['custom_profile_fields']))
{
$view['custom_profile_fields'] = my_unserialize($view['custom_profile_fields']);

	if(!is_array($view['custom_profile_fields']))
{
$view['custom_profile_fields'] = my_unserialize($view['custom_profile_fields']);

	}

	}

	if(isset($mybb->input['username']))
{
$view['conditions']['username'] = $mybb->input['username'];

	if(isset($mybb->input['username']))
{
$view['conditions']['username'] = $mybb->input['username'];

	}


		$view['url'] .= "&amp;username=".urlencode(htmlspecialchars_uni($mybb->input['username']));
}

	if($view['vid'])

	if($view['vid'])

	{

	{

		$view['url'] .= "&amp;vid={$view['vid']}";
}
else

		$view['url'] .= "&amp;vid={$view['vid']}";
}
else

	{

	{

		// If this is a custom view we need to save everything ready to pass it on from page to page
global $admin_session;
if(!$mybb->input['search_id'])

		// If this is a custom view we need to save everything ready to pass it on from page to page
global $admin_session;
if(!$mybb->input['search_id'])

Zeile 3153Zeile 3214
			$mybb->input['search_id'] = $search_id;
}
$view['url'] .= "&amp;search_id=".htmlspecialchars_uni($mybb->input['search_id']);

			$mybb->input['search_id'] = $search_id;
}
$view['url'] .= "&amp;search_id=".htmlspecialchars_uni($mybb->input['search_id']);

	}

if(isset($mybb->input['username']))
{
$view['url'] .= "&amp;username=".urlencode(htmlspecialchars_uni($mybb->input['username']));

 
	}

if(!isset($admin_session['data']['last_users_view']) || $admin_session['data']['last_users_view'] != str_replace("&amp;", "&", $view['url']))

	}

if(!isset($admin_session['data']['last_users_view']) || $admin_session['data']['last_users_view'] != str_replace("&amp;", "&", $view['url']))

Zeile 3206Zeile 3262
	// Build the search SQL for users

// List of valid LIKE search fields

	// Build the search SQL for users

// List of valid LIKE search fields

	$user_like_fields = array("username", "email", "website", "icq", "aim", "yahoo", "skype", "google", "signature", "usertitle");

	$user_like_fields = array("username", "email", "website", "icq", "skype", "google", "signature", "usertitle");

	foreach($user_like_fields as $search_field)
{
if(!empty($view['conditions'][$search_field]) && !$view['conditions'][$search_field.'_blank'])

	foreach($user_like_fields as $search_field)
{
if(!empty($view['conditions'][$search_field]) && !$view['conditions'][$search_field.'_blank'])

Zeile 3447Zeile 3503
		if($mybb->input['page'])
{
$start = ($mybb->input['page'] - 1) * $view['perpage'];

		if($mybb->input['page'])
{
$start = ($mybb->input['page'] - 1) * $view['perpage'];

 
			$pages = ceil($num_results / $view['perpage']);
if($mybb->input['page'] > $pages)
{
$start = 0;
$mybb->input['page'] = 1;
}

		}
else
{

		}
else
{

Zeile 3479Zeile 3541
				break;
default:
$view['sortby'] = "username";

				break;
default:
$view['sortby'] = "username";

		}


		}


		if($view['sortorder'] != "desc")
{
$view['sortorder'] = "asc";
}

		if($view['sortorder'] != "desc")
{
$view['sortorder'] = "asc";
}





		$usergroups = $cache->read("usergroups");

// Fetch matching users

		$usergroups = $cache->read("usergroups");

// Fetch matching users

Zeile 3500Zeile 3562
		while($user = $db->fetch_array($query))
{
$comma = $groups_list = '';

		while($user = $db->fetch_array($query))
{
$comma = $groups_list = '';

 
			$user['username'] = htmlspecialchars_uni($user['username']);

			$user['view']['username'] = "<a href=\"index.php?module=user-users&amp;action=edit&amp;uid={$user['uid']}\">".format_name($user['username'], $user['usergroup'], $user['displaygroup'])."</a>";
$user['view']['usergroup'] = htmlspecialchars_uni($usergroups[$user['usergroup']]['title']);
if($user['additionalgroups'])

			$user['view']['username'] = "<a href=\"index.php?module=user-users&amp;action=edit&amp;uid={$user['uid']}\">".format_name($user['username'], $user['usergroup'], $user['displaygroup'])."</a>";
$user['view']['usergroup'] = htmlspecialchars_uni($usergroups[$user['usergroup']]['title']);
if($user['additionalgroups'])

Zeile 3513Zeile 3576
				}
}
if(!$groups_list)

				}
}
if(!$groups_list)

			{

			{

				$groups_list = $lang->none;
}
$user['view']['additionalgroups'] = "<small>{$groups_list}</small>";
$user['view']['email'] = "<a href=\"mailto:".htmlspecialchars_uni($user['email'])."\">".htmlspecialchars_uni($user['email'])."</a>";
$user['view']['regdate'] = my_date('relative', $user['regdate']);

				$groups_list = $lang->none;
}
$user['view']['additionalgroups'] = "<small>{$groups_list}</small>";
$user['view']['email'] = "<a href=\"mailto:".htmlspecialchars_uni($user['email'])."\">".htmlspecialchars_uni($user['email'])."</a>";
$user['view']['regdate'] = my_date('relative', $user['regdate']);

			$user['view']['lastactive'] = my_date('relative', $user['lastactive']);









			$last_seen = max(array($user['lastactive'], $user['lastvisit']));
if(!empty($last_seen))
{
$user['view']['lastactive'] = my_date('relative', $last_seen);
}
else
{
$user['view']['lastactive'] = $lang->never;
}


// Build popup menu
$popup = new PopupMenu("user_{$user['uid']}", $lang->options);


// Build popup menu
$popup = new PopupMenu("user_{$user['uid']}", $lang->options);

Zeile 3548Zeile 3619
				else
{
$popup->add_item($lang->approve_user, "index.php?module=user-users&amp;action=activate_user&amp;uid={$user['uid']}&amp;my_post_key={$mybb->post_code}{$from_bit}");

				else
{
$popup->add_item($lang->approve_user, "index.php?module=user-users&amp;action=activate_user&amp;uid={$user['uid']}&amp;my_post_key={$mybb->post_code}{$from_bit}");

				}

				}

			}

$popup->add_item($lang->delete_user, "index.php?module=user-users&amp;action=delete&amp;uid={$user['uid']}&amp;my_post_key={$mybb->post_code}", "return AdminCP.deleteConfirmation(this, '{$lang->user_deletion_confirmation}')");
$popup->add_item($lang->show_referred_users, "index.php?module=user-users&amp;action=referrers&amp;uid={$user['uid']}");
$popup->add_item($lang->show_ip_addresses, "index.php?module=user-users&amp;action=ipaddresses&amp;uid={$user['uid']}");

			}

$popup->add_item($lang->delete_user, "index.php?module=user-users&amp;action=delete&amp;uid={$user['uid']}&amp;my_post_key={$mybb->post_code}", "return AdminCP.deleteConfirmation(this, '{$lang->user_deletion_confirmation}')");
$popup->add_item($lang->show_referred_users, "index.php?module=user-users&amp;action=referrers&amp;uid={$user['uid']}");
$popup->add_item($lang->show_ip_addresses, "index.php?module=user-users&amp;action=ipaddresses&amp;uid={$user['uid']}");

			$popup->add_item($lang->show_attachments, "index.php?module=forum-attachments&amp;results=1&amp;username=".urlencode(htmlspecialchars_uni($user['username'])));

			$popup->add_item($lang->show_attachments, "index.php?module=forum-attachments&amp;results=1&amp;username=".urlencode($user['username']));

			$user['view']['controls'] = $popup->fetch();

			$user['view']['controls'] = $popup->fetch();





			// Fetch the reputation for this user
if($usergroups[$user['usergroup']]['usereputationsystem'] == 1 && $mybb->settings['enablereputation'] == 1)
{

			// Fetch the reputation for this user
if($usergroups[$user['usergroup']]['usereputationsystem'] == 1 && $mybb->settings['enablereputation'] == 1)
{

Zeile 3568Zeile 3639
			}

if($mybb->settings['enablewarningsystem'] != 0 && $usergroups[$user['usergroup']]['canreceivewarnings'] != 0)

			}

if($mybb->settings['enablewarningsystem'] != 0 && $usergroups[$user['usergroup']]['canreceivewarnings'] != 0)

			{

			{

				if($mybb->settings['maxwarningpoints'] < 1)
{
$mybb->settings['maxwarningpoints'] = 10;

				if($mybb->settings['maxwarningpoints'] < 1)
{
$mybb->settings['maxwarningpoints'] = 10;

				}

				}


$warning_level = round($user['warningpoints']/$mybb->settings['maxwarningpoints']*100);
if($warning_level > 100)


$warning_level = round($user['warningpoints']/$mybb->settings['maxwarningpoints']*100);
if($warning_level > 100)

Zeile 3581Zeile 3652
				}
$user['view']['warninglevel'] = get_colored_warning_level($warning_level);
}

				}
$user['view']['warninglevel'] = get_colored_warning_level($warning_level);
}


if($user['avatar'] && my_substr($user['avatar'], 0, 7) !== 'http://' && my_substr($user['avatar'], 0, 8) !== 'https://')
{
$user['avatar'] = "../{$user['avatar']}";
}







			if($view['view_type'] == "card")

			if($view['view_type'] == "card")

			{
$scaled_avatar = fetch_scaled_avatar($user, 80, 80);
}

			{
$max_dimensions = '80x80';
}

			else
{

			else
{

				$scaled_avatar = fetch_scaled_avatar($user, 34, 34);

				$max_dimensions = '34x34';

			}

			}

			if(!$user['avatar'])
{
$user['avatar'] = "../".$mybb->settings['useravatar'];
}
$user['view']['avatar'] = "<img src=\"".htmlspecialchars_uni($user['avatar'])."\" alt=\"\" width=\"{$scaled_avatar['width']}\" height=\"{$scaled_avatar['height']}\" />";


$avatar = format_avatar($user['avatar'], $user['avatardimensions'], $max_dimensions);

$user['view']['avatar'] = "<img src=\"".$avatar['image']."\" alt=\"\" {$avatar['width_height']} />";



// Convert IP's to readable
$user['regip'] = my_inet_ntop($db->unescape_binary($user['regip']));


// Convert IP's to readable
$user['regip'] = my_inet_ntop($db->unescape_binary($user['regip']));

Zeile 3646Zeile 3712
	// Do we need to construct the pagination?
if($num_results > $view['perpage'])
{

	// Do we need to construct the pagination?
if($num_results > $view['perpage'])
{

		$pagination = draw_admin_pagination($mybb->input['page'], $view['perpage'], $num_results, $view['url']."&amp;type={$view['view_type']}");


		$view_type = htmlspecialchars_uni($view['view_type']);
$pagination = draw_admin_pagination($mybb->input['page'], $view['perpage'], $num_results, $view['url']."&amp;type={$view_type}");

		$search_class = "float_right";
$search_style = "";
}

		$search_class = "float_right";
$search_style = "";
}

Zeile 3677Zeile 3744
		$default_class = "search_default";
$value = $lang->search_for_user;
}

		$default_class = "search_default";
$value = $lang->search_for_user;
}

	$built_view .= $search->generate_text_box('username', $value, array('id' => 'search_keywords', 'class' => "{$default_class} field150 field_small"))."\n";

	$built_view .= $search->generate_text_box('username', htmlspecialchars_uni($value), array('id' => 'search_keywords', 'class' => "{$default_class} field150 field_small"))."\n";

	$built_view .= "<input type=\"submit\" class=\"search_button\" value=\"{$lang->search}\" />\n";
if($view['popup'])
{

	$built_view .= "<input type=\"submit\" class=\"search_button\" value=\"{$lang->search}\" />\n";
if($view['popup'])
{

Zeile 3685Zeile 3752
	}
$built_view .= "<script type=\"text/javascript\">
var form = $(\"#search_form\");

	}
$built_view .= "<script type=\"text/javascript\">
var form = $(\"#search_form\");

		form.submit(function() {

		form.on('submit', function() {

			var search = $('#search_keywords');
if(search.val() == '' || search.val() == '".addcslashes($lang->search_for_user, "'")."')
{

			var search = $('#search_keywords');
if(search.val() == '' || search.val() == '".addcslashes($lang->search_for_user, "'")."')
{

				search.focus();

				search.trigger('focus');

				return false;

				return false;

			}
});


			}
});


		var search = $(\"#search_keywords\");

		var search = $(\"#search_keywords\");

		search.focus(function()

		search.on('focus', function()

		{
var searched_focus = $(this);
if(searched_focus.val() == '".addcslashes($lang->search_for_user, "'")."')

		{
var searched_focus = $(this);
if(searched_focus.val() == '".addcslashes($lang->search_for_user, "'")."')

			{

			{

				searched_focus.removeClass(\"search_default\");
searched_focus.val(\"\");

				searched_focus.removeClass(\"search_default\");
searched_focus.val(\"\");

			}
});

search.blur(function()
{

			}
}).on('blur', function()
{



			var searched_blur = $(this);
if(searched_blur.val() == \"\")
{

			var searched_blur = $(this);
if(searched_blur.val() == \"\")
{

Zeile 3714Zeile 3779
				searched_blur.val('".addcslashes($lang->search_for_user, "'")."');
}
});

				searched_blur.val('".addcslashes($lang->search_for_user, "'")."');
}
});





		// fix the styling used if we have a different default value
if(search.val() != '".addcslashes($lang->search_for_user, "'")."')
{

		// fix the styling used if we have a different default value
if(search.val() != '".addcslashes($lang->search_for_user, "'")."')
{

Zeile 3722Zeile 3787
		}
</script>\n";
$built_view .= "</div>\n";

		}
</script>\n";
$built_view .= "</div>\n";





	// Autocompletion for usernames
// TODO Select2

	// Autocompletion for usernames
// TODO Select2





	$built_view .= $search->end();

	$built_view .= $search->end();


if(isset($pagination))


if(isset($pagination))

	{
$built_view .= $pagination;
}

	{
$built_view .= $pagination;
}

Zeile 3747Zeile 3812
	}

$built_view .= '

	}

$built_view .= '

<script type="text/javascript" src="'.$mybb->settings['bburl'].'/jscripts/inline_moderation.js?ver=1800"></script>

<script type="text/javascript" src="'.$mybb->settings['bburl'].'/jscripts/inline_moderation.js?ver=1821"></script>

<form action="index.php?module=user-users" method="post">
<input type="hidden" name="my_post_key" value="'.$mybb->post_code.'" />
<input type="hidden" name="action" value="inline_edit" />

<form action="index.php?module=user-users" method="post">
<input type="hidden" name="my_post_key" value="'.$mybb->post_code.'" />
<input type="hidden" name="action" value="inline_edit" />

Zeile 3844Zeile 3909
	}

// And build the final card

	}

// And build the final card

 
	$uname = "";
if(in_array('username', $view['fields']))
{
$uname = $user['view']['username'];
}

	$card = "<fieldset id=\"uid_{$user['uid']}\" style=\"width: 47%; float: {$float};\">\n";

	$card = "<fieldset id=\"uid_{$user['uid']}\" style=\"width: 47%; float: {$float};\">\n";

	$card .= "<legend><input type=\"checkbox\" class=\"checkbox\" name=\"inlinemod_{$user['uid']}\" id=\"inlinemod_{$user['uid']}\" value=\"1\" onclick=\"$('#uid_{$user['uid']}').toggleClass('inline_selected');\" /> {$user['view']['username']}</legend>\n";

	$card .= "<legend><input type=\"checkbox\" class=\"checkbox\" name=\"inlinemod_{$user['uid']}\" id=\"inlinemod_{$user['uid']}\" value=\"1\" onclick=\"$('#uid_{$user['uid']}').toggleClass('inline_selected');\" /> {$uname}</legend>\n";

	if($avatar)
{
$card .= "<div class=\"user_avatar\">{$avatar}</div>\n";

	if($avatar)
{
$card .= "<div class=\"user_avatar\">{$avatar}</div>\n";

Zeile 3903Zeile 3973
	$table->construct_cell("<input type=\"checkbox\" class=\"checkbox\" name=\"inlinemod_{$user['uid']}\" id=\"inlinemod_{$user['uid']}\" value=\"1\" onclick=\"$('#uid_{$user['uid']}').toggleClass('inline_selected');\" />");

$table->construct_row();

	$table->construct_cell("<input type=\"checkbox\" class=\"checkbox\" name=\"inlinemod_{$user['uid']}\" id=\"inlinemod_{$user['uid']}\" value=\"1\" onclick=\"$('#uid_{$user['uid']}').toggleClass('inline_selected');\" />");

$table->construct_row();

}

/**
* @param array $user
* @param int $max_width
* @param int $max_height
*
* @return array
*/
function fetch_scaled_avatar($user, $max_width=80, $max_height=80)
{
$scaled_dimensions = array(
"width" => $max_width,
"height" => $max_height,
);

if($user['avatar'])
{
if($user['avatardimensions'])
{
require_once MYBB_ROOT."inc/functions_image.php";
list($width, $height) = explode("|", $user['avatardimensions']);
$scaled_dimensions = scale_image($width, $height, $max_width, $max_height);
}
}

return array("width" => $scaled_dimensions['width'], "height" => $scaled_dimensions['height']);

 
}

/**

}

/**

Zeile 3941Zeile 3984
 */
function output_custom_profile_fields($fields, $values, &$form_container, &$form, $search=false)
{

 */
function output_custom_profile_fields($fields, $values, &$form_container, &$form, $search=false)
{

	global $lang;

	global $lang, $mybb;


if(!is_array($fields))
{


if(!is_array($fields))
{

Zeile 3954Zeile 3997
		list($type, $options) = explode("\n", $profile_field['type'], 2);
$type = trim($type);
$field_name = "fid{$profile_field['fid']}";

		list($type, $options) = explode("\n", $profile_field['type'], 2);
$type = trim($type);
$field_name = "fid{$profile_field['fid']}";





		switch($type)
{
case "multiselect":

		switch($type)
{
case "multiselect":

 
				$selected_options = array();

				if(!is_array($values[$field_name]))
{
$user_options = explode("\n", $values[$field_name]);

				if(!is_array($values[$field_name]))
{
$user_options = explode("\n", $values[$field_name]);

Zeile 3967Zeile 4011
					$user_options = $values[$field_name];
}


					$user_options = $values[$field_name];
}


				$selected_options = array();



				foreach($user_options as $val)
{
$selected_options[$val] = htmlspecialchars_uni($val);

				foreach($user_options as $val)
{
$selected_options[$val] = htmlspecialchars_uni($val);

Zeile 4032Zeile 4076
				}
break;
case "checkbox":

				}
break;
case "checkbox":

 
				$select_options = array();

				if(!is_array($values[$field_name]))

				if(!is_array($values[$field_name]))

				{

				{

					$user_options = explode("\n", $values[$field_name]);

					$user_options = explode("\n", $values[$field_name]);

				}

				}

				else
{
$user_options = $values[$field_name];
}

				else
{
$user_options = $values[$field_name];
}

 

$selected_options = array();

				foreach($user_options as $val)
{
$selected_options[$val] = $val;
}

				foreach($user_options as $val)
{
$selected_options[$val] = $val;
}

				$select_options = array();



				if($search == true)
{
$select_options[''] = $lang->na;

				if($search == true)
{
$select_options[''] = $lang->na;

Zeile 4111Zeile 4158
	}

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

	}

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

	$form_container->output_row($lang->username_contains, "", $form->generate_text_box('conditions[username]', $input['conditions']['username'], array('id' => 'username')), 'username');

	$form_container->output_row($lang->username_contains, "", $form->generate_text_box('conditions[username]', htmlspecialchars_uni($input['conditions']['username']), array('id' => 'username')), 'username');

	$form_container->output_row($lang->email_address_contains, "", $form->generate_text_box('conditions[email]', $input['conditions']['email'], array('id' => 'email')), 'email');

$options = array();

	$form_container->output_row($lang->email_address_contains, "", $form->generate_text_box('conditions[email]', $input['conditions']['email'], array('id' => 'email')), 'email');

$options = array();

Zeile 4125Zeile 4172

$form_container->output_row($lang->website_contains, "", $form->generate_text_box('conditions[website]', $input['conditions']['website'], array('id' => 'website'))." {$lang->or} ".$form->generate_check_box('conditions[website_blank]', 1, $lang->is_not_blank, array('id' => 'website_blank', 'checked' => $input['conditions']['website_blank'])), 'website');
$form_container->output_row($lang->icq_number_contains, "", $form->generate_text_box('conditions[icq]', $input['conditions']['icq'], array('id' => 'icq'))." {$lang->or} ".$form->generate_check_box('conditions[icq_blank]', 1, $lang->is_not_blank, array('id' => 'icq_blank', 'checked' => $input['conditions']['icq_blank'])), 'icq');


$form_container->output_row($lang->website_contains, "", $form->generate_text_box('conditions[website]', $input['conditions']['website'], array('id' => 'website'))." {$lang->or} ".$form->generate_check_box('conditions[website_blank]', 1, $lang->is_not_blank, array('id' => 'website_blank', 'checked' => $input['conditions']['website_blank'])), 'website');
$form_container->output_row($lang->icq_number_contains, "", $form->generate_text_box('conditions[icq]', $input['conditions']['icq'], array('id' => 'icq'))." {$lang->or} ".$form->generate_check_box('conditions[icq_blank]', 1, $lang->is_not_blank, array('id' => 'icq_blank', 'checked' => $input['conditions']['icq_blank'])), 'icq');

	$form_container->output_row($lang->aim_handle_contains, "", $form->generate_text_box('conditions[aim]', $input['conditions']['aim'], array('id' => 'aim'))." {$lang->or} ".$form->generate_check_box('conditions[aim_blank]', 1, $lang->is_not_blank, array('id' => 'aim_blank', 'checked' => $input['conditions']['aim_blank'])), 'aim');
$form_container->output_row($lang->yahoo_contains, "", $form->generate_text_box('conditions[yahoo]', $input['conditions']['yahoo'], array('id' => 'yahoo'))." {$lang->or} ".$form->generate_check_box('conditions[yahoo_blank]', 1, $lang->is_not_blank, array('id' => 'yahoo_blank', 'checked' => $input['conditions']['yahoo_blank'])), 'yahoo');

 
	$form_container->output_row($lang->skype_contains, "", $form->generate_text_box('conditions[skype]', $input['conditions']['skype'], array('id' => 'skype'))." {$lang->or} ".$form->generate_check_box('conditions[skype_blank]', 1, $lang->is_not_blank, array('id' => 'skype_blank', 'checked' => $input['conditions']['skype_blank'])), 'skype');
$form_container->output_row($lang->google_contains, "", $form->generate_text_box('conditions[google]', $input['conditions']['google'], array('id' => 'google'))." {$lang->or} ".$form->generate_check_box('conditions[google_blank]', 1, $lang->is_not_blank, array('id' => 'google_blank', 'checked' => $input['conditions']['google_blank'])), 'google');
$form_container->output_row($lang->signature_contains, "", $form->generate_text_box('conditions[signature]', $input['conditions']['signature'], array('id' => 'signature'))." {$lang->or} ".$form->generate_check_box('conditions[signature_blank]', 1, $lang->is_not_blank, array('id' => 'signature_blank', 'checked' => $input['conditions']['signature_blank'])), 'signature');

	$form_container->output_row($lang->skype_contains, "", $form->generate_text_box('conditions[skype]', $input['conditions']['skype'], array('id' => 'skype'))." {$lang->or} ".$form->generate_check_box('conditions[skype_blank]', 1, $lang->is_not_blank, array('id' => 'skype_blank', 'checked' => $input['conditions']['skype_blank'])), 'skype');
$form_container->output_row($lang->google_contains, "", $form->generate_text_box('conditions[google]', $input['conditions']['google'], array('id' => 'google'))." {$lang->or} ".$form->generate_check_box('conditions[google_blank]', 1, $lang->is_not_blank, array('id' => 'google_blank', 'checked' => $input['conditions']['google_blank'])), 'google');
$form_container->output_row($lang->signature_contains, "", $form->generate_text_box('conditions[signature]', $input['conditions']['signature'], array('id' => 'signature'))." {$lang->or} ".$form->generate_check_box('conditions[signature_blank]', 1, $lang->is_not_blank, array('id' => 'signature_blank', 'checked' => $input['conditions']['signature_blank'])), 'signature');

Zeile 4207Zeile 4252
});
// -->
</script>';

});
// -->
</script>';

 
}

/**
* @param int $source_uid
* @param int $destination_uid
*/
function merge_thread_ratings($source_uid, $destination_uid)
{
global $db;

$source_ratings = $dest_threads = $delete_list = $decrement_list = array();

// Get all thread ratings from both accounts
$query = $db->simple_select('threadratings', 'tid, uid, rid, rating', "uid IN ({$destination_uid}, {$source_uid})");
while($rating = $db->fetch_array($query))
{
if($rating['uid'] == $destination_uid)
{
$dest_threads[] = $rating['tid'];
}
else
{
$source_ratings[] = $rating;
}
}

// If there are duplicates, mark them for deletion
foreach($source_ratings as $rating)
{
if(in_array($rating['tid'], $dest_threads))
{
$delete_list[] = $rating['rid'];
$decrement_list[$rating['tid']][] = (int) $rating['rating'];
}
}

// Attribute all of the source user's ratings to the destination user
$db->update_query("threadratings", array("uid" => $destination_uid), "uid='{$source_uid}'");

// Remove ratings previously given to recently acquired threads
$query = $db->query("
SELECT tr.rid, tr.rating, t.tid
FROM {$db->table_prefix}threadratings tr
LEFT JOIN {$db->table_prefix}threads t ON (t.tid=tr.tid)
WHERE tr.uid='{$destination_uid}' AND tr.uid=t.uid
");
while($rating = $db->fetch_array($query))
{
$delete_list[] = $rating['rid'];
$decrement_list[$rating['tid']][] = (int) $rating['rating'];
}

// Delete the duplicate/disallowed ratings
if(!empty($delete_list))
{
$imp = implode(',', $delete_list);
$db->delete_query('threadratings', "rid IN ({$imp})");
}

// Correct the thread rating counters
if(!empty($decrement_list))
{
foreach($decrement_list as $tid => $ratings)
{
if(is_array($ratings))
{
$db->update_query('threads', array('numratings' => 'numratings-'.count($ratings), 'totalratings' => 'totalratings-'.array_sum($ratings)), "tid='{$tid}'", 1, true);
}
}
}

}

}