-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathsfs_hooks_install.php
53 lines (45 loc) · 1.74 KB
/
sfs_hooks_install.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
<?php
/**
* The Main class for Stop Forum Spam
* @package StopForumSpam
* @author SleePy <sleepy @ simplemachines (dot) org>
* @copyright 2023
* @license 3-Clause BSD https://opensource.org/licenses/BSD-3-Clause
*/
// If we have found SSI.php and we are outside of SMF, then we are running standalone.
if (file_exists(dirname(__FILE__) . '/SSI.php') && !defined('SMF')) {
require_once dirname(__FILE__) . '/SSI.php';
} elseif (file_exists(getcwd() . '/SSI.php') && !defined('SMF')) {
require_once getcwd() . '/SSI.php';
} elseif (!defined('SMF')) { // If we are outside SMF and can't find SSI.php, then throw an error
die('<b>Error:</b> Cannot install - please verify you put this file in the same place as SMF\'s SSI.php.');
}
if (SMF == 'SSI') {
db_extend('packages');
}
$hooks = [
// Main sections.
'integrate_pre_include' => '$sourcedir/StopForumSpam.php',
'integrate_pre_load' => 'SFS::hook_pre_load',
'integrate_register' => 'SFS::hook_register',
// Admin Sections.
'integrate_admin_include' => '$sourcedir/StopForumSpam/SFS-Admin.php',
'integrate_admin_areas' => 'SFSA::hook_admin_areas',
'integrate_modify_modifications' => 'SFSA::hook_modify_modifications',
'integrate_manage_logs' => 'SFSL::hook_manage_logs',
// Profile Section.
'integrate_profile_areas' => 'SFSP::hook_pre_profile_areas',
];
foreach ($hooks as $hook => $func) {
add_integration_function($hook, $func, true);
}
// Remove old hooks.
$removeHooks = [
['integrate_manage_logs', 'SFSA::hook_manage_logs'],
['integrate_pre_include', '$sourcedir/SFS.php'],
['integrate_admin_include', '$sourcedir/SFS-Subs-Admin.php'],
['integrate_profile_areas', 'SFS::hook_pre_profile_areas'],
];
foreach ($removeHooks as $remove) {
remove_integration_function($remove[0], $remove[1]);
}