From: Jim W. <ter...@ph...> - 2009-07-18 19:21:18
|
Author: terrafrost Date: Sat Jul 18 19:19:38 2009 New Revision: 9781 Log: - added ability to filter logs by log_operation Modified: branches/phpBB-3_0_0/phpBB/adm/style/acp_logs.html branches/phpBB-3_0_0/phpBB/docs/CHANGELOG.html branches/phpBB-3_0_0/phpBB/includes/acp/acp_logs.php branches/phpBB-3_0_0/phpBB/includes/functions_admin.php branches/phpBB-3_0_0/phpBB/language/en/acp/common.php Modified: branches/phpBB-3_0_0/phpBB/adm/style/acp_logs.html ============================================================================== *** branches/phpBB-3_0_0/phpBB/adm/style/acp_logs.html (original) --- branches/phpBB-3_0_0/phpBB/adm/style/acp_logs.html Sat Jul 18 19:19:38 2009 *************** *** 8,19 **** <form id="list" method="post" action="{U_ACTION}"> <!-- IF PAGINATION --> ! <div class="pagination"> <a href="#" onclick="jumpto(); return false;" title="{L_JUMP_TO_PAGE}">{S_ON_PAGE}</a> • <span>{PAGINATION}</span> </div> <!-- ENDIF --> <!-- IF .log --> <table cellspacing="1"> <thead> --- 8,25 ---- <form id="list" method="post" action="{U_ACTION}"> + <fieldset class="display-options" style="float: left"> + {L_SELECT_LANG_KEY}: <select name="log_operation">{S_LANG_KEYS}</select> <input type="submit" class="button2" name="filter" value="{L_FILTER}" /> + </fieldset> + <!-- IF PAGINATION --> ! <div class="pagination" style="float: right; margin: 15px 0 2px 0"> <a href="#" onclick="jumpto(); return false;" title="{L_JUMP_TO_PAGE}">{S_ON_PAGE}</a> • <span>{PAGINATION}</span> </div> <!-- ENDIF --> + <div class="clearfix"> </div><br style="clear: both;" /> + <!-- IF .log --> <table cellspacing="1"> <thead> Modified: branches/phpBB-3_0_0/phpBB/docs/CHANGELOG.html ============================================================================== *** branches/phpBB-3_0_0/phpBB/docs/CHANGELOG.html (original) --- branches/phpBB-3_0_0/phpBB/docs/CHANGELOG.html Sat Jul 18 19:19:38 2009 *************** *** 209,214 **** --- 209,215 ---- <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> <li>[Feature] Ability to empty a user's outbox from the user ACP quick tools.</li> + <li>[Feature] Ability to filter ACP logs</li> </ul> <a name="v304"></a><h3>1.ii. Changes since 3.0.4</h3> Modified: branches/phpBB-3_0_0/phpBB/includes/acp/acp_logs.php ============================================================================== *** branches/phpBB-3_0_0/phpBB/includes/acp/acp_logs.php (original) --- branches/phpBB-3_0_0/phpBB/includes/acp/acp_logs.php Sat Jul 18 19:19:38 2009 *************** *** 104,109 **** --- 104,168 ---- $sql_where = ($sort_days) ? (time() - ($sort_days * 86400)) : 0; $sql_sort = $sort_by_sql[$sort_key] . ' ' . (($sort_dir == 'd') ? 'DESC' : 'ASC'); + $log_operation = request_var('log_operation', ''); + $s_lang_keys = '<option value="">' . $user->lang['SHOW_ALL_OPERATIONS'] . '</option>'; + + switch ($mode) + { + case 'admin': + $log_type = LOG_ADMIN; + $sql_forum = ''; + break; + + case 'mod': + $log_type = LOG_MOD; + + if ($topic_id) + { + $sql_forum = 'AND topic_id = ' . intval($topic_id); + } + else if (is_array($forum_id)) + { + $sql_forum = 'AND ' . $db->sql_in_set('forum_id', array_map('intval', $forum_id)); + } + else + { + $sql_forum = ($forum_id) ? 'AND forum_id = ' . intval($forum_id) : ''; + } + break; + + case 'user': + $log_type = LOG_USERS; + $sql_forum = 'AND reportee_id = ' . (int) $user_id; + break; + + case 'users': + $log_type = LOG_USERS; + $sql_forum = ''; + break; + + case 'critical': + $log_type = LOG_CRITICAL; + $sql_forum = ''; + break; + + default: + return; + } + + $sql = "SELECT DISTINCT log_operation + FROM " . LOG_TABLE . " + WHERE log_type = $log_type + " . (($limit_days) ? "AND log_time >= $sql_where " : ' ') . + $sql_forum; + $result = $db->sql_query($sql); + while ($row = $db->sql_fetchrow($result)) + { + $selected = ($log_operation == $row['log_operation']) ? ' selected="selected"' : ''; + $s_lang_keys .= '<option value="' . $row['log_operation'] . '"' . $selected . '>' . $user->lang[$row['log_operation']] . '</option>'; + } + $db->sql_freeresult($result); + $l_title = $user->lang['ACP_' . strtoupper($mode) . '_LOGS']; $l_title_explain = $user->lang['ACP_' . strtoupper($mode) . '_LOGS_EXPLAIN']; *************** *** 123,129 **** // Grab log data $log_data = array(); $log_count = 0; ! view_log($mode, $log_data, $log_count, $config['topics_per_page'], $start, $forum_id, 0, 0, $sql_where, $sql_sort); $template->assign_vars(array( 'L_TITLE' => $l_title, --- 182,188 ---- // Grab log data $log_data = array(); $log_count = 0; ! view_log($mode, $log_data, $log_count, $config['topics_per_page'], $start, $forum_id, 0, 0, $sql_where, $sql_sort, $log_operation); $template->assign_vars(array( 'L_TITLE' => $l_title, *************** *** 136,141 **** --- 195,201 ---- 'S_LIMIT_DAYS' => $s_limit_days, 'S_SORT_KEY' => $s_sort_key, 'S_SORT_DIR' => $s_sort_dir, + 'S_LANG_KEYS' => $s_lang_keys, 'S_CLEARLOGS' => $auth->acl_get('a_clearlogs'), ) ); Modified: branches/phpBB-3_0_0/phpBB/includes/functions_admin.php ============================================================================== *** branches/phpBB-3_0_0/phpBB/includes/functions_admin.php (original) --- branches/phpBB-3_0_0/phpBB/includes/functions_admin.php Sat Jul 18 19:19:38 2009 *************** *** 2278,2284 **** /** * View log */ ! function view_log($mode, &$log, &$log_count, $limit = 0, $offset = 0, $forum_id = 0, $topic_id = 0, $user_id = 0, $limit_days = 0, $sort_by = 'l.log_time DESC') { global $db, $user, $auth, $phpEx, $phpbb_root_path, $phpbb_admin_path; --- 2278,2284 ---- /** * View log */ ! function view_log($mode, &$log, &$log_count, $limit = 0, $offset = 0, $forum_id = 0, $topic_id = 0, $user_id = 0, $limit_days = 0, $sort_by = 'l.log_time DESC', $log_operation = '') { global $db, $user, $auth, $phpEx, $phpbb_root_path, $phpbb_admin_path; *************** *** 2333,2339 **** FROM " . LOG_TABLE . " l, " . USERS_TABLE . " u WHERE l.log_type = $log_type AND u.user_id = l.user_id ! " . (($limit_days) ? "AND l.log_time >= $limit_days" : '') . " $sql_forum ORDER BY $sort_by"; $result = $db->sql_query_limit($sql, $limit, $offset); --- 2333,2340 ---- FROM " . LOG_TABLE . " l, " . USERS_TABLE . " u WHERE l.log_type = $log_type AND u.user_id = l.user_id ! " . (($limit_days) ? "AND l.log_time >= $limit_days" : '') . ! (!empty($log_operation) ? "AND l.log_operation = '" . $db->sql_escape($log_operation) . "'" : '') . " $sql_forum ORDER BY $sort_by"; $result = $db->sql_query_limit($sql, $limit, $offset); Modified: branches/phpBB-3_0_0/phpBB/language/en/acp/common.php ============================================================================== *** branches/phpBB-3_0_0/phpBB/language/en/acp/common.php (original) --- branches/phpBB-3_0_0/phpBB/language/en/acp/common.php Sat Jul 18 19:19:38 2009 *************** *** 230,235 **** --- 230,237 ---- 'EXPORT_DOWNLOAD' => 'Download', 'EXPORT_STORE' => 'Store', + 'FILTER' => 'Filter', + 'GENERAL_OPTIONS' => 'General options', 'GENERAL_SETTINGS' => 'General settings', 'GLOBAL_MASK' => 'Global permission mask', *************** *** 271,276 **** --- 273,279 ---- 'RETURN_TO' => 'Return toâ¦', 'SELECT_ANONYMOUS' => 'Select anonymous user', + 'SELECT_LANG_KEY' => 'Select operation', 'SELECT_OPTION' => 'Select option', 'SETTING_TOO_LOW' => 'The entered value for the setting â%1$sâ is too low. The minimal allowed value is %2$d.', |