From 01ad065ae54d3828cf6dad36e8f363000cd183a0 Mon Sep 17 00:00:00 2001 From: Meik Sievertsen Date: Wed, 26 Apr 2006 18:10:57 +0000 Subject: - adding user logs (displaying all users instead of limited to the user if viewing user notes) - fixed a tiny set of bugs... git-svn-id: file:///svn/phpbb/trunk@5848 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/includes/functions_admin.php | 61 ++++++++++++++++++++++++++++++-------- 1 file changed, 48 insertions(+), 13 deletions(-) (limited to 'phpBB/includes/functions_admin.php') diff --git a/phpBB/includes/functions_admin.php b/phpBB/includes/functions_admin.php index 057508c100..9e22f22f75 100644 --- a/phpBB/includes/functions_admin.php +++ b/phpBB/includes/functions_admin.php @@ -1920,7 +1920,7 @@ function view_log($mode, &$log, &$log_count, $limit = 0, $offset = 0, $forum_id { global $db, $user, $auth, $phpEx, $SID, $phpbb_root_path, $phpbb_admin_path; - $topic_id_list = $is_auth = $is_mod = array(); + $topic_id_list = $reportee_id_list = $is_auth = $is_mod = array(); $profile_url = (defined('IN_ADMIN')) ? "{$phpbb_admin_path}index.$phpEx$SID&i=users&mode=overview" : "{$phpbb_root_path}memberlist.$phpEx$SID&mode=viewprofile"; @@ -1929,7 +1929,7 @@ function view_log($mode, &$log, &$log_count, $limit = 0, $offset = 0, $forum_id case 'admin': $log_type = LOG_ADMIN; $sql_forum = ''; - break; + break; case 'mod': $log_type = LOG_MOD; @@ -1946,17 +1946,22 @@ function view_log($mode, &$log, &$log_count, $limit = 0, $offset = 0, $forum_id { $sql_forum = ($forum_id) ? 'AND l.forum_id = ' . intval($forum_id) : ''; } - break; + break; case 'user': $log_type = LOG_USERS; $sql_forum = 'AND l.reportee_id = ' . intval($user_id); - break; + break; + case 'users': + $log_type = LOG_USERS; + $sql_forum = ''; + break; + case 'critical': $log_type = LOG_CRITICAL; $sql_forum = ''; - break; + break; default: return; @@ -1980,15 +1985,27 @@ function view_log($mode, &$log, &$log_count, $limit = 0, $offset = 0, $forum_id $topic_id_list[] = $row['topic_id']; } - $log[$i]['id'] = $row['log_id']; - $log[$i]['username'] = '' . $row['username'] . ''; - $log[$i]['ip'] = $row['log_ip']; - $log[$i]['time'] = $row['log_time']; - $log[$i]['forum_id'] = $row['forum_id']; - $log[$i]['topic_id'] = $row['topic_id']; - $log[$i]['viewforum'] = ($row['forum_id'] && $auth->acl_get('f_read', $row['forum_id'])) ? "{$phpbb_root_path}viewforum.$phpEx$SID&f=" . $row['forum_id'] : ''; + if ($row['reportee_id']) + { + $reportee_id_list[] = $row['reportee_id']; + } - $log[$i]['action'] = (isset($user->lang[$row['log_operation']])) ? $user->lang[$row['log_operation']] : '{' . ucfirst(str_replace('_', ' ', $row['log_operation'])) . '}'; + $log[$i] = array( + 'id' => $row['log_id'], + + 'reportee_id' => $row['reportee_id'], + 'reportee_username' => '', + + 'user_id' => $row['user_id'], + 'username' => '' . $row['username'] . '', + 'ip' => $row['log_ip'], + 'time' => $row['log_time'], + 'forum_id' => $row['forum_id'], + 'topic_id' => $row['topic_id'], + + 'viewforum' => ($row['forum_id'] && $auth->acl_get('f_read', $row['forum_id'])) ? "{$phpbb_root_path}viewforum.$phpEx$SID&f=" . $row['forum_id'] : '', + 'action' => (isset($user->lang[$row['log_operation']])) ? $user->lang[$row['log_operation']] : '{' . ucfirst(str_replace('_', ' ', $row['log_operation'])) . '}', + ); if (!empty($row['log_data'])) { @@ -2046,6 +2063,24 @@ function view_log($mode, &$log, &$log_count, $limit = 0, $offset = 0, $forum_id } } + if ($reportee_id_list) + { + $reportee_id_list = array_unique($reportee_id_list); + $reportee_names_list = array(); + + if (!function_exists('user_get_id_name')) + { + include_once($phpbb_root_path . 'includes/functions_user.' . $phpEx); + } + + user_get_id_name($reportee_id_list, $reportee_names_list); + + foreach ($log as $key => $row) + { + $log[$key]['reportee_username'] = (isset($reportee_names_list[$row['reportee_id']])) ? '' . $reportee_names_list[$row['reportee_id']] . '' : ''; + } + } + $sql = 'SELECT COUNT(l.log_id) AS total_entries FROM ' . LOG_TABLE . " l WHERE l.log_type = $log_type -- cgit v1.2.1