gruffen commited on 2011-05-28 05:10:22
Showing 3 changed files, with 10 additions and 38 deletions.
... | ... |
@@ -333,6 +333,7 @@ function shd_list_hooks() |
333 | 333 |
'shd_hook_adminmenu', // functions to call when specifically modifying the admin menu |
334 | 334 |
|
335 | 335 |
// Area level hooks |
336 |
+ 'shd_hook_init', // functions to run as soon as main SD initialisation has completed (SD permissions are loaded by here) |
|
336 | 337 |
'shd_hook_helpdesk', // functions to run when starting the main helpdesk (before going off to subactions) |
337 | 338 |
'shd_hook_hdadmin', // functions to run when starting the main SimpleDesk admin area (probably should include via _include_hdadmin) |
338 | 339 |
'shd_hook_hdadminopts', // functions to run when working in the SimpleDesk options submenu structure (probably should include via _include_hdadmin) |
... | ... |
@@ -240,6 +240,7 @@ function shd_init() |
240 | 240 |
} |
241 | 241 |
|
242 | 242 |
$context['shd_plugins'] = empty($modSettings['shd_enabled_plugins']) || empty($modSettings['helpdesk_active']) ? array() : explode(',', $modSettings['shd_enabled_plugins']); |
243 |
+ call_integration_hook('shd_hook_init'); |
|
243 | 244 |
} |
244 | 245 |
|
245 | 246 |
/** |
... | ... |
@@ -46,7 +46,7 @@ elseif (!defined('SMF')) |
46 | 46 |
} |
47 | 47 |
|
48 | 48 |
// Unchecking the option in Core Features. |
49 |
-global $modSettings; |
|
49 |
+global $modSettings, $sourcedir; |
|
50 | 50 |
$modSettings['helpdesk_active'] = false; |
51 | 51 |
$features = implode(',', array_diff(explode(',', $modSettings['admin_features']), array('shd'))); |
52 | 52 |
|
... | ... |
@@ -109,54 +109,24 @@ $smcFunc['db_query']('', ' |
109 | 109 |
); |
110 | 110 |
|
111 | 111 |
// 4. Forcing all SD plugin hooks to be disabled. |
112 |
- |
|
113 | 112 |
$shd_hooks = array( |
114 |
- // Plugin related: general |
|
115 | 113 |
'shd_enabled_plugins', |
116 |
- // Plugin: source load hooks |
|
117 |
- 'shd_include_init', |
|
118 |
- 'shd_include_helpdesk', |
|
119 |
- 'shd_include_hdadmin', |
|
120 |
- 'shd_include_hdprofile', |
|
121 |
- // Plugin: lang load hooks |
|
122 |
- 'shd_includelang_init', |
|
123 |
- 'shd_includelang_helpdesk', |
|
124 |
- 'shd_includelang_hdadmin', |
|
125 |
- 'shd_includelang_hdprofile', |
|
126 |
- // Plugin: general hooks |
|
127 |
- 'shd_hook_actions', |
|
128 |
- 'shd_hook_perms', |
|
129 |
- 'shd_hook_permstemplate', |
|
130 |
- 'shd_hook_prefs', |
|
131 |
- 'shd_hook_newticket', |
|
132 |
- 'shd_hook_newreply', |
|
133 |
- 'shd_hook_modpost', |
|
134 |
- 'shd_hook_assign', |
|
135 |
- 'shd_hook_buffer', |
|
136 |
- 'shd_hook_after_main', |
|
137 |
- 'shd_hook_boardindex_before', |
|
138 |
- 'shd_hook_boardindex_after', |
|
139 |
- // Plugin: menu hooks |
|
140 |
- 'shd_hook_mainmenu', |
|
141 |
- 'shd_hook_profilemenu', |
|
142 |
- 'shd_hook_adminmenu', |
|
143 |
- // Plugin: area hooks |
|
144 |
- 'shd_hook_helpdesk', |
|
145 |
- 'shd_hook_hdadmin', |
|
146 |
- 'shd_hook_hdadminopts', |
|
147 |
- 'shd_hook_hdadminoptssrch', |
|
148 |
- 'shd_hook_hdprofile', |
|
149 | 114 |
); |
115 |
+foreach ($modSettings as $k => $v) |
|
116 |
+ if (strpos($k, 'shd_hook') === 0 || strpos($k, 'shd_include') === 0) |
|
117 |
+ $shd_hooks[] = $k; |
|
150 | 118 |
|
151 | 119 |
$new_hooks = array(); |
152 | 120 |
foreach ($shd_hooks as $hook) |
153 |
-{ |
|
154 | 121 |
$new_hooks[$hook] = ''; |
155 |
-} |
|
122 |
+ |
|
123 |
+// Reset them locally. |
|
156 | 124 |
updateSettings( |
157 | 125 |
$new_hooks, |
158 | 126 |
true |
159 | 127 |
); |
128 |
+ |
|
129 |
+// Purge them finally. |
|
160 | 130 |
$smcFunc['db_query']('', ' |
161 | 131 |
DELETE FROM {db_prefix}settings |
162 | 132 |
WHERE variable IN ({array_string:hooks})', |
163 | 133 |