mirror of
https://github.com/phpbb/phpbb.git
synced 2025-08-01 14:30:32 +02:00
Merge branch 'develop' of https://github.com/phpbb/phpbb3 into feature/softdelete-1-permission
* 'develop' of https://github.com/phpbb/phpbb3: (234 commits) [ticket/11398] Correctly call permission_set method in permission tool [ticket/11394] Relax Migration Tools [ticket/11386] Fix missing ; [ticket/10714] Get log from container in install, update and download/file [feature/avatars] Update module_auth of ucp module and fix small issues [ticket/11396] Rename insert_migration to set_migration_state [ticket/11395] Prevent acp_modules::get_modules_info from reincluding files [ticket/11393] Give more information on database updater [ticket/11386] Send list of migrations instead of using load_migrations [feature/avatars] Add migrations data file for avatars [feature/avatars] Reduce module auth of ucp avatar settings [ticket/10714] Use $phpbb_adm_relative_path instead of hardcoded adm/ [ticket/10714] Logs are disabled for this page call only [ticket/10411] Fix call to function on non-object $db->...() [ticket/10411] Remove ajax delete, so the page is refreshed [feature/avatars] Auto-clear avatar dimensions when first changing avatars [ticket/10411] Update schema file with new table and remove the column [ticket/10411] Add unit tests for move() with values >1 [ticket/10411] Add migrations file for teampage table [ticket/10411] Revert database_update.php changes from for easier update ...
This commit is contained in:
@@ -3583,69 +3583,49 @@ function parse_cfg_file($filename, $lines = false)
|
||||
}
|
||||
|
||||
/**
|
||||
* Add log event
|
||||
* Add log entry
|
||||
*
|
||||
* @param string $mode The mode defines which log_type is used and from which log the entry is retrieved
|
||||
* @param int $forum_id Mode 'mod' ONLY: forum id of the related item, NOT INCLUDED otherwise
|
||||
* @param int $topic_id Mode 'mod' ONLY: topic id of the related item, NOT INCLUDED otherwise
|
||||
* @param int $reportee_id Mode 'user' ONLY: user id of the reportee, NOT INCLUDED otherwise
|
||||
* @param string $log_operation Name of the operation
|
||||
* @param array $additional_data More arguments can be added, depending on the log_type
|
||||
*
|
||||
* @return int|bool Returns the log_id, if the entry was added to the database, false otherwise.
|
||||
*
|
||||
* @deprecated Use $phpbb_log->add() instead
|
||||
*/
|
||||
function add_log()
|
||||
{
|
||||
global $db, $user;
|
||||
|
||||
// In phpBB 3.1.x i want to have logging in a class to be able to control it
|
||||
// For now, we need a quite hakish approach to circumvent logging for some actions
|
||||
// @todo implement cleanly
|
||||
if (!empty($GLOBALS['skip_add_log']))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
global $phpbb_log, $user;
|
||||
|
||||
$args = func_get_args();
|
||||
$mode = array_shift($args);
|
||||
|
||||
$mode = array_shift($args);
|
||||
$reportee_id = ($mode == 'user') ? intval(array_shift($args)) : '';
|
||||
$forum_id = ($mode == 'mod') ? intval(array_shift($args)) : '';
|
||||
$topic_id = ($mode == 'mod') ? intval(array_shift($args)) : '';
|
||||
$action = array_shift($args);
|
||||
$data = (!sizeof($args)) ? '' : serialize($args);
|
||||
|
||||
$sql_ary = array(
|
||||
'user_id' => (empty($user->data)) ? ANONYMOUS : $user->data['user_id'],
|
||||
'log_ip' => $user->ip,
|
||||
'log_time' => time(),
|
||||
'log_operation' => $action,
|
||||
'log_data' => $data,
|
||||
);
|
||||
|
||||
// This looks kind of dirty, but add_log has some additional data before the log_operation
|
||||
$additional_data = array();
|
||||
switch ($mode)
|
||||
{
|
||||
case 'admin':
|
||||
$sql_ary['log_type'] = LOG_ADMIN;
|
||||
break;
|
||||
|
||||
case 'mod':
|
||||
$sql_ary += array(
|
||||
'log_type' => LOG_MOD,
|
||||
'forum_id' => $forum_id,
|
||||
'topic_id' => $topic_id
|
||||
);
|
||||
break;
|
||||
|
||||
case 'user':
|
||||
$sql_ary += array(
|
||||
'log_type' => LOG_USERS,
|
||||
'reportee_id' => $reportee_id
|
||||
);
|
||||
break;
|
||||
|
||||
case 'critical':
|
||||
$sql_ary['log_type'] = LOG_CRITICAL;
|
||||
break;
|
||||
|
||||
default:
|
||||
return false;
|
||||
case 'mod':
|
||||
$additional_data['forum_id'] = array_shift($args);
|
||||
$additional_data['topic_id'] = array_shift($args);
|
||||
break;
|
||||
case 'user':
|
||||
$additional_data['reportee_id'] = array_shift($args);
|
||||
break;
|
||||
}
|
||||
|
||||
$db->sql_query('INSERT INTO ' . LOG_TABLE . ' ' . $db->sql_build_array('INSERT', $sql_ary));
|
||||
$log_operation = array_shift($args);
|
||||
$additional_data = array_merge($additional_data, $args);
|
||||
|
||||
return $db->sql_nextid();
|
||||
$user_id = (empty($user->data)) ? ANONYMOUS : $user->data['user_id'];
|
||||
$user_ip = (empty($user->ip)) ? '' : $user->ip;
|
||||
|
||||
return $phpbb_log->add($mode, $user_id, $user_ip, $log_operation, time(), $additional_data);
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user