浏览代码

Merge pull request #748 from Arantor/release-2.1

Reorganisation of how the moderation log can be enabled/disabled.
Arantor 11 年之前
父节点
当前提交
b65cc5800d

+ 5 - 5
Sources/Admin.php

@@ -427,8 +427,8 @@ function AdminMain()
 					'icon' => 'logs.png',
 					'subsections' => array(
 						'errorlog' => array($txt['errlog'], 'admin_forum', 'enabled' => !empty($modSettings['enableErrorLogging']), 'url' => $scripturl . '?action=admin;area=logs;sa=errorlog;desc'),
-						'adminlog' => array($txt['admin_log'], 'admin_forum', 'enabled' => in_array('ml', $context['admin_features'])),
-						'modlog' => array($txt['moderation_log'], 'admin_forum', 'enabled' => in_array('ml', $context['admin_features'])),
+						'adminlog' => array($txt['admin_log'], 'admin_forum', 'enabled' => !empty($modSettings['adminlog_enabled'])),
+						'modlog' => array($txt['moderation_log'], 'admin_forum', 'enabled' => !empty($modSettings['modlog_enabled'])),
 						'banlog' => array($txt['ban_log'], 'manage_bans'),
 						'spiderlog' => array($txt['spider_logs'], 'admin_forum', 'enabled' => !empty($modSettings['spider_mode'])),
 						'tasklog' => array($txt['scheduled_log'], 'admin_forum'),
@@ -889,13 +889,13 @@ function AdminSearchOM()
  */
 function AdminLogs()
 {
-	global $sourcedir, $context, $txt, $scripturl;
+	global $sourcedir, $context, $txt, $scripturl, $modSettings;
 
 	// These are the logs they can load.
 	$log_functions = array(
 		'errorlog' => array('ManageErrors.php', 'ViewErrorLog'),
-		'adminlog' => array('Modlog.php', 'ViewModlog'),
-		'modlog' => array('Modlog.php', 'ViewModlog', 'disabled' => !in_array('ml', $context['admin_features'])),
+		'adminlog' => array('Modlog.php', 'ViewModlog', 'disabled' => empty($modSettings['adminlog_enabled'])),
+		'modlog' => array('Modlog.php', 'ViewModlog', 'disabled' => empty($modSettings['modlog_enabled'])),
 		'banlog' => array('ManageBans.php', 'BanLog'),
 		'spiderlog' => array('ManageSearchEngines.php', 'SpiderLogs'),
 		'tasklog' => array('ManageScheduledTasks.php', 'TaskLog'),

+ 7 - 0
Sources/Logging.php

@@ -421,6 +421,13 @@ function logActions($logs)
 		'admin' => 3,
 	);
 
+	if (empty($modSettings['modlog_enabled']))
+		unset ($log_types['moderate']);
+	if (empty($modSettings['userlog_enabled']))
+		unset ($log_types['user']);
+	if (empty($modSettings['adminlog_enabled']))
+		unset ($log_types['admin']);
+
 	call_integration_hook('integrate_log_types', array(&$log_types));
 
 	// No point in doing anything, if the log isn't even enabled.

+ 16 - 1
Sources/ManageSettings.php

@@ -2023,6 +2023,12 @@ function ModifyLogSettings($return_config = false)
 	$context['page_title'] = $txt['log_settings'];
 
 	$config_vars = array(
+			array('check', 'modlog_enabled', 'help' => 'modlog'),
+			array('check', 'adminlog_enabled', 'help' => 'adminlog'),
+			array('check', 'userlog_enabled', 'help' => 'userlog'),
+			// The error log is a wonderful thing.
+			array('title', 'errlog'),
+			array('desc', 'error_log_desc'),
 			array('check', 'enableErrorLogging'),
 			array('check', 'enableErrorQueryLogging'),
 			array('check', 'log_ban_hits'),
@@ -2046,7 +2052,7 @@ function ModifyLogSettings($return_config = false)
 	// We want to be toggling some of these for a nice user experience. If you want to add yours to the list of those magically hidden when the 'pruning' option is off, add to this.
 	$prune_toggle = array('pruneErrorLog', 'pruneModLog', 'pruneBanLog', 'pruneReportLog', 'pruneScheduledTaskLog', 'pruneSpiderHitLog');
 
-	call_integration_hook('integrate_prune_settings', array(&$config_vars, &$prune_toggle));
+	call_integration_hook('integrate_prune_settings', array(&$config_vars, &$prune_toggle, false));
 
 	$prune_toggle_dt = array();
 	foreach ($prune_toggle as $item)
@@ -2073,10 +2079,19 @@ function ModifyLogSettings($return_config = false)
 	{
 		checkSession();
 
+		// Because of the excitement attached to combining pruning log items, we need to duplicate everything here.
 		$savevar = array(
+			array('check', 'modlog_enabled'),
+			array('check', 'adminlog_enabled'),
+			array('check', 'userlog_enabled'),
+			array('check', 'enableErrorLogging'),
+			array('check', 'enableErrorQueryLogging'),
+			array('check', 'log_ban_hits'),
 			array('text', 'pruningOptions')
 		);
 
+		call_integration_hook('integrate_prune_settings', array(&$savevar, &$prune_toggle, true));
+
 		if (!empty($_POST['pruningOptions']))
 		{
 			$vals = array();

+ 1 - 1
Sources/Profile.php

@@ -143,7 +143,7 @@ function ModifyProfile($post_errors = array())
 					'subsections' => array(
 						'activity' => array($txt['trackActivity'], 'moderate_forum'),
 						'ip' => array($txt['trackIP'], 'moderate_forum'),
-						'edits' => array($txt['trackEdits'], 'moderate_forum'),
+						'edits' => array($txt['trackEdits'], 'moderate_forum', 'enabled' => !empty($modSettings['userlog_enabled'])),
 						'logins' => array($txt['trackLogins'], array('profile_view_own', 'moderate_forum')),
 					),
 					'permission' => array(

+ 3 - 0
Themes/default/languages/Admin.english.php

@@ -240,6 +240,9 @@ $txt['moderation_log'] = 'Moderation Log';
 $txt['moderation_log_desc'] = 'Lists moderation activities that have been performed by moderators on your forum.';
 $txt['spider_log_desc'] = 'Review the entries related to search engine spider activity on your forum.';
 $txt['log_settings_desc'] = 'Use these options to configure how logging works on your forum.';
+$txt['modlog_enabled'] = 'Enable the moderation log';
+$txt['adminlog_enabled'] = 'Enable the administration log';
+$txt['userlog_enabled'] = 'Enable the profile edits log';
 
 $txt['mailqueue_title'] = 'Mail';
 

+ 2 - 2
Themes/default/languages/Help.english.php

@@ -172,6 +172,8 @@ $helptxt['modlog'] = '<strong>Moderation Log</strong><br />
 $helptxt['adminlog'] = '<strong>Administration Log</strong><br />
 	This section allows members of the admin team to track some of the administrative actions that have occurred on the forum. To ensure that
 	admins cannot remove references to the actions they have performed, entries may not be deleted until 24 hours after the action was taken.';
+$helptxt['userlog'] = '<strong>Profile Edits Log</strong><br />
+	This section allows members of the admin team to view changes users make to their profiles, and is available from inside a user\'s profile area.';
 $helptxt['warning_enable'] = '<strong>User Warning System</strong><br />
 	This feature enables members of the admin and moderation team to issue warnings to members - and to use a members warning level to determine the
 	actions available to them on the forum. Upon enabling this feature a permission will be available within the permissions section to define
@@ -458,8 +460,6 @@ $helptxt['pm_posts_per_hour'] = 'This will limit the number of personal messages
 
 $helptxt['default_personal_text'] = 'Sets the default text a new user will have as their &quot;personal text.&quot; This option is not available when personal text is disabled, or when users can set personal text on registration for themselves.';
 
-$helptxt['modlog_enabled'] = 'Logs all moderation actions.';
-
 $helptxt['guest_hideContacts'] = 'If selected this option will hide the email addresses and messenger contact details
 	of all members from any guests on your forum';
 

+ 1 - 0
Themes/default/languages/ManageSettings.english.php

@@ -37,6 +37,7 @@ $txt['disableTemplateEval'] = 'Disable evaluation of templates';
 $txt['databaseSession_enable'] = 'Use database driven sessions';
 $txt['databaseSession_loose'] = 'Allow browsers to go back to cached pages';
 $txt['databaseSession_lifetime'] = 'Seconds before an unused session timeout';
+$txt['error_log_desc'] = 'The error log, if enabled, will log every error encountered by users using your forum. This can be an invaluable aid to identifying forum problems.';
 $txt['enableErrorLogging'] = 'Enable error logging';
 $txt['enableErrorQueryLogging'] = 'Include database query in the error log';
 $txt['pruningOptions'] = 'Enable pruning of log entries';

+ 2 - 0
other/install_2-1_mysql.sql

@@ -1855,6 +1855,8 @@ VALUES ('smfVersion', '{$smf_version}'),
 	('admin_features', ''),
 	('last_mod_report_action', '0'),
 	('pruningOptions', '30,180,180,180,30,0'),
+	('modlog_enabled', '1'),
+	('adminlog_enabled', '1'),
 	('cache_enable', '1'),
 	('reg_verification', '1'),
 	('visual_verification_type', '3'),

+ 2 - 0
other/install_2-1_postgresql.sql

@@ -2355,6 +2355,8 @@ INSERT INTO {$db_prefix}settings (variable, value) VALUES ('warning_mute', '60')
 INSERT INTO {$db_prefix}settings (variable, value) VALUES ('admin_features', '');
 INSERT INTO {$db_prefix}settings (variable, value) VALUES ('last_mod_report_action', '0');
 INSERT INTO {$db_prefix}settings (variable, value) VALUES ('pruningOptions', '30,180,180,180,30,0');
+INSERT INTO {$db_prefix}settings (variable, value) VALUES ('modlog_enabled', '1');
+INSERT INTO {$db_prefix}settings (variable, value) VALUES ('adminlog_enabled', '1');
 INSERT INTO {$db_prefix}settings (variable, value) VALUES ('cache_enable', '1');
 INSERT INTO {$db_prefix}settings (variable, value) VALUES ('reg_verification', '1');
 INSERT INTO {$db_prefix}settings (variable, value) VALUES ('visual_verification_type', '3');

+ 2 - 0
other/install_2-1_sqlite.sql

@@ -2004,6 +2004,8 @@ INSERT INTO {$db_prefix}settings (variable, value) VALUES ('warning_mute', '60')
 INSERT INTO {$db_prefix}settings (variable, value) VALUES ('admin_features', '');
 INSERT INTO {$db_prefix}settings (variable, value) VALUES ('last_mod_report_action', '0');
 INSERT INTO {$db_prefix}settings (variable, value) VALUES ('pruningOptions', '30,180,180,180,30,0');
+INSERT INTO {$db_prefix}settings (variable, value) VALUES ('modlog_enabled', '1');
+INSERT INTO {$db_prefix}settings (variable, value) VALUES ('adminlog_enabled', '1');
 INSERT INTO {$db_prefix}settings (variable, value) VALUES ('cache_enable', '1');
 INSERT INTO {$db_prefix}settings (variable, value) VALUES ('reg_verification', '1');
 INSERT INTO {$db_prefix}settings (variable, value) VALUES ('visual_verification_type', '3');

+ 2 - 0
other/install_2-1_sqlite3.sql

@@ -2004,6 +2004,8 @@ INSERT INTO {$db_prefix}settings (variable, value) VALUES ('warning_mute', '60')
 INSERT INTO {$db_prefix}settings (variable, value) VALUES ('admin_features', '');
 INSERT INTO {$db_prefix}settings (variable, value) VALUES ('last_mod_report_action', '0');
 INSERT INTO {$db_prefix}settings (variable, value) VALUES ('pruningOptions', '30,180,180,180,30,0');
+INSERT INTO {$db_prefix}settings (variable, value) VALUES ('modlog_enabled', '1');
+INSERT INTO {$db_prefix}settings (variable, value) VALUES ('adminlog_enabled', '1');
 INSERT INTO {$db_prefix}settings (variable, value) VALUES ('cache_enable', '1');
 INSERT INTO {$db_prefix}settings (variable, value) VALUES ('reg_verification', '1');
 INSERT INTO {$db_prefix}settings (variable, value) VALUES ('visual_verification_type', '3');