diff options
author | Meik Sievertsen <acydburn@phpbb.com> | 2006-01-25 21:01:52 +0000 |
---|---|---|
committer | Meik Sievertsen <acydburn@phpbb.com> | 2006-01-25 21:01:52 +0000 |
commit | 90385cd79a550b4ac08e10e3b8a01abc37965bd4 (patch) | |
tree | 87838a4580032f81b981a0867cd2b766d3d81ab6 /phpBB/includes/functions.php | |
parent | 964615eb0799b2d20d9578af9e328fb1a348d8da (diff) | |
download | forums-90385cd79a550b4ac08e10e3b8a01abc37965bd4.tar forums-90385cd79a550b4ac08e10e3b8a01abc37965bd4.tar.gz forums-90385cd79a550b4ac08e10e3b8a01abc37965bd4.tar.bz2 forums-90385cd79a550b4ac08e10e3b8a01abc37965bd4.tar.xz forums-90385cd79a550b4ac08e10e3b8a01abc37965bd4.zip |
- moved add_log out of functions_admin (this file should only be included in admin/admin-related pages)
- fixed cookie based topic tracking
- added missing config variables
- other minor things
git-svn-id: file:///svn/phpbb/trunk@5494 89ea8834-ac86-4346-8a33-228a782c2dd0
Diffstat (limited to 'phpBB/includes/functions.php')
-rw-r--r-- | phpBB/includes/functions.php | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index a631975b0a..ea3cafda79 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -531,6 +531,11 @@ function markread($mode, $forum_id = false, $topic_id = false, $post_time = 0) $user->set_cookie('track', serialize($tracking), time() + 31536000); unset($tracking); + + if ($user->data['is_registered']) + { + $db->sql_query('UPDATE ' . USERS_TABLE . ' SET user_lastmark = ' . time() . " WHERE user_id = {$user->data['user_id']}"); + } } } @@ -1569,6 +1574,62 @@ function parse_cfg_file($filename, $lines = false) } /** +* Add log event +*/ +function add_log() +{ + global $db, $user; + + $args = func_get_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)) ? '' : $db->sql_escape(serialize($args)); + + $sql_ary = array( + 'user_id' => $user->data['user_id'], + 'log_ip' => $user->ip, + 'log_time' => time(), + 'log_operation' => $action, + 'log_data' => $data, + ); + + 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; + } + + $db->sql_query('INSERT INTO ' . LOG_TABLE . ' ' . $db->sql_build_array('INSERT', $sql_ary)); +} + +/** * Error and message handler, call with trigger_error if reqd */ function msg_handler($errno, $msg_text, $errfile, $errline) |