Zeile 1 | Zeile 1 |
---|
<?php /** * MyBB 1.4
|
<?php /** * MyBB 1.4
|
* Copyright � 2008 MyBB Group, All Rights Reserved
| * Copyright © 2008 MyBB Group, All Rights Reserved
|
* * Website: http://www.mybboard.net * License: http://www.mybboard.net/about/license *
|
* * Website: http://www.mybboard.net * License: http://www.mybboard.net/about/license *
|
* $Id: users.php 4180 2008-09-07 16:44:43Z Tikitiki $
| * $Id: users.php 4657 2009-12-24 20:31:25Z RyanGordon $
|
*/
// Disallow direct access to this file for security reasons
| */
// Disallow direct access to this file for security reasons
|
Zeile 159 | Zeile 159 |
---|
// We've selected a new avatar for this user! if($mybb->input['avatar']) {
|
// We've selected a new avatar for this user! if($mybb->input['avatar']) {
|
| $mybb->input['avatar'] = str_replace(array("./", ".."), "", $mybb->input['avatar']);
|
if(file_exists("../".$mybb->settings['avatardir']."/".$mybb->input['avatar'])) { $dimensions = @getimagesize("../".$mybb->settings['avatardir']."/".$mybb->input['avatar']);
| if(file_exists("../".$mybb->settings['avatardir']."/".$mybb->input['avatar'])) { $dimensions = @getimagesize("../".$mybb->settings['avatardir']."/".$mybb->input['avatar']);
|
Zeile 175 | Zeile 177 |
---|
// Log admin action log_admin_action($user['uid'], $user['username']); }
|
// Log admin action log_admin_action($user['uid'], $user['username']); }
|
remove_avatars($mybb->user['uid']);
| remove_avatars($user['uid']);
|
// Now a tad of javascript to submit the parent window form echo "<script type=\"text/javascript\">window.parent.submitUserForm();</script>"; exit;
| // Now a tad of javascript to submit the parent window form echo "<script type=\"text/javascript\">window.parent.submitUserForm();</script>"; exit;
|
Zeile 199 | Zeile 201 |
---|
$mybb->settings['avatardir'] = "../".$mybb->settings['avatardir'];
|
$mybb->settings['avatardir'] = "../".$mybb->settings['avatardir'];
|
| if(!is_dir($mybb->settings['avatardir']) && is_dir(MYBB_ROOT."/images/avatars/")) { $mybb->settings['avatardir'] = "../images/avatars/"; }
|
// Within a gallery
|
// Within a gallery
|
if($gallery)
| if(!empty($gallery))
|
{ $path = $gallery."/"; $real_path = $mybb->settings['avatardir']."/".$path;
|
{ $path = $gallery."/"; $real_path = $mybb->settings['avatardir']."/".$path;
|
if(is_dir($path))
| if(is_dir($real_path))
|
{ // Build friendly gallery breadcrumb $gallery_path = explode("/", $gallery);
| { // Build friendly gallery breadcrumb $gallery_path = explode("/", $gallery);
|
Zeile 273 | Zeile 280 |
---|
else if(preg_match("#\.(jpg|jpeg|gif|bmp|png)$#i", $file)) { $friendly_name = preg_replace("#\.(jpg|jpeg|gif|bmp|png)$#i", "", $friendly_name);
|
else if(preg_match("#\.(jpg|jpeg|gif|bmp|png)$#i", $file)) { $friendly_name = preg_replace("#\.(jpg|jpeg|gif|bmp|png)$#i", "", $friendly_name);
|
|
|
// Fetch dimensions $dimensions = @getimagesize($real_path."/".$file);
| // Fetch dimensions $dimensions = @getimagesize($real_path."/".$file);
|
Zeile 355 | Zeile 362 |
---|
$updated_user = array( "coppauser" => 0 );
|
$updated_user = array( "coppauser" => 0 );
|
} else {
| } else {
|
$db->delete_query("awaitingactivation", "uid='{$user['uid']}'"); }
| $db->delete_query("awaitingactivation", "uid='{$user['uid']}'"); }
|
Zeile 368 | Zeile 375 |
---|
}
$db->update_query("users", $updated_user, "uid='{$user['uid']}'");
|
}
$db->update_query("users", $updated_user, "uid='{$user['uid']}'");
|
|
|
$plugins->run_hooks("admin_user_users_coppa_activate_commit");
// Log admin action log_admin_action($user['uid'], $user['username']);
|
$plugins->run_hooks("admin_user_users_coppa_activate_commit");
// Log admin action log_admin_action($user['uid'], $user['username']);
|
if($user['coppauser']) { flash_message($lang->success_coppa_activated, 'success');
| if($mybb->input['from'] == "home") { if($user['coppauser']) { $message = $lang->success_coppa_activated; } else { $message = $lang->success_activated; } update_admin_session('flash_message2', array('message' => $message, 'type' => 'success'));
|
} else
|
} else
|
{ flash_message($lang->success_activated, 'success');
| { if($user['coppauser']) { flash_message($lang->success_coppa_activated, 'success'); } else { flash_message($lang->success_activated, 'success'); }
|
}
|
}
|
|
|
if($admin_session['data']['last_users_url']) { $url = $admin_session['data']['last_users_url']; update_admin_session('last_users_url', '');
|
if($admin_session['data']['last_users_url']) { $url = $admin_session['data']['last_users_url']; update_admin_session('last_users_url', '');
|
}
| if($mybb->input['from'] == "home") { update_admin_session('from', 'home'); } }
|
else
|
else
|
{ $url = "index.php?module=user/users&action=edit&uid={$user['uid']}";
| { $url = "index.php?module=user/users&action=edit&uid={$user['uid']}";
|
}
|
}
|
|
|
admin_redirect($url); }
if($mybb->input['action'] == "add") { $plugins->run_hooks("admin_user_users_add");
|
admin_redirect($url); }
if($mybb->input['action'] == "add") { $plugins->run_hooks("admin_user_users_add");
|
if($mybb->request_method == "post") { // Determine the usergroup stuff if(is_array($mybb->input['additionalgroups'])) { foreach($mybb->input['additionalgroups'] as $gid) { if($gid == $mybb->input['usergroup']) { unset($mybb->input['additionalgroups'][$gid]); } } $additionalgroups = implode(",", $mybb->input['additionalgroups']); } else { $additionalgroups = ''; }
| if($mybb->request_method == "post") { // Determine the usergroup stuff 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(",", $mybb->input['additionalgroups']); } else { $additionalgroups = ''; }
|
// Set up user handler. require_once MYBB_ROOT."inc/datahandlers/user.php";
| // Set up user handler. require_once MYBB_ROOT."inc/datahandlers/user.php";
|
Zeile 540 | Zeile 569 |
---|
// Determine the usergroup stuff if(is_array($mybb->input['additionalgroups'])) {
|
// Determine the usergroup stuff if(is_array($mybb->input['additionalgroups'])) {
|
foreach($mybb->input['additionalgroups'] as $gid)
| foreach($mybb->input['additionalgroups'] as $key => $gid)
|
{ if($gid == $mybb->input['usergroup']) {
|
{ if($gid == $mybb->input['usergroup']) {
|
unset($mybb->input['additionalgroups'][$gid]);
| unset($mybb->input['additionalgroups'][$key]);
|
} } $additionalgroups = implode(",", $mybb->input['additionalgroups']);
| } } $additionalgroups = implode(",", $mybb->input['additionalgroups']);
|
Zeile 597 | Zeile 626 |
---|
$updated_user['password'] = $mybb->input['new_password']; $updated_user['password2'] = $mybb->input['confirm_new_password']; }
|
$updated_user['password'] = $mybb->input['new_password']; $updated_user['password2'] = $mybb->input['confirm_new_password']; }
|
$updated_user['birthday'] = array( "day" => $mybb->input['birthday_day'], "month" => $mybb->input['birthday_month'], "year" => $mybb->input['birthday_year'] );
| |
$updated_user['options'] = array( "allownotices" => $mybb->input['allownotices'],
| $updated_user['options'] = array( "allownotices" => $mybb->input['allownotices'],
|
Zeile 652 | Zeile 675 |
---|
"avatardimensions" => "", "avatartype" => "" );
|
"avatardimensions" => "", "avatartype" => "" );
|
remove_avatars($mybb->user['uid']);
| remove_avatars($user['uid']);
|
}
| }
|
Zeile 716 | Zeile 739 |
---|
{ if($width && $height && $mybb->settings['maxavatardims'] != "") {
|
{ if($width && $height && $mybb->settings['maxavatardims'] != "") {
|
list($maxwidth, $maxheight) = explode("x", $mybb->settings['maxavatardims']);
| list($maxwidth, $maxheight) = explode("x", my_strtolower($mybb->settings['maxavatardims']));
|
if(($maxwidth && $width > $maxwidth) || ($maxheight && $height > $maxheight)) { $lang->error_avatartoobig = $lang->sprintf($lang->error_avatartoobig, $maxwidth, $maxheight);
| if(($maxwidth && $width > $maxwidth) || ($maxheight && $height > $maxheight)) { $lang->error_avatartoobig = $lang->sprintf($lang->error_avatartoobig, $maxwidth, $maxheight);
|
Zeile 844 | Zeile 867 |
---|
require_once MYBB_ROOT."inc/functions_image.php"; list($width, $height) = explode("|", $user['avatardimensions']); $scaled_dimensions = scale_image($width, $height, 120, 120);
|
require_once MYBB_ROOT."inc/functions_image.php"; list($width, $height) = explode("|", $user['avatardimensions']); $scaled_dimensions = scale_image($width, $height, 120, 120);
|
} else {
| } else {
|
$scaled_dimensions = array( "width" => 120, "height" => 120
| $scaled_dimensions = array( "width" => 120, "height" => 120
|
Zeile 890 | Zeile 913 |
---|
{ $posts_per_day = round($user['postnum'] / $days_registered, 2); if($posts_per_day > $user['postnum'])
|
{ $posts_per_day = round($user['postnum'] / $days_registered, 2); if($posts_per_day > $user['postnum'])
|
{
| {
|
$posts_per_day = $user['postnum']; } } $stats = $cache->read("stats"); $posts = $stats['numposts']; if($posts == 0)
|
$posts_per_day = $user['postnum']; } } $stats = $cache->read("stats"); $posts = $stats['numposts']; if($posts == 0)
|
{
| {
|
$percent_posts = "0";
|
$percent_posts = "0";
|
}
| }
|
else {
|
else {
|
$percent_posts = round($memprofile['postnum']*100/$posts, 2);;
| $percent_posts = round($user['postnum']*100/$posts, 2);
|
}
$user_permissions = user_permissions($user['uid']);
| }
$user_permissions = user_permissions($user['uid']);
|
Zeile 912 | Zeile 935 |
---|
{ $reputation = get_reputation($user['reputation']); }
|
{ $reputation = get_reputation($user['reputation']); }
|
else { $reputation = "-"; }
| else { $reputation = "-"; }
|
if($mybb->settings['enablewarningsystem'] != 0 && $user_permissions['canreceivewarnings'] != 0)
|
if($mybb->settings['enablewarningsystem'] != 0 && $user_permissions['canreceivewarnings'] != 0)
|
{
| {
|
$warning_level = round($user['warningpoints']/$mybb->settings['maxwarningpoints']*100); if($warning_level > 100) { $warning_level = 100; } $warning_level = get_colored_warning_level($warning_level);
|
$warning_level = round($user['warningpoints']/$mybb->settings['maxwarningpoints']*100); if($warning_level > 100) { $warning_level = 100; } $warning_level = get_colored_warning_level($warning_level);
|
}
| }
|
if($user['birthday']) { $age = get_age($user['birthday']); }
|
if($user['birthday']) { $age = get_age($user['birthday']); }
|
|
|
else { $age = ''; }
|
else { $age = ''; }
|
$table->construct_cell("<div style=\"width: 126px; height: 126px;\" class=\"user_avatar\"><img src=\"{$user['avatar']}\" style=\"margin-top: {$avatar_top}px\" width=\"{$scaled_dimensions['width']}\" height=\"{$scaled_dimensions['height']}\" alt=\"\" /></div>", array('rowspan' => 6, 'width' => 1));
| $table->construct_cell("<div style=\"width: 126px; height: 126px;\" class=\"user_avatar\"><img src=\"".htmlspecialchars_uni($user['avatar'])."\" style=\"margin-top: {$avatar_top}px\" width=\"{$scaled_dimensions['width']}\" height=\"{$scaled_dimensions['height']}\" alt=\"\" /></div>", array('rowspan' => 6, 'width' => 1));
|
$table->construct_cell("<strong>{$lang->email_address}:</strong> <a href=\"mailto:".htmlspecialchars_uni($user['email'])."\">".htmlspecialchars_uni($user['email'])."</a>"); $table->construct_cell("<strong>{$lang->last_active}:</strong> {$last_active}"); $table->construct_row();
| $table->construct_cell("<strong>{$lang->email_address}:</strong> <a href=\"mailto:".htmlspecialchars_uni($user['email'])."\">".htmlspecialchars_uni($user['email'])."</a>"); $table->construct_cell("<strong>{$lang->last_active}:</strong> {$last_active}"); $table->construct_row();
|
Zeile 1022 | Zeile 1046 |
---|
$form->generate_check_box("remember", 1, $lang->remember_login_details, array("checked" => $mybb->input['remember'])) ); $form_container->output_row($lang->login_cookies_privacy, "", "<div class=\"user_settings_bit\">".implode("</div><div class=\"user_settings_bit\">", $login_options)."</div>");
|
$form->generate_check_box("remember", 1, $lang->remember_login_details, array("checked" => $mybb->input['remember'])) ); $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; }
|
$messaging_options = array( $form->generate_check_box("allownotices", 1, $lang->recieve_admin_emails, array("checked" => $mybb->input['allownotices'])), $form->generate_check_box("hideemail", 1, $lang->hide_email_from_others, array("checked" => $mybb->input['hideemail'])),
| $messaging_options = array( $form->generate_check_box("allownotices", 1, $lang->recieve_admin_emails, array("checked" => $mybb->input['allownotices'])), $form->generate_check_box("hideemail", 1, $lang->hide_email_from_others, array("checked" => $mybb->input['hideemail'])),
|
Zeile 1110 | Zeile 1139 |
---|
); $form_container->output_row($lang->thread_view_options, "", "<div class=\"user_settings_bit\">".implode("</div><div class=\"user_settings_bit\">", $thread_options)."</div>");
|
); $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('0' => $lang->use_default), $lang->get_languages());
| $languages = array_merge(array('' => $lang->use_default), $lang->get_languages());
|
$other_options = array( $form->generate_check_box("showredirect", 1, $lang->show_redirect, array("checked" => $mybb->input['showredirect'])),
| $other_options = array( $form->generate_check_box("showredirect", 1, $lang->show_redirect, array("checked" => $mybb->input['showredirect'])),
|
Zeile 1170 | Zeile 1199 |
---|
$table = new Table; $table->construct_header($lang->current_avatar, array('colspan' => 2));
|
$table = new Table; $table->construct_header($lang->current_avatar, array('colspan' => 2));
|
$table->construct_cell("<div style=\"width: 126px; height: 126px;\" class=\"user_avatar\"><img src=\"{$user['avatar']}\" width=\"{$scaled_dimensions['width']}\" style=\"margin-top: {$avatar_top}px\" height=\"{$scaled_dimensions['height']}\" alt=\"\" /></div>", array('width' => 1));
| $table->construct_cell("<div style=\"width: 126px; height: 126px;\" class=\"user_avatar\"><img src=\"".htmlspecialchars_uni($user['avatar'])."\" width=\"{$scaled_dimensions['width']}\" style=\"margin-top: {$avatar_top}px\" height=\"{$scaled_dimensions['height']}\" alt=\"\" /></div>", array('width' => 1));
|
if($user['avatartype'] == "upload" || stristr($user['avatar'], $mybb->settings['avataruploadpath'])) {
| if($user['avatartype'] == "upload" || stristr($user['avatar'], $mybb->settings['avataruploadpath'])) {
|
Zeile 1193 | Zeile 1222 |
---|
if($mybb->settings['maxavatardims'] != "") {
|
if($mybb->settings['maxavatardims'] != "") {
|
list($max_width, $max_height) = explode("x", $mybb->settings['maxavatardims']);
| list($max_width, $max_height) = explode("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 1272 | Zeile 1301 |
---|
{ // Delete the user $db->update_query("posts", array('uid' => 0), "uid='{$user['uid']}'");
|
{ // Delete the user $db->update_query("posts", array('uid' => 0), "uid='{$user['uid']}'");
|
$db->delete_query("users", "uid='{$user['uid']}'");
| |
$db->delete_query("userfields", "ufid='{$user['uid']}'"); $db->delete_query("privatemessages", "uid='{$user['uid']}'"); $db->delete_query("events", "uid='{$user['uid']}'");
| $db->delete_query("userfields", "ufid='{$user['uid']}'"); $db->delete_query("privatemessages", "uid='{$user['uid']}'"); $db->delete_query("events", "uid='{$user['uid']}'");
|
Zeile 1282 | Zeile 1310 |
---|
$db->delete_query("sessions", "uid='{$user['uid']}'"); $db->delete_query("banned", "uid='{$user['uid']}'"); $db->delete_query("threadratings", "uid='{$user['uid']}'");
|
$db->delete_query("sessions", "uid='{$user['uid']}'"); $db->delete_query("banned", "uid='{$user['uid']}'"); $db->delete_query("threadratings", "uid='{$user['uid']}'");
|
| $db->delete_query("users", "uid='{$user['uid']}'"); $db->delete_query("joinrequests", "uid='{$user['uid']}'"); $db->delete_query("warnings", "uid='{$user['uid']}'");
|
// Update forum stats update_stats(array('numusers' => '-1'));
| // Update forum stats update_stats(array('numusers' => '-1'));
|
Zeile 1291 | Zeile 1322 |
---|
// Log admin action log_admin_action($user['uid'], $user['username']);
|
// Log admin action log_admin_action($user['uid'], $user['username']);
|
|
|
flash_message($lang->success_user_deleted, 'success'); admin_redirect("index.php?module=user/users");
|
flash_message($lang->success_user_deleted, 'success'); admin_redirect("index.php?module=user/users");
|
}
| }
|
else { $page->output_confirm_action("index.php?module=user/users&action=delete&uid={$user['uid']}", $lang->user_deletion_confirmation);
|
else { $page->output_confirm_action("index.php?module=user/users&action=delete&uid={$user['uid']}", $lang->user_deletion_confirmation);
|
} }
| } }
|
if($mybb->input['action'] == "referrers") { $plugins->run_hooks("admin_user_users_referrers");
|
if($mybb->input['action'] == "referrers") { $plugins->run_hooks("admin_user_users_referrers");
|
|
|
$page->add_breadcrumb_item($lang->show_referrers); $page->output_header($lang->show_referrers);
| $page->add_breadcrumb_item($lang->show_referrers); $page->output_header($lang->show_referrers);
|
Zeile 1313 | Zeile 1344 |
---|
'link' => "index.php?module=user/users&action=referrers&uid={$mybb->input['uid']}", 'description' => $lang->show_referrers_desc );
|
'link' => "index.php?module=user/users&action=referrers&uid={$mybb->input['uid']}", 'description' => $lang->show_referrers_desc );
|
|
|
$page->output_nav_tabs($sub_tabs, 'referrers'); // Fetch default admin view $default_view = fetch_default_view("user");
|
$page->output_nav_tabs($sub_tabs, 'referrers'); // Fetch default admin view $default_view = fetch_default_view("user");
|
| if(!$default_view) { $default_view = "0"; }
|
$query = $db->simple_select("adminviews", "*", "type='user' AND (vid='{$default_view}' OR uid=0)", array("order_by" => "uid", "order_dir" => "desc")); $admin_view = $db->fetch_array($query);
| $query = $db->simple_select("adminviews", "*", "type='user' AND (vid='{$default_view}' OR uid=0)", array("order_by" => "uid", "order_dir" => "desc")); $admin_view = $db->fetch_array($query);
|
Zeile 1395 | Zeile 1430 |
---|
$table->construct_cell($controls, array('class' => "align_center")); $table->construct_row();
|
$table->construct_cell($controls, array('class' => "align_center")); $table->construct_row();
|
$query = $db->simple_select("posts", "DISTINCT ipaddress, pid", "uid='{$mybb->input['uid']}'");
| $counter = 0; $query = $db->simple_select("posts", "DISTINCT ipaddress", "uid='{$mybb->input['uid']}'");
|
while($ip = $db->fetch_array($query)) {
|
while($ip = $db->fetch_array($query)) {
|
if(!$done_ip[$ip['ipaddress']]) { $popup = new PopupMenu("post_{$ip['pid']}", $lang->options); $popup->add_item($lang->show_users_regged_with_ip, "index.php?module=user/users&results=1&action=search&conditions=".urlencode(serialize(array("regip" => $ip['ipaddress'])))); $popup->add_item($lang->show_users_posted_with_ip, "index.php?module=user/users&results=1&action=search&conditions=".urlencode(serialize(array("postip" => $ip['ipaddress'])))); $popup->add_item($lang->ban_ip, "index.php?module=config/banning&filter={$ip['ipaddress']}"); $controls = $popup->fetch(); $table->construct_cell($ip['ipaddress']); $table->construct_cell($controls, array('class' => "align_center")); $table->construct_row(); $done_ip[$ip['ipaddres']] = 1; }
| ++$counter; $popup = new PopupMenu("id_{$counter}", $lang->options); $popup->add_item($lang->show_users_regged_with_ip, "index.php?module=user/users&results=1&action=search&conditions=".urlencode(serialize(array("regip" => $ip['ipaddress'])))); $popup->add_item($lang->show_users_posted_with_ip, "index.php?module=user/users&results=1&action=search&conditions=".urlencode(serialize(array("postip" => $ip['ipaddress'])))); $popup->add_item($lang->ban_ip, "index.php?module=config/banning&filter={$ip['ipaddress']}"); $controls = $popup->fetch(); $table->construct_cell($ip['ipaddress']); $table->construct_cell($controls, array('class' => "align_center")); $table->construct_row();
|
} $table->output($lang->ip_address_for." {$user['username']}");
| } $table->output($lang->ip_address_for." {$user['username']}");
|
Zeile 1421 | Zeile 1455 |
---|
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") { $query = $db->simple_select("users", "*", "LOWER(username)='".$db->escape_string(my_strtolower($mybb->input['source_username']))."'");
| if($mybb->request_method == "post") { $query = $db->simple_select("users", "*", "LOWER(username)='".$db->escape_string(my_strtolower($mybb->input['source_username']))."'");
|
Zeile 1467 | Zeile 1501 |
---|
$db->update_query("pollvotes", $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("pollvotes", $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("reputation", $uid_update, "uid='{$source_user['uid']}'"); $db->update_query("reputation", array('adduid' => $destination_user['uid']), "adduid='{$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("threadratings", $uid_update, "uid='{$source_user['uid']}'"); $db->update_query("threads", $uid_update, "uid='{$source_user['uid']}'");
|
| $db->delete_query("sessions", "uid='{$source_user['uid']}'"); // Merging Reputation $query = $db->simple_select("reputation", "rid, uid", "adduid = '{$source_user['uid']}' OR adduid = '{$uid_update['uid']}'", array("order_by" => "dateline", "order_dir" => "DESC")); while($result = $db->fetch_array($query)) { // Let's try and remove old one if it's the same uid if($result['uid'] == $last['uid']) { $db->delete_query("reputation", "rid = '".$result['rid']."'"); $db->update_query("reputation", array("adduid" => $uid_update['uid']), "rid = '".$last['rid']."'"); } $last = array( "rid" => $result['rid'], "uid" => $result['uid'] ); } // Calculate new reputation $query = $db->simple_select("reputation", "SUM(reputation) as total_rep", "uid='{$destination_user['uid']}'"); $total_reputation = $db->fetch_field($query, "total_rep");
// No reputation? if(!$total_reputation) { $total_reputation = '0'; }
|
|
|
| $db->update_query("users", array('reputation' => $total_reputation), "uid='{$destination_user['uid']}'");
|
// Additional updates for non-uid fields $last_poster = array( "lastposteruid" => $destination_user['uid'],
| // Additional updates for non-uid fields $last_poster = array( "lastposteruid" => $destination_user['uid'],
|
Zeile 1496 | Zeile 1557 |
---|
// Delete the old user $db->delete_query("users", "uid='{$source_user['uid']}'"); $db->delete_query("banned", "uid='{$source_user['uid']}'");
|
// Delete the old user $db->delete_query("users", "uid='{$source_user['uid']}'"); $db->delete_query("banned", "uid='{$source_user['uid']}'");
|
| // Get a list of forums where post count doesn't apply $fids = array(); $query = $db->simple_select("forums", "fid", "usepostcounts=0"); while($fid = $db->fetch_field($query, "fid")) { $fids[] = $fid; } $fids_not_in = ''; if(!empty($fids)) { $fids_not_in = "AND fid NOT IN(".implode(',', $fids).")"; }
|
// Update user post count
|
// Update user post count
|
$query = $db->simple_select("posts", "COUNT(*) AS postnum", "uid='".$destination_user['uid']."'");
| $query = $db->simple_select("posts", "COUNT(*) AS postnum", "uid='".$destination_user['uid']."' {$fids_not_in}");
|
$num = $db->fetch_array($query); $updated_count = array( "postnum" => $num['postnum'] ); $db->update_query("users", $updated_count, "uid='{$destination_user['uid']}'");
|
$num = $db->fetch_array($query); $updated_count = array( "postnum" => $num['postnum'] ); $db->update_query("users", $updated_count, "uid='{$destination_user['uid']}'");
|
| // Use the earliest registration date if($destination_user['regdate'] > $source_user['regdate']) { $db->update_query("users", array('regdate' => $source_user['regdate']), "uid='{$destination_user['uid']}'"); }
|
update_stats(array('numusers' => '-1')); $plugins->run_hooks("admin_user_users_merge_commit");
|
update_stats(array('numusers' => '-1')); $plugins->run_hooks("admin_user_users_merge_commit");
|
|
|
// 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! flash_message("<strong>{$source_user['username']}</strong> {$lang->success_merged} {$destination_user['username']}", "success"); admin_redirect("index.php?module=user/users"); exit; }
|
// Redirect! flash_message("<strong>{$source_user['username']}</strong> {$lang->success_merged} {$destination_user['username']}", "success"); 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 1531 | Zeile 1612 |
---|
}
$form = new Form("index.php?module=user/users&action=merge", "post");
|
}
$form = new Form("index.php?module=user/users&action=merge", "post");
|
|
|
$form_container = new FormContainer($lang->merge_users); $form_container->output_row($lang->source_account." <em>*</em>", $lang->source_account_desc, $form->generate_text_box('source_username', $mybb->input['source_username'], array('id' => 'source_username')), 'source_username'); $form_container->output_row($lang->destination_account." <em>*</em>", $lang->destination_account_desc, $form->generate_text_box('destination_username', $mybb->input['destination_username'], array('id' => 'destination_username')), 'destination_username');
|
$form_container = new FormContainer($lang->merge_users); $form_container->output_row($lang->source_account." <em>*</em>", $lang->source_account_desc, $form->generate_text_box('source_username', $mybb->input['source_username'], array('id' => 'source_username')), 'source_username'); $form_container->output_row($lang->destination_account." <em>*</em>", $lang->destination_account_desc, $form->generate_text_box('destination_username', $mybb->input['destination_username'], array('id' => 'destination_username')), 'destination_username');
|
$form_container->end();
| $form_container->end();
|
// Autocompletion for usernames echo ' <script type="text/javascript" src="../jscripts/autocomplete.js?ver=140"></script>
| // Autocompletion for usernames echo ' <script type="text/javascript" src="../jscripts/autocomplete.js?ver=140"></script>
|
Zeile 1561 | Zeile 1642 |
---|
if($mybb->request_method == "post" || $mybb->input['results'] == 1) { // Build view options from incoming search options
|
if($mybb->request_method == "post" || $mybb->input['results'] == 1) { // Build view options from incoming search options
|
if($mybb->input['vid']) { $query = $db->simple_select("adminviews", "*", "vid='".intval($mybb->input['vid'])."'"); $admin_view = $db->fetch_array($query);
| if($mybb->input['vid']) { $query = $db->simple_select("adminviews", "*", "vid='".intval($mybb->input['vid'])."'"); $admin_view = $db->fetch_array($query);
|
// View does not exist or this view is private and does not belong to the current user if(!$admin_view['vid'] || ($admin_view['visibility'] == 1 && $admin_view['uid'] != $mybb->user['uid'])) { unset($admin_view);
|
// 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 1583 | Zeile 1664 |
---|
if(!$admin_view['vid']) { $default_view = fetch_default_view("user");
|
if(!$admin_view['vid']) { $default_view = fetch_default_view("user");
|
| if(!$default_view) { $default_view = "0"; }
|
$query = $db->simple_select("adminviews", "*", "type='user' AND (vid='{$default_view}' OR uid=0)", array("order_by" => "uid", "order_dir" => "desc")); $admin_view = $db->fetch_array($query); }
| $query = $db->simple_select("adminviews", "*", "type='user' AND (vid='{$default_view}' OR uid=0)", array("order_by" => "uid", "order_dir" => "desc")); $admin_view = $db->fetch_array($query); }
|
Zeile 1592 | Zeile 1677 |
---|
unset($admin_view['vid']);
if($mybb->input['type'])
|
unset($admin_view['vid']);
if($mybb->input['type'])
|
{
| {
|
$admin_view['view_type'] = $mybb->input['type'];
|
$admin_view['view_type'] = $mybb->input['type'];
|
}
| }
|
if($mybb->input['conditions']) { $admin_view['conditions'] = $mybb->input['conditions']; } if($mybb->input['sortby'])
|
if($mybb->input['conditions']) { $admin_view['conditions'] = $mybb->input['conditions']; } if($mybb->input['sortby'])
|
{
| {
|
$admin_view['sortby'] = $mybb->input['sortby'];
|
$admin_view['sortby'] = $mybb->input['sortby'];
|
}
| }
|
if($mybb->input['perpage']) { $admin_view['perpage'] = $mybb->input['perpage']; } if($mybb->input['order'])
|
if($mybb->input['perpage']) { $admin_view['perpage'] = $mybb->input['perpage']; } if($mybb->input['order'])
|
{
| {
|
$admin_view['sortorder'] = $mybb->input['order']; } if($mybb->input['displayas']) { $admin_view['view_type'] = $mybb->input['displayas'];
|
$admin_view['sortorder'] = $mybb->input['order']; } if($mybb->input['displayas']) { $admin_view['view_type'] = $mybb->input['displayas'];
|
}
| }
|
$results = build_users_view($admin_view);
if($results)
|
$results = build_users_view($admin_view);
if($results)
|
{
| {
|
$page->output_header($lang->find_users); echo "<script type=\"text/javascript\" src=\"jscripts/users.js\"></script>"; $page->output_nav_tabs($sub_tabs, 'find_users');
| $page->output_header($lang->find_users); echo "<script type=\"text/javascript\" src=\"jscripts/users.js\"></script>"; $page->output_nav_tabs($sub_tabs, 'find_users');
|
Zeile 1633 | Zeile 1718 |
---|
} else {
|
} else {
|
$errors[] = $lang->error_no_users_found;
| if($mybb->input['from'] == "home") { flash_message($lang->error_no_users_found, 'error'); admin_redirect("index.php"); exit; } else { $errors[] = $lang->error_no_users_found; }
|
} }
| } }
|
Zeile 1704 | Zeile 1798 |
---|
// Don't have a view? Fetch the default if(!$admin_view)
|
// Don't have a view? Fetch the default if(!$admin_view)
|
{
| {
|
$default_view = fetch_default_view("user");
|
$default_view = fetch_default_view("user");
|
| if(!$default_view) { $default_view = "0"; }
|
$query = $db->simple_select("adminviews", "*", "type='user' AND (vid='{$default_view}' OR uid=0)", array("order_by" => "uid", "order_dir" => "desc")); $admin_view = $db->fetch_array($query);
|
$query = $db->simple_select("adminviews", "*", "type='user' AND (vid='{$default_view}' OR uid=0)", array("order_by" => "uid", "order_dir" => "desc")); $admin_view = $db->fetch_array($query);
|
}
| }
|
}
// Fetch a list of all of the views for this user
| }
// Fetch a list of all of the views for this user
|
Zeile 1718 | Zeile 1816 |
---|
while($view = $db->fetch_array($query)) { $popup->add_item(htmlspecialchars_uni($view['title']), "index.php?module=user/users&vid={$view['vid']}");
|
while($view = $db->fetch_array($query)) { $popup->add_item(htmlspecialchars_uni($view['title']), "index.php?module=user/users&vid={$view['vid']}");
|
}
| }
|
$popup->add_item("<em>{$lang->manage_views}</em>", "index.php?module=user/users&action=views"); $admin_view['popup'] = $popup->fetch();
| $popup->add_item("<em>{$lang->manage_views}</em>", "index.php?module=user/users&action=views"); $admin_view['popup'] = $popup->fetch();
|
Zeile 1731 | Zeile 1829 |
---|
if(!$results) {
|
if(!$results) {
|
| // If we came from the home page and clicked on the "Activate Users" link, send them back to here if($admin_session['data']['from'] == "home") { flash_message($admin_session['data']['flash_message2']['message'], $admin_session['data']['flash_message2']['type']); update_admin_session('flash_message2', ''); update_admin_session('from', ''); admin_redirect("index.php"); exit; } else {
|
$errors[] = $lang->error_no_users_found;
|
$errors[] = $lang->error_no_users_found;
|
}
| } }
|
// If we have any error messages, show them if($errors)
|
// If we have any error messages, show them if($errors)
|
{
| { echo "<div style=\"display: inline; float: right;\">{$admin_view['popup']}</div><br />\n";
|
$page->output_inline_error($errors); }
|
$page->output_inline_error($errors); }
|
|
|
echo $results;
$page->output_footer();
| echo $results;
$page->output_footer();
|
Zeile 1759 | Zeile 1870 |
---|
} $view_title .= " (".htmlspecialchars_uni($view['title']).")";
|
} $view_title .= " (".htmlspecialchars_uni($view['title']).")";
|
}
| }
|
// Build the URL to this view if(!$view['url']) {
| // Build the URL to this view if(!$view['url']) {
|
Zeile 1804 | Zeile 1915 |
---|
if(!isset($admin_session['data']['last_users_view']) || $admin_session['data']['last_users_view'] != str_replace("&", "&", $view['url'])) { update_admin_session('last_users_url', str_replace("&", "&", $view['url']));
|
if(!isset($admin_session['data']['last_users_view']) || $admin_session['data']['last_users_view'] != str_replace("&", "&", $view['url'])) { update_admin_session('last_users_url', str_replace("&", "&", $view['url']));
|
| } // Do we not have any views? if(empty($view)) { return false;
|
}
$table = new Table;
| }
$table = new Table;
|
Zeile 1816 | Zeile 1933 |
---|
if(!$user_view_fields[$field]) { continue;
|
if(!$user_view_fields[$field]) { continue;
|
}
| }
|
$view_field = $user_view_fields[$field]; $field_options = array(); if($view_field['width']) { $field_options['width'] = $view_field['width'];
|
$view_field = $user_view_fields[$field]; $field_options = array(); if($view_field['width']) { $field_options['width'] = $view_field['width'];
|
}
| }
|
if($view_field['align']) { $field_options['class'] = "align_".$view_field['align']; } $table->construct_header($view_field['title'], $field_options);
|
if($view_field['align']) { $field_options['class'] = "align_".$view_field['align']; } $table->construct_header($view_field['title'], $field_options);
|
} }
| } }
|
$search_sql = '1=1';
|
$search_sql = '1=1';
|
Zeile 1843 | Zeile 1960 |
---|
if($view['conditions'][$search_field]) { $search_sql .= " AND u.{$search_field} LIKE '%".$db->escape_string_like($view['conditions'][$search_field])."%'";
|
if($view['conditions'][$search_field]) { $search_sql .= " AND u.{$search_field} LIKE '%".$db->escape_string_like($view['conditions'][$search_field])."%'";
|
} }
| } }
|
// EXACT matching fields $user_exact_fields = array("referrer");
| // EXACT matching fields $user_exact_fields = array("referrer");
|
Zeile 1884 | Zeile 2001 |
---|
{ if($view['conditions'][$search_field]) {
|
{ if($view['conditions'][$search_field]) {
|
$view['conditions'][$search_field] = str_replace("*", "%", $view['conditions'][$search_field]);
| |
// IPv6 IP if(strpos($view['conditions'][$search_field], ":") !== false) {
|
// IPv6 IP if(strpos($view['conditions'][$search_field], ":") !== false) {
|
| $view['conditions'][$search_field] = str_replace("*", "%", $view['conditions'][$search_field]);
|
$ip_sql = "{$search_field} LIKE '".$db->escape_string($view['conditions'][$search_field])."'"; } else
| $ip_sql = "{$search_field} LIKE '".$db->escape_string($view['conditions'][$search_field])."'"; } else
|
Zeile 1905 | Zeile 2021 |
---|
} $search_sql .= " AND {$ip_sql}"; }
|
} $search_sql .= " AND {$ip_sql}"; }
|
| }
// Post IP searching if($view['conditions']['postip']) { // IPv6 IP if(strpos($view['conditions']['postip'], ":") !== false) { $view['conditions']['postip'] = str_replace("*", "%", $view['conditions']['postip']); $ip_sql = "ipaddress LIKE '".$db->escape_string($view['conditions']['postip'])."'"; } else { $ip_range = fetch_longipv4_range($view['conditions']['postip']); if(!is_array($ip_range)) { $ip_sql = "longipaddress='{$ip_range}'"; } else { $ip_sql = "longipaddress > '{$ip_range[0]}' AND longipaddress < '{$ip_range[1]}'"; } } $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).")"; unset($ip_uids);
|
}
// Usergroup based searching
| }
// Usergroup based searching
|
Zeile 1923 | Zeile 2070 |
---|
case "sqlite3": case "sqlite2": $additional_sql .= " OR ','||additionalgroups||',' LIKE '%,{$usergroup},%'";
|
case "sqlite3": case "sqlite2": $additional_sql .= " OR ','||additionalgroups||',' LIKE '%,{$usergroup},%'";
|
| break;
|
default: $additional_sql .= "OR CONCAT(',',additionalgroups,',') LIKE '%,{$usergroup},%'"; } } $search_sql .= " AND (u.usergroup IN (".implode(",", $view['conditions']['usergroup']).") {$additional_sql})";
|
default: $additional_sql .= "OR CONCAT(',',additionalgroups,',') LIKE '%,{$usergroup},%'"; } } $search_sql .= " AND (u.usergroup IN (".implode(",", $view['conditions']['usergroup']).") {$additional_sql})";
|
}
| }
|
// COPPA users only? if($view['conditions']['coppa']) {
| // COPPA users only? if($view['conditions']['coppa']) {
|
Zeile 1974 | Zeile 2122 |
---|
{ $start = 0; $mybb->input['page'] = 1;
|
{ $start = 0; $mybb->input['page'] = 1;
|
| } $from_bit = ""; if($mybb->input['from'] == "home") { $from_bit = "&from=home";
|
} switch($view['sortby']) {
|
} switch($view['sortby']) {
|
case "numposts": $view['sortby'] = "postnum"; break;
| |
case "regdate": case "lastactive": case "postnum": case "reputation":
|
case "regdate": case "lastactive": case "postnum": case "reputation":
|
| $view['sortby'] = $db->escape_string($view['sortby']); break; case "numposts": $view['sortby'] = "postnum"; break;
|
case "warninglevel":
|
case "warninglevel":
|
| $view['sortby'] = "warningpoints";
|
break; default: $view['sortby'] = "username";
| break; default: $view['sortby'] = "username";
|
Zeile 2032 | Zeile 2189 |
---|
{ if($user['coppauser']) {
|
{ if($user['coppauser']) {
|
$popup->add_item($lang->approve_coppa_user, "index.php?module=user/users&action=activate_user&uid={$user['uid']}");
| $popup->add_item($lang->approve_coppa_user, "index.php?module=user/users&action=activate_user&uid={$user['uid']}{$from_bit}");
|
} else {
|
} else {
|
$popup->add_item($lang->approve_user, "index.php?module=user/users&action=activate_user&uid={$user['uid']}");
| $popup->add_item($lang->approve_user, "index.php?module=user/users&action=activate_user&uid={$user['uid']}{$from_bit}");
|
} }
| } }
|
Zeile 2082 | Zeile 2239 |
---|
{ $user['avatar'] = "styles/{$page->style}/images/default_avatar.gif"; }
|
{ $user['avatar'] = "styles/{$page->style}/images/default_avatar.gif"; }
|
$user['view']['avatar'] = "<img src=\"{$user['avatar']}\" alt=\"\" width=\"{$scaled_avatar['width']}\" height=\"{$scaled_avatar['height']}\" />";
| $user['view']['avatar'] = "<img src=\"".htmlspecialchars_uni($user['avatar'])."\" alt=\"\" width=\"{$scaled_avatar['width']}\" height=\"{$scaled_avatar['height']}\" />";
|
if($view['view_type'] == "card") {
| if($view['view_type'] == "card") {
|
Zeile 2416 | Zeile 2573 |
---|
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 == $values[$field_name] ? true : false)))."<br />";
| $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; case "textarea":
| } break; case "textarea":
|