Fix SMF 2.1 support
Jeremy D

Jeremy D commited on 2022-02-13 08:55:45
Showing 4 changed files, with 27 additions and 2 deletions.

... ...
@@ -1,5 +1,6 @@
1 1
 <?php
2 2
 // Version: 2.1; Topic solved mod
3
+global $helptxt;
3 4
 
4 5
 $txt['topic_solved_title'] = 'Topic Solved mod';
5 6
 $txt['solve_topic'] = '<strong style="color: green">Mark topic solved</strong>';
... ...
@@ -10,6 +11,7 @@ $txt['modlog_solve_log'] = 'Topic solved log';
10 11
 $txt['modlog_solve_log_desc'] = 'Below is a list of all topics that have been solved or unsolved by your users.<br /><strong>Please note:</strong> Entries cannot be removed from this log until they are at least twenty-four hours old.';
11 12
 $txt['modlog_solve_log_no_entries_found'] = 'There are currently no entries in the topic solved log.';
12 13
 $txt['solve_log_help'] = '<strong>Topic solved log</strong><br />This section allows members of the moderation team to track all usage of the topic solved/not solved feature. To ensure that moderators cannot remove references to the actions they have performed, entries may not be deleted until 24 hours after the action was taken.';
14
+$helptxt['solve_log'] = $txt['solve_log_help'];
13 15
 
14 16
 $txt['permissionname_solve_topic'] = 'Mark topics solved/not solved';
15 17
 $txt['permissionhelp_solve_topic'] = 'This permission will allow the user to mark topics as solved and not solved.';
... ...
@@ -58,6 +58,7 @@
58 58
 		<hook function="add_ts_permissions" hook="integrate_load_permissions" file="$sourcedir/SolveTopic-Admin.php" />
59 59
 		<hook function="integrate_moderate_areas_solveTopic" hook="integrate_moderate_areas" file="$sourcedir/SolveTopic-Admin.php" />
60 60
 		<hook function="integrate_viewModLog_solveTopic" hook="integrate_viewModLog" file="$sourcedir/SolveTopic-Admin.php" />
61
+		<hook function="integrate_helpadmin_solveTopic" hook="integrate_helpadmin" file="$sourcedir/SolveTopic-Admin.php" />
61 62
 	</install>
62 63
 	<uninstall for="2.1-2.1.99">
63 64
 		<database>install/uninstall-optional.php</database>
... ...
@@ -89,6 +90,7 @@
89 90
 		<hook function="add_ts_permissions" hook="integrate_load_permissions" file="$sourcedir/SolveTopic.php" reverse="true" />
90 91
 		<hook function="integrate_moderate_areas_solveTopic" hook="integrate_moderate_areas" file="$sourcedir/SolveTopic.php" reverse="true" />
91 92
 		<hook function="integrate_viewModLog_solveTopic" hook="integrate_viewModLog" file="$sourcedir/SolveTopic-Admin.php" reverse="true" />
93
+		<hook function="integrate_helpadmin_solveTopic" hook="integrate_helpadmin" file="$sourcedir/SolveTopic-Admin.php" reverse="true" />
92 94
 	</uninstall>	
93 95
 
94 96
 </package-info>
95 97
\ No newline at end of file
... ...
@@ -1,4 +1,9 @@
1 1
 <?php
2
+/**********************************************************************************
3
+* SolveTopic-Admin.php                                                                                                                                                                              *
4
+***********************************************************************************
5
+* Topic Solved mod for SMF 2.1, by SimpleDesk - www.simpledesk.net                                                                            *
6
+**********************************************************************************/
2 7
 
3 8
 if (!defined('SMF'))
4 9
 	die('Hacking attempt...');
... ...
@@ -75,6 +80,10 @@ function ModifyTopicSolvedSettings($return_config = false)
75 80
 	{
76 81
 		checkSession();
77 82
 
83
+		// Ensure we use the compatible 2.1 method of enabling a log, incase anywhere in the code it expecs it.
84
+		$config_vars[] = array('check', 'solvelog_enabled');
85
+		$_POST['solvelog_enabled'] = !empty($_POST['enable_solved_log']);
86
+
78 87
 		$save_vars = $config_vars;
79 88
 		saveDBSettings($save_vars);
80 89
 		
... ...
@@ -98,7 +107,10 @@ function integrate_viewModLog_solveTopic(&$listOptions, &$moderation_menu_name)
98 107
 
99 108
 	loadLanguage('SolveTopic');
100 109
 
101
-	// Topic solved log
110
+	// Topic solved log.
111
+	if (function_exists('loadCacheAccelerator'))
112
+		$context['log_type'] = isset($_REQUEST['area']) && $_REQUEST['area'] == 'solvelog' ? 4 : $context['log_type'];
113
+	else
102 114
 		$context['log_type'] = isset($_REQUEST['sa']) && $_REQUEST['sa'] == 'solvelog' ? 4 : $context['log_type'];
103 115
 	
104 116
 	// Make sure the solve log is enabled.
... ...
@@ -119,7 +131,11 @@ function integrate_viewModLog_solveTopic(&$listOptions, &$moderation_menu_name)
119 131
 	);
120 132
 
121 133
 	// Fix up the list options.
134
+	if (function_exists('loadCacheAccelerator'))
135
+		$listOptions['title'] = $txt['modlog_solve_log'];
136
+	else
122 137
 		$listOptions['title'] = '<a href="' . $scripturl . '?action=helpadmin;help=solve_log_help" onclick="return reqWin(this.href);" class="help"><img src="' . $settings['images_url'] . '/helptopics.gif" alt="' . $txt['help'] . '" align="top" /></a> ' . $txt['modlog_solve_log'];
138
+
123 139
 	$listOptions['additional_rows'][0]['value'] = '
124 140
 					' . $txt['modlog_search'] . ' (' . $txt['modlog_by'] . ': ' . $context['search']['label'] . '):
125 141
 					<input type="text" name="search" size="18" value="' . $smcFunc['htmlspecialchars']($context['search']['string']) . '">
... ...
@@ -197,4 +213,9 @@ function integrate_moderate_areas_solveTopic(&$menuData)
197 213
 	);
198 214
 }
199 215
 
216
+function integrate_helpadmin_solveTopic()
217
+{
218
+	loadLanguage('SolveTopic');
219
+}
220
+
200 221
 ?>
201 222
\ No newline at end of file
... ...
@@ -2,7 +2,7 @@
2 2
 /**********************************************************************************
3 3
 * SolveTopic.php                                                                                                                                                                              *
4 4
 ***********************************************************************************
5
-* Topic Solved mod for SMF 2.0, by SimpleDesk - www.simpledesk.net                                                                            *
5
+* Topic Solved mod for SMF 2.1, by SimpleDesk - www.simpledesk.net                                                                            *
6 6
 **********************************************************************************/
7 7
 
8 8
 if (!defined('SMF'))
9 9