diff options
author | Jim Wigginton <terrafrost@phpbb.com> | 2009-07-18 19:19:38 +0000 |
---|---|---|
committer | Jim Wigginton <terrafrost@phpbb.com> | 2009-07-18 19:19:38 +0000 |
commit | b6a1271c3aedab008be367565db9c9713e22e638 (patch) | |
tree | 84c8e5f264d675146f5634b4b550b424370ac1c9 /phpBB/includes | |
parent | e9830e5530739f90fa094106fb93f456643afd37 (diff) | |
download | forums-b6a1271c3aedab008be367565db9c9713e22e638.tar forums-b6a1271c3aedab008be367565db9c9713e22e638.tar.gz forums-b6a1271c3aedab008be367565db9c9713e22e638.tar.bz2 forums-b6a1271c3aedab008be367565db9c9713e22e638.tar.xz forums-b6a1271c3aedab008be367565db9c9713e22e638.zip |
- added ability to filter logs by log_operation
git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9781 89ea8834-ac86-4346-8a33-228a782c2dd0
Diffstat (limited to 'phpBB/includes')
-rw-r--r-- | phpBB/includes/acp/acp_logs.php | 62 | ||||
-rw-r--r-- | phpBB/includes/functions_admin.php | 5 |
2 files changed, 64 insertions, 3 deletions
diff --git a/phpBB/includes/acp/acp_logs.php b/phpBB/includes/acp/acp_logs.php index 12953173f1..c44592a23c 100644 --- a/phpBB/includes/acp/acp_logs.php +++ b/phpBB/includes/acp/acp_logs.php @@ -104,6 +104,65 @@ class acp_logs $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,7 +182,7 @@ class acp_logs // 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); + 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,6 +195,7 @@ class acp_logs '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'), ) ); diff --git a/phpBB/includes/functions_admin.php b/phpBB/includes/functions_admin.php index b634410afc..dd6378a2b5 100644 --- a/phpBB/includes/functions_admin.php +++ b/phpBB/includes/functions_admin.php @@ -2278,7 +2278,7 @@ function cache_moderators() /** * 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') +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,7 +2333,8 @@ function view_log($mode, &$log, &$log_count, $limit = 0, $offset = 0, $forum_id 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" : '') . " + " . (($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); |