Vergleich admin/modules/user/users.php - 1.6.5 - 1.6.18

  Keine Änderungen   Hinzugefügt   Modifiziert   Entfernt
Zeile 6Zeile 6
 * Website: http://mybb.com
* License: http://mybb.com/about/license
*

 * Website: http://mybb.com
* License: http://mybb.com/about/license
*

 * $Id: users.php 5646 2011-10-31 10:32:20Z PirataNervo $

 * $Id$

 */

// Disallow direct access to this file for security reasons

 */

// Disallow direct access to this file for security reasons

Zeile 149Zeile 149
if($mybb->input['action'] == "avatar_gallery")
{
$plugins->run_hooks("admin_user_users_avatar_gallery");

if($mybb->input['action'] == "avatar_gallery")
{
$plugins->run_hooks("admin_user_users_avatar_gallery");

	



	$user = get_user($mybb->input['uid']);
if(!$user['uid'])

	$user = get_user($mybb->input['uid']);
if(!$user['uid'])

	{
exit;
}


	{
exit;
}


	// We've selected a new avatar for this user!

	// We've selected a new avatar for this user!

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

	if(isset($mybb->input['avatar']))

	{

	{

 
		if(!verify_post_check($mybb->input['my_post_key']))
{
echo $lang->invalid_post_verify_key2;
exit;
}


		$mybb->input['avatar'] = str_replace(array("./", ".."), "", $mybb->input['avatar']);

		$mybb->input['avatar'] = str_replace(array("./", ".."), "", $mybb->input['avatar']);

		



		if(file_exists("../".$mybb->settings['avatardir']."/".$mybb->input['avatar']))
{
$dimensions = @getimagesize("../".$mybb->settings['avatardir']."/".$mybb->input['avatar']);

		if(file_exists("../".$mybb->settings['avatardir']."/".$mybb->input['avatar']))
{
$dimensions = @getimagesize("../".$mybb->settings['avatardir']."/".$mybb->input['avatar']);

Zeile 169Zeile 175
				"avatardimensions" => "{$dimensions[0]}|{$dimensions[1]}",
"avatartype" => "gallery"
);

				"avatardimensions" => "{$dimensions[0]}|{$dimensions[1]}",
"avatartype" => "gallery"
);





			$db->update_query("users", $updated_avatar, "uid='".$user['uid']."'");

			$db->update_query("users", $updated_avatar, "uid='".$user['uid']."'");

			



			$plugins->run_hooks("admin_user_users_avatar_gallery_commit");

// Log admin action

			$plugins->run_hooks("admin_user_users_avatar_gallery_commit");

// Log admin action

Zeile 181Zeile 187
		// Now a tad of javascript to submit the parent window form
echo "<script type=\"text/javascript\">window.parent.submitUserForm();</script>";
exit;

		// Now a tad of javascript to submit the parent window form
echo "<script type=\"text/javascript\">window.parent.submitUserForm();</script>";
exit;

	}


	}


	echo "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\n";
echo "<html xmlns=\"http://www.w3.org/1999/xhtml\">\n";
echo "<head profile=\"http://gmpg.org/xfn/1\">\n";

	echo "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\n";
echo "<html xmlns=\"http://www.w3.org/1999/xhtml\">\n";
echo "<head profile=\"http://gmpg.org/xfn/1\">\n";

Zeile 195Zeile 201
	echo "<body id=\"avatar_gallery\">\n";

// Sanitize incoming path if we have one

	echo "<body id=\"avatar_gallery\">\n";

// Sanitize incoming path if we have one

	$gallery = str_replace(array("..", "\x0"), "", $mybb->input['gallery']);






	$gallery = '';
if(isset($mybb->input['gallery']))
{
$gallery = str_replace(array("..", "\x0"), "", $mybb->input['gallery']);
}


	$breadcrumb = "<a href=\"index.php?module=user-users&amp;action=avatar_gallery&amp;uid={$user['uid']}\">Default Gallery</a>";

	$breadcrumb = "<a href=\"index.php?module=user-users&amp;action=avatar_gallery&amp;uid={$user['uid']}\">Default Gallery</a>";





	$mybb->settings['avatardir'] = "../".$mybb->settings['avatardir'];

if(!is_dir($mybb->settings['avatardir']) && is_dir(MYBB_ROOT."/images/avatars/"))

	$mybb->settings['avatardir'] = "../".$mybb->settings['avatardir'];

if(!is_dir($mybb->settings['avatardir']) && is_dir(MYBB_ROOT."/images/avatars/"))

	{

	{

		$mybb->settings['avatardir'] = "../images/avatars/";
}

		$mybb->settings['avatardir'] = "../images/avatars/";
}

	



	// Within a gallery
if(!empty($gallery))
{

	// Within a gallery
if(!empty($gallery))
{

Zeile 246Zeile 256
	// Get a listing of avatars/directories within this gallery
$sub_galleries = $avatars = array();
$files = @scandir($real_path);

	// Get a listing of avatars/directories within this gallery
$sub_galleries = $avatars = array();
$files = @scandir($real_path);

	



	if(is_array($files))
{
foreach($files as $file)

	if(is_array($files))
{
foreach($files as $file)

Zeile 255Zeile 265
			{
continue;
}

			{
continue;
}

			



			// Build friendly name
$friendly_name = str_replace(array("_", "%20"), " ", $file);
$friendly_name = ucwords($friendly_name);

			// Build friendly name
$friendly_name = str_replace(array("_", "%20"), " ", $file);
$friendly_name = ucwords($friendly_name);

Zeile 284Zeile 294
			else if(preg_match("#\.(jpg|jpeg|gif|bmp|png)$#i", $file))
{
$friendly_name = preg_replace("#\.(jpg|jpeg|gif|bmp|png)$#i", "", $friendly_name);

			else if(preg_match("#\.(jpg|jpeg|gif|bmp|png)$#i", $file))
{
$friendly_name = preg_replace("#\.(jpg|jpeg|gif|bmp|png)$#i", "", $friendly_name);

	



				// Fetch dimensions
$dimensions = @getimagesize($real_path."/".$file);

				// Fetch dimensions
$dimensions = @getimagesize($real_path."/".$file);

	



				$avatars[] = array(
"path" => $path.$file,
"friendly_name" => $friendly_name,

				$avatars[] = array(
"path" => $path.$file,
"friendly_name" => $friendly_name,

Zeile 334Zeile 344
			$scaled_dimensions = scale_image($avatar['width'], $avatar['height'], 80, 80);
$top = ceil((80-$scaled_dimensions['height'])/2);
$left = ceil((80-$scaled_dimensions['width'])/2);

			$scaled_dimensions = scale_image($avatar['width'], $avatar['height'], 80, 80);
$top = ceil((80-$scaled_dimensions['height'])/2);
$left = ceil((80-$scaled_dimensions['width'])/2);

			echo "<li><a href=\"index.php?module=user-users&amp;action=avatar_gallery&amp;uid={$user['uid']}&amp;avatar={$avatar['path']}\"><span class=\"image\"><img src=\"{$mybb->settings['avatardir']}/{$avatar['path']}\" alt=\"\" style=\"margin-top: {$top}px;\" height=\"{$scaled_dimensions['height']}\" width=\"{$scaled_dimensions['width']}\" /></span><span class=\"title\">{$avatar['friendly_name']}</span></a></li>\n";

			echo "<li><a href=\"index.php?module=user-users&amp;action=avatar_gallery&amp;uid={$user['uid']}&amp;avatar={$avatar['path']}&amp;my_post_key={$mybb->post_code}\"><span class=\"image\"><img src=\"{$mybb->settings['avatardir']}/{$avatar['path']}\" alt=\"\" style=\"margin-top: {$top}px;\" height=\"{$scaled_dimensions['height']}\" width=\"{$scaled_dimensions['width']}\" /></span><span class=\"title\">{$avatar['friendly_name']}</span></a></li>\n";

		}
}
echo "</ul>\n";

		}
}
echo "</ul>\n";

Zeile 347Zeile 357
if($mybb->input['action'] == "activate_user")
{
$plugins->run_hooks("admin_user_users_coppa_activate");

if($mybb->input['action'] == "activate_user")
{
$plugins->run_hooks("admin_user_users_coppa_activate");

	








if(!verify_post_check($mybb->input['my_post_key']))
{
flash_message($lang->invalid_post_verify_key2, 'error');
admin_redirect("index.php?module=user-users");
}


	$query = $db->simple_select("users", "*", "uid='".intval($mybb->input['uid'])."'");
$user = $db->fetch_array($query);

	$query = $db->simple_select("users", "*", "uid='".intval($mybb->input['uid'])."'");
$user = $db->fetch_array($query);





	// Does the user not exist?
if(!$user['uid'] || $user['usergroup'] != 5)
{
flash_message($lang->error_invalid_user, 'error');
admin_redirect("index.php?module=user-users");

	// Does the user not exist?
if(!$user['uid'] || $user['usergroup'] != 5)
{
flash_message($lang->error_invalid_user, 'error');
admin_redirect("index.php?module=user-users");

	}

	}


$updated_user['usergroup'] = $user['usergroup'];



$updated_user['usergroup'] = $user['usergroup'];


Zeile 377Zeile 393
	{
$updated_user['usergroup'] = 2;
}

	{
$updated_user['usergroup'] = 2;
}





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

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

	



	$plugins->run_hooks("admin_user_users_coppa_activate_commit");

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

	$plugins->run_hooks("admin_user_users_coppa_activate_commit");

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





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

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

Zeile 395Zeile 411
		{
$message = $lang->success_activated;
}

		{
$message = $lang->success_activated;
}

		



		update_admin_session('flash_message2', array('message' => $message, 'type' => 'success'));
}
else

		update_admin_session('flash_message2', array('message' => $message, 'type' => 'success'));
}
else

Zeile 409Zeile 425
			flash_message($lang->success_activated, 'success');
}
}

			flash_message($lang->success_activated, 'success');
}
}

	



	if($admin_session['data']['last_users_url'])
{
$url = $admin_session['data']['last_users_url'];
update_admin_session('last_users_url', '');

	if($admin_session['data']['last_users_url'])
{
$url = $admin_session['data']['last_users_url'];
update_admin_session('last_users_url', '');

		



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

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

Zeile 424Zeile 440
	{
$url = "index.php?module=user-users&action=edit&uid={$user['uid']}";
}

	{
$url = "index.php?module=user-users&action=edit&uid={$user['uid']}";
}

	



	admin_redirect($url);
}

if($mybb->input['action'] == "add")
{
$plugins->run_hooks("admin_user_users_add");

	admin_redirect($url);
}

if($mybb->input['action'] == "add")
{
$plugins->run_hooks("admin_user_users_add");

	



	if($mybb->request_method == "post")
{
// Determine the usergroup stuff

	if($mybb->request_method == "post")
{
// Determine the usergroup stuff

Zeile 482Zeile 498
		else
{
$user_info = $userhandler->insert_user();

		else
{
$user_info = $userhandler->insert_user();

			



			$plugins->run_hooks("admin_user_users_add_commit");

			$plugins->run_hooks("admin_user_users_add_commit");

			



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


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


Zeile 502Zeile 518

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


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

		



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

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

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

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

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

$display_group_options[0] = $lang->use_primary_user_group;

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

$display_group_options[0] = $lang->use_primary_user_group;

 
	$options = array();

	$query = $db->simple_select("usergroups", "gid, title", "gid != '1'", array('order_by' => 'title'));
while($usergroup = $db->fetch_array($query))
{

	$query = $db->simple_select("usergroups", "gid, title", "gid != '1'", array('order_by' => 'title'));
while($usergroup = $db->fetch_array($query))
{

		$options[$usergroup['gid']] = $usergroup['title'];
$display_group_options[$usergroup['gid']] = $usergroup['title'];

		$options[$usergroup['gid']] = htmlspecialchars_uni($usergroup['title']);
$display_group_options[$usergroup['gid']] = htmlspecialchars_uni($usergroup['title']);

	}

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

	}

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

Zeile 539Zeile 556

// Output custom profile fields - required
output_custom_profile_fields($profile_fields['required'], $mybb->input['profile_fields'], $form_container, $form);


// Output custom profile fields - required
output_custom_profile_fields($profile_fields['required'], $mybb->input['profile_fields'], $form_container, $form);





	$form_container->end();
$buttons[] = $form->generate_submit_button($lang->save_user);
$form->output_submit_wrapper($buttons);

	$form_container->end();
$buttons[] = $form->generate_submit_button($lang->save_user);
$form->output_submit_wrapper($buttons);

Zeile 551Zeile 568
if($mybb->input['action'] == "edit")
{
$plugins->run_hooks("admin_user_users_edit");

if($mybb->input['action'] == "edit")
{
$plugins->run_hooks("admin_user_users_edit");

	



	$query = $db->simple_select("users", "*", "uid='".intval($mybb->input['uid'])."'");
$user = $db->fetch_array($query);


	$query = $db->simple_select("users", "*", "uid='".intval($mybb->input['uid'])."'");
$user = $db->fetch_array($query);


Zeile 611Zeile 628
			"aim" => $mybb->input['aim'],
"yahoo" => $mybb->input['yahoo'],
"msn" => $mybb->input['msn'],

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

 
			"birthday" => array(
"day" => $mybb->input['bday1'],
"month" => $mybb->input['bday2'],
"year" => $mybb->input['bday3']
),

			"style" => $mybb->input['style'],
"signature" => $mybb->input['signature'],
"dateformat" => intval($mybb->input['dateformat']),

			"style" => $mybb->input['style'],
"signature" => $mybb->input['signature'],
"dateformat" => intval($mybb->input['dateformat']),

Zeile 682Zeile 704
				);
remove_avatars($user['uid']);
}

				);
remove_avatars($user['uid']);
}

			



			// Are we uploading a new avatar?
if($_FILES['avatar_upload']['name'])
{

			// Are we uploading a new avatar?
if($_FILES['avatar_upload']['name'])
{

Zeile 708Zeile 730
			else if($mybb->input['avatar_url'] && $mybb->input['avatar_url'] != $user['avatar'])
{
$mybb->input['avatar_url'] = preg_replace("#script:#i", "", $mybb->input['avatar_url']);

			else if($mybb->input['avatar_url'] && $mybb->input['avatar_url'] != $user['avatar'])
{
$mybb->input['avatar_url'] = preg_replace("#script:#i", "", $mybb->input['avatar_url']);

				$mybb->input['avatar_url'] = htmlspecialchars($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)

				$ext = get_extension($mybb->input['avatar_url']);

// Copy the avatar to the local server (work around remote URL access disabled for getimagesize)

Zeile 751Zeile 772
						}
}
}

						}
}
}

				



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

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

Zeile 819Zeile 840
						// User has selected a type of ban, but not entered a valid time frame
$string = $option['action']."_error";
$errors[] = $lang->$string;

						// User has selected a type of ban, but not entered a valid time frame
$string = $option['action']."_error";
$errors[] = $lang->$string;

					}


					}


					if(!is_array($errors))
{
$suspend_length = fetch_time_length(intval($mybb->input[$option['time']]), $mybb->input[$option['period']]);

					if(!is_array($errors))
{
$suspend_length = fetch_time_length(intval($mybb->input[$option['time']]), $mybb->input[$option['period']]);

	



						if($user[$option['update_field']] == 1 && ($mybb->input[$option['time']] || $mybb->input[$option['period']] == "never"))
{
// We already have a suspension, but entered a new time
if($suspend_length == "-1")
{
// Permanent ban on action

						if($user[$option['update_field']] == 1 && ($mybb->input[$option['time']] || $mybb->input[$option['period']] == "never"))
{
// We already have a suspension, but entered a new time
if($suspend_length == "-1")
{
// Permanent ban on action

								$extra_user_updates[$option['update_length']] = 0;
}

								$extra_user_updates[$option['update_length']] = 0;
}

							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!

							$extra_user_updates[$option['update_field']] = 1;				

							$extra_user_updates[$option['update_field']] = 1;

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

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

Zeile 854Zeile 875
						}
}
}

						}
}
}

			}

			}


if($extra_user_updates['moderateposts'] && $extra_user_updates['suspendposting'])
{


if($extra_user_updates['moderateposts'] && $extra_user_updates['suspendposting'])
{

Zeile 865Zeile 886
			{
$user_info = $userhandler->update_user();
$db->update_query("users", $extra_user_updates, "uid='{$user['uid']}'");

			{
$user_info = $userhandler->update_user();
$db->update_query("users", $extra_user_updates, "uid='{$user['uid']}'");

				



				// if we're updating the user's signature preferences, do so now
if($mybb->input['update_posts'] == 'enable' || $mybb->input['update_posts'] == 'disable')
{

				// if we're updating the user's signature preferences, do so now
if($mybb->input['update_posts'] == 'enable' || $mybb->input['update_posts'] == 'disable')
{

Zeile 874Zeile 895
					);
$db->update_query("posts", $update_signature, "uid='{$user['uid']}'");
}

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

				



				$plugins->run_hooks("admin_user_users_edit_commit");

// Log admin action

				$plugins->run_hooks("admin_user_users_edit_commit");

// Log admin action

Zeile 882Zeile 903

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");

			}
}
}


			}
}
}


	if(!$errors)
{
$user['usertitle'] = htmlspecialchars_decode($user['usertitle']);

	if(!$errors)
{
$user['usertitle'] = htmlspecialchars_decode($user['usertitle']);

		$mybb->input = $user;

















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

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


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

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

	}


















	}

if($mybb->input['bday1'] || $mybb->input['bday2'] || $mybb->input['bday3'])
{
$mybb->input['bday'][0] = $mybb->input['bday1'];
$mybb->input['bday'][1] = $mybb->input['bday2'];
$mybb->input['bday'][2] = intval($mybb->input['bday3']);
}
else
{
$mybb->input['bday'] = array(0, 0, '');

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


	// Fetch custom profile fields
$query = $db->simple_select("profilefields", "*", "", array('order_by' => 'disporder'));
while($profile_field = $db->fetch_array($query))

	// Fetch custom profile fields
$query = $db->simple_select("profilefields", "*", "", array('order_by' => 'disporder'));
while($profile_field = $db->fetch_array($query))

Zeile 912Zeile 964

$page->add_breadcrumb_item($lang->edit_user.": ".htmlspecialchars_uni($user['username']));
$page->output_header($lang->edit_user);


$page->add_breadcrumb_item($lang->edit_user.": ".htmlspecialchars_uni($user['username']));
$page->output_header($lang->edit_user);

		



	$sub_tabs['edit_user'] = array(
'title' => $lang->edit_user,
'description' => $lang->edit_user_desc

	$sub_tabs['edit_user'] = array(
'title' => $lang->edit_user,
'description' => $lang->edit_user_desc

	);


	);


	$form = new Form("index.php?module=user-users&amp;action=edit&amp;uid={$user['uid']}", "post", "", 1);
echo "<script type=\"text/javascript\">\n function submitUserForm() { $('tab_overview').up('FORM').submit(); }</script>\n";

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

	$form = new Form("index.php?module=user-users&amp;action=edit&amp;uid={$user['uid']}", "post", "", 1);
echo "<script type=\"text/javascript\">\n function submitUserForm() { $('tab_overview').up('FORM').submit(); }</script>\n";

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





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

	



	// Is this user a COPPA user? We show a warning & activate link
if($user['coppauser'])
{
echo $lang->sprintf($lang->warning_coppa_user, $user['uid']);
}

	// Is this user a COPPA user? We show a warning & activate link
if($user['coppauser'])
{
echo $lang->sprintf($lang->warning_coppa_user, $user['uid']);
}





	$tabs = array(
"overview" => $lang->overview,
"profile" => $lang->profile,

	$tabs = array(
"overview" => $lang->overview,
"profile" => $lang->profile,

Zeile 962Zeile 1014
			require_once MYBB_ROOT."inc/functions_image.php";
list($width, $height) = explode("|", $user['avatardimensions']);
$scaled_dimensions = scale_image($width, $height, 120, 120);

			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(

		else
{
$scaled_dimensions = array(

Zeile 1045Zeile 1097
		$warning_level = get_colored_warning_level($warning_level);
}


		$warning_level = get_colored_warning_level($warning_level);
}




	$age = $lang->na;

	if($user['birthday'])

	if($user['birthday'])

	{

	{

		$age = get_age($user['birthday']);

		$age = get_age($user['birthday']);

	}

else
{
$age = '';

 
	}

$table->construct_cell("<div style=\"width: 126px; height: 126px;\" class=\"user_avatar\"><img src=\"".htmlspecialchars_uni($user['avatar'])."\" style=\"margin-top: {$avatar_top}px\" width=\"{$scaled_dimensions['width']}\" height=\"{$scaled_dimensions['height']}\" alt=\"\" /></div>", array('rowspan' => 6, 'width' => 1));

	}

$table->construct_cell("<div style=\"width: 126px; height: 126px;\" class=\"user_avatar\"><img src=\"".htmlspecialchars_uni($user['avatar'])."\" style=\"margin-top: {$avatar_top}px\" width=\"{$scaled_dimensions['width']}\" height=\"{$scaled_dimensions['height']}\" alt=\"\" /></div>", array('rowspan' => 6, 'width' => 1));

Zeile 1075Zeile 1122
	$table->construct_cell("<strong>{$lang->registration_ip}:</strong> {$user['regip']}");
$table->construct_cell("<strong>{$lang->last_known_ip}:</strong> {$user['lastip']}");
$table->construct_row();

	$table->construct_cell("<strong>{$lang->registration_ip}:</strong> {$user['regip']}");
$table->construct_cell("<strong>{$lang->last_known_ip}:</strong> {$user['lastip']}");
$table->construct_row();

	



	$table->output("{$lang->user_overview}: {$user['username']}");
echo "</div>\n";


	$table->output("{$lang->user_overview}: {$user['username']}");
echo "</div>\n";


Zeile 1089Zeile 1136
	$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->email_address." <em>*</em>", "", $form->generate_text_box('email', $mybb->input['email'], array('id' => 'email')), 'email');

	$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->email_address." <em>*</em>", "", $form->generate_text_box('email', $mybb->input['email'], array('id' => 'email')), 'email');





	$display_group_options[0] = $lang->use_primary_user_group;

	$display_group_options[0] = $lang->use_primary_user_group;

 
	$options = array();

	$query = $db->simple_select("usergroups", "gid, title", "gid != '1'", array('order_by' => 'title'));
while($usergroup = $db->fetch_array($query))
{

	$query = $db->simple_select("usergroups", "gid, title", "gid != '1'", array('order_by' => 'title'));
while($usergroup = $db->fetch_array($query))
{

		$options[$usergroup['gid']] = $usergroup['title'];
$display_group_options[$usergroup['gid']] = $usergroup['title'];

		$options[$usergroup['gid']] = htmlspecialchars_uni($usergroup['title']);
$display_group_options[$usergroup['gid']] = htmlspecialchars_uni($usergroup['title']);

	}

	}

	



	if(!is_array($mybb->input['additionalgroups']))

	if(!is_array($mybb->input['additionalgroups']))

	{

	{

		$mybb->input['additionalgroups'] = explode(',', $mybb->input['additionalgroups']);
}


		$mybb->input['additionalgroups'] = explode(',', $mybb->input['additionalgroups']);
}


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

// Output custom profile fields - required

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

// Output custom profile fields - required

 
	if(!isset($profile_fields['required']))
{
$profile_fields['required'] = array();
}

	output_custom_profile_fields($profile_fields['required'], $mybb->input['profile_fields'], $form_container, $form);

	output_custom_profile_fields($profile_fields['required'], $mybb->input['profile_fields'], $form_container, $form);





	$form_container->end();

	$form_container->end();

	



	$form_container = new FormContainer($lang->optional_profile_info.": {$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 = new FormContainer($lang->optional_profile_info.": {$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');

Zeile 1120Zeile 1172
	$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->msn_messanger_handle, "", $form->generate_text_box('msn', $mybb->input['msn'], array('id' => 'msn')), 'msn');

	$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->msn_messanger_handle, "", $form->generate_text_box('msn', $mybb->input['msn'], array('id' => 'msn')), 'msn');

 


	// Birthday

	// Birthday






























	$birthday_days = array(0 => '');
for($i = 1; $i <= 31; $i++)
{
$birthday_days[$i] = $i;
}

$birthday_months = array(
0 => '',
1 => $lang->january,
2 => $lang->february,
3 => $lang->march,
4 => $lang->april,
5 => $lang->may,
6 => $lang->june,
7 => $lang->july,
8 => $lang->august,
9 => $lang->september,
10 => $lang->october,
11 => $lang->november,
12 => $lang->december
);

$birthday_row = $form->generate_select_box('bday1', $birthday_days, $mybb->input['bday'][0], array('id' => 'bday_day'));
$birthday_row .= ' '.$form->generate_select_box('bday2', $birthday_months, $mybb->input['bday'][1], array('id' => 'bday_month'));
$birthday_row .= ' '.$form->generate_text_box('bday3', $mybb->input['bday'][2], array('id' => 'bday_year', 'style' => 'width: 3em;'));

$form_container->output_row($lang->birthday, "", $birthday_row, 'birthday');


	// Output custom profile fields - optional
output_custom_profile_fields($profile_fields['optional'], $mybb->input['profile_fields'], $form_container, $form);

$form_container->end();
echo "</div>\n";

	// Output custom profile fields - optional
output_custom_profile_fields($profile_fields['optional'], $mybb->input['profile_fields'], $form_container, $form);

$form_container->end();
echo "</div>\n";


//


//

	// 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 :>

	// 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";
$form_container = new FormContainer($lang->account_settings.": {$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>");

	echo "<div id=\"tab_settings\">\n";
$form_container = new FormContainer($lang->account_settings.": {$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)
{
$mybb->input['pmnotice'] = 1;
}

	if($mybb->input['pmnotice'] > 1)
{
$mybb->input['pmnotice'] = 1;
}

	



	$messaging_options = array(
$form->generate_check_box("allownotices", 1, $lang->recieve_admin_emails, array("checked" => $mybb->input['allownotices'])),
$form->generate_check_box("hideemail", 1, $lang->hide_email_from_others, array("checked" => $mybb->input['hideemail'])),

	$messaging_options = array(
$form->generate_check_box("allownotices", 1, $lang->recieve_admin_emails, array("checked" => $mybb->input['allownotices'])),
$form->generate_check_box("hideemail", 1, $lang->hide_email_from_others, array("checked" => $mybb->input['hideemail'])),

Zeile 1161Zeile 1241
	foreach($date_formats as $key => $format)
{
$date_format_options[$key] = my_date($format, TIME_NOW, "", 0);

	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[$key] = my_date($format, TIME_NOW, "", 0);
}


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





	$date_options = array(
"<label for=\"dateformat\">{$lang->date_format}:</label><br />".$form->generate_select_box("dateformat", $date_format_options, $mybb->input['dateformat'], array('id' => 'dateformat')),
"<label for=\"dateformat\">{$lang->time_format}:</label><br />".$form->generate_select_box("timeformat", $time_format_options, $mybb->input['timeformat'], array('id' => 'timeformat')),

	$date_options = array(
"<label for=\"dateformat\">{$lang->date_format}:</label><br />".$form->generate_select_box("dateformat", $date_format_options, $mybb->input['dateformat'], array('id' => 'dateformat')),
"<label for=\"dateformat\">{$lang->time_format}:</label><br />".$form->generate_select_box("timeformat", $time_format_options, $mybb->input['timeformat'], array('id' => 'timeformat')),

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

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

			}

			}

		}
}


		}
}


Zeile 1208Zeile 1288
	$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'))

	);

	);

	$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 1241Zeile 1321
		$form->generate_check_box("showcodebuttons", "1", $lang->show_code_buttons, array("checked" => $mybb->input['showcodebuttons'])),
"<label for=\"style\">{$lang->theme}:</label><br />".build_theme_select("style", $mybb->input['style'], 0, "", true),
"<label for=\"language\">{$lang->board_language}:</label><br />".$form->generate_select_box("language", $languages, $mybb->input['language'], array('id' => 'language'))

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

	);

	);

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

	$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();
echo "</div>\n";

	$form_container->end();
echo "</div>\n";


//


//

	// SIGNATURE EDITOR
//
$signature_editor = $form->generate_text_area("signature", $mybb->input['signature'], array('id' => 'signature', 'rows' => 15, 'cols' => '70', 'style' => 'width: 95%'));

	// SIGNATURE EDITOR
//
$signature_editor = $form->generate_text_area("signature", $mybb->input['signature'], array('id' => 'signature', 'rows' => 15, 'cols' => '70', 'style' => 'width: 95%'));

Zeile 1294Zeile 1374
		{
// Permanent
$lang->suspend_expire_info = $lang->suspend_sig_perm;

		{
// Permanent
$lang->suspend_expire_info = $lang->suspend_sig_perm;

		}
else

		}
else

		{
// There's a limit to the suspension!
$expired = my_date($mybb->settings['dateformat'], $user['suspendsigtime'])." @ ".my_date($mybb->settings['timeformat'], $user['suspendsigtime']);

		{
// There's a limit to the suspension!
$expired = my_date($mybb->settings['dateformat'], $user['suspendsigtime'])." @ ".my_date($mybb->settings['timeformat'], $user['suspendsigtime']);

Zeile 1309Zeile 1389
	else
{
$sig_checked = 0;

	else
{
$sig_checked = 0;

 
		$user_suspend_info = '';

	}

$actions = '

	}

$actions = '

Zeile 1359Zeile 1440
		$form->generate_radio_button("update_posts", "no", $lang->do_nothing, array("checked" => 1))
);


		$form->generate_radio_button("update_posts", "no", $lang->do_nothing, array("checked" => 1))
);


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

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


$form_container->end();
echo "</div>\n";


$form_container->end();
echo "</div>\n";

Zeile 1373Zeile 1454

$table->construct_cell("<div style=\"width: 126px; height: 126px;\" class=\"user_avatar\"><img src=\"".htmlspecialchars_uni($user['avatar'])."\" width=\"{$scaled_dimensions['width']}\" style=\"margin-top: {$avatar_top}px\" height=\"{$scaled_dimensions['height']}\" alt=\"\" /></div>", array('width' => 1));



$table->construct_cell("<div style=\"width: 126px; height: 126px;\" class=\"user_avatar\"><img src=\"".htmlspecialchars_uni($user['avatar'])."\" width=\"{$scaled_dimensions['width']}\" style=\"margin-top: {$avatar_top}px\" height=\"{$scaled_dimensions['height']}\" alt=\"\" /></div>", array('width' => 1));


 
	$avatar_url = '';

	if($user['avatartype'] == "upload" || stristr($user['avatar'], $mybb->settings['avataruploadpath']))
{
$current_avatar_msg = "<br /><strong>{$lang->user_current_using_uploaded_avatar}</strong>";

	if($user['avatartype'] == "upload" || stristr($user['avatar'], $mybb->settings['avataruploadpath']))
{
$current_avatar_msg = "<br /><strong>{$lang->user_current_using_uploaded_avatar}</strong>";

Zeile 1389Zeile 1471

if($errors)
{


if($errors)
{

		$avatar_url = $mybb->input['avatar_url'];

		$avatar_url = htmlspecialchars_uni($mybb->input['avatar_url']);

	}

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

	}

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

Zeile 1411Zeile 1493

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

// Custom avatar

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

// Custom avatar

Zeile 1434Zeile 1516
	echo "<iframe src=\"index.php?module=user-users&amp;action=avatar_gallery&amp;uid={$user['uid']}\" width=\"100%\" height=\"350\" frameborder=\"0\"></iframe>";
echo "</div>";
echo "</div>";

	echo "<iframe src=\"index.php?module=user-users&amp;action=avatar_gallery&amp;uid={$user['uid']}\" width=\"100%\" height=\"350\" frameborder=\"0\"></iframe>";
echo "</div>";
echo "</div>";

	



	//
// MODERATOR OPTIONS
//

	//
// MODERATOR OPTIONS
//

Zeile 1447Zeile 1529
	);

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

	);

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

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

	$form_container = new FormContainer($lang->mod_options.": {$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 1455Zeile 1537
	$modpost_options = $form->generate_select_box('modpost_period', $periods, $mybb->input['modpost_period'], array('id' => 'modpost_period'));

// Do we have any existing suspensions here?

	$modpost_options = $form->generate_select_box('modpost_period', $periods, $mybb->input['modpost_period'], array('id' => 'modpost_period'));

// Do we have any existing suspensions here?

 
	$existing_info = '';

	if($user['moderateposts'] || ($mybb->input['moderateposting'] && !empty($errors)))
{
$mybb->input['moderateposting'] = 1;

	if($user['moderateposts'] || ($mybb->input['moderateposting'] && !empty($errors)))
{
$mybb->input['moderateposting'] = 1;

Zeile 1515Zeile 1598
	{
$("suspendposting").checked = false;
$("suspost").hide();

	{
$("suspendposting").checked = false;
$("suspost").hide();

		



		if($("moderateposting").checked == true)
{
$("modpost").show();

		if($("moderateposting").checked == true)
{
$("modpost").show();

Zeile 1523Zeile 1606
		else if($("moderateposting").checked == false)
{
$("modpost").hide();

		else if($("moderateposting").checked == false)
{
$("modpost").hide();

		}		

		}

	}
else if(action == "suspost")
{

	}
else if(action == "suspost")
{

Zeile 1544Zeile 1627
if($("moderateposting").checked == false)
{
$("modpost").hide();

if($("moderateposting").checked == false)
{
$("modpost").hide();

}

}

else
{
$("modpost").show();
}

if($("suspendposting").checked == false)

else
{
$("modpost").show();
}

if($("suspendposting").checked == false)

{

{

	$("suspost").hide();

	$("suspost").hide();

}

}

else
{
$("suspost").show();

else
{
$("suspost").show();

}


}


// -->
</script>';


// -->
</script>';


Zeile 1568Zeile 1651
if($mybb->input['action'] == "delete")
{
$plugins->run_hooks("admin_user_users_delete");

if($mybb->input['action'] == "delete")
{
$plugins->run_hooks("admin_user_users_delete");

	



	$query = $db->simple_select("users", "*", "uid='".intval($mybb->input['uid'])."'");
$user = $db->fetch_array($query);


	$query = $db->simple_select("users", "*", "uid='".intval($mybb->input['uid'])."'");
$user = $db->fetch_array($query);


Zeile 1578Zeile 1661
		flash_message($lang->error_invalid_user, 'error');
admin_redirect("index.php?module=user-users");
}

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

	



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

	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');

		flash_message($lang->error_no_perms_super_admin, 'error');

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


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


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

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

Zeile 1594Zeile 1677
	if($mybb->request_method == "post")
{
// Delete the user

	if($mybb->request_method == "post")
{
// Delete the user

		$db->update_query("posts", array('uid' => 0), "uid='{$user['uid']}'");

 
		$db->delete_query("userfields", "ufid='{$user['uid']}'");
$db->delete_query("privatemessages", "uid='{$user['uid']}'");
$db->delete_query("events", "uid='{$user['uid']}'");

		$db->delete_query("userfields", "ufid='{$user['uid']}'");
$db->delete_query("privatemessages", "uid='{$user['uid']}'");
$db->delete_query("events", "uid='{$user['uid']}'");

Zeile 1602Zeile 1684
		$db->delete_query("threadsubscriptions", "uid='{$user['uid']}'");
$db->delete_query("sessions", "uid='{$user['uid']}'");
$db->delete_query("banned", "uid='{$user['uid']}'");

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

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

 
		$db->delete_query("users", "uid='{$user['uid']}'");
$db->delete_query("joinrequests", "uid='{$user['uid']}'");
$db->delete_query("warnings", "uid='{$user['uid']}'");
$db->delete_query("reputation", "uid='{$user['uid']}' OR adduid='{$user['uid']}'");

		$db->delete_query("users", "uid='{$user['uid']}'");
$db->delete_query("joinrequests", "uid='{$user['uid']}'");
$db->delete_query("warnings", "uid='{$user['uid']}'");
$db->delete_query("reputation", "uid='{$user['uid']}' OR adduid='{$user['uid']}'");

		$db->delete_query("awaitingactivation", "uid='{$uid}'");






















		$db->delete_query("awaitingactivation", "uid='{$user['uid']}'");
$db->delete_query("posts", "uid = '{$user['uid']}' AND visible = '-2'");
$db->delete_query("threads", "uid = '{$user['uid']}' AND visible = '-2'");

// Update thread ratings
$query = $db->query("
SELECT r.*, t.numratings, t.totalratings
FROM ".TABLE_PREFIX."threadratings r
LEFT JOIN ".TABLE_PREFIX."threads t ON (t.tid=r.tid)
WHERE r.uid='{$user['uid']}'
");
while($rating = $db->fetch_array($query))
{
$update_thread = array(
"numratings" => $rating['numratings'] - 1,
"totalratings" => $rating['totalratings'] - $rating['rating']
);
$db->update_query("threads", $update_thread, "tid='{$rating['tid']}'");
}

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


		// Update forum stats
update_stats(array('numusers' => '-1'));

		// Update forum stats
update_stats(array('numusers' => '-1'));

 

// Update forums & threads if user is the lastposter
$db->update_query("posts", array('uid' => 0), "uid='{$user['uid']}'");
$db->update_query("threads", array('uid' => 0), "uid='{$user['uid']}'");
$db->update_query("forums", array("lastposteruid" => 0), "lastposteruid = '{$user['uid']}'");
$db->update_query("threads", array("lastposteruid" => 0), "lastposteruid = '{$user['uid']}'");


// Did this user have an uploaded avatar?
if($user['avatartype'] == "upload")


// Did this user have an uploaded avatar?
if($user['avatartype'] == "upload")

Zeile 1643Zeile 1750
if($mybb->input['action'] == "referrers")
{
$plugins->run_hooks("admin_user_users_referrers");

if($mybb->input['action'] == "referrers")
{
$plugins->run_hooks("admin_user_users_referrers");

	



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

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

		



	$sub_tabs['referrers'] = array(
'title' => $lang->show_referrers,
'link' => "index.php?module=user-users&amp;action=referrers&amp;uid={$mybb->input['uid']}",
'description' => $lang->show_referrers_desc

	$sub_tabs['referrers'] = array(
'title' => $lang->show_referrers,
'link' => "index.php?module=user-users&amp;action=referrers&amp;uid={$mybb->input['uid']}",
'description' => $lang->show_referrers_desc

	);


	);


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

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

	



	// Fetch default admin view
$default_view = fetch_default_view("user");
if(!$default_view)

	// Fetch default admin view
$default_view = fetch_default_view("user");
if(!$default_view)

Zeile 1665Zeile 1772
	$admin_view = $db->fetch_array($query);

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

	$admin_view = $db->fetch_array($query);

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

	{

	{

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

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

	}


	}


	$admin_view['conditions'] = unserialize($admin_view['conditions']);
$admin_view['conditions']['referrer'] = $mybb->input['uid'];


	$admin_view['conditions'] = unserialize($admin_view['conditions']);
$admin_view['conditions']['referrer'] = $mybb->input['uid'];


	echo build_users_view($admin_view);















	$view = build_users_view($admin_view);

// No referred users
if(!$view)
{
$table = new Table;
$table->construct_cell($lang->error_no_referred_users);
$table->construct_row();
$table->output($lang->show_referrers);
}
else
{
echo $view;
}


	$page->output_footer();
}

if($mybb->input['action'] == "ipaddresses")
{
$plugins->run_hooks("admin_user_users_ipaddresses");

	$page->output_footer();
}

if($mybb->input['action'] == "ipaddresses")
{
$plugins->run_hooks("admin_user_users_ipaddresses");

	



	$page->add_breadcrumb_item($lang->ip_addresses);

	$page->add_breadcrumb_item($lang->ip_addresses);

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


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


	$sub_tabs['ipaddresses'] = array(
'title' => $lang->show_ip_addresses,
'link' => "index.php?module=user-users&amp;action=ipaddresses&amp;uid={$mybb->input['uid']}",
'description' => $lang->show_ip_addresses_desc
);

	$sub_tabs['ipaddresses'] = array(
'title' => $lang->show_ip_addresses,
'link' => "index.php?module=user-users&amp;action=ipaddresses&amp;uid={$mybb->input['uid']}",
'description' => $lang->show_ip_addresses_desc
);

	



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

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

	



	$query = $db->simple_select("users", "uid, regip, username, lastip", "uid='{$mybb->input['uid']}'", array('limit' => 1));
$user = $db->fetch_array($query);

	$query = $db->simple_select("users", "uid, regip, username, lastip", "uid='{$mybb->input['uid']}'", array('limit' => 1));
$user = $db->fetch_array($query);





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

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

	



	$table = new Table;

	$table = new Table;

	



	$table->construct_header($lang->ip_address);
$table->construct_header($lang->controls, array('width' => 200, 'class' => "align_center"));

	$table->construct_header($lang->ip_address);
$table->construct_header($lang->controls, array('width' => 200, 'class' => "align_center"));

	



	if(empty($user['lastip']))
{
$user['lastip'] = $lang->unknown;

	if(empty($user['lastip']))
{
$user['lastip'] = $lang->unknown;

		$controls = '';

		$controls = '';

	}
else
{
$popup = new PopupMenu("user_last", $lang->options);

	}
else
{
$popup = new PopupMenu("user_last", $lang->options);

		$popup->add_item($lang->show_users_regged_with_ip, 

		$popup->add_item($lang->show_users_regged_with_ip,

"index.php?module=user-users&amp;action=search&amp;results=1&amp;conditions=".urlencode(serialize(array("regip" => $user['lastip']))));
$popup->add_item($lang->show_users_posted_with_ip, "index.php?module=user-users&amp;results=1&amp;action=search&amp;conditions=".urlencode(serialize(array("postip" => $user['lastip']))));
$popup->add_item($lang->info_on_ip, "{$mybb->settings['bburl']}/modcp.php?action=iplookup&ipaddress={$user['lastip']}", "MyBB.popupWindow('{$mybb->settings['bburl']}/modcp.php?action=iplookup&ipaddress={$user['lastip']}', 'iplookup', 500, 250); return false;");

"index.php?module=user-users&amp;action=search&amp;results=1&amp;conditions=".urlencode(serialize(array("regip" => $user['lastip']))));
$popup->add_item($lang->show_users_posted_with_ip, "index.php?module=user-users&amp;results=1&amp;action=search&amp;conditions=".urlencode(serialize(array("postip" => $user['lastip']))));
$popup->add_item($lang->info_on_ip, "{$mybb->settings['bburl']}/modcp.php?action=iplookup&ipaddress={$user['lastip']}", "MyBB.popupWindow('{$mybb->settings['bburl']}/modcp.php?action=iplookup&ipaddress={$user['lastip']}', 'iplookup', 500, 250); return false;");

Zeile 1719Zeile 1839
		$controls = $popup->fetch();
}
$table->construct_cell("<strong>{$lang->last_known_ip}:</strong> {$user['lastip']}");

		$controls = $popup->fetch();
}
$table->construct_cell("<strong>{$lang->last_known_ip}:</strong> {$user['lastip']}");

	$table->construct_cell($controls, array('class' => "align_center"));
$table->construct_row();


	$table->construct_cell($controls, array('class' => "align_center"));
$table->construct_row();


	if(empty($user['regip']))
{
$user['regip'] = $lang->unknown;
$controls = '';
}
else

	if(empty($user['regip']))
{
$user['regip'] = $lang->unknown;
$controls = '';
}
else

	{

	{

		$popup = new PopupMenu("user_reg", $lang->options);
$popup->add_item($lang->show_users_regged_with_ip, "index.php?module=user-users&amp;results=1&amp;action=search&amp;conditions=".urlencode(serialize(array("regip" => $user['regip']))));
$popup->add_item($lang->show_users_posted_with_ip, "index.php?module=user-users&amp;results=1&amp;action=search&amp;conditions=".urlencode(serialize(array("postip" => $user['regip']))));
$popup->add_item($lang->info_on_ip, "{$mybb->settings['bburl']}/modcp.php?action=iplookup&ipaddress={$user['regip']}", "MyBB.popupWindow('{$mybb->settings['bburl']}/modcp.php?action=iplookup&ipaddress={$user['regip']}', 'iplookup', 500, 250); return false;");
$popup->add_item($lang->ban_ip, "index.php?module=config-banning&amp;filter={$user['regip']}");

		$popup = new PopupMenu("user_reg", $lang->options);
$popup->add_item($lang->show_users_regged_with_ip, "index.php?module=user-users&amp;results=1&amp;action=search&amp;conditions=".urlencode(serialize(array("regip" => $user['regip']))));
$popup->add_item($lang->show_users_posted_with_ip, "index.php?module=user-users&amp;results=1&amp;action=search&amp;conditions=".urlencode(serialize(array("postip" => $user['regip']))));
$popup->add_item($lang->info_on_ip, "{$mybb->settings['bburl']}/modcp.php?action=iplookup&ipaddress={$user['regip']}", "MyBB.popupWindow('{$mybb->settings['bburl']}/modcp.php?action=iplookup&ipaddress={$user['regip']}', 'iplookup', 500, 250); return false;");
$popup->add_item($lang->ban_ip, "index.php?module=config-banning&amp;filter={$user['regip']}");

		$controls = $popup->fetch();
}

		$controls = $popup->fetch();
}

	$table->construct_cell("<strong>{$lang->registration_ip}:</strong> {$user['regip']}");
$table->construct_cell($controls, array('class' => "align_center"));
$table->construct_row();

	$table->construct_cell("<strong>{$lang->registration_ip}:</strong> {$user['regip']}");
$table->construct_cell($controls, array('class' => "align_center"));
$table->construct_row();

	



	$counter = 0;

	$counter = 0;

	



	$query = $db->simple_select("posts", "DISTINCT ipaddress", "uid='{$mybb->input['uid']}'");
while($ip = $db->fetch_array($query))
{

	$query = $db->simple_select("posts", "DISTINCT ipaddress", "uid='{$mybb->input['uid']}'");
while($ip = $db->fetch_array($query))
{

Zeile 1752Zeile 1872
		$popup->add_item($lang->info_on_ip, "{$mybb->settings['bburl']}/modcp.php?action=iplookup&ipaddress={$ip['ipaddress']}", "MyBB.popupWindow('{$mybb->settings['bburl']}/modcp.php?action=iplookup&ipaddress={$ip['ipaddress']}', 'iplookup', 500, 250); return false;");
$popup->add_item($lang->ban_ip, "index.php?module=config-banning&amp;filter={$ip['ipaddress']}");
$controls = $popup->fetch();

		$popup->add_item($lang->info_on_ip, "{$mybb->settings['bburl']}/modcp.php?action=iplookup&ipaddress={$ip['ipaddress']}", "MyBB.popupWindow('{$mybb->settings['bburl']}/modcp.php?action=iplookup&ipaddress={$ip['ipaddress']}', 'iplookup', 500, 250); return false;");
$popup->add_item($lang->ban_ip, "index.php?module=config-banning&amp;filter={$ip['ipaddress']}");
$controls = $popup->fetch();

	



		$table->construct_cell($ip['ipaddress']);
$table->construct_cell($controls, array('class' => "align_center"));
$table->construct_row();
}

		$table->construct_cell($ip['ipaddress']);
$table->construct_cell($controls, array('class' => "align_center"));
$table->construct_row();
}

	



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

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

	



	$page->output_footer();
}

if($mybb->input['action'] == "merge")
{
$plugins->run_hooks("admin_user_users_merge");

	$page->output_footer();
}

if($mybb->input['action'] == "merge")
{
$plugins->run_hooks("admin_user_users_merge");

	



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

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

	{

	{

		$query = $db->simple_select("users", "*", "LOWER(username)='".$db->escape_string(my_strtolower($mybb->input['source_username']))."'");
$source_user = $db->fetch_array($query);
if(!$source_user['uid'])

		$query = $db->simple_select("users", "*", "LOWER(username)='".$db->escape_string(my_strtolower($mybb->input['source_username']))."'");
$source_user = $db->fetch_array($query);
if(!$source_user['uid'])

Zeile 1782Zeile 1902
		{
$errors[] = $lang->error_invalid_user_destination;
}

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

		



		// 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(!is_super_admin($mybb->user['uid']) && (is_super_admin($source_user['uid']) || is_super_admin($destination_user['uid'])))
{
flash_message($lang->error_no_perms_super_admin, 'error');
admin_redirect("index.php?module=user-users");

		// 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(!is_super_admin($mybb->user['uid']) && (is_super_admin($source_user['uid']) || is_super_admin($destination_user['uid'])))
{
flash_message($lang->error_no_perms_super_admin, 'error');
admin_redirect("index.php?module=user-users");

		}


		}


		if($source_user['uid'] == $destination_user['uid'])
{
$errors[] = $lang->error_cannot_merge_same_account;
}

		if($source_user['uid'] == $destination_user['uid'])
{
$errors[] = $lang->error_cannot_merge_same_account;
}





		if(empty($errors))
{
// Begin to merge the accounts

		if(empty($errors))
{
// Begin to merge the accounts

Zeile 1809Zeile 1929
			{
$db->update_query("adminoptions", $uid_update, "uid='{$source_user['uid']}'");
}

			{
$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 1823Zeile 1943
			$db->update_query("reportedposts", $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("reportedposts", $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->delete_query("sessions", "uid='{$source_user['uid']}'");

// Is the source user a moderator?

			$db->delete_query("sessions", "uid='{$source_user['uid']}'");

// Is the source user a moderator?

Zeile 1833Zeile 1956
				// Update the moderator cache...
$cache->update_moderators();
}

				// Update the moderator cache...
$cache->update_moderators();
}

 

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


// Merging Reputation
// First, let's change all the details over to our new user...


// Merging Reputation
// First, let's change all the details over to our new user...

			$rep_update = array(
"adduid" => $destination_user['uid'],
"uid" => $destination_user['uid']
);
$db->update_query("reputation", $rep_update, "adduid = '".$source_user['uid']."' OR uid = '".$source_user['uid']."'");

			$db->update_query("reputation", array("adduid" => $destination_user['uid']), "adduid = '".$source_user['uid']."'");
$db->update_query("reputation", array("uid" => $destination_user['uid']), "uid = '".$source_user['uid']."'");





// Now that all the repuation is merged, figure out what to do with this user's comments...
$options = array(


// Now that all the repuation is merged, figure out what to do with this user's comments...
$options = array(

Zeile 1886Zeile 2009
			$total_reputation = $db->fetch_field($query, "total_rep");

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

			$total_reputation = $db->fetch_field($query, "total_rep");

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

 

// Calculate warning points
$query = $db->query("
SELECT SUM(points) as warn_lev
FROM ".TABLE_PREFIX."warnings
WHERE uid='{$source_user['uid']}' AND expired='0'
");
$original_warn_level = $db->fetch_field($query, "warn_lev");

$query = $db->query("
SELECT SUM(points) as warn_lev
FROM ".TABLE_PREFIX."warnings
WHERE uid='{$destination_user['uid']}' AND expired='0'
");
$new_warn_level = $db->fetch_field($query, "warn_lev");
$db->update_query("users", array("warningpoints" => intval($original_warn_level + $new_warn_level)), "uid='{$destination_user['uid']}'");


// Additional updates for non-uid fields
$last_poster = array(


// Additional updates for non-uid fields
$last_poster = array(

Zeile 1898Zeile 2037
				"edituid" => $destination_user['uid']
);
$db->update_query("posts", $edit_uid, "edituid='{$source_user['uid']}'");

				"edituid" => $destination_user['uid']
);
$db->update_query("posts", $edit_uid, "edituid='{$source_user['uid']}'");





			$from_uid = array(
"fromid" => $destination_user['uid']

			$from_uid = array(
"fromid" => $destination_user['uid']

			);	

			);

			$db->update_query("privatemessages", $from_uid, "fromid='{$source_user['uid']}'");
$to_uid = array(
"toid" => $destination_user['uid']

			$db->update_query("privatemessages", $from_uid, "fromid='{$source_user['uid']}'");
$to_uid = array(
"toid" => $destination_user['uid']

			);	

			);

			$db->update_query("privatemessages", $to_uid, "toid='{$source_user['uid']}'");

			$db->update_query("privatemessages", $to_uid, "toid='{$source_user['uid']}'");

 

// Buddy/ignore lists

$destination_buddies = explode(',', $destination_user['buddylist']);
$source_buddies = explode(',', $source_user['buddylist']);
$buddies = array_unique(array_merge($source_buddies, $destination_buddies));
// Make sure the new buddy list doesn't contain either users
$buddies_array = array_diff($buddies, array($destination_user['uid'], $source_user['uid']));

$destination_ignored = explode(',', $destination_user['ignorelist']);
$source_ignored = explode(',', $destination_user['ignorelist']);
$ignored = array_unique(array_merge($source_ignored, $destination_ignored));
// ... and the same for the new ignore list
$ignored_array = array_diff($ignored, array($destination_user['uid'], $source_user['uid']));

// Remove any ignored users from the buddy list
$buddies = array_diff($buddies_array, $ignored_array);
// implode the arrays so we get a nice neat list for each
$buddies = trim(implode(',', $buddies), ',');
$ignored = trim(implode(',', $ignored_array), ',');

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


// Delete the old user
$db->delete_query("users", "uid='{$source_user['uid']}'");
$db->delete_query("banned", "uid='{$source_user['uid']}'");


// Delete the old user
$db->delete_query("users", "uid='{$source_user['uid']}'");
$db->delete_query("banned", "uid='{$source_user['uid']}'");

			









// Did the old user have an uploaded avatar?
if($source_user['avatartype'] == "upload")
{
// Removes the ./ at the beginning the timestamp on the end...
@unlink("../".substr($source_user['avatar'], 2, -20));
}


			// Get a list of forums where post count doesn't apply
$fids = array();
$query = $db->simple_select("forums", "fid", "usepostcounts=0");

			// Get a list of forums where post count doesn't apply
$fids = array();
$query = $db->simple_select("forums", "fid", "usepostcounts=0");

Zeile 1919Zeile 2091
			{
$fids[] = $fid;
}

			{
$fids[] = $fid;
}

			



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

			$fids_not_in = '';
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 1933Zeile 2105
				"postnum" => $num['postnum']
);
$db->update_query("users", $updated_count, "uid='{$destination_user['uid']}'");

				"postnum" => $num['postnum']
);
$db->update_query("users", $updated_count, "uid='{$destination_user['uid']}'");

			



			// Use the earliest registration date
if($destination_user['regdate'] > $source_user['regdate'])
{

			// Use the earliest registration date
if($destination_user['regdate'] > $source_user['regdate'])
{

Zeile 1941Zeile 2113
			}

update_stats(array('numusers' => '-1'));

			}

update_stats(array('numusers' => '-1'));

			



			$plugins->run_hooks("admin_user_users_merge_commit");

// Log admin action

			$plugins->run_hooks("admin_user_users_merge_commit");

// Log admin action

Zeile 1956Zeile 2128

$page->add_breadcrumb_item($lang->merge_users);
$page->output_header($lang->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)

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

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

	{

	{

		$page->output_inline_error($errors);
}

		$page->output_inline_error($errors);
}





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

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





	$form_container = new FormContainer($lang->merge_users);
$form_container->output_row($lang->source_account." <em>*</em>", $lang->source_account_desc, $form->generate_text_box('source_username', $mybb->input['source_username'], array('id' => 'source_username')), 'source_username');
$form_container->output_row($lang->destination_account." <em>*</em>", $lang->destination_account_desc, $form->generate_text_box('destination_username', $mybb->input['destination_username'], array('id' => 'destination_username')), 'destination_username');
$form_container->end();

	$form_container = new FormContainer($lang->merge_users);
$form_container->output_row($lang->source_account." <em>*</em>", $lang->source_account_desc, $form->generate_text_box('source_username', $mybb->input['source_username'], array('id' => 'source_username')), 'source_username');
$form_container->output_row($lang->destination_account." <em>*</em>", $lang->destination_account_desc, $form->generate_text_box('destination_username', $mybb->input['destination_username'], array('id' => 'destination_username')), 'destination_username');
$form_container->end();





	// Autocompletion for usernames
echo '
<script type="text/javascript" src="../jscripts/autocomplete.js?ver=140"></script>

	// Autocompletion for usernames
echo '
<script type="text/javascript" src="../jscripts/autocomplete.js?ver=140"></script>

Zeile 1981Zeile 2153
		new autoComplete("destination_username", "../xmlhttp.php?action=get_users", {valueSpan: "username"});
// -->
</script>';

		new autoComplete("destination_username", "../xmlhttp.php?action=get_users", {valueSpan: "username"});
// -->
</script>';





	$buttons[] = $form->generate_submit_button($lang->merge_user_accounts);
$form->output_submit_wrapper($buttons);
$form->end();

	$buttons[] = $form->generate_submit_button($lang->merge_user_accounts);
$form->output_submit_wrapper($buttons);
$form->end();

Zeile 1992Zeile 2164
if($mybb->input['action'] == "search")
{
$plugins->run_hooks("admin_user_users_search");

if($mybb->input['action'] == "search")
{
$plugins->run_hooks("admin_user_users_search");

	



	if($mybb->request_method == "post" || $mybb->input['results'] == 1)
{
// Build view options from incoming search options
if($mybb->input['vid'])

	if($mybb->request_method == "post" || $mybb->input['results'] == 1)
{
// Build view options from incoming search options
if($mybb->input['vid'])

		{
$query = $db->simple_select("adminviews", "*", "vid='".intval($mybb->input['vid'])."'");
$admin_view = $db->fetch_array($query);
// View does not exist or this view is private and does not belong to the current user
if(!$admin_view['vid'] || ($admin_view['visibility'] == 1 && $admin_view['uid'] != $mybb->user['uid']))
{

		{
$query = $db->simple_select("adminviews", "*", "vid='".intval($mybb->input['vid'])."'");
$admin_view = $db->fetch_array($query);
// View does not exist or this view is private and does not belong to the current user
if(!$admin_view['vid'] || ($admin_view['visibility'] == 1 && $admin_view['uid'] != $mybb->user['uid']))
{

				unset($admin_view);
}
}

				unset($admin_view);
}
}

Zeile 2034Zeile 2206
		{
$admin_view['view_type'] = $mybb->input['type'];
}

		{
$admin_view['view_type'] = $mybb->input['type'];
}

		



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

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

		}


		}


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

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

		{

		{

			$admin_view['sortby'] = $mybb->input['sortby'];
}

			$admin_view['sortby'] = $mybb->input['sortby'];
}

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


if(intval($mybb->input['perpage']))

		{
$admin_view['perpage'] = $mybb->input['perpage'];

		{
$admin_view['perpage'] = $mybb->input['perpage'];

		}


		}


		if($mybb->input['order'])
{
$admin_view['sortorder'] = $mybb->input['order'];
}

		if($mybb->input['order'])
{
$admin_view['sortorder'] = $mybb->input['order'];
}

		



		if($mybb->input['displayas'])
{
$admin_view['view_type'] = $mybb->input['displayas'];
}

		if($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'];

		}

$results = build_users_view($admin_view);

		}

$results = build_users_view($admin_view);


if($results)
{


if($results)
{

Zeile 2074Zeile 2246
			$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")

			{

			{

				flash_message($lang->error_no_users_found, 'error');
admin_redirect("index.php");
exit;

				flash_message($lang->error_no_users_found, 'error');
admin_redirect("index.php");
exit;

			}

			}

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

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

Zeile 2092Zeile 2264

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


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

	



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

// If we have any error messages, show them

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

// If we have any error messages, show them

Zeile 2100Zeile 2272
	{
$page->output_inline_error($errors);
}

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

	



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

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

Zeile 2147Zeile 2319

$vid_url = "&amp;vid=".$mybb->input['vid'];
}


$vid_url = "&amp;vid=".$mybb->input['vid'];
}

	



	// First, collect the user IDs that we're performing the moderation on
$ids = explode("|", $mybb->cookies['inlinemod_useracp']);
foreach($ids as $id)

	// First, collect the user IDs that we're performing the moderation on
$ids = explode("|", $mybb->cookies['inlinemod_useracp']);
foreach($ids as $id)

Zeile 2155Zeile 2327
		if($id != '')
{
$selected[] = intval($id);

		if($id != '')
{
$selected[] = intval($id);

		}
}

		}
}


// If there isn't anything to select, then output an error
if(!is_array($selected))


// If there isn't anything to select, then output an error
if(!is_array($selected))

Zeile 2166Zeile 2338
			$errors[] = $lang->error_inline_no_users_selected;
}
}

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

	



	if($errors)
{
// Don't show views, but show the user list if there's errors

	if($errors)
{
// Don't show views, but show the user list if there's errors

Zeile 2232Zeile 2404
					my_unsetcookie("inlinemod_useracp"); // Unset the cookie, so that the users aren't still selected when we're redirected

flash_message($lang->inline_activated, 'success');

					my_unsetcookie("inlinemod_useracp"); // Unset the cookie, so that the users aren't still selected when we're redirected

flash_message($lang->inline_activated, 'success');

					admin_redirect("index.php?module=user-users".$vid_url);
}
else

					admin_redirect("index.php?module=user-users".$vid_url);
}
else

				{
// Nothing was updated, show an error
flash_message($lang->inline_activated_failed, 'error');
admin_redirect("index.php?module=user-users".$vid_url);

				{
// Nothing was updated, show an error
flash_message($lang->inline_activated_failed, 'error');
admin_redirect("index.php?module=user-users".$vid_url);

				}				

				}

				break;
case 'multilift':
// Get the users that are banned, and check that they have been selected

				break;
case 'multilift':
// Get the users that are banned, and check that they have been selected

Zeile 2249Zeile 2421
				}

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

				}

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

				{

				{

					$sql_array = implode(",", $selected);
$query = $db->simple_select("banned", "*", "uid IN (".$sql_array.")");
$to_be_unbanned = $db->num_rows($query);

					$sql_array = implode(",", $selected);
$query = $db->simple_select("banned", "*", "uid IN (".$sql_array.")");
$to_be_unbanned = $db->num_rows($query);

Zeile 2258Zeile 2430
						$updated_group = array(
"usergroup" => $ban['oldgroup'],
"additionalgroups" => $ban['oldadditionalgroups'],

						$updated_group = array(
"usergroup" => $ban['oldgroup'],
"additionalgroups" => $ban['oldadditionalgroups'],

							"displaygroup" => $ban['olddisplaygroup']					

							"displaygroup" => $ban['olddisplaygroup']

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

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

Zeile 2292Zeile 2464
					while($user = $db->fetch_array($query))
{
$bannedcache[] = "u_".$user['uid'];

					while($user = $db->fetch_array($query))
{
$bannedcache[] = "u_".$user['uid'];

					}

					}


// Collect the users
$query = $db->simple_select("users", "uid, username, usergroup, additionalgroups, displaygroup", "uid IN (".$sql_array.")");


// Collect the users
$query = $db->simple_select("users", "uid, username, usergroup, additionalgroups, displaygroup", "uid IN (".$sql_array.")");

Zeile 2390Zeile 2562
				echo $form->generate_hidden_field('processed', '1');

$form_container = new FormContainer('<div class="float_right"><a href="index.php?module=user-users&amp;action=inline_edit&amp;inline_action=multilift&amp;my_post_key='.$mybb->post_code.'">'.$lang->lift_bans.'</a></div>'.$lang->mass_ban);

				echo $form->generate_hidden_field('processed', '1');

$form_container = new FormContainer('<div class="float_right"><a href="index.php?module=user-users&amp;action=inline_edit&amp;inline_action=multilift&amp;my_post_key='.$mybb->post_code.'">'.$lang->lift_bans.'</a></div>'.$lang->mass_ban);

				$form_container->output_row($lang->ban_reason, "", $form->generate_text_box('reason', $mybb->input['reason'], array('id' => 'reason')), 'reason');				

				$form_container->output_row($lang->ban_reason, "", $form->generate_text_box('reason', $mybb->input['reason'], array('id' => 'reason')), 'reason');

				$ban_times = fetch_ban_times();
foreach($ban_times as $time => $period)
{

				$ban_times = fetch_ban_times();
foreach($ban_times as $time => $period)
{

Zeile 2401Zeile 2573
					}
$length_list[$time] = $period;
}

					}
$length_list[$time] = $period;
}

				$form_container->output_row($lang->ban_time, "", $form->generate_select_box('bantime', $length_list, $mybb->input['bantime'], array('id' => 'bantime')), 'bantime');				

				$form_container->output_row($lang->ban_time, "", $form->generate_select_box('bantime', $length_list, $mybb->input['bantime'], array('id' => 'bantime')), 'bantime');

				$form_container->end();

				$form_container->end();

			



				$buttons[] = $form->generate_submit_button($lang->ban_users);

				$buttons[] = $form->generate_submit_button($lang->ban_users);

				$form->output_submit_wrapper($buttons);				

				$form->output_submit_wrapper($buttons);

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

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

Zeile 2427Zeile 2599
							if($user['uid'] == $mybb->user['uid'] || is_super_admin($user['uid']))
{
// Remove me and super admins

							if($user['uid'] == $mybb->user['uid'] || is_super_admin($user['uid']))
{
// Remove me and super admins

 
								--$to_be_deleted;

								continue;
}
else
{
// Run delete queries
$db->update_query("posts", array('uid' => 0), "uid='{$user['uid']}'");

								continue;
}
else
{
// Run delete queries
$db->update_query("posts", array('uid' => 0), "uid='{$user['uid']}'");

 
								$db->update_query("threads", array('uid' => 0), "uid='{$user['uid']}'");

								$db->delete_query("userfields", "ufid='{$user['uid']}'");
$db->delete_query("privatemessages", "uid='{$user['uid']}'");
$db->delete_query("events", "uid='{$user['uid']}'");

								$db->delete_query("userfields", "ufid='{$user['uid']}'");
$db->delete_query("privatemessages", "uid='{$user['uid']}'");
$db->delete_query("events", "uid='{$user['uid']}'");

Zeile 2441Zeile 2615
								$db->delete_query("threadsubscriptions", "uid='{$user['uid']}'");
$db->delete_query("sessions", "uid='{$user['uid']}'");
$db->delete_query("banned", "uid='{$user['uid']}'");

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

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

 
								$db->delete_query("users", "uid='{$user['uid']}'");
$db->delete_query("joinrequests", "uid='{$user['uid']}'");
$db->delete_query("warnings", "uid='{$user['uid']}'");

								$db->delete_query("users", "uid='{$user['uid']}'");
$db->delete_query("joinrequests", "uid='{$user['uid']}'");
$db->delete_query("warnings", "uid='{$user['uid']}'");

 

// Update thread ratings
$update_thread_ratings_query = $db->query("
SELECT r.*, t.numratings, t.totalratings
FROM ".TABLE_PREFIX."threadratings r
LEFT JOIN ".TABLE_PREFIX."threads t ON (t.tid=r.tid)
WHERE r.uid='{$user['uid']}'
");
while($rating = $db->fetch_array($update_thread_ratings_query))
{
$update_thread = array(
"numratings" => $rating['numratings'] - 1,
"totalratings" => $rating['totalratings'] - $rating['rating']
);
$db->update_query("threads", $update_thread, "tid='{$rating['tid']}'");
}

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

							}
}
// Update forum stats, remove the cookie and redirect the user

							}
}
// Update forum stats, remove the cookie and redirect the user

Zeile 2461Zeile 2652
					$to_be_deleted = count($selected);
$lang->confirm_multidelete = $lang->sprintf($lang->confirm_multidelete, my_number_format($to_be_deleted));
$page->output_confirm_action("index.php?module=user-users&amp;action=inline_edit&amp;inline_action=multidelete&amp;my_post_key={$mybb->post_code}&amp;processed=1", $lang->confirm_multidelete);

					$to_be_deleted = count($selected);
$lang->confirm_multidelete = $lang->sprintf($lang->confirm_multidelete, my_number_format($to_be_deleted));
$page->output_confirm_action("index.php?module=user-users&amp;action=inline_edit&amp;inline_action=multidelete&amp;my_post_key={$mybb->post_code}&amp;processed=1", $lang->confirm_multidelete);

				}

				}

				break;
case 'multiprune':
if($mybb->input['processed'] == 1)

				break;
case 'multiprune':
if($mybb->input['processed'] == 1)

Zeile 2550Zeile 2741
					{
$sql_array = implode(",", $selected);
$prune_array = array();

					{
$sql_array = implode(",", $selected);
$prune_array = array();

						$query = $db->simple_select("users", "uid", "uid IN (".$sql_array.")");							

						$query = $db->simple_select("users", "uid", "uid IN (".$sql_array.")");

						while($user = $db->fetch_array($query))
{
// Protect Super Admins

						while($user = $db->fetch_array($query))
{
// Protect Super Admins

Zeile 2574Zeile 2765
						}

// Require the rebuild functions

						}

// Require the rebuild functions

						require_once(MYBB_ROOT.'/inc/functions.php');
require_once(MYBB_ROOT.'/inc/functions_rebuild.php');

						require_once MYBB_ROOT.'/inc/functions.php';
require_once MYBB_ROOT.'/inc/functions_rebuild.php';


// We've finished deleting user's posts, so let's delete the threads
if(is_array($prune_array['to_delete']) && count($prune_array['to_delete']) > 0)


// We've finished deleting user's posts, so let's delete the threads
if(is_array($prune_array['to_delete']) && count($prune_array['to_delete']) > 0)

Zeile 2585Zeile 2776
								$db->delete_query("threads", "tid='$tid'");
$db->delete_query("threads", "closed='moved|$tid'");
$db->delete_query("threadsubscriptions", "tid='$tid'");

								$db->delete_query("threads", "tid='$tid'");
$db->delete_query("threads", "closed='moved|$tid'");
$db->delete_query("threadsubscriptions", "tid='$tid'");

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

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

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

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

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

							}
}


							}
}


Zeile 2621Zeile 2813
						//log_admin_action();
my_unsetcookie("inlinemod_useracp"); // We've got our users, remove the cookie
flash_message($lang->prune_complete, 'success');

						//log_admin_action();
my_unsetcookie("inlinemod_useracp"); // We've got our users, remove the cookie
flash_message($lang->prune_complete, 'success');

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

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

				}

				}





				$page->output_header($lang->manage_users);
$page->output_nav_tabs($sub_tabs, 'manage_users');

				$page->output_header($lang->manage_users);
$page->output_nav_tabs($sub_tabs, 'manage_users');

				



				// Display a table warning
$table = new Table;
$lang->mass_prune_info = $lang->sprintf($lang->mass_prune_info, count($selected));

				// Display a table warning
$table = new Table;
$lang->mass_prune_info = $lang->sprintf($lang->mass_prune_info, count($selected));

Zeile 2669Zeile 2861
				$year_box = $form->generate_text_box('year', $mybb->input['year'], array('id' => 'year', 'style' => 'width: 50px;'));

$prune_select = $date_box.$month_box.$year_box;

				$year_box = $form->generate_text_box('year', $mybb->input['year'], array('id' => 'year', 'style' => 'width: 50px;'));

$prune_select = $date_box.$month_box.$year_box;

				$form_container->output_row($lang->manual_date, "", $prune_select, 'date');				

				$form_container->output_row($lang->manual_date, "", $prune_select, 'date');


// Generate the set date box
$set_options = array();


// Generate the set date box
$set_options = array();

Zeile 2680Zeile 2872
					$set_options[] = $lang->$string;
}


					$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->output_row($lang->relative_date, "", $lang->delete_posts." ".$form->generate_select_box('set', $set_options, $mybb->input['set']), 'set');

				$form_container->end();

$buttons[] = $form->generate_submit_button($lang->prune_posts);

				$form_container->end();

$buttons[] = $form->generate_submit_button($lang->prune_posts);

				$form->output_submit_wrapper($buttons);				

				$form->output_submit_wrapper($buttons);

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

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

Zeile 2701Zeile 2893
								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 2710Zeile 2902

// Create an update array
$update_array = array(


// Create an update array
$update_array = array(

						"usergroup" => $mybb->input['usergroup'],

						"usergroup" => intval($mybb->input['usergroup']),

						"additionalgroups" => $additionalgroups,

						"additionalgroups" => $additionalgroups,

						"displaygroup" => $mybb->input['displaygroup']

						"displaygroup" => intval($mybb->input['displaygroup'])

					);

// Do the usergroup update for all those selected

					);

// Do the usergroup update for all those selected

Zeile 2771Zeile 2963

// Usergroups
$display_group_options[0] = $lang->use_primary_user_group;


// Usergroups
$display_group_options[0] = $lang->use_primary_user_group;

 
				$options = array();

				$query = $db->simple_select("usergroups", "gid, title", "gid != '1'", array('order_by' => 'title'));
while($usergroup = $db->fetch_array($query))
{

				$query = $db->simple_select("usergroups", "gid, title", "gid != '1'", array('order_by' => 'title'));
while($usergroup = $db->fetch_array($query))
{

					$options[$usergroup['gid']] = $usergroup['title'];
$display_group_options[$usergroup['gid']] = $usergroup['title'];

					$options[$usergroup['gid']] = htmlspecialchars_uni($usergroup['title']);
$display_group_options[$usergroup['gid']] = htmlspecialchars_uni($usergroup['title']);

				}

if(!is_array($mybb->input['additionalgroups']))

				}

if(!is_array($mybb->input['additionalgroups']))

Zeile 2785Zeile 2978

$form_container->output_row($lang->primary_user_group, "", $form->generate_select_box('usergroup', $options, $mybb->input['usergroup'], array('id' => 'usergroup')), 'usergroup');
$form_container->output_row($lang->additional_user_groups, $lang->additional_user_groups_desc, $form->generate_select_box('additionalgroups[]', $options, $mybb->input['additionalgroups'], array('id' => 'additionalgroups', 'multiple' => true, 'size' => 5)), 'additionalgroups');


$form_container->output_row($lang->primary_user_group, "", $form->generate_select_box('usergroup', $options, $mybb->input['usergroup'], array('id' => 'usergroup')), 'usergroup');
$form_container->output_row($lang->additional_user_groups, $lang->additional_user_groups_desc, $form->generate_select_box('additionalgroups[]', $options, $mybb->input['additionalgroups'], array('id' => 'additionalgroups', 'multiple' => true, 'size' => 5)), 'additionalgroups');

				$form_container->output_row($lang->display_user_group, "", $form->generate_select_box('displaygroup', $display_group_options, $mybb->input['displaygroup'], array('id' => 'displaygroup')), 'displaygroup');			

				$form_container->output_row($lang->display_user_group, "", $form->generate_select_box('displaygroup', $display_group_options, $mybb->input['displaygroup'], array('id' => 'displaygroup')), 'displaygroup');


$form_container->end();

$buttons[] = $form->generate_submit_button($lang->alter_usergroups);


$form_container->end();

$buttons[] = $form->generate_submit_button($lang->alter_usergroups);

				$form->output_submit_wrapper($buttons);				

				$form->output_submit_wrapper($buttons);

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

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

Zeile 2801Zeile 2994
if(!$mybb->input['action'])
{
$plugins->run_hooks("admin_user_users_start");

if(!$mybb->input['action'])
{
$plugins->run_hooks("admin_user_users_start");

	



	$page->output_header($lang->browse_users);
echo "<script type=\"text/javascript\" src=\"jscripts/users.js\"></script>";

	$page->output_header($lang->browse_users);
echo "<script type=\"text/javascript\" src=\"jscripts/users.js\"></script>";

	



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

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

	
if($mybb->input['search_id'] && $admin_session['data']['user_views'][$mybb->input['search_id']])


if(isset($mybb->input['search_id']) && $admin_session['data']['user_views'][$mybb->input['search_id']])

	{
$admin_view = $admin_session['data']['user_views'][$mybb->input['search_id']];
unset($admin_view['extra_sql']);

	{
$admin_view = $admin_session['data']['user_views'][$mybb->input['search_id']];
unset($admin_view['extra_sql']);

Zeile 2815Zeile 3008
	else
{
// Showing a specific view

	else
{
// Showing a specific view

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

		if(isset($mybb->input['vid']))

		{
$query = $db->simple_select("adminviews", "*", "vid='".intval($mybb->input['vid'])."'");
$admin_view = $db->fetch_array($query);

		{
$query = $db->simple_select("adminviews", "*", "vid='".intval($mybb->input['vid'])."'");
$admin_view = $db->fetch_array($query);

Zeile 2827Zeile 3020
		}

// Don't have a view? Fetch the default

		}

// Don't have a view? Fetch the default

		if(!$admin_view)

		if(!isset($admin_view))

		{
$default_view = fetch_default_view("user");
if(!$default_view)

		{
$default_view = fetch_default_view("user");
if(!$default_view)

Zeile 2850Zeile 3043
	$popup->add_item("<em>{$lang->manage_views}</em>", "index.php?module=user-users&amp;action=views");
$admin_view['popup'] = $popup->fetch();


	$popup->add_item("<em>{$lang->manage_views}</em>", "index.php?module=user-users&amp;action=views");
$admin_view['popup'] = $popup->fetch();


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

	if(isset($mybb->input['type']))

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

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

	}

$results = build_users_view($admin_view);


	}

$results = build_users_view($admin_view);


	if(!$results)
{
// If we came from the home page and clicked on the "Activate Users" link, send them back to here

	if(!$results)
{
// If we came from the home page and clicked on the "Activate Users" link, send them back to here

Zeile 2893Zeile 3086
{
global $mybb, $db, $cache, $lang, $user_view_fields, $page;


{
global $mybb, $db, $cache, $lang, $user_view_fields, $page;


 
	$view_title = '';

	if($view['title'])
{
$title_string = "view_title_{$view['vid']}";

	if($view['title'])
{
$title_string = "view_title_{$view['vid']}";

		



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

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

		



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

// Build the URL to this view

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

// Build the URL to this view

	if(!$view['url'])

	if(!isset($view['url']))

	{
$view['url'] = "index.php?module=user-users";
}

	{
$view['url'] = "index.php?module=user-users";
}

Zeile 2922Zeile 3116
	{
$view['custom_profile_fields'] = unserialize($view['custom_profile_fields']);
}

	{
$view['custom_profile_fields'] = unserialize($view['custom_profile_fields']);
}

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

	if(isset($mybb->input['username']))

	{
$view['conditions']['username'] = $mybb->input['username'];
}

	{
$view['conditions']['username'] = $mybb->input['username'];
}

Zeile 2934Zeile 3128
	{
// If this is a custom view we need to save everything ready to pass it on from page to page
global $admin_session;

	{
// If this is a custom view we need to save everything ready to pass it on from page to page
global $admin_session;

		if(!$_REQUEST['search_id'])

		if(!$mybb->input['search_id'])

		{
$search_id = md5(random_str());
$admin_session['data']['user_views'][$search_id] = $view;
update_admin_session('user_views', $admin_session['data']['user_views']);

		{
$search_id = md5(random_str());
$admin_session['data']['user_views'][$search_id] = $view;
update_admin_session('user_views', $admin_session['data']['user_views']);

			$_REQUEST['search_id'] = $search_id;

			$mybb->input['search_id'] = $search_id;

		}

		}

		$view['url'] .= "&amp;search_id=".htmlspecialchars($_REQUEST['search_id']);

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

	}

	}

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


if(isset($mybb->input['username']))
{

		$view['url'] .= "&amp;username=".urlencode(htmlspecialchars_uni($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']))
{
update_admin_session('last_users_url', str_replace("&amp;", "&", $view['url']));

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

	}


	}


	if(isset($view['conditions']['referrer'])){

	if(isset($view['conditions']['referrer'])){

		$view['url'] .= "&amp;action=referrers&amp;uid=".htmlspecialchars($view['conditions']['referrer']);

		$view['url'] .= "&amp;action=referrers&amp;uid=".htmlspecialchars_uni($view['conditions']['referrer']);

	}

	}

	



	// Do we not have any views?
if(empty($view))
{
return false;
}

	// Do we not have any views?
if(empty($view))
{
return false;
}

	



	$table = new Table;

// Build header for table based view

	$table = new Table;

// Build header for table based view

Zeile 2998Zeile 3192
	$user_like_fields = array("username", "email", "website", "icq", "aim", "yahoo", "msn", "signature", "usertitle");
foreach($user_like_fields as $search_field)
{

	$user_like_fields = array("username", "email", "website", "icq", "aim", "yahoo", "msn", "signature", "usertitle");
foreach($user_like_fields as $search_field)
{

		if($view['conditions'][$search_field] && !$view['conditions'][$search_field.'_blank'])

		if(!empty($view['conditions'][$search_field]) && !$view['conditions'][$search_field.'_blank'])

		{
$search_sql .= " AND u.{$search_field} LIKE '%".$db->escape_string_like($view['conditions'][$search_field])."%'";

		{
$search_sql .= " AND u.{$search_field} LIKE '%".$db->escape_string_like($view['conditions'][$search_field])."%'";

		}
else if(isset($view['conditions'][$search_field.'_blank']))

		}
else if(!empty($view['conditions'][$search_field.'_blank']))

		{
$search_sql .= " AND u.{$search_field} != ''";
}

		{
$search_sql .= " AND u.{$search_field} != ''";
}

Zeile 3012Zeile 3206
	$user_exact_fields = array("referrer");
foreach($user_exact_fields as $search_field)
{

	$user_exact_fields = array("referrer");
foreach($user_exact_fields as $search_field)
{

		if($view['conditions'][$search_field])

		if(!empty($view['conditions'][$search_field]))

		{
$search_sql .= " AND u.{$search_field}='".$db->escape_string($view['conditions'][$search_field])."'";

		{
$search_sql .= " AND u.{$search_field}='".$db->escape_string($view['conditions'][$search_field])."'";

		}
}

		}
}


// LESS THAN or GREATER THAN
$direction_fields = array("postnum");
foreach($direction_fields as $search_field)
{
$direction_field = $search_field."_dir";


// LESS THAN or GREATER THAN
$direction_fields = array("postnum");
foreach($direction_fields as $search_field)
{
$direction_field = $search_field."_dir";

		if(($view['conditions'][$search_field] || $view['conditions'][$search_field] === '0') && $view['conditions'][$direction_field])

		if(isset($view['conditions'][$search_field]) && ($view['conditions'][$search_field] || $view['conditions'][$search_field] === '0') && $view['conditions'][$direction_field])

		{
switch($view['conditions'][$direction_field])
{
case "greater_than":
$direction = ">";

		{
switch($view['conditions'][$direction_field])
{
case "greater_than":
$direction = ">";

					break;

					break;

				case "less_than":
$direction = "<";
break;

				case "less_than":
$direction = "<";
break;

Zeile 3044Zeile 3238
	$reg_fields = array("regdate");
foreach($reg_fields as $search_field)
{

	$reg_fields = array("regdate");
foreach($reg_fields as $search_field)
{

		if(intval($view['conditions'][$search_field]))

		if(!empty($view['conditions'][$search_field]) && intval($view['conditions'][$search_field]))

		{
$threshold = TIME_NOW - (intval($view['conditions'][$search_field]) * 24 * 60 * 60);


		{
$threshold = TIME_NOW - (intval($view['conditions'][$search_field]) * 24 * 60 * 60);


Zeile 3055Zeile 3249
	// IP searching
$ip_fields = array("regip", "lastip");
foreach($ip_fields as $search_field)

	// IP searching
$ip_fields = array("regip", "lastip");
foreach($ip_fields as $search_field)

	{
if($view['conditions'][$search_field])

	{
if(!empty($view['conditions'][$search_field]))

		{
// IPv6 IP
if(strpos($view['conditions'][$search_field], ":") !== false)

		{
// IPv6 IP
if(strpos($view['conditions'][$search_field], ":") !== false)

Zeile 3081Zeile 3275
	}

// Post IP searching

	}

// Post IP searching

	if($view['conditions']['postip'])

	if(!empty($view['conditions']['postip']))

	{
// IPv6 IP
if(strpos($view['conditions']['postip'], ":") !== false)

	{
// IPv6 IP
if(strpos($view['conditions']['postip'], ":") !== false)

Zeile 3110Zeile 3304
		$search_sql .= " AND u.uid IN(".implode(',', $ip_uids).")";
unset($ip_uids);
}

		$search_sql .= " AND u.uid IN(".implode(',', $ip_uids).")";
unset($ip_uids);
}

	



	// Custom Profile Field searching
if($view['custom_profile_fields'])
{

	// Custom Profile Field searching
if($view['custom_profile_fields'])
{

Zeile 3127Zeile 3321
					}

if($value == $lang->na)

					}

if($value == $lang->na)

					{

					{

						continue;
}


						continue;
}


Zeile 3145Zeile 3339
			else if(!empty($input))
{
if($input == $lang->na)

			else if(!empty($input))
{
if($input == $lang->na)

				{

				{

					continue;
}

					continue;
}

				



				if(strpos($column, '_blank') !== false)
{
$column = str_replace('_blank', '', $column);

				if(strpos($column, '_blank') !== false)
{
$column = str_replace('_blank', '', $column);

Zeile 3157Zeile 3351
				else
{
$userfield_sql .= ' AND '.$db->escape_string($column)." LIKE '%".$db->escape_string($input)."%'";

				else
{
$userfield_sql .= ' AND '.$db->escape_string($column)." LIKE '%".$db->escape_string($input)."%'";

				}
}
}


				}
}
}


		if($userfield_sql != '1=1')
{
$userfield_uids = array(0);

		if($userfield_sql != '1=1')
{
$userfield_uids = array(0);

Zeile 3168Zeile 3362
			while($userfield = $db->fetch_array($query))
{
$userfield_uids[] = $userfield['ufid'];

			while($userfield = $db->fetch_array($query))
{
$userfield_uids[] = $userfield['ufid'];

			}

			}

			$search_sql .= " AND u.uid IN(".implode(',', $userfield_uids).")";
unset($userfield_uids);
}
}

// Usergroup based searching

			$search_sql .= " AND u.uid IN(".implode(',', $userfield_uids).")";
unset($userfield_uids);
}
}

// Usergroup based searching

	if($view['conditions']['usergroup'])

	if(isset($view['conditions']['usergroup']))

	{
if(!is_array($view['conditions']['usergroup']))
{
$view['conditions']['usergroup'] = array($view['conditions']['usergroup']);

	{
if(!is_array($view['conditions']['usergroup']))
{
$view['conditions']['usergroup'] = array($view['conditions']['usergroup']);

		}


		}


		foreach($view['conditions']['usergroup'] as $usergroup)
{

		foreach($view['conditions']['usergroup'] as $usergroup)
{

 
			$usergroup = intval($usergroup);

if(!$usergroup)
{
continue;
}


			switch($db->type)
{
case "pgsql":

			switch($db->type)
{
case "pgsql":

Zeile 3194Zeile 3395
					$additional_sql .= "OR CONCAT(',',additionalgroups,',') LIKE '%,{$usergroup},%'";
}
}

					$additional_sql .= "OR CONCAT(',',additionalgroups,',') LIKE '%,{$usergroup},%'";
}
}

		$search_sql .= " AND (u.usergroup IN (".implode(",", $view['conditions']['usergroup']).") {$additional_sql})";



$search_sql .= " AND (u.usergroup IN (".implode(",", array_map('intval', $view['conditions']['usergroup'])).") {$additional_sql})";

	}

// COPPA users only?

	}

// COPPA users only?

	if($view['conditions']['coppa'])

	if(isset($view['conditions']['coppa']))

	{
$search_sql .= " AND u.coppauser=1 AND u.usergroup=5";
}

// Extra SQL?

	{
$search_sql .= " AND u.coppauser=1 AND u.usergroup=5";
}

// Extra SQL?

	if($view['extra_sql'])

	if(isset($view['extra_sql']))

	{
$search_sql .= $view['extra_sql'];
}

	{
$search_sql .= $view['extra_sql'];
}

Zeile 3216Zeile 3418
		WHERE {$search_sql}
");
$num_results = $db->fetch_field($query, "num_results");

		WHERE {$search_sql}
");
$num_results = $db->fetch_field($query, "num_results");

	



	// No matching results then return false
if(!$num_results)
{

	// No matching results then return false
if(!$num_results)
{

Zeile 3232Zeile 3434
		$view['perpage'] = intval($view['perpage']);

// Establish which page we're viewing and the starting index for querying

		$view['perpage'] = intval($view['perpage']);

// Establish which page we're viewing and the starting index for querying

		$mybb->input['page'] = intval($mybb->input['page']);










		// Establish which page we're viewing and the starting index for querying
if(!isset($mybb->input['page']))
{
$mybb->input['page'] = 1;
}
else
{
$mybb->input['page'] = intval($mybb->input['page']);
}


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

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

		}

		}

		else
{
$start = 0;
$mybb->input['page'] = 1;
}

		else
{
$start = 0;
$mybb->input['page'] = 1;
}

		



		$from_bit = "";

		$from_bit = "";

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

		if(isset($mybb->input['from']) && $mybb->input['from'] == "home")

		{
$from_bit = "&amp;from=home";
}

		{
$from_bit = "&amp;from=home";
}

		



		switch($view['sortby'])
{
case "regdate":

		switch($view['sortby'])
{
case "regdate":

Zeile 3259Zeile 3470
				break;
case "numposts":
$view['sortby'] = "postnum";

				break;
case "numposts":
$view['sortby'] = "postnum";

				break;			

				break;

			case "warninglevel":
$view['sortby'] = "warningpoints";
break;

			case "warninglevel":
$view['sortby'] = "warningpoints";
break;

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

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

		}


		}


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

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

		



		// Fetch matching users
$query = $db->query("
SELECT u.*

		// Fetch matching users
$query = $db->query("
SELECT u.*

Zeile 3282Zeile 3493
			ORDER BY {$view['sortby']} {$view['sortorder']}
LIMIT {$start}, {$view['perpage']}
");

			ORDER BY {$view['sortby']} {$view['sortorder']}
LIMIT {$start}, {$view['perpage']}
");

 
		$users = '';

		while($user = $db->fetch_array($query))

		while($user = $db->fetch_array($query))

		{			
$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'] = $usergroups[$user['usergroup']]['title'];
$additional_groups = explode(",", $user['additionalgroups']);

		{




			$comma = $groups_list = '';

			$comma = $groups_list = '';

			foreach($additional_groups as $group)
{
$groups_list .= "{$comma}{$usergroups[$group]['title']}";
$comma = $lang->comma;








			$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'])
{
$additional_groups = explode(",", $user['additionalgroups']);

foreach($additional_groups as $group)
{
$groups_list .= $comma.htmlspecialchars_uni($usergroups[$group]['title']);
$comma = $lang->comma;
}

			}
if(!$groups_list)
{
$groups_list = $lang->none;

			}
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($mybb->settings['dateformat'], $user['regdate']).", ".my_date($mybb->settings['timeformat'], $user['regdate']);

			$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($mybb->settings['dateformat'], $user['regdate']).", ".my_date($mybb->settings['timeformat'], $user['regdate']);

Zeile 3311Zeile 3527
			{
if($user['coppauser'])
{

			{
if($user['coppauser'])
{

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

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

				}
else
{

				}
else
{

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

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

				}
}


				}
}


Zeile 3329Zeile 3545
			if($usergroups[$user['usergroup']]['usereputationsystem'] == 1 && $mybb->settings['enablereputation'] == 1)
{
$user['view']['reputation'] = get_reputation($user['reputation']);

			if($usergroups[$user['usergroup']]['usereputationsystem'] == 1 && $mybb->settings['enablereputation'] == 1)
{
$user['view']['reputation'] = get_reputation($user['reputation']);

			}

			}

			else
{
$reputation = "-";
}

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

			else
{
$reputation = "-";
}

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

			{

			{

				$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 3348Zeile 3564
			if($user['avatar'] && !stristr($user['avatar'], 'http://'))
{
$user['avatar'] = "../{$user['avatar']}";

			if($user['avatar'] && !stristr($user['avatar'], 'http://'))
{
$user['avatar'] = "../{$user['avatar']}";

			}

			}

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

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

			{

			{

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

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

			}
else
{

			}
else
{

				$scaled_avatar = fetch_scaled_avatar($user, 34, 34);
}
if(!$user['avatar'])

				$scaled_avatar = fetch_scaled_avatar($user, 34, 34);
}
if(!$user['avatar'])

Zeile 3380Zeile 3596
			$table->construct_row();
}
}

			$table->construct_row();
}
}

	
if(!$view['table_id'])


if(!isset($view['table_id']))

	{
$view['table_id'] = "users_list";
}

	{
$view['table_id'] = "users_list";
}

Zeile 3414Zeile 3630
		$search_class = '';
$search_style = "text-align: right;";
}

		$search_class = '';
$search_style = "text-align: right;";
}

	



	$search_action = $view['url'];
// stop &username= in the query string
if($view_upos = strpos($search_action, '&amp;username='))

	$search_action = $view['url'];
// stop &username= in the query string
if($view_upos = strpos($search_action, '&amp;username='))

Zeile 3426Zeile 3642
	$built_view = $search->construct_return;
$built_view .= "<div class=\"{$search_class}\" style=\"padding-bottom: 3px; margin-top: -9px; {$search_style}\">";
$built_view .= $search->generate_hidden_field('action', 'search')."\n";

	$built_view = $search->construct_return;
$built_view .= "<div class=\"{$search_class}\" style=\"padding-bottom: 3px; margin-top: -9px; {$search_style}\">";
$built_view .= $search->generate_hidden_field('action', 'search')."\n";

	if($view['conditions']['username'])

	if(isset($view['conditions']['username']))

	{
$default_class = '';
$value = $view['conditions']['username'];

	{
$default_class = '';
$value = $view['conditions']['username'];

Zeile 3446Zeile 3662
		var form = document.getElementById('search_form');
form.onsubmit = function() {
var search = document.getElementById('search_keywords');

		var form = document.getElementById('search_form');
form.onsubmit = function() {
var search = document.getElementById('search_keywords');

			if(search.value == '' || search.value == '{$lang->search_for_user}')

			if(search.value == '' || search.value == '".addcslashes($lang->search_for_user, "'")."')

			{
search.focus();
return false;

			{
search.focus();
return false;

			}

			}

		}

var search = document.getElementById('search_keywords');
search.onfocus = function()
{

		}

var search = document.getElementById('search_keywords');
search.onfocus = function()
{

			if(this.value == '{$lang->search_for_user}')

			if(this.value == '".addcslashes($lang->search_for_user, "'")."')

			{
$(this).removeClassName('search_default');
this.value = '';

			{
$(this).removeClassName('search_default');
this.value = '';

Zeile 3467Zeile 3683
			if(this.value == '')
{
$(this).addClassName('search_default');

			if(this.value == '')
{
$(this).addClassName('search_default');

				this.value = '{$lang->search_for_user}';

				this.value = '".addcslashes($lang->search_for_user, "'")."';

			}
}
// fix the styling used if we have a different default value

			}
}
// fix the styling used if we have a different default value

        if(search.value != '{$lang->search_for_user}')
{
$(search).removeClassName('search_default');
}

		if(search.value != '".addcslashes($lang->search_for_user, "'")."')
{
$(search).removeClassName('search_default');
}

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

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

	



	// Autocompletion for usernames
$built_view .= '
<script type="text/javascript" src="../jscripts/autocomplete.js?ver=140"></script>

	// Autocompletion for usernames
$built_view .= '
<script type="text/javascript" src="../jscripts/autocomplete.js?ver=140"></script>

Zeile 3486Zeile 3702
		new autoComplete("search_keywords", "../xmlhttp.php?action=get_users", {valueSpan: "username"});
// -->
</script>';

		new autoComplete("search_keywords", "../xmlhttp.php?action=get_users", {valueSpan: "username"});
// -->
</script>';

	



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


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


	$built_view .= $pagination;




	if(isset($pagination))
{
$built_view .= $pagination;
}

	if($view['view_type'] != "card")
{
$checkbox = '';

	if($view['view_type'] != "card")
{
$checkbox = '';

	}

	}

	else
{
$checkbox = "<input type=\"checkbox\" name=\"allbox\" onclick=\"inlineModeration.checkAll(this)\" /> ";

	else
{
$checkbox = "<input type=\"checkbox\" name=\"allbox\" onclick=\"inlineModeration.checkAll(this)\" /> ";

	}

	}

	$built_view .= $table->construct_html("{$switch_view}<div>{$checkbox}{$lang->users}{$view_title}</div>", 1, "", $view['table_id']);

	$built_view .= $table->construct_html("{$switch_view}<div>{$checkbox}{$lang->users}{$view_title}</div>", 1, "", $view['table_id']);

	$built_view .= $pagination;




	if(isset($pagination))
{
$built_view .= $pagination;
}


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


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

Zeile 3550Zeile 3772
		}

$view_field = $user_view_fields[$field];

		}

$view_field = $user_view_fields[$field];

		



		// Special conditions for avatar
if($field == "avatar")

		// Special conditions for avatar
if($field == "avatar")

		{

		{

			$avatar = $user['view']['avatar'];
}
else if($field == "controls")

			$avatar = $user['view']['avatar'];
}
else if($field == "controls")

Zeile 3563Zeile 3785
		// Otherwise, just user data
else if($field != "username")
{

		// Otherwise, just user data
else if($field != "username")
{

			if($user['view'][$field])

			if(isset($user['view'][$field]))

			{
$value = $user['view'][$field];

			{
$value = $user['view'][$field];

			}

			}

			else
{
$value = $user[$field];
}

			else
{
$value = $user[$field];
}

			



			if($field == "postnum")
{
$value = my_number_format($value);
}

			if($field == "postnum")
{
$value = my_number_format($value);
}

			



			$user_details[] = "<strong>{$view_field['title']}:</strong> {$value}";
}


			$user_details[] = "<strong>{$view_field['title']}:</strong> {$value}";
}


Zeile 3648Zeile 3870
	$scaled_dimensions = array(
"width" => $max_width,
"height" => $max_height,

	$scaled_dimensions = array(
"width" => $max_width,
"height" => $max_height,

	);

	);


if($user['avatar'])
{
if($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, $max_width, $max_height);
}

			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']);
}

function output_custom_profile_fields($fields, $values, &$form_container, &$form, $search=false)
{
global $lang;

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

function output_custom_profile_fields($fields, $values, &$form_container, &$form, $search=false)
{
global $lang;

	



	if(!is_array($fields))
{
return;
}
foreach($fields as $profile_field)
{

	if(!is_array($fields))
{
return;
}
foreach($fields as $profile_field)
{

 
		$profile_field['name'] = htmlspecialchars_uni($profile_field['name']);
$profile_field['description'] = htmlspecialchars_uni($profile_field['description']);

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

		$profile_field['type'] = htmlspecialchars_uni($profile_field['type']);
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":

Zeile 3688Zeile 3912
				else
{
$user_options = $values[$field_name];

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

				}


				}


				foreach($user_options as $val)

				foreach($user_options as $val)

				{

				{

					$selected_options[$val] = $val;

					$selected_options[$val] = $val;

				}

				}


$select_options = explode("\n", $options);


$select_options = explode("\n", $options);

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

foreach($select_options as $val)
{
$val = trim($val);

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

foreach($select_options as $val)
{
$val = trim($val);

					$options[$val] = $val;
}
if(!$profile_field['length'])

					$options[$val] = $val;
}
if(!$profile_field['length'])

Zeile 3779Zeile 4003
				break;
case "textarea":
$extra = '';

				break;
case "textarea":
$extra = '';

				if($mybb->input['action'] == "search")

				if(isset($mybb->input['action']) && $mybb->input['action'] == "search")

				{
$extra = " {$lang->or} ".$form->generate_check_box("profile_fields[{$field_name}_blank]", 1, $lang->is_not_blank, array('id' => "{$field_name}_blank", 'checked' => $values[$field_name.'_blank']));
}

				{
$extra = " {$lang->or} ".$form->generate_check_box("profile_fields[{$field_name}_blank]", 1, $lang->is_not_blank, array('id' => "{$field_name}_blank", 'checked' => $values[$field_name.'_blank']));
}

Zeile 3788Zeile 4012
				break;
default:
$extra = '';

				break;
default:
$extra = '';

				if($mybb->input['action'] == "search")

				if(isset($mybb->input['action']) && $mybb->input['action'] == "search")

				{
$extra = " {$lang->or} ".$form->generate_check_box("profile_fields[{$field_name}_blank]", 1, $lang->is_not_blank, array('id' => "{$field_name}_blank", 'checked' => $values[$field_name.'_blank']));
}

				{
$extra = " {$lang->or} ".$form->generate_check_box("profile_fields[{$field_name}_blank]", 1, $lang->is_not_blank, array('id' => "{$field_name}_blank", 'checked' => $values[$field_name.'_blank']));
}

Zeile 3810Zeile 4034
	{
$input = $mybb->input;
}

	{
$input = $mybb->input;
}

	



	if(!is_array($input['conditions']))
{
$input['conditions'] = unserialize($input['conditions']);
}

	if(!is_array($input['conditions']))
{
$input['conditions'] = unserialize($input['conditions']);
}

	



	if(!is_array($input['profile_fields']))

	if(!is_array($input['profile_fields']))

	{

	{

		$input['profile_fields'] = unserialize($input['profile_fields']);

		$input['profile_fields'] = unserialize($input['profile_fields']);

	}


	}


	if(!is_array($input['fields']))
{
$input['fields'] = unserialize($input['fields']);
}

	if(!is_array($input['fields']))
{
$input['fields'] = unserialize($input['fields']);
}

	



	$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->email_address_contains, "", $form->generate_text_box('conditions[email]', $input['conditions']['email'], array('id' => 'email')), 'email');


	$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->email_address_contains, "", $form->generate_text_box('conditions[email]', $input['conditions']['email'], array('id' => 'email')), 'email');


 
	$options = array();

	$query = $db->simple_select("usergroups", "gid, title", "gid != '1'", array('order_by' => 'title'));
while($usergroup = $db->fetch_array($query))

	$query = $db->simple_select("usergroups", "gid, title", "gid != '1'", array('order_by' => 'title'));
while($usergroup = $db->fetch_array($query))

	{
$options[$usergroup['gid']] = $usergroup['title'];
}

	{
$options[$usergroup['gid']] = htmlspecialchars_uni($usergroup['title']);
}


$form_container->output_row($lang->is_member_of_groups, $lang->additional_user_groups_desc, $form->generate_select_box('conditions[usergroup][]', $options, $input['conditions']['usergroup'], array('id' => 'usergroups', 'multiple' => true, 'size' => 5)), 'usergroups');



$form_container->output_row($lang->is_member_of_groups, $lang->additional_user_groups_desc, $form->generate_select_box('conditions[usergroup][]', $options, $input['conditions']['usergroup'], array('id' => 'usergroups', 'multiple' => true, 'size' => 5)), 'usergroups');


Zeile 3858Zeile 4083
	$form_container->output_row($lang->posted_with_ip, $lang->wildcard, $form->generate_text_box('conditions[postip]', $input['conditions']['postip'], array('id' => 'postip')), 'postip');

$form_container->end();

	$form_container->output_row($lang->posted_with_ip, $lang->wildcard, $form->generate_text_box('conditions[postip]', $input['conditions']['postip'], array('id' => 'postip')), 'postip');

$form_container->end();

	



	// Custom profile fields go here
$form_container = new FormContainer($lang->custom_profile_fields_match);

	// Custom profile fields go here
$form_container = new FormContainer($lang->custom_profile_fields_match);

	



	// Fetch custom profile fields
$query = $db->simple_select("profilefields", "*", "", array('order_by' => 'disporder'));
while($profile_field = $db->fetch_array($query))

	// Fetch custom profile fields
$query = $db->simple_select("profilefields", "*", "", array('order_by' => 'disporder'));
while($profile_field = $db->fetch_array($query))

	{		

	{

		if($profile_field['required'] == 1)
{
$profile_fields['required'][] = $profile_field;

		if($profile_field['required'] == 1)
{
$profile_fields['required'][] = $profile_field;

Zeile 3875Zeile 4100
			$profile_fields['optional'][] = $profile_field;
}
}

			$profile_fields['optional'][] = $profile_field;
}
}

	



	output_custom_profile_fields($profile_fields['required'], $input['profile_fields'], $form_container, $form, true);
output_custom_profile_fields($profile_fields['optional'], $input['profile_fields'], $form_container, $form, true);

	output_custom_profile_fields($profile_fields['required'], $input['profile_fields'], $form_container, $form, true);
output_custom_profile_fields($profile_fields['optional'], $input['profile_fields'], $form_container, $form, true);

	



	$form_container->end();

	$form_container->end();

	



	// Autocompletion for usernames
echo '
<script type="text/javascript" src="../jscripts/autocomplete.js?ver=140"></script>

	// Autocompletion for usernames
echo '
<script type="text/javascript" src="../jscripts/autocomplete.js?ver=140"></script>