What use is a shiny banstick(TM) if nobody finds it?

git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@8574 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
Henry Sudhof 2008-05-29 13:59:47 +00:00
parent a3368632d0
commit bb8a48817c
6 changed files with 41 additions and 7 deletions

View file

@ -108,6 +108,7 @@
<li>[Feature] Added optional stricter upload validation to avoid mime sniffing in addition to the safeguards provided by file.php. (thanks to Nicolas Grekas for compiling the list).</li> <li>[Feature] Added optional stricter upload validation to avoid mime sniffing in addition to the safeguards provided by file.php. (thanks to Nicolas Grekas for compiling the list).</li>
<li>[Fix] Do not remove whitespace in front of url containing the boards url and no relative path appended (Bug #27355)</li> <li>[Fix] Do not remove whitespace in front of url containing the boards url and no relative path appended (Bug #27355)</li>
<li>[Change] Show email ban reason on registration. Additionally allow custom errors properly returned if using validate_data(). (Bug #26885)</li> <li>[Change] Show email ban reason on registration. Additionally allow custom errors properly returned if using validate_data(). (Bug #26885)</li>
<li>[Feature] Streamlined banning via the MCP by adding a ban link to the user profile. Also pre-fills ban fields as far as possible.</li>
</ul> </ul>
<a name="v300"></a><h3>1.ii. Changes since 3.0.0</h3> <a name="v300"></a><h3>1.ii. Changes since 3.0.0</h3>

View file

@ -151,7 +151,7 @@ class mcp_ban
'U_FIND_USERNAME' => append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=searchuser&amp;form=mcp_ban&amp;field=ban'), 'U_FIND_USERNAME' => append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=searchuser&amp;form=mcp_ban&amp;field=ban'),
)); ));
if ($mode != 'user') if ($mode === 'email' && !$auth->acl_get('a_user'))
{ {
return; return;
} }
@ -163,11 +163,24 @@ class mcp_ban
if ($user_id && $user_id <> ANONYMOUS) if ($user_id && $user_id <> ANONYMOUS)
{ {
$sql = 'SELECT username $sql = 'SELECT username, user_email, user_ip
FROM ' . USERS_TABLE . ' FROM ' . USERS_TABLE . '
WHERE user_id = ' . $user_id; WHERE user_id = ' . $user_id;
$result = $db->sql_query($sql); $result = $db->sql_query($sql);
$username = (string) $db->sql_fetchfield('username'); switch ($mode)
{
case 'user':
$pre_fill = (string) $db->sql_fetchfield('username');
break;
case 'ip':
$pre_fill = (string) $db->sql_fetchfield('user_ip');
break;
case 'email':
$pre_fill = (string) $db->sql_fetchfield('user_email');
break;
}
$db->sql_freeresult($result); $db->sql_freeresult($result);
} }
else if ($post_id) else if ($post_id)
@ -176,13 +189,29 @@ class mcp_ban
if (sizeof($post_info) && !empty($post_info[$post_id])) if (sizeof($post_info) && !empty($post_info[$post_id]))
{ {
$username = $post_info[$post_id]['username']; switch ($mode)
{
case 'user':
$pre_fill = $post_info[$post_id]['username'];
break;
case 'ip':
$pre_fill = $post_info[$post_id]['poster_ip'];
break;
case 'email':
$pre_fill = $post_info[$post_id]['user_email'];
break;
}
} }
} }
if ($username) if ($pre_fill)
{ {
$template->assign_var('USERNAMES', $username); // left for legacy template compatibility
$template->assign_var('USERNAMES', $pre_fill);
$template->assign_var('BAN_QUANTIFIER', $pre_fill);
} }
} }
} }

View file

@ -132,6 +132,7 @@ $lang = array_merge($lang, array(
'USERNAME_BEGINS_WITH' => 'Username begins with', 'USERNAME_BEGINS_WITH' => 'Username begins with',
'USER_ADMIN' => 'Administrate user', 'USER_ADMIN' => 'Administrate user',
'USER_BAN' => 'Banning',
'USER_FORUM' => 'User statistics', 'USER_FORUM' => 'User statistics',
'USER_ONLINE' => 'Online', 'USER_ONLINE' => 'Online',
'USER_PRESENCE' => 'Board presence', 'USER_PRESENCE' => 'Board presence',

View file

@ -551,6 +551,8 @@ switch ($mode)
'S_CUSTOM_FIELDS' => (isset($profile_fields['row']) && sizeof($profile_fields['row'])) ? true : false, 'S_CUSTOM_FIELDS' => (isset($profile_fields['row']) && sizeof($profile_fields['row'])) ? true : false,
'U_USER_ADMIN' => ($auth->acl_get('a_user')) ? append_sid("{$phpbb_root_path}adm/index.$phpEx", 'i=users&amp;mode=overview&amp;u=' . $user_id, true, $user->session_id) : '', 'U_USER_ADMIN' => ($auth->acl_get('a_user')) ? append_sid("{$phpbb_root_path}adm/index.$phpEx", 'i=users&amp;mode=overview&amp;u=' . $user_id, true, $user->session_id) : '',
'U_USER_BAN' => ($auth->acl_get('m_ban')) ? append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=ban&amp;mode=user&amp;u=' . $user_id) : '',
'U_SWITCH_PERMISSIONS' => ($auth->acl_get('a_switchperm') && $user->data['user_id'] != $user_id) ? append_sid("{$phpbb_root_path}ucp.$phpEx", "mode=switch_perm&amp;u={$user_id}") : '', 'U_SWITCH_PERMISSIONS' => ($auth->acl_get('a_switchperm') && $user->data['user_id'] != $user_id) ? append_sid("{$phpbb_root_path}ucp.$phpEx", "mode=switch_perm&amp;u={$user_id}") : '',
'S_ZEBRA' => ($user->data['user_id'] != $user_id && $user->data['is_registered'] && $zebra_enabled) ? true : false, 'S_ZEBRA' => ($user->data['user_id'] != $user_id && $user->data['is_registered'] && $zebra_enabled) ? true : false,

View file

@ -44,7 +44,7 @@
<fieldset> <fieldset>
<dl> <dl>
<dt><label for="ban">{L_BAN_CELL}:</label></dt> <dt><label for="ban">{L_BAN_CELL}:</label></dt>
<dd><label for="ban"><textarea name="ban" id="ban" class="inputbox" cols="40" rows="3">{USERNAMES}</textarea></label></dd> <dd><label for="ban"><textarea name="ban" id="ban" class="inputbox" cols="40" rows="3">{BAN_QUANTIFIER}</textarea></label></dd>
<!-- IF S_USERNAME_BAN --><dd><strong><a href="{U_FIND_USERNAME}" onclick="find_username(this.href); return false;">{L_FIND_USERNAME}</a></strong></dd><!-- ENDIF --> <!-- IF S_USERNAME_BAN --><dd><strong><a href="{U_FIND_USERNAME}" onclick="find_username(this.href); return false;">{L_FIND_USERNAME}</a></strong></dd><!-- ENDIF -->
</dl> </dl>
<dl> <dl>

View file

@ -19,6 +19,7 @@
<dd> <dd>
<!-- IF USER_COLOR --><span style="color: {USER_COLOR}; font-weight: bold;"><!-- ELSE --><span><!-- ENDIF -->{USERNAME}</span> <!-- IF USER_COLOR --><span style="color: {USER_COLOR}; font-weight: bold;"><!-- ELSE --><span><!-- ENDIF -->{USERNAME}</span>
<!-- IF U_USER_ADMIN --> [ <a href="{U_USER_ADMIN}">{L_USER_ADMIN}</a> ]<!-- ENDIF --> <!-- IF U_USER_ADMIN --> [ <a href="{U_USER_ADMIN}">{L_USER_ADMIN}</a> ]<!-- ENDIF -->
<!-- IF U_USER_BAN --> [ <a href="{U_USER_BAN}">{L_USER_BAN}</a> ]<!-- ENDIF -->
<!-- IF U_SWITCH_PERMISSIONS --> [ <a href="{U_SWITCH_PERMISSIONS}">{L_USE_PERMISSIONS}</a> ]<!-- ENDIF --> <!-- IF U_SWITCH_PERMISSIONS --> [ <a href="{U_SWITCH_PERMISSIONS}">{L_USE_PERMISSIONS}</a> ]<!-- ENDIF -->
</dd> </dd>
<!-- IF not AVATAR_IMG --> <!-- IF not AVATAR_IMG -->