Translations of this page: en bg cs de fi fr hu it ja pl ru tr zh

This is an old revision of the document!


API for log events (pun_admin_log)

PunBB 1.3 official extension

  • Status: under development
  • Current version: 1.0b

General idea

Adds event logging and a GUI for browsing logs.

Specification

Functionality

Logs lots of PunBB events.

List of actions

  • Install and uninstall extensions
  • Enable and disable extensions
  • Change keys of Administration Settings
  • Enable and disable keys of Administration Settings
  • Delete topics and posts
  • Stick and unstick topics
  • Open and close topics
  • Move topics
  • Change topics subject and message

Interface

  • File “forum.log”
  • “Features page”
    • Enable logging to file
    • Enable logging to database
    • Path to log-file

Database

Extension use tables of extension pun_admin_events

Examples

Example 1

The first example shows how to register actions on the page Administration → Settings. Add this piece of code after line 239 of ”<FORUM_ROOT>/admin/settings.php”

if ($forum_config['o_pun_admin_log_write_db'] == '1' || $forum_config['o_pun_admin_log_write_file'] == '1')
{
	$action = 'Admin settings';
 
	if (in_array($key, $str_actions))
		$comment = sprintf($lang_pun_admin_log['Key changed'], $key, $forum_config['o_'.$key], $input);
	else if (in_array($key, $chbox_actions))
		$comment = sprintf(($input == '1' ? $lang_pun_admin_log['Key enabled'] : $lang_pun_admin_log['Key disabled']), 'o_'.$key);
	else if (in_array($key, array_keys($radbox_actions)))
		$comment = sprintf($lang_pun_admin_log['Key changed'], 'o_'.$key, $radbox_actions[$key][ $forum_config['o_'.$key] ], $radbox_actions[$key][ $input ]);
 
	if (isset($comment))
	{
		if ($forum_config['o_pun_admin_log_write_db'] == '1')
			pun_admin_event($action, $comment);
 
		if ($forum_config['o_pun_admin_log_write_file'] == '1')
			$records_file .= record_log_file($action, $comment);
	}
}

Screenshots


Personal Tools