more bugfixing. Important change: admins able to give ban reason for user quick tool ban - logging also syndicated, now always logged to ACP and MCP logs.

git-svn-id: file:///svn/phpbb/trunk@7426 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
Meik Sievertsen 2007-04-29 12:30:22 +00:00
parent c262c4addb
commit 290187c6c7
12 changed files with 444 additions and 364 deletions

View file

@ -67,14 +67,62 @@
</form> </form>
<!-- IF not S_USER_FOUNDER or S_FOUNDER --> <!-- IF not S_USER_FOUNDER or S_FOUNDER -->
<script type="text/javascript">
<!--
function display_reason(option)
{
if (option != 'banuser' && option != 'banemail' && option != 'banip')
{
dE('reasons', -1);
return;
}
dE('reasons', 1);
element = document.getElementById('user_quick_tools').ban_reason;
if (element.value && element.value != '{LA_USER_ADMIN_BAN_NAME_REASON}' && element.value != '{LA_USER_ADMIN_BAN_EMAIL_REASON}' && element.value != '{LA_USER_ADMIN_BAN_IP_REASON}')
{
return;
}
if (option == 'banuser')
{
element.value = '{LA_USER_ADMIN_BAN_NAME_REASON}';
}
else if (option == 'banemail')
{
element.value = '{LA_USER_ADMIN_BAN_EMAIL_REASON}';
}
else if (option == 'banip')
{
element.value = '{LA_USER_ADMIN_BAN_IP_REASON}';
}
}
//-->
</script>
<form id="user_quick_tools" method="post" action="{U_ACTION}"> <form id="user_quick_tools" method="post" action="{U_ACTION}">
<fieldset> <fieldset>
<legend>{L_USER_TOOLS}</legend> <legend>{L_USER_TOOLS}</legend>
<dl> <dl>
<dt><label for="quicktools">{L_QUICK_TOOLS}:</label></dt> <dt><label for="quicktools">{L_QUICK_TOOLS}:</label></dt>
<dd><select id="quicktools" name="action">{S_ACTION_OPTIONS}</select></dd> <dd><select id="quicktools" name="action" onchange="display_reason(this.options[this.selectedIndex].value);">{S_ACTION_OPTIONS}</select></dd>
</dl> </dl>
<div style="display: none;" id="reasons">
<dl>
<dt><label for="ban_reason">{L_BAN_REASON}:</label></dt>
<dd><input name="ban_reason" type="text" id="ban_reason" class="medium" maxlength="3000" /></dd>
</dl>
<dl>
<dt><label for="ban_give_reason">{L_BAN_GIVE_REASON}:</label></dt>
<dd><input name="ban_give_reason" type="text" id="ban_give_reason" class="medium" maxlength="3000" /></dd>
</dl>
</div>
<!-- IF not S_OWN_ACCOUNT --> <!-- IF not S_OWN_ACCOUNT -->
<dl> <dl>
<dt><label for="delete_user">{L_DELETE_USER}:</label><br /><span>{L_DELETE_USER_EXPLAIN}</span></dt> <dt><label for="delete_user">{L_DELETE_USER}:</label><br /><span>{L_DELETE_USER_EXPLAIN}</span></dt>

View file

@ -148,6 +148,8 @@ class acp_users
{ {
case 'overview': case 'overview':
$user->add_lang('acp/ban');
$delete = request_var('delete', 0); $delete = request_var('delete', 0);
$delete_type = request_var('delete_type', ''); $delete_type = request_var('delete_type', '');
$ip = request_var('ip', 'ip'); $ip = request_var('ip', 'ip');
@ -246,10 +248,11 @@ class acp_users
break; break;
} }
user_ban(substr($action, 3), $ban, 0, 0, 0, $user->lang[$reason]); $ban_reason = request_var('ban_reason', $user->lang[$reason], true);
$ban_give_reason = request_var('ban_give_reason', '', true);
add_log('admin', $log, $user->lang[$reason], implode(', ', $ban)); // Log not used at the moment, we simply utilize the ban function.
add_log('user', $user_id, $log, $user->lang[$reason], implode(', ', $ban)); user_ban(substr($action, 3), $ban, 0, 0, 0, $ban_reason, $ban_give_reason);
trigger_error($user->lang['BAN_SUCCESSFUL'] . adm_back_link($this->u_action . '&amp;u=' . $user_id)); trigger_error($user->lang['BAN_SUCCESSFUL'] . adm_back_link($this->u_action . '&amp;u=' . $user_id));
@ -837,8 +840,7 @@ class acp_users
'USER_WARNINGS' => $user_row['user_warnings'], 'USER_WARNINGS' => $user_row['user_warnings'],
'USER_POSTS' => $user_row['user_posts'], 'USER_POSTS' => $user_row['user_posts'],
'USER_INACTIVE_REASON' => $inactive_reason, 'USER_INACTIVE_REASON' => $inactive_reason,
) ));
);
break; break;

View file

@ -946,7 +946,10 @@ function user_ban($mode, $ban, $ban_len, $ban_len_other, $ban_exclude, $ban_reas
// Update log // Update log
$log_entry = ($ban_exclude) ? 'LOG_BAN_EXCLUDE_' : 'LOG_BAN_'; $log_entry = ($ban_exclude) ? 'LOG_BAN_EXCLUDE_' : 'LOG_BAN_';
// Add to moderator and admin log
add_log('admin', $log_entry . strtoupper($mode), $ban_reason, $ban_list_log); add_log('admin', $log_entry . strtoupper($mode), $ban_reason, $ban_list_log);
add_log('mod', 0, 0, $log_entry . strtoupper($mode), $ban_reason, $ban_list_log);
return true; return true;
} }
@ -1012,7 +1015,9 @@ function user_unban($mode, $ban)
WHERE ' . $db->sql_in_set('ban_id', $unban_sql); WHERE ' . $db->sql_in_set('ban_id', $unban_sql);
$db->sql_query($sql); $db->sql_query($sql);
// Add to moderator and admin log
add_log('admin', 'LOG_UNBAN_' . strtoupper($mode), $l_unban_list); add_log('admin', 'LOG_UNBAN_' . strtoupper($mode), $l_unban_list);
add_log('mod', 0, 0, 'LOG_UNBAN_' . strtoupper($mode), $l_unban_list);
} }
return false; return false;
@ -1147,13 +1152,18 @@ function validate_num($num, $optional = false, $min = 0, $max = 1E99)
* *
* @return boolean|string Either false if validation succeeded or a string which will be used as the error message (with the variable name appended) * @return boolean|string Either false if validation succeeded or a string which will be used as the error message (with the variable name appended)
*/ */
function validate_match($string, $optional = false, $match) function validate_match($string, $optional = false, $match = '')
{ {
if (empty($string) && $optional) if (empty($string) && $optional)
{ {
return false; return false;
} }
if (empty($match))
{
return false;
}
if (!preg_match($match, $string)) if (!preg_match($match, $string))
{ {
return 'WRONG_DATA'; return 'WRONG_DATA';

View file

@ -231,6 +231,8 @@ class ucp_main
} }
} }
if ($config['allow_forum_notify'])
{
$sql_array = array( $sql_array = array(
'SELECT' => 'f.*', 'SELECT' => 'f.*',
@ -323,8 +325,11 @@ class ucp_main
); );
} }
$db->sql_freeresult($result); $db->sql_freeresult($result);
}
// Subscribed Topics // Subscribed Topics
if ($config['allow_topic_notify'])
{
$start = request_var('start', 0); $start = request_var('start', 0);
$sql = 'SELECT COUNT(topic_id) as topics_count $sql = 'SELECT COUNT(topic_id) as topics_count
@ -469,6 +474,12 @@ class ucp_main
'U_VIEW_TOPIC' => $view_topic_url, 'U_VIEW_TOPIC' => $view_topic_url,
)); ));
} }
}
$template->assign_vars(array(
'S_TOPIC_NOTIFY' => $config['allow_topic_notify'],
'S_FORUM_NOTIFY' => $config['allow_forum_notify'],
));
break; break;

View file

@ -281,8 +281,8 @@ $lang = array_merge($lang, array(
$lang = array_merge($lang, array( $lang = array_merge($lang, array(
'ACP_ADMIN_LOGS_EXPLAIN' => 'This lists all the actions carried out by board administrators. You can sort by username, date, IP or action. If you have appropriate permissions you can also clear individual operations or the log as a whole.', 'ACP_ADMIN_LOGS_EXPLAIN' => 'This lists all the actions carried out by board administrators. You can sort by username, date, IP or action. If you have appropriate permissions you can also clear individual operations or the log as a whole.',
'ACP_CRITICAL_LOGS_EXPLAIN' => 'This lists the actions carried out by the board itself. This log provides you with information you are able to use for solving specific problems, for example non-delivery of emails. You can sort by username, date, IP or action. If you have appropriate permissions you can also clear individual operations or the log as a whole.', 'ACP_CRITICAL_LOGS_EXPLAIN' => 'This lists the actions carried out by the board itself. This log provides you with information you are able to use for solving specific problems, for example non-delivery of emails. You can sort by username, date, IP or action. If you have appropriate permissions you can also clear individual operations or the log as a whole.',
'ACP_MOD_LOGS_EXPLAIN' => 'This lists the actions carried out by board moderators, select a forum from the drop down list. You can sort by username, date, IP or action. If you have appropriate permissions you can also clear individual operations or the log as a whole.', 'ACP_MOD_LOGS_EXPLAIN' => 'This lists all actions done on forums, topics and posts as well as actions carried out on users by moderators, including banning. You can sort by username, date, IP or action. If you have appropriate permissions you can also clear individual operations or the log as a whole.',
'ACP_USERS_LOGS_EXPLAIN' => 'This lists all actions carried out by users or on users.', 'ACP_USERS_LOGS_EXPLAIN' => 'This lists all actions carried out by users or on users (warnings and user notes).',
'ALL_ENTRIES' => 'All entries', 'ALL_ENTRIES' => 'All entries',
'DISPLAY_LOG' => 'Display entries from previous', 'DISPLAY_LOG' => 'Display entries from previous',

View file

@ -120,7 +120,7 @@ $help = array(
), ),
array( array(
0 => 'How do I create a poll?', 0 => 'How do I create a poll?',
1 => 'Creating a poll is easy, when you post a new topic (or edit the first post of a topic, if you have permission) you should see the “Poll creation” tab below the main posting form (if you cannot see this then you do not have appropriate permissions to create polls). You should enter a title for the poll in “Poll question” and then at least two options in the “Poll options” textarea (limit is set by the board administrator), with each option separated by a new line. You can also set the number of options user may select during voting under “Options per user”, setting a time limit in days for the poll (0 is a poll of infinite duration) and lastly the option if users are allowed to amend their votes.' 1 => 'Creating a poll is easy, when you post a new topic (or edit the first post of a topic, if you have permission) you should see the “Poll creation” tab below the main posting form (if you cannot see this then you do not have appropriate permissions to create polls). You should enter a title for the poll in “Poll question” and then at least two options in the “Poll options” textarea (limit is set by the board administrator), with each option separated by a new line. You can also set the number of options users may select during voting under “Options per user”, setting a time limit in days for the poll (0 is a poll of infinite duration) and lastly the option if users are allowed to amend their votes.'
), ),
array( array(
0 => 'How do I edit or delete a poll?', 0 => 'How do I edit or delete a poll?',

View file

@ -152,14 +152,14 @@ $lang = array_merge($lang, array(
'POST_CONFIRM_EXPLAIN' => 'To prevent automated posts the board administrator requires you to enter a confirmation code. The code is displayed in the image you should see below. If you are visually impaired or cannot otherwise read this code please contact the %sBoard Administrator%s.', 'POST_CONFIRM_EXPLAIN' => 'To prevent automated posts the board administrator requires you to enter a confirmation code. The code is displayed in the image you should see below. If you are visually impaired or cannot otherwise read this code please contact the %sBoard Administrator%s.',
'POST_DELETED' => 'This message has been deleted successfully', 'POST_DELETED' => 'This message has been deleted successfully',
'POST_EDITED' => 'This message has been edited successfully', 'POST_EDITED' => 'This message has been edited successfully',
'POST_EDITED_MOD' => 'This message has been edited but requires approval', 'POST_EDITED_MOD' => 'This message has been edited successfully, but it will need to be approved by a moderator before it is publicly viewable. You will be notified when your post has been approved.',
'POST_GLOBAL' => 'Global', 'POST_GLOBAL' => 'Global',
'POST_ICON' => 'Post icon', 'POST_ICON' => 'Post icon',
'POST_NORMAL' => 'Normal', 'POST_NORMAL' => 'Normal',
'POST_REVIEW' => 'Post review', 'POST_REVIEW' => 'Post review',
'POST_REVIEW_EXPLAIN' => 'At least one new post has been made to this topic. You may wish to review your post in light of this.', 'POST_REVIEW_EXPLAIN' => 'At least one new post has been made to this topic. You may wish to review your post in light of this.',
'POST_STORED' => 'This message has been posted successfully', 'POST_STORED' => 'This message has been posted successfully',
'POST_STORED_MOD' => 'This message has been saved but requires approval', 'POST_STORED_MOD' => 'This message has been submitted successfully, but it will need to be approved by a moderator before it is publicly viewable. You will be notified when your post has been approved.',
'POST_TOPIC_AS' => 'Post topic as', 'POST_TOPIC_AS' => 'Post topic as',
'PROGRESS_BAR' => 'Progress bar', 'PROGRESS_BAR' => 'Progress bar',

View file

@ -411,7 +411,7 @@ $lang = array_merge($lang, array(
'UCP_PM' => 'Private messages', 'UCP_PM' => 'Private messages',
'UCP_PM_COMPOSE' => 'Compose message', 'UCP_PM_COMPOSE' => 'Compose message',
'UCP_PM_DRAFTS' => 'Manage PM drafts', 'UCP_PM_DRAFTS' => 'Manage PM drafts',
'UCP_PM_OPTIONS' => 'Rules, folder &amp; settings', 'UCP_PM_OPTIONS' => 'Rules, folders &amp; settings',
'UCP_PM_POPUP' => 'Private messages', 'UCP_PM_POPUP' => 'Private messages',
'UCP_PM_POPUP_TITLE' => 'Private message popup', 'UCP_PM_POPUP_TITLE' => 'Private message popup',
'UCP_PM_UNREAD' => 'Unread messages', 'UCP_PM_UNREAD' => 'Unread messages',

View file

@ -60,13 +60,13 @@
<!-- BEGIN custom_fields --><dt>{custom_fields.PROFILE_FIELD_NAME}:</dt> <dd>{custom_fields.PROFILE_FIELD_VALUE}</dd><!-- END custom_fields --> <!-- BEGIN custom_fields --><dt>{custom_fields.PROFILE_FIELD_NAME}:</dt> <dd>{custom_fields.PROFILE_FIELD_VALUE}</dd><!-- END custom_fields -->
<!-- IF S_USER_LOGGED_IN and S_ZEBRA --> <!-- IF S_USER_LOGGED_IN and S_ZEBRA -->
<!-- IF U_ADD_FRIEND and U_ADD_FOE--> <!-- IF U_ADD_FRIEND and U_ADD_FOE-->
<dt><strong>&hearts;</strong></dt> <dd><a href="{U_ADD_FRIEND}"><strong>{L_ADD_FRIEND}</strong></a></dd> <dt>&nbsp;</dt> <dd><a href="{U_ADD_FRIEND}"><strong>{L_ADD_FRIEND}</strong></a></dd>
<dt><strong>&times;</strong></dt> <dd><a href="{U_ADD_FOE}"><strong>{L_ADD_FOE}</strong></a></dd> <dt>&nbsp;</dt> <dd><a href="{U_ADD_FOE}"><strong>{L_ADD_FOE}</strong></a></dd>
<!-- ELSE --> <!-- ELSE -->
<!-- IF U_REMOVE_FRIEND --> <!-- IF U_REMOVE_FRIEND -->
<dt><strong>&hearts;</strong></dt> <dd><a href="{U_REMOVE_FRIEND}"><strong>{L_REMOVE_FRIEND}</strong></a></dd> <dt>&nbsp;</dt> <dd><a href="{U_REMOVE_FRIEND}"><strong>{L_REMOVE_FRIEND}</strong></a></dd>
<!-- ELSE --> <!-- ELSE -->
<dt><strong>&times;</strong></dt> <dd><a href="{U_REMOVE_FOE}"><strong>{L_REMOVE_FOE}</strong></a></dd> <dt>&nbsp;</dt> <dd><a href="{U_REMOVE_FOE}"><strong>{L_REMOVE_FOE}</strong></a></dd>
<!-- ENDIF --> <!-- ENDIF -->
<!-- ENDIF --> <!-- ENDIF -->
<!-- ENDIF --> <!-- ENDIF -->

View file

@ -32,7 +32,7 @@
</li> </li>
<!-- END forumrow --> <!-- END forumrow -->
</ul> </ul>
<!-- ELSE --> <!-- ELSEIF S_FORUM_NOTIFY -->
<p><strong>{L_NO_WATCHED_FORUMS}</strong></p> <p><strong>{L_NO_WATCHED_FORUMS}</strong></p>
<!-- ENDIF --> <!-- ENDIF -->
@ -72,7 +72,7 @@
<!-- IF PAGE_NUMBER --><!-- IF PAGINATION --> &bull; <a href="#" onclick="jumpto(); return false;" title="{L_JUMP_TO_PAGE}">{PAGE_NUMBER}</a> &bull; <span>{PAGINATION}</span><!-- ELSE --> &bull; {PAGE_NUMBER}<!-- ENDIF --><!-- ENDIF --> <!-- IF PAGE_NUMBER --><!-- IF PAGINATION --> &bull; <a href="#" onclick="jumpto(); return false;" title="{L_JUMP_TO_PAGE}">{PAGE_NUMBER}</a> &bull; <span>{PAGINATION}</span><!-- ELSE --> &bull; {PAGE_NUMBER}<!-- ENDIF --><!-- ENDIF -->
</li> </li>
</ul> </ul>
<!-- ELSE --> <!-- ELSEIF S_TOPIC_NOTIFY -->
<p><strong>{L_NO_WATCHED_TOPICS}</strong></p> <p><strong>{L_NO_WATCHED_TOPICS}</strong></p>
<!-- ENDIF --> <!-- ENDIF -->

View file

@ -7,6 +7,7 @@
<tr> <tr>
<td class="row1" colspan="4" align="center"><span class="genmed">{L_WATCHED_EXPLAIN}</span></td> <td class="row1" colspan="4" align="center"><span class="genmed">{L_WATCHED_EXPLAIN}</span></td>
</tr> </tr>
<!-- IF S_FORUM_NOTIFY -->
<tr> <tr>
<th colspan="4">{L_WATCHED_FORUMS}</th> <th colspan="4">{L_WATCHED_FORUMS}</th>
</tr> </tr>
@ -24,7 +25,8 @@
<td colspan="4" align="center"><b class="genmed">{L_NO_WATCHED_FORUMS}</b></td> <td colspan="4" align="center"><b class="genmed">{L_NO_WATCHED_FORUMS}</b></td>
</tr> </tr>
<!-- END forumrow --> <!-- END forumrow -->
<!-- ENDIF -->
<!-- IF S_TOPIC_NOTIFY -->
<tr> <tr>
<th colspan="4">{L_WATCHED_TOPICS}</th> <th colspan="4">{L_WATCHED_TOPICS}</th>
</tr> </tr>
@ -66,6 +68,7 @@
<td colspan="4" align="center"><b class="genmed">{L_NO_WATCHED_TOPICS}</b></td> <td colspan="4" align="center"><b class="genmed">{L_NO_WATCHED_TOPICS}</b></td>
</tr> </tr>
<!-- END topicrow --> <!-- END topicrow -->
<!-- ENDIF -->
<!-- IF .topicrow or .forumrow --> <!-- IF .topicrow or .forumrow -->
<tr> <tr>

View file

@ -292,6 +292,12 @@ if ($module->is_active('zebra', 'friends'))
$db->sql_freeresult($result); $db->sql_freeresult($result);
} }
// Do not display subscribed topics/forums if not allowed
if (!$config['allow_topic_notify'] && !$config['allow_forum_notify'])
{
$module->set_display('main', 'subscribed', false);
}
// Select the active module // Select the active module
$module->set_active($id, $mode); $module->set_active($id, $mode);