mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-10 13:28:55 +00:00
Feature Bug #43375 - Ability to delete warnings and keep warnings permanently
Authorised by: AcydBurn git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9758 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
parent
0b2979c6ba
commit
e3866c939d
9 changed files with 235 additions and 1 deletions
|
@ -83,6 +83,10 @@
|
|||
|
||||
<!-- INCLUDE acp_users_feedback.html -->
|
||||
|
||||
<!-- ELSEIF S_WARNINGS -->
|
||||
|
||||
<!-- INCLUDE acp_users_warnings.html -->
|
||||
|
||||
<!-- ELSEIF S_PROFILE -->
|
||||
|
||||
<!-- INCLUDE acp_users_profile.html -->
|
||||
|
|
39
phpBB/adm/style/acp_users_warnings.html
Normal file
39
phpBB/adm/style/acp_users_warnings.html
Normal file
|
@ -0,0 +1,39 @@
|
|||
<form id="list" method="post" action="{U_ACTION}">
|
||||
|
||||
<!-- IF .warn -->
|
||||
<table cellspacing="1">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>{L_REPORT_BY}</th>
|
||||
<th>{L_TIME}</th>
|
||||
<th>{L_FEEDBACK}</th>
|
||||
<!-- IF S_CLEARLOGS --><th>{L_MARK}</th><!-- ENDIF -->
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<!-- BEGIN warn -->
|
||||
<!-- IF warn.S_ROW_COUNT is even --><tr class="row1"><!-- ELSE --><tr class="row2"><!-- ENDIF -->
|
||||
|
||||
<td>{warn.USERNAME}</td>
|
||||
<td style="text-align: center; nowrap: nowrap;">{warn.DATE}</td>
|
||||
<td>{warn.ACTION}</td>
|
||||
<!-- IF S_CLEARLOGS --><td style="text-align: center;"><input type="checkbox" class="radio" name="mark[]" value="{warn.ID}" /></td><!-- ENDIF -->
|
||||
</tr>
|
||||
<!-- END warn -->
|
||||
</tbody>
|
||||
</table>
|
||||
<!-- ELSE -->
|
||||
<div class="errorbox">
|
||||
<p>{L_NO_WARNINGS}</p>
|
||||
</div>
|
||||
<!-- ENDIF -->
|
||||
|
||||
<!-- IF S_CLEARLOGS -->
|
||||
<fieldset class="quick">
|
||||
<input class="button2" type="submit" name="delall" value="{L_DELETE_ALL}" />
|
||||
<input class="button2" type="submit" name="delmarked" value="{L_DELETE_MARKED}" />
|
||||
<p class="small"><a href="#" onclick="marklist('list', 'mark', true);">{L_MARK_ALL}</a> • <a href="#" onclick="marklist('list', 'mark', false);">{L_UNMARK_ALL}</a></p>
|
||||
</fieldset>
|
||||
<!-- ENDIF -->
|
||||
{S_FORM_TOKEN}
|
||||
</form>
|
|
@ -199,6 +199,7 @@
|
|||
<li>[Feature] Detect when a post has been altered by someone else while editing. (Patch by bantu)</li>
|
||||
<li>[Feature] Add unread posts quick search option (Bug #46765 - Patch by rxu)</li>
|
||||
<li>[Feature] Add option to disable remote upload avatars (Bug #45375 - Patch by nickvergessen)</li>
|
||||
<li>[Feature] Ability to delete warnings and keep warnings permanently (Bug #43375 - Patch by nickvergessen)</li>
|
||||
</ul>
|
||||
|
||||
<a name="v304"></a><h3>1.ii. Changes since 3.0.4</h3>
|
||||
|
|
|
@ -1065,6 +1065,148 @@ class acp_users
|
|||
|
||||
break;
|
||||
|
||||
case 'warnings':
|
||||
$user->add_lang('mcp');
|
||||
|
||||
// Set up general vars
|
||||
$start = request_var('start', 0);
|
||||
$deletemark = (isset($_POST['delmarked'])) ? true : false;
|
||||
$deleteall = (isset($_POST['delall'])) ? true : false;
|
||||
$confirm = (isset($_POST['confirm'])) ? true : false;
|
||||
$marked = request_var('mark', array(0));
|
||||
$message = utf8_normalize_nfc(request_var('message', '', true));
|
||||
|
||||
// Sort keys
|
||||
$sort_days = request_var('st', 0);
|
||||
$sort_key = request_var('sk', 't');
|
||||
$sort_dir = request_var('sd', 'd');
|
||||
|
||||
// Delete entries if requested and able
|
||||
if ($deletemark || $deleteall || $confirm)
|
||||
{
|
||||
if (confirm_box(true))
|
||||
{
|
||||
$where_sql = '';
|
||||
$deletemark = request_var('delmarked', 0);
|
||||
$deleteall = request_var('delall', 0);
|
||||
if ($deletemark && $marked)
|
||||
{
|
||||
$sql_in = array();
|
||||
foreach ($marked as $mark)
|
||||
{
|
||||
$sql_in[] = $mark;
|
||||
}
|
||||
$where_sql = ' AND ' . $db->sql_in_set('warning_id', $sql_in);
|
||||
unset($sql_in);
|
||||
}
|
||||
|
||||
if ($where_sql || $deleteall)
|
||||
{
|
||||
$sql = 'DELETE FROM ' . WARNINGS_TABLE . "
|
||||
WHERE user_id = $user_id
|
||||
$where_sql";
|
||||
$db->sql_query($sql);
|
||||
|
||||
if ($deleteall)
|
||||
{
|
||||
$deleted_warnings = '0';
|
||||
}
|
||||
else
|
||||
{
|
||||
$deleted_warnings = ' user_warnings - ' . $db->sql_affectedrows();
|
||||
}
|
||||
|
||||
$sql = 'UPDATE ' . USERS_TABLE . "
|
||||
SET user_warnings = $deleted_warnings
|
||||
WHERE user_id = $user_id";
|
||||
$db->sql_query($sql);
|
||||
|
||||
add_log('admin', 'LOG_WARNING_DELETED', $user_row['username']);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$s_hidden_fields = array(
|
||||
'i' => $id,
|
||||
'mode' => $mode,
|
||||
'u' => $user_id,
|
||||
'mark' => $marked,
|
||||
);
|
||||
if (isset($_POST['delmarked']))
|
||||
{
|
||||
$s_hidden_fields['delmarked'] = 1;
|
||||
}
|
||||
if (isset($_POST['delall']))
|
||||
{
|
||||
$s_hidden_fields['delall'] = 1;
|
||||
}
|
||||
if (isset($_POST['delall']) || (isset($_POST['delmarked']) && sizeof($marked)))
|
||||
{
|
||||
confirm_box(false, $user->lang['CONFIRM_OPERATION'], build_hidden_fields($s_hidden_fields));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$sql = 'SELECT w.warning_id, w.warning_time, w.post_id, l.log_operation, l.log_data, l.user_id AS mod_user_id, m.username AS mod_username, m.user_colour AS mod_user_colour
|
||||
FROM ' . WARNINGS_TABLE . ' w
|
||||
LEFT JOIN ' . LOG_TABLE . ' l
|
||||
ON (w.log_id = l.log_id)
|
||||
LEFT JOIN ' . USERS_TABLE . ' m
|
||||
ON (l.user_id = m.user_id)
|
||||
WHERE w.user_id = ' . $user_id . '
|
||||
ORDER BY w.warning_time DESC';
|
||||
$result = $db->sql_query($sql);
|
||||
|
||||
while ($row = $db->sql_fetchrow($result))
|
||||
{
|
||||
if (!$row['log_operation'])
|
||||
{
|
||||
// We do not have a log-entry anymore, so there is no data available
|
||||
$row['action'] = $user->lang['USER_WARNING_LOG_DELETED'];
|
||||
}
|
||||
else
|
||||
{
|
||||
$row['action'] = (isset($user->lang[$row['log_operation']])) ? $user->lang[$row['log_operation']] : '{' . ucfirst(str_replace('_', ' ', $row['log_operation'])) . '}';
|
||||
if (!empty($row['log_data']))
|
||||
{
|
||||
$log_data_ary = @unserialize($row['log_data']);
|
||||
$log_data_ary = ($log_data_ary === false) ? array() : $log_data_ary;
|
||||
|
||||
if (isset($user->lang[$row['log_operation']]))
|
||||
{
|
||||
// Check if there are more occurrences of % than arguments, if there are we fill out the arguments array
|
||||
// It doesn't matter if we add more arguments than placeholders
|
||||
if ((substr_count($row['action'], '%') - sizeof($log_data_ary)) > 0)
|
||||
{
|
||||
$log_data_ary = array_merge($log_data_ary, array_fill(0, substr_count($row['action'], '%') - sizeof($log_data_ary), ''));
|
||||
}
|
||||
$row['action'] = vsprintf($row['action'], $log_data_ary);
|
||||
$row['action'] = bbcode_nl2br(censor_text($row['action']));
|
||||
}
|
||||
else if (!empty($log_data_ary))
|
||||
{
|
||||
$row['action'] .= '<br />' . implode('', $log_data_ary);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$template->assign_block_vars('warn', array(
|
||||
'ID' => $row['warning_id'],
|
||||
'USERNAME' => ($row['log_operation']) ? get_username_string('full', $row['mod_user_id'], $row['mod_username'], $row['mod_user_colour']) : '-',
|
||||
'ACTION' => make_clickable($row['action']),
|
||||
'DATE' => $user->format_date($row['warning_time']),
|
||||
));
|
||||
}
|
||||
$db->sql_freeresult($result);
|
||||
|
||||
$template->assign_vars(array(
|
||||
'S_WARNINGS' => true,
|
||||
'S_CLEARLOGS' => $auth->acl_get('a_clearlogs'),
|
||||
));
|
||||
|
||||
break;
|
||||
|
||||
case 'profile':
|
||||
|
||||
include($phpbb_root_path . 'includes/functions_user.' . $phpEx);
|
||||
|
|
|
@ -22,6 +22,7 @@ class acp_users_info
|
|||
'modes' => array(
|
||||
'overview' => array('title' => 'ACP_MANAGE_USERS', 'auth' => 'acl_a_user', 'cat' => array('ACP_CAT_USERS')),
|
||||
'feedback' => array('title' => 'ACP_USER_FEEDBACK', 'auth' => 'acl_a_user', 'display' => false, 'cat' => array('ACP_CAT_USERS')),
|
||||
'warnings' => array('title' => 'ACP_USER_WARNINGS', 'auth' => 'acl_a_user', 'display' => false, 'cat' => array('ACP_CAT_USERS')),
|
||||
'profile' => array('title' => 'ACP_USER_PROFILE', 'auth' => 'acl_a_user', 'display' => false, 'cat' => array('ACP_CAT_USERS')),
|
||||
'prefs' => array('title' => 'ACP_USER_PREFS', 'auth' => 'acl_a_user', 'display' => false, 'cat' => array('ACP_CAT_USERS')),
|
||||
'avatar' => array('title' => 'ACP_USER_AVATAR', 'auth' => 'acl_a_user', 'display' => false, 'cat' => array('ACP_CAT_USERS')),
|
||||
|
|
|
@ -4025,7 +4025,7 @@ function page_footer($run_cron = true)
|
|||
// Tidy the cache
|
||||
$cron_type = 'tidy_cache';
|
||||
}
|
||||
else if (time() - $config['warnings_gc'] > $config['warnings_last_gc'])
|
||||
else if ($config['warnings_last_gc'] && (time() - $config['warnings_gc'] > $config['warnings_last_gc']))
|
||||
{
|
||||
$cron_type = 'tidy_warnings';
|
||||
}
|
||||
|
|
|
@ -1122,6 +1122,49 @@ function change_database_data(&$no_updates, $version)
|
|||
}
|
||||
}
|
||||
|
||||
// Also install the "User Warning" module
|
||||
$sql = 'SELECT module_id
|
||||
FROM ' . MODULES_TABLE . "
|
||||
WHERE module_class = 'acp'
|
||||
AND module_langname = 'ACP_USER_MANAGEMENT'
|
||||
AND module_mode = ''
|
||||
AND module_basename = ''";
|
||||
$result = $db->sql_query($sql);
|
||||
|
||||
while ($row = $db->sql_fetchrow($result))
|
||||
{
|
||||
$category_id = (int) $row['module_id'];
|
||||
|
||||
// Check if we actually need to add the module or if it is already added. ;)
|
||||
$sql = 'SELECT *
|
||||
FROM ' . MODULES_TABLE . "
|
||||
WHERE module_class = 'acp'
|
||||
AND module_langname = 'ACP_USER_WARNINGS'
|
||||
AND module_mode = 'warnings'
|
||||
AND module_auth = 'acl_a_user'
|
||||
AND parent_id = {$category_id}";
|
||||
$result2 = $db->sql_query($sql);
|
||||
$row2 = $db->sql_fetchrow($result2);
|
||||
$db->sql_freeresult($result2);
|
||||
|
||||
if (!$row2)
|
||||
{
|
||||
$module_data = array(
|
||||
'module_basename' => 'users',
|
||||
'module_enabled' => 1,
|
||||
'module_display' => 0,
|
||||
'parent_id' => $category_id,
|
||||
'module_class' => 'acp',
|
||||
'module_langname' => 'ACP_USER_WARNINGS',
|
||||
'module_mode' => 'warnings',
|
||||
'module_auth' => 'acl_a_user',
|
||||
);
|
||||
|
||||
$_module->update_module_data($module_data, true);
|
||||
}
|
||||
}
|
||||
$db->sql_freeresult($result);
|
||||
|
||||
$_module->remove_cache_file();
|
||||
|
||||
// Add newly_registered group... but check if it already exists (we always supported running the updater on any schema)
|
||||
|
|
|
@ -186,6 +186,7 @@ $lang = array_merge($lang, array(
|
|||
'ACP_USER_ROLES' => 'User roles',
|
||||
'ACP_USER_SECURITY' => 'User security',
|
||||
'ACP_USER_SIG' => 'Signature',
|
||||
'ACP_USER_WARNINGS' => 'Warnings',
|
||||
|
||||
'ACP_VC_SETTINGS' => 'Visual confirmation settings',
|
||||
'ACP_VC_CAPTCHA_DISPLAY' => 'CAPTCHA image preview',
|
||||
|
@ -697,6 +698,7 @@ $lang = array_merge($lang, array(
|
|||
'LOG_USER_REACTIVATE_USER' => '<strong>Forced user account reactivation</strong>',
|
||||
'LOG_USER_UNLOCK' => '<strong>User unlocked own topic</strong><br />» %s',
|
||||
'LOG_USER_WARNING' => '<strong>Added user warning</strong><br />» %s',
|
||||
'LOG_WARNING_DELETED' => '<strong>Deleted user warning</strong><br />» %s',
|
||||
'LOG_USER_WARNING_BODY' => '<strong>The following warning was issued to this user</strong><br />» %s',
|
||||
|
||||
'LOG_USER_GROUP_CHANGE' => '<strong>User changed default group</strong><br />» %s',
|
||||
|
|
|
@ -77,6 +77,7 @@ $lang = array_merge($lang, array(
|
|||
'MOVE_POSTS_EXPLAIN' => 'Please select the forum to which you wish to move all the posts this user has made.',
|
||||
|
||||
'NO_SPECIAL_RANK' => 'No special rank assigned',
|
||||
'NO_WARNINGS' => 'No warnings.',
|
||||
'NOT_MANAGE_FOUNDER' => 'You tried to manage a user with founder status. Only founders are allowed to manage other founders.',
|
||||
|
||||
'QUICK_TOOLS' => 'Quick tools',
|
||||
|
@ -130,6 +131,7 @@ $lang = array_merge($lang, array(
|
|||
'USER_RANK' => 'User rank',
|
||||
'USER_RANK_UPDATED' => 'User rank updated.',
|
||||
'USER_SIG_UPDATED' => 'User signature successfully updated.',
|
||||
'USER_WARNING_LOG_DELETED' => 'No information available. Possibly the log entry has been deleted.',
|
||||
'USER_TOOLS' => 'Basic tools',
|
||||
));
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue