1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-08-23 08:43:02 +02:00

- 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
This commit is contained in:
Meik Sievertsen
2006-04-26 18:10:57 +00:00
parent db56792e91
commit 01ad065ae5
12 changed files with 212 additions and 169 deletions

View File

@@ -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'],
)
);
}

View File

@@ -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;
}
}

View File

@@ -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)

View File

@@ -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']);
}

View File

@@ -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;

View File

@@ -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'),
),
);

View File

@@ -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 . '&amp;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&amp;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 . '&amp;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&amp;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 . '&amp;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

View File

@@ -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'))
{

View File

@@ -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);
}