jdarwood007 commited on 2021-02-13 08:27:36
Showing 2 changed files, with 16 additions and 17 deletions.
... | ... |
@@ -3,14 +3,14 @@ error_reporting(E_ALL); |
3 | 3 |
|
4 | 4 |
// Hopefully we have the goodies. |
5 | 5 |
if (file_exists(dirname(__FILE__) . '/SSI.php') && !defined('SMF')) |
6 |
-{ |
|
7 |
- $using_ssi = true; |
|
8 | 6 |
require_once(dirname(__FILE__) . '/SSI.php'); |
9 |
-} |
|
10 | 7 |
elseif (!defined('SMF')) |
11 | 8 |
exit('<b>Error:</b> Cannot install - please verify you put this in the same place as SMF\'s index.php.'); |
12 | 9 |
|
13 |
-global $db_prefix, $modSettings, $func, $smcFunc; |
|
10 |
+global $smcFunc; |
|
11 |
+ |
|
12 |
+// SSI may not present the database extension, while being ran via package manager does. |
|
13 |
+db_extend('packages'); |
|
14 | 14 |
|
15 | 15 |
// Fields to add |
16 | 16 |
$new_fields = array( |
... | ... |
@@ -37,20 +37,20 @@ $changed_fields = array( |
37 | 37 |
); |
38 | 38 |
|
39 | 39 |
// Load up the board info, we will only add these once. |
40 |
-$table_columns = $smcFunc['db_list_columns']($db_prefix . 'ban_items'); |
|
40 |
+$table_columns = $smcFunc['db_list_columns']('{db_prefix}ban_items'); |
|
41 | 41 |
|
42 | 42 |
// Do the loopy, loop, loe. |
43 | 43 |
foreach ($new_fields as $column_name => $column_attributes) |
44 | 44 |
if (!in_array($column_name, $table_columns)) |
45 |
- $smcFunc['db_add_column']($db_prefix . 'ban_items', $column_attributes); |
|
45 |
+ $smcFunc['db_add_column']('{db_prefix}ban_items', $column_attributes); |
|
46 | 46 |
|
47 | 47 |
// Do the loopy, loop, loe. |
48 | 48 |
foreach ($changed_fields as $column_name => $column_attributes) |
49 |
- $smcFunc['db_change_column']($db_prefix . 'ban_items', $column_attributes); |
|
49 |
+ $smcFunc['db_change_column']('{db_prefix}ban_items', $column_attributes); |
|
50 | 50 |
|
51 | 51 |
// Find any IPv6 bans and reenable them again. |
52 | 52 |
// !!! Note, We changed is_ipv6 to the time stamp of when it is supposed of expired, 1 if it was a perm ban. |
53 |
-$result = $smcFunc['db_query']('', ' |
|
53 |
+$request = $smcFunc['db_query']('', ' |
|
54 | 54 |
SELECT id_ban_group, is_ipv6 |
55 | 55 |
FROM {db_prefix}ban_items |
56 | 56 |
WHERE is_ipv6 < {int:is_ipv6}', |
... | ... |
@@ -94,7 +94,7 @@ $smcFunc['db_query']('', ' |
94 | 94 |
)); |
95 | 95 |
|
96 | 96 |
// Handle our lost bans. |
97 |
-if (!empty($lost_bans) && !empty($using_ssi)) |
|
97 |
+if (!empty($lost_bans) && SMF === 'SSI') |
|
98 | 98 |
echo 'We had some bans that we could not properly enable. Please check these ban ids:', implode(', ', $lost_bans), '<br />'; |
99 | 99 |
|
100 | 100 |
// For debugging/support purposes. |
... | ... |
@@ -104,5 +104,5 @@ log_error('Lost bans during IPV6 re-enabling:', implode(', ', $lost_bans), 'crit |
104 | 104 |
// Update our ban time, forcing rechecks to occur. |
105 | 105 |
updateSettings(array('banLastUpdated' => time())); |
106 | 106 |
|
107 |
-if(!empty($using_ssi)) |
|
107 |
+if (SMF === 'SSI') |
|
108 | 108 |
echo 'If no errors, Success!'; |
109 | 109 |
\ No newline at end of file |
... | ... |
@@ -3,17 +3,17 @@ error_reporting(E_ALL); |
3 | 3 |
|
4 | 4 |
// Hopefully we have the goodies. |
5 | 5 |
if (file_exists(dirname(__FILE__) . '/SSI.php') && !defined('SMF')) |
6 |
-{ |
|
7 |
- $using_ssi = true; |
|
8 | 6 |
require_once(dirname(__FILE__) . '/SSI.php'); |
9 |
-} |
|
10 | 7 |
elseif (!defined('SMF')) |
11 | 8 |
exit('<b>Error:</b> Cannot install - please verify you put this in the same place as SMF\'s index.php.'); |
12 | 9 |
|
13 |
-global $db_prefix, $modSettings, $func, $smcFunc; |
|
10 |
+global $smcFunc; |
|
11 |
+ |
|
12 |
+// SSI may not present the database extension, while being ran via package manager does. |
|
13 |
+db_extend('packages'); |
|
14 | 14 |
|
15 | 15 |
// Find any IPv6 bans. |
16 |
-$result = $smcFunc['db_query']('', ' |
|
16 |
+$request = $smcFunc['db_query']('', ' |
|
17 | 17 |
SELECT bi.id_ban_group, bi.is_ipv6, bg.expire_time |
18 | 18 |
FROM {db_prefix}ban_items AS bi |
19 | 19 |
INNER JOIN {db_prefix}ban_groups AS bg ON (bi.id_ban_group = bg.id_ban_group) |
... | ... |
@@ -51,6 +51,5 @@ $smcFunc['db_query']('', ' |
51 | 51 |
// Update our ban time, forcing rechecks to occur. |
52 | 52 |
updateSettings(array('banLastUpdated' => time())); |
53 | 53 |
|
54 |
-if(!empty($using_ssi)) |
|
54 |
+if (SMF === 'SSI') |
|
55 | 55 |
echo 'If no errors, Success!'; |
56 | 56 |
\ No newline at end of file |
57 |
-?> |
|
58 | 57 |
\ No newline at end of file |
59 | 58 |