$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&action=inline_edit&inline_action=multilift&my_post_key=' . $mybb->post_code . '">' . $lang->lift_bans . '</a></div>' . $lang->mass_ban); $form_container->output_row($lang->ban_reason, "", $form->generate_text_box('reason', $mybb->input['reason'], array('id' => 'reason')), 'reason'); $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
function replyban_run() { global $db, $mybb, $lang, $templates, $theme, $headerinclude, $header, $footer, $replyban, $moderation; $lang->load("replyban"); if ($mybb->input['action'] != "replyban" && $mybb->input['action'] != "do_replyban" && $mybb->input['action'] != "liftreplyban") { return; } if ($mybb->input['action'] == "replyban") { $tid = $mybb->get_input('tid', MyBB::INPUT_INT); $thread = get_thread($tid); if (!is_moderator($thread['fid'], "canmanagethreads")) { error_no_permission(); } if (!$thread['tid']) { error($lang->error_invalidthread); } $thread['subject'] = htmlspecialchars_uni($thread['subject']); $lang->reply_bans_for = $lang->sprintf($lang->reply_bans_for, $thread['subject']); check_forum_password($thread['fid']); build_forum_breadcrumb($thread['fid']); add_breadcrumb($thread['subject'], get_thread_link($thread['tid'])); add_breadcrumb($lang->reply_bans); $query = $db->query("\r\n\t\t\tSELECT r.*, u.username\r\n\t\t\tFROM " . TABLE_PREFIX . "replybans r\r\n\t\t\tLEFT JOIN " . TABLE_PREFIX . "users u ON (r.uid=u.uid)\r\n\t\t\tWHERE r.tid='{$thread['tid']}'\r\n\t\t\tORDER BY r.dateline DESC\r\n\t\t"); while ($ban = $db->fetch_array($query)) { $ban['reason'] = htmlspecialchars_uni($ban['reason']); $ban['username'] = build_profile_link($ban['username'], $ban['uid']); if ($ban['lifted'] == 0) { $ban['lifted'] = $lang->permanent; } else { $ban['lifted'] = my_date('relative', $ban['lifted'], '', 2); } $alt_bg = alt_trow(); eval("\$ban_bit .= \"" . $templates->get("moderation_replyban_bit") . "\";"); } if (!$ban_bit) { eval("\$ban_bit = \"" . $templates->get("moderation_replyban_no_bans") . "\";"); } // Generate the banned times dropdown $liftlist = ''; $bantimes = fetch_ban_times(); foreach ($bantimes as $time => $title) { $selected = ''; if (isset($banned['bantime']) && $banned['bantime'] == $time) { $selected = " selected=\"selected\""; } $thattime = ''; if ($time != '---') { $dateline = TIME_NOW; if (isset($banned['dateline'])) { $dateline = $banned['dateline']; } $thatime = my_date("D, jS M Y @ g:ia", ban_date2timestamp($time, $dateline)); $thattime = " ({$thatime})"; } eval("\$liftlist .= \"" . $templates->get("moderation_replyban_liftlist") . "\";"); } eval("\$replyban = \"" . $templates->get("moderation_replyban") . "\";"); output_page($replyban); } if ($mybb->input['action'] == "do_replyban" && $mybb->request_method == "post") { // Verify incoming POST request verify_post_check($mybb->get_input('my_post_key')); $tid = $mybb->get_input('tid', MyBB::INPUT_INT); $thread = get_thread($tid); if (!is_moderator($thread['fid'], "canmanagethreads")) { error_no_permission(); } if (!$thread['tid']) { error($lang->error_invalidthread); } $user = get_user_by_username($mybb->input['username'], array('fields' => array('username'))); if (!$user['uid']) { error($lang->error_invaliduser); } $mybb->input['reason'] = $mybb->get_input('reason'); if (!trim($mybb->input['reason'])) { error($lang->error_missing_reason); } $query = $db->simple_select('replybans', 'rid', "uid='{$user['uid']}' AND tid='{$thread['tid']}'"); $existingban = $db->fetch_field($query, 'rid'); if ($existingban > 0) { error($lang->error_alreadybanned); } if ($mybb->get_input('liftban') == '---') { $lifted = 0; } else { $lifted = ban_date2timestamp($mybb->get_input('liftban'), 0); } $reason = my_substr($mybb->input['reason'], 0, 240); $insert_array = array('uid' => $user['uid'], 'tid' => $thread['tid'], 'dateline' => TIME_NOW, 'reason' => $db->escape_string($reason), 'lifted' => $db->escape_string($lifted)); $db->insert_query('replybans', $insert_array); log_moderator_action(array("tid" => $thread['tid'], "fid" => $thread['fid'], "uid" => $user['uid'], "username" => $user['username']), $lang->user_reply_banned); moderation_redirect("moderation.php?action=replyban&tid={$thread['tid']}", $lang->redirect_user_banned_replying); } if ($mybb->input['action'] == "liftreplyban") { // Verify incoming POST request verify_post_check($mybb->get_input('my_post_key')); $rid = $mybb->get_input('rid', MyBB::INPUT_INT); $query = $db->simple_select("replybans", "*", "rid='{$rid}'"); $ban = $db->fetch_array($query); if (!$ban['rid']) { error($lang->error_invalidreplyban); } $thread = get_thread($ban['tid']); $user = get_user($ban['uid']); if (!$thread['tid']) { error($lang->error_invalidthread); } if (!is_moderator($thread['fid'], "canmanagethreads")) { error_no_permission(); } $db->delete_query("replybans", "rid='{$ban['rid']}'"); log_moderator_action(array("tid" => $thread['tid'], "fid" => $thread['fid'], "uid" => $user['uid'], "username" => $user['username']), $lang->user_reply_banned_lifted); moderation_redirect("moderation.php?action=replyban&tid={$thread['tid']}", $lang->redirect_reply_ban_lifted); } exit; }
$banreason = htmlspecialchars_uni($mybb->get_input('banreason')); } // Generate the banned times dropdown $liftlist = ''; foreach ($bantimes as $time => $title) { $selected = ''; if (isset($banned['bantime']) && $banned['bantime'] == $time) { $selected = " selected=\"selected\""; } $thattime = ''; if ($time != '---') { $dateline = TIME_NOW; if (isset($banned['dateline'])) { $dateline = $banned['dateline']; } $thatime = my_date("D, jS M Y @ g:ia", ban_date2timestamp($time, $dateline)); $thattime = " ({$thatime})"; } eval("\$liftlist .= \"" . $templates->get("modcp_banuser_liftlist") . "\";"); } $bangroup_option = $bangroups = ''; $numgroups = $banned_group = 0; $groupscache = $cache->read("usergroups"); foreach ($groupscache as $key => $group) { if ($group['isbannedgroup']) { $selected = ""; if (isset($banned['gid']) && $banned['gid'] == $group['gid']) { $selected = " selected=\"selected\""; } $group['title'] = htmlspecialchars_uni($group['title']); eval("\$bangroup_option .= \"" . $templates->get("modcp_banuser_bangroups_group") . "\";");
} eval("\$banuser_username = \"" . $templates->get("modcp_banuser_addusername") . "\";"); } // Coming back to this page from an error? if ($errors) { $errors = inline_error($errors); $banned = array("bantime" => $mybb->input['liftafter'], "reason" => $mybb->input['reason'], "gid" => $mybb->input['gid']); $banreason = htmlspecialchars_uni($mybb->input['banreason']); } // Generate the banned times dropdown foreach ($bantimes as $time => $title) { $liftlist .= "<option value=\"{$time}\""; if ($banned['bantime'] == $time) { $liftlist .= " selected=\"selected\""; } $thatime = my_date("D, jS M Y @ g:ia", ban_date2timestamp($time, $banned['dateline'])); if ($time == '---') { $liftlist .= ">{$title}</option>\n"; } else { $liftlist .= ">{$title} ({$thatime})</option>\n"; } } $bangroups = ''; $query = $db->simple_select("usergroups", "gid, title", "isbannedgroup=1"); while ($item = $db->fetch_array($query)) { $selected = ""; if ($banned['gid'] == $item['gid']) { $selected = " selected=\"selected\""; } $bangroups .= "<option value=\"{$item['gid']}\"{$selected}>" . htmlspecialchars_uni($item['title']) . "</option>\n"; }