jdarwood007 commited on 2023-04-13 18:02:47
Showing 4 changed files, with 20 additions and 28 deletions.
... | ... |
@@ -364,7 +364,7 @@ class SFS |
364 | 364 |
if ($response === []) |
365 | 365 |
{ |
366 | 366 |
$this->logAllStats('error', $checks, 'error'); |
367 |
- log_error($this->txt('sfs_request_failure_nodata') . ':' . $requestURL, 'critical'); |
|
367 |
+ log_error($this->txt('sfs_request_failure_nodata') . ':' . $this->buildServerURL(), 'critical'); |
|
368 | 368 |
return true; |
369 | 369 |
} |
370 | 370 |
|
... | ... |
@@ -465,6 +465,7 @@ class SFS |
465 | 465 |
'email' => !empty($this->modSettings['sfs_emailcheck']) && !empty($response['email']) |
466 | 466 |
]; |
467 | 467 |
|
468 |
+ $requestBlocked = ''; |
|
468 | 469 |
foreach ($checkMap as $key => $checkEnabled) |
469 | 470 |
if (empty($requestBlocked) && $checkEnabled) |
470 | 471 |
$requestBlocked = call_user_func(array($this, 'sfsCheck_' . $key), $response[$key], $area); |
... | ... |
@@ -901,7 +902,7 @@ class SFS |
901 | 902 |
// Standard options. |
902 | 903 |
$options = $this->Decode($this->modSettings[$optionsKey]); |
903 | 904 |
|
904 |
- if (empty($options)) |
|
905 |
+ if (empty($options) || !is_array($options)) |
|
905 | 906 |
$options = []; |
906 | 907 |
|
907 | 908 |
// Extras. |
... | ... |
@@ -83,9 +83,9 @@ class SFSA |
83 | 83 |
* @uses integrate__admin_areas - Hook SMF2.1 |
84 | 84 |
* @return void No return is generated |
85 | 85 |
*/ |
86 |
- public static function hook_admin_areas(array &$admin_areas) |
|
86 |
+ public static function hook_admin_areas(array &$admin_areas): void |
|
87 | 87 |
{ |
88 |
- return self::selfClass()->setupAdminAreas($admin_areas); |
|
88 |
+ self::selfClass()->setupAdminAreas($admin_areas); |
|
89 | 89 |
} |
90 | 90 |
|
91 | 91 |
/** |
... | ... |
@@ -152,9 +152,9 @@ class SFSA |
152 | 152 |
* @uses integrate_modify_modifications - Hook SMF2.1 |
153 | 153 |
* @return void No return is generated |
154 | 154 |
*/ |
155 |
- public static function hook_modify_modifications(array &$subActions) |
|
155 |
+ public static function hook_modify_modifications(array &$subActions): void |
|
156 | 156 |
{ |
157 |
- return self::selfClass()->setupModifyModifications($subActions); |
|
157 |
+ self::selfClass()->setupModifyModifications($subActions); |
|
158 | 158 |
} |
159 | 159 |
|
160 | 160 |
/** |
... | ... |
@@ -347,14 +347,6 @@ class SFSA |
347 | 347 |
*/ |
348 | 348 |
public static function hook_manage_registrations(array &$subActions): bool |
349 | 349 |
{ |
350 |
- global $context; |
|
351 |
- |
|
352 |
- // Add our logs sub action. |
|
353 |
- $subActions['sfstest'] = ['SFSA::startupTest', 'admin_forum']; |
|
354 |
- |
|
355 |
- if (isset($_REQUEST['sa']) && $_REQUEST['sa'] == 'sfstest' && allowedTo('admin_forum')) |
|
356 |
- $context['sub_action'] = 'sfstest'; |
|
357 |
- |
|
358 | 350 |
return self::selfClass()->AddToRegCenterMenu($subActions); |
359 | 351 |
} |
360 | 352 |
|
... | ... |
@@ -371,6 +363,12 @@ class SFSA |
371 | 363 |
*/ |
372 | 364 |
public function AddToRegCenterMenu(array &$subActions): bool |
373 | 365 |
{ |
366 |
+ // Add our logs sub action. |
|
367 |
+ $subActions['sfstest'] = ['SFSA::startupTest', 'admin_forum']; |
|
368 |
+ |
|
369 |
+ if (isset($_REQUEST['sa']) && $_REQUEST['sa'] == 'sfstest' && allowedTo('admin_forum')) |
|
370 |
+ $this->context['sub_action'] = 'sfstest'; |
|
371 |
+ |
|
374 | 372 |
$this->context[$this->context['admin_menu_name']]['tab_data']['tabs']['sfstest'] = [ |
375 | 373 |
'description' => $this->SFSclass->txt('sfs_admin_test_desc'), |
376 | 374 |
]; |
... | ... |
@@ -395,7 +393,7 @@ class SFSA |
395 | 393 |
*/ |
396 | 394 |
public static function startupTest(bool $return_config = false): array |
397 | 395 |
{ |
398 |
- return self::selfClass()->loadTestAPI(); |
|
396 |
+ return self::selfClass()->loadTestAPI($return_config); |
|
399 | 397 |
} |
400 | 398 |
|
401 | 399 |
/** |
... | ... |
@@ -150,7 +150,7 @@ class SFSB |
150 | 150 |
$id_ban_group = $this->getBanGroup(); |
151 | 151 |
if (!empty($id_ban_group)) |
152 | 152 |
{ |
153 |
- updateSettings(['sfs_ipcheck_autoban_group' => $ban_data['id_ban_group']]); |
|
153 |
+ updateSettings(['sfs_ipcheck_autoban_group' => $id_ban_group]); |
|
154 | 154 |
return true; |
155 | 155 |
} |
156 | 156 |
|
... | ... |
@@ -198,7 +198,6 @@ class SFSB |
198 | 198 |
*/ |
199 | 199 |
private function getBanGroup(): ?int |
200 | 200 |
{ |
201 |
- $ban_group_id = null; |
|
202 | 201 |
// Maybe just got unlinked, if we can find the matching name, relink it. |
203 | 202 |
$request = $this->smcFunc['db_query']('', ' |
204 | 203 |
SELECT id_ban_group |
... | ... |
@@ -215,14 +214,12 @@ class SFSB |
215 | 214 |
$this->smcFunc['db_free_result']($request); |
216 | 215 |
|
217 | 216 |
if (!empty($ban_data['id_ban_group'])) |
218 |
- { |
|
219 |
- $ban_group_id = $ban_data['id_ban_group']; |
|
220 |
- return true; |
|
221 |
- } |
|
217 |
+ return $ban_data['id_ban_group']; |
|
222 | 218 |
} |
219 |
+ else |
|
223 | 220 |
$this->smcFunc['db_free_result']($request); |
224 | 221 |
|
225 |
- return $ban_group_id; |
|
222 |
+ return null; |
|
226 | 223 |
} |
227 | 224 |
|
228 | 225 |
/** |
... | ... |
@@ -170,10 +170,6 @@ class SFSP |
170 | 170 |
$cache_key = 'sfs_check_member-' . $this->memID; |
171 | 171 |
|
172 | 172 |
// Do we have a message? |
173 |
- $poster_name = null; |
|
174 |
- $poster_email = null; |
|
175 |
- $poster_ip = null; |
|
176 |
- $post_body = null; |
|
177 | 173 |
if (isset($_GET['msg']) && intval($_GET['msg']) > 0) |
178 | 174 |
{ |
179 | 175 |
$row = $this->TrackSFSMessage((int) $_GET['msg']); |
... | ... |
@@ -285,8 +281,8 @@ class SFSP |
285 | 281 |
// Now we have a URL, lets go get it. |
286 | 282 |
$result = fetch_web_data('https://www.stopforumspam.com/add', $post_data); |
287 | 283 |
|
288 |
- if (strpos($result, 'data submitted successfully') === false) |
|
289 |
- $this->context['submission_failed'] = $this->txt('sfs_submission_error'); |
|
284 |
+ if ($result === false || strpos($result, 'data submitted successfully') === false) |
|
285 |
+ $this->context['submission_failed'] = $this->SFSclass->txt('sfs_submission_error'); |
|
290 | 286 |
elseif (isset($_POST['sfs_submitban'])) |
291 | 287 |
redirectexit($this->scripturl . '?action=admin;area=ban;sa=add;u=' . $this->memID); |
292 | 288 |
else |
293 | 289 |