diff options
author | Meik Sievertsen <acydburn@phpbb.com> | 2006-04-26 18:10:57 +0000 |
---|---|---|
committer | Meik Sievertsen <acydburn@phpbb.com> | 2006-04-26 18:10:57 +0000 |
commit | 01ad065ae54d3828cf6dad36e8f363000cd183a0 (patch) | |
tree | f76b68b915ac405f144d00ebc0c6daa345193248 /phpBB/includes | |
parent | db56792e91fa33da53bcd169c1fc45f092186b1d (diff) | |
download | forums-01ad065ae54d3828cf6dad36e8f363000cd183a0.tar forums-01ad065ae54d3828cf6dad36e8f363000cd183a0.tar.gz forums-01ad065ae54d3828cf6dad36e8f363000cd183a0.tar.bz2 forums-01ad065ae54d3828cf6dad36e8f363000cd183a0.tar.xz forums-01ad065ae54d3828cf6dad36e8f363000cd183a0.zip |
- 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
Diffstat (limited to 'phpBB/includes')
-rw-r--r-- | phpBB/includes/acp/acp_logs.php | 14 | ||||
-rw-r--r-- | phpBB/includes/acp/acp_modules.php | 17 | ||||
-rw-r--r-- | phpBB/includes/acp/acp_permissions.php | 5 | ||||
-rw-r--r-- | phpBB/includes/acp/acp_users.php | 3 | ||||
-rw-r--r-- | phpBB/includes/acp/auth.php | 4 | ||||
-rw-r--r-- | phpBB/includes/acp/info/acp_logs.php | 1 | ||||
-rw-r--r-- | phpBB/includes/functions_admin.php | 61 | ||||
-rw-r--r-- | phpBB/includes/session.php | 2 | ||||
-rw-r--r-- | phpBB/includes/ucp/ucp_profile.php | 3 |
9 files changed, 72 insertions, 38 deletions
diff --git a/phpBB/includes/acp/acp_logs.php b/phpBB/includes/acp/acp_logs.php index 241f266541..33a4ce13c2 100644 --- a/phpBB/includes/acp/acp_logs.php +++ b/phpBB/includes/acp/acp_logs.php @@ -127,12 +127,14 @@ class acp_logs } $template->assign_block_vars('log', array( - 'USERNAME' => $row['username'], - 'IP' => $row['ip'], - 'DATE' => $user->format_date($row['time']), - 'ACTION' => $row['action'], - 'DATA' => (sizeof($data)) ? implode(' | ', $data) : '', - 'ID' => $row['id'], + 'USERNAME' => $row['username'], + 'REPORTEE_USERNAME' => ($row['reportee_username'] && $row['user_id'] != $row['reportee_id']) ? $row['reportee_username'] : '', + + 'IP' => $row['ip'], + 'DATE' => $user->format_date($row['time']), + 'ACTION' => $row['action'], + 'DATA' => (sizeof($data)) ? implode(' | ', $data) : '', + 'ID' => $row['id'], ) ); } diff --git a/phpBB/includes/acp/acp_modules.php b/phpBB/includes/acp/acp_modules.php index 7e742c8e46..8a163996d1 100644 --- a/phpBB/includes/acp/acp_modules.php +++ b/phpBB/includes/acp/acp_modules.php @@ -564,12 +564,13 @@ class acp_modules /** * Get available module informations from module files */ - function get_module_infos($module = '') + function get_module_infos($module = '', $module_class = false) { global $phpbb_root_path, $phpEx; - $directory = $phpbb_root_path . 'includes/' . $this->module_class . '/info/'; - + $module_class = ($module_class === false) ? $this->module_class : $module_class; + + $directory = $phpbb_root_path . 'includes/' . $module_class . '/info/'; $fileinfo = array(); if (!$module) @@ -578,7 +579,7 @@ class acp_modules while (($file = readdir($dh)) !== false) { // Is module? - if (preg_match('/^' . $this->module_class . '_.+\.' . $phpEx . '$/', $file)) + if (preg_match('/^' . $module_class . '_.+\.' . $phpEx . '$/', $file)) { $class = str_replace(".$phpEx", '', $file) . '_info'; @@ -592,7 +593,7 @@ class acp_modules { $c_class = new $class(); $module_info = $c_class->module(); - $fileinfo[str_replace($this->module_class . '_', '', $module_info['filename'])] = $module_info; + $fileinfo[str_replace($module_class . '_', '', $module_info['filename'])] = $module_info; } } } @@ -602,8 +603,8 @@ class acp_modules } else { - $filename = $this->module_class . '_' . basename($module); - $class = $this->module_class . '_' . basename($module) . '_info'; + $filename = $module_class . '_' . basename($module); + $class = $module_class . '_' . basename($module) . '_info'; if (!class_exists($class)) { @@ -615,7 +616,7 @@ class acp_modules { $c_class = new $class(); $module_info = $c_class->module(); - $fileinfo[str_replace($this->module_class . '_', '', $module_info['filename'])] = $module_info; + $fileinfo[str_replace($module_class . '_', '', $module_info['filename'])] = $module_info; } } diff --git a/phpBB/includes/acp/acp_permissions.php b/phpBB/includes/acp/acp_permissions.php index 44c73e8cf1..9ca25c8cf7 100644 --- a/phpBB/includes/acp/acp_permissions.php +++ b/phpBB/includes/acp/acp_permissions.php @@ -679,7 +679,8 @@ class acp_permissions trigger_error($user->lang['NO_ADMIN'] . adm_back_link($this->u_action)); } - $auth_settings = $_POST['setting']; + $auth_settings = (isset($_POST['setting'])) ? $_POST['setting'] : array(); + $auth_roles = (isset($_POST['role'])) ? $_POST['role'] : array(); $ug_ids = $forum_ids = array(); // We need to go through the auth settings @@ -694,7 +695,7 @@ class acp_permissions $forum_ids[] = $forum_id; // Check role... - $assigned_role = (isset($_POST['role'][$ug_id][$forum_id])) ? (int) $_POST['role'][$ug_id][$forum_id] : 0; + $assigned_role = (isset($auth_roles[$ug_id][$forum_id])) ? (int) $auth_roles[$ug_id][$forum_id] : 0; // If the auth settings differ from the assigned role, then do not set a role... if ($assigned_role) diff --git a/phpBB/includes/acp/acp_users.php b/phpBB/includes/acp/acp_users.php index 62a9a38d98..75ac50cdcb 100644 --- a/phpBB/includes/acp/acp_users.php +++ b/phpBB/includes/acp/acp_users.php @@ -652,7 +652,6 @@ class acp_users { $sql_ary['username'] = $update_username; - add_log('admin', 'LOG_USER_UPDATE_NAME', $user_row['username'], $update_username); add_log('user', $user_id, 'LOG_USER_UPDATE_NAME', $user_row['username'], $update_username); } @@ -663,7 +662,6 @@ class acp_users 'user_email_hash' => crc32(strtolower($update_email)) . strlen($update_email) ); - add_log('admin', 'LOG_USER_UPDATE_EMAIL', $user_row['username'], $user_row['user_email'], $update_email); add_log('user', $user_id, 'LOG_USER_UPDATE_EMAIL', $user_row['username'], $user_row['user_email'], $update_email); } @@ -675,7 +673,6 @@ class acp_users ); $user->reset_login_keys($user_id); - add_log('admin', 'LOG_USER_NEW_PASSWORD', $user_row['username']); add_log('user', $user_id, 'LOG_USER_NEW_PASSWORD', $user_row['username']); } diff --git a/phpBB/includes/acp/auth.php b/phpBB/includes/acp/auth.php index 0aeffeb47e..9bb80f4ac0 100644 --- a/phpBB/includes/acp/auth.php +++ b/phpBB/includes/acp/auth.php @@ -701,7 +701,7 @@ class auth_admin extends auth /** * Set a user or group ACL record */ - function acl_set($ug_type, &$forum_id, &$ug_id, &$auth, $role_id = 0, $clear_prefetch = true) + function acl_set($ug_type, $forum_id, $ug_id, $auth, $role_id = 0, $clear_prefetch = true) { global $db; @@ -851,7 +851,7 @@ class auth_admin extends auth /** * Set a role-specific ACL record */ - function acl_set_role($role_id, &$auth) + function acl_set_role($role_id, $auth) { global $db; diff --git a/phpBB/includes/acp/info/acp_logs.php b/phpBB/includes/acp/info/acp_logs.php index 066da62ab2..0da4c82633 100644 --- a/phpBB/includes/acp/info/acp_logs.php +++ b/phpBB/includes/acp/info/acp_logs.php @@ -22,6 +22,7 @@ class acp_logs_info 'modes' => array( 'admin' => array('title' => 'ACP_ADMIN_LOGS', 'auth' => 'acl_a_viewlogs'), 'mod' => array('title' => 'ACP_MOD_LOGS', 'auth' => 'acl_a_viewlogs'), + 'users' => array('title' => 'ACP_USERS_LOGS', 'auth' => 'acl_a_viewlogs'), 'critical' => array('title' => 'ACP_CRITICAL_LOGS', 'auth' => 'acl_a_viewlogs'), ), ); 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'] = '<a href="' . $profile_url . '&u=' . $row['user_id'] . '">' . $row['username'] . '</a>'; - $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' => '<a href="' . $profile_url . '&u=' . $row['user_id'] . '">' . $row['username'] . '</a>', + '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']])) ? '<a href="' . $profile_url . '&u=' . $row['reportee_id'] . '">' . $reportee_names_list[$row['reportee_id']] . '</a>' : ''; + } + } + $sql = 'SELECT COUNT(l.log_id) AS total_entries FROM ' . LOG_TABLE . " l WHERE l.log_type = $log_type diff --git a/phpBB/includes/session.php b/phpBB/includes/session.php index 41f7e8c29f..88a7c6563c 100644 --- a/phpBB/includes/session.php +++ b/phpBB/includes/session.php @@ -139,7 +139,7 @@ class session $this->ip = (!empty($_SERVER['REMOTE_ADDR'])) ? htmlspecialchars($_SERVER['REMOTE_ADDR']) : ''; // Load limit check (if applicable) - if (@file_exists('/proc/loadavg')) + if (@file_exists('/proc/loadavg') && @is_readable('/proc/loadavg')) { if ($load = @file_get_contents('/proc/loadavg')) { diff --git a/phpBB/includes/ucp/ucp_profile.php b/phpBB/includes/ucp/ucp_profile.php index 5e69e927a6..4f87ba8983 100644 --- a/phpBB/includes/ucp/ucp_profile.php +++ b/phpBB/includes/ucp/ucp_profile.php @@ -96,20 +96,17 @@ class ucp_profile if ($auth->acl_get('u_chgname') && $config['allow_namechange'] && $username != $user->data['username']) { - add_log('admin', 'LOG_USER_UPDATE_NAME', $user->data['username'], $username); add_log('user', $user->data['user_id'], 'LOG_USER_UPDATE_NAME', $user->data['username'], $username); } if ($auth->acl_get('u_chgpasswd') && $new_password && md5($new_password) != $user->data['user_password']) { $user->reset_login_keys(); - add_log('admin', 'LOG_USER_NEW_PASSWORD', $username); add_log('user', $user->data['user_id'], 'LOG_USER_NEW_PASSWORD', $username); } if ($auth->acl_get('u_chgemail') && $email != $user->data['user_email']) { - add_log('admin', 'LOG_USER_UPDATE_EMAIL', $username, $user->data['user_email'], $email); add_log('user', $user->data['user_id'], 'LOG_USER_UPDATE_EMAIL', $username, $user->data['user_email'], $email); } |