Vergleich admin/modules/user/users.php - 1.8.10 - 1.8.11

  Keine Änderungen   Hinzugefügt   Modifiziert   Entfernt
Zeile 437Zeile 437

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


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

 
		$plugins->run_hooks("admin_user_users_edit_start");

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

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

Zeile 848Zeile 849
				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 1114Zeile 1116

$username = htmlspecialchars_uni($user['username']);
$table->output("{$lang->user_overview}: {$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 1221Zeile 1224
		$form_container->end();
}


		$form_container->end();
}


 
	$plugins->run_hooks("admin_user_users_edit_profile");

	echo "</div>\n";

//

	echo "</div>\n";

//

Zeile 1346Zeile 1350
	$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 1480Zeile 1485
	$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 1545Zeile 1551
		$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->output_row($lang->or_specify_avatar_url, "", $form->generate_text_box('avatar_url', $avatar_url, array('id' => 'avatar_url')), 'avatar_url');
}
$form_container->end();

 
	$plugins->run_hooks("admin_user_users_edit_avatar");

	echo "</div>\n";

//

	echo "</div>\n";

//

Zeile 1644Zeile 1651


$form_container->end();



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

Zeile 2001Zeile 2011
						continue;
}
}

						continue;
}
}





				$last_result = array(
"rid" => $rep['rid'],
"uid" => $rep['uid']

				$last_result = array(
"rid" => $rep['rid'],
"uid" => $rep['uid']

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

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





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

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

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

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

		placeholder: "'.$lang->search_for_a_user.'",
minimumInputLength: 2,
multiple: false,
ajax: { // instead of writing the function to execute the request we use Select2\'s convenient helper
url: "../xmlhttp.php?action=get_users",
dataType: \'json\',
data: function (term, page) {

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

				return {
query: term // search term
};

Zeile 2242Zeile 2252
	{
// 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', 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']))
{
unset($admin_view);
}
}


		{
$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']))
{
unset($admin_view);
}
}


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

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

Zeile 2393Zeile 2403
		}

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

		}

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

	}

	}


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


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

Zeile 2535Zeile 2545
				}

// Collect the users

				}

// Collect the users

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

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


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


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

Zeile 3103Zeile 3113
	if($errors)
{
if($inline != true)

	if($errors)
{
if($inline != true)

		{

		{

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

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

Zeile 3243Zeile 3253
	// EXACT matching fields
$user_exact_fields = array("referrer");
foreach($user_exact_fields as $search_field)

	// EXACT matching fields
$user_exact_fields = array("referrer");
foreach($user_exact_fields as $search_field)

	{

	{

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

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

		}

		}

	}

// LESS THAN or GREATER THAN

	}

// LESS THAN or GREATER THAN

Zeile 3256Zeile 3266
	{
$direction_field = $search_field."_dir";
if(isset($view['conditions'][$search_field]) && ($view['conditions'][$search_field] || $view['conditions'][$search_field] === '0') && $view['conditions'][$direction_field])

	{
$direction_field = $search_field."_dir";
if(isset($view['conditions'][$search_field]) && ($view['conditions'][$search_field] || $view['conditions'][$search_field] === '0') && $view['conditions'][$direction_field])

		{

		{

			switch($view['conditions'][$direction_field])
{
case "greater_than":

			switch($view['conditions'][$direction_field])
{
case "greater_than":

Zeile 3279Zeile 3289
		if(!empty($view['conditions'][$search_field]) && (int)$view['conditions'][$search_field])
{
$threshold = TIME_NOW - ((int)$view['conditions'][$search_field] * 24 * 60 * 60);

		if(!empty($view['conditions'][$search_field]) && (int)$view['conditions'][$search_field])
{
$threshold = TIME_NOW - ((int)$view['conditions'][$search_field] * 24 * 60 * 60);





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

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

		}
}


		}
}


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

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

	{

	{

		if(!empty($view['conditions'][$search_field]))
{
$ip_range = fetch_ip_range($view['conditions'][$search_field]);
if(!is_array($ip_range))

		if(!empty($view['conditions'][$search_field]))
{
$ip_range = fetch_ip_range($view['conditions'][$search_field]);
if(!is_array($ip_range))

			{

			{

				$ip_sql = "{$search_field}=".$db->escape_binary($ip_range);
}
else

				$ip_sql = "{$search_field}=".$db->escape_binary($ip_range);
}
else

Zeile 3300Zeile 3310
				$ip_sql = "{$search_field} BETWEEN ".$db->escape_binary($ip_range[0])." AND ".$db->escape_binary($ip_range[1]);
}
$search_sql .= " AND {$ip_sql}";

				$ip_sql = "{$search_field} BETWEEN ".$db->escape_binary($ip_range[0])." AND ".$db->escape_binary($ip_range[1]);
}
$search_sql .= " AND {$ip_sql}";

		}

		}

	}

// Post IP searching

	}

// Post IP searching

Zeile 3314Zeile 3324
		else
{
$ip_sql = "ipaddress BETWEEN ".$db->escape_binary($ip_range[0])." AND ".$db->escape_binary($ip_range[1]);

		else
{
$ip_sql = "ipaddress BETWEEN ".$db->escape_binary($ip_range[0])." AND ".$db->escape_binary($ip_range[1]);

		}

		}

		$ip_uids = array(0);
$query = $db->simple_select("posts", "uid", $ip_sql);
while($uid = $db->fetch_field($query, "uid"))

		$ip_uids = array(0);
$query = $db->simple_select("posts", "uid", $ip_sql);
while($uid = $db->fetch_field($query, "uid"))

		{

		{

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

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

Zeile 3349Zeile 3359
					{
$column = str_replace('_blank', '', $column);
$userfield_sql .= ' AND '.$db->escape_string($column)." != ''";

					{
$column = str_replace('_blank', '', $column);
$userfield_sql .= ' AND '.$db->escape_string($column)." != ''";

					}

					}

					else
{
$userfield_sql .= ' AND '.$db->escape_string($column)."='".$db->escape_string($value)."'";
}

					else
{
$userfield_sql .= ' AND '.$db->escape_string($column)."='".$db->escape_string($value)."'";
}

				}

				}

			}
else if(!empty($input))
{

			}
else if(!empty($input))
{

Zeile 3367Zeile 3377
				{
$column = str_replace('_blank', '', $column);
$userfield_sql .= ' AND '.$db->escape_string($column)." != ''";

				{
$column = str_replace('_blank', '', $column);
$userfield_sql .= ' AND '.$db->escape_string($column)." != ''";

				}

				}

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

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

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

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

		}
}


		}
}


	// Usergroup based searching
if(isset($view['conditions']['usergroup']))
{
if(!is_array($view['conditions']['usergroup']))

	// Usergroup based searching
if(isset($view['conditions']['usergroup']))
{
if(!is_array($view['conditions']['usergroup']))

		{

		{

			$view['conditions']['usergroup'] = array($view['conditions']['usergroup']);
}


			$view['conditions']['usergroup'] = array($view['conditions']['usergroup']);
}


Zeile 3401Zeile 3411
			$usergroup = (int)$usergroup;

if(!$usergroup)

			$usergroup = (int)$usergroup;

if(!$usergroup)

			{

			{

				continue;

				continue;

			}

$additional_sql = '';

			}

$additional_sql = '';


switch($db->type)
{


switch($db->type)
{

Zeile 3423Zeile 3433

// COPPA users only?
if(isset($view['conditions']['coppa']))


// COPPA users only?
if(isset($view['conditions']['coppa']))

	{

	{

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


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


Zeile 3431Zeile 3441
	if(isset($view['extra_sql']))
{
$search_sql .= $view['extra_sql'];

	if(isset($view['extra_sql']))
{
$search_sql .= $view['extra_sql'];

	}

	}


// Lets fetch out how many results we have
$query = $db->query("


// Lets fetch out how many results we have
$query = $db->query("

Zeile 3457Zeile 3467

// Establish which page we're viewing and the starting index for querying
if(!isset($mybb->input['page']))


// Establish which page we're viewing and the starting index for querying
if(!isset($mybb->input['page']))

		{
$mybb->input['page'] = 1;

		{
$mybb->input['page'] = 1;

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

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

		}

		}


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


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

Zeile 3494Zeile 3504
				break;
case "numthreads":
$view['sortby'] = "threadnum";

				break;
case "numthreads":
$view['sortby'] = "threadnum";

				break;

				break;

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

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

Zeile 3503Zeile 3513
		}

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

		}

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

		{

		{

			$view['sortorder'] = "asc";
}

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

			$view['sortorder'] = "asc";
}

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





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

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

Zeile 3529Zeile 3539
				$additional_groups = explode(",", $user['additionalgroups']);

foreach($additional_groups as $group)

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

foreach($additional_groups as $group)

				{

				{

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

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

Zeile 3600Zeile 3610
				if($warning_level > 100)
{
$warning_level = 100;

				if($warning_level > 100)
{
$warning_level = 100;

				}

				}

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

if($user['avatar'] && !my_validate_url($user['avatar']))

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

if($user['avatar'] && !my_validate_url($user['avatar']))

			{

			{

				$user['avatar'] = "../{$user['avatar']}";

				$user['avatar'] = "../{$user['avatar']}";

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

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

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

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

Zeile 3636Zeile 3646
			if($view['view_type'] == "card")
{
$users .= build_user_view_card($user, $view, $i);

			if($view['view_type'] == "card")
{
$users .= build_user_view_card($user, $view, $i);

			}

			}

			else
{
build_user_view_table($user, $view, $table);
}

			else
{
build_user_view_table($user, $view, $table);
}

		}

		}


// If card view, we need to output the results
if($view['view_type'] == "card")


// If card view, we need to output the results
if($view['view_type'] == "card")

Zeile 3649Zeile 3659
			$table->construct_cell($users);
$table->construct_row();
}

			$table->construct_cell($users);
$table->construct_row();
}

	}


	}


	if(!isset($view['table_id']))
{
$view['table_id'] = "users_list";

	if(!isset($view['table_id']))
{
$view['table_id'] = "users_list";

	}

	}


$switch_view = "<div class=\"float_right\">";
$switch_url = $view['url'];


$switch_view = "<div class=\"float_right\">";
$switch_url = $view['url'];

Zeile 3663Zeile 3673
		$switch_url .= "&amp;page=".$mybb->get_input('page', MyBB::INPUT_INT);
}
if($view['view_type'] != "card")

		$switch_url .= "&amp;page=".$mybb->get_input('page', MyBB::INPUT_INT);
}
if($view['view_type'] != "card")

	{

	{

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

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

Zeile 3671Zeile 3681
		$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>";

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

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

Zeile 4239Zeile 4249
});
// -->
</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)
{
$db->update_query('threads', array('numratings' => 'numratings-'.count($ratings), 'totalratings' => 'totalratings-'.array_sum($ratings)), "tid='{$tid}'", 1, true);
}
}

}

}