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

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

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

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

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

		}
else
{

		}
else
{

Zeile 393Zeile 393
	}

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

	}

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

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

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

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

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

Zeile 403Zeile 403
	$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 437Zeile 437

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


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

 
		$plugins->run_hooks("admin_user_users_edit_start");

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

		}


		}


		// Determine the usergroup stuff
if(is_array($mybb->input['additionalgroups']))
{

		// Determine the usergroup stuff
if(is_array($mybb->input['additionalgroups']))
{

Zeile 453Zeile 454
					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 472Zeile 473
			if(!$mybb->input['away_year'])
{
$mybb->input['away_year'] = my_date('Y', $awaydate);

			if(!$mybb->input['away_year'])
{
$mybb->input['away_year'] = my_date('Y', $awaydate);

			}


			}


			$return_month = (int)substr($mybb->input['away_month'], 0, 2);
$return_day = (int)substr($mybb->input['away_day'], 0, 2);

			$return_month = (int)substr($mybb->input['away_month'], 0, 2);
$return_day = (int)substr($mybb->input['away_day'], 0, 2);

			$return_year = min((int)$mybb->input['away_year'], 9999);

			$return_year = min($mybb->get_input('away_year', MyBB::INPUT_INT), 9999);


// Check if return date is after the away date.
$returntimestamp = gmmktime(0, 0, 0, $return_month, $return_day, $return_year);


// Check if return date is after the away date.
$returntimestamp = gmmktime(0, 0, 0, $return_month, $return_day, $return_year);

Zeile 492Zeile 493
		// Set up user handler.
require_once MYBB_ROOT."inc/datahandlers/user.php";
$userhandler = new UserDataHandler('update');

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





		// Set the data for the new user.
$updated_user = array(
"uid" => $mybb->input['uid'],

		// Set the data for the new user.
$updated_user = array(
"uid" => $mybb->input['uid'],

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

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

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

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

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

Zeile 522Zeile 521
			),
"style" => $mybb->input['style'],
"signature" => $mybb->input['signature'],

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

			"dateformat" => (int)$mybb->input['dateformat'],
"timeformat" => (int)$mybb->input['timeformat'],
"language" => $mybb->input['language'],

			"dateformat" => $mybb->get_input('dateformat', MyBB::INPUT_INT),
"timeformat" => $mybb->get_input('timeformat', MyBB::INPUT_INT),


			"usernotes" => $mybb->input['usernotes'],
"away" => array(
"away" => $mybb->input['away'],

			"usernotes" => $mybb->input['usernotes'],
"away" => array(
"away" => $mybb->input['away'],

Zeile 567Zeile 565
			"showcodebuttons" => $mybb->input['showcodebuttons'],
"sourceeditor" => $mybb->input['sourceeditor'],
"pmnotify" => $mybb->input['pmnotify'],

			"showcodebuttons" => $mybb->input['showcodebuttons'],
"sourceeditor" => $mybb->input['sourceeditor'],
"pmnotify" => $mybb->input['pmnotify'],

 
			"buddyrequestspm" => $mybb->input['buddyrequestspm'],
"buddyrequestsauto" => $mybb->input['buddyrequestsauto'],

			"showredirect" => $mybb->input['showredirect']
);

if($mybb->settings['usertppoptions'])
{

			"showredirect" => $mybb->input['showredirect']
);

if($mybb->settings['usertppoptions'])
{

			$updated_user['options']['tpp'] = (int)$mybb->input['tpp'];

			$updated_user['options']['tpp'] = $mybb->get_input('tpp', MyBB::INPUT_INT);

		}

if($mybb->settings['userpppoptions'])
{

		}

if($mybb->settings['userpppoptions'])
{

			$updated_user['options']['ppp'] = (int)$mybb->input['ppp'];

			$updated_user['options']['ppp'] = $mybb->get_input('ppp', MyBB::INPUT_INT);

		}

// Set the data of the user in the datahandler.

		}

// Set the data of the user in the datahandler.

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

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

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

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

				{

				{

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

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

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

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

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

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




















				}
else
{

				}
else
{

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














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

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

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

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





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

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

					}
else

					}
else

					{
$tmp_name = "../".$mybb->settings['avataruploadpath']."/remote_".md5(random_str());
$fp = @fopen($tmp_name, "wb");
if(!$fp)




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

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

						{
$avatar_error = $lang->error_invalidavatarurl;

						{
$avatar_error = $lang->error_invalidavatarurl;

						}
else

						}
else

						{

						{

							fwrite($fp, $file);
fclose($fp);
list($width, $height, $type) = @getimagesize($tmp_name);
@unlink($tmp_name);
echo $type;
if(!$type)

							$tmp_name = "../".$mybb->settings['avataruploadpath']."/remote_".md5(random_str());
$fp = @fopen($tmp_name, "wb");
if(!$fp)




							{
$avatar_error = $lang->error_invalidavatarurl;

							{
$avatar_error = $lang->error_invalidavatarurl;

							}
}
}

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










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

if(empty($avatar_error))

						{

						{

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













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

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

							{

							{

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

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


							}

							}

						}
}

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



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

						{

						{

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

							$errors = array($avatar_error);

						}

						}

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

 
					}
}
}

					}
}
}

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

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

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

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

							}
}
elseif(!$user[$option['update_field']])

							}
}
elseif(!$user[$option['update_field']])

Zeile 798Zeile 804
							}
}
}

							}
}
}

				}
}

				}
}


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


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

			}


			}


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

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

Zeile 829Zeile 835
				}

$plugins->run_hooks("admin_user_users_edit_commit");

				}

$plugins->run_hooks("admin_user_users_edit_commit");

 

if($user['usergroup'] == 5 && $mybb->input['usergroup'] != 5)
{
$cache->update_awaitingactivation();
}


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


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

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

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

 
			$plugins->run_hooks("admin_user_users_edit_end");

		}
}


		}
}


Zeile 868Zeile 880
	{
$mybb->input['bday'][0] = $mybb->input['bday1'];
$mybb->input['bday'][1] = $mybb->input['bday2'];

	{
$mybb->input['bday'][0] = $mybb->input['bday1'];
$mybb->input['bday'][1] = $mybb->input['bday2'];

		$mybb->input['bday'][2] = (int)$mybb->input['bday3'];

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

	}
else
{

	}
else
{

Zeile 882Zeile 894

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


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

		$mybb->input['away_year'] = (int)$mybb->input['away_year'];

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

	}
else
{

	}
else
{

Zeile 916Zeile 928

$page->extra_header .= <<<EOF



$page->extra_header .= <<<EOF


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


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

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


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


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

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

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

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

	}

$tabs = array(

	}

$tabs = array(

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

// Avatar

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

// Avatar

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

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
















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

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

	}
$avatar_top = ceil((126-$scaled_dimensions['height'])/2);
if($user['lastactive'])
{
$last_active = my_date('relative', $user['lastactive']);
}
else
{
$last_active = $lang->never;
}
$reg_date = my_date('relative', $user['regdate']);
if($user['dst'] == 1)
{
$timezone = $user['timezone']+1;












	}
if($user['avatar'] && (my_strpos($user['avatar'], '://') === false || $mybb->settings['allowremoteavatars']))
{
if(!my_validate_url($user['avatar']))
{
$avatar = format_avatar($user['avatar'], $user['avatardimensions']);
$user['avatar'] = $avatar['image'];
}
}
else
{
if(my_validate_url($mybb->settings['useravatar']))
{
$user['avatar'] = str_replace('{theme}', 'images', $mybb->settings['useravatar']);
}
else
{
$user['avatar'] = "../".str_replace('{theme}', 'images', $mybb->settings['useravatar']);
}
}
$avatar_top = ceil((126-$scaled_dimensions['height'])/2);
$last_seen = max(array($user['lastactive'], $user['lastvisit']));
if(!empty($last_seen))
{
$last_active = my_date('relative', $last_seen);

	}
else
{

	}
else
{

		$timezone = $user['timezone'];










		$last_active = $lang->never;
}
$reg_date = my_date('relative', $user['regdate']);
if($user['dst'] == 1)
{
$timezone = (float)$user['timezone']+1;
}
else
{
$timezone = (float)$user['timezone'];

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

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

Zeile 1051Zeile 1069

if($mybb->settings['enablewarningsystem'] != 0 && $user_permissions['canreceivewarnings'] != 0)
{


if($mybb->settings['enablewarningsystem'] != 0 && $user_permissions['canreceivewarnings'] != 0)
{

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


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

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

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


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


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



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

	echo "</div>\n";

//

	echo "</div>\n";

//

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


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


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

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

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

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

Zeile 1106Zeile 1131
	$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 1118Zeile 1143
	$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->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." <em>*</em>", "", $form->generate_select_box('displaygroup', $display_group_options, $mybb->input['displaygroup'], array('id' => 'displaygroup')), 'displaygroup');

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

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

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


// Output custom profile fields - required
if(!isset($profile_fields['required']))


// Output custom profile fields - required
if(!isset($profile_fields['required']))

Zeile 1130Zeile 1155

$form_container->end();



$form_container->end();


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

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

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

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

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

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



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


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


Zeile 1144Zeile 1167
	for($i = 1; $i <= 31; $i++)
{
$birthday_days[$i] = $i;

	for($i = 1; $i <= 31; $i++)
{
$birthday_days[$i] = $i;

	}

	}


$birthday_months = array(
0 => '',


$birthday_months = array(
0 => '',

Zeile 1164Zeile 1187

$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_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_numeric_field('bday3', $mybb->input['bday'][2], array('id' => 'bday_year', 'style' => 'width: 3em;'));

	$birthday_row .= ' '.$form->generate_numeric_field('bday3', $mybb->input['bday'][2], array('id' => 'bday_year', 'style' => 'width: 4em;', 'min' => 0));


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



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


Zeile 1176Zeile 1199

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


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

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

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

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

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

Zeile 1188Zeile 1211
		//Return date (we can use the arrays from birthday)
$return_row = $form->generate_select_box('away_day', $birthday_days, $mybb->input['away_day'], array('id' => 'away_day'));
$return_row .= ' '.$form->generate_select_box('away_month', $birthday_months, $mybb->input['away_month'], array('id' => 'away_month'));

		//Return date (we can use the arrays from birthday)
$return_row = $form->generate_select_box('away_day', $birthday_days, $mybb->input['away_day'], array('id' => 'away_day'));
$return_row .= ' '.$form->generate_select_box('away_month', $birthday_months, $mybb->input['away_month'], array('id' => 'away_month'));

		$return_row .= ' '.$form->generate_numeric_field('away_year', $mybb->input['away_year'], array('id' => 'away_year', 'style' => 'width: 3em;'));

		$return_row .= ' '.$form->generate_numeric_field('away_year', $mybb->input['away_year'], array('id' => 'away_year', 'style' => 'width: 4em;', 'min' => 0));


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

$form_container->end();
}



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

$form_container->end();
}


 
	$plugins->run_hooks("admin_user_users_edit_profile");

	echo "</div>\n";

//
// ACCOUNT SETTINGS
//

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

 

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


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

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

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

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

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

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

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

	{

	{

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


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


Zeile 1222Zeile 1244
		$form->generate_check_box("receivefrombuddy", 1, $lang->recieve_pms_from_buddy, array("checked" => $mybb->input['receivefrombuddy'])),
$form->generate_check_box("pmnotice", 1, $lang->alert_new_pms, array("checked" => $mybb->input['pmnotice'])),
$form->generate_check_box("pmnotify", 1, $lang->email_notify_new_pms, array("checked" => $mybb->input['pmnotify'])),

		$form->generate_check_box("receivefrombuddy", 1, $lang->recieve_pms_from_buddy, array("checked" => $mybb->input['receivefrombuddy'])),
$form->generate_check_box("pmnotice", 1, $lang->alert_new_pms, array("checked" => $mybb->input['pmnotice'])),
$form->generate_check_box("pmnotify", 1, $lang->email_notify_new_pms, array("checked" => $mybb->input['pmnotify'])),

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



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

	);

	);

 

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

// Output messaging options

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

$date_format_options = array($lang->use_default);
foreach($date_formats as $key => $format)

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

$date_format_options = array($lang->use_default);
foreach($date_formats as $key => $format)

	{

	{

		$date_format_options[$key] = my_date($format, TIME_NOW, "", 0);
}


		$date_format_options[$key] = my_date($format, TIME_NOW, "", 0);
}


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

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

 

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

// Output date options

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



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



Zeile 1278Zeile 1312
		"<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'))
);

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

 

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

// Output forum options

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

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

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

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

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

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

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







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

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


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



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


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

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

 

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

// Output other options

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

$form_container->end();

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

$form_container->end();

 
	$plugins->run_hooks("admin_user_users_edit_settings");

	echo "</div>\n";

//

	echo "</div>\n";

//

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

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

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

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

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

$periods = array(

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

$periods = array(

Zeile 1371Zeile 1421
		else
{
// There's a limit to the suspension!

		else
{
// There's a limit to the suspension!

			$expired = my_date('relative', $user['suspendsigtime']);
$lang->suspend_expire_info = $lang->sprintf($lang->suspend_expire_info, $expired);

















			$remaining = $user['suspendsigtime']-TIME_NOW;
$expired = nice_time($remaining, array('seconds' => false));

$color = 'inherit';
if($remaining < 3600)
{
$color = 'red';
}
elseif($remaining < 86400)
{
$color = 'maroon';
}
elseif($remaining < 604800)
{
$color = 'green';
}

$lang->suspend_expire_info = $lang->sprintf($lang->suspend_expire_info, $expired, $color);

		}
$user_suspend_info = '
<tr>
<td colspan="2">'.$lang->suspend_expire_info.'<br />'.$lang->suspend_sig_extend.'</td>
</tr>';

		}
$user_suspend_info = '
<tr>
<td colspan="2">'.$lang->suspend_expire_info.'<br />'.$lang->suspend_sig_extend.'</td>
</tr>';

	}
else

	}
else

	{
$sig_checked = 0;
$user_suspend_info = '';

	{
$sig_checked = 0;
$user_suspend_info = '';

Zeile 1410Zeile 1476
			<table cellpadding="4">'.$user_suspend_info.'
<tr>
<td width="30%"><small>'.$lang->expire_length.'</small></td>

			<table cellpadding="4">'.$user_suspend_info.'
<tr>
<td width="30%"><small>'.$lang->expire_length.'</small></td>

					<td>'.$form->generate_numeric_field('action_time', $mybb->input['action_time'], array('style' => 'width: 2em;')).' '.$form->generate_select_box('action_period', $periods, $mybb->input['action_period']).'</td>

					<td>'.$form->generate_numeric_field('action_time', $mybb->input['action_time'], array('style' => 'width: 3em;', 'min' => 0)).' '.$form->generate_select_box('action_period', $periods, $mybb->input['action_period']).'</td>

				</tr>
</table>
</dd>

				</tr>
</table>
</dd>

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

$form_container->end();

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

$form_container->end();

 
	$plugins->run_hooks("admin_user_users_edit_signatur");

	echo "</div>\n";

//

	echo "</div>\n";

//

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

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

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

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

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

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

Zeile 1460Zeile 1527

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'] != "")
{

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

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

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


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


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


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


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


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


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

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

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

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

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




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

	$form_container->end();

	$form_container->end();

 
	$plugins->run_hooks("admin_user_users_edit_avatar");

	echo "</div>\n";

//

	echo "</div>\n";

//

Zeile 1512Zeile 1583
	);

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

	);

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

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

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

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

// Mod posts

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

// Mod posts

Zeile 1526Zeile 1597
		$mybb->input['moderateposting'] = 1;
if($user['moderationtime'] != 0)
{

		$mybb->input['moderateposting'] = 1;
if($user['moderationtime'] != 0)
{

			$expired = my_date('relative', $user['moderationtime']);
$existing_info = $lang->sprintf($lang->moderate_length, $expired);

















			$remaining = $user['moderationtime']-TIME_NOW;
$expired = nice_time($remaining, array('seconds' => false));

$color = 'inherit';
if($remaining < 3600)
{
$color = 'red';
}
elseif($remaining < 86400)
{
$color = 'maroon';
}
elseif($remaining < 604800)
{
$color = 'green';
}

$existing_info = $lang->sprintf($lang->moderate_length, $expired, $color);

		}
else
{
$existing_info = $lang->moderated_perm;

		}
else
{
$existing_info = $lang->moderated_perm;

		}
}

$modpost_div = '<div id="modpost">'.$existing_info.''.$lang->moderate_for.' '.$form->generate_numeric_field("modpost_time", $mybb->input['modpost_time'], array('style' => 'width: 2em;')).' '.$modpost_options.'</div>';
$lang->moderate_posts_info = $lang->sprintf($lang->moderate_posts_info, $user['username']);
$form_container->output_row($form->generate_check_box("moderateposting", 1, $lang->moderate_posts, array("id" => "moderateposting", "onclick" => "toggleBox('modpost');", "checked" => $mybb->input['moderateposting'])), $lang->moderate_posts_info, $modpost_div);


		}
}

$modpost_div = '<div id="modpost">'.$existing_info.''.$lang->moderate_for.' '.$form->generate_numeric_field("modpost_time", $mybb->input['modpost_time'], array('style' => 'width: 3em;', 'min' => 0)).' '.$modpost_options.'</div>';
$lang->moderate_posts_info = $lang->sprintf($lang->moderate_posts_info, htmlspecialchars_uni($user['username']));
$form_container->output_row($form->generate_check_box("moderateposting", 1, $lang->moderate_posts, array("id" => "moderateposting", "onclick" => "toggleBox('modpost');", "checked" => $mybb->input['moderateposting'])), $lang->moderate_posts_info, $modpost_div);


	// Suspend posts
// Generate check box
$suspost_options = $form->generate_select_box('suspost_period', $periods, $mybb->input['suspost_period'], array('id' => 'suspost_period'));

// Do we have any existing suspensions here?
if($user['suspendposting'] || ($mybb->input['suspendposting'] && !empty($errors)))

	// Suspend posts
// Generate check box
$suspost_options = $form->generate_select_box('suspost_period', $periods, $mybb->input['suspost_period'], array('id' => 'suspost_period'));

// Do we have any existing suspensions here?
if($user['suspendposting'] || ($mybb->input['suspendposting'] && !empty($errors)))

	{

	{

		$mybb->input['suspendposting'] = 1;

if($user['suspensiontime'] == 0 || $mybb->input['suspost_period'] == "never")
{
$existing_info = $lang->suspended_perm;

		$mybb->input['suspendposting'] = 1;

if($user['suspensiontime'] == 0 || $mybb->input['suspost_period'] == "never")
{
$existing_info = $lang->suspended_perm;

		}

		}

		else
{

		else
{

			$suspost_date = my_date('relative', $user['suspensiontime']);
$existing_info = $lang->sprintf($lang->suspend_length, $suspost_date);

















			$remaining = $user['suspensiontime']-TIME_NOW;
$suspost_date = nice_time($remaining, array('seconds' => false));

$color = 'inherit';
if($remaining < 3600)
{
$color = 'red';
}
elseif($remaining < 86400)
{
$color = 'maroon';
}
elseif($remaining < 604800)
{
$color = 'green';
}

$existing_info = $lang->sprintf($lang->suspend_length, $suspost_date, $color);

		}
}


		}
}


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

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

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


$form_container->end();

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


$form_container->end();

 
	$plugins->run_hooks("admin_user_users_edit_moderator_options");

	echo "</div>\n";

$plugins->run_hooks("admin_user_users_edit_graph");

	echo "</div>\n";

$plugins->run_hooks("admin_user_users_edit_graph");

Zeile 1591Zeile 1695
		else if($("#moderateposting").is(":checked") == false)
{
$("#modpost").hide();

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

		}
}

		}
}

	else if(action == "suspost")
{
$("#moderateposting").attr("checked", false);
$("#modpost").hide();

if($("#suspendposting").is(":checked") == true)

	else if(action == "suspost")
{
$("#moderateposting").attr("checked", false);
$("#modpost").hide();

if($("#suspendposting").is(":checked") == true)

		{

		{

			$("#suspost").show();
}
else if($("#suspendposting").is(":checked") == false)

			$("#suspost").show();
}
else if($("#suspendposting").is(":checked") == false)

Zeile 1616Zeile 1720
else
{
$("#modpost").show();

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

}


}


if($("#suspendposting").is(":checked") == false)
{
$("#suspost").hide();
}
else

if($("#suspendposting").is(":checked") == false)
{
$("#suspost").hide();
}
else

{

{

	$("#suspost").show();
}

// -->
</script>';

	$("#suspost").show();
}

// -->
</script>';





	$page->output_footer();
}


	$page->output_footer();
}


Zeile 1641Zeile 1745
	if(!$user['uid'])
{
flash_message($lang->error_invalid_user, 'error');

	if(!$user['uid'])
{
flash_message($lang->error_invalid_user, 'error');

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

		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']))
{
flash_message($lang->error_no_perms_super_admin, 'error');


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

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

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

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


$plugins->run_hooks("admin_user_users_delete");



$plugins->run_hooks("admin_user_users_delete");


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

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






$cache->update_awaitingactivation();


		$plugins->run_hooks("admin_user_users_delete_commit_end");

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

		$plugins->run_hooks("admin_user_users_delete_commit_end");

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

Zeile 1690Zeile 1796
{
$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
);





	$plugins->run_hooks("admin_user_users_referrers");

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

	$plugins->run_hooks("admin_user_users_referrers");

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

Zeile 1713Zeile 1819
	if($mybb->input['type'])
{
$admin_view['view_type'] = $mybb->input['type'];

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

	}


	}


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

$view = build_users_view($admin_view);

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

$view = build_users_view($admin_view);





	// No referred users
if(!$view)
{

	// No referred users
if(!$view)
{

Zeile 1737Zeile 1843
}

if($mybb->input['action'] == "ipaddresses")

}

if($mybb->input['action'] == "ipaddresses")

{

{

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


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


Zeile 1748Zeile 1854
	);

$plugins->run_hooks("admin_user_users_ipaddresses");

	);

$plugins->run_hooks("admin_user_users_ipaddresses");





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

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

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

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

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

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

		$controls = '';
}

		$controls = '';
}

	else
{
$user['lastip'] = my_inet_ntop($db->unescape_binary($user['lastip']));
$popup = new PopupMenu("user_last", $lang->options);
$popup->add_item($lang->show_users_regged_with_ip,

	else
{
$user['lastip'] = my_inet_ntop($db->unescape_binary($user['lastip']));
$popup = new PopupMenu("user_last", $lang->options);
$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']))));

			"index.php?module=user-users&amp;action=search&amp;results=1&amp;conditions=".urlencode(my_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(my_serialize(array("postip" => $user['lastip']))));

		$popup->add_item($lang->info_on_ip, "index.php?module=user-users&amp;action=iplookup&ipaddress={$user['lastip']}", "MyBB.popupWindow('index.php?module=user-users&amp;action=iplookup&ipaddress={$user['lastip']}', null, true); return false;");
$popup->add_item($lang->ban_ip, "index.php?module=config-banning&amp;filter={$user['lastip']}");
$controls = $popup->fetch();

		$popup->add_item($lang->info_on_ip, "index.php?module=user-users&amp;action=iplookup&ipaddress={$user['lastip']}", "MyBB.popupWindow('index.php?module=user-users&amp;action=iplookup&ipaddress={$user['lastip']}', null, true); return false;");
$popup->add_item($lang->ban_ip, "index.php?module=config-banning&amp;filter={$user['lastip']}");
$controls = $popup->fetch();

Zeile 1786Zeile 1892
	{
$user['regip'] = $lang->unknown;
$controls = '';

	{
$user['regip'] = $lang->unknown;
$controls = '';

	}

	}

	else
{
$user['regip'] = my_inet_ntop($db->unescape_binary($user['regip']));
$popup = new PopupMenu("user_reg", $lang->options);

	else
{
$user['regip'] = my_inet_ntop($db->unescape_binary($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->show_users_regged_with_ip, "index.php?module=user-users&amp;results=1&amp;action=search&amp;conditions=".urlencode(my_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(my_serialize(array("postip" => $user['regip']))));

		$popup->add_item($lang->info_on_ip, "index.php?module=user-users&amp;action=iplookup&ipaddress={$user['regip']}", "MyBB.popupWindow('index.php?module=user-users&amp;action=iplookup&ipaddress={$user['regip']}', null, true); return false;");
$popup->add_item($lang->ban_ip, "index.php?module=config-banning&amp;filter={$user['regip']}");
$controls = $popup->fetch();

		$popup->add_item($lang->info_on_ip, "index.php?module=user-users&amp;action=iplookup&ipaddress={$user['regip']}", "MyBB.popupWindow('index.php?module=user-users&amp;action=iplookup&ipaddress={$user['regip']}', null, true); return false;");
$popup->add_item($lang->ban_ip, "index.php?module=config-banning&amp;filter={$user['regip']}");
$controls = $popup->fetch();

Zeile 1809Zeile 1915
		++$counter;
$ip['ipaddress'] = my_inet_ntop($db->unescape_binary($ip['ipaddress']));
$popup = new PopupMenu("id_{$counter}", $lang->options);

		++$counter;
$ip['ipaddress'] = my_inet_ntop($db->unescape_binary($ip['ipaddress']));
$popup = new PopupMenu("id_{$counter}", $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" => $ip['ipaddress']))));
$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" => $ip['ipaddress']))));

		$popup->add_item($lang->show_users_regged_with_ip, "index.php?module=user-users&amp;results=1&amp;action=search&amp;conditions=".urlencode(my_serialize(array("regip" => $ip['ipaddress']))));
$popup->add_item($lang->show_users_posted_with_ip, "index.php?module=user-users&amp;results=1&amp;action=search&amp;conditions=".urlencode(my_serialize(array("postip" => $ip['ipaddress']))));

		$popup->add_item($lang->info_on_ip, "index.php?module=user-users&amp;action=iplookup&ipaddress={$ip['ipaddress']}", "MyBB.popupWindow('index.php?module=user-users&amp;action=iplookup&ipaddress={$ip['ipaddress']}', null, true); 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, "index.php?module=user-users&amp;action=iplookup&ipaddress={$ip['ipaddress']}", "MyBB.popupWindow('index.php?module=user-users&amp;action=iplookup&ipaddress={$ip['ipaddress']}', null, true); return false;");
$popup->add_item($lang->ban_ip, "index.php?module=config-banning&amp;filter={$ip['ipaddress']}");
$controls = $popup->fetch();

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


		$table->construct_row();
}


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

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


$page->output_footer();
}


$page->output_footer();
}

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

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





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

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

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

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


		{

		{

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

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

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



		}

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

		}

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

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


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


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

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

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

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

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

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

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

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

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

 

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


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


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

 

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


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


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

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

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


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

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

 

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


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

Zeile 2046Zeile 2156
			}

$plugins->run_hooks("admin_user_users_merge_commit");

			}

$plugins->run_hooks("admin_user_users_merge_commit");

 

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

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

$cache->update_awaitingactivation();


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


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





			// Redirect!

			// Redirect!

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



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

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

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

	}

	}


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


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

Zeile 2078Zeile 2199
	// Autocompletion for usernames
echo '
<link rel="stylesheet" href="../jscripts/select2/select2.css">

	// Autocompletion for usernames
echo '
<link rel="stylesheet" href="../jscripts/select2/select2.css">

	<script type="text/javascript" src="../jscripts/select2/select2.min.js"></script>

	<script type="text/javascript" src="../jscripts/select2/select2.min.js?ver=1804"></script>

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

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

		placeholder: "Search for a user",
minimumInputLength: 3,
maximumSelectionSize: 3,
multiple: false,
ajax: { // instead of writing the function to execute the request we use Select2\'s convenient helper
url: "../xmlhttp.php?action=get_users",
dataType: \'json\',
data: function (term, page) {
return {
query: term // search term
};
},
results: function (data, page) { // parse the results into the format expected by Select2.
// since we are using custom formatting functions we do not need to alter remote JSON data
return {results: data};
}
},
initSelection: function(element, callback) {
var query = $(element).val();
if (query !== "") {
$.ajax("../xmlhttp.php?action=get_users&getone=1", {
data: {
query: query
},
dataType: "json"
}).done(function(data) { callback(data); });

		placeholder: "'.$lang->search_for_a_user.'",
minimumInputLength: 2,
multiple: false,
ajax: { // instead of writing the function to execute the request we use Select2\'s convenient helper
url: "../xmlhttp.php?action=get_users",
dataType: \'json\',
data: function (term, page) {
return {
query: term // search term
};
},
results: function (data, page) { // parse the results into the format expected by Select2.
// since we are using custom formatting functions we do not need to alter remote JSON data
return {results: data};
}
},
initSelection: function(element, callback) {
var query = $(element).val();
if (query !== "") {
$.ajax("../xmlhttp.php?action=get_users&getone=1", {
data: {
query: query
},
dataType: "json"
}).done(function(data) { callback(data); });


			}
}
});
$("#destination_username").select2({

			}
}
});
$("#destination_username").select2({

		placeholder: "Search for a user",
minimumInputLength: 3,
maximumSelectionSize: 3,

		placeholder: "'.$lang->search_for_a_user.'",
minimumInputLength: 2,


		multiple: false,
ajax: { // instead of writing the function to execute the request we use Select2\'s convenient helper
url: "../xmlhttp.php?action=get_users",

		multiple: false,
ajax: { // instead of writing the function to execute the request we use Select2\'s convenient helper
url: "../xmlhttp.php?action=get_users",

Zeile 2160Zeile 2279
		// Build view options from incoming search options
if($mybb->input['vid'])
{

		// Build view options from incoming search options
if($mybb->input['vid'])
{

			$query = $db->simple_select("adminviews", "*", "vid='".$mybb->get_input('vid', 1)."'");

			$query = $db->simple_select("adminviews", "*", "vid='".$mybb->get_input('vid', MyBB::INPUT_INT)."'");

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

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

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


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


		if($mybb->get_input('perpage', 1))

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

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

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

Zeile 2261Zeile 2380

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


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

	{

	{

		$page->output_inline_error($errors);
}


		$page->output_inline_error($errors);
}


Zeile 2280Zeile 2399
		"desc" => $lang->descending
);
$form_container->output_row($lang->sort_results_by, "", $form->generate_select_box('sortby', $sort_options, $mybb->input['sortby'], array('id' => 'sortby'))." {$lang->in} ".$form->generate_select_box('order', $sort_directions, $mybb->input['order'], array('id' => 'order')), 'sortby');

		"desc" => $lang->descending
);
$form_container->output_row($lang->sort_results_by, "", $form->generate_select_box('sortby', $sort_options, $mybb->input['sortby'], array('id' => 'sortby'))." {$lang->in} ".$form->generate_select_box('order', $sort_directions, $mybb->input['order'], array('id' => 'order')), 'sortby');

	$form_container->output_row($lang->results_per_page, "", $form->generate_numeric_field('perpage', $mybb->input['perpage'], array('id' => 'perpage')), 'perpage');

	$form_container->output_row($lang->results_per_page, "", $form->generate_numeric_field('perpage', $mybb->input['perpage'], array('id' => 'perpage', 'min' => 1)), 'perpage');

	$form_container->output_row($lang->display_results_as, "", $form->generate_radio_button('displayas', 'table', $lang->table, array('checked' => ($mybb->input['displayas'] != "card" ? true : false)))."<br />".$form->generate_radio_button('displayas', 'card', $lang->business_card, array('checked' => ($mybb->input['displayas'] == "card" ? true : false))));
$form_container->end();


	$form_container->output_row($lang->display_results_as, "", $form->generate_radio_button('displayas', 'table', $lang->table, array('checked' => ($mybb->input['displayas'] != "card" ? true : false)))."<br />".$form->generate_radio_button('displayas', 'card', $lang->business_card, array('checked' => ($mybb->input['displayas'] == "card" ? true : false))));
$form_container->end();


Zeile 2322Zeile 2441
		}
}


		}
}


	// If there isn't anything to select, then output an error













	// Verify incoming POST request
if(!verify_post_check($mybb->input['my_post_key']))
{
flash_message($lang->invalid_post_verify_key2, 'error');
admin_redirect("index.php?module=user-user");
}
$sub_tabs['manage_users'] = array(
"title" => $lang->manage_users,
"link" => "./",
"description" => $lang->manage_users_desc
);
$page->add_breadcrumb_item($lang->manage_users);


	if(!is_array($selected))
{

	if(!is_array($selected))
{

		if($mybb->input['inline_action'] != "multilift" && $mybb->request_method != "post")
{
$errors[] = $lang->error_inline_no_users_selected;
}

		// Not selected any users, show error
flash_message($lang->error_inline_no_users_selected, 'error');
admin_redirect("index.php?module=user-users".$vid_url);


	}

	}


if($errors)
{
// Don't show views, but show the user list if there's errors
$inline = true;
$mybb->input['action'] = '';
}
else


switch($mybb->input['inline_action'])







	{

	{

		// Let's continue!
// Verify incoming POST request
if(!verify_post_check($mybb->input['my_post_key']))
{
flash_message($lang->invalid_post_verify_key2, 'error');
admin_redirect("index.php?module=user-user");
}
$sub_tabs['manage_users'] = array(
"title" => $lang->manage_users,
"link" => "./",
"description" => $lang->manage_users_desc
);
$page->add_breadcrumb_item($lang->manage_users);

if(!is_array($selected))
{
// Not selected any users, show error
flash_message($lang->error_inline_no_users_selected, 'error');
admin_redirect("index.php?module=user-users".$vid_url);
}

switch($mybb->input['inline_action'])
{
case 'multiactivate':
// Run through the activating users, so that users already registered (but have been selected) aren't affected
if(is_array($selected))
{
$sql_array = implode(",", $selected);
$query = $db->simple_select("users", "uid", "usergroup = '5' AND uid IN (".$sql_array.")");
while($user = $db->fetch_array($query))
{
$to_update[] = $user['uid'];
}
}

if(is_array($to_update))
{
$sql_array = implode(",", $to_update);
$db->write_query("UPDATE ".TABLE_PREFIX."users SET usergroup = '2' WHERE uid IN (".$sql_array.")");
















































































































































































































		case 'multiactivate':
// Run through the activating users, so that users already registered (but have been selected) aren't affected
if(is_array($selected))
{
$sql_array = implode(",", $selected);
$query = $db->simple_select("users", "uid, username, email", "usergroup = '5' AND uid IN (".$sql_array.")");
$user_mail_data = array();
while($user = $db->fetch_array($query))
{
$to_update[] = $user['uid'];
$user_mail_data[] = array('username' => $user['username'], 'email' => $user['email']);
}
}

if(is_array($to_update))
{
$sql_array = implode(",", $to_update);
$db->write_query("UPDATE ".TABLE_PREFIX."users SET usergroup = '2' WHERE uid IN (".$sql_array.")");

$cache->update_awaitingactivation();

// send activation mail
foreach($user_mail_data as $mail_data)
{
$message = $lang->sprintf($lang->email_adminactivateaccount, $mail_data['username'], $mybb->settings['bbname'], $mybb->settings['bburl']);
my_mail($mail_data['email'], $lang->sprintf($lang->emailsubject_activateaccount, $mybb->settings['bbname']), $message);
}

// Action complete, grab stats and show success message - redirect user
$to_update_count = count($to_update);
$lang->inline_activated = $lang->sprintf($lang->inline_activated, my_number_format($to_update_count));

if(is_array($selected) && $to_update_count != count($selected))
{
// The update count is different to how many we selected!
$not_updated_count = count($selected) - $to_update_count;
$lang->inline_activated_more = $lang->sprintf($lang->inline_activated_more, my_number_format($not_updated_count));
$lang->inline_activated = $lang->inline_activated."<br />".$lang->inline_activated_more; // Add these stats to the message
}

$mybb->input['action'] = "inline_activated"; // Force a change to the action so we can add it to the adminlog
log_admin_action($to_update_count); // Add to adminlog
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
{
// 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
if($mybb->input['no'])
{
admin_redirect("index.php?module=user-users".$vid_url); // User clicked on 'No'
}

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);
while($ban = $db->fetch_array($query))
{
$updated_group = array(
"usergroup" => $ban['oldgroup'],
"additionalgroups" => $db->escape_string($ban['oldadditionalgroups']),
"displaygroup" => $ban['olddisplaygroup']
);
$db->update_query("users", $updated_group, "uid = '".$ban['uid']."'");
$db->delete_query("banned", "uid = '".$ban['uid']."'");
}

$cache->update_moderators();

$mybb->input['action'] = "inline_lift";
log_admin_action($to_be_unbanned);
my_unsetcookie("inlinemod_useracp");

$lang->success_ban_lifted = $lang->sprintf($lang->success_ban_lifted, my_number_format($to_be_unbanned));
flash_message($lang->success_ban_lifted, 'success');
admin_redirect("index.php?module=user-users".$vid_url);
}
else
{
$page->output_confirm_action("index.php?module=user-users&amp;action=inline_edit&amp;inline_action=multilift", $lang->confirm_multilift);
}

break;
case 'multiban':
if($mybb->input['processed'] == 1)
{
// We've posted ban information!
// Build an array of users to ban, =D
$sql_array = implode(",", $selected);
// Build a cache array for this users that have been banned already
$query = $db->simple_select("banned", "uid", "uid IN (".$sql_array.")");
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.")");

if($mybb->input['bantime'] == '---')
{
$lifted = 0;
}
else
{
$lifted = ban_date2timestamp($mybb->input['bantime']);
}

$reason = my_substr($mybb->input['reason'], 0, 255);

$banned_count = 0;
while($user = $db->fetch_array($query))
{
if($user['uid'] == $mybb->user['uid'] || is_super_admin($user['uid']))
{
// We remove ourselves and Super Admins from the mix
continue;
}

if(is_array($bannedcache) && in_array("u_".$user['uid'], $bannedcache))
{
// User already has a ban, update it!
$update_array = array(
"admin" => (int)$mybb->user['uid'],
"dateline" => TIME_NOW,
"bantime" => $db->escape_string($mybb->input['bantime']),
"lifted" => $db->escape_string($lifted),
"reason" => $db->escape_string($reason)
);
$db->update_query("banned", $update_array, "uid = '".$user['uid']."'");
}
else
{
// Not currently banned - insert the ban
$insert_array = array(
'uid' => $user['uid'],
'gid' => $mybb->get_input('usergroup', MyBB::INPUT_INT),
'oldgroup' => $user['usergroup'],
'oldadditionalgroups' => $db->escape_string($user['additionalgroups']),
'olddisplaygroup' => $user['displaygroup'],
'admin' => (int)$mybb->user['uid'],
'dateline' => TIME_NOW,
'bantime' => $db->escape_string($mybb->input['bantime']),
'lifted' => $db->escape_string($lifted),
'reason' => $db->escape_string($reason)
);
$db->insert_query('banned', $insert_array);
}

// Moved the user to the 'Banned' Group
$update_array = array(
'usergroup' => 7,
'displaygroup' => 0,
'additionalgroups' => '',
);
$db->update_query('users', $update_array, "uid = '{$user['uid']}'");

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

++$banned_count;
}
$mybb->input['action'] = "inline_banned";
log_admin_action($banned_count, $lifted);
my_unsetcookie("inlinemod_useracp"); // Remove the cookie of selected users as we've finished with them

$lang->users_banned = $lang->sprintf($lang->users_banned, $banned_count);
flash_message($lang->users_banned, 'success');
admin_redirect("index.php?module=user-users".$vid_url);
}

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

// Provide the user with a warning of what they're about to do
$table = new Table;
$lang->mass_ban_info = $lang->sprintf($lang->mass_ban_info, count($selected));
$table->construct_cell($lang->mass_ban_info);
$table->construct_row();
$table->output($lang->important);

// If there's any errors, display inline
if($errors)
{
$page->output_inline_error($errors);
}

$form = new Form("index.php?module=user-users", "post");
echo $form->generate_hidden_field('action', 'inline_edit');
echo $form->generate_hidden_field('inline_action', 'multiban');
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_area('reason', $mybb->input['reason'], array('id' => 'reason', 'maxlength' => '255')), 'reason');
$ban_times = fetch_ban_times();
foreach($ban_times as $time => $period)
{
if($time != '---')
{
$friendly_time = my_date("D, jS M Y @ {$mybb->settings['timeformat']}", ban_date2timestamp($time));
$period = "{$period} ({$friendly_time})";
}
$length_list[$time] = $period;
}
$form_container->output_row($lang->ban_time, "", $form->generate_select_box('bantime', $length_list, $mybb->input['bantime'], array('id' => 'bantime')), 'bantime');
$form_container->end();

$buttons[] = $form->generate_submit_button($lang->ban_users);
$form->output_submit_wrapper($buttons);
$form->end();
$page->output_footer();
break;
case 'multidelete':
if($mybb->input['no'])
{
admin_redirect("index.php?module=user-users".$vid_url); // User clicked on 'No
}
else
{
if($mybb->input['processed'] == 1)
{
// Set up user handler.
require_once MYBB_ROOT.'inc/datahandlers/user.php';
$userhandler = new UserDataHandler('delete');

// Delete users
$deleted = $userhandler->delete_user($selected);
$to_be_deleted = $deleted['deleted_users']; // Get the correct number of deleted users

// Update forum stats, remove the cookie and redirect the user
my_unsetcookie("inlinemod_useracp");
$mybb->input['action'] = "inline_delete";
log_admin_action($to_be_deleted);

$lang->users_deleted = $lang->sprintf($lang->users_deleted, $to_be_deleted);


					$cache->update_awaitingactivation();


					$cache->update_awaitingactivation();


					// Action complete, grab stats and show success message - redirect user
$to_update_count = count($to_update);
$lang->inline_activated = $lang->sprintf($lang->inline_activated, my_number_format($to_update_count));




















































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

$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)
{
if(($mybb->input['day'] || $mybb->input['month'] || $mybb->input['year']) && $mybb->input['set'])
{
$errors[] = $lang->multi_selected_dates;
}

$day = $mybb->get_input('day', MyBB::INPUT_INT);
$month = $mybb->get_input('month', MyBB::INPUT_INT);
$year = $mybb->get_input('year', MyBB::INPUT_INT);

// Selected a date - check if the date the user entered is valid
if($mybb->input['day'] || $mybb->input['month'] || $mybb->input['year'])
{
// Is the date sort of valid?
if($day < 1 || $day > 31 || $month < 1 || $month > 12 || ($month == 2 && $day > 29))
{
$errors[] = $lang->incorrect_date;
}

// Check the month
$months = get_bdays($year);
if($day > $months[$month-1])
{
$errors[] = $lang->incorrect_date;
}

// Check the year
if($year != 0 && ($year < (date("Y")-100)) || $year > date("Y"))
{
$errors[] = $lang->incorrect_date;
}

if(!$errors)
{
// No errors, so let's continue and set the date to delete from
$date = mktime(date('H'), date('i'), date('s'), $month, $day, $year); // Generate a unix time stamp
}
}
elseif($mybb->input['set'] > 0)
{
// Set options
// For this purpose, 1 month = 31 days
$base_time = 24 * 60 * 60;





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

					switch($mybb->input['set'])

					{

					{

						// The update count is different to how many we selected!
$not_updated_count = count($selected) - $to_update_count;
$lang->inline_activated_more = $lang->sprintf($lang->inline_activated_more, my_number_format($not_updated_count));
$lang->inline_activated = $lang->inline_activated."<br />".$lang->inline_activated_more; // Add these stats to the message















						case '1':
$threshold = $base_time * 31; // 1 month = 31 days, in the standard terms
break;
case '2':
$threshold = $base_time * 93; // 3 months = 31 days * 3
break;
case '3':
$threshold = $base_time * 183; // 6 months = 365 days / 2
break;
case '4':
$threshold = $base_time * 365; // 1 year = 365 days
break;
case '5':
$threshold = $base_time * 548; // 18 months = 365 + 183
break;
case '6':
$threshold = $base_time * 730; // 2 years = 365 * 2
break;

					}


					}


					$mybb->input['action'] = "inline_activated"; // Force a change to the action so we can add it to the adminlog
log_admin_action($to_update_count); // Add to adminlog
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);




					if(!$threshold)
{
// An option was entered that isn't in the dropdown box
$errors[] = $lang->no_set_option;
}
else
{
$date = TIME_NOW - $threshold;
}

				}
else

				}
else

				{
// 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
if($mybb->input['no'])
{
admin_redirect("index.php?module=user-users".$vid_url); // User clicked on 'No'
}

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);
while($ban = $db->fetch_array($query))
{
$updated_group = array(
"usergroup" => $ban['oldgroup'],
"additionalgroups" => $ban['oldadditionalgroups'],
"displaygroup" => $ban['olddisplaygroup']
);
$db->update_query("users", $updated_group, "uid = '".$ban['uid']."'");
$db->delete_query("banned", "uid = '".$ban['uid']."'");
}

$cache->update_banned();
$cache->update_moderators();

$mybb->input['action'] = "inline_lift";
log_admin_action($to_be_unbanned);
my_unsetcookie("inlinemod_useracp");

$lang->success_ban_lifted = $lang->sprintf($lang->success_ban_lifted, my_number_format($to_be_unbanned));
flash_message($lang->success_ban_lifted, 'success');
admin_redirect("index.php?module=user-users".$vid_url);
}
else
{
$page->output_confirm_action("index.php?module=user-users&amp;action=inline_edit&amp;inline_action=multilift", $lang->confirm_multilift);

				{
$errors[] = $lang->no_prune_option;










































				}

				}


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


if(!$errors)



				{

				{

					// We've posted ban information!
// Build an array of users to ban, =D

 
					$sql_array = implode(",", $selected);

					$sql_array = implode(",", $selected);

					// Build a cache array for this users that have been banned already
$query = $db->simple_select("banned", "uid", "uid IN (".$sql_array.")");

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

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

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

if($mybb->input['bantime'] == '---')
{
$lifted = 0;
}
else
{
$lifted = ban_date2timestamp($mybb->input['bantime']);
}

$reason = my_substr($mybb->input['reason'], 0, 255);

$banned_count = 0;
while($user = $db->fetch_array($query))
{
if($user['uid'] == $mybb->user['uid'] || is_super_admin($user['uid']))
{
// We remove ourselves and Super Admins from the mix
continue;
}

if(is_array($bannedcache) && in_array("u_".$user['uid'], $bannedcache))
{
// User already has a ban, update it!
$update_array = array(
"admin" => (int)$mybb->user['uid'],
"dateline" => TIME_NOW,
"bantime" => $db->escape_string($mybb->input['bantime']),
"lifted" => $db->escape_string($lifted),
"reason" => $db->escape_string($reason)
);
$db->update_query("banned", $update_array, "uid = '".$user['uid']."'");
}
else
{
// Not currently banned - insert the ban
$insert_array = array(
'uid' => $user['uid'],
'gid' => (int)$mybb->input['usergroup'],
'oldgroup' => $user['usergroup'],
'oldadditionalgroups' => $user['additionalgroups'],
'olddisplaygroup' => $user['displaygroup'],
'admin' => (int)$mybb->user['uid'],
'dateline' => TIME_NOW,
'bantime' => $db->escape_string($mybb->input['bantime']),
'lifted' => $db->escape_string($lifted),
'reason' => $db->escape_string($reason)
);
$db->insert_query('banned', $insert_array);
}

// Moved the user to the 'Banned' Group
$update_array = array(
'usergroup' => 7,
'displaygroup' => 0,
'additionalgroups' => '',
);
$db->update_query('users', $update_array, "uid = '{$user['uid']}'");

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

$cache->update_banned();
++$banned_count;
}
$mybb->input['action'] = "inline_banned";
log_admin_action($banned_count, $lifted);
my_unsetcookie("inlinemod_useracp"); // Remove the cookie of selected users as we've finished with them

$lang->users_banned = $lang->sprintf($lang->users_banned, $banned_count);
flash_message($lang->users_banned, 'success');
admin_redirect("index.php?module=user-users".$vid_url);
}

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

// Provide the user with a warning of what they're about to do
$table = new Table;
$lang->mass_ban_info = $lang->sprintf($lang->mass_ban_info, count($selected));
$table->construct_cell($lang->mass_ban_info);
$table->construct_row();
$table->output($lang->important);

// If there's any errors, display inline
if($errors)
{
$page->output_inline_error($errors);
}

$form = new Form("index.php?module=user-users", "post");
echo $form->generate_hidden_field('action', 'inline_edit');
echo $form->generate_hidden_field('inline_action', 'multiban');
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_area('reason', $mybb->input['reason'], array('id' => 'reason', 'maxlength' => '255')), 'reason');
$ban_times = fetch_ban_times();
foreach($ban_times as $time => $period)
{
if($time != '---')
{
$friendly_time = my_date("D, jS M Y @ g:ia", ban_date2timestamp($time));
$period = "{$period} ({$friendly_time})";
}
$length_list[$time] = $period;
}
$form_container->output_row($lang->ban_time, "", $form->generate_select_box('bantime', $length_list, $mybb->input['bantime'], array('id' => 'bantime')), 'bantime');
$form_container->end();

$buttons[] = $form->generate_submit_button($lang->ban_users);
$form->output_submit_wrapper($buttons);
$form->end();
$page->output_footer();
break;
case 'multidelete':
if($mybb->input['no'])
{
admin_redirect("index.php?module=user-users".$vid_url); // User clicked on 'No
}
else
{
if($mybb->input['processed'] == 1)
{
// Set up user handler.
require_once MYBB_ROOT.'inc/datahandlers/user.php';
$userhandler = new UserDataHandler('delete');

// Delete users
$deleted = $userhandler->delete_user($selected);
$to_be_deleted = $deleted['deleted_users']; // Get the correct number of deleted users

// Update forum stats, remove the cookie and redirect the user
my_unsetcookie("inlinemod_useracp");
$mybb->input['action'] = "inline_delete";
log_admin_action($to_be_deleted);

$lang->users_deleted = $lang->sprintf($lang->users_deleted, $to_be_deleted);
flash_message($lang->users_deleted, 'success');
admin_redirect("index.php?module=user-users".$vid_url);
}

$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)
{
if(($mybb->input['day'] || $mybb->input['month'] || $mybb->input['year']) && $mybb->input['set'])
{
$errors[] = $lang->multi_selected_dates;
}

$day = (int)$mybb->input['day'];
$month = (int)$mybb->input['month'];
$year = (int)$mybb->input['year'];

// Selected a date - check if the date the user entered is valid
if($mybb->input['day'] || $mybb->input['month'] || $mybb->input['year'])
{
// Is the date sort of valid?
if($day < 1 || $day > 31 || $month < 1 || $month > 12 || ($month == 2 && $day > 29))
{
$errors[] = $lang->incorrect_date;
}

// Check the month
$months = get_bdays($year);
if($day > $months[$month]-1)
{
$errors[] = $lang->incorrect_date;
}

// Check the year
if($year != 0 && ($year < (date("Y")-100)) || $year > date("Y"))

						// Protect Super Admins
if(is_super_admin($user['uid']) && !is_super_admin($mybb->user['uid']))





















































































































































































						{

						{

							$errors[] = $lang->incorrect_date;

							continue;

						}


						}


						if(!$errors)
{
// No errors, so let's continue and set the date to delete from
$date = mktime(date('H'), date('i'), date('s'), $month, $day, $year); // Generate a unix time stamp
}
}
elseif($mybb->input['set'] > 0)
{
// Set options
// For this purpose, 1 month = 31 days
$base_time = 24 * 60 * 60;

switch($mybb->input['set'])
{
case '1':
$threshold = $base_time * 31; // 1 month = 31 days, in the standard terms
break;
case '2':
$threshold = $base_time * 93; // 3 months = 31 days * 3
break;
case '3':
$threshold = $base_time * 183; // 6 months = 365 days / 2
break;
case '4':
$threshold = $base_time * 365; // 1 year = 365 days
break;
case '5':
$threshold = $base_time * 548; // 18 months = 365 + 183
break;
case '6':
$threshold = $base_time * 730; // 2 years = 365 * 2
break;
}

if(!$threshold)
{
// An option was entered that isn't in the dropdown box
$errors[] = $lang->no_set_option;
}
else

						$return_array = delete_user_posts($user['uid'], $date); // Delete user posts, and grab a list of threads to delete
if($return_array && is_array($return_array))
{
$prune_array = array_merge_recursive($prune_array, $return_array);
}
}

// No posts were found for the user, return error
if(!is_array($prune_array) || count($prune_array) == 0)
{
flash_message($lang->prune_fail, 'error');
admin_redirect("index.php?module=user-users".$vid_url);
}

// Require the rebuild functions
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)
{
foreach($prune_array['to_delete'] as $tid)



















						{

						{

							$date = TIME_NOW - $threshold;

















							$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("threadsread", "tid='$tid'");
$db->delete_query("threadratings", "tid='$tid'");
}
}

// After deleting threads, rebuild the thread counters for the affected threads
if(is_array($prune_array['thread_update']) && count($prune_array['thread_update']) > 0)
{
$sql_array = implode(",", $prune_array['thread_update']);
$query = $db->simple_select("threads", "tid", "tid IN (".$sql_array.")", array('order_by' => 'tid', 'order_dir' => 'asc'));
while($thread = $db->fetch_array($query))
{
rebuild_thread_counters($thread['tid']);

						}
}

						}
}

					else
{
$errors[] = $lang->no_prune_option;
}

if(!$errors)


// After updating thread counters, update the affected forum counters
if(is_array($prune_array['forum_update']) && count($prune_array['forum_update']) > 0)




					{

					{

						$sql_array = implode(",", $selected);
$prune_array = array();
$query = $db->simple_select("users", "uid", "uid IN (".$sql_array.")");
while($user = $db->fetch_array($query))

						$sql_array = implode(",", $prune_array['forum_update']);
$query = $db->simple_select("forums", "fid", "fid IN (".$sql_array.")", array('order_by' => 'fid', 'order_dir' => 'asc'));
while($forum = $db->fetch_array($query))


						{

						{

							// Protect Super Admins
if(is_super_admin($user['uid']) && !is_super_admin($mybb->user['uid']))

							// Because we have a recursive array merge, check to see if there isn't a duplicated forum to update
if($looped_forum == $forum['fid'])

							{
continue;
}

							{
continue;
}


$return_array = delete_user_posts($user['uid'], $date); // Delete user posts, and grab a list of threads to delete
if($return_array && is_array($return_array))
{
$prune_array = array_merge_recursive($prune_array, $return_array);
}
}

// No posts were found for the user, return error
if(!is_array($prune_array) || count($prune_array) == 0)
{
flash_message($lang->prune_fail, 'error');
admin_redirect("index.php?module=user-users".$vid_url);

							$looped_forum = $forum['fid'];
rebuild_forum_counters($forum['fid']);












						}

						}

 
					}

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

$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));
$table->construct_cell($lang->mass_prune_info);
$table->construct_row();
$table->output($lang->important);

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

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

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

// Generate a list of days (1 - 31)
$day_options = array();
$day_options[] = "&nbsp;";
for($i = 1; $i <= 31; ++$i)
{
$day_options[] = $i;
}

// Generate a list of months (1 - 12)
$month_options = array();
$month_options[] = "&nbsp;";
for($i = 1; $i <= 12; ++$i)
{
$string = "month_{$i}";
$month_options[] = $lang->$string;
}
$date_box = $form->generate_select_box('day', $day_options, $mybb->input['day']);
$month_box = $form->generate_select_box('month', $month_options, $mybb->input['month']);
$year_box = $form->generate_numeric_field('year', $mybb->input['year'], array('id' => 'year', 'style' => 'width: 50px;', 'min' => 0));

$prune_select = $date_box.$month_box.$year_box;
$form_container->output_row($lang->manual_date, "", $prune_select, 'date');





						// Require the rebuild functions
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)
{
foreach($prune_array['to_delete'] as $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("threadsread", "tid='$tid'");
$db->delete_query("threadratings", "tid='$tid'");
}
}

			// Generate the set date box
$set_options = array();
$set_options[] = $lang->set_an_option;
for($i = 1; $i <= 6; ++$i)
{
$string = "option_{$i}";
$set_options[] = $lang->$string;
}

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











						// After deleting threads, rebuild the thread counters for the affected threads
if(is_array($prune_array['thread_update']) && count($prune_array['thread_update']) > 0)
{
$sql_array = implode(",", $prune_array['thread_update']);
$query = $db->simple_select("threads", "tid", "tid IN (".$sql_array.")", array('order_by' => 'tid', 'order_dir' => 'asc'));
while($thread = $db->fetch_array($query))
{
rebuild_thread_counters($thread['tid']);
}
}

// After updating thread counters, update the affected forum counters
if(is_array($prune_array['forum_update']) && count($prune_array['forum_update']) > 0)


			$buttons[] = $form->generate_submit_button($lang->prune_posts);
$form->output_submit_wrapper($buttons);
$form->end();
$page->output_footer();
break;
case 'multiusergroup':
if($mybb->input['processed'] == 1)
{
// Determine additional usergroups
if(is_array($mybb->input['additionalgroups']))
{
foreach($mybb->input['additionalgroups'] as $key => $gid)
{
if($gid == $mybb->input['usergroup'])

						{

						{

							$sql_array = implode(",", $prune_array['forum_update']);
$query = $db->simple_select("forums", "fid", "fid IN (".$sql_array.")", array('order_by' => 'fid', 'order_dir' => 'asc'));
while($forum = $db->fetch_array($query))
{
// Because we have a recursive array merge, check to see if there isn't a duplicated forum to update
if($looped_forum == $forum['fid'])
{
continue;
}
$looped_forum = $forum['fid'];
rebuild_forum_counters($forum['fid']);
}
}

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

$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));
$table->construct_cell($lang->mass_prune_info);
$table->construct_row();
$table->output($lang->important);

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

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

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

// Generate a list of days (1 - 31)
$day_options = array();
$day_options[] = "&nbsp;";
for($i = 1; $i <= 31; ++$i)
{
$day_options[] = $i;
}

// Generate a list of months (1 - 12)
$month_options = array();
$month_options[] = "&nbsp;";
for($i = 1; $i <= 12; ++$i)
{
$string = "month_{$i}";
$month_options[] = $lang->$string;
}
$date_box = $form->generate_select_box('day', $day_options, $mybb->input['day']);
$month_box = $form->generate_select_box('month', $month_options, $mybb->input['month']);
$year_box = $form->generate_numeric_field('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');

// Generate the set date box
$set_options = array();
$set_options[] = $lang->set_an_option;
for($i = 1; $i <= 6; ++$i)
{
$string = "option_{$i}";
$set_options[] = $lang->$string;
}

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

$buttons[] = $form->generate_submit_button($lang->prune_posts);
$form->output_submit_wrapper($buttons);
$form->end();
$page->output_footer();
break;
case 'multiusergroup':
if($mybb->input['processed'] == 1)
{
// Determine additional usergroups
if(is_array($mybb->input['additionalgroups']))
{
foreach($mybb->input['additionalgroups'] as $key => $gid)
{
if($gid == $mybb->input['usergroup'])
{
unset($mybb->input['additionalgroups'][$key]);
}
}

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

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






































































































					}


					}


					// Create an update array
$update_array = array(
"usergroup" => (int)$mybb->input['usergroup'],
"additionalgroups" => $additionalgroups,
"displaygroup" => (int)$mybb->input['displaygroup']
);

// Do the usergroup update for all those selected
// If the a selected user is a super admin, don't update that user
foreach($selected as $user)
{
if(!is_super_admin($user))
{
$users_to_update[] = $user;
}
}

$to_update_count = count($users_to_update);
if($to_update_count > 0 && is_array($users_to_update))
{
// Update the users in the database
$sql = implode(",", $users_to_update);
$db->update_query("users", $update_array, "uid IN (".$sql.")");

// Redirect the admin...
$mybb->input['action'] = "inline_usergroup";
log_admin_action($to_update_count);
my_unsetcookie("inlinemod_useracp");
flash_message($lang->success_mass_usergroups, 'success');
admin_redirect("index.php?module=user-users".$vid_url);
}
else

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

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

// Do the usergroup update for all those selected
// If the a selected user is a super admin, don't update that user
$users_to_update = array();
foreach($selected as $user)
{
if(!is_super_admin($user))













					{

					{

						// They tried to edit super admins! Uh-oh!
$errors[] = $lang->no_usergroup_changed;

						$users_to_update[] = $user;


					}
}


					}
}


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

// Display a table warning
$table = new Table;
$lang->usergroup_info = $lang->sprintf($lang->usergroup_info, count($selected));
$table->construct_cell($lang->usergroup_info);
$table->construct_row();
$table->output($lang->important);

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

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

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

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

				$to_update_count = count($users_to_update);
if($to_update_count > 0)



























				{

				{

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









					// Update the users in the database
$sql = implode(",", $users_to_update);
$db->update_query("users", $update_array, "uid IN (".$sql.")");

// Redirect the admin...
$mybb->input['action'] = "inline_usergroup";
log_admin_action($to_update_count);
my_unsetcookie("inlinemod_useracp");
flash_message($lang->success_mass_usergroups, 'success');
admin_redirect("index.php?module=user-users".$vid_url);

				}

				}


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

				else


				{

				{

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


					// They tried to edit super admins! Uh-oh!
$errors[] = $lang->no_usergroup_changed;

				}

				}

 
			}

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





				$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->end();

$buttons[] = $form->generate_submit_button($lang->alter_usergroups);
$form->output_submit_wrapper($buttons);
$form->end();
$page->output_footer();
break;
}



































			// Display a table warning
$table = new Table;
$lang->usergroup_info = $lang->sprintf($lang->usergroup_info, count($selected));
$table->construct_cell($lang->usergroup_info);
$table->construct_row();
$table->output($lang->important);

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

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

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

// 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))
{
$options[$usergroup['gid']] = htmlspecialchars_uni($usergroup['title']);
$display_group_options[$usergroup['gid']] = htmlspecialchars_uni($usergroup['title']);
}

if(!is_array($mybb->input['additionalgroups']))
{
$mybb->input['additionalgroups'] = explode(',', $mybb->input['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->end();

$buttons[] = $form->generate_submit_button($lang->alter_usergroups);
$form->output_submit_wrapper($buttons);
$form->end();
$page->output_footer();
break;

	}
}

	}
}





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

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

{
$plugins->run_hooks("admin_user_users_start");


{
$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>";


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

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

			$query = $db->simple_select("adminviews", "*", "vid='".$mybb->get_input('vid', 1)."'");

			$query = $db->simple_select("adminviews", "*", "vid='".$mybb->get_input('vid', MyBB::INPUT_INT)."'");

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

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

Zeile 3038Zeile 3149
	$page->output_footer();
}


	$page->output_footer();
}


 
/**
* @param array $view
*
* @return string
*/

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

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

 

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


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


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

	{

	{

		$title_string = "view_title_{$view['vid']}";

if($lang->$title_string)

		$title_string = "view_title_{$view['vid']}";

if($lang->$title_string)

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

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

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

	}
if($view['vid'])
{

	}
if($view['vid'])
{

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

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

	}

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

 
	}

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

	}

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

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

// List of valid LIKE search fields

	// Build the search SQL for users

// List of valid LIKE search fields

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

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

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

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

Zeile 3288Zeile 3405
				}
else
{

				}
else
{

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

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

				}
}
}

				}
}
}

Zeile 3380Zeile 3497
		}
else
{

		}
else
{

			$mybb->input['page'] = $mybb->get_input('page', 1);

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

		}

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

		}

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

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

		}
else
{

		}
else
{

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

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

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

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

			$user['view']['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'];

			$user['view']['usergroup'] = htmlspecialchars_uni($usergroups[$user['usergroup']]['title']);

			if($user['additionalgroups'])
{
$additional_groups = explode(",", $user['additionalgroups']);

foreach($additional_groups as $group)
{

			if($user['additionalgroups'])
{
$additional_groups = explode(",", $user['additionalgroups']);

foreach($additional_groups as $group)
{

					$groups_list .= "{$comma}{$usergroups[$group]['title']}";

					$groups_list .= $comma.htmlspecialchars_uni($usergroups[$group]['title']);

					$comma = $lang->comma;
}
}

					$comma = $lang->comma;
}
}

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

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

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









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


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


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

Zeile 3476Zeile 3608
			{
// Not banned... but soon maybe!
$popup->add_item($lang->ban_user, "index.php?module=user-banning&amp;uid={$user['uid']}#username");

			{
// Not banned... but soon maybe!
$popup->add_item($lang->ban_user, "index.php?module=user-banning&amp;uid={$user['uid']}#username");

			}


			}


			if($user['usergroup'] == 5)
{
if($user['coppauser'])

			if($user['usergroup'] == 5)
{
if($user['coppauser'])

				{

				{

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

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

			}

			}


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


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

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

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

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

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

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

// Fetch the reputation for this user
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)

			{






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


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

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

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

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


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







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

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

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

			{
$max_dimensions = '80x80';

			}
else
{

			}
else
{

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

				$max_dimensions = '34x34';

			}

			}

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


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

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



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


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

Zeile 3565Zeile 3697
	$switch_url = $view['url'];
if($mybb->input['page'] > 0)
{

	$switch_url = $view['url'];
if($mybb->input['page'] > 0)
{

		$switch_url .= "&amp;page=".$mybb->get_input('page', 1);

		$switch_url .= "&amp;page=".$mybb->get_input('page', MyBB::INPUT_INT);

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

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

Zeile 3574Zeile 3706
	else
{
$switch_view .= "<a href=\"{$switch_url}&amp;type=table\" style=\"font-weight: normal;\">{$lang->table_view}</a> | <strong>{$lang->card_view}</strong>";

	else
{
$switch_view .= "<a href=\"{$switch_url}&amp;type=table\" style=\"font-weight: normal;\">{$lang->table_view}</a> | <strong>{$lang->card_view}</strong>";

	}

	}

	$switch_view .= "</div>";

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

	$switch_view .= "</div>";

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

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


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

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

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

	}

	}

	else
{
$search_class = '';

	else
{
$search_class = '';

Zeile 3605Zeile 3738
	{
$default_class = '';
$value = $view['conditions']['username'];

	{
$default_class = '';
$value = $view['conditions']['username'];

	}

	}

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

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

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

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

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

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

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

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

		form.submit(function() {

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

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

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

				search.focus();

				search.trigger('focus');

				return false;

				return false;

			}

			}

		});

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

		});

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

		search.focus(function()

		search.on('focus', function()

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

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

Zeile 3637Zeile 3770
				searched_focus.removeClass(\"search_default\");
searched_focus.val(\"\");
}

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

		});

search.blur(function()

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



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

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

Zeile 3681Zeile 3812
	}

$built_view .= '

	}

$built_view .= '

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

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

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

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

Zeile 3710Zeile 3841
	return $built_view;
}


	return $built_view;
}


 
/**
* @param array $user
* @param array $view
* @param int $i
*
* @return string
*/

function build_user_view_card($user, $view, &$i)
{
global $user_view_fields;

function build_user_view_card($user, $view, &$i)
{
global $user_view_fields;

Zeile 3771Zeile 3909
	}

// And build the final card

	}

// And build the final card

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

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

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

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

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

	if($avatar)

	if($avatar)

	{

	{

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

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

Zeile 3789Zeile 3932
	return $card;

}

	return $card;

}









/**
* @param array $user
* @param array $view
* @param DefaultTable $table
*/

function build_user_view_table($user, $view, &$table)
{
global $user_view_fields;

function build_user_view_table($user, $view, &$table)
{
global $user_view_fields;

Zeile 3799Zeile 3947
		if(!$user_view_fields[$field])
{
continue;

		if(!$user_view_fields[$field])
{
continue;

		}

		}

		$view_field = $user_view_fields[$field];
$field_options = array();
if($view_field['align'])

		$view_field = $user_view_fields[$field];
$field_options = array();
if($view_field['align'])

Zeile 3809Zeile 3957
		if($user['view'][$field])
{
$value = $user['view'][$field];

		if($user['view'][$field])
{
$value = $user['view'][$field];

		}
else
{

		}
else
{

			$value = $user[$field];
}

if($field == "postnum")

			$value = $user[$field];
}

if($field == "postnum")

		{

		{

			$value = my_number_format($user[$field]);
}
$table->construct_cell($value, $field_options);

			$value = my_number_format($user[$field]);
}
$table->construct_cell($value, $field_options);

	}

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


	}

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


	$table->construct_row();
}


	$table->construct_row();
}


function fetch_scaled_avatar($user, $max_width=80, $max_height=80)
{
$scaled_dimensions = array(
"width" => $max_width,
"height" => $max_height,
);

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

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


/**
* @param array $fields
* @param array $values
* @param DefaultFormContainer $form_container
* @param DefaultForm $form
* @param bool $search
*/














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

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

	global $lang;

	global $lang, $mybb;


if(!is_array($fields))


if(!is_array($fields))

	{

	{

		return;
}
foreach($fields as $profile_field)
{

		return;
}
foreach($fields as $profile_field)
{

		$profile_field['type'] = htmlspecialchars_uni($profile_field['type']);


		$profile_field['name'] = htmlspecialchars_uni($profile_field['name']);
$profile_field['description'] = htmlspecialchars_uni($profile_field['description']);

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

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





		switch($type)
{
case "multiselect":

		switch($type)
{
case "multiselect":

 
				$selected_options = array();

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

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

Zeile 3872Zeile 4009
				else
{
$user_options = $values[$field_name];

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

				}

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

				}


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

				}

$select_options = explode("\n", $options);

				}

$select_options = explode("\n", $options);

Zeile 3888Zeile 4025
				}

foreach($select_options as $val)

				}

foreach($select_options as $val)

				{
$val = trim($val);

				{
$val = htmlspecialchars_uni(trim($val));

					$options[$val] = $val;
}
if(!$profile_field['length'])

					$options[$val] = $val;
}
if(!$profile_field['length'])

Zeile 3899Zeile 4036
				$code = $form->generate_select_box("profile_fields[{$field_name}][]", $options, $selected_options, array('id' => "profile_field_{$field_name}", 'multiple' => true, 'size' => $profile_field['length']));
break;
case "select":

				$code = $form->generate_select_box("profile_fields[{$field_name}][]", $options, $selected_options, array('id' => "profile_field_{$field_name}", 'multiple' => true, 'size' => $profile_field['length']));
break;
case "select":

				$select_options = array();
if($search == true)

				$select_options = array();
if($search == true)

				{
$select_options[''] = $lang->na;
}

				{
$select_options[''] = $lang->na;
}

Zeile 3908Zeile 4045
				$options = array();
foreach($select_options as $val)
{

				$options = array();
foreach($select_options as $val)
{

					$val = trim($val);

					$val = htmlspecialchars_uni(trim($val));

					$options[$val] = $val;

					$options[$val] = $val;

				}

				}

				if(!$profile_field['length'])
{
$profile_field['length'] = 1;

				if(!$profile_field['length'])
{
$profile_field['length'] = 1;

				}
if($search == true)

				}
if($search == true)

				{

				{

					$code = $form->generate_select_box("profile_fields[{$field_name}][{$field_name}]", $options, $values[$field_name], array('id' => "profile_field_{$field_name}", 'size' => $profile_field['length']));

					$code = $form->generate_select_box("profile_fields[{$field_name}][{$field_name}]", $options, htmlspecialchars_uni($values[$field_name]), array('id' => "profile_field_{$field_name}", 'size' => $profile_field['length']));

				}
else

				}
else

				{
$code = $form->generate_select_box("profile_fields[{$field_name}]", $options, $values[$field_name], array('id' => "profile_field_{$field_name}", 'size' => $profile_field['length']));
}

				{
$code = $form->generate_select_box("profile_fields[{$field_name}]", $options, htmlspecialchars_uni($values[$field_name]), array('id' => "profile_field_{$field_name}", 'size' => $profile_field['length']));
}

				break;
case "radio":
$radio_options = array();
if($search == true)

				break;
case "radio":
$radio_options = array();
if($search == true)

				{

				{

					$radio_options[''] = $lang->na;
}
$radio_options += explode("\n", $options);

					$radio_options[''] = $lang->na;
}
$radio_options += explode("\n", $options);

Zeile 3935Zeile 4072
				foreach($radio_options as $val)
{
$val = trim($val);

				foreach($radio_options as $val)
{
$val = trim($val);

					$code .= $form->generate_radio_button("profile_fields[{$field_name}]", $val, $val, array('id' => "profile_field_{$field_name}", 'checked' => ($val == $values[$field_name] ? true : false)))."<br />";

					$code .= $form->generate_radio_button("profile_fields[{$field_name}]", $val, htmlspecialchars_uni($val), array('id' => "profile_field_{$field_name}", 'checked' => ($val == $values[$field_name] ? true : false)))."<br />";

				}
break;
case "checkbox":

				}
break;
case "checkbox":

 
				$select_options = array();

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

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

				}

				}

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

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

 

$selected_options = array();

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

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

				$select_options = array();



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

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

Zeile 3961Zeile 4101
				foreach($select_options as $val)
{
$val = trim($val);

				foreach($select_options as $val)
{
$val = trim($val);

					$code .= $form->generate_check_box("profile_fields[{$field_name}][]", $val, $val, array('id' => "profile_field_{$field_name}", 'checked' => ($val == $selected_options[$val] ? true : false)))."<br />";
}
break;

					$code .= $form->generate_check_box("profile_fields[{$field_name}][]", $val, htmlspecialchars_uni($val), array('id' => "profile_field_{$field_name}", 'checked' => ($val == $selected_options[$val] ? true : false)))."<br />";
}
break;

			case "textarea":

			case "textarea":

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

				}

$code = $form->generate_text_area("profile_fields[{$field_name}]", $values[$field_name], array('id' => "profile_field_{$field_name}", 'rows' => 6, 'cols' => 50)).$extra;

				}

$code = $form->generate_text_area("profile_fields[{$field_name}]", $values[$field_name], array('id' => "profile_field_{$field_name}", 'rows' => 6, 'cols' => 50)).$extra;

Zeile 3982Zeile 4122

$code = $form->generate_text_box("profile_fields[{$field_name}]", $values[$field_name], array('id' => "profile_field_{$field_name}", 'maxlength' => $profile_field['maxlength'], 'length' => $profile_field['length'])).$extra;
break;


$code = $form->generate_text_box("profile_fields[{$field_name}]", $values[$field_name], array('id' => "profile_field_{$field_name}", 'maxlength' => $profile_field['maxlength'], 'length' => $profile_field['length'])).$extra;
break;

		}

		}


$form_container->output_row($profile_field['name'], $profile_field['description'], $code, "", array('id' => "profile_field_{$field_name}"));
$code = $user_options = $selected_options = $radio_options = $val = $options = '';


$form_container->output_row($profile_field['name'], $profile_field['description'], $code, "", array('id' => "profile_field_{$field_name}"));
$code = $user_options = $selected_options = $radio_options = $val = $options = '';

	}

	}

}


}


 
/**
* @param array $input
* @param DefaultForm $form
*/

function user_search_conditions($input=array(), &$form)
{
global $mybb, $db, $lang;

function user_search_conditions($input=array(), &$form)
{
global $mybb, $db, $lang;

Zeile 4009Zeile 4153
	}

if(!is_array($input['fields']))

	}

if(!is_array($input['fields']))

	{

	{

		$input['fields'] = my_unserialize($input['fields']);
}

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

		$input['fields'] = my_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->username_contains, "", $form->generate_text_box('conditions[username]', htmlspecialchars_uni($input['conditions']['username']), array('id' => 'username')), 'username');

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

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

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

	{
$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->website_contains, "", $form->generate_text_box('conditions[website]', $input['conditions']['website'], array('id' => 'website'))." {$lang->or} ".$form->generate_check_box('conditions[website_blank]', 1, $lang->is_not_blank, array('id' => 'website_blank', 'checked' => $input['conditions']['website_blank'])), 'website');

	$form_container->output_row($lang->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->website_contains, "", $form->generate_text_box('conditions[website]', $input['conditions']['website'], array('id' => 'website'))." {$lang->or} ".$form->generate_check_box('conditions[website_blank]', 1, $lang->is_not_blank, array('id' => 'website_blank', 'checked' => $input['conditions']['website_blank'])), 'website');

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

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



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

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

Zeile 4039Zeile 4181
		"is_exactly" => $lang->is_exactly,
"less_than" => $lang->less_than
);

		"is_exactly" => $lang->is_exactly,
"less_than" => $lang->less_than
);

	$form_container->output_row($lang->post_count_is, "", $form->generate_select_box('conditions[postnum_dir]', $greater_options, $input['conditions']['postnum_dir'], array('id' => 'numposts_dir'))." ".$form->generate_numeric_field('conditions[postnum]', $input['conditions']['postnum'], array('id' => 'numposts')), 'numposts');
$form_container->output_row($lang->thread_count_is, "", $form->generate_select_box('conditions[threadnum_dir]', $greater_options, $input['conditions']['threadnum_dir'], array('id' => 'numthreads_dir'))." ".$form->generate_numeric_field('conditions[threadnum]', $input['conditions']['threadnum'], array('id' => 'numthreads')), 'numthreads');

	$form_container->output_row($lang->post_count_is, "", $form->generate_select_box('conditions[postnum_dir]', $greater_options, $input['conditions']['postnum_dir'], array('id' => 'numposts_dir'))." ".$form->generate_text_box('conditions[postnum]', $input['conditions']['postnum'], array('id' => 'numposts')), 'numposts');
$form_container->output_row($lang->thread_count_is, "", $form->generate_select_box('conditions[threadnum_dir]', $greater_options, $input['conditions']['threadnum_dir'], array('id' => 'numthreads_dir'))." ".$form->generate_text_box('conditions[threadnum]', $input['conditions']['threadnum'], array('id' => 'numthreads')), 'numthreads');


$form_container->output_row($lang->reg_in_x_days, '', $form->generate_text_box('conditions[regdate]', $input['conditions']['regdate'], array('id' => 'regdate')).' '.$lang->days, 'regdate');
$form_container->output_row($lang->reg_ip_matches, $lang->wildcard, $form->generate_text_box('conditions[regip]', $input['conditions']['regip'], array('id' => 'regip')), 'regip');


$form_container->output_row($lang->reg_in_x_days, '', $form->generate_text_box('conditions[regdate]', $input['conditions']['regdate'], array('id' => 'regdate')).' '.$lang->days, 'regdate');
$form_container->output_row($lang->reg_ip_matches, $lang->wildcard, $form->generate_text_box('conditions[regip]', $input['conditions']['regip'], array('id' => 'regip')), 'regip');

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


Zeile 4065Zeile 4207
		else
{
$profile_fields['optional'][] = $profile_field;

		else
{
$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);

$form_container->end();

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





	// Autocompletion for usernames
echo '
<link rel="stylesheet" href="../jscripts/select2/select2.css">

	// Autocompletion for usernames
echo '
<link rel="stylesheet" href="../jscripts/select2/select2.css">

<script type="text/javascript" src="../jscripts/select2/select2.min.js"></script>

<script type="text/javascript" src="../jscripts/select2/select2.min.js?ver=1804"></script>

<script type="text/javascript">
<!--
$("#username").select2({

<script type="text/javascript">
<!--
$("#username").select2({

	placeholder: "Search for a user",
minimumInputLength: 3,
maximumSelectionSize: 3,

	placeholder: "'.$lang->search_for_a_user.'",
minimumInputLength: 2,


	multiple: false,
ajax: { // instead of writing the function to execute the request we use Select2\'s convenient helper
url: "../xmlhttp.php?action=get_users",

	multiple: false,
ajax: { // instead of writing the function to execute the request we use Select2\'s convenient helper
url: "../xmlhttp.php?action=get_users",

Zeile 4106Zeile 4247
				},
dataType: "json"
}).done(function(data) { callback(data); });

				},
dataType: "json"
}).done(function(data) { callback(data); });

		}
}

		}
}

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

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

 
}

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

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

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

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

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

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

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

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

}

}