diff options
author | Gaëtan Muller <m.gaetan89@gmail.com> | 2015-01-05 22:21:31 +0100 |
---|---|---|
committer | Gaëtan Muller <m.gaetan89@gmail.com> | 2015-01-27 18:34:33 +0100 |
commit | 7fc586080bf5e7b6e90dcf44526200d7c9356d57 (patch) | |
tree | 046444e816e9e3c328cf2683c301da1d52c8d96c /phpBB/includes/functions_compatibility.php | |
parent | e2786c37dc1ef5c0e032e09bb6b7a18210eebfca (diff) | |
download | forums-7fc586080bf5e7b6e90dcf44526200d7c9356d57.tar forums-7fc586080bf5e7b6e90dcf44526200d7c9356d57.tar.gz forums-7fc586080bf5e7b6e90dcf44526200d7c9356d57.tar.bz2 forums-7fc586080bf5e7b6e90dcf44526200d7c9356d57.tar.xz forums-7fc586080bf5e7b6e90dcf44526200d7c9356d57.zip |
[ticket/13468] Update calls to `add_log()`
PHPBB3-13468
Diffstat (limited to 'phpBB/includes/functions_compatibility.php')
-rw-r--r-- | phpBB/includes/functions_compatibility.php | 54 |
1 files changed, 50 insertions, 4 deletions
diff --git a/phpBB/includes/functions_compatibility.php b/phpBB/includes/functions_compatibility.php index 561c72183a..014f5d40e3 100644 --- a/phpBB/includes/functions_compatibility.php +++ b/phpBB/includes/functions_compatibility.php @@ -91,7 +91,7 @@ function phpbb_check_hash($password, $hash) * @param string $path Path to clean * @return string Cleaned path * -* @deprecated +* @deprecated 3.1.0 (To be removed: 3.3.0) */ function phpbb_clean_path($path) { @@ -135,7 +135,7 @@ function phpbb_clean_path($path) * * @return string Returns the options for timezone selector only * -* @deprecated +* @deprecated 3.1.0 (To be removed: 3.3.0) */ function tz_select($default = '', $truncate = false) { @@ -149,7 +149,7 @@ function tz_select($default = '', $truncate = false) * via admin_permissions. Changes of usernames and group names * must be carried through for the moderators table. * -* @deprecated 3.1 +* @deprecated 3.1.0 (To be removed: 3.3.0) * @return null */ function cache_moderators() @@ -161,7 +161,7 @@ function cache_moderators() /** * Removes moderators and administrators from foe lists. * -* @deprecated 3.1 +* @deprecated 3.1.0 (To be removed: 3.3.0) * @param array|bool $group_id If an array, remove all members of this group from foe lists, or false to ignore * @param array|bool $user_id If an array, remove this user from foe lists, or false to ignore * @return null @@ -218,3 +218,49 @@ function get_remote_file($host, $directory, $filename, &$errstr, &$errno, $port return $file_data; } + +/** + * 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 3.1.0 (To be removed: 3.3.0) + */ +function add_log() +{ + global $phpbb_log, $user; + + $args = func_get_args(); + $mode = array_shift($args); + + // This looks kind of dirty, but add_log has some additional data before the log_operation + $additional_data = array(); + switch ($mode) + { + case 'admin': + case 'critical': + break; + 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; + } + + $log_operation = array_shift($args); + $additional_data = array_merge($additional_data, $args); + + $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); +} |