mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-28 06:08:52 +00:00
Adding the ability to get a list of all users with outstanding warnings
git-svn-id: file:///svn/phpbb/trunk@5333 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
parent
9acd80748c
commit
a7dcdb0760
5 changed files with 118 additions and 7 deletions
|
@ -2010,14 +2010,15 @@ function view_log($mode, &$log, &$log_count, $limit = 0, $offset = 0, $forum_id
|
|||
/**
|
||||
* Lists warned users
|
||||
*/
|
||||
function view_warned_users(&$users, &$user_count, $limit = 0, $offset = 0, $sort_by = 'user_warnings DESC')
|
||||
function view_warned_users(&$users, &$user_count, $limit = 0, $offset = 0, $limit_days = 0, $sort_by = 'user_warnings DESC')
|
||||
{
|
||||
global $db;
|
||||
|
||||
$sql = 'SELECT user_id, username, user_warnings
|
||||
FROM ' . USERS_TABLE . "
|
||||
$sql = 'SELECT user_id, username, user_warnings, user_last_warning
|
||||
FROM ' . USERS_TABLE . '
|
||||
WHERE user_warnings > 0
|
||||
ORDER BY $sort_by";
|
||||
' . (($limit_days) ? "AND user_last_warning >= $limit_days" : '') . "
|
||||
ORDER BY $sort_by";
|
||||
$result = $db->sql_query_limit($sql, $limit, $offset);
|
||||
|
||||
$users = $db->sql_fetchrowset($result);
|
||||
|
@ -2025,14 +2026,15 @@ function view_warned_users(&$users, &$user_count, $limit = 0, $offset = 0, $sort
|
|||
|
||||
$sql = 'SELECT count(user_id) AS user_count
|
||||
FROM ' . USERS_TABLE . '
|
||||
WHERE user_warnings > 0';
|
||||
WHERE user_warnings > 0
|
||||
' . (($limit_days) ? "AND user_last_warning >= $limit_days" : '');
|
||||
|
||||
$result = $db->sql_query($sql);
|
||||
|
||||
$row = $db->sql_fetchrow($result);
|
||||
$db->sql_freeresult($result);
|
||||
|
||||
$user_count = $row['user_count'];
|
||||
$user_count = $row['user_count'];
|
||||
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -41,6 +41,10 @@ class mcp_warn
|
|||
mcp_warn_front_view($id, $mode);
|
||||
$this->tpl_name = 'mcp_warn_front';
|
||||
break;
|
||||
case 'list':
|
||||
mcp_warn_list_view($id, $mode, $action);
|
||||
$this->tpl_name = 'mcp_warn_list';
|
||||
break;
|
||||
case 'warn_post':
|
||||
mcp_warn_post_view($id, $mode, $action);
|
||||
$this->tpl_name = 'mcp_warn_post';
|
||||
|
@ -141,6 +145,65 @@ function mcp_warn_front_view($id, $mode)
|
|||
$db->sql_freeresult($result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Lists all users with warnings
|
||||
*/
|
||||
function mcp_warn_list_view($id, $mode, $action)
|
||||
{
|
||||
global $SID, $phpEx, $phpbb_root_path, $config;
|
||||
global $template, $db, $user, $auth;
|
||||
|
||||
$user->add_lang('memberlist');
|
||||
|
||||
$start = request_var('start', 0);
|
||||
$st = request_var('st', 0);
|
||||
$sk = request_var('sk', 'b');
|
||||
$sd = request_var('sd', 'd');
|
||||
|
||||
$limit_days = array(0 => $user->lang['ALL_ENTRIES'], 1 => $user->lang['1_DAY'], 7 => $user->lang['7_DAYS'], 14 => $user->lang['2_WEEKS'], 30 => $user->lang['1_MONTH'], 90 => $user->lang['3_MONTHS'], 180 => $user->lang['6_MONTHS'], 364 => $user->lang['1_YEAR']);
|
||||
$sort_by_text = array('a' => $user->lang['SORT_USERNAME'], 'b' => $user->lang['SORT_DATE'], 'c' => $user->lang['SORT_WARNINGS']);
|
||||
$sort_by_sql = array('a' => 'username', 'b' => 'user_last_warning', 'c' => 'user_warnings');
|
||||
|
||||
$s_limit_days = $s_sort_key = $s_sort_dir = '';
|
||||
gen_sort_selects($limit_days, $sort_by_text, $st, $sk, $sd, $s_limit_days, $s_sort_key, $s_sort_dir);
|
||||
|
||||
// Define where and sort sql for use in displaying logs
|
||||
$sql_where = ($st) ? (time() - ($st * 86400)) : 0;
|
||||
$sql_sort = $sort_by_sql[$sk] . ' ' . (($sd == 'd') ? 'DESC' : 'ASC');
|
||||
|
||||
$users = array();
|
||||
$user_count = 0;
|
||||
|
||||
view_warned_users($users, $user_count, $config['topics_per_page'], $start, $sql_where, $sql_sort);
|
||||
|
||||
foreach ($users as $row)
|
||||
{
|
||||
$template->assign_block_vars('user', array(
|
||||
'U_NOTES' => 'mcp.' . $phpEx . $SID . '&i=notes&mode=user_notes&u=' . $row['user_id'],
|
||||
'U_USER' => 'memberlist.' . $phpEx . $SID . '&mode=viewprofile&u=' . $row['user_id'],
|
||||
|
||||
'USERNAME' => $row['username'],
|
||||
'WARNING_TIME' => $user->format_date($row['user_last_warning']),
|
||||
'WARNINGS' => $row['user_warnings'],
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
$template->assign_vars(array(
|
||||
'U_POST_ACTION' => "mcp.$phpEx$SID&i=$id&mode=$mode",
|
||||
'S_CLEAR_ALLOWED' => ($auth->acl_get('a_clearlogs')) ? true : false,
|
||||
'S_SELECT_SORT_DIR' => $s_sort_dir,
|
||||
'S_SELECT_SORT_KEY' => $s_sort_key,
|
||||
'S_SELECT_SORT_DAYS' => $s_limit_days,
|
||||
|
||||
'PAGE_NUMBER' => on_page($user_count, $config['topic_per_page'], $start),
|
||||
'PAGINATION' => generate_pagination("mcp.$phpEx$SID&i=$id&mode=$mode&st=$st&sk=$sk&sd=$sd", $user_count, $config['topics_per_page'], $start),
|
||||
'TOTAL_USERS' => ($user_count == 1) ? $user->lang['LIST_USER'] : sprintf($user->lang['LIST_USERS'], $user_count),
|
||||
)
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Handles warning the user when the warning is for a specific post
|
||||
*/
|
||||
|
|
|
@ -272,6 +272,8 @@ $lang = array_merge($lang, array(
|
|||
|
||||
'VIEW_DETAILS' => 'View Details',
|
||||
|
||||
'WARNED_USERS' => 'Warned Users',
|
||||
|
||||
'YOU_SELECTED_TOPIC' => 'You selected topic number %d: %s',
|
||||
|
||||
'report_reasons' => array(
|
||||
|
|
|
@ -32,7 +32,7 @@
|
|||
<tr>
|
||||
<td class="row1" width="15%" valign="top"><span class="gen"><a href="{highest.U_USER}">{highest.USERNAME}</a></span></td>
|
||||
<td class="row2" width="15%" valign="top"><span class="gen">{highest.WARNINGS}</span></td>
|
||||
<td class="row1" width="15%" valign="top"><span class="gen"></span></td>
|
||||
<td class="row1" width="15%" valign="top"><span class="gen">{highest.WARNING_TIME}</span></td>
|
||||
<td class="row2" width="15%" valign="top"><span class="gen"><a href="{highest.U_NOTES}">{L_VIEW_NOTES}</a></span></td>
|
||||
</tr>
|
||||
<!-- BEGINELSE -->
|
||||
|
|
44
phpBB/styles/subSilver/template/mcp_warn_list.html
Executable file
44
phpBB/styles/subSilver/template/mcp_warn_list.html
Executable file
|
@ -0,0 +1,44 @@
|
|||
<!-- INCLUDE mcp_header.html -->
|
||||
|
||||
<!-- $Id$ -->
|
||||
<form method="post" name="mcp" action="{U_POST_ACTION}">
|
||||
|
||||
<table class="tablebg" width="100%" cellspacing="1">
|
||||
<tr>
|
||||
<td class="row3" colspan="5" align="center"><b class="gen">{L_WARNED_USERS}</b></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th> {L_USERNAME} </th>
|
||||
<th> {L_WARNINGS} </th>
|
||||
<th> {L_LATEST_TIME} </th>
|
||||
<th> </th>
|
||||
</tr>
|
||||
<!-- BEGIN user -->
|
||||
<tr>
|
||||
<td class="row1" width="15%" valign="top"><span class="gen"><a href="{user.U_USER}">{user.USERNAME}</a></span></td>
|
||||
<td class="row2" width="15%" valign="top"><span class="gen">{user.WARNINGS}</span></td>
|
||||
<td class="row1" width="15%" valign="top"><span class="gen">{user.WARNING_TIME}</span></td>
|
||||
<td class="row2" width="15%" valign="top"><span class="gen"><a href="{user.U_NOTES}">{L_VIEW_NOTES}</a></span></td>
|
||||
</tr>
|
||||
<!-- BEGINELSE -->
|
||||
<tr>
|
||||
<td class="row1" colspan="5" align="center"><span class="gen">{L_WARNINGS_ZERO_TOTAL}</span></td>
|
||||
</tr>
|
||||
<!-- END user -->
|
||||
<tr align="center">
|
||||
<td class="row3" colspan="4"><span class="gensmall">{L_DISPLAY_POSTS}:</span> {S_SELECT_SORT_DAYS} <span class="gensmall">{L_SORT_BY}</span> {S_SELECT_SORT_KEY} {S_SELECT_SORT_DIR} <input class="btnlite" type="submit" value="{L_GO}" name="sort" /></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<table width="100%" cellspacing="0" cellpadding="0">
|
||||
<tr>
|
||||
<td class="pagination">{PAGE_NUMBER} [ {TOTAL_USERS} ]</td>
|
||||
<td align="right"><span class="pagination"><!-- IF PAGINATION --><a href="javascript:jumpto();">{L_GOTO_PAGE}</a> <!-- IF PREVIOUS_PAGE --><a href="{PREVIOUS_PAGE}">{L_PREVIOUS}</a> <!-- ENDIF -->{PAGINATION}<!-- IF NEXT_PAGE --> <a href="{NEXT_PAGE}">{L_NEXT}</a><!-- ENDIF --><!-- ENDIF --></span></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
</form>
|
||||
|
||||
<br clear="all" /><br />
|
||||
|
||||
<!-- INCLUDE mcp_footer.html -->
|
Loading…
Add table
Reference in a new issue